<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux/net/netlink, branch v4.9</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/
</subtitle>
<id>https://git.shady.money/linux/atom?h=v4.9</id>
<link rel='self' href='https://git.shady.money/linux/atom?h=v4.9'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/'/>
<updated>2016-12-06T00:43:42Z</updated>
<entry>
<title>netlink: Do not schedule work from sk_destruct</title>
<updated>2016-12-06T00:43:42Z</updated>
<author>
<name>Herbert Xu</name>
<email>herbert@gondor.apana.org.au</email>
</author>
<published>2016-12-05T07:28:21Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=ed5d7788a934a4b6d6d025e948ed4da496b4f12e'/>
<id>urn:sha1:ed5d7788a934a4b6d6d025e948ed4da496b4f12e</id>
<content type='text'>
It is wrong to schedule a work from sk_destruct using the socket
as the memory reserve because the socket will be freed immediately
after the return from sk_destruct.

Instead we should do the deferral prior to sk_free.

This patch does just that.

Fixes: 707693c8a498 ("netlink: Call cb-&gt;done from a worker thread")
Signed-off-by: Herbert Xu &lt;herbert@gondor.apana.org.au&gt;
Tested-by: Andrey Konovalov &lt;andreyknvl@google.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>netlink: Call cb-&gt;done from a worker thread</title>
<updated>2016-11-30T00:48:38Z</updated>
<author>
<name>Herbert Xu</name>
<email>herbert@gondor.apana.org.au</email>
</author>
<published>2016-11-28T11:22:12Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=707693c8a498697aa8db240b93eb76ec62e30892'/>
<id>urn:sha1:707693c8a498697aa8db240b93eb76ec62e30892</id>
<content type='text'>
The cb-&gt;done interface expects to be called in process context.
This was broken by the netlink RCU conversion.  This patch fixes
it by adding a worker struct to make the cb-&gt;done call where
necessary.

Fixes: 21e4902aea80 ("netlink: Lockless lookup with RCU grace...")
Reported-by: Subash Abhinov Kasiviswanathan &lt;subashab@codeaurora.org&gt;
Signed-off-by: Herbert Xu &lt;herbert@gondor.apana.org.au&gt;
Acked-by: Cong Wang &lt;xiyou.wangcong@gmail.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>genetlink: fix a memory leak on error path</title>
<updated>2016-11-03T20:52:29Z</updated>
<author>
<name>WANG Cong</name>
<email>xiyou.wangcong@gmail.com</email>
</author>
<published>2016-11-03T16:42:35Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=00ffc1ba02d876478c125e4305f9a02d40c6d284'/>
<id>urn:sha1:00ffc1ba02d876478c125e4305f9a02d40c6d284</id>
<content type='text'>
In __genl_register_family(), when genl_validate_assign_mc_groups()
fails, we forget to free the memory we possibly allocate for
family-&gt;attrbuf.

Note, some callers call genl_unregister_family() to clean up
on error path, it doesn't work because the family is inserted
to the global list in the nearly last step.

Cc: Jakub Kicinski &lt;kubakici@wp.pl&gt;
Cc: Johannes Berg &lt;johannes@sipsolutions.net&gt;
Signed-off-by: Cong Wang &lt;xiyou.wangcong@gmail.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>netlink: netlink_diag_dump() runs without locks</title>
<updated>2016-11-03T20:16:51Z</updated>
<author>
<name>Eric Dumazet</name>
<email>edumazet@google.com</email>
</author>
<published>2016-11-03T03:21:20Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=93636d1f1f162ae89ae4f2a22a83bf4fd960724e'/>
<id>urn:sha1:93636d1f1f162ae89ae4f2a22a83bf4fd960724e</id>
<content type='text'>
A recent commit removed locking from netlink_diag_dump() but forgot
one error case.

=====================================
[ BUG: bad unlock balance detected! ]
4.9.0-rc3+ #336 Not tainted
-------------------------------------
syz-executor/4018 is trying to release lock ([   36.220068] nl_table_lock
) at:
[&lt;ffffffff82dc8683&gt;] netlink_diag_dump+0x1a3/0x250 net/netlink/diag.c:182
but there are no more locks to release!

other info that might help us debug this:
3 locks held by syz-executor/4018:
 #0: [   36.220068]  (
sock_diag_mutex[   36.220068] ){+.+.+.}
, at: [   36.220068] [&lt;ffffffff82c3873b&gt;] sock_diag_rcv+0x1b/0x40
 #1: [   36.220068]  (
