<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux/net/netlink, branch v3.10.44</title>
<subtitle>Linux kernel source tree</subtitle>
<id>https://git.amat.us/linux/atom/net/netlink?h=v3.10.44</id>
<link rel='self' href='https://git.amat.us/linux/atom/net/netlink?h=v3.10.44'/>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/'/>
<updated>2013-12-08T15:29:25Z</updated>
<entry>
<title>net: rework recvmsg handler msg_name and msg_namelen logic</title>
<updated>2013-12-08T15:29:25Z</updated>
<author>
<name>Hannes Frederic Sowa</name>
<email>hannes@stressinduktion.org</email>
</author>
<published>2013-11-21T02:14:22Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=2f73d7fde99d702cba6a05062c27605a6eef1b78'/>
<id>urn:sha1:2f73d7fde99d702cba6a05062c27605a6eef1b78</id>
<content type='text'>
[ Upstream commit f3d3342602f8bcbf37d7c46641cb9bca7618eb1c ]

This patch now always passes msg-&gt;msg_namelen as 0. recvmsg handlers must
set msg_namelen to the proper size &lt;= sizeof(struct sockaddr_storage)
to return msg_name to the user.

This prevents numerous uninitialized memory leaks we had in the
recvmsg handlers and makes it harder for new code to accidentally leak
uninitialized memory.

Optimize for the case recvfrom is called with NULL as address. We don't
need to copy the address at all, so set it to NULL before invoking the
recvmsg handler. We can do so, because all the recvmsg handlers must
cope with the case a plain read() is called on them. read() also sets
msg_name to NULL.

Also document these changes in include/linux/net.h as suggested by David
Miller.

Changes since RFC:

Set msg-&gt;msg_name = NULL if user specified a NULL in msg_name but had a
non-null msg_namelen in verify_iovec/verify_compat_iovec. This doesn't
affect sendto as it would bail out earlier while trying to copy-in the
address. It also more naturally reflects the logic by the callers of
verify_iovec.

With this change in place I could remove "
if (!uaddr || msg_sys-&gt;msg_namelen == 0)
	msg-&gt;msg_name = NULL
".

This change does not alter the user visible error logic as we ignore
msg_namelen as long as msg_name is NULL.

Also remove two unnecessary curly brackets in ___sys_recvmsg and change
comments to netdev style.

Cc: David Miller &lt;davem@davemloft.net&gt;
Suggested-by: Eric Dumazet &lt;eric.dumazet@gmail.com&gt;
Signed-off-by: Hannes Frederic Sowa &lt;hannes@stressinduktion.org&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>genl: Hold reference on correct module while netlink-dump.</title>
<updated>2013-09-14T13:54:55Z</updated>
<author>
<name>Pravin B Shelar</name>
<email>pshelar@nicira.com</email>
</author>
<published>2013-08-23T19:45:04Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=a8077ef001460c41bc0509b096d3d342002c4d9b'/>
<id>urn:sha1:a8077ef001460c41bc0509b096d3d342002c4d9b</id>
<content type='text'>
[ Upstream commit 33c6b1f6b154894321f5734e50c66621e9134e7e ]

netlink dump operations take module as parameter to hold
reference for entire netlink dump duration.
Currently it holds ref only on genl module which is not correct
when we use ops registered to genl from another module.
Following patch adds module pointer to genl_ops so that netlink
can hold ref count on it.

Signed-off-by: Pravin B Shelar &lt;pshelar@nicira.com&gt;
CC: Jesse Gross &lt;jesse@nicira.com&gt;
CC: Johannes Berg &lt;johannes.berg@intel.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>genl: Fix genl dumpit() locking.</title>
<updated>2013-09-14T13:54:55Z</updated>
<author>
<name>Pravin B Shelar</name>
<email>pshelar@nicira.com</email>
</author>
<published>2013-08-23T19:44:55Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=e307a8acf8c075261f8110b7088f20d2f7206f56'/>
<id>urn:sha1:e307a8acf8c075261f8110b7088f20d2f7206f56</id>
<content type='text'>
[ Upstream commit 9b96309c5b0b9e466773c07a5bc8b7b68fcf010a ]

