OSDN Git Service

net/sched: act_pedit: fix memory leak when IDR allocation fails
authorDavide Caratti <dcaratti@redhat.com>
Wed, 14 Nov 2018 11:17:25 +0000 (12:17 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 23 Nov 2018 07:17:03 +0000 (08:17 +0100)
commitae06e2f9c1777592c13910dda9d25d9fd5c1381a
tree3a9c9e5cc763954ab656c558311fcd1c556ed029
parent3d6679c85a53bd2ce837bcb87bbddfc369b8cf2c
net/sched: act_pedit: fix memory leak when IDR allocation fails

[ Upstream commit 19ab69107d3ecfb7cd3e38ad262a881be40c01a3 ]

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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
net/sched/act_pedit.c