sock_diag_table_mutex[   36.220068] ){+.+.+.}
, at: [   36.220068] [&lt;ffffffff82c38e00&gt;] sock_diag_rcv_msg+0x140/0x3a0
 #2: [   36.220068]  (
nlk-&gt;cb_mutex[   36.220068] ){+.+.+.}
, at: [   36.220068] [&lt;ffffffff82db6600&gt;] netlink_dump+0x50/0xac0

stack backtrace:
CPU: 1 PID: 4018 Comm: syz-executor Not tainted 4.9.0-rc3+ #336
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Bochs 01/01/2011
 ffff8800645df688 ffffffff81b46934 ffffffff84eb3e78 ffff88006ad85800
 ffffffff82dc8683 ffffffff84eb3e78 ffff8800645df6b8 ffffffff812043ca
 dffffc0000000000 ffff88006ad85ff8 ffff88006ad85fd0 00000000ffffffff
Call Trace:
 [&lt;     inline     &gt;] __dump_stack lib/dump_stack.c:15
 [&lt;ffffffff81b46934&gt;] dump_stack+0xb3/0x10f lib/dump_stack.c:51
 [&lt;ffffffff812043ca&gt;] print_unlock_imbalance_bug+0x17a/0x1a0
kernel/locking/lockdep.c:3388
 [&lt;     inline     &gt;] __lock_release kernel/locking/lockdep.c:3512
 [&lt;ffffffff8120cfd8&gt;] lock_release+0x8e8/0xc60 kernel/locking/lockdep.c:3765
 [&lt;     inline     &gt;] __raw_read_unlock ./include/linux/rwlock_api_smp.h:225
 [&lt;ffffffff83fc001a&gt;] _raw_read_unlock+0x1a/0x30 kernel/locking/spinlock.c:255
 [&lt;ffffffff82dc8683&gt;] netlink_diag_dump+0x1a3/0x250 net/netlink/diag.c:182
 [&lt;ffffffff82db6947&gt;] netlink_dump+0x397/0xac0 net/netlink/af_netlink.c:2110

Fixes: ad202074320c ("netlink: Use rhashtable walk interface in diag dump")
Signed-off-by: Eric Dumazet &lt;edumazet@google.com&gt;
Reported-by: Andrey Konovalov &lt;andreyknvl@google.com&gt;
Tested-by: Andrey Konovalov &lt;andreyknvl@google.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>netlink: do not enter direct reclaim from netlink_dump()</title>
<updated>2016-10-07T00:53:13Z</updated>
<author>
<name>Eric Dumazet</name>
<email>edumazet@google.com</email>
</author>
<published>2016-10-05T19:13:18Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=d35c99ff77ecb2eb239731b799386f3b3637a31e'/>
<id>urn:sha1:d35c99ff77ecb2eb239731b799386f3b3637a31e</id>
<content type='text'>
Since linux-3.15, netlink_dump() can use up to 16384 bytes skb
allocations.

Due to struct skb_shared_info ~320 bytes overhead, we end up using
order-3 (on x86) page allocations, that might trigger direct reclaim and
add stress.

The intent was really to attempt a large allocation but immediately
fallback to a smaller one (order-1 on x86) in case of memory stress.

On recent kernels (linux-4.4), we can remove __GFP_DIRECT_RECLAIM to
meet the goal. Old kernels would need to remove __GFP_WAIT

While we are at it, since we do an order-3 allocation, allow to use
all the allocated bytes instead of 16384 to reduce syscalls during
large dumps.

iproute2 already uses 32KB recvmsg() buffer sizes.

Alexei provided an initial patch downsizing to SKB_WITH_OVERHEAD(16384)