In case of genl-family with parallel ops off, dumpif() callback
is expected to run under genl_lock, But commit def3117493eafd9df
(genl: Allow concurrent genl callbacks.) changed this behaviour
where only first dumpit() op was called under genl-lock.
For subsequent dump, only nlk-&gt;cb_lock was taken.
Following patch fixes it by defining locked dumpit() and done()
callback which takes care of genl-locking.

Signed-off-by: Pravin B Shelar &lt;pshelar@nicira.com&gt;
CC: Jesse Gross &lt;jesse@nicira.com&gt;
CC: Johannes Berg &lt;johannes.berg@intel.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>Revert "genetlink: fix family dump race"</title>
<updated>2013-08-20T22:32:57Z</updated>
<author>
<name>Greg Kroah-Hartman</name>
<email>gregkh@linuxfoundation.org</email>
</author>
<published>2013-08-20T22:32:57Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=8e7430857af5b242c950d3d2bb00289374f1436a'/>
<id>urn:sha1:8e7430857af5b242c950d3d2bb00289374f1436a</id>
<content type='text'>
This reverts commit aab4f8d490ef8c184d854d5f630438c10406765c, commit
58ad436fcf49810aa006016107f494c9ac9013db upstream, as it causes
problems.

Cc: Johannes Berg &lt;johannes.berg@intel.com&gt;
Cc: Andrei Otcheretianski &lt;andrei.otcheretianski@intel.com&gt;
Cc: David S. Miller &lt;davem@davemloft.net&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>genetlink: fix family dump race</title>
<updated>2013-08-20T15:43:03Z</updated>
<author>
<name>Johannes Berg</name>
<email>johannes.berg@intel.com</email>
</author>
<published>2013-08-13T07:04:05Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=aab4f8d490ef8c184d854d5f630438c10406765c'/>
<id>urn:sha1:aab4f8d490ef8c184d854d5f630438c10406765c</id>
<content type='text'>
commit 58ad436fcf49810aa006016107f494c9ac9013db upstream.

When dumping generic netlink families, only the first dump call
is locked with genl_lock(), which protects the list of families,
and thus subsequent calls can access the data without locking,
racing against family addition/removal. This can cause a crash.
Fix it - the locking needs to be conditional because the first
time around it's already locked.

A similar bug was reported to me on an old kernel (3.4.47) but
the exact scenario that happened there is no longer possible,
on those kernels the first round wasn't locked either. Looking
at the current code I found the race described above, which had
also existed on the old kernel.

Reported-by: Andrei Otcheretianski &lt;andrei.otcheretianski@intel.com&gt;
Signed-off-by: Johannes Berg &lt;johannes.berg@intel.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>genetlink: release cb_lock before requesting additional module</title>
<updated>2013-08-12T01:35:25Z</updated>
<author>
<name>Stanislaw Gruszka</name>
<email>sgruszka@redhat.com</email>
</author>
<published>2013-07-26T09:00:10Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=1aa1e4cd9ea8a50f610c86ea324f9de4263ac4bc'/>
<id>urn:sha1:1aa1e4cd9ea8a50f610c86ea324f9de4263ac4bc</id>
<content type='text'>
[ Upstream commit c74f2b2678f40b80265dd53556f1f778c8e1823f ]

Requesting external module with cb_lock taken can result in
the deadlock like showed below:

[ 2458.111347] Showing all locks held in the system:
[ 2458.111347] 1 lock held by NetworkManager/582:
[ 2458.111347]  #0:  (cb_lock){++++++}, at: [&lt;ffffffff8162bc79&gt;] genl_rcv+0x19/0x40
[ 2458.111347] 1 lock held by modprobe/603:
[ 2458.111347]  #0:  (cb_lock){++++++}, at: [&lt;ffffffff8162baa5&gt;] genl_lock_all+0x15/0x30

