<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux/drivers/staging/comedi, branch v3.7.7</title>
<subtitle>Linux kernel source tree</subtitle>
<id>https://git.amat.us/linux/atom/drivers/staging/comedi?h=v3.7.7</id>
<link rel='self' href='https://git.amat.us/linux/atom/drivers/staging/comedi?h=v3.7.7'/>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/'/>
<updated>2013-01-17T16:46:35Z</updated>
<entry>
<title>staging: comedi: comedi_test: fix race when cancelling command</title>
<updated>2013-01-17T16:46:35Z</updated>
<author>
<name>Ian Abbott</name>
<email>abbotti@mev.co.uk</email>
</author>
<published>2013-01-04T11:33:21Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=6c1a00ab82e6749b5165cee08af2056d62fd752c'/>
<id>urn:sha1:6c1a00ab82e6749b5165cee08af2056d62fd752c</id>
<content type='text'>
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-&gt;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 &lt;abbotti@mev.co.uk&gt;
Reported-by: Éric Piel &lt;piel@delmic.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>staging: comedi: Kconfig: COMEDI_NI_AT_A2150 should select COMEDI_FC</title>
<updated>2013-01-17T16:46:35Z</updated>
<author>
<name>Ian Abbott</name>
<email>abbotti@mev.co.uk</email>
</author>
<published>2013-01-03T12:15:26Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=dd6fd3c34614fc138369da20c535840a03e998ec'/>
<id>urn:sha1:dd6fd3c34614fc138369da20c535840a03e998ec</id>
<content type='text'>
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 &lt;abbotti@mev.co.uk&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>staging: comedi: fix minimum AO period for NI 625x and NI 628x</title>
<updated>2013-01-17T16:46:31Z</updated>
<author>
<name>Éric Piel</name>
<email>piel@delmic.com</email>
</author>
<published>2012-12-19T12:03:13Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=81b2b4fb16aadd1d161307d7535f619aa3f3b877'/>
<id>urn:sha1:81b2b4fb16aadd1d161307d7535f619aa3f3b877</id>
<content type='text'>
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 &lt;piel@delmic.com&gt;
Acked-By: Ian Abbott &lt;abbotti@mev.co.uk&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>staging: comedi: prevent auto-unconfig of manually configured devices</title>
<updated>2013-01-17T16:46:26Z</updated>
<author>
<name>Ian Abbott</name>
<email>abbotti@mev.co.uk</email>
</author>
<published>2012-12-04T15:59:55Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=75ded7cb00915fc666186635b31796f9e06b8fd1'/>
<id>urn:sha1:75ded7cb00915fc666186635b31796f9e06b8fd1</id>
<content type='text'>
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 &lt;abbotti@mev.co.uk&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>staging: comedi: ni_labpc: fix possible NULL deref during detach</title>
<updated>2012-10-22T18:46:35Z</updated>
<author>
<name>Ian Abbott</name>
<email>abbotti@mev.co.uk</email>
</author>
<published>2012-10-03T15:25:21Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=922b67c1ac53014d80649a961a2fde700cd065d8'/>
<id>urn:sha1:922b67c1ac53014d80649a961a2fde700cd065d8</id>
<content type='text'>
`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-&gt;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-&gt;private` and that is freed by the comedi
core, not by this function.

Cc: &lt;stable@vger.kernel.org&gt; # 3.6.x
Signed-off-by: Ian Abbott &lt;abbotti@mev.co.uk&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>staging: comedi: das08: fix possible NULL deref during detach</title>
<updated>2012-10-22T18:46:35Z</updated>
<author>
<name>Ian Abbott</name>
<email>abbotti@mev.co.uk</email>
</author>
<published>2012-10-03T15:25:20Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=ee280d134f2e05e0172369a53fbe202dbfc527fa'/>
<id>urn:sha1:ee280d134f2e05e0172369a53fbe202dbfc527fa</id>
<content type='text'>
`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-&gt;private` and that is freed by the comedi core,
not by this function.

Cc: &lt;stable@vger.kernel.org&gt; # 3.6.x
Signed-off-by: Ian Abbott &lt;abbotti@mev.co.uk&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>staging: comedi: amplc_pc263: fix possible NULL deref during detach</title>
<updated>2012-10-22T18:46:35Z</updated>
<author>
<name>Ian Abbott</name>
<email>abbotti@mev.co.uk</email>
</author>
<published>2012-10-03T15:25:19Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=1d1171ffda585c1cab7bd7cf4bd8f8fd5923fb4a'/>
<id>urn:sha1:1d1171ffda585c1cab7bd7cf4bd8f8fd5923fb4a</id>
<content type='text'>
`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: &lt;stable@vger.kernel.org&gt; # 3.6.x
Signed-off-by: Ian Abbott &lt;abbotti@mev.co.uk&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>staging: comedi: amplc_pc236: fix possible NULL deref during detach</title>
<updated>2012-10-22T18:46:35Z</updated>
<author>
<name>Ian Abbott</name>
<email>abbotti@mev.co.uk</email>
</author>
<published>2012-10-03T15:25:18Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=2db012bd40b889d8e5483d3daa07af04c4c109d8'/>
<id>urn:sha1:2db012bd40b889d8e5483d3daa07af04c4c109d8</id>
<content type='text'>
`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-&gt;private` and that is freed by the comedi core,
not by this function.

Cc: &lt;stable@vger.kernel.org&gt; # 3.6.x
Signed-off-by: Ian Abbott &lt;abbotti@mev.co.uk&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>staging: comedi: amplc_pc236: fix invalid register access during detach</title>
<updated>2012-10-22T18:46:35Z</updated>
<author>
<name>Ian Abbott</name>
<email>abbotti@mev.co.uk</email>
</author>
<published>2012-10-03T15:25:17Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=aaeb61a97b7159ebe30b18a422d04eeabfa8790b'/>
<id>urn:sha1:aaeb61a97b7159ebe30b18a422d04eeabfa8790b</id>
<content type='text'>
`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-&gt;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: &lt;stable@vger.kernel.org&gt; # 3.5.x, 3.6.x
Signed-off-by: Ian Abbott &lt;abbotti@mev.co.uk&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>staging: comedi: amplc_dio200: fix possible NULL deref during detach</title>
<updated>2012-10-22T18:46:35Z</updated>
<author>
<name>Ian Abbott</name>
<email>abbotti@mev.co.uk</email>
</author>
<published>2012-10-03T15:25:16Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=dfb2540e91e1f63765bc3ff497ad0b714d774261'/>
<id>urn:sha1:dfb2540e91e1f63765bc3ff497ad0b714d774261</id>
<content type='text'>
`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-&gt;private` and that is freed by
the comedi core, not by this function.

Cc: &lt;stable@vger.kernel.org&gt; # 3.6.x
Signed-off-by: Ian Abbott &lt;abbotti@mev.co.uk&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
</feed>
