[PATCH -stable] staging: comedi: check s->async for poll(), read() and write()

2013-02-27 Thread Ian Abbott
`, `comedi_read()` and `comedi_write()` to avoid the bug. Signed-off-by: Ian Abbott --- Applies to all stable/longterm kernels from (at least) 2.6.32.x to 3.8.x. --- drivers/staging/comedi/comedi_fops.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/staging/c

[PATCH-stable-3.0-3.6 1/2] staging: comedi: ni_labpc: correct differential channel sequence for AI commands

2013-02-27 Thread Ian Abbott
. Thanks to Tuomas for suggesting the fix. Signed-off-by: Ian Abbott --- Applies to stable/longterm kernels 3.0.x to 3.6.x inclusive. --- drivers/staging/comedi/drivers/ni_labpc.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/staging/comedi/drivers/ni_labpc.c b

[PATCH-stable-3.0-3.6 2/2] staging: comedi: ni_labpc: set up command4 register *after* command3

2013-02-27 Thread Ian Abbott
suggesting the fix. Signed-off-by: Ian Abbott --- Applies to stable/longterm kernels 3.0.x to 3.6.x inclusive. --- drivers/staging/comedi/drivers/ni_labpc.c | 31 --- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/drivers/staging/comedi/drivers/ni_labpc.c b

[PATCH-2.6.34 1/2] staging: comedi: ni_labpc: correct differential channel sequence for AI commands

2013-02-27 Thread Ian Abbott
. Thanks to Tuomas for suggesting the fix. Signed-off-by: Ian Abbott --- Applies to 2.6.34.x longterm/stable kernel. --- drivers/staging/comedi/drivers/ni_labpc.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/staging/comedi/drivers/ni_labpc.c b/drivers/staging/comedi

[PATCH-2.6.34 2/2] staging: comedi: ni_labpc: set up command4 register *after* command3

2013-02-27 Thread Ian Abbott
suggesting the fix. Signed-off-by: Ian Abbott --- Applies to 2.6.34.x longterm/stable kernel. --- drivers/staging/comedi/drivers/ni_labpc.c | 31 --- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/drivers/staging/comedi/drivers/ni_labpc.c b/drivers/staging

[PATCH-2.6.32 1/2] staging: comedi: ni_labpc: correct differential channel sequence for AI commands

2013-02-27 Thread Ian Abbott
. Thanks to Tuomas for suggesting the fix. Signed-off-by: Ian Abbott --- Applies to 2.6.32 longterm/stable kernel. --- drivers/staging/comedi/drivers/ni_labpc.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/staging/comedi/drivers/ni_labpc.c b/drivers/staging/comedi

[PATCH-2.6.32 2/2] staging: comedi: ni_labpc: set up command4 register *after* command3

2013-02-27 Thread Ian Abbott
suggesting the fix. Signed-off-by: Ian Abbott --- Applies to 2.6.32 longterm/stable kernel. --- drivers/staging/comedi/drivers/ni_labpc.c | 31 --- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/drivers/staging/comedi/drivers/ni_labpc.c b/drivers/staging

[PATCH] staging: comedi: dt9812: use CR_CHAN() for channel number

2013-03-05 Thread Ian Abbott
as the channel number (where `insn` is a pointer to the `struct comedi_insn` being processed). Cc: # 3.8 onwards Cc: Dan Carpenter Cc: Anders Blomdell Signed-off-by: Ian Abbott --- Note: Needs a little backporting for kernels below 3.8. --- drivers/staging/comedi/drivers/dt9812.c | 16 ++

[PATCH resend] staging: comedi: s626: fix continuous acquisition

2013-03-22 Thread Ian Abbott
il. Cc: stable@vger.kernel.org Signed-off-by: Ian Abbott --- Resent to correct the stable@vger.kernel.org address. Sorry. --- drivers/staging/comedi/drivers/s626.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/comedi/drivers/s626.c b/drivers/staging/co

[PATCH stable] staging: comedi: Kconfig: COMEDI_NI_AT_A2150 should select COMEDI_FC

2013-01-15 Thread Ian Abbott
upstream commit 34ffb33e09132401872fe79e95c30824ce194d23 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 Abbot

Re: [PATCH stable] staging: comedi: Kconfig: COMEDI_NI_AT_A2150 should select COMEDI_FC

2013-01-15 Thread Ian Abbott
On 15/01/13 18:45, Greg KH wrote: On Tue, Jan 15, 2013 at 10:15:57AM -0800, Greg KH wrote: On Tue, Jan 15, 2013 at 02:45:20PM +, Ian Abbott wrote: upstream commit 34ffb33e09132401872fe79e95c30824ce194d23 The 'ni_at_a2150' module links to `cfc_write_to_buffer` in the 'comedi

[PATCH 2/2] staging: comedi: ni_labpc: correct differential channel sequence for AI commands

2013-02-01 Thread Ian Abbott
when the AI scan mode is `MODE_SINGLE_CHAN` or `MODE_SINGLE_CHAN_INTERVAL`. The existing test for whether the comedi channel number needs to be doubled in differential mode is incorrect in `labpc_ai_cmd()`. This patch corrects the test. Thanks to Tuomas for suggesting the fix. Signed-off-by: Ian

[PATCH 1/2] staging: comedi: ni_labpc: set up command4 register *after* command3

2013-02-01 Thread Ian Abbott
register in `labpc_ai_cmd()` messes up the differential reference bit setting in the command4 register. Set up the command4 register after the command3 register (as in `labpc_ai_rinsn()`) to avoid the problem. Thanks to Tuomas for suggesting the fix. Signed-off-by: Ian Abbott Cc: # 3.7.x, 3.8.x

[PATCH] staging: comedi: check s->async for poll(), read() and write()

2013-02-04 Thread Ian Abbott
they assume `s->async` is valid (where `s` points to the read or write subdevice), which it won't be if it has been set incorrectly. This can lead to a NULL pointer dereference. Check `s->async` is non-NULL in `comedi_poll()`, `comedi_read()` and `comedi_write()` to avoid the bug. Sig

Re: [PATCH] staging: comedi: check s->async for poll(), read() and write()

2013-02-04 Thread Ian Abbott
On 2013-02-04 14:56, Ian Abbott wrote: Some low-level comedi drivers (incorrectly) point `dev->read_subdev` or `dev->write_subdev` to a subdevice that does not support asynchronous commands. Comedi's poll(), read() and write() file operation handlers assume these subdevices

[PATCH] staging: comedi: fix a race between do_cmd_ioctl() and read/write

2013-07-05 Thread Ian Abbott
medi_read()` and `comedi_write()` while calling `do_become_nonbusy()` in order to avoid moving the race condition to a point within that function. Change some error handling `goto cleanup` statements in `do_cmd_ioctl()` to simple `return -ERRFOO` statements as a result of changing when the `busy` point