[ 2461.579457] SysRq : Show Blocked State
[ 2461.580103]   task                        PC stack   pid father
[ 2461.580103] NetworkManager  D ffff880034b84500  4040   582      1 0x00000080
[ 2461.580103]  ffff8800197ff720 0000000000000046 00000000001d5340 ffff8800197fffd8
[ 2461.580103]  ffff8800197fffd8 00000000001d5340 ffff880019631700 7fffffffffffffff
[ 2461.580103]  ffff8800197ff880 ffff8800197ff878 ffff880019631700 ffff880019631700
[ 2461.580103] Call Trace:
[ 2461.580103]  [&lt;ffffffff817355f9&gt;] schedule+0x29/0x70
[ 2461.580103]  [&lt;ffffffff81731ad1&gt;] schedule_timeout+0x1c1/0x360
[ 2461.580103]  [&lt;ffffffff810e69eb&gt;] ? mark_held_locks+0xbb/0x140
[ 2461.580103]  [&lt;ffffffff817377ac&gt;] ? _raw_spin_unlock_irq+0x2c/0x50
[ 2461.580103]  [&lt;ffffffff810e6b6d&gt;] ? trace_hardirqs_on_caller+0xfd/0x1c0
[ 2461.580103]  [&lt;ffffffff81736398&gt;] wait_for_completion_killable+0xe8/0x170
[ 2461.580103]  [&lt;ffffffff810b7fa0&gt;] ? wake_up_state+0x20/0x20
[ 2461.580103]  [&lt;ffffffff81095825&gt;] call_usermodehelper_exec+0x1a5/0x210
[ 2461.580103]  [&lt;ffffffff817362ed&gt;] ? wait_for_completion_killable+0x3d/0x170
[ 2461.580103]  [&lt;ffffffff81095cc3&gt;] __request_module+0x1b3/0x370
[ 2461.580103]  [&lt;ffffffff810e6b6d&gt;] ? trace_hardirqs_on_caller+0xfd/0x1c0
[ 2461.580103]  [&lt;ffffffff8162c5c9&gt;] ctrl_getfamily+0x159/0x190
[ 2461.580103]  [&lt;ffffffff8162d8a4&gt;] genl_family_rcv_msg+0x1f4/0x2e0
[ 2461.580103]  [&lt;ffffffff8162d990&gt;] ? genl_family_rcv_msg+0x2e0/0x2e0
[ 2461.580103]  [&lt;ffffffff8162da1e&gt;] genl_rcv_msg+0x8e/0xd0
[ 2461.580103]  [&lt;ffffffff8162b729&gt;] netlink_rcv_skb+0xa9/0xc0
[ 2461.580103]  [&lt;ffffffff8162bc88&gt;] genl_rcv+0x28/0x40
[ 2461.580103]  [&lt;ffffffff8162ad6d&gt;] netlink_unicast+0xdd/0x190
[ 2461.580103]  [&lt;ffffffff8162b149&gt;] netlink_sendmsg+0x329/0x750
[ 2461.580103]  [&lt;ffffffff815db849&gt;] sock_sendmsg+0x99/0xd0
[ 2461.580103]  [&lt;ffffffff810bb58f&gt;] ? local_clock+0x5f/0x70
[ 2461.580103]  [&lt;ffffffff810e96e8&gt;] ? lock_release_non_nested+0x308/0x350
[ 2461.580103]  [&lt;ffffffff815dbc6e&gt;] ___sys_sendmsg+0x39e/0x3b0
[ 2461.580103]  [&lt;ffffffff810565af&gt;] ? kvm_clock_read+0x2f/0x50
[ 2461.580103]  [&lt;ffffffff810218b9&gt;] ? sched_clock+0x9/0x10
[ 2461.580103]  [&lt;ffffffff810bb2bd&gt;] ? sched_clock_local+0x1d/0x80
[ 2461.580103]  [&lt;ffffffff810bb448&gt;] ? sched_clock_cpu+0xa8/0x100
[ 2461.580103]  [&lt;ffffffff810e33ad&gt;] ? trace_hardirqs_off+0xd/0x10
[ 2461.580103]  [&lt;ffffffff810bb58f&gt;] ? local_clock+0x5f/0x70
[ 2461.580103]  [&lt;ffffffff810e3f7f&gt;] ? lock_release_holdtime.part.28+0xf/0x1a0
[ 2461.580103]  [&lt;ffffffff8120fec9&gt;] ? fget_light+0xf9/0x510
[ 2461.580103]  [&lt;ffffffff8120fe0c&gt;] ? fget_light+0x3c/0x510
[ 2461.580103]  [&lt;ffffffff815dd1d2&gt;] __sys_sendmsg+0x42/0x80
[ 2461.580103]  [&lt;ffffffff815dd222&gt;] SyS_sendmsg+0x12/0x20
[ 2461.580103]  [&lt;ffffffff81741ad9&gt;] system_call_fastpath+0x16/0x1b
[ 2461.580103] modprobe        D ffff88000f2c8000  4632   603    602 0x00000080
[ 2461.580103]  ffff88000f04fba8 0000000000000046 00000000001d5340 ffff88000f04ffd8
[ 2461.580103]  ffff88000f04ffd8 00000000001d5340 ffff8800377d4500 ffff8800377d4500
[ 2461.580103]  ffffffff81d0b260 ffffffff81d0b268 ffffffff00000000 ffffffff81d0b2b0
[ 2461.580103] Call Trace:
[ 2461.580103]  [&lt;ffffffff817355f9&gt;] schedule+0x29/0x70
[ 2461.580103]  [&lt;ffffffff81736d4d&gt;] rwsem_down_write_failed+0xed/0x1a0
[ 2461.580103]  [&lt;ffffffff810bb200&gt;] ? update_cpu_load_active+0x10/0xb0
[ 2461.580103]  [&lt;ffffffff8137b473&gt;] call_rwsem_down_write_failed+0x13/0x20
[ 2461.580103]  [&lt;ffffffff8173492d&gt;] ? down_write+0x9d/0xb2
[ 2461.580103]  [&lt;ffffffff8162baa5&gt;] ? genl_lock_all+0x15/0x30
[ 2461.580103]  [&lt;ffffffff8162baa5&gt;] genl_lock_all+0x15/0x30
[ 2461.580103]  [&lt;ffffffff8162cbb3&gt;] genl_register_family+0x53/0x1f0
[ 2461.580103]  [&lt;ffffffffa01dc000&gt;] ? 0xffffffffa01dbfff
[ 2461.580103]  [&lt;ffffffff8162d650&gt;] genl_register_family_with_ops+0x20/0x80
[ 2461.580103]  [&lt;ffffffffa01dc000&gt;] ? 0xffffffffa01dbfff
[ 2461.580103]  [&lt;ffffffffa017fe84&gt;] nl80211_init+0x24/0xf0 [cfg80211]
[ 2461.580103]  [&lt;ffffffffa01dc000&gt;] ? 0xffffffffa01dbfff
[ 2461.580103]  [&lt;ffffffffa01dc043&gt;] cfg80211_init+0x43/0xdb [cfg80211]
[ 2461.580103]  [&lt;ffffffff810020fa&gt;] do_one_initcall+0xfa/0x1b0
[ 2461.580103]  [&lt;ffffffff8105cb93&gt;] ? set_memory_nx+0x43/0x50
[ 2461.580103]  [&lt;ffffffff810f75af&gt;] load_module+0x1c6f/0x27f0
[ 2461.580103]  [&lt;ffffffff810f2c90&gt;] ? store_uevent+0x40/0x40
[ 2461.580103]  [&lt;ffffffff810f82c6&gt;] SyS_finit_module+0x86/0xb0
[ 2461.580103]  [&lt;ffffffff81741ad9&gt;] system_call_fastpath+0x16/0x1b
[ 2461.580103] Sched Debug Version: v0.10, 3.11.0-0.rc1.git4.1.fc20.x86_64 #1

