lkml.org 
[lkml]   [2018]   [Dec]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH] ipset: fix a missing check of nla_parse
From
Date
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]);
>
>

\
 
 \ /
  Last update: 2018-12-26 10:17    [W:0.064 / U:2.044 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site