summaryrefslogtreecommitdiff
path: root/drivers/staging
AgeCommit message (Collapse)Author
2013-01-17staging: zram: fix invalid memory references during disk writeNitin Gupta
commit 397c60668aa5ae7130b5ad4e73870d7b8a787085 upstream. Fixes a bug introduced by commit c8f2f0db1 ("zram: Fix handling of incompressible pages") which caused invalid memory references during disk write. Invalid references could occur in two cases: - Incoming data expands on compression: In this case, reference was made to kunmap()'ed bio page. - Partial (non PAGE_SIZE) write with incompressible data: In this case, reference was made to a kfree()'ed buffer. Fixes bug 50081: https://bugzilla.kernel.org/show_bug.cgi?id=50081 Signed-off-by: Nitin Gupta <ngupta@vflare.org> Reported-by: Mihail Kasadjikov <hamer.mk@gmail.com> Reported-by: Tomas M <tomas@slax.org> Reviewed-by: Minchan Kim <minchan@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-01-17staging: zram: factor-out zram_decompress_page() functionSergey Senozhatsky
commit 37b51fdddf64e7ba0971d070428655f8d6f36578 upstream. zram_bvec_read() shared decompress functionality with zram_read_before_write() function. Factor-out and make commonly used zram_decompress_page() function, which also simplified error handling in zram_bvec_read(). Signed-off-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com> Reviewed-by: Nitin Gupta <ngupta@vflare.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-01-17staging: speakup: avoid out-of-range access in synth_add()Samuel Thibault
commit 6102c48bd421074a33e102f2ebda3724e8d275f9 upstream. Check that array index is in-bounds before accessing the synths[] array. Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org> Cc: Nickolai Zeldovich <nickolai@csail.mit.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-01-17staging: speakup: avoid out-of-range access in synth_init()Nickolai Zeldovich
commit ae428655b826f2755a8101b27beda42a275ef8ad upstream. Check that array index is in-bounds before accessing the synths[] array. Signed-off-by: Nickolai Zeldovich <nickolai@csail.mit.edu> Cc: Samuel Thibault <samuel.thibault@ens-lyon.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-01-17staging: r8712u: Add new device IDLarry Finger
commit da849a92d3bafaf24d770e971c2c9e5c3f60b5d1 upstream. The ISY IWL 1000 USB WLAN stick with USB ID 050d:11f1 is a clone of the Belkin F7D1101 V1 device. Reported-by: Thomas Hartmann <hartmann@ict.tuwien.ac.at> Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net> Cc: Thomas Hartmann <hartmann@ict.tuwien.ac.at> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-01-17staging: comedi: comedi_test: fix race when cancelling commandIan Abbott
commit c0729eeefdcd76db338f635162bf0739fd2c5f6f upstream. Éric Piel reported a kernel oops in the "comedi_test" module. It was a NULL pointer dereference within `waveform_ai_interrupt()` (actually a timer function) that sometimes occurred when a running asynchronous command is cancelled (either by the `COMEDI_CANCEL` ioctl or by closing the device file). This seems to be a race between the caller of `waveform_ai_cancel()` which on return from that function goes and tears down the running command, and the timer function which uses the command. In particular, `async->cmd.chanlist` gets freed (and the pointer set to NULL) by `do_become_nonbusy()` in "comedi_fops.c" but a previously scheduled `waveform_ai_interrupt()` timer function will dereference that pointer regardless, leading to the oops. Fix it by replacing the `del_timer()` call in `waveform_ai_cancel()` with `del_timer_sync()`. Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Reported-by: Éric Piel <piel@delmic.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-01-17staging: comedi: Kconfig: COMEDI_NI_AT_A2150 should select COMEDI_FCIan Abbott
commit 34ffb33e09132401872fe79e95c30824ce194d23 upstream. The 'ni_at_a2150' module links to `cfc_write_to_buffer` in the 'comedi_fc' module, so selecting 'COMEDI_NI_AT_A2150' in the kernel config needs to also select 'COMEDI_FC'. Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-01-17staging: comedi: fix minimum AO period for NI 625x and NI 628xÉric Piel
commit 34b55d8c48f4f76044d8f4d6ec3dc786cf210312 upstream. The minimum period was set to 357 ns, while the divider for these boards is 50 ns. This prevented to output at maximum speed as ni_ao_cmdtest() would return 357 but would not accept it. Not sure why it was set to 357 ns (this was done before the git history, which starts 5 years ago). My guess is that it comes from reading the specification stating a 2.8 MHz rate (~ 357 ns). The latest specification states a 2.86 MHz rate (~ 350 ns), which makes a lot more sense. Tested on a pci-6251. Signed-off-by: Éric Piel <piel@delmic.com> Acked-By: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-01-17staging: comedi: prevent auto-unconfig of manually configured devicesIan Abbott
commit 7d3135af399e92cf4c9bbc5f86b6c140aab3b88c upstream. When a low-level comedi driver auto-configures a device, a `struct comedi_dev_file_info` is allocated (as well as a `struct comedi_device`) by `comedi_alloc_board_minor()`. A pointer to the hardware `struct device` is stored as a cookie in the `struct comedi_dev_file_info`. When the low-level comedi driver auto-unconfigures the device, `comedi_auto_unconfig()` uses the cookie to find the `struct comedi_dev_file_info` so it can detach the comedi device from the driver, clean it up and free it. A problem arises if the user manually unconfigures and reconfigures the comedi device using the `COMEDI_DEVCONFIG` ioctl so that is no longer associated with the original hardware device. The problem is that the cookie is not cleared, so that a call to `comedi_auto_unconfig()` from the low-level driver will still find it, detach it, clean it up and free it. Stop this problem occurring by always clearing the `hardware_device` cookie in the `struct comedi_dev_file_info` whenever the `COMEDI_DEVCONFIG` ioctl call is successful. Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-01-17staging: vt6656: 64bit fixes: vCommandTimerWait change calculation of timer.Malcolm Priestley
commit 70e227790d4ee4590023d8041a3485f8053593fc upstream. The timer appears to run too fast/race on 64 bit systems. Using msecs_to_jiffies seems to cause a deadlock on 64 bit. A calculation of (MSecond * HZ) / 1000 appears to run satisfactory. Change BSSIDInfoCount to u32. After this patch the driver can be successfully connect on little endian 64/32 bit systems. Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-01-17staging: vt6656: 64bit fixes: key.c/h change unsigned long to u32Malcolm Priestley
commit c0d05b305b00c698b0a8c1b3d46c9380bce9db45 upstream. Fixes long issues. Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-01-17staging: vt6656: 64 bit fixes: fix long warning messages.Malcolm Priestley
commit b4dc03af5513774277c9c36b12a25cd3f25f4404 upstream. Fixes long warning messages from patch [PATCH 08/14] staging: vt6656: 64 bit fixes : correct all type sizes Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-01-17staging: vt6656: 64 bit fixes : correct all type sizesMalcolm Priestley
commit 7730492855a2f9c828599bcd8d62760f96d319e4 upstream. After this patch all BYTE/WORD/DWORD types can be replaced with the appropriate u sizes. Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-01-17staging: vt6656: 64 bit fixes: use u32 for QWORD definition.Malcolm Priestley
commit a552397d5e4ef0cc0bd3e9595d6acc9a3b381171 upstream. Size of long issues replace with u32. Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-01-17staging: vt6656: [BUG] out of bound array reference in RFbSetPower.Malcolm Priestley
commit ab1dd9963137a1e122004d5378a581bf16ae9bc8 upstream. Calling RFbSetPower with uCH zero value will cause out of bound array reference. This causes 64 bit kernels to oops on boot. Note: Driver does not function on 64 bit kernels and should be blacklisted on them. Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-01-17drm/prime: drop reference on imported dma-buf come from gemSeung-Woo Kim
commit be8a42ae60addd8b6092535c11b42d099d6470ec upstream. Increasing ref counts of both dma-buf and gem for imported dma-buf come from gem makes memory leak. release function of dma-buf cannot be called because f_count of dma-buf increased by importing gem and gem ref count cannot be decrease because of exported dma-buf. So I add dma_buf_put() for imported gem come from its own gem into each drivers having prime_import and prime_export capabilities. With this, only gem ref count is increased if importing gem exported from gem of same driver. Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com> Signed-off-by: Kyungmin.park <kyungmin.park@samsung.com> Cc: Inki Dae <inki.dae@samsung.com> Cc: Daniel Vetter <daniel.vetter@ffwll.ch> Cc: Rob Clark <rob.clark@linaro.org> Cc: Alex Deucher <alexander.deucher@amd.com> Signed-off-by: Dave Airlie <airlied@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-01-11staging: drm/omap: Fix include error during makeAndy Gross
commit b9ed9f0ecf1b5675c64d069e9b53effe276b6f01 upstream. Fixed include error for drm_mode.h Signed-off-by: Andy Gross <andy.gross@ti.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-12-17Staging: bcm: Add two products and remove an existing product.Kevin McKinney
commit 4f29ef050848245f7c180b95ccf67dfcd76b1fd8 upstream. This patch adds two new products and modifies the device id table to include them. In addition, product of 0xbccd - BCM_USB_PRODUCT_ID_SM250 is removed because Beceem, ZTE, Sprint use this id for block devices. Reported-by: Muhammad Minhazul Haque <mdminhazulhaque@gmail.com> Signed-off-by: Kevin McKinney <klmckinney1@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-12-17telephony: ijx: buffer overflow in ixj_write_cid()Dan Carpenter
[Not needed in 3.8 or newer as this driver is removed there. - gregkh] We get this from user space and nothing has been done to ensure that these strings are NUL terminated. Reported-by: Chen Gang <gang.chen@asianux.com> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-11-13Revert "Staging: Android alarm: IOCTL command encoding fix"Colin Cross
Commit 6bd4a5d96c08dc2380f8053b1bd4f879f55cd3c9 changed the ANDROID_ALARM_GET_TIME ioctls from IOW to IOR. While technically correct, the _IOC_DIR bits are ignored by alarm_ioctl, so the commit breaks a userspace ABI used by all existing Android devices for a purely cosmetic reason. Revert it. Cc: stable <stable@vger.kernel.org> Cc: Dae S. Kim <dae@velatum.com> Signed-off-by: Colin Cross <ccross@android.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-10-26Merge tag 'staging-3.7-rc2' of ↵Linus Torvalds
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging Pull staging driver fixes from Greg Kroah-Hartman: "Here are some staging driver fixes for your 3.7-rc tree. Nothing major here, a number of iio driver fixups that were causing problems, some comedi driver bugfixes, and a bunch of tidspbridge warning squashing and other regressions fixed from the 3.6 release. All have been in the linux-next releases for a bit. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>" * tag 'staging-3.7-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging: (32 commits) staging: tidspbridge: delete unused mmu functions staging: tidspbridge: ioremap physical address of the stack segment in shm staging: tidspbridge: ioremap dsp sync addr staging: tidspbridge: change type to __iomem for per and core addresses staging: tidspbridge: drop const from custom mmu implementation staging: tidspbridge: request the right irq for mmu staging: ipack: add missing include (implicit declaration of function 'kfree') staging: ramster: depends on NET staging: omapdrm: fix allocation size for page addresses array staging: zram: Fix handling of incompressible pages Staging: android: binder: Allow using highmem for binder buffers Staging: android: binder: Fix memory leak on thread/process exit staging: comedi: ni_labpc: fix possible NULL deref during detach staging: comedi: das08: fix possible NULL deref during detach staging: comedi: amplc_pc263: fix possible NULL deref during detach staging: comedi: amplc_pc236: fix possible NULL deref during detach staging: comedi: amplc_pc236: fix invalid register access during detach staging: comedi: amplc_dio200: fix possible NULL deref during detach staging: comedi: 8255_pci: fix possible NULL deref during detach staging: comedi: ni_daq_700: fix dio subdevice regression ...
2012-10-24staging: tidspbridge: delete unused mmu functionsOmar Ramirez Luna
This should get rid of warnings of the type: warning: passing argument 1 of '' discards qualifiers from pointer target type note: expected 'void *' but argument is of type 'const void *' Signed-off-by: Omar Ramirez Luna <omar.ramirez@copitl.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-10-24staging: tidspbridge: ioremap physical address of the stack segment in shmOmar Ramirez Luna
Due to data type change, readl can no longer receive a u32. Signed-off-by: Omar Ramirez Luna <omar.ramirez@copitl.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-10-24staging: tidspbridge: ioremap dsp sync addrOmar Ramirez Luna
Change the type of sync_addr to 'void __iomem *' and ioremap the physical address in the shared memory so we can access it using _raw_*. While at it, drop 'dw_' prefix. Fix the warning associated with dsp's sync_addr: warning: passing argument 2 of '__raw_writel' makes pointer from integer without a cast ../io.h:88: note: expected 'volatile void *' but argument is of type 'u32' Signed-off-by: Omar Ramirez Luna <omar.ramirez@copitl.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-10-24staging: tidspbridge: change type to __iomem for per and core addressesOmar Ramirez Luna
Currently per_pm_base and core_pm_base are declared as u32, however _raw_* changed the data type, since: 195bbca ARM: 7500/1: io: avoid writeback addressing modes for __raw_ accessors This should fix warnings for per and core accesses: warning: passing argument 2 of '__raw_writel' makes pointer from integer without a cast ../io.h:88: note: expected 'volatile void *' but argument is of type 'u32' Signed-off-by: Omar Ramirez Luna <omar.ramirez@copitl.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-10-24staging: tidspbridge: drop const from custom mmu implementationOmar Ramirez Luna
Custom mmu functions receive a 'const void __iomem *', all the callers pass a 'void __iomem *', so drop the const to fix the warnings like: warning: passing argument 2 of '__raw_writel' discards qualifiers from pointer target type ../io.h:88: note: expected 'volatile void *' but argument is of type 'const void *' Signed-off-by: Omar Ramirez Luna <omar.ramirez@copitl.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-10-24staging: tidspbridge: request the right irq for mmuOmar Ramirez Luna
Requested irq for mmu is currently conflicting with a DMA irq due to recent changes to irq header files, now the offset for the start of the interrupt controller numbering has changed. This should be removed during a future migration to omap-iommu, for now it is hardcoded. Signed-off-by: Omar Ramirez Luna <omar.ramirez@copitl.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-10-24staging: ipack: add missing include (implicit declaration of function 'kfree')Sergei Trofimovich
On ARCH=alpha make allmodconfig: linux-2.6/drivers/staging/ipack/bridges/tpci200.c: In function 'tpci200_free_irq': linux-2.6/drivers/staging/ipack/bridges/tpci200.c:188:2: error: implicit declaration of function 'kfree' [-Werror=implicit-function-declaration] linux-2.6/drivers/staging/ipack/bridges/tpci200.c: In function 'tpci200_request_irq': linux-2.6/drivers/staging/ipack/bridges/tpci200.c:215:2: error: implicit declaration of function 'kzalloc' [-Werror=implicit-function-declaration] Fixed by adding <linux/slab.h> header CC: Greg Kroah-Hartman <gregkh@linuxfoundation.org> CC: Samuel Iglesias Gonsalvez <siglesias@igalia.com> CC: Jens Taprogge <jens.taprogge@taprogge.org> CC: "Miguel Gómez" <magomez@igalia.com> CC: devel@driverdev.osuosl.org Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-10-22staging: ramster: depends on NETRandy Dunlap
ramster uses network interfaces that are only present when CONFIG_NET is enabled, so it should depend on NET. Fixes these build errors: drivers/built-in.o: In function `sc_kref_release': tcp.c:(.text+0x24b9af): undefined reference to `sock_release' drivers/built-in.o: In function `r2net_open_listening_sock': tcp.c:(.text+0x24ca2b): undefined reference to `sock_create' tcp.c:(.text+0x24cb91): undefined reference to `sock_release' drivers/built-in.o: In function `r2net_recv_tcp_msg': tcp.c:(.text+0x24cdbd): undefined reference to `sock_recvmsg' drivers/built-in.o: In function `r2net_send_tcp_msg': tcp.c:(.text+0x24d341): undefined reference to `sock_sendmsg' drivers/built-in.o: In function `r2net_start_connect': tcp.c:(.text+0x24d8fa): undefined reference to `sock_create' drivers/built-in.o: In function `r2net_shutdown_sc': tcp.c:(.text+0x24e30c): undefined reference to `kernel_sock_shutdown' drivers/built-in.o: In function `r2net_accept_one': tcp.c:(.text+0x24f392): undefined reference to `sock_create_lite' tcp.c:(.text+0x24f3c3): undefined reference to `sock_release' drivers/built-in.o: In function `r2net_stop_listening': (.text+0x250f63): undefined reference to `sock_release' Signed-off-by: Randy Dunlap <rdunlap@xenotime.net> Cc: konrad.wilk@oracle.com Acked-by: Dan Magenheimer <dan.magenheimer@oracle.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-10-22staging: omapdrm: fix allocation size for page addresses arrayVincent Penquerc'h
Signed-off-by: Rob Clark <rob@ti.com> Signed-off-by: Vincent Penquerc'h <vincent.penquerch@collabora.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-10-22staging: zram: Fix handling of incompressible pagesNitin Gupta
Change 130f315a (staging: zram: remove special handle of uncompressed page) introduced a bug in the handling of incompressible pages which resulted in memory allocation failure for such pages. When a page expands on compression, say from 4K to 4K+30, we were trying to do zsmalloc(pool, 4K+30). However, the maximum size which zsmalloc can allocate is PAGE_SIZE (for obvious reasons), so such allocation requests always return failure (0). For a page that has compressed size larger than the original size (this may happen with already compressed or random data), there is no point storing the compressed version as that would take more space and would also require time for decompression when needed again. So, the fix is to store any page, whose compressed size exceeds a threshold (max_zpage_size), as-it-is i.e. without compression. Memory required for storing this uncompressed page can then be requested from zsmalloc which supports PAGE_SIZE sized allocations. Lastly, the fix checks that we do not attempt to "decompress" the page which we stored in the uncompressed form -- we just memcpy() out such pages. Signed-off-by: Nitin Gupta <ngupta@vflare.org> Reported-by: viechweg@gmail.com Reported-by: paerley@gmail.com Reported-by: wu.tommy@gmail.com Acked-by: Minchan Kim <minchan@kernel.org> Cc: stable <stable@vger.kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-10-22Staging: android: binder: Allow using highmem for binder buffersArve Hjønnevåg
The default kernel mapping for the pages allocated for the binder buffers is never used. Set the __GFP_HIGHMEM flag when allocating these pages so we don't needlessly use low memory pages that may be required elsewhere. Signed-off-by: Arve Hjønnevåg <arve@android.com> Cc: stable <stable@vger.kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-10-22Staging: android: binder: Fix memory leak on thread/process exitArve Hjønnevåg
If a thread or process exited while a reply, one-way transaction or death notification was pending, the struct holding the pending work was leaked. Signed-off-by: Arve Hjønnevåg <arve@android.com> Cc: stable <stable@vger.kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-10-22staging: comedi: ni_labpc: fix possible NULL deref during detachIan Abbott
`labpc_common_detach()` is called by the comedi core to clean up if either `labpc_attach()` (including the one in the "ni_labpc_cs" module) or `labpc_attach_pci()` returns an error. It assumes the `thisboard` macro (expanding to `((struct labpc_board_struct *)dev->board_ptr)`) is non-null. This is a valid assumption if `labpc_attach()` fails, but not if `labpc_attach_pci()` fails, leading to a possible NULL pointer dereference. Check `thisboard` at the top of `labpc_common_detach()` and return early if it is `NULL`. This is okay because the only other thing that could have been allocated is `dev->private` and that is freed by the comedi core, not by this function. Cc: <stable@vger.kernel.org> # 3.6.x Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-10-22staging: comedi: das08: fix possible NULL deref during detachIan Abbott
`das08_detach()` is called by the comedi core to clean up if either `das08_attach()` or `das08_attach_pci()` returns an error. It sets `thisboard` to the return value of `comedi_board(dev)` and assumes it is non-null. This is a valid assumption if `das08_attach()` fails, but not if `das08_attach_pci()` fails, leading to a possible NULL pointer dereference. Check `thisboard` at the top of `das08_detach()` and return early if it is `NULL`. This is okay because the only other thing that could have been allocated is `dev->private` and that is freed by the comedi core, not by this function. Cc: <stable@vger.kernel.org> # 3.6.x Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-10-22staging: comedi: amplc_pc263: fix possible NULL deref during detachIan Abbott
`pc263_detach()` is called by the comedi core to clean up if either `pc263_attach()` or `pc263_attach_pci()` returns an error. It sets `thisboard` to the return value of `comedi_board(dev)` and assumes it is non-null. This is a valid assumption if `pc263_attach()` fails, but not if `pc263_attach_pci()` fails, leading to a possible NULL pointer dereference. Check `thisboard` at the top of `pc263_detach()` and return early if it is `NULL`. This is okay because no other resources need cleaning up in this case. Cc: <stable@vger.kernel.org> # 3.6.x Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-10-22staging: comedi: amplc_pc236: fix possible NULL deref during detachIan Abbott
`pc236_detach()` is called by the comedi core to clean up if either `pc236_attach()` or `pc236_attach_pci()` returns an error. It sets `thisboard` to the return value of `comedi_board(dev)` and assumes it is non-null. This is a valid assumption if `pc236_attach()` fails, but not if `pc236_attach_pci()` fails, leading to a possible NULL pointer dereference. Check `thisboard` at the top of `pc236_detach()` and return early if it is `NULL`. This is okay because the only other thing that could have been allocated is `dev->private` and that is freed by the comedi core, not by this function. Cc: <stable@vger.kernel.org> # 3.6.x Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-10-22staging: comedi: amplc_pc236: fix invalid register access during detachIan Abbott
`pc236_detach()` is called by the comedi core if it attempted to attach a device and failed. `pc236_detach()` calls `pc236_intr_disable()` if the comedi device private data pointer (`devpriv`) is non-null. This test is insufficient as `pc236_intr_disable()` accesses hardware registers and the attach routine may have failed before it has saved their I/O base addresses. Fix it by checking `dev->iobase` is non-zero before calling `pc236_intr_disable()` as that means the I/O base addresses have been saved and the hardware registers can be accessed. It also implies the comedi device private data pointer is valid, so there is no need to check it. Cc: <stable@vger.kernel.org> # 3.5.x, 3.6.x Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-10-22staging: comedi: amplc_dio200: fix possible NULL deref during detachIan Abbott
`dio200_detach()` is called by the comedi core to clean up if either `dio200_attach()` or `dio200_attach_pci()` return an error. It assigns `thisboard` to the return value of `comedi_board(dev)` and assumes it is non-null. In the case of a previous call to `dio200_attach()` it won't be `NULL` because the comedi core will have pointed it to one of the elements of `dio200_boards[]`, but in the case of a previous call to `dio200_attach_pci()` it could be `NULL`, leading to a null pointer dereference. Check that `thisboard` is valid at the top of `dio200_detach()` and return early if it is `NULL`. This is okay because the only other thing that could have been allocated is `dev->private` and that is freed by the comedi core, not by this function. Cc: <stable@vger.kernel.org> # 3.6.x Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-10-22staging: comedi: 8255_pci: fix possible NULL deref during detachIan Abbott
`pci_8255_detach()` will be called by the comedi core if `pci_8255_attach_pci()` returns an error. It currently assumes that both `board` (assigned from the return value of `comedi_board(dev)`) and `devpriv` (assigned from `dev->private`) are non-null, but they might be null, leading to a null pointer dereference. `pci_8255_detach()` doesn't need to do anything if either `board` or `devpriv` are null, so just return early in this case. Cc: <stable@vger.kernel.org> # 3.6.x Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-10-22staging: comedi: ni_daq_700: fix dio subdevice regressionFred Brooks
Here is a small patch to fix a problem caused by a previous patch that removed the callback function. The callback remove patch: http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commitdiff;h=1de02225358988e8fd48d1dc3fd12336bbae258a I finally booted my dev machine on the latest kernel (running Debian here so it's still on 3.2 normally) to test the ni_daq_700 driver with my test program and noticed this bug. Shift the DIO_R read result to bits 8..15 Digital direction configuration: channels 0-7 output, 8-15 input (8225 device emu as port A output, port B input, port C N/A). Cc: <stable@vger.kernel.org> # 3.6.x Signed-off-by: Fred Brooks <nsaspook@nsaspook.com> 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>
2012-10-19staging:iio:adis16400: Fixup adis16336 temp channel attributesLars-Peter Clausen
The temperature channel has a calibbias attribute which it should not have, but the offset attribute is missing. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2012-10-19staging:iio:adis16400: Report correct temperature scale and offsetLars-Peter Clausen
Temperature scale and offset differ between the different devices supported by this driver. Right now the driver always reports the temperature scale and offset of the adis16400 regardless of which chip variant is used. This patch adds two new attributes to the chip_info struct, one for the temperature scale and one for the temperature offset. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2012-10-19staging:iio: Fix adis16400 channel offsets and scalesLars-Peter Clausen
Most of the channel offsets and scales in the adis16400 are incorrect: * Voltage scale is off by a factor of 1000 * Temperature scale is off by a factor of 1000 * Temperature offset is completely wrong * Some of the acceleration scales are either completely wrong or have the wrong unit * Some of the angular velocity scale are either completely wrong or have the wrong unit This patch fixes these issues. For consistency it also converts scales which are correct to use the IIO_G_TO_M_S_2 and IIO_DEGREE_TO_RAD macro. This makes it much easier to compare it to the value given in the datasheet. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2012-10-19staging:iio: Fix adis16260 channel offsets and scalesLars-Peter Clausen
Most of the channel offsets and scales in the adis16260 are incorrect: * Temperature scale is off by a factor of 1000 * Voltage scale is off by a factor of 1000 * Temperature offset is completely wrong This patch fixes these issues. Also use the IIO_DEGREE_TO_RAD for the angle velocity since this makes it much easier to compare it to the value given in the datasheet. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2012-10-19staging:iio: Fix adis16240 channel offsets and scalesLars-Peter Clausen
Most of the channel offsets and scales in the adis16240 are incorrect: * Temperature scale is of by a factor of 1000 * Voltage scale is of by a factor of 1000 * Temperature offset is completely wrong * Peak scale is completely wrong This patch fixes these issues. Also use the IIO_G_TO_M_S_2 macro for the acceleration scale since this makes it much easier to compare it to the value given in the datasheet. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2012-10-19staging:iio: Fix adis16220 channel offsets and scalesLars-Peter Clausen
Most of the channel offsets and scales in the adis16220 are incorrect: * Temperature scale is off by a factor of 1000 * Voltage scale is off by a factor of 1000 * Acceleration seems to have a typo "187042" since it should be instead of "1887042" * Temperature offset is completely wrong This patch fixes these issues. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2012-10-19staging:iio: Fix adis16209 channel offsets and scalesLars-Peter Clausen
Most of the channel offsets and scales in the adis16209 are incorrect: * Temperature scale is of by a factor of 1000 * Voltage scale is of by a factor of 1000 * Temperature offset is completely wrong * Rotational position scale is missing This patch fixes these issues. Also use the IIO_G_TO_M_S_2 macro for the acceleration scale since this makes it much easier to compare it with the value given in the datasheet. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2012-10-19staging:iio: Fix adis16204 channel offsets and scalesLars-Peter Clausen
Most of the channel offsets and scales in the adis16204 are incorrect: * Temperature scale is off by a factor of 1000 * Voltage scale is off by a factor of 1000 * Acceleration is scale is in g instead of m/(s**2) * Temperature offset is completely wrong This patch fixes these issues. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2012-10-19staging:iio: Fix adis16203 channel offsets and scalesLars-Peter Clausen
Most of the channel offsets and scales in the adis16203 are incorrect: * Temperature scale is off by a factor of 1000 * Voltage scale is off by a factor of 1000 * Temperature offset is completely wrong This patch fixes these issues. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>