diff options
author | Davide Caratti <dcaratti@redhat.com> | 2018-03-19 15:31:25 +0100 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2018-05-30 07:52:18 +0200 |
commit | 01a80839635db5973dc72e00e7abd4d902af1902 (patch) | |
tree | 90c10bc091f9389abfc483232da606a8fddf8dcd | |
parent | 97689fea3c803d5b47a45941a6f46e196a0f2c53 (diff) | |
download | linux-stable-01a80839635db5973dc72e00e7abd4d902af1902.tar.gz linux-stable-01a80839635db5973dc72e00e7abd4d902af1902.tar.bz2 linux-stable-01a80839635db5973dc72e00e7abd4d902af1902.zip |
net/sched: fix idr leak in the error path of tcp_pedit_init()
[ Upstream commit 94fa3f929ec0c048b1f3658cc335b940df4f6d22 ]
tcf_pedit_init() can fail to allocate 'keys' after the idr has been
successfully reserved. When this happens, subsequent attempts to configure
a pedit rule using the same idr value systematically fail with -ENOSPC:
# tc action add action pedit munge ip ttl set 63 index 100
RTNETLINK answers: Cannot allocate memory
We have an error talking to the kernel
# tc action add action pedit munge ip ttl set 63 index 100
RTNETLINK answers: No space left on device
We have an error talking to the kernel
# tc action add action pedit munge ip ttl set 63 index 100
RTNETLINK answers: No space left on device
We have an error talking to the kernel
...
Fix this in the error path of tcf_act_pedit_init(), calling
tcf_idr_release() in place of tcf_idr_cleanup().
Fixes: 65a206c01e8e ("net/sched: Change act_api and act_xxx modules to use IDR")
Acked-by: Jamal Hadi Salim <jhs@mojatatu.com>
Signed-off-by: Davide Caratti <dcaratti@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | net/sched/act_pedit.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/net/sched/act_pedit.c b/net/sched/act_pedit.c index 491fe5deb09e..51ab463d9e16 100644 --- a/net/sched/act_pedit.c +++ b/net/sched/act_pedit.c @@ -176,7 +176,7 @@ static int tcf_pedit_init(struct net *net, struct nlattr *nla, p = to_pedit(*a); keys = kmalloc(ksize, GFP_KERNEL); if (keys == NULL) { - tcf_idr_cleanup(*a, est); + tcf_idr_release(*a, bind); kfree(keys_ex); return -ENOMEM; } |