* [PATCH] negative groups in netlink_setsockopt
@ 2007-07-17 12:26 Johannes Berg
2007-07-18 9:08 ` David Miller
0 siblings, 1 reply; 3+ messages in thread
From: Johannes Berg @ 2007-07-17 12:26 UTC (permalink / raw)
To: David Miller; +Cc: netdev
Reading netlink_setsockopt it's not immediately clear why there isn't a
bug when you pass in negative numbers, the reason being that the >=
comparison is really unsigned although 'val' is signed because
nlk->ngroups is unsigned. Make 'val' unsigned too.
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
---
net/netlink/af_netlink.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
--- wireless-dev.orig/net/netlink/af_netlink.c 2007-07-17 14:05:14.580964463 +0200
+++ wireless-dev/net/netlink/af_netlink.c 2007-07-17 14:05:30.210964463 +0200
@@ -1012,7 +1012,8 @@ static int netlink_setsockopt(struct soc
{
struct sock *sk = sock->sk;
struct netlink_sock *nlk = nlk_sk(sk);
- int val = 0, err;
+ unsigned int val = 0;
+ int err;
if (level != SOL_NETLINK)
return -ENOPROTOOPT;
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] negative groups in netlink_setsockopt
2007-07-17 12:26 [PATCH] negative groups in netlink_setsockopt Johannes Berg
@ 2007-07-18 9:08 ` David Miller
2007-07-18 10:10 ` Johannes Berg
0 siblings, 1 reply; 3+ messages in thread
From: David Miller @ 2007-07-18 9:08 UTC (permalink / raw)
To: johannes; +Cc: netdev
From: Johannes Berg <johannes@sipsolutions.net>
Date: Tue, 17 Jul 2007 14:26:04 +0200
> Reading netlink_setsockopt it's not immediately clear why there isn't a
> bug when you pass in negative numbers, the reason being that the >=
> comparison is really unsigned although 'val' is signed because
> nlk->ngroups is unsigned. Make 'val' unsigned too.
>
> Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Applied, but I updated the "(int __user *)" cast in
get_user() to match as well when applying this.
Thanks.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] negative groups in netlink_setsockopt
2007-07-18 9:08 ` David Miller
@ 2007-07-18 10:10 ` Johannes Berg
0 siblings, 0 replies; 3+ messages in thread
From: Johannes Berg @ 2007-07-18 10:10 UTC (permalink / raw)
To: David Miller; +Cc: netdev
[-- Attachment #1: Type: text/plain, Size: 643 bytes --]
On Wed, 2007-07-18 at 02:08 -0700, David Miller wrote:
> From: Johannes Berg <johannes@sipsolutions.net>
> Date: Tue, 17 Jul 2007 14:26:04 +0200
>
> > Reading netlink_setsockopt it's not immediately clear why there isn't a
> > bug when you pass in negative numbers, the reason being that the >=
> > comparison is really unsigned although 'val' is signed because
> > nlk->ngroups is unsigned. Make 'val' unsigned too.
> >
> > Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
>
> Applied, but I updated the "(int __user *)" cast in
> get_user() to match as well when applying this.
Oh, good catch, thanks.
johannes
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 190 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2007-07-18 10:14 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-07-17 12:26 [PATCH] negative groups in netlink_setsockopt Johannes Berg
2007-07-18 9:08 ` David Miller
2007-07-18 10:10 ` Johannes Berg
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox