Haggai Eran [Sat, 23 May 2015 20:13:51 +0000 (23:13 +0300)]
staging: rtl8712: prevent buffer overrun in recvbuf2recvframe
With an RTL8191SU USB adaptor, sometimes the hints for a fragmented
packet are set, but the packet length is too large. Allocate enough
space to prevent memory corruption and a resulting kernel panic [1].
Sudip Mukherjee [Fri, 15 May 2015 09:19:39 +0000 (14:49 +0530)]
staging: rtl8712: fix stack dump
del_timer_sync() is not to be called in the interrupt context unless
the timer is irqsafe. but most of the functions where commits 6501c8e7d86cca5f and 382d020f4459cd77 touched were called in interrupt
context. And as a result the WARN_ON was getting triggered. Changed
to del_timer() in places which were called from interrupt.
Fixes: 382d020f4459cd77 ("Staging: rtl8712: Eliminate use of _cancel_timer" Fixes: 6501c8e7d86cca5f ("Staging: rtl8712: Eliminate use of _cancel_timer_ex") Fixes: https://bugzilla.kernel.org/show_bug.cgi?id=97711 Reported-by: Arek Rusniak <arek.rusi@gmail.com> Tested-by: Arek Rusniak <arek.rusi@gmail.com> Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This patch fixes the leak, which was present in fwserial driver in the
init function. In case the tty driver allocation failed the function
returned error, leaving debugfs entry in the filesystem.
To fix the issue additional error label was added, so that the code will
jump to it in case of allocation failure, and free debugfs entries.
Signed-off-by: Vladimirs Ambrosovs <rodriguez.twister@gmail.com> Reviewed-by: Peter Hurley <peter@hurleysoftware.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Jagan Teki [Mon, 18 May 2015 16:32:45 +0000 (22:02 +0530)]
staging: rtl8712: Use ether_addr_copy() instead of memcpy()
Fixes Warning encounter this by applying checkpatch.pl against this file:
Prefer ether_addr_copy() over memcpy() if the Ethernet addresses
are __aligned(2)
- pnetdev->dev_addr
dev_addr is interface address infor from generic net_device structure
which is properly aligned and have some patches with this change as well.
"staging: rtl8712: fix Prefer ether_addr_copy() over memcpy()"
(sha1: 36e4d8826b317080e283e4edd08bf8d5ac706f38)
Signed-off-by: Jagan Teki <jteki@openedev.com> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Cc: Larry Finger <Larry.Finger@lwfinger.net> Cc: Florian Schilhabel <florian.c.schilhabel@googlemail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Dan Carpenter [Tue, 19 May 2015 12:25:24 +0000 (15:25 +0300)]
staging: slicoss: restore IRQs correctly after slic_cmdq_reset()
We can't save two different values in "flags" so it means that IRQs are
not enabled properly at the end of this function. This isn't a problem
in the current code because it's always called with IRQs disabled so we
don't want to enable them at the end.
This bug is old but it's thanks to David Matlack's recent cleanups that
Smatch can detect it.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Reviewed-by: David Matlack <dmatlack@google.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Jaime Arrocha [Tue, 26 May 2015 18:14:05 +0000 (13:14 -0500)]
staging: gdm724x: Remove test for host endian
gdm_endian.c: small changes were done to remove testing for host
endianness and in-driver conversion for byte-ordering.
The linux/kernel.h functions are used now.
gdm_endian.h: removal of code no longer needed with changes
in gdm_endian.c.
staging: rts5208: pass timeout as HZ independent value
schedule_timeout takes a timeout in jiffies but the code currently is
passing in a constant POLLING_INTERVAL which makes this timeout HZ
dependent, so pass it through msecs_to_jiffies() to fix this up.
patch was compile tested for x86_64_defconfig + CONFIG_STAGING=y,
CONFIG_RTS5208=m
Patch is against 4.0-rc5 (localversion-next is -next-20150527)
Signed-off-by: Nicholas Mc Guire <hofrat@osadl.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
As the first argument of gf_write64() was of type unsigned long, and as
some calls to gf_write64() were casting the first argument from void *
to u64 the compiler and/or sparse were printing warnings for casts of
wrong sizes when compiling for i386.
This patch changes the type of the first argument of gf_write64() to
const void *, and update calls to the function. This change fixed the
warnings and allowed to remove casts from 3 calls to gf_write64().
In addition gf_write64() was renamed to gf_write_ptr() as the name was
misleading because it only writes 32 bits on 32 bit systems.
gf_write_dma_addr() was added to handle dma_addr_t values which is
used at drivers/staging/goldfish/goldfish_audio.c.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Peter Senna Tschudin <peter.senna@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Simon Guo [Sat, 30 May 2015 08:10:46 +0000 (16:10 +0800)]
STAGING: Declare request_cache as static for drivers/staging/lustre/lustre/ptlrpc/client.c
Declare request_cache variable as static. It is only used by
drivers/staging/lustre/lustre/ptlrpc/client.c, and its naming is common
which will lead to namespace pollution.
Signed-off-by: Simon Guo <wei.guo.simon@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Oleg Drokin [Thu, 21 May 2015 19:32:18 +0000 (15:32 -0400)]
staging/lustre/llite: make llite/lov and lmv symlinks
old proc code had /proc/sys/fs/lustre/llite/.../lov and lmv
dirs that contained name of the dir in lustre/lov and lustre/lmv
to better be able to find correct obd device there, but
I imagien a better solution would be to just create a symlink with
the same name. The name is then pointless and the target dir would
have uuid file just as if it was the old-style dir.
Oleg Drokin [Thu, 21 May 2015 19:32:10 +0000 (15:32 -0400)]
staging/lustre/ptlrpc: move procfs high_priority_ratio file to sysfs
Move ptlrpc service high_priority_ratio entry from procfs to sysfs.
Currently in use only by ldlm callback service only in
/sys/fs/lustre/ldlm/services/ldlm_cbd/
Oleg Drokin [Thu, 21 May 2015 19:32:09 +0000 (15:32 -0400)]
staging/lustre/ptlrpc: move procfs threads* files to sysfs
Move ptlrpc service threads_min, threads_max and threads_running
entries from procfs to sysfs.
Currently in use only by ldlm callback service only in
/sys/fs/lustre/ldlm/services/ldlm_cbd/
Oleg Drokin [Thu, 21 May 2015 19:32:05 +0000 (15:32 -0400)]
staging/lustre/ldlm: move procfs ldlm pool stats to sysfs
Suitable contents of /proc/fs/lustre/ldlm/namespaces/.../pools/
is moved to /sys/fs/lustre/ldlm/namespaces/.../pools/:
cancel_rate grant_plan grant_speed lock_volume_factor
server_lock_volume granted grant_rate limit recalc_period
Oleg Drokin [Thu, 21 May 2015 19:32:03 +0000 (15:32 -0400)]
staging/lustre/ldlm: remove server-side congested locks support
This code only makes sense on the server, also while we are at it
drop registration of server-side procfs values and
as all client side values were already moved to sysfs - also
drop now unused procfs helpers.
Since Lustre 2.5, cookiesize is unused on the clients since
MDS now does final object unlink by itself, so drop these
max_cookiesize and default_cookiesize files.
staging: xgifb: use arch_phys_wc_add() and ioremap_wc()
The same area used for ioremap() is used for the MTRR area.
Convert the driver from using the x86 specific MTRR code to
the architecture agnostic arch_phys_wc_add(). arch_phys_wc_add()
will avoid MTRR if write-combining is available, in order to
take advantage of that also ensure the ioremap'd area is requested
as write-combining.
There are a few motivations for this:
a) Take advantage of PAT when available
b) Help bury MTRR code away, MTRR is architecture specific and on
x86 its replaced by PAT
c) Help with the goal of eventually using _PAGE_CACHE_UC over
_PAGE_CACHE_UC_MINUS on x86 on ioremap_nocache() (see commit de33c442e titled "x86 PAT: fix performance drop for glx,
use UC minus for ioremap(), ioremap_nocache() and
pci_mmap_page_range()")
The conversion done is expressed by the following Coccinelle
SmPL patch, it additionally required manual intervention to
address all the #ifdery and removal of redundant things which
arch_phys_wc_add() already addresses such as verbose message
about when MTRR fails and doing nothing when we didn't get
an MTRR.
This patch deletes all references to 'flipbuf'.Memory is allocated and
freed but never used anywhere in the driver.Also deleted an ununsed
Macro defined in the header file.
Signed-off-by: Gujulan Elango Hari Prasath <hgujulan@visteon.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Wim de With [Wed, 20 May 2015 12:27:39 +0000 (14:27 +0200)]
staging: dgnc: fix line length over 80 chars in dgnc_sysfs.c
This patch fixes most of the lines over 80 characters long in
dgnc_sysfs.c. I couldn't find a way to break line 202-207 in a sensible
way. If there is a way, let me know.
Signed-off-by: Wim de With <nauxuron@wimdewith.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Ian Abbott [Fri, 22 May 2015 17:45:25 +0000 (18:45 +0100)]
staging: comedi: comedi_isadma.h: make self-reliant
The Comedi "comedi_isadma.h" header is included by the source for the
"comedi_isadma" helper module and other modules that use it. It does
not compile cleanly when it is the first header file included. It uses
the `dma_addr_t` type, so include <linux/types.h> to declare it. (Also,
that indirectly takes care of the use of `NULL`.) It uses `struct
comedi_device *` in various function prototypes, so add an incomplete
declaration of `struct comedi_device`.
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 [Fri, 22 May 2015 17:32:31 +0000 (18:32 +0100)]
staging: comedi: comedi_8254.h: make self-reliant
The Comedi "comedi_8254.h" header file is included by various Comedi
drivers with timer/counters based on the 8254 chip. The drivers do not
compile cleanly if this header file is included first. It uses pointers
to the `struct comedi_device`, `struct comedi_subdevice`, and `struct
comedi_insn` structures in various function prototypes, so declare those
as incomplete types. It use the `bool` type, so include
<linux/types.h>. It also uses the `__iomem` tag, but that seems to be
taken care of indirectly by including <linux/types.h>.
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 [Fri, 22 May 2015 16:32:03 +0000 (17:32 +0100)]
staging: comedi: addi_watchdog.h: don't include "../comedidev.h"
The Comedi "addi_watchdog.h" header doesn't use anything form
"comedidev.h" apart from `struct comedi_subdevice`, which it only uses
to construct a corresponding pointer type within the parameter list of a
function prototype. Just declare the structure type incompletely and
don't bother including the header file.
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 [Fri, 22 May 2015 17:15:57 +0000 (18:15 +0100)]
staging: comedi: amplc_dio200.h: make self-reliant
The Comedi "amplc_dio200.h" header file included by drivers for Amplicon
DIO200 series cards does not compile cleanly when it is the first header
included by the ".c" file. It uses `struct comedi_device *` in the
parameter lists of some function prototypes, so just declare `struct
comedi_device` as an incomplete type. It also uses `bool`, so include
<linux/types.h> to declare it.
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 [Fri, 22 May 2015 15:21:38 +0000 (16:21 +0100)]
staging: comedi: comedi_8255: new module split from 8255
The Comedi "8255" module is both a standalone Comedi device driver
module for simple devices with one or more 8255 "Programmable Peripheral
Interface" chips at known I/O base addresses (configured at run-time),
and a helper module to configure a 8255-based digital I/O subdevice for
other Comedi drivers.
Split the "8255 subdevice helper" functionality into a new module:
"comedi_8255", leaving the standalone 8255 Comedi driver in the "8255"
module.
The Comedi "detach" routine of the standalone "8255" driver needs to
retrieve the I/O base address passed to the "comedi_8255" module to set
up each subdevice in order to release the I/O port regions it requested
in its "attach" routine. The "comedi_8255" module stores it in a
"subdevice private" data structure that is no longer known to the "8255"
module, so add a new, exported function `subdev_8255_regbase()` to
retrieve it.
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>
Several Comedi driver modules call `subdev_8255_init()` or
`subdev_8255_mm_init()` to set up a digital I/O subdevice based on the
"8255" chip. One of the parameters to these functions is an optional
pointer to an I/O callback function to perform the actual register
accesses (an internal default callback function is used if NULL).
The kerneldoc for `subdev_8255_init()` and `subdev_8255_mm_init()`
describe the prototype of the optional I/O callback function
incorrectly (my fault), adding a non-existent parameter of type `struct
comedi_subdevice *`. Fix the kerneldoc. Also add parameter names to
the callback function pointer type wherever it occurs to make the usage
clearer.
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 [Fri, 22 May 2015 15:21:36 +0000 (16:21 +0100)]
staging: comedi: 8255.h: don't include "../comedidev.h"
The Comedi "8255.h" header doesn't use anything from "comedidev.h" apart
from `struct comedi_device` and `struct comedi_subdevice`, which are
only used to construct corresponding pointer types within the parameter
lists of function prototypes. Just declare those structure types
incompletely and don't bother including "comedidev.h".
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 [Fri, 22 May 2015 15:21:35 +0000 (16:21 +0100)]
staging: comedi: 8255: fix I/O region leak on failure
The Comedi "8255" driver does not clean up properly on failure. It can
leave requested I/O port regions unreleased. Specifically, the Comedi
"attach" handler (`dev_8255_attach()`) requests a specified I/O port
region before calling `subdev_8255_init()` to set up the subdevice. If
that fails, the "attach" handler returns an error and the Comedi core
will call the "detach" handler (`dev_8255_detach()`) to clean up. The
"detach" handler is responsible for releasing the I/O port regions
successfully requested by the "attach" handler. Unfortunately, it is
unable to obtain the base address of the region if the call to
`subdev_8255_init()` failed.
Fix the I/O region leak by releasing the region in the "attach" handler
directly if the call to `subdev_8255_init()` fails.
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>