From: Pavel Emelyanov <xemul@parallels.com>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: "David S. Miller" <davem@davemloft.net>,
"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
"kernel-janitors@vger.kernel.org"
<kernel-janitors@vger.kernel.org>
Subject: Re: [patch] sock_diag: off by one checks
Date: Thu, 08 Dec 2011 09:07:55 +0000 [thread overview]
Message-ID: <4EE07E6B.5050608@parallels.com> (raw)
In-Reply-To: <20111208064938.GB16735@elgon.mountain>
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@oracle.com>
Acked-by: Pavel Emelyanov <xemul@parallels.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);
>
next prev parent reply other threads:[~2011-12-08 9:07 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-12-08 6:49 [patch] sock_diag: off by one checks Dan Carpenter
2011-12-08 9:07 ` Pavel Emelyanov [this message]
2011-12-09 0:54 ` David Miller
2011-12-09 0:54 ` David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4EE07E6B.5050608@parallels.com \
--to=xemul@parallels.com \
--cc=dan.carpenter@oracle.com \
--cc=davem@davemloft.net \
--cc=kernel-janitors@vger.kernel.org \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox