]> www.infradead.org Git - users/jedix/linux-maple.git/commit
net: ipmr: fix static mfc/dev leaks on table destruction
authorNikolay Aleksandrov <nikolay@cumulusnetworks.com>
Fri, 20 Nov 2015 12:54:19 +0000 (13:54 +0100)
committerChuck Anderson <chuck.anderson@oracle.com>
Fri, 5 Feb 2016 03:33:13 +0000 (19:33 -0800)
commit08b777c5e91cfa8287104193d7658c8f7fb6e6f7
treef406ee252ac0a24d99b7c6c8123ee65ef98cd55f
parent7b67f41b61737441bf8f1d193b4759569c7a9703
net: ipmr: fix static mfc/dev leaks on table destruction

Orabug: 22641722

[ Upstream commit 0e615e9601a15efeeb8942cf7cd4dadba0c8c5a7 ]

When destroying an mrt table the static mfc entries and the static
devices are kept, which leads to devices that can never be destroyed
(because of refcnt taken) and leaked memory, for example:
unreferenced object 0xffff880034c144c0 (size 192):
  comm "mfc-broken", pid 4777, jiffies 4320349055 (age 46001.964s)
  hex dump (first 32 bytes):
    98 53 f0 34 00 88 ff ff 98 53 f0 34 00 88 ff ff  .S.4.....S.4....
    ef 0a 0a 14 01 02 03 04 00 00 00 00 01 00 00 00  ................
  backtrace:
    [<ffffffff815c1b9e>] kmemleak_alloc+0x4e/0xb0
    [<ffffffff811ea6e0>] kmem_cache_alloc+0x190/0x300
    [<ffffffff815931cb>] ip_mroute_setsockopt+0x5cb/0x910
    [<ffffffff8153d575>] do_ip_setsockopt.isra.11+0x105/0xff0
    [<ffffffff8153e490>] ip_setsockopt+0x30/0xa0
    [<ffffffff81564e13>] raw_setsockopt+0x33/0x90
    [<ffffffff814d1e14>] sock_common_setsockopt+0x14/0x20
    [<ffffffff814d0b51>] SyS_setsockopt+0x71/0xc0
    [<ffffffff815cdbf6>] entry_SYSCALL_64_fastpath+0x16/0x7a
    [<ffffffffffffffff>] 0xffffffffffffffff

Make sure that everything is cleaned on netns destruction.

Signed-off-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
Reviewed-by: Cong Wang <cwang@twopensource.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit 3621421a35c3070ab86741f2e7ac8da635f79980)
Signed-off-by: Dan Duval <dan.duval@oracle.com>
net/ipv4/ipmr.c