[PATCH] staging: comedi: COMEDI_CANCEL ioctl should wake up read/write

2013-07-08 Thread Ian Abbott
level comedi driver's cancel routine, but it always shuts the command down regardless, so `do_cancel_ioctl()` can wake up he wait queue regardless of the return value from `do_cancel()`. Signed-off-by: Ian Abbott Cc: --- drivers/staging/comedi/comedi_fops.c | 7 ++- 1 file changed, 6

[PATCH stable] staging: comedi: ssv_dnp: correct insn_bits result

2013-12-12 Thread Ian Abbott
follow f6b316bcd8c421acd6fa5a6e18b4c846ecb9d965 [Split from original patch subject: "staging: comedi: ssv_dnp: use comedi_dio_update_state()"] Also, fix a bug where the state of the channels is returned in data[0]. The comedi core expects it to be returned in data[1]. Signed-off-by:

[PATCH-3.10.y-3.12.y] staging: comedi: amplc_pc263, amplc_pci263: correct insn_bits result

2013-12-12 Thread Ian Abbott
follow 97f4289ad08cffe55de06d4ac4f89ac540450aee [Split from original patch subject: "staging: comedi: drivers: use comedi_dio_update_state() for simple cases"] Also, fix a bug in the amplc_pc263 and amplc_pci263 drivers where the current state is not returned in data[1]. Signed-o

[PATCH-3.6.y-3.9.y] staging: comedi: amplc_pc263: correct insn_bits result

2013-12-12 Thread Ian Abbott
follow 97f4289ad08cffe55de06d4ac4f89ac540450aee [Split from original patch subject: "staging: comedi: drivers: use comedi_dio_update_state() for simple cases"] Also, fix a bug in the amplc_pc263 and amplc_pci263 drivers where the current state is not returned in data[1]. Signed-o

[PATCH-3.11.y] staging: comedi: pcmuio: fix possible NULL deref on detach

2013-12-12 Thread Ian Abbott
sed to `kfree()` is non-NULL, so remove that check. Signed-off-by: Ian Abbott --- Applies to 3.11.y only (e.g. Debian jessie/testing). --- drivers/staging/comedi/drivers/pcmuio.c | 11 ++- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/staging/comedi/drivers/pcmuio.c

[PATCH-3.10.y] staging: comedi: pcmuio: fix possible NULL deref on detach

2013-12-12 Thread Ian Abbott
sed to `kfree()` is non-NULL, so remove that check. Signed-off-by: Ian Abbott --- Applies to 3.10.y only. --- drivers/staging/comedi/drivers/pcmuio.c | 11 ++- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/staging/comedi/drivers/pcmuio.c b/drivers/staging/com

[PATCH-3.6.y-3.9.y] staging: comedi: pcmuio: fix possible NULL deref on detach

2013-12-12 Thread Ian Abbott
sed to `kfree()` is non-NULL, so remove that check. Signed-off-by: Ian Abbott --- Applies to 3.6.y to 3.9.y inclusive if any distros want it. --- drivers/staging/comedi/drivers/pcmuio.c | 11 ++- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/staging/comedi/driv

[PATCH-3.5.y] staging: comedi: pcmuio: fix possible NULL deref on detach

2013-12-12 Thread Ian Abbott
sed to `kfree()` is non-NULL, so remove that check. Signed-off-by: Ian Abbott --- Applies to 3.5.y only (if any distro is still using it). --- drivers/staging/comedi/drivers/pcmuio.c | 11 ++- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/staging/comedi/driv

