* [PATCH 1/3] aacraid: Fix return code interpretation
@ 2006-06-08 16:50 Mark Haverkamp
2006-06-08 20:11 ` Christoph Hellwig
0 siblings, 1 reply; 5+ messages in thread
From: Mark Haverkamp @ 2006-06-08 16:50 UTC (permalink / raw)
To: James Bottomley; +Cc: linux-scsi, Mark Salyzyn
Received from Mark Salyzyn
clear_user return is 0 for success, the code fragment is written to
assume that it is the count of the number of bytes zero'd.
Signed-off-by: Mark Haverkamp <markh@osdl.org>
---
Applies to the scsi-misc-2.6 git tree.
--- scsi-misc-aac.orig/drivers/scsi/aacraid/linit.c 2006-06-08 09:37:43.000000000 -0700
+++ scsi-misc-aac/drivers/scsi/aacraid/linit.c 2006-06-08 09:38:40.000000000 -0700
@@ -564,7 +564,7 @@
f = compat_alloc_user_space(sizeof(*f));
ret = 0;
- if (clear_user(f, sizeof(*f)) != sizeof(*f))
+ if (clear_user(f, sizeof(*f)))
ret = -EFAULT;
if (copy_in_user(f, (void __user *)arg, sizeof(struct fib_ioctl) - sizeof(u32)))
ret = -EFAULT;
--
Mark Haverkamp <markh@osdl.org>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 1/3] aacraid: Fix return code interpretation
2006-06-08 16:50 [PATCH 1/3] aacraid: Fix return code interpretation Mark Haverkamp
@ 2006-06-08 20:11 ` Christoph Hellwig
0 siblings, 0 replies; 5+ messages in thread
From: Christoph Hellwig @ 2006-06-08 20:11 UTC (permalink / raw)
To: Mark Haverkamp; +Cc: James Bottomley, linux-scsi, Mark Salyzyn
> @@ -564,7 +564,7 @@
>
> f = compat_alloc_user_space(sizeof(*f));
> ret = 0;
> - if (clear_user(f, sizeof(*f)) != sizeof(*f))
> + if (clear_user(f, sizeof(*f)))
> ret = -EFAULT;
> if (copy_in_user(f, (void __user *)arg, sizeof(struct fib_ioctl) - sizeof(u32)))
> ret = -EFAULT;
>
just remove the clear_user call completely, it's not needed.
^ permalink raw reply [flat|nested] 5+ messages in thread
* RE: [PATCH 1/3] aacraid: Fix return code interpretation
@ 2006-06-09 12:00 Salyzyn, Mark
2006-06-09 16:22 ` Mark Haverkamp
0 siblings, 1 reply; 5+ messages in thread
From: Salyzyn, Mark @ 2006-06-09 12:00 UTC (permalink / raw)
To: Christoph Hellwig, Mark Haverkamp; +Cc: James Bottomley, linux-scsi
Are you sure of this? The code that follows expects the end of the
structure to be cleared.
Sincerely -- Mark Salyzyn
> -----Original Message-----
> From: Christoph Hellwig [mailto:hch@infradead.org]
> Sent: Thursday, June 08, 2006 4:11 PM
> To: Mark Haverkamp
> Cc: James Bottomley; linux-scsi; Salyzyn, Mark
> Subject: Re: [PATCH 1/3] aacraid: Fix return code interpretation
>
>
> > @@ -564,7 +564,7 @@
> >
> > f = compat_alloc_user_space(sizeof(*f));
> > ret = 0;
> > - if (clear_user(f, sizeof(*f)) != sizeof(*f))
> > + if (clear_user(f, sizeof(*f)))
> > ret = -EFAULT;
> > if (copy_in_user(f, (void __user *)arg,
> sizeof(struct fib_ioctl) - sizeof(u32)))
> > ret = -EFAULT;
> >
>
> just remove the clear_user call completely, it's not needed.
>
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* RE: [PATCH 1/3] aacraid: Fix return code interpretation
2006-06-09 12:00 Salyzyn, Mark
@ 2006-06-09 16:22 ` Mark Haverkamp
0 siblings, 0 replies; 5+ messages in thread
From: Mark Haverkamp @ 2006-06-09 16:22 UTC (permalink / raw)
To: Salyzyn, Mark; +Cc: Christoph Hellwig, James Bottomley, linux-scsi
On Fri, 2006-06-09 at 08:00 -0400, Salyzyn, Mark wrote:
> Are you sure of this? The code that follows expects the end of the
> structure to be cleared.
Could you clarify? It looks like copy_in_user copies one u32 less than
the structure size and leaves that last word uninitialized? The last
element of fib_ioctl (fib) is a char pointer though.
I can't see where f.fib is initialized in next_adapter_fib even though
copy_to_user is called. Even if clear_user is called, doesn't that
mean that f.fib in next_adapter_fib will be only partially NULL,
Mark.
>
> Sincerely -- Mark Salyzyn
>
> > -----Original Message-----
> > From: Christoph Hellwig [mailto:hch@infradead.org]
> > Sent: Thursday, June 08, 2006 4:11 PM
> > To: Mark Haverkamp
> > Cc: James Bottomley; linux-scsi; Salyzyn, Mark
> > Subject: Re: [PATCH 1/3] aacraid: Fix return code interpretation
> >
> >
> > > @@ -564,7 +564,7 @@
> > >
> > > f = compat_alloc_user_space(sizeof(*f));
> > > ret = 0;
> > > - if (clear_user(f, sizeof(*f)) != sizeof(*f))
> > > + if (clear_user(f, sizeof(*f)))
> > > ret = -EFAULT;
> > > if (copy_in_user(f, (void __user *)arg,
> > sizeof(struct fib_ioctl) - sizeof(u32)))
> > > ret = -EFAULT;
> > >
> >
> > just remove the clear_user call completely, it's not needed.
> >
> >
>
--
Mark Haverkamp <markh@osdl.org>
^ permalink raw reply [flat|nested] 5+ messages in thread
* RE: [PATCH 1/3] aacraid: Fix return code interpretation
@ 2006-06-09 17:10 Salyzyn, Mark
0 siblings, 0 replies; 5+ messages in thread
From: Salyzyn, Mark @ 2006-06-09 17:10 UTC (permalink / raw)
To: Mark Haverkamp; +Cc: Christoph Hellwig, James Bottomley, linux-scsi
Yes, that is the intent. A 32 bit application is calling a 64 bit
driver. The pointers in the 32 bit application merely need the virtual
address upper word zero'd to pass themselves off as 64 bit virtual
pointers. Yes, the clear_user call could be replaced with an =0 on the
last element, but it was more generic to clear it out completely before
copying in the subset. copy_[in|out]_user works with the constructed 64
bit virtual pointer.
Sincerely -- Mark Salyzyn
> -----Original Message-----
> From: Mark Haverkamp [mailto:markh@osdl.org]
> Sent: Friday, June 09, 2006 12:22 PM
> To: Salyzyn, Mark
> Cc: Christoph Hellwig; James Bottomley; linux-scsi
> Subject: RE: [PATCH 1/3] aacraid: Fix return code interpretation
>
>
> On Fri, 2006-06-09 at 08:00 -0400, Salyzyn, Mark wrote:
> > Are you sure of this? The code that follows expects the end of the
> > structure to be cleared.
>
> Could you clarify? It looks like copy_in_user copies one u32
> less than
> the structure size and leaves that last word uninitialized? The last
> element of fib_ioctl (fib) is a char pointer though.
>
> I can't see where f.fib is initialized in next_adapter_fib even though
> copy_to_user is called. Even if clear_user is called, doesn't that
> mean that f.fib in next_adapter_fib will be only partially NULL,
>
> Mark.
>
>
> >
> > Sincerely -- Mark Salyzyn
> >
> > > -----Original Message-----
> > > From: Christoph Hellwig [mailto:hch@infradead.org]
> > > Sent: Thursday, June 08, 2006 4:11 PM
> > > To: Mark Haverkamp
> > > Cc: James Bottomley; linux-scsi; Salyzyn, Mark
> > > Subject: Re: [PATCH 1/3] aacraid: Fix return code interpretation
> > >
> > >
> > > > @@ -564,7 +564,7 @@
> > > >
> > > > f = compat_alloc_user_space(sizeof(*f));
> > > > ret = 0;
> > > > - if (clear_user(f, sizeof(*f)) != sizeof(*f))
> > > > + if (clear_user(f, sizeof(*f)))
> > > > ret = -EFAULT;
> > > > if (copy_in_user(f, (void __user *)arg,
> > > sizeof(struct fib_ioctl) - sizeof(u32)))
> > > > ret = -EFAULT;
> > > >
> > >
> > > just remove the clear_user call completely, it's not needed.
> > >
> > >
> >
> --
> Mark Haverkamp <markh@osdl.org>
>
>
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2006-06-09 17:10 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-06-08 16:50 [PATCH 1/3] aacraid: Fix return code interpretation Mark Haverkamp
2006-06-08 20:11 ` Christoph Hellwig
-- strict thread matches above, loose matches on Subject: below --
2006-06-09 12:00 Salyzyn, Mark
2006-06-09 16:22 ` Mark Haverkamp
2006-06-09 17:10 Salyzyn, Mark
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.