public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Kadlecsik József" <kadlecsik.jozsef@wigner.mta.hu>
To: Aditya Pakki <pakki001@umn.edu>
Cc: kjlu@umn.edu, Pablo Neira Ayuso <pablo@netfilter.org>,
	Florian Westphal <fw@strlen.de>,
	"David S. Miller" <davem@davemloft.net>,
	Kirill Tkhai <ktkhai@virtuozzo.com>,
	Stefano Brivio <sbrivio@redhat.com>,
	"Gustavo A. R. Silva" <garsilva@embeddedor.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] [v2] netfilter: ipset: fix a missing check of nla_parse
Date: Tue, 8 Jan 2019 21:01:41 +0100 (CET)	[thread overview]
Message-ID: <alpine.DEB.2.20.1901082101100.21270@localhost> (raw)
In-Reply-To: <20190105153150.2600-1-pakki001@umn.edu>

Hi,

On Sat, 5 Jan 2019, Aditya Pakki 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.

Patch is applied in the ipset git tree, thanks!

Best regards,
Jozsef

> Signed-off-by: Aditya Pakki <pakki001@umn.edu>
> ---
>  net/netfilter/ipset/ip_set_core.c | 9 +++++++--
>  1 file changed, 7 insertions(+), 2 deletions(-)
> 
> diff --git a/net/netfilter/ipset/ip_set_core.c b/net/netfilter/ipset/ip_set_core.c
> index 45a257695bef..3ee0fda05a3b 100644
> --- a/net/netfilter/ipset/ip_set_core.c
> +++ b/net/netfilter/ipset/ip_set_core.c
> @@ -1546,8 +1546,13 @@ 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,
> -			  nlh->nlmsg_len - min_len, ip_set_adt_policy, NULL);
> +		ret = nla_parse(cda, IPSET_ATTR_CMD_MAX, cmdattr,
> +				nlh->nlmsg_len - min_len, ip_set_adt_policy,
> +				NULL);
> +		if (ret) {
> +			nlmsg_free(skb2);
> +			return ret;
> +		}
>  
>  		errline = nla_data(cda[IPSET_ATTR_LINENO]);
>  
> -- 
> 2.17.1
> 
> 

--
E-mail : kadlecsik.jozsef@wigner.mta.hu
PGP key: http://www.kfki.hu/~kadlec/pgp_public_key.txt
Address: Wigner Research Centre for Physics, Hungarian Academy of Sciences
         H-1525 Budapest 114, POB. 49, Hungary

      reply	other threads:[~2019-01-08 20:08 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-05 15:31 [PATCH] [v2] netfilter: ipset: fix a missing check of nla_parse Aditya Pakki
2019-01-08 20:01 ` Kadlecsik József [this message]

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=alpine.DEB.2.20.1901082101100.21270@localhost \
    --to=kadlecsik.jozsef@wigner.mta.hu \
    --cc=aryabinin@virtuozzo.com \
    --cc=coreteam@netfilter.org \
    --cc=davem@davemloft.net \
    --cc=fw@strlen.de \
    --cc=garsilva@embeddedor.com \
    --cc=kjlu@umn.edu \
    --cc=ktkhai@virtuozzo.com \
    --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