gsc_hpdi_auto_attach does not affect interrupt status but contains a
call to comedi_alloc_devpriv() which calls kzalloc with GFP_KERNEL flag.
Thus, there seems to be no danger that dma_alloc_coherent can be called
with interrupts turned off, and GFP_KERNEL can be used.
Sandhya Bankar [Sun, 6 Mar 2016 10:20:35 +0000 (15:50 +0530)]
Staging: most: Use usb_endpoint_dir_in(endpoint) instead of (endpoint->bEndpointAddress & USB_DIR_IN).
Use usb_endpoint_dir_in(endpoint) instead of (endpoint->bEndpointAddress & USB_DIR_IN) to check if the endpoint has IN direction.
This correction is based on following semantic patch,
Bhumika Goyal [Sat, 5 Mar 2016 13:46:40 +0000 (19:16 +0530)]
Staging: most: Replace pr_err with dev_err
All devm functions has a device structure as the first argument which is
required by dev_{err,info,dbg} printing functions.
This patch converts pr_err to dev_err as dev_* is preferred after calls
to devm functions.
Rehas Sachdeva [Fri, 26 Feb 2016 12:57:05 +0000 (18:27 +0530)]
staging: vt6656: Remove unnecessary parentheses
This patch removes the following checkpatch.pl warnings:
Unnecessary parentheses around al7230_init_table_amode[0][0]
Unnecessary parentheses around al7230_channel_table2[0][0]
James Simmons [Tue, 8 Mar 2016 22:35:29 +0000 (17:35 -0500)]
staging: lustre: make lustre dependent on LNet
In the case of lustre routers you only need a functioning
LNet stack. Especially since often the routers are very
light weight and want to avoid any addition software that
would create additional pressures on the system.
Signed-off-by: James Simmons <jsimmons@infradead.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
A few errors exist for the Kconfig option LNET_MAX_PAYLOAD. First
mistake is the default size is 1MB not 2MB as it is shown to the
person configuring the kernel. Second the LNET_MAX_PAYLOAD option
is more closely related to LNET than the LUSTRE_FS option.
Signed-off-by: James Simmons <jsimmons@infradead.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
James Simmons [Tue, 8 Mar 2016 22:35:26 +0000 (17:35 -0500)]
staging: lustre: move libcfs to lnet layer
The lustre file system has a layered architecture with
libcfs as the lowest layer and LNet layered on top. Then
on top of LNet we run the lustre client. This patch moves
the libcfs module code out of lustre into the lnet tree.
This fits into the long term goal of eventually merging
libcfs into LNet.
Signed-off-by: James Simmons <jsimmons@infradead.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
James Simmons [Mon, 7 Mar 2016 23:10:24 +0000 (18:10 -0500)]
staging: lustre: make LNet use lprocfs_call_handler
Sometime ago a patch was submitted to duplicate the
proc_call_handler code in the LNet layer. This was
due to the thinking libcfs was not used by the LNet
layer. This was a wrong assumption so lets make LNet
use the lprocfs_call_handler from the libcfs layer.
Signed-off-by: James Simmons <jsimmons@infradead.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
James Nunez [Mon, 7 Mar 2016 23:10:21 +0000 (18:10 -0500)]
staging: lustre: Correct missing newline
Several error messages are missing newline characters
at the end of the message. Newlines are added where
necessary and other minor corrections; no punctuation
at the end of an error message, add a return code to
the end of error messages, device name at the beginning,
etc.
There are just a couple of places where newlines are
removed and this is only in LDLM_DEBUG_NOLOCK. The definition
of LDLM_DEBUG_NOLOCK already has a newline in it and
resulted in double newlines printed.
Signed-off-by: James Nunez <james.a.nunez@intel.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-4871
Reviewed-on: http://review.whamcloud.com/10000 Reviewed-by: Andreas Dilger <andreas.dilger@intel.com> Reviewed-by: John L. Hammond <john.hammond@intel.com> Reviewed-by: Cliff White <cliff.white@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
staging: lustre: fix 'data race condition' issue in framework.c
Fix 'data race condition' defects found by Coverity version 6.5.0:
Data race condition (MISSING_LOCK)
Accessing variable without holding lock. Elsewhere,
this variable is accessed with lock held.
Signed-off-by: Sebastien Buisson <sbuisson@ddn.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-2744
Reviewed-on: http://review.whamcloud.com/6568 Reviewed-by: Bob Glossman <bob.glossman@intel.com> Reviewed-by: Andreas Dilger <andreas.dilger@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Fix 'NULL pointer dereference' defects found by Coverity version
6.5.3:
Dereference after null check (FORWARD_NULL)
For instance, Passing null pointer to a function which dereferences
it.
Dereference before null check (REVERSE_INULL)
Null-checking variable suggests that it may be null, but it has
already been dereferenced on all paths leading to the check.
Dereference null return value (NULL_RETURNS)
The following fixes for the LNet layer are broken out of patch
http://review.whamcloud.com/4720.
staging: lustre: fix 'data race condition' issue in conrpc.c
Fix 'data race condition' defects found by Coverity version 6.5.0:
Data race condition (MISSING_LOCK)
Accessing variable without holding lock. Elsewhere,
this variable is accessed with lock held.
Liang Zhen [Mon, 7 Mar 2016 23:10:16 +0000 (18:10 -0500)]
staging: lustre: LNet drop rule implementation
This is implementation of LNet Drop Rule, which can randomly drop
LNet messages at specified rate.
LNet Drop Rule can only be applied to receive side of message. User
can add drop_rule either on end point of cluster (client/server) or
on LNet routers.
Here are lctl command to control LNet Drop Rules:
- net_drop_add -s SRC_NID -d DEST_NID --rate VALUE
drop 1/@VALUE of messages from @SRC_NID to @DEST_NID
- net_drop_del -s SRC_NID -d DEST_NID
remove all drop rules from @SRC_NID to @DEST_NID
- net_drop_list
list all drop rules on current node
Examples:
- lctl net_drop_add -s *@o2ib0 -d 192.168.1.102@tcp 1000
add new drop rule, it will drop 1/1000 messages from network o2ib0
to 192.168.1.102@tcp
- lctl net_drop_add -s 10.8.6.123@o2ib1 -d * 500
add new drop rule, it will drop 1/500 messages from 10.8.6.123@o2ib1
to all nodes
Signed-off-by: Liang Zhen <liang.zhen@intel.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-5435
Reviewed-on: http://review.whamcloud.com/11314 Reviewed-by: Bobi Jam <bobijam@gmail.com> Reviewed-by: Amir Shehata <amir.shehata@intel.com> Reviewed-by: Johann Lombardi <johann.lombardi@intel.com> Reviewed-by: Oleg Drokin <oleg.drokin@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Arnd Bergmann [Wed, 2 Mar 2016 19:06:46 +0000 (20:06 +0100)]
isdn: i4l: move active-isdn drivers to staging
The icn, act2000 and pcbit drivers are all for very old hardware,
and it is highly unlikely that anyone is actually still using them
on modern kernels, if at all.
All three drivers apparently are for hardware that predates PCI
being the common connector, as they are ISA-only and active
PCI ISDN cards were widely available in the 1990s.
Looking through the git logs, it I cannot find any indication of a
patch to any of these drivers that has been tested on real hardware,
only cleanups or global API changes.
Arnd Bergmann [Wed, 2 Mar 2016 19:06:45 +0000 (20:06 +0100)]
isdn: icn: remove a #warning
The icn driver currently produces an unconditional #warning whenever
we build it, introduced by Karsten Keil back in 2003:
#warning TODO test headroom or use skb->nb to flag ACK
Karsten's original commit (from BitKeeper) contains this description:
- here are lot of bugs left, so ISDN is not stable yet but
I think it's really time to fix it, even if it need some cycles
to get it right (normally I'm only send patches if it works 100% for
me).
- I add some additional #warnings to address places which need fixing
(I hope that some of the other ISDN developer jump in)
Apparently this has not happened, and it is unlikely that it ever will,
given that the driver doesn't seem to work. No substantial bug fixes
other than janitorial cleanups have happened in the driver since then,
and I see no indication that anyone who patched it had the hardware.
We should probably either remove the driver, or remove all of i4l,
but for now, this shuts up the distracting #warning by turning it
into a comment.
Ian Abbott [Wed, 2 Mar 2016 14:27:38 +0000 (14:27 +0000)]
staging: comedi: comedi.h: Fix comment for struct comedi_krange
The kernel-doc comment for `struct comedi_krange` refers to the macro
constant `RF_external`. It should be `RF_EXTERNAL`, so fix it. It also
documents the value of the constant as `(1 << 8)`, but the macro now
expands to the hexadecimal constant `0x100`, so use that as the
documented value.
Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Ian Abbott [Wed, 2 Mar 2016 14:27:37 +0000 (14:27 +0000)]
staging: comedi: comedi.h: Do not use BIT macro
The "comedi.h" file is part of the user API for COMEDI devices, and is
intended to be migrated to "include/uapi/linux". The `BIT` macro from
"include/linux/bitops.h" should not be used there.
Replace the use of the `BIT` macro with hexadecimal constants of the
same value. The `BIT` macro replaced expressions of the form `(1 << N)`
in this file originally, but reverting back to that form would encourage
patches changing them back to use the `BIT` macro.
Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Bhumika Goyal [Sun, 28 Feb 2016 07:58:47 +0000 (13:28 +0530)]
Staging: comedi: s626.c: Remove unused functions
The functions s626_get_clk_mult, s626_get_clk_mult, s626_get_enc_mode,
s626_set_index_pol are not used anywhere in the kernel so they can be
removed. This also cleans the code. Grepped to find the occurences.
alloc_and_init_dma_members does not affect the interrupt status and is
only called by auto_attach, which also does not affect the interrupt
status. auto_attach() also contains a call to comedi_alloc_devpriv()
which calls kzalloc with GFP_KERNEL flag. Thus, there seems to be no
danger that dma_alloc_coherent can be called with interrupts turned
off, and GFP_KERNEL can be used.
Bhumika Goyal [Tue, 1 Mar 2016 19:43:22 +0000 (01:13 +0530)]
Staging: gdm724x: Replace random_ether_addr with eth_random_addr
The macro random_ether_addr is calling the function eth_random_addr.
Therefore, the call to random_ether_addr can be replaced with
eth_random_addr.
Done using coccinelle:
Bhumika Goyal [Fri, 26 Feb 2016 10:04:32 +0000 (15:34 +0530)]
Staging: gdm724x: Use min instead of ternary operator
This patch replaces ternary operator with macro min as it shorter and
thus increases code readability. Macro min return the minimum of the
two compared values.
Made a semantic patch for changes:
@@
type T;
T x;
T y;
@@
(
- x < y ? x : y
+ min(x,y)
|
- x > y ? x : y
+ max(x,y)
)
With concurrency managed workqueues, use of dedicated workqueues
can be replaced by using system_wq. Drop usb_tx_wq and usb_rx_wq
by using system_wq.
Since there are multiple work items per udev but different udevs
do not need to be ordered, increase of concurrency level by
switching to system_wq should not break anything.
cancel_work_sync() is used to ensure that work is not pending or
executing on any CPU.
Lastly, since all devices are suspended, which shutdowns the work
items before the driver can be unregistered, it is guaranteed
that no work item is pending or executing by the time exit path
runs.
Dan Carpenter [Mon, 22 Feb 2016 19:33:09 +0000 (22:33 +0300)]
Staging: gdm72xx: underflow bug in gdm_wimax_ioctl_get_data()
"size" here should be unsigned, otherwise we might end up trying to copy
negative bytes in gdm_wimax_ioctl_get_data() resulting in an information
leak.
Reported-by: Alan Cox <gnomes@lxorguk.ukuu.org.uk> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Dan Carpenter [Mon, 22 Feb 2016 19:31:31 +0000 (22:31 +0300)]
Staging: gdm72xx: silence underflow warning in netlink_send()
The value of "group" comes from "idx" in __gdm_wimax_event_send():
if (sscanf(e->dev->name, "wm%d", &idx) == 1)
Smatch marks sscanf values as user controlled. It's supposed to be a
number in 0-30 range. We cap the upper bound but allow negatives. Fix
this by making it type u16 instead.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Dan Carpenter [Mon, 22 Feb 2016 19:30:46 +0000 (22:30 +0300)]
staging: gdm72xx: underflow in netlink_rcv_cb()
If nlh->nlmsg_len is less than ND_IFINDEX_LEN we end up trying to memcpy
a negative size. I also re-ordered slighty the condition to make it
more uniform.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Alan [Mon, 15 Feb 2016 18:58:10 +0000 (18:58 +0000)]
rtl871x: avoid running off end of buffer
If 32 bytes of non zero are passed in pdata->pointer then the mac_pton
function will run off the end of the buffer. Make sure we always have a
terminated string kernel side.
Signed-off-by: Alan Cox <alan@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
staging: speakup: Remove unnecessary test in if condition
Remove unnecessary test on synth->alive since it has already been
tested previously.
This fixes the following smatch warning:
drivers/staging/speakup/synth.c:182 spk_synth_is_alive_restart() warn:
we tested 'synth->alive' before and it was 'false'
James Simmons [Thu, 3 Mar 2016 16:00:58 +0000 (11:00 -0500)]
staging: lustre: handle complex strings in cfs_str2num_check
Originally the function cfs_str2num_check used simple_strtoul
but has been updated to kstrtoul. The string passed into
cfs_str2num_check can be a very complex, for example we could
have 10.37.202.[59-61]. When simple_strtoul was used the first
number until we hit a non-digit character could be extracted
but testing showed that kstrtoul will not return any value if
it detects any non-digit character. Because of this change in
behavior a different approach is needed to handle these types
of complex strings. The use of sscanf was investigated to see
if it could be used to extract numbers from the passed in
string but unlike its glibc counterpart the kernel version
also just reported a error with no results if a non-digit value
in the string was encountered. Another possible approach would
be to use __parse_int directly but that class of functions is
not exported by the kernel. So the approach in this patch is
to scan the string passed in for the first non-digit character
and replace that character with a '\0' so kstrtoul can be used.
Once completed the original character is restored. We also
restore a original behavior that was removed to return 0 when
we encounter any non digit character before the nob count.
Signed-off-by: James Simmons <jsimmons@infradead.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Liang Zhen [Wed, 2 Mar 2016 23:53:30 +0000 (18:53 -0500)]
staging: lustre: do less intense allocating retry for ko2iblnd
ko2iblnd may retry too frequent for growing pools, all schedulers
are spinning if another thread is in progress of allocating a new
pool and can't finish right away because of high system load.
Liang Zhen [Wed, 2 Mar 2016 23:53:29 +0000 (18:53 -0500)]
staging: lustre: avoid intensive reconnecting for ko2iblnd
When there is a connection race between two nodes and one side
of the connection is rejected by the other side. o2iblnd will
reconnect immediately, this is going to generate a lot of
trashes if:
- race winner is slow and can't send out connecting request
in short time.
- remote side leaves a cmid in TIMEWAIT state, which will reject
future connection requests
To resolve this problem, this patch changed the reconnection
behave: reconnection is submitted by connd only if a zombie
connection is being destroyed and there is a pending
reconnection request for the corresponding peer.
Also, after a few rejections, reconnection will have a time
interval between each attempt.
Liang Zhen [Wed, 2 Mar 2016 23:53:28 +0000 (18:53 -0500)]
staging: lustre: check wr_id returned by ib_poll_cq
If ib_poll_cq returned +ve without initialising ib_wc::wr_id (bug
in driver), then o2iblnd will run into unpredictable situation
because ib_wc::wr_id may refer to stale tx/rx pointer in stack.
It indicates bug in HCA driver if this happened, ko2iblnd should
output console error then close current connection.
Doug Oucharek [Wed, 2 Mar 2016 23:53:27 +0000 (18:53 -0500)]
staging: lustre: Change connect peer failed cleanup order
A race condition has been found where connd is cleaning up failed
connections, the peer ref counter goes to zero, but we stil have
a connecting counter > 0.
One possible race is when we are retrying a connection by
calling kiblnd_connect_peer() which itself fails and decrements
the peer ref counter and gets swapped out before it can decrement
the connecting counter. connd swaps in and cleans up the
connection where it sees a peer ref counter of 1 and a connecting
counter of 1. This will trigger the assert seen in LU-7210 when
it decrements the peer counter.
The solution: be sure to decrement the connecting counter
before decrementing the peer counter in the peer connect
failure path.
Liang Zhen [Wed, 2 Mar 2016 23:53:26 +0000 (18:53 -0500)]
staging: lustre: take extra refcount in kiblnd_connreq_done
refcount taken by cmid is not reliable after kiblnd_connreq_done
released the glock because this connection is visible to other
threads, another thread can find and close this connection right
after kiblnd_connreq_done released the glock, if kiblnd_cm_callback
for RDMA_CM_EVENT_DISCONNECTED is called, it can release the
connection refcount taken by cmid. It means the connection could be
destroyed before kiblnd_connreq_done() finish operations on it.
Amir Shehata [Wed, 2 Mar 2016 23:53:25 +0000 (18:53 -0500)]
staging: lustre: make ko2iblnd connect parameters persistent
Store map-on-demand and peertx credits in the peer, since the peer
is persistent. Also made sure that when assigning the parameters
received on the connection to the peer structure through create,
that if another peer is added before grabbing the lock we assign
these parameters to it as well.
Bhumika Goyal [Wed, 2 Mar 2016 19:16:37 +0000 (00:46 +0530)]
Staging: lustre: lnet: Remove and rename struct typedefs
Remove typedefs from structures stt_timer_t and lst_ping_data_t as typedef
for a structure type is not preferred. The suffix '_t' and the typedefs
are removed using coccinelle.
Script 1:
//Drop typedefs and '_t'
@r1@
type T;
@@
typedef struct { ... } T;
@script:python c1@
T2;
T << r1.T;
@@
if T[-2:] =="_t":
coccinelle.T2 = T[:-2];
print T
else:
coccinelle.T2=T;