lkml.org 
[lkml]   [2019]   [Jul]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 5.2 077/413] netfilter: ipset: fix a missing check of nla_parse
    Date
    [ Upstream commit f4f5748bfec94cf418e49bf05f0c81a1b9ebc950 ]

    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: Aditya Pakki <pakki001@umn.edu>
    Signed-off-by: Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    ---
    net/netfilter/ipset/ip_set_core.c | 10 +++++++---
    1 file changed, 7 insertions(+), 3 deletions(-)

    diff --git a/net/netfilter/ipset/ip_set_core.c b/net/netfilter/ipset/ip_set_core.c
    index 3cdf171cd468..16afa0df4004 100644
    --- a/net/netfilter/ipset/ip_set_core.c
    +++ b/net/netfilter/ipset/ip_set_core.c
    @@ -1541,10 +1541,14 @@ 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_deprecated(cda, IPSET_ATTR_CMD_MAX, cmdattr,
    - nlh->nlmsg_len - min_len,
    - ip_set_adt_policy, NULL);
    + ret = nla_parse_deprecated(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]);

    *errline = lineno;
    --
    2.20.1


    \
     
     \ /
      Last update: 2019-07-24 23:09    [W:2.763 / U:1.260 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site