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 <pakki...@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.joz...@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 via email to