[PATCH-2.6.32.y-3.4.y] staging: comedi: pcmuio: fix possible NULL deref on detach

2013-12-12 Thread Ian Abbott
sed to `kfree()` is non-NULL, so remove that check. Signed-off-by: Ian Abbott --- Applies to 2.6.32.y through to 3.4.y inclusive. Does not apply to 3.5.y onwards. --- drivers/staging/comedi/drivers/pcmuio.c | 12 ++-- 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/driv

[PATCH-3.10.y-3.11.y] staging: comedi: pcmmio: remove unneeded checks on detach

2013-12-12 Thread Ian Abbott
oop. Signed-off-by: Ian Abbott --- Applies to 3.10.y and 3.11.y only. Not needed for other kernels. --- drivers/staging/comedi/drivers/pcmmio.c | 11 ++- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/staging/comedi/drivers/pcmmio.c b/drivers/staging/comedi/driv

Re: [PATCH-3.10.y-3.11.y] staging: comedi: pcmmio: remove unneeded checks on detach

2013-12-12 Thread Ian Abbott
On 2013-12-12 13:41, Ian Abbott wrote: follow b88e75bb6576d99e0ba4f6edc978293d1ff9c01b As pointed out by Dan carpenter for the similar pcmuio driver, there is no need to check the pointer passed to `kfree()`, so remove that check from `pcmmio_detach()`. Also, check the `devpriv` (`dev

[PATCH] staging: comedi: 8255_pci: fix for newer PCI-DIO48H

2013-12-13 Thread Ian Abbott
e for both entries. Signed-off-by: Ian Abbott --- Cc: # 3.10.y # 3.11.y # 3.12.y # 3.13.y --- drivers/staging/comedi/drivers/8255_pci.c | 15 --- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/drivers/staging/comedi/drivers/8255_pci.c b/drivers/staging/comedi/drivers/

[PATCH] staging: comedi: bug-fix NULL pointer dereference on failed attach

2013-08-23 Thread Ian Abbott
introduced a NULL pointer dereference bug as `dev->driver` is NULL after the call to `comedi_device_detach()`. We still have a pointer to the low-level comedi driver structure in the `driv` variable, so use that instead. Signed-off-by: Ian Abbott Cc: # 3.10.x Cc: # 3.11.x --- drivers/staging/com

[PATCH] staging: comedi: ni_65xx: (bug fix) confine insn_bits to one subdevice

2013-10-02 Thread Ian Abbott
ration, increasing by 8 for each subsequent operation.) Signed-off-by: Ian Abbott Cc: # 3.10.y 3.11.y 3.12.y --- Needs backporting for longterm kernels before 3.10.y --- drivers/staging/comedi/drivers/ni_65xx.c | 25 ++--- 1 file changed, 10 insertions(+), 15 deletions(-

[PATCH v2] staging: comedi: avoid memleak for subdevice private

2013-10-07 Thread Ian Abbott
avoid unnecessary use of a spin-lock. Signed-off-by: Ian Abbott Cc: # 3.11.y --- v2: Replaced call to `comedi_set_subdevice_runflags()` from `comedi_alloc_spriv()` with a simple OR-assignment, as suggested by Hartley S Sweeten. Note: The first version of this patch was posted on 2013-07-05 but I

[PATCH 2.6.34.y--3.5.y] staging: comedi: ni_65xx: (bug fix) confine insn_bits to one subdevice

2013-10-10 Thread Ian Abbott
tshift` will be between -7 and 7 inclusive on the first iteration, increasing by 8 for each subsequent operation.) Signed-off-by: Ian Abbott --- This patch applies to kernels 2.6.34.y through to 3.5.y inclusive. Similar patch already queued for 3.10.y and 3.11.y by Greg-KH. I can post similar pa

[PATCH 2.6.32.y] staging: comedi: ni_65xx: (bug fix) confine insn_bits to one subdevice

