summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavide Caratti <dcaratti@redhat.com>2018-11-14 12:17:25 +0100
committerDavid S. Miller <davem@davemloft.net>2018-11-17 04:53:45 +0100
commit19ab69107d3ecfb7cd3e38ad262a881be40c01a3 (patch)
tree82b7b0d49ccbcd5e18f42f2f689ac2e37cf88d65
parentnet: lantiq: Fix returned value in case of error in 'xrx200_probe()' (diff)
downloadlinux-19ab69107d3ecfb7cd3e38ad262a881be40c01a3.tar.xz
linux-19ab69107d3ecfb7cd3e38ad262a881be40c01a3.zip
net/sched: act_pedit: fix memory leak when IDR allocation fails
tcf_idr_check_alloc() can return a negative value, on allocation failures (-ENOMEM) or IDR exhaustion (-ENOSPC): don't leak keys_ex in these cases. Fixes: 0190c1d452a9 ("net: sched: atomically check-allocate action") Signed-off-by: Davide Caratti <dcaratti@redhat.com> Acked-by: Cong Wang <xiyou.wangcong@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--net/sched/act_pedit.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/net/sched/act_pedit.c b/net/sched/act_pedit.c
index da3dd0f68cc2..2b372a06b432 100644
--- a/net/sched/act_pedit.c
+++ b/net/sched/act_pedit.c
@@ -201,7 +201,8 @@ static int tcf_pedit_init(struct net *net, struct nlattr *nla,
goto out_release;
}
} else {
- return err;
+ ret = err;
+ goto out_free;
}
p = to_pedit(*a);