From: Patrick McHardy <kaber@trash.net>
To: Jan Engelhardt <jengelh@medozas.de>
Cc: Netfilter Developer Mailing List <netfilter-devel@vger.kernel.org>
Subject: Re: [patch] netfilter: nfnetlink: guard against undefined entries
Date: Thu, 11 Nov 2010 11:34:08 +0100 [thread overview]
Message-ID: <4CDBC6A0.2000108@trash.net> (raw)
In-Reply-To: <alpine.LNX.2.01.1011100249390.23289@obet.zrqbmnf.qr>
On 10.11.2010 02:50, Jan Engelhardt wrote:
> parent a391d495f6082f6348b9074214e81c7e2dc1151c (v2.6.37-rc1-184-ga391d49)
> commit 6e97eb121bc8e39c651645c3d937f468d2b3e7fe
> Author: Jan Engelhardt <jengelh@medozas.de>
> Date: Sat Nov 6 21:19:16 2010 +0100
>
> netfilter: nfnetlink: guard against undefined entries
>
> Check for empty entries in struct nfnl_callback[] to avoid potential
> NULL deference. (Because I have run into one during development.)
It seems silly to add checks for easy to find bugs in users of
this code. Finding the cause of -EINVAL is much harder than
getting a nice oops.
> Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
> ---
> net/netfilter/nfnetlink.c | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/net/netfilter/nfnetlink.c b/net/netfilter/nfnetlink.c
> index b4a4532..7012882 100644
> --- a/net/netfilter/nfnetlink.c
> +++ b/net/netfilter/nfnetlink.c
> @@ -152,7 +152,7 @@ replay:
> }
>
> nc = nfnetlink_find_client(type, ss);
> - if (!nc)
> + if (nc == NULL || nc->call == NULL)
> return -EINVAL;
>
> {
next prev parent reply other threads:[~2010-11-11 10:34 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-11-10 1:50 [patch] netfilter: nfnetlink: guard against undefined entries Jan Engelhardt
2010-11-11 10:34 ` Patrick McHardy [this message]
2010-11-11 20:56 ` Jan Engelhardt
2010-11-12 7:35 ` Patrick McHardy
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=4CDBC6A0.2000108@trash.net \
--to=kaber@trash.net \
--cc=jengelh@medozas.de \
--cc=netfilter-devel@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;
as well as URLs for NNTP newsgroup(s).