2013-10-10 Thread Ian Abbott
tshift` will be between -7 and 7 inclusive on the first iteration, increasing by 8 for each subsequent operation.) Signed-off-by: Ian Abbott --- drivers/staging/comedi/drivers/ni_65xx.c | 25 +++-- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/drivers

[PATCH] staging: comedi: prevent auto-unconfig of manually configured devices

2012-12-04 Thread Ian Abbott
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 Cc: stable@vger.kernel.org --- drivers/staging/comedi/comedi_fops.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers

Re: [PATCH] comedi: fix minimum AO period for NI 625x and NI 628x

2012-12-19 Thread Ian Abbott
, 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 Cc: Ian Abbott Cc: Greg Kroah-Hartman

Re: [PATCH] comedi: fix minimum AO period for NI 625x and NI 628x

2012-12-20 Thread Ian Abbott
On 20/12/12 14:09, Éric Piel wrote: On 19/12/12 17:43, Ian Abbott wrote: Looks reasonable. The AO speed checks were added to the NI drivers (in the out-of-tree Comedi sources before they were imported into "staging") in early May 2007 but probably weren't tested to the limits.

[RESEND PATCH] staging: comedi: prevent auto-unconfig of manually configured devices

2013-01-02 Thread Ian Abbott
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 Cc: stable@vger.kernel.org --- @Greg: This was originally sent on 4th December. It clashes with Hartley's "[PATCH 04/2

Re: [PATCH] staging: comedi: Kconfig: COMEDI_NI_AT_A2150 should select COMEDI_FC

2013-01-04 Thread Ian Abbott
On 2013-01-03 12:15, Ian Abbott wrote: 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 Cc: # 3.6+

[PATCH 1/6] staging: comedi: comedi_test: fix race when cancelling command

2013-01-04 Thread Ian Abbott
ecome_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 Rep

Re: [RESEND PATCH] staging: comedi: prevent auto-unconfig of manually configured devices

2013-01-08 Thread Ian Abbott
On 2013/01/07 11:35 PM, Greg Kroah-Hartman wrote: > On Mon, Jan 07, 2013 at 05:34:28PM -0600, H Hartley Sweeten wrote: >> On Monday, January 07, 2013 4:23 PM, Greg Kroah-Hartman wrote: >>> On Wed, Jan 02, 2013 at 04:21:23PM +, Ian Abbott wrote: >>>> When

[PATCH] staging: comedi: 8255_pci: initialize MITE data window

2014-03-13 Thread Ian Abbott
l with so use a local, simpler initialization function. Signed-off-by: Ian Abbott Cc: # 3.10.y, 3.11.y, 3.12.y, 3.13.y, 3.14.y --- Needs backporting for kernels 3.7.y to 3.9.y if any distros are maintaining them. --- drivers/staging/comedi/drivers/8255_pci.c | 34 +++

[PATCH 3.8.y] staging: comedi: 8255_pci: fix for newer PCI-DIO48H

2014-01-20 Thread Ian Abbott
to use the fact that the PCI BAR 2 region will have non-zero length only on the newer design, so use that fact to distinguish them. Signed-off-by: Ian Abbott Cc: kernel-t...@lists.ubuntu.com --- drivers/staging/comedi/drivers/8255_pci.c | 20 +--- 1 file changed, 17 insertions(

[PATCH-3.4.y-3.5.y] staging: comedi: cb_pcidio: fix for newer PCI-DIO48H

2014-01-20 Thread Ian Abbott
of `struct pcidio_board` redundant. The `pcicontroler_badrindex` member is also unused, so remove both members. Signed-off-by: Ian Abbott Cc: kernel-t...@lists.ubuntu.com --- Applies to 3.4.y and 3.5.y (Ubuntu Extended Stable). Note that other changes make this patch somewhat different to the upstr

[PATCH-2.6.32.y-3.2.y] staging: comedi: cb_pcidio: fix for newer PCI-DIO48H

2014-01-20 Thread Ian Abbott
of `struct pcidio_board` redundant. The `pcicontroler_badrindex` member is also unused, so remove both members. Signed-off-by: Ian Abbott Cc: kernel-t...@lists.ubuntu.com --- Applies to stable kernels 2.6.32.y through to 3.2.y. Note that other changes make this patch somewhat different to the upstr

[PATCH-3.7.y-3.12.y] staging: comedi: adl_pci9111: fix incorrect irq passed to request_irq()

2014-01-21 Thread Ian Abbott
wed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- Applies to stable kernels 3.7.y to 3.12.y inclusive. Not needed for kernels prior to 3.7.y --- drivers/staging/comedi/drivers/adl_pci9111.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/comedi/d

Re: [PATCH-3.7.y-3.12.y] staging: comedi: adl_pci9111: fix incorrect irq passed to request_irq()

2014-01-21 Thread Ian Abbott
On 2014-01-21 13:21, Ian Abbott wrote: From: H Hartley Sweeten commit 48108fe3daa0d142f9b97178fdb23704ea3a407b upstream The dev->irq passed to request_irq() will always be 0 when the auto_attach function is called. The pcidev->irq should be used instead to get the correct irq number.

[PATCH-3.8.y-3.13.y] staging: comedi: addi_apci_1032: fix subdevice type/flags bug

2014-01-21 Thread Ian Abbott
From: H Hartley Sweeten commit 90daf69a7a3f1d1a41018c799968a0bb896d65e0 upstream The SDF_CMD_READ should be one of the s->subdev_flags not part of the s->type. Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- Applies to stable kernels 3.

[PATCH-3.13.y] staging: comedi: fix result of memdup_user for user chanlist

2014-01-21 Thread Ian Abbott
ULL and checking this in do_become_nonbusy prevents the oops. [Ian Abbott] Also do the same for the chanlist allocated in do_cmdtest_ioctl(). Signed-off-by: Bernd Porr Signed-off-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/comedi_fops.c | 2 ++ 1 file changed

Re: [PATCH 1/3] staging: comedi: usbduxsigma: updated contact details and status

2014-10-13 Thread Ian Abbott
d, 4 insertions(+), 4 deletions(-) Reviewed-by: Ian Abbott -- -=( Ian Abbott @ MEV Ltd.E-mail: )=- -=( Web: http://www.mev.co.uk/ )=- -- To unsubscribe from this list: send the line "unsubscribe stable" in the body of a message to majord...@vger.kernel.o

Re: [PATCH 3/3] staging: comedi: usbduxfast: updated address details

2014-10-13 Thread Ian Abbott
Abbott -- -=( Ian Abbott @ MEV Ltd.E-mail: )=- -=( Web: http://www.mev.co.uk/ )=- -- To unsubscribe from this list: send the line "unsubscribe stable" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html

Re: [PATCH 2/3] staging: comedi: usbdux: updated contact details / comments

2014-10-13 Thread Ian Abbott
On 10/10/14 20:34, Bernd Porr wrote: I've updated my contact details and removed obsolete comments. Signed-off-by: Bernd Porr --- drivers/staging/comedi/drivers/usbdux.c | 59 - 1 file changed, 28 insertions(+), 31 deletions(-) Reviewed-by: Ian A

[PATCH] staging: comedi: fix memory leak / bad pointer freeing for chanlist

2014-10-20 Thread Ian Abbott
As a follow-up to commit 6cab7a37f5c04 ("staging: comedi: (regression) channel list must be set for COMEDI_CMD ioctl"), Hartley Sweeten pointed out another couple of bugs stemming from commit 6cab7a37f5c04 ("staging: comedi: comedi_fops: introduce __comedi_get_user_chanlist()"). Firstly, `do_cmdte

Re: [PATCH] staging: comedi: fix memory leak / bad pointer freeing for chanlist

2014-10-21 Thread Ian Abbott
On 20/10/14 22:38, Hartley Sweeten wrote: On Monday, October 20, 2014 7:11 AM, Ian Abbott wrote: As a follow-up to commit 6cab7a37f5c04 ("staging: comedi: (regression) channel list must be set for COMEDI_CMD ioctl"), Hartley Sweeten pointed out another couple of bugs stemming f

[PATCH] misc: genwqe: check for error from get_user_pages_fast()

2014-11-06 Thread Ian Abbott
; m->nr_pages)` will be false (due to promotion of `rc` to a large `unsigned int`) and the code will continue on to call `genwqe_map_pages()` with an invalid list of page pointers. Fix it by bailing out if `get_user_pages_fast()` returns a negative error value. Signed-off-by: Ian Abbott Cc:

[PATCH] staging: comedi: ni_daq_700: add mux settling delay

2014-05-19 Thread Ian Abbott
I got a patch from the original author, Fred Brooks, to add a small settling delay after setting the AI channel multiplexor. The lack of delay resulted in unstable or scrambled data on faster processors. Signed-off-by: Ian Abbott Reported-by: Fred Brooks Cc: # 3.7.x - 3.15.x --- drivers

[PATCH] staging: comedi: (regression) channel list must be set for COMEDI_CMD ioctl

2014-10-08 Thread Ian Abbott
the bug via an initial patch sent privately. Fixes: c6cd0eefb27b ("staging: comedi: comedi_fops: introduce __comedi_get_user_chanlist()") Reported-by: Bernd Porr Signed-off-by: Ian Abbott Cc: Bernd Porr Cc: # 3.15.y 3.16.y 3.17.y --- drivers/staging/comedi/comedi_fops.c | 15 +++--

Re: [PATCH] staging: comedi: (regression) channel list must be set for COMEDI_CMD ioctl

2014-10-09 Thread Ian Abbott
On 09/10/14 00:13, Hartley Sweeten wrote: On Wednesday, October 08, 2014 8:09 AM, Ian Abbott wrote: `do_cmd_ioctl()`, the handler for the `COMEDI_CMD` ioctl can incorrectly call the Comedi subdevice's `do_cmd()` handler with a NULL channel list pointer. This is a regression as the `d

[PATCH] staging: comedi: fix circular locking dependency in comedi_mmap()

2014-04-10 Thread Ian Abbott
ncremented and a pointer to it is returned. The comedi subdevice's spin-lock is used to protect the checks. Also use the spin-lock in `__comedi_buf_alloc()` and `__comedi_buf_free()` to protect changes to the subdevice's buffer map structure pointer and the buffer map structure'

Re: FAILED: patch "[PATCH] staging: comedi: comedi_isadma: fix "stalled" detect in" failed to apply to 3.19-stable tree

2015-03-16 Thread Ian Abbott
last check. Reported-by: coverity (CID 1271132) Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Cc: stable Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/staging/comedi/drivers/comedi_isadma.c b/drivers/staging/comedi/drivers/comedi_isadma.c index dbdea71d6b95..e856f01ca077 1

[PATCH 3.16.y to 3.19.y] staging: comedi: adv_pci1710: fix AI INSN_READ for non-zero channel

2015-03-16 Thread Ian Abbott
ays enable PCI171x_PARANOIDCHECK code") Signed-off-by: Ian Abbott --- Sorry, the original upstream commit didn't apply! --- drivers/staging/comedi/drivers/adv_pci1710.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/staging/comedi/drivers/adv_pci1710.c b/drivers/st

[PATCH] spi: spidev: fix possible arithmetic overflow for multi-transfer message

2015-03-23 Thread Ian Abbott
ed tx buffer before it reaches an invalid user memory address. Fix it by checking that neither the total nor the individual transfer lengths exceed the maximum allowed value. Thanks to Dan Carpenter for reporting the potential integer overflow. Signed-off-by: Ian Abbott Cc: # 4.0+ --- This cou

