[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4EE07E6B.5050608@parallels.com>
Date: Thu, 08 Dec 2011 13:07:55 +0400
From: Pavel Emelyanov <xemul@...allels.com>
To: Dan Carpenter <dan.carpenter@...cle.com>
CC: "David S. Miller" <davem@...emloft.net>,
"netdev@...r.kernel.org" <netdev@...r.kernel.org>,
"kernel-janitors@...r.kernel.org" <kernel-janitors@...r.kernel.org>
Subject: Re: [patch] sock_diag: off by one checks
On 12/08/2011 10:49 AM, Dan Carpenter wrote:
> These tests are off by one because sock_diag_handlers[] only has AF_MAX
> elements.
Oops :(
> Signed-off-by: Dan Carpenter <dan.carpenter@...cle.com>
Acked-by: Pavel Emelyanov <xemul@...allels.com>
> diff --git a/net/core/sock_diag.c b/net/core/sock_diag.c
> index fbaf01c..9c27bcd 100644
> --- a/net/core/sock_diag.c
> +++ b/net/core/sock_diag.c
> @@ -32,7 +32,7 @@ int sock_diag_register(struct sock_diag_handler *hndl)
> {
> int err = 0;
>
> - if (hndl->family > AF_MAX)
> + if (hndl->family >= AF_MAX)
> return -EINVAL;
>
> mutex_lock(&sock_diag_table_mutex);
> @@ -50,7 +50,7 @@ void sock_diag_unregister(struct sock_diag_handler *hnld)
> {
> int family = hnld->family;
>
> - if (family > AF_MAX)
> + if (family >= AF_MAX)
> return;
>
> mutex_lock(&sock_diag_table_mutex);
>
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists