mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Kirill Tkhai <ktkhai@virtuozzo.com>
To: Kangjie Lu <kjlu@umn.edu>
Cc: pakki001@umn.edu, Pablo Neira Ayuso <pablo@netfilter.org>,
	Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>,
	Florian Westphal <fw@strlen.de>,
	"David S. Miller" <davem@davemloft.net>,
	Stefano Brivio <sbrivio@redhat.com>,
	Andrey Ryabinin <aryabinin@virtuozzo.com>,
	netfilter-devel@vger.kernel.org, coreteam@netfilter.org,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] ipset: fix a missing check of nla_parse
Date: Wed, 26 Dec 2018 12:16:25 +0300	[thread overview]
Message-ID: <c462e7f4-6c41-78e8-26e9-8ce16ca26a5c@virtuozzo.com> (raw)
In-Reply-To: <20181226035002.73614-1-kjlu@umn.edu>

On 26.12.2018 06:50, Kangjie Lu wrote:
> When nla_parse fails, we should not use the results (the first
> argument). The fix checks if it fails, and if so, returns its error code
> upstream.
> 
> Signed-off-by: Kangjie Lu <kjlu@umn.edu>
> ---
>  net/netfilter/ipset/ip_set_core.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/net/netfilter/ipset/ip_set_core.c b/net/netfilter/ipset/ip_set_core.c
> index 1577f2f76060..4dc8057cff02 100644
> --- a/net/netfilter/ipset/ip_set_core.c
> +++ b/net/netfilter/ipset/ip_set_core.c
> @@ -1531,8 +1531,10 @@ call_ad(struct sock *ctnl, struct sk_buff *skb, struct ip_set *set,
>  		memcpy(&errmsg->msg, nlh, nlh->nlmsg_len);
>  		cmdattr = (void *)&errmsg->msg + min_len;
>  
> -		nla_parse(cda, IPSET_ATTR_CMD_MAX, cmdattr,
> +		ret = nla_parse(cda, IPSET_ATTR_CMD_MAX, cmdattr,
>  			  nlh->nlmsg_len - min_len, ip_set_adt_policy, NULL);
> +		if (ret)
> +			return ret;

In this function above nlmsg_new() allocates skb2, but I don't see, where you free it here.

>  
>  		errline = nla_data(cda[IPSET_ATTR_LINENO]);
>  
> 

  reply	other threads:[~2018-12-26  9:16 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-26  3:50 Kangjie Lu
2018-12-26  9:16 ` Kirill Tkhai [this message]
2019-01-09 22:43   ` Pablo Neira Ayuso
2019-01-10  8:54     ` Kirill Tkhai

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=c462e7f4-6c41-78e8-26e9-8ce16ca26a5c@virtuozzo.com \
    --to=ktkhai@virtuozzo.com \
    --cc=aryabinin@virtuozzo.com \
    --cc=coreteam@netfilter.org \
    --cc=davem@davemloft.net \
    --cc=fw@strlen.de \
    --cc=kadlec@blackhole.kfki.hu \
    --cc=kjlu@umn.edu \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=pablo@netfilter.org \
    --cc=pakki001@umn.edu \
    --cc=sbrivio@redhat.com \
    /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

all inboxes | Powered by JetHome®