Re: [PATCH] spi: spidev: fix possible arithmetic overflow for multi-transfer message

2015-03-23 Thread Ian Abbott
On 23/03/15 18:50, Mark Brown wrote: On Mon, Mar 23, 2015 at 05:50:27PM +, Ian Abbott wrote: Signed-off-by: Ian Abbott Cc: # 4.0+ This doesn't apply against Linus' tree as far as I can tell - if you think this needs to go to stable please send a version that applies ag

[PATCH] staging: comedi: cb_pcidas64: fix incorrect AI range code handling

2015-01-19 Thread Ian Abbott
`ai_range_bits_6xxx()` to use a look-up table pointed to by new member `ai_range_codes` of `struct pcidas64_board` to map the comedi range table indices to the hardware range codes. Use a new comedi range table for the PCI-DAS64/Mx/16 boards (and the commented out variants). Signed-off-by: Ian

Re: [PATCH] misc: genwqe: check for error from get_user_pages_fast()

2014-12-02 Thread Ian Abbott
On 02/12/14 12:59, Frank Haverkamp wrote: Hi Ian, thanks for reviewing our code and sorry for not answering immediately. Am Donnerstag, den 06.11.2014, 16:23 + schrieb Ian Abbott: `genwqe_user_vmap()` calls `get_user_pages_fast()` and if the return value is less than the number of pages

[PATCH 1/6] staging: comedi: usbduxsigma: don't clobber ai_timer in command test

2015-07-23 Thread Ian Abbott
uxsigma: tidy up analog input command support) Signed-off-by: Ian Abbott Cc: # 3.19 onwards --- drivers/staging/comedi/drivers/usbduxsigma.c | 37 1 file changed, 16 insertions(+), 21 deletions(-) diff --git a/drivers/staging/comedi/drivers/usbduxsigma.c b/drivers/stag

[PATCH 2/6] staging: comedi: usbduxsigma: don't clobber ao_timer in command test

2015-07-23 Thread Ian Abbott
being used, although currently only "scan" timing is supported. Fixes: fb1ef622e7a3 ("staging: comedi: usbduxsigma: tidy up analog output command support") Signed-off-by: Ian Abbott Cc: # 3.19 onwards --- drivers/staging/comedi/drivers/usbduxsigma.c | 33 ---

Re: [patch added to the 3.12 stable tree] staging: comedi: usbduxsigma: don't clobber ai_timer in command test

2015-09-23 Thread Ian Abbott
On 22/09/15 22:48, Luis Henriques wrote: On Tue, Sep 22, 2015 at 09:29:14PM +0200, Jiri Slaby wrote: On 09/22/2015, 08:47 PM, Luis Henriques wrote: On Wed, Sep 16, 2015 at 09:38:12PM +0200, Jiri Slaby wrote: From: Ian Abbott This patch has been added to the 3.12 stable tree. If you have any

[PATCH] staging: comedi: adl_pci7x3x: fix digital output on PCI-7230

2015-08-11 Thread Ian Abbott
the user manual says it should do. Fixes: 8f567c373c4b ("staging: comedi: new adl_pci7x3x driver") Signed-off-by: Ian Abbott Cc: # 3.13+, needs backporting for 3.7 to 3.12 --- drivers/staging/comedi/drivers/adl_pci7x3x.c | 16 ++-- 1 file changed, 14 insertions(+), 2 deletions

[PATCH 3.7 - 3.12] staging: comedi: adl_pci7x3x: fix digital output on PCI-7230

2015-09-16 Thread Ian Abbott
both for what the board actually does and for what the user manual says it should do. Fixes: 8f567c373c4b ("staging: comedi: new adl_pci7x3x driver") Signed-off-by: Ian Abbott --- drivers/staging/comedi/drivers/adl_pci7x3x.c | 15 +-- 1 file changed, 13 insertions(+), 2 deleti

[PATCH 3.18] staging: comedi: adv_pci1710: fix AI INSN_READ for non-zero channel

2015-09-16 Thread Ian Abbott
dv_pci1710: always enable PCI171x_PARANOIDCHECK code") Signed-off-by: Ian Abbott --- drivers/staging/comedi/drivers/adv_pci1710.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/staging/comedi/drivers/adv_pci1710.c b/drivers/staging/comedi/drivers/adv_pci1710.

Re: [PATCH 3.18] staging: comedi: adv_pci1710: fix AI INSN_READ for non-zero channel

2015-09-16 Thread Ian Abbott
On 16/09/15 11:37, Ian Abbott wrote: commit abe46b8932dd9a6dfc3698e3eb121809b7b9ed28 upstream Reading of analog input channels by the `INSN_READ` comedi instruction is broken for all except channel 0. `pci171x_insn_read_ai()` calls `pci171x_ai_dropout()` with the wrong value for the third

[PATCH 3.16 - 3.18] staging: comedi: usbduxsigma: don't clobber ai_timer in command test

