* [PATCH] Staging: comedi: fix information leak
@ 2015-03-09 20:08 Matteo Semenzato
2015-03-09 23:34 ` Ian Abbott
2015-03-10 6:44 ` Dan Carpenter
0 siblings, 2 replies; 3+ messages in thread
From: Matteo Semenzato @ 2015-03-09 20:08 UTC (permalink / raw)
To: gregkh, abbotti, hsweeten; +Cc: devel, linux-kernel, Matteo Semenzato
From: Matteo Semenzato <mattew8898@gmail.com>
The comedi_cmd struct has an hole after chanlist_len that could contain uninitialized
memory, this struct is copied to userspace.
Signed-off-by: Matteo Semenato <mattew8898@gmail.com>
---
drivers/staging/comedi/comedi_fops.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/staging/comedi/comedi_fops.c b/drivers/staging/comedi/comedi_fops.c
index 727640e..1cdf0a2 100644
--- a/drivers/staging/comedi/comedi_fops.c
+++ b/drivers/staging/comedi/comedi_fops.c
@@ -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)
--
2.3.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] Staging: comedi: fix information leak
2015-03-09 20:08 [PATCH] Staging: comedi: fix information leak Matteo Semenzato
@ 2015-03-09 23:34 ` Ian Abbott
2015-03-10 6:44 ` Dan Carpenter
1 sibling, 0 replies; 3+ messages in thread
From: Ian Abbott @ 2015-03-09 23:34 UTC (permalink / raw)
To: Matteo Semenzato, gregkh, hsweeten; +Cc: devel, linux-kernel
On 09/03/15 20:08, Matteo Semenzato wrote:
> From: Matteo Semenzato <mattew8898@gmail.com>
>
> The comedi_cmd struct has an hole after chanlist_len that could contain uninitialized
> memory, this struct is copied to userspace.
>
> Signed-off-by: Matteo Semenato <mattew8898@gmail.com>
> ---
> drivers/staging/comedi/comedi_fops.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/drivers/staging/comedi/comedi_fops.c b/drivers/staging/comedi/comedi_fops.c
> index 727640e..1cdf0a2 100644
> --- a/drivers/staging/comedi/comedi_fops.c
> +++ b/drivers/staging/comedi/comedi_fops.c
> @@ -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.
--
-=( Ian Abbott @ MEV Ltd. E-mail: <abbotti@mev.co.uk> )=-
-=( Web: http://www.mev.co.uk/ )=-
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] Staging: comedi: fix information leak
2015-03-09 20:08 [PATCH] Staging: comedi: fix information leak Matteo Semenzato
2015-03-09 23:34 ` Ian Abbott
@ 2015-03-10 6:44 ` Dan Carpenter
1 sibling, 0 replies; 3+ messages in thread
From: Dan Carpenter @ 2015-03-10 6:44 UTC (permalink / raw)
To: Matteo Semenzato; +Cc: gregkh, abbotti, hsweeten, devel, linux-kernel
On Mon, Mar 09, 2015 at 09:08:17PM +0100, Matteo Semenzato wrote:
> From: Matteo Semenzato <mattew8898@gmail.com>
>
> The comedi_cmd struct has an hole after chanlist_len that 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
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-03-10 6:45 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-03-09 20:08 [PATCH] Staging: comedi: fix information leak Matteo Semenzato
2015-03-09 23:34 ` Ian Abbott
2015-03-10 6:44 ` Dan Carpenter
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox