summaryrefslogtreecommitdiffstats
path: root/drivers/staging/comedi/comedi_fops.c
diff options
context:
space:
mode:
authorBernd Porr2013-12-11 17:06:15 +0100
committerGreg Kroah-Hartman2013-12-17 22:10:40 +0100
commite56b1401056288a725d50942ef300dcbed5e519a (patch)
tree58e619e30e3fd508e975d72dffb732fc5e0bfa98 /drivers/staging/comedi/comedi_fops.c
parentstaging: keucr: Fix typo in keucr driver (diff)
downloadkernel-qcow2-linux-e56b1401056288a725d50942ef300dcbed5e519a.tar.gz
kernel-qcow2-linux-e56b1401056288a725d50942ef300dcbed5e519a.tar.xz
kernel-qcow2-linux-e56b1401056288a725d50942ef300dcbed5e519a.zip
staging: comedi: fix result of memdup_user for user chanlist
If the channel list is not set in userspace we get an error at PTR_ERR(async->cmd.chanlist). However, do_become_nonbusy(dev, s) cleans up this pointer which causes a kernel ooops. Setting the channel list in async to NULL 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 <mail@berndporr.me.uk> Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/comedi/comedi_fops.c')
-rw-r--r--drivers/staging/comedi/comedi_fops.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/staging/comedi/comedi_fops.c b/drivers/staging/comedi/comedi_fops.c
index fc3404882ae8..d7f63c483ad3 100644
--- a/drivers/staging/comedi/comedi_fops.c
+++ b/drivers/staging/comedi/comedi_fops.c
@@ -1473,6 +1473,7 @@ static int do_cmd_ioctl(struct comedi_device *dev,
async->cmd.chanlist_len * sizeof(int));
if (IS_ERR(async->cmd.chanlist)) {
ret = PTR_ERR(async->cmd.chanlist);
+ async->cmd.chanlist = NULL;
dev_dbg(dev->class_dev, "memdup_user failed with code %d\n",
ret);
goto cleanup;
@@ -1595,6 +1596,7 @@ static int do_cmdtest_ioctl(struct comedi_device *dev,
cmd.chanlist_len * sizeof(int));
if (IS_ERR(chanlist)) {
ret = PTR_ERR(chanlist);
+ chanlist = NULL;
dev_dbg(dev->class_dev,
"memdup_user exited with code %d", ret);
goto cleanup;