WSL2-Linux-Kernel/arch
Andrey Vagin 98bbc06aab net: x86: bpf: don't forget to free sk_filter (v2)
sk_filter isn't freed if bpf_func is equal to sk_run_filter.

This memory leak was introduced by v3.12-rc3-224-gd45ed4a4
"net: fix unsafe set_memory_rw from softirq".

Before this patch sk_filter was freed in sk_filter_release_rcu,
now it should be freed in bpf_jit_free.

Here is output of kmemleak:
unreferenced object 0xffff8800b774eab0 (size 128):
  comm "systemd", pid 1, jiffies 4294669014 (age 124.062s)
  hex dump (first 32 bytes):
    00 00 00 00 0b 00 00 00 20 63 7f b7 00 88 ff ff  ........ c......
    60 d4 55 81 ff ff ff ff 30 d9 55 81 ff ff ff ff  `.U.....0.U.....
  backtrace:
    [<ffffffff816444be>] kmemleak_alloc+0x4e/0xb0
    [<ffffffff811845af>] __kmalloc+0xef/0x260
    [<ffffffff81534028>] sock_kmalloc+0x38/0x60
    [<ffffffff8155d4dd>] sk_attach_filter+0x5d/0x190
    [<ffffffff815378a1>] sock_setsockopt+0x991/0x9e0
    [<ffffffff81531bd6>] SyS_setsockopt+0xb6/0xd0
    [<ffffffff8165f3e9>] system_call_fastpath+0x16/0x1b
    [<ffffffffffffffff>] 0xffffffffffffffff

v2: add extra { } after else

Fixes: d45ed4a4e3 ("net: fix unsafe set_memory_rw from softirq")
Acked-by: Daniel Borkmann <dborkman@redhat.com>
Cc: Alexei Starovoitov <ast@plumgrid.com>
Cc: Eric Dumazet <edumazet@google.com>
Cc: "David S. Miller" <davem@davemloft.net>
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Acked-by: Alexei Starovoitov <ast@plumgrid.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2013-11-07 19:06:52 -05:00
..
alpha net: introduce SO_MAX_PACING_RATE 2013-09-28 15:35:41 -07:00
arc ARC: Incorrect mm reference used in vmalloc fault handler 2013-11-02 10:27:04 -07:00
arm Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2013-11-04 13:48:30 -05:00
arm64 arm64: Remove duplicate DEBUG_STACK_USAGE config 2013-10-02 18:03:26 +01:00
avr32 Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2013-10-01 17:06:14 -04:00
blackfin Merge branch 'genirq' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux 2013-09-13 07:31:38 -07:00
c6x Remove GENERIC_HARDIRQ config option 2013-09-13 15:09:52 +02:00
cris net: introduce SO_MAX_PACING_RATE 2013-09-28 15:35:41 -07:00
frv net: introduce SO_MAX_PACING_RATE 2013-09-28 15:35:41 -07:00
h8300 net: introduce SO_MAX_PACING_RATE 2013-09-28 15:35:41 -07:00
hexagon Remove GENERIC_HARDIRQ config option 2013-09-13 15:09:52 +02:00
ia64 net: introduce SO_MAX_PACING_RATE 2013-09-28 15:35:41 -07:00
m32r net: introduce SO_MAX_PACING_RATE 2013-09-28 15:35:41 -07:00
m68k Remove GENERIC_HARDIRQ config option 2013-09-13 15:09:52 +02:00
metag Remove GENERIC_HARDIRQ config option 2013-09-13 15:09:52 +02:00
microblaze Remove GENERIC_HARDIRQ config option 2013-09-13 15:09:52 +02:00
mips Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2013-11-04 13:48:30 -05:00
mn10300 net: introduce SO_MAX_PACING_RATE 2013-09-28 15:35:41 -07:00
openrisc openrisc: clean-up prom.h 2013-09-24 21:12:27 -05:00
parisc Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2013-11-04 13:48:30 -05:00
powerpc Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2013-10-23 16:49:34 -04:00
s390 Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2013-10-23 16:49:34 -04:00
score Score: Modify the Makefile of Score, remove -mlong-calls for compiling 2013-09-26 03:46:03 +08:00
sh Remove GENERIC_HARDIRQ config option 2013-09-13 15:09:52 +02:00
sparc Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2013-10-23 16:49:34 -04:00
tile arch: tile: re-use kbasename() helper 2013-09-30 10:34:46 -04:00
um uml: check length in exitcode_proc_write() 2013-10-30 12:24:49 -07:00
unicore32 Remove GENERIC_HARDIRQ config option 2013-09-13 15:09:52 +02:00
x86 net: x86: bpf: don't forget to free sk_filter (v2) 2013-11-07 19:06:52 -05:00
xtensa Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2013-11-04 13:48:30 -05:00
.gitignore
Kconfig mutex: replace CONFIG_HAVE_ARCH_MUTEX_CPU_RELAX with simple ifdef 2013-09-28 12:46:21 +02:00