netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATRCH] janitor: hermes: delete verify_area call
@ 2003-09-26  4:59 Randy.Dunlap
  2003-09-29  5:29 ` David Gibson
  0 siblings, 1 reply; 5+ messages in thread
From: Randy.Dunlap @ 2003-09-26  4:59 UTC (permalink / raw)
  To: netdev; +Cc: hermes, jgarzik


Hi,
Please apply to 2.6.0-test5-current.

Thanks,
--
~Randy


From: Domen Puncer <domen@coderock.org>

IMO, that verify_area wasn't needed.



 linux-260-t5bk12-kj-rddunlap/drivers/net/wireless/orinoco.c |    4 ----
 1 files changed, 4 deletions(-)

diff -puN drivers/net/wireless/orinoco.c~net_wireless_orinoco_verify drivers/net/wireless/orinoco.c
--- linux-260-t5bk12-kj/drivers/net/wireless/orinoco.c~net_wireless_orinoco_verify	2003-09-25 16:03:17.000000000 -0700
+++ linux-260-t5bk12-kj-rddunlap/drivers/net/wireless/orinoco.c	2003-09-25 16:03:17.000000000 -0700
@@ -3833,10 +3833,6 @@ orinoco_ioctl(struct net_device *dev, st
 				{ SIOCIWLASTPRIV, 0, 0, "dump_recs" },
 			};
 
-			err = verify_area(VERIFY_WRITE, wrq->u.data.pointer, sizeof(privtab));
-			if (err)
-				break;
-			
 			wrq->u.data.length = sizeof(privtab) / sizeof(privtab[0]);
 			if (copy_to_user(wrq->u.data.pointer, privtab, sizeof(privtab)))
 				err = -EFAULT;

_

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATRCH] janitor: hermes: delete verify_area call
  2003-09-26  4:59 [PATRCH] janitor: hermes: delete verify_area call Randy.Dunlap
@ 2003-09-29  5:29 ` David Gibson
  2003-09-29 20:06   ` Randy.Dunlap
  2003-09-30  5:15   ` David S. Miller
  0 siblings, 2 replies; 5+ messages in thread
From: David Gibson @ 2003-09-29  5:29 UTC (permalink / raw)
  To: Randy.Dunlap; +Cc: netdev, jgarzik

On Thu, Sep 25, 2003 at 09:59:02PM -0700, Randy.Dunlap wrote:
> 
> Hi,
> Please apply to 2.6.0-test5-current.
> 
> Thanks,

Sorry, can you clarify why this verify_area() is not needed?
                                                                                
From: Domen Puncer <domen@coderock.org>
                                                                                
IMO, that verify_area wasn't needed.
                                                                                
                                                                                
                                                                                
 linux-260-t5bk12-kj-rddunlap/drivers/net/wireless/orinoco.c |    4
 ----
 1 files changed, 4 deletions(-)
                                                                                
diff -puN drivers/net/wireless/orinoco.c~net_wireless_orinoco_verify
+drivers/net/wireless/orinoco.c
---
+linux-260-t5bk12-kj/drivers/net/wireless/orinoco.c~net_wireless_orinoco_verify
+2003-09-25 16:03:17.000000000 -0700
+++ linux-260-t5bk12-kj-rddunlap/drivers/net/wireless/orinoco.c
2003-09-25
+16:03:17.000000000 -0700
@@ -3833,10 +3833,6 @@ orinoco_ioctl(struct net_device *dev, st
                                { SIOCIWLASTPRIV, 0, 0, "dump_recs" },
                        };
                                                                                
-                       err = verify_area(VERIFY_WRITE,
wrq->u.data.pointer,
+sizeof(privtab));
-                       if (err)
-                               break;
-
                        wrq->u.data.length = sizeof(privtab) /
+sizeof(privtab[0]);
                        if (copy_to_user(wrq->u.data.pointer, privtab,
+sizeof(privtab)))
                                err = -EFAULT;
                                                                                
_


-- 
David Gibson			| For every complex problem there is a
david@gibson.dropbear.id.au	| solution which is simple, neat and
				| wrong.
http://www.ozlabs.org/people/dgibson

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATRCH] janitor: hermes: delete verify_area call
  2003-09-29  5:29 ` David Gibson
@ 2003-09-29 20:06   ` Randy.Dunlap
  2003-09-30  4:51     ` David Gibson
  2003-09-30  5:15   ` David S. Miller
  1 sibling, 1 reply; 5+ messages in thread
From: Randy.Dunlap @ 2003-09-29 20:06 UTC (permalink / raw)
  To: David Gibson; +Cc: netdev, jgarzik

On Mon, 29 Sep 2003 15:29:25 +1000 David Gibson <hermes@gibson.dropbear.id.au> wrote:

| On Thu, Sep 25, 2003 at 09:59:02PM -0700, Randy.Dunlap wrote:
| > 
| > Hi,
| > Please apply to 2.6.0-test5-current.
| > 
| > Thanks,
| 
| Sorry, can you clarify why this verify_area() is not needed?