2015-09-16 Thread Ian Abbott
log input command support) Signed-off-by: Ian Abbott --- drivers/staging/comedi/drivers/usbduxsigma.c | 53 +--- 1 file changed, 24 insertions(+), 29 deletions(-) diff --git a/drivers/staging/comedi/drivers/usbduxsigma.c b/drivers/staging/comedi/drivers/usbduxsigma.c in

[PATCH 3.16 - 3.18] staging: comedi: usbduxsigma: don't clobber ao_timer in command test

2015-09-16 Thread Ian Abbott
though currently only "scan" timing is supported. Fixes: fb1ef622e7a3 ("staging: comedi: usbduxsigma: tidy up analog output command support") Signed-off-by: Ian Abbott --- drivers/staging/comedi/drivers/usbduxsigma.c | 46 1 file changed, 20 inserti

[PATCH 3.12 - 3.15] staging: comedi: usbduxsigma: don't clobber ai_timer in command test

2015-09-16 Thread Ian Abbott
g: comedi: usbduxsigma: tidy up analog input command support) Signed-off-by: Ian Abbott --- drivers/staging/comedi/drivers/usbduxsigma.c | 58 +--- 1 file changed, 27 insertions(+), 31 deletions(-) diff --git a/drivers/staging/comedi/drivers/usbduxsigma.c b/drivers/stagin

[PATCH 3.12 - 3.15] staging: comedi: usbduxsigma: don't clobber ao_timer in command test

2015-09-16 Thread Ian Abbott
vert" timing is being used, although currently only "scan" timing is supported. Fixes: fb1ef622e7a3 ("staging: comedi: usbduxsigma: tidy up analog output command support") Signed-off-by: Ian Abbott --- drivers/staging/comedi/drivers/usbduxsigma.c | 41 ---

[PATCH 1/7] staging: comedi: comedi_compat32.c: fix COMEDI_CMD copy back

2015-01-27 Thread Ian Abbott
o user-space, which is at odds with the way the regular `COMEDI_CMD` ioctl is handled. To fix it, change `compat_cmd()` to copy a 32-bit compatible version of the `struct comedi_cmd` back to user-space when the main ioctl handler returns `-EAGAIN`. Signed-off-by: Ian Abbott Cc: --- drivers/staging

Re: [PATCH 1/7] staging: comedi: comedi_compat32.c: fix COMEDI_CMD copy back

