]> git.kernelconcepts.de Git - karo-tx-linux.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)
committerDavid S. Miller <davem@davemloft.net>
Mon, 23 Nov 2015 01:44:46 +0000 (20:44 -0500)
commit0e615e9601a15efeeb8942cf7cd4dadba0c8c5a7
tree40bd7429b26267edfd83fe9179d304e66b293887
parentf96c9285487f28a90b301718aad86f047d2abb94
net: ipmr: fix static mfc/dev leaks on table destruction

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>
net/ipv4/ipmr.c