Staging: comedi: fix information leak
PATCH 1/1 Staging: comedi: fix information leak
From: Matteo Semenzato <[email protected]>
The comedi_cmd struct has an hole after chanlist_len that could contain uninitialized memory, this struct is copied to userspace.
--- drivers/staging/comedi/comedi_fops.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/staging/comedi/comedi_fops.c +2 -0
@@ -1718,6 +1718,8 @@ static int do_cmdtest_ioctl(struct comedi_device *dev,unsigned int __user *user_chanlist;int ret; +memset (&cmd,0 ,sizeof (cmd)); +/* get the user's cmd and do some simple validation */ ret =__comedi_get_user_cmd (dev, arg, &cmd);if (ret)
Signature · 1 line
2.3.2
Quoted 16 lines · Matteo Semenzato
From: Matteo Semenzato <[email protected]>
The
comedi_cmdstruct has an hole afterchanlist_lenthat could contain uninitialized memory, this struct is copied to userspace.Signed-off-by Matteo Semenato <[email protected]>--- drivers/staging/comedi/comedi_fops.c | 2 ++ 1 file changed, 2 insertions(+)drivers/staging/comedi/comedi_fops.c +0
-0
drivers/staging/comedi/comedi_fops.c static int do_cmdtest_ioctl(struct comedi_device *dev, · line 1725
Quoted 8 lines
drivers/staging/comedi/comedi_fops.c +2
-0@@ -1718,6 +1718,8 @@ static int do_cmdtest_ioctl(struct comedi_device *dev,unsigned int __user *user_chanlist;int ret; +memset (&cmd,0 ,sizeof (cmd)); +/* get the user's cmd and do some simple validation */ ret =__comedi_get_user_cmd (dev, arg, &cmd);if (ret)
I see no information leak there. The cmd variable gets copied over with user memory by the call to __comedi_get_user_cmd(), so zero-filling it first is rather pointless.
Signature · 2 lines
-=( Ian Abbott @ MEV Ltd. E-mail: <[email protected]> )=- -=( Web: http://www.mev.co.uk/ )=-
Quoted 5 lines · Matteo Semenzato
From: Matteo Semenzato <[email protected]>
The
comedi_cmdstruct has an hole afterchanlist_lenthat could contain uninitialized memory, this struct is copied to userspace.
Is this a Smatch warning? If so then, I appologize because it's a false positive. You really need to have the cross function database built for that test to work.
The struct is initialized in __comedi_get_user_cmd().
regards,
dan carpenter