2015-01-27 Thread Ian Abbott
On 27/01/15 15:50, Ian Abbott wrote: `do_cmd_ioctl()` in "comedi_fops.c" handles the `COMEDI_CMD` ioctl. This returns `-EAGAIN` if it has copied a modified `struct comedi_cmd` back to user-space. (This occurs when the low-level Comedi driver's `do_cmdtest()` handler returns non-z

Re: [PATCH 1/7] staging: comedi: comedi_compat32.c: fix COMEDI_CMD copy back

2015-01-27 Thread Ian Abbott
On 27/01/15 17:20, Hartley Sweeten wrote: On Tuesday, January 27, 2015 8:59 AM, Ian Abbott wrote: On 27/01/15 15:50, Ian Abbott wrote: `do_cmd_ioctl()` in "comedi_fops.c" handles the `COMEDI_CMD` ioctl. This returns `-EAGAIN` if it has copied a modified `struct comedi_cmd` back to

[PATCH v2 1/6] staging: comedi: comedi_compat32.c: fix COMEDI_CMD copy back

2015-01-27 Thread Ian Abbott
o user-space, which is at odds with the way the regular `COMEDI_CMD` ioctl is handled. To fix it, change `compat_cmd()` to copy a 32-bit compatible version of the `struct comedi_cmd` back to user-space when the main ioctl handler returns `-EAGAIN`. Signed-off-by: Ian Abbott Cc: --- v2: keep exist

[PATCH 3.18 and 3.19] staging: comedi: cb_pcidas64: fix incorrect AI range code handling

2015-02-27 Thread Ian Abbott
boards (and the commented out variants). Signed-off-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- Note: The upstream patch has previously been Cc'd to stable for 3.18.y but it also applies to 3.19.y. --- drivers/staging/comedi/drivers/cb_pcidas64.c | 122 --- 1

[PATCH 3.14 to 3.16] staging: comedi: cb_pcidas64: fix incorrect AI range code handling

2015-02-27 Thread Ian Abbott
boards (and the commented out variants). Signed-off-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/cb_pcidas64.c | 122 --- 1 file changed, 75 insertions(+), 47 deletions(-) diff --git a/drivers/staging/comedi/drivers/cb_pcidas64.c b

[PATCH 3.10 to 3.13] staging: comedi: cb_pcidas64: fix incorrect AI range code handling

2015-02-27 Thread Ian Abbott
boards (and the commented out variants). Signed-off-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/cb_pcidas64.c | 122 --- 1 file changed, 75 insertions(+), 47 deletions(-) diff --git a/drivers/staging/comedi/drivers/cb_pcidas64.c b

[PATCH 3.8 to 3.9] staging: comedi: cb_pcidas64: fix incorrect AI range code handling

2015-02-27 Thread Ian Abbott
boards (and the commented out variants). Signed-off-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/cb_pcidas64.c | 122 --- 1 file changed, 75 insertions(+), 47 deletions(-) diff --git a/drivers/staging/comedi/drivers/cb_pcidas64.c b

[PATCH 2.6.32 to 3.7] staging: comedi: cb_pcidas64: fix incorrect AI range code handling

2015-02-27 Thread Ian Abbott
boards (and the commented out variants). Signed-off-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/cb_pcidas64.c | 123 --- 1 file changed, 75 insertions(+), 48 deletions(-) diff --git a/drivers/staging/comedi/drivers/cb_pcidas64.c b

[PATCH 2.6.22 to 4.0] spi: spidev: fix possible arithmetic overflow for multi-transfer message

2015-04-17 Thread Ian Abbott
n Carpenter for reporting the potential integer overflow. Signed-off-by: Ian Abbott --- Note: original commit compares the lengths to INT_MAX instead of bufsiz due to changes in earlier commits. --- drivers/spi/spidev.c | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers

[PATCH 3.4.y] staging: comedi: amplc_pc236: fix invalid register access during detach

2012-10-27 Thread Ian Abbott
are registers can be accessed. It also implies the comedi device private data pointer is valid, so there is no need to check it. Signed-off-by: Ian Abbott --- This patch is for the stable 3.4 kernel. --- drivers/staging/comedi/drivers/amplc_pc236.c | 2 +- 1 file changed, 1 insertion(+), 1 delet

[PATCH 3.0.y] staging: comedi: amplc_pc236: fix invalid register access during detach

2012-10-27 Thread Ian Abbott
are registers can be accessed. It also implies the comedi device private data pointer is valid, so there is no need to check it. Signed-off-by: Ian Abbott --- This patch is for the stable 3.0 kernel. --- drivers/staging/comedi/drivers/amplc_pc236.c | 2 +- 1 file changed, 1 insertion(+), 1 delet

[PATCH] staging: comedi: Fix reversed test in comedi_device_attach()

2012-08-14 Thread Ian Abbott
to Stephen N Chivers for discovering the bug and suggesting the fix. Cc: # 3.5.x Signed-off-by: Ian Abbott --- drivers/staging/comedi/drivers.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/drivers/staging/comedi/drivers.c b/drivers/staging/comedi/drivers.c index

Re: [PATCH] staging: comedi: Fix reversed test in comedi_device_attach()

2012-08-14 Thread Ian Abbott
On 2012-08-14 13:04, Dan Carpenter wrote: On Tue, Aug 14, 2012 at 11:29:17AM +0100, Ian Abbott wrote: Commit 3902a370281d2f2b130f141e8cf94eab40125769 by yours truly Please give a human readable patch title as well. Sorry. It's: staging: comedi: refactor comedi_device_attach() a bit a

[PATCH 02/21] staging: comedi: das08: Correct AO output for das08jr-16-ao

2012-08-31 Thread Ian Abbott
Don't zero out bits 15..12 of the data value in `das08jr_ao_winsn()` as that knobbles the upper three-quarters of the output range for the 'das08jr-16-ao' board. Cc: Signed-off-by: Ian Abbott --- drivers/staging/comedi/drivers/das08.c | 2 +- 1 file changed, 1 insertion(+), 1 de

[PATCH 01/21] staging: comedi: das08: Correct AI encoding for das08jr-16-ao

2012-08-31 Thread Ian Abbott
er at offset 0 seems incorrect in the user manual "cio-das08jr-16-ao.pdf" as it implies that the AI resolution is only 12 bits. The diagrams of the A/D LSB and MSB registers show 15 data bits and a sign bit, which matches what the software expects for the `das08_encode16` AI encoding method.

[PATCH 49/50] staging: comedi: don't dereference user memory for INSN_INTTRIG

2012-09-18 Thread Ian Abbott
gned-off-by: Ian Abbott --- drivers/staging/comedi/comedi_fops.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/comedi/comedi_fops.c b/drivers/staging/comedi/comedi_fops.c index 55722b3..b266cb2 100644 --- a/drivers/staging/comedi/comedi_fops.c +++ b/drivers/sta

[PATCH 5/9] staging: comedi: fix memory leak for saved channel list

2012-09-19 Thread Ian Abbott
e_nonbusy()` instead of `do_cmd_ioctl()` and clear the pointer to prevent it being freed more than once. Note that `cleanup_device()` could be called at an inappropriate time while the comedi device is open, but that's a separate bug not related to this this patch. Cc: stable@vger.kernel.org Signed-off-

[PATCH 1/2] staging: comedi: s626: don't dereference insn->data

2012-09-24 Thread Ian Abbott
`s626_enc_insn_config()` is incorrectly dereferencing `insn->data` which is a pointer to user memory. It should be dereferencing the separate `data` parameter that points to a copy of the data in kernel memory. Cc: stable@vger.kernel.org Signed-off-by: Ian Abbott --- drivers/staging/com

[PATCH] staging: comedi: jr3_pci: fix iomem dereference

2012-09-27 Thread Ian Abbott
Correct a direct dereference of I/O memory to use an appropriate I/O memory access function. Note that the pointer being dereferenced is not currently tagged with `__iomem` but I plan to correct that for 3.7. Cc: stable@vger.kernel.org Signed-off-by: Ian Abbott --- drivers/staging/comedi