Problem start to happen after adding net-pf-16-proto-16-family-nl80211
alias name to cfg80211 module by below commit (though that commit
itself is perfectly fine):

commit fb4e156886ce6e8309e912d8b370d192330d19d3
Author: Marcel Holtmann &lt;marcel@holtmann.org&gt;
Date:   Sun Apr 28 16:22:06 2013 -0700

    nl80211: Add generic netlink module alias for cfg80211/nl80211

Reported-and-tested-by: Jeff Layton &lt;jlayton@redhat.com&gt;
Reported-by: Richard W.M. Jones &lt;rjones@redhat.com&gt;
Signed-off-by: Stanislaw Gruszka &lt;sgruszka@redhat.com&gt;
Reviewed-by: Pravin B Shelar &lt;pshelar@nicira.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>netlink: fix error propagation in netlink_mmap()</title>
<updated>2013-06-11T09:52:47Z</updated>
<author>
<name>Patrick McHardy</name>
<email>kaber@trash.net</email>
</author>
<published>2013-06-11T09:52:47Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=7cdbac71f911494aa7d0343be23c092ca84a5ed4'/>
<id>urn:sha1:7cdbac71f911494aa7d0343be23c092ca84a5ed4</id>
<content type='text'>
Return the error if something went wrong instead of unconditionally
returning 0.