Sure, I'll try to do that.
There are several related reasons for it.

Summary:
Using verify_area() [or access_ok()] is redundant if copy*user(),
get_user(), or put_user() is being used, but must (*should*) be used
if __copy*user(), __get_user(), or __put_user() are being used.

a.  [include/asm-i386/uaccess.h] verify_area: - Obsolete, use access_ok()

b.  copy_*_user() already calls access_ok() to validate the user address.
    The __* versions of copy*user() and __get/put_user() do not use
    access_ok(), so checking must be done before using them.


HTH.
--
~Randy


| From: Domen Puncer <domen@coderock.org>
|                                                                                 
| IMO, that verify_area wasn't needed.
|                                                                                 
|  linux-260-t5bk12-kj-rddunlap/drivers/net/wireless/orinoco.c |    4
|  ----
|  1 files changed, 4 deletions(-)
|                                                                                 
| diff -puN drivers/net/wireless/orinoco.c~net_wireless_orinoco_verify
| +drivers/net/wireless/orinoco.c
| ---
| +linux-260-t5bk12-kj/drivers/net/wireless/orinoco.c~net_wireless_orinoco_verify
| +2003-09-25 16:03:17.000000000 -0700
| +++ linux-260-t5bk12-kj-rddunlap/drivers/net/wireless/orinoco.c
| 2003-09-25
| +16:03:17.000000000 -0700
| @@ -3833,10 +3833,6 @@ orinoco_ioctl(struct net_device *dev, st
|                                 { SIOCIWLASTPRIV, 0, 0, "dump_recs" },
|                         };
|                                                                                 
| -                       err = verify_area(VERIFY_WRITE,
| wrq->u.data.pointer,
| +sizeof(privtab));
| -                       if (err)
| -                               break;
| -
|                         wrq->u.data.length = sizeof(privtab) /
| +sizeof(privtab[0]);
|                         if (copy_to_user(wrq->u.data.pointer, privtab,
| +sizeof(privtab)))
|                                 err = -EFAULT;

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATRCH] janitor: hermes: delete verify_area call
  2003-09-29 20:06   ` Randy.Dunlap
@ 2003-09-30  4:51     ` David Gibson
  0 siblings, 0 replies; 5+ messages in thread
From: David Gibson @ 2003-09-30  4:51 UTC (permalink / raw)
  To: Randy.Dunlap; +Cc: netdev, jgarzik

On Mon, Sep 29, 2003 at 01:06:08PM -0700, Randy.Dunlap wrote:
> On Mon, 29 Sep 2003 15:29:25 +1000 David Gibson <hermes@gibson.dropbear.id.au> wrote:
> 
> | On Thu, Sep 25, 2003 at 09:59:02PM -0700, Randy.Dunlap wrote:
> | > 
> | > Hi,
> | > Please apply to 2.6.0-test5-current.
> | > 
> | > Thanks,
> | 
> | Sorry, can you clarify why this verify_area() is not needed?
> 
> 
> Sure, I'll try to do that.
> There are several related reasons for it.
> 
> Summary:
> Using verify_area() [or access_ok()] is redundant if copy*user(),
> get_user(), or put_user() is being used, but must (*should*) be used
> if __copy*user(), __get_user(), or __put_user() are being used.
> 
> a.  [include/asm-i386/uaccess.h] verify_area: - Obsolete, use access_ok()
> 
> b.  copy_*_user() already calls access_ok() to validate the user address.
>     The __* versions of copy*user() and __get/put_user() do not use
>     access_ok(), so checking must be done before using them.

Ah, ok, thanks.  In that case presumably the other call to
verify_area() doesn't need to be there either...

-- 
David Gibson			| For every complex problem there is a
david@gibson.dropbear.id.au	| solution which is simple, neat and
				| wrong.
http://www.ozlabs.org/people/dgibson

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATRCH] janitor: hermes: delete verify_area call
  2003-09-29  5:29 ` David Gibson
  2003-09-29 20:06   ` Randy.Dunlap
@ 2003-09-30  5:15   ` David S. Miller
  1 sibling, 0 replies; 5+ messages in thread
From: David S. Miller @ 2003-09-30  5:15 UTC (permalink / raw)
  To: David Gibson; +Cc: rddunlap, netdev, jgarzik

On Mon, 29 Sep 2003 15:29:25 +1000
David Gibson <hermes@gibson.dropbear.id.au> wrote:

> Sorry, can you clarify why this verify_area() is not needed?

copy_{to,from}_user() and friends do the verify_area().

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2003-09-30  5:15 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-09-26  4:59 [PATRCH] janitor: hermes: delete verify_area call Randy.Dunlap
2003-09-29  5:29 ` David Gibson
2003-09-29 20:06   ` Randy.Dunlap
2003-09-30  4:51     ` David Gibson
2003-09-30  5:15   ` David S. Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).