Re: [PATCH] sysctl: fix min/max handling in __do_proc_doulongvec_minmax()

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Eric Dumazet
Date: Monday, October 4, 2010 - 3:10 am

Le lundi 04 octobre 2010 à 17:34 +0800, Américo Wang a écrit :

Please re-read again. I had crashes, so original code is bugyy.

Say you call __do_proc_doulongvec_minmax() with an array of three
elements. And .extra1 = NULL, .extra2 = NULL (no range checks, this is a
valid use case)

First element, min = NULL OK. no problem so far.

Second element, min = (long *)(NULL + sizeof(long))   -> BUG 

Third element, min = (long *)(NULL + 2*sizeof(long)) -> BUG 

After my patch, min/max increases normally (they are only pointers after
all)

But they are _dereferenced_ only if they were _not_ NULL at the
beginning (extra1 not NULL for *min, extra2 not NULL for *max)



--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Re: [PATCH] sysctl: fix min/max handling in __do_proc_doul ..., Eric Dumazet, (Mon Oct 4, 3:10 am)
Re: [PATCH] sysctl: fix min/max handling in __do_proc_doul ..., Eric W. Biederman, (Thu Oct 7, 12:38 pm)