Signed-off-by: Patrick McHardy &lt;kaber@trash.net&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>net: fix sk_buff head without data area</title>
<updated>2013-06-05T00:26:49Z</updated>
<author>
<name>Pablo Neira</name>
<email>pablo@netfilter.org</email>
</author>
<published>2013-06-03T09:28:43Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=5e71d9d77c07fa7d4c42287a177f7b738d0cd4b9'/>
<id>urn:sha1:5e71d9d77c07fa7d4c42287a177f7b738d0cd4b9</id>
<content type='text'>
Eric Dumazet spotted that we have to check skb-&gt;head instead
of skb-&gt;data as skb-&gt;head points to the beginning of the
data area of the skbuff. Similarly, we have to initialize the
skb-&gt;head pointer, not skb-&gt;data in __alloc_skb_head.

After this fix, netlink crashes in the release path of the
sk_buff, so let's fix that as well.

This bug was introduced in (0ebd0ac net: add function to
allocate sk_buff head without data area).

Reported-by: Eric Dumazet &lt;eric.dumazet@gmail.com&gt;
Signed-off-by: Pablo Neira Ayuso &lt;pablo@netfilter.org&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>netlink: kconfig: move mmap i/o into netlink kconfig</title>
<updated>2013-05-01T19:02:42Z</updated>
<author>
<name>Daniel Borkmann</name>
<email>dborkman@redhat.com</email>
</author>
<published>2013-05-01T01:37:20Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=ee1bec9b3b49ea05e97ef40a3d38b70628cb947a'/>
<id>urn:sha1:ee1bec9b3b49ea05e97ef40a3d38b70628cb947a</id>
<content type='text'>
Currently, in menuconfig, Netlink's new mmaped IO is the very first
entry under the ``Networking support'' item and comes even before
``Networking options'':

  [ ]   Netlink: mmaped IO
  Networking options  ---&gt;
  ...

Lets move this into ``Networking options'' under netlink's Kconfig,
since this might be more appropriate. Introduced by commit ccdfcc398
(``netlink: mmaped netlink: ring setup'').

Signed-off-by: Daniel Borkmann &lt;dborkman@redhat.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>netlink: Fix skb ref counting.</title>
<updated>2013-05-01T18:57:03Z</updated>
<author>
<name>Pravin B Shelar</name>
<email>pshelar@nicira.com</email>
</author>
<published>2013-04-29T20:52:01Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=ae6164adeb559db1828d4abd917971b61130f72e'/>
<id>urn:sha1:ae6164adeb559db1828d4abd917971b61130f72e</id>
<content type='text'>
Commit f9c2288837ba072b21dba955f04a4c97eaa77b1e (netlink:
implement memory mapped recvmsg) increamented skb-&gt;users
ref count twice for a dump op which does not look right.

Following patch fixes that.

CC: Patrick McHardy &lt;kaber@trash.net&gt;
Signed-off-by: Pravin B Shelar &lt;pshelar@nicira.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
</feed>