Fixes: 9063e21fb026 ("netlink: autosize skb lengthes")
Signed-off-by: Eric Dumazet &lt;edumazet@google.com&gt;
Reported-by: Alexei Starovoitov &lt;ast@kernel.org&gt;
Cc: Greg Thelen &lt;gthelen@google.com&gt;
Reviewed-by: Greg Rose &lt;grose@lightfleet.com&gt;
Acked-by: Alexei Starovoitov &lt;ast@kernel.org&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>netlink: don't forget to release a rhashtable_iter structure</title>
<updated>2016-09-08T00:29:38Z</updated>
<author>
<name>Andrey Vagin</name>
<email>avagin@openvz.org</email>
</author>
<published>2016-09-07T04:31:17Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=733ade23de1b72c1f11c5e4a1a9020a6f48decd2'/>
<id>urn:sha1:733ade23de1b72c1f11c5e4a1a9020a6f48decd2</id>
<content type='text'>
This bug was detected by kmemleak:
unreferenced object 0xffff8804269cc3c0 (size 64):
  comm "criu", pid 1042, jiffies 4294907360 (age 13.713s)
  hex dump (first 32 bytes):
    a0 32 cc 2c 04 88 ff ff 00 00 00 00 00 00 00 00  .2.,............
    00 01 00 00 00 00 ad de 00 02 00 00 00 00 ad de  ................
  backtrace:
    [&lt;ffffffff8184dffa&gt;] kmemleak_alloc+0x4a/0xa0
    [&lt;ffffffff8124720f&gt;] kmem_cache_alloc_trace+0x10f/0x280
    [&lt;ffffffffa02864cc&gt;] __netlink_diag_dump+0x26c/0x290 [netlink_diag]

v2: don't remove a reference on a rhashtable_iter structure to
    release it from netlink_diag_dump_done

Cc: Herbert Xu &lt;herbert@gondor.apana.org.au&gt;
Fixes: ad202074320c ("netlink: Use rhashtable walk interface in diag dump")
Signed-off-by: Andrei Vagin &lt;avagin@openvz.org&gt;
Acked-by: Herbert Xu &lt;herbert@gondor.apana.org.au&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>net: make genetlink ctrl ops const</title>
<updated>2016-09-01T21:09:00Z</updated>
<author>
<name>stephen hemminger</name>
<email>stephen@networkplumber.org</email>
</author>
<published>2016-08-31T22:22:00Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=12d8de6d952372102db2faedd19913dbfa883c5d'/>
<id>urn:sha1:12d8de6d952372102db2faedd19913dbfa883c5d</id>
<content type='text'>
Signed-off-by: Stephen Hemminger &lt;stephen@networkplumber.org&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>netlink: Use rhashtable walk interface in diag dump</title>
<updated>2016-08-19T21:40:25Z</updated>
<author>
<name>Herbert Xu</name>
<email>herbert@gondor.apana.org.au</email>
</author>
<published>2016-08-19T08:21:37Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=ad202074320cd75b31b8cdb58cca0d4ef6aaea8a'/>
<id>urn:sha1:ad202074320cd75b31b8cdb58cca0d4ef6aaea8a</id>
<content type='text'>
This patch converts the diag dumping code to use the rhashtable
walk code instead of going through rhashtable by hand.  The lock
nl_table_lock is now only taken while we process the multicast
list as it's not needed for the rhashtable walk.

Signed-off-by: Herbert Xu &lt;herbert@gondor.apana.org.au&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>net/netlink/af_netlink.h: Remove unused structure.</title>
<updated>2016-06-10T05:26:24Z</updated>
<author>
<name>Fabien Siron</name>
<email>fabien.siron@epita.fr</email>
</author>
<published>2016-06-07T13:02:04Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=21aff3b905ad9e5e52b18a755c13fe755bd6ab3d'/>
<id>urn:sha1:21aff3b905ad9e5e52b18a755c13fe755bd6ab3d</id>
<content type='text'>
Signed-off-by: Fabien Siron &lt;fabien.siron@epita.fr&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>netlink: Fix dump skb leak/double free</title>
<updated>2016-05-17T02:05:15Z</updated>
<author>
<name>Herbert Xu</name>
<email>herbert@gondor.apana.org.au</email>
</author>
<published>2016-05-16T09:28:16Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=92964c79b357efd980812c4de5c1fd2ec8bb5520'/>
<id>urn:sha1:92964c79b357efd980812c4de5c1fd2ec8bb5520</id>
<content type='text'>
When we free cb-&gt;skb after a dump, we do it after releasing the
lock.  This means that a new dump could have started in the time
being and we'll end up freeing their skb instead of ours.

This patch saves the skb and module before we unlock so we free
the right memory.

Fixes: 16b304f3404f ("netlink: Eliminate kmalloc in netlink dump operation.")
Reported-by: Baozeng Ding &lt;sploving1@gmail.com&gt;
Signed-off-by: Herbert Xu &lt;herbert@gondor.apana.org.au&gt;
Acked-by: Cong Wang &lt;xiyou.wangcong@gmail.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
</feed>
