]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
comedi: das800: Add sanity checks for I/O base address
authorIan Abbott <abbotti@mev.co.uk>
Fri, 30 Jan 2026 16:47:42 +0000 (16:47 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 2 Apr 2026 13:49:38 +0000 (15:49 +0200)
The "das800" driver uses an admin-supplied configuration option
(`it->options[0]`) to configure the I/O port base address of a supported
board in the DAS800 family.  It currently allows any base address to be
configured but the hardware only supports base addresses (configured by
an on-board DIP switch) in the range 0 to 0x3f8 on 8-byte boundaries.

Add a sanity check to ensure the device is not configured at an
unsupported base address.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Link: https://patch.msgid.link/20260130170416.49994-18-abbotti@mev.co.uk
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/comedi/drivers/das800.c

index 3007755230314f3bf08c3aafe6339cda6e08f90b..7563f40a40237501c98746a957d31704455042c5 100644 (file)
@@ -655,7 +655,8 @@ static int das800_attach(struct comedi_device *dev, struct comedi_devconfig *it)
        if (!devpriv)
                return -ENOMEM;
 
-       ret = comedi_request_region(dev, it->options[0], 0x8);
+       ret = comedi_check_request_region(dev, it->options[0], 0x8,
+                                         0, 0x3ff, 8);
        if (ret)
                return ret;