Sanity check drivers setting do_cmd without setting do_cmdtest.
authorIan Abbott <abbotti@mev.co.uk>
Tue, 21 Aug 2007 09:47:21 +0000 (09:47 +0000)
committerIan Abbott <abbotti@mev.co.uk>
Tue, 21 Aug 2007 09:47:21 +0000 (09:47 +0000)
comedi/comedi_fops.c
comedi/drivers.c

index 819d99f4b5293427e5f3a0303a48ddd1be303ed2..1b5c9bdb229a569af16bcdcbaf36d36f58d21dac 100644 (file)
@@ -889,7 +889,7 @@ static int do_cmd_ioctl(comedi_device *dev,void *arg,void *file)
                return -EIO;
        }
 
-       if(!s->do_cmd || !s->async){
+       if(!s->do_cmd || !s->do_cmdtest || !s->async){
                DPRINTK("subdevice %i does not support commands\n", user_cmd.subdev);
                return -EIO;
        }
@@ -1027,7 +1027,7 @@ static int do_cmdtest_ioctl(comedi_device *dev,void *arg,void *file)
                return -EIO;
        }
 
-       if(!s->do_cmd){
+       if(!s->do_cmd || !s->do_cmdtest){
                DPRINTK("subdevice %i does not support commands\n", user_cmd.subdev);
                return -EIO;
        }
index be47412dec6821ece3cb896964fd6a49538e0578..059ff2a0d5342fbc654fdf90b075556aa1c0738f 100644 (file)
@@ -266,6 +266,7 @@ static int postconfig(comedi_device *dev)
                        dev_t devt;
 
                        BUG_ON((s->subdev_flags & (SDF_CMD_READ | SDF_CMD_WRITE)) == 0);
+                       BUG_ON(!s->do_cmdtest);
 
                        async = kmalloc(sizeof(comedi_async), GFP_KERNEL);
                        if(async == NULL)