<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux-stable.git/net/l2tp, branch v3.2.78</title>
<subtitle>Linux kernel stable tree</subtitle>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/'/>
<entry>
<title>l2tp: fix race while getting PMTU on PPP pseudo-wire</title>
<updated>2014-11-05T20:27:49+00:00</updated>
<author>
<name>Guillaume Nault</name>
<email>g.nault@alphalink.fr</email>
</author>
<published>2014-09-03T12:12:55+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=544bd1bf08f824dc972832fba6d92b34a5a93f69'/>
<id>544bd1bf08f824dc972832fba6d92b34a5a93f69</id>
<content type='text'>
commit eed4d839b0cdf9d84b0a9bc63de90fd5e1e886fb upstream.

Use dst_entry held by sk_dst_get() to retrieve tunnel's PMTU.

The dst_mtu(__sk_dst_get(tunnel-&gt;sock)) call was racy. __sk_dst_get()
could return NULL if tunnel-&gt;sock-&gt;sk_dst_cache was reset just before the
call, thus making dst_mtu() dereference a NULL pointer:

[ 1937.661598] BUG: unable to handle kernel NULL pointer dereference at 0000000000000020
[ 1937.664005] IP: [&lt;ffffffffa049db88&gt;] pppol2tp_connect+0x33d/0x41e [l2tp_ppp]
[ 1937.664005] PGD daf0c067 PUD d9f93067 PMD 0
[ 1937.664005] Oops: 0000 [#1] SMP
[ 1937.664005] Modules linked in: l2tp_ppp l2tp_netlink l2tp_core ip6table_filter ip6_tables iptable_filter ip_tables ebtable_nat ebtables x_tables udp_tunnel pppoe pppox ppp_generic slhc deflate ctr twofish_generic twofish_x86_64_3way xts lrw gf128mul glue_helper twofish_x86_64 twofish_common blowfish_generic blowfish_x86_64 blowfish_common des_generic cbc xcbc rmd160 sha512_generic hmac crypto_null af_key xfrm_algo 8021q garp bridge stp llc tun atmtcp clip atm ext3 mbcache jbd iTCO_wdt coretemp kvm_intel iTCO_vendor_support kvm pcspkr evdev ehci_pci lpc_ich mfd_core i5400_edac edac_core i5k_amb shpchp button processor thermal_sys xfs crc32c_generic libcrc32c dm_mod usbhid sg hid sr_mod sd_mod cdrom crc_t10dif crct10dif_common ata_generic ahci ata_piix tg3 libahci libata uhci_hcd ptp ehci_hcd pps_core usbcore scsi_mod libphy usb_common [last unloaded: l2tp_core]
[ 1937.664005] CPU: 0 PID: 10022 Comm: l2tpstress Tainted: G           O   3.17.0-rc1 #1
[ 1937.664005] Hardware name: HP ProLiant DL160 G5, BIOS O12 08/22/2008
[ 1937.664005] task: ffff8800d8fda790 ti: ffff8800c43c4000 task.ti: ffff8800c43c4000
[ 1937.664005] RIP: 0010:[&lt;ffffffffa049db88&gt;]  [&lt;ffffffffa049db88&gt;] pppol2tp_connect+0x33d/0x41e [l2tp_ppp]
[ 1937.664005] RSP: 0018:ffff8800c43c7de8  EFLAGS: 00010282
[ 1937.664005] RAX: ffff8800da8a7240 RBX: ffff8800d8c64600 RCX: 000001c325a137b5
[ 1937.664005] RDX: 8c6318c6318c6320 RSI: 000000000000010c RDI: 0000000000000000
[ 1937.664005] RBP: ffff8800c43c7ea8 R08: 0000000000000000 R09: 0000000000000000
[ 1937.664005] R10: ffffffffa048e2c0 R11: ffff8800d8c64600 R12: ffff8800ca7a5000
[ 1937.664005] R13: ffff8800c439bf40 R14: 000000000000000c R15: 0000000000000009
[ 1937.664005] FS:  00007fd7f610f700(0000) GS:ffff88011a600000(0000) knlGS:0000000000000000
[ 1937.664005] CS:  0010 DS: 0000 ES: 0000 CR0: 000000008005003b
[ 1937.664005] CR2: 0000000000000020 CR3: 00000000d9d75000 CR4: 00000000000027e0
[ 1937.664005] Stack:
[ 1937.664005]  ffffffffa049da80 ffff8800d8fda790 000000000000005b ffff880000000009
[ 1937.664005]  ffff8800daf3f200 0000000000000003 ffff8800c43c7e48 ffffffff81109b57
[ 1937.664005]  ffffffff81109b0e ffffffff8114c566 0000000000000000 0000000000000000
[ 1937.664005] Call Trace:
[ 1937.664005]  [&lt;ffffffffa049da80&gt;] ? pppol2tp_connect+0x235/0x41e [l2tp_ppp]
[ 1937.664005]  [&lt;ffffffff81109b57&gt;] ? might_fault+0x9e/0xa5
[ 1937.664005]  [&lt;ffffffff81109b0e&gt;] ? might_fault+0x55/0xa5
[ 1937.664005]  [&lt;ffffffff8114c566&gt;] ? rcu_read_unlock+0x1c/0x26
[ 1937.664005]  [&lt;ffffffff81309196&gt;] SYSC_connect+0x87/0xb1
[ 1937.664005]  [&lt;ffffffff813e56f7&gt;] ? sysret_check+0x1b/0x56
[ 1937.664005]  [&lt;ffffffff8107590d&gt;] ? trace_hardirqs_on_caller+0x145/0x1a1
[ 1937.664005]  [&lt;ffffffff81213dee&gt;] ? trace_hardirqs_on_thunk+0x3a/0x3f
[ 1937.664005]  [&lt;ffffffff8114c262&gt;] ? spin_lock+0x9/0xb
[ 1937.664005]  [&lt;ffffffff813092b4&gt;] SyS_connect+0x9/0xb
[ 1937.664005]  [&lt;ffffffff813e56d2&gt;] system_call_fastpath+0x16/0x1b
[ 1937.664005] Code: 10 2a 84 81 e8 65 76 bd e0 65 ff 0c 25 10 bb 00 00 4d 85 ed 74 37 48 8b 85 60 ff ff ff 48 8b 80 88 01 00 00 48 8b b8 10 02 00 00 &lt;48&gt; 8b 47 20 ff 50 20 85 c0 74 0f 83 e8 28 89 83 10 01 00 00 89
[ 1937.664005] RIP  [&lt;ffffffffa049db88&gt;] pppol2tp_connect+0x33d/0x41e [l2tp_ppp]
[ 1937.664005]  RSP &lt;ffff8800c43c7de8&gt;
[ 1937.664005] CR2: 0000000000000020
[ 1939.559375] ---[ end trace 82d44500f28f8708 ]---

Fixes: f34c4a35d879 ("l2tp: take PMTU from tunnel UDP socket")
Signed-off-by: Guillaume Nault &lt;g.nault@alphalink.fr&gt;
Acked-by: Eric Dumazet &lt;edumazet@google.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
Signed-off-by: Ben Hutchings &lt;ben@decadent.org.uk&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
commit eed4d839b0cdf9d84b0a9bc63de90fd5e1e886fb upstream.

Use dst_entry held by sk_dst_get() to retrieve tunnel's PMTU.

The dst_mtu(__sk_dst_get(tunnel-&gt;sock)) call was racy. __sk_dst_get()
could return NULL if tunnel-&gt;sock-&gt;sk_dst_cache was reset just before the
call, thus making dst_mtu() dereference a NULL pointer:

[ 1937.661598] BUG: unable to handle kernel NULL pointer dereference at 0000000000000020
[ 1937.664005] IP: [&lt;ffffffffa049db88&gt;] pppol2tp_connect+0x33d/0x41e [l2tp_ppp]
[ 1937.664005] PGD daf0c067 PUD d9f93067 PMD 0
[ 1937.664005] Oops: 0000 [#1] SMP
[ 1937.664005] Modules linked in: l2tp_ppp l2tp_netlink l2tp_core ip6table_filter ip6_tables iptable_filter ip_tables ebtable_nat ebtables x_tables udp_tunnel pppoe pppox ppp_generic slhc deflate ctr twofish_generic twofish_x86_64_3way xts lrw gf128mul glue_helper twofish_x86_64 twofish_common blowfish_generic blowfish_x86_64 blowfish_common des_generic cbc xcbc rmd160 sha512_generic hmac crypto_null af_key xfrm_algo 8021q garp bridge stp llc tun atmtcp clip atm ext3 mbcache jbd iTCO_wdt coretemp kvm_intel iTCO_vendor_support kvm pcspkr evdev ehci_pci lpc_ich mfd_core i5400_edac edac_core i5k_amb shpchp button processor thermal_sys xfs crc32c_generic libcrc32c dm_mod usbhid sg hid sr_mod sd_mod cdrom crc_t10dif crct10dif_common ata_generic ahci ata_piix tg3 libahci libata uhci_hcd ptp ehci_hcd pps_core usbcore scsi_mod libphy usb_common [last unloaded: l2tp_core]
[ 1937.664005] CPU: 0 PID: 10022 Comm: l2tpstress Tainted: G           O   3.17.0-rc1 #1
[ 1937.664005] Hardware name: HP ProLiant DL160 G5, BIOS O12 08/22/2008
[ 1937.664005] task: ffff8800d8fda790 ti: ffff8800c43c4000 task.ti: ffff8800c43c4000
[ 1937.664005] RIP: 0010:[&lt;ffffffffa049db88&gt;]  [&lt;ffffffffa049db88&gt;] pppol2tp_connect+0x33d/0x41e [l2tp_ppp]
[ 1937.664005] RSP: 0018:ffff8800c43c7de8  EFLAGS: 00010282
[ 1937.664005] RAX: ffff8800da8a7240 RBX: ffff8800d8c64600 RCX: 000001c325a137b5
[ 1937.664005] RDX: 8c6318c6318c6320 RSI: 000000000000010c RDI: 0000000000000000
[ 1937.664005] RBP: ffff8800c43c7ea8 R08: 0000000000000000 R09: 0000000000000000
[ 1937.664005] R10: ffffffffa048e2c0 R11: ffff8800d8c64600 R12: ffff8800ca7a5000
[ 1937.664005] R13: ffff8800c439bf40 R14: 000000000000000c R15: 0000000000000009
[ 1937.664005] FS:  00007fd7f610f700(0000) GS:ffff88011a600000(0000) knlGS:0000000000000000
[ 1937.664005] CS:  0010 DS: 0000 ES: 0000 CR0: 000000008005003b
[ 1937.664005] CR2: 0000000000000020 CR3: 00000000d9d75000 CR4: 00000000000027e0
[ 1937.664005] Stack:
[ 1937.664005]  ffffffffa049da80 ffff8800d8fda790 000000000000005b ffff880000000009
[ 1937.664005]  ffff8800daf3f200 0000000000000003 ffff8800c43c7e48 ffffffff81109b57
[ 1937.664005]  ffffffff81109b0e ffffffff8114c566 0000000000000000 0000000000000000
[ 1937.664005] Call Trace:
[ 1937.664005]  [&lt;ffffffffa049da80&gt;] ? pppol2tp_connect+0x235/0x41e [l2tp_ppp]
[ 1937.664005]  [&lt;ffffffff81109b57&gt;] ? might_fault+0x9e/0xa5
[ 1937.664005]  [&lt;ffffffff81109b0e&gt;] ? might_fault+0x55/0xa5
[ 1937.664005]  [&lt;ffffffff8114c566&gt;] ? rcu_read_unlock+0x1c/0x26
[ 1937.664005]  [&lt;ffffffff81309196&gt;] SYSC_connect+0x87/0xb1
[ 1937.664005]  [&lt;ffffffff813e56f7&gt;] ? sysret_check+0x1b/0x56
[ 1937.664005]  [&lt;ffffffff8107590d&gt;] ? trace_hardirqs_on_caller+0x145/0x1a1
[ 1937.664005]  [&lt;ffffffff81213dee&gt;] ? trace_hardirqs_on_thunk+0x3a/0x3f
[ 1937.664005]  [&lt;ffffffff8114c262&gt;] ? spin_lock+0x9/0xb
[ 1937.664005]  [&lt;ffffffff813092b4&gt;] SyS_connect+0x9/0xb
[ 1937.664005]  [&lt;ffffffff813e56d2&gt;] system_call_fastpath+0x16/0x1b
[ 1937.664005] Code: 10 2a 84 81 e8 65 76 bd e0 65 ff 0c 25 10 bb 00 00 4d 85 ed 74 37 48 8b 85 60 ff ff ff 48 8b 80 88 01 00 00 48 8b b8 10 02 00 00 &lt;48&gt; 8b 47 20 ff 50 20 85 c0 74 0f 83 e8 28 89 83 10 01 00 00 89
[ 1937.664005] RIP  [&lt;ffffffffa049db88&gt;] pppol2tp_connect+0x33d/0x41e [l2tp_ppp]
[ 1937.664005]  RSP &lt;ffff8800c43c7de8&gt;
[ 1937.664005] CR2: 0000000000000020
[ 1939.559375] ---[ end trace 82d44500f28f8708 ]---

Fixes: f34c4a35d879 ("l2tp: take PMTU from tunnel UDP socket")
Signed-off-by: Guillaume Nault &lt;g.nault@alphalink.fr&gt;
Acked-by: Eric Dumazet &lt;edumazet@google.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
Signed-off-by: Ben Hutchings &lt;ben@decadent.org.uk&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>net/l2tp: don't fall back on UDP [get|set]sockopt</title>
<updated>2014-08-06T17:07:37+00:00</updated>
<author>
<name>Sasha Levin</name>
<email>sasha.levin@oracle.com</email>
</author>
<published>2014-07-15T00:02:31+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=1179c8f1caca90caf4ce0eec54b499de4f1551c4'/>
<id>1179c8f1caca90caf4ce0eec54b499de4f1551c4</id>
<content type='text'>
commit 3cf521f7dc87c031617fd47e4b7aa2593c2f3daf upstream.

The l2tp [get|set]sockopt() code has fallen back to the UDP functions
for socket option levels != SOL_PPPOL2TP since day one, but that has
never actually worked, since the l2tp socket isn't an inet socket.

As David Miller points out:

  "If we wanted this to work, it'd have to look up the tunnel and then
   use tunnel-&gt;sk, but I wonder how useful that would be"

Since this can never have worked so nobody could possibly have depended
on that functionality, just remove the broken code and return -EINVAL.

Reported-by: Sasha Levin &lt;sasha.levin@oracle.com&gt;
Acked-by: James Chapman &lt;jchapman@katalix.com&gt;
Acked-by: David Miller &lt;davem@davemloft.net&gt;
Cc: Phil Turnbull &lt;phil.turnbull@oracle.com&gt;
Cc: Vegard Nossum &lt;vegard.nossum@oracle.com&gt;
Cc: Willy Tarreau &lt;w@1wt.eu&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
Signed-off-by: Ben Hutchings &lt;ben@decadent.org.uk&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
commit 3cf521f7dc87c031617fd47e4b7aa2593c2f3daf upstream.

The l2tp [get|set]sockopt() code has fallen back to the UDP functions
for socket option levels != SOL_PPPOL2TP since day one, but that has
never actually worked, since the l2tp socket isn't an inet socket.

As David Miller points out:

  "If we wanted this to work, it'd have to look up the tunnel and then
   use tunnel-&gt;sk, but I wonder how useful that would be"

Since this can never have worked so nobody could possibly have depended
on that functionality, just remove the broken code and return -EINVAL.

Reported-by: Sasha Levin &lt;sasha.levin@oracle.com&gt;
Acked-by: James Chapman &lt;jchapman@katalix.com&gt;
Acked-by: David Miller &lt;davem@davemloft.net&gt;
Cc: Phil Turnbull &lt;phil.turnbull@oracle.com&gt;
Cc: Vegard Nossum &lt;vegard.nossum@oracle.com&gt;
Cc: Willy Tarreau &lt;w@1wt.eu&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
Signed-off-by: Ben Hutchings &lt;ben@decadent.org.uk&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>l2tp: take PMTU from tunnel UDP socket</title>
<updated>2014-06-09T12:28:55+00:00</updated>
<author>
<name>Dmitry Petukhov</name>
<email>dmgenp@gmail.com</email>
</author>
<published>2014-04-08T20:23:20+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=109d10d19ff823dd63d0045cc2667708c923b83d'/>
<id>109d10d19ff823dd63d0045cc2667708c923b83d</id>
<content type='text'>
[ Upstream commit f34c4a35d87949fbb0e0f31eba3c054e9f8199ba ]

When l2tp driver tries to get PMTU for the tunnel destination, it uses
the pointer to struct sock that represents PPPoX socket, while it
should use the pointer that represents UDP socket of the tunnel.

Signed-off-by: Dmitry Petukhov &lt;dmgenp@gmail.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
Signed-off-by: Ben Hutchings &lt;ben@decadent.org.uk&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
[ Upstream commit f34c4a35d87949fbb0e0f31eba3c054e9f8199ba ]

When l2tp driver tries to get PMTU for the tunnel destination, it uses
the pointer to struct sock that represents PPPoX socket, while it
should use the pointer that represents UDP socket of the tunnel.

Signed-off-by: Dmitry Petukhov &lt;dmgenp@gmail.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
Signed-off-by: Ben Hutchings &lt;ben@decadent.org.uk&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>net: rework recvmsg handler msg_name and msg_namelen logic</title>
<updated>2014-01-03T04:33:33+00:00</updated>
<author>
<name>Hannes Frederic Sowa</name>
<email>hannes@stressinduktion.org</email>
</author>
<published>2013-11-21T02:14:22+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=a598f7fa9c24c3ef458043d59c237b8fc5d1adad'/>
<id>a598f7fa9c24c3ef458043d59c237b8fc5d1adad</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: Ben Hutchings &lt;ben@decadent.org.uk&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
[ 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: Ben Hutchings &lt;ben@decadent.org.uk&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>inet: prevent leakage of uninitialized memory to user in recv syscalls</title>
<updated>2014-01-03T04:33:33+00:00</updated>
<author>
<name>Hannes Frederic Sowa</name>
<email>hannes@stressinduktion.org</email>
</author>
<published>2013-11-18T03:20:45+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=05d3c1eece356052d8119663d5415c2fcb4680d8'/>
<id>05d3c1eece356052d8119663d5415c2fcb4680d8</id>
<content type='text'>
[ Upstream commit bceaa90240b6019ed73b49965eac7d167610be69 ]

Only update *addr_len when we actually fill in sockaddr, otherwise we
can return uninitialized memory from the stack to the caller in the
recvfrom, recvmmsg and recvmsg syscalls. Drop the the (addr_len == NULL)
checks because we only get called with a valid addr_len pointer either
from sock_common_recvmsg or inet_recvmsg.

If a blocking read waits on a socket which is concurrently shut down we
now return zero and set msg_msgnamelen to 0.

Reported-by: mpb &lt;mpb.mail@gmail.com&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: Ben Hutchings &lt;ben@decadent.org.uk&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
[ Upstream commit bceaa90240b6019ed73b49965eac7d167610be69 ]

Only update *addr_len when we actually fill in sockaddr, otherwise we
can return uninitialized memory from the stack to the caller in the
recvfrom, recvmmsg and recvmsg syscalls. Drop the the (addr_len == NULL)
checks because we only get called with a valid addr_len pointer either
from sock_common_recvmsg or inet_recvmsg.

If a blocking read waits on a socket which is concurrently shut down we
now return zero and set msg_msgnamelen to 0.

Reported-by: mpb &lt;mpb.mail@gmail.com&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: Ben Hutchings &lt;ben@decadent.org.uk&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>l2tp: must disable bh before calling l2tp_xmit_skb()</title>
<updated>2013-11-28T14:01:57+00:00</updated>
<author>
<name>Eric Dumazet</name>
<email>edumazet@google.com</email>
</author>
<published>2013-10-10T13:30:09+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=d9aab1cfdd30ff43df1e45f9430c30d99c2c6e47'/>
<id>d9aab1cfdd30ff43df1e45f9430c30d99c2c6e47</id>
<content type='text'>
[ Upstream commit 455cc32bf128e114455d11ad919321ab89a2c312 ]

François Cachereul made a very nice bug report and suspected
the bh_lock_sock() / bh_unlok_sock() pair used in l2tp_xmit_skb() from
process context was not good.

This problem was added by commit 6af88da14ee284aaad6e4326da09a89191ab6165
("l2tp: Fix locking in l2tp_core.c").

l2tp_eth_dev_xmit() runs from BH context, so we must disable BH
from other l2tp_xmit_skb() users.

[  452.060011] BUG: soft lockup - CPU#1 stuck for 23s! [accel-pppd:6662]
[  452.061757] Modules linked in: l2tp_ppp l2tp_netlink l2tp_core pppoe pppox
ppp_generic slhc ipv6 ext3 mbcache jbd virtio_balloon xfs exportfs dm_mod
virtio_blk ata_generic virtio_net floppy ata_piix libata virtio_pci virtio_ring virtio [last unloaded: scsi_wait_scan]
[  452.064012] CPU 1
[  452.080015] BUG: soft lockup - CPU#2 stuck for 23s! [accel-pppd:6643]
[  452.080015] CPU 2
[  452.080015]
[  452.080015] Pid: 6643, comm: accel-pppd Not tainted 3.2.46.mini #1 Bochs Bochs
[  452.080015] RIP: 0010:[&lt;ffffffff81059f6c&gt;]  [&lt;ffffffff81059f6c&gt;] do_raw_spin_lock+0x17/0x1f
[  452.080015] RSP: 0018:ffff88007125fc18  EFLAGS: 00000293
[  452.080015] RAX: 000000000000aba9 RBX: ffffffff811d0703 RCX: 0000000000000000
[  452.080015] RDX: 00000000000000ab RSI: ffff8800711f6896 RDI: ffff8800745c8110
[  452.080015] RBP: ffff88007125fc18 R08: 0000000000000020 R09: 0000000000000000
[  452.080015] R10: 0000000000000000 R11: 0000000000000280 R12: 0000000000000286
[  452.080015] R13: 0000000000000020 R14: 0000000000000240 R15: 0000000000000000
[  452.080015] FS:  00007fdc0cc24700(0000) GS:ffff8800b6f00000(0000) knlGS:0000000000000000
[  452.080015] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[  452.080015] CR2: 00007fdb054899b8 CR3: 0000000074404000 CR4: 00000000000006a0
[  452.080015] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
[  452.080015] DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
[  452.080015] Process accel-pppd (pid: 6643, threadinfo ffff88007125e000, task ffff8800b27e6dd0)
[  452.080015] Stack:
[  452.080015]  ffff88007125fc28 ffffffff81256559 ffff88007125fc98 ffffffffa01b2bd1
[  452.080015]  ffff88007125fc58 000000000000000c 00000000029490d0 0000009c71dbe25e
[  452.080015]  000000000000005c 000000080000000e 0000000000000000 ffff880071170600
[  452.080015] Call Trace:
[  452.080015]  [&lt;ffffffff81256559&gt;] _raw_spin_lock+0xe/0x10
[  452.080015]  [&lt;ffffffffa01b2bd1&gt;] l2tp_xmit_skb+0x189/0x4ac [l2tp_core]
[  452.080015]  [&lt;ffffffffa01c2d36&gt;] pppol2tp_sendmsg+0x15e/0x19c [l2tp_ppp]
[  452.080015]  [&lt;ffffffff811c7872&gt;] __sock_sendmsg_nosec+0x22/0x24
[  452.080015]  [&lt;ffffffff811c83bd&gt;] sock_sendmsg+0xa1/0xb6
[  452.080015]  [&lt;ffffffff81254e88&gt;] ? __schedule+0x5c1/0x616
[  452.080015]  [&lt;ffffffff8103c7c6&gt;] ? __dequeue_signal+0xb7/0x10c
[  452.080015]  [&lt;ffffffff810bbd21&gt;] ? fget_light+0x75/0x89
[  452.080015]  [&lt;ffffffff811c8444&gt;] ? sockfd_lookup_light+0x20/0x56
[  452.080015]  [&lt;ffffffff811c9b34&gt;] sys_sendto+0x10c/0x13b
[  452.080015]  [&lt;ffffffff8125cac2&gt;] system_call_fastpath+0x16/0x1b
[  452.080015] Code: 81 48 89 e5 72 0c 31 c0 48 81 ff 45 66 25 81 0f 92 c0 5d c3 55 b8 00 01 00 00 48 89 e5 f0 66 0f c1 07 0f b6 d4 38 d0 74 06 f3 90 &lt;8a&gt; 07 eb f6 5d c3 90 90 55 48 89 e5 9c 58 0f 1f 44 00 00 5d c3
[  452.080015] Call Trace:
[  452.080015]  [&lt;ffffffff81256559&gt;] _raw_spin_lock+0xe/0x10
[  452.080015]  [&lt;ffffffffa01b2bd1&gt;] l2tp_xmit_skb+0x189/0x4ac [l2tp_core]
[  452.080015]  [&lt;ffffffffa01c2d36&gt;] pppol2tp_sendmsg+0x15e/0x19c [l2tp_ppp]
[  452.080015]  [&lt;ffffffff811c7872&gt;] __sock_sendmsg_nosec+0x22/0x24
[  452.080015]  [&lt;ffffffff811c83bd&gt;] sock_sendmsg+0xa1/0xb6
[  452.080015]  [&lt;ffffffff81254e88&gt;] ? __schedule+0x5c1/0x616
[  452.080015]  [&lt;ffffffff8103c7c6&gt;] ? __dequeue_signal+0xb7/0x10c
[  452.080015]  [&lt;ffffffff810bbd21&gt;] ? fget_light+0x75/0x89
[  452.080015]  [&lt;ffffffff811c8444&gt;] ? sockfd_lookup_light+0x20/0x56
[  452.080015]  [&lt;ffffffff811c9b34&gt;] sys_sendto+0x10c/0x13b
[  452.080015]  [&lt;ffffffff8125cac2&gt;] system_call_fastpath+0x16/0x1b
[  452.064012]
[  452.064012] Pid: 6662, comm: accel-pppd Not tainted 3.2.46.mini #1 Bochs Bochs
[  452.064012] RIP: 0010:[&lt;ffffffff81059f6e&gt;]  [&lt;ffffffff81059f6e&gt;] do_raw_spin_lock+0x19/0x1f
[  452.064012] RSP: 0018:ffff8800b6e83ba0  EFLAGS: 00000297
[  452.064012] RAX: 000000000000aaa9 RBX: ffff8800b6e83b40 RCX: 0000000000000002
[  452.064012] RDX: 00000000000000aa RSI: 000000000000000a RDI: ffff8800745c8110
[  452.064012] RBP: ffff8800b6e83ba0 R08: 000000000000c802 R09: 000000000000001c
[  452.064012] R10: ffff880071096c4e R11: 0000000000000006 R12: ffff8800b6e83b18
[  452.064012] R13: ffffffff8125d51e R14: ffff8800b6e83ba0 R15: ffff880072a589c0
[  452.064012] FS:  00007fdc0b81e700(0000) GS:ffff8800b6e80000(0000) knlGS:0000000000000000
[  452.064012] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[  452.064012] CR2: 0000000000625208 CR3: 0000000074404000 CR4: 00000000000006a0
[  452.064012] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
[  452.064012] DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
[  452.064012] Process accel-pppd (pid: 6662, threadinfo ffff88007129a000, task ffff8800744f7410)
[  452.064012] Stack:
[  452.064012]  ffff8800b6e83bb0 ffffffff81256559 ffff8800b6e83bc0 ffffffff8121c64a
[  452.064012]  ffff8800b6e83bf0 ffffffff8121ec7a ffff880072a589c0 ffff880071096c62
[  452.064012]  0000000000000011 ffffffff81430024 ffff8800b6e83c80 ffffffff8121f276
[  452.064012] Call Trace:
[  452.064012]  &lt;IRQ&gt;
[  452.064012]  [&lt;ffffffff81256559&gt;] _raw_spin_lock+0xe/0x10
[  452.064012]  [&lt;ffffffff8121c64a&gt;] spin_lock+0x9/0xb
[  452.064012]  [&lt;ffffffff8121ec7a&gt;] udp_queue_rcv_skb+0x186/0x269
[  452.064012]  [&lt;ffffffff8121f276&gt;] __udp4_lib_rcv+0x297/0x4ae
[  452.064012]  [&lt;ffffffff8121c178&gt;] ? raw_rcv+0xe9/0xf0
[  452.064012]  [&lt;ffffffff8121f4a7&gt;] udp_rcv+0x1a/0x1c
[  452.064012]  [&lt;ffffffff811fe385&gt;] ip_local_deliver_finish+0x12b/0x1a5
[  452.064012]  [&lt;ffffffff811fe54e&gt;] ip_local_deliver+0x53/0x84
[  452.064012]  [&lt;ffffffff811fe1d0&gt;] ip_rcv_finish+0x2bc/0x2f3
[  452.064012]  [&lt;ffffffff811fe78f&gt;] ip_rcv+0x210/0x269
[  452.064012]  [&lt;ffffffff8101911e&gt;] ? kvm_clock_get_cycles+0x9/0xb
[  452.064012]  [&lt;ffffffff811d88cd&gt;] __netif_receive_skb+0x3a5/0x3f7
[  452.064012]  [&lt;ffffffff811d8eba&gt;] netif_receive_skb+0x57/0x5e
[  452.064012]  [&lt;ffffffff811cf30f&gt;] ? __netdev_alloc_skb+0x1f/0x3b
[  452.064012]  [&lt;ffffffffa0049126&gt;] virtnet_poll+0x4ba/0x5a4 [virtio_net]
[  452.064012]  [&lt;ffffffff811d9417&gt;] net_rx_action+0x73/0x184
[  452.064012]  [&lt;ffffffffa01b2cc2&gt;] ? l2tp_xmit_skb+0x27a/0x4ac [l2tp_core]
[  452.064012]  [&lt;ffffffff810343b9&gt;] __do_softirq+0xc3/0x1a8
[  452.064012]  [&lt;ffffffff81013b56&gt;] ? ack_APIC_irq+0x10/0x12
[  452.064012]  [&lt;ffffffff81256559&gt;] ? _raw_spin_lock+0xe/0x10
[  452.064012]  [&lt;ffffffff8125e0ac&gt;] call_softirq+0x1c/0x26
[  452.064012]  [&lt;ffffffff81003587&gt;] do_softirq+0x45/0x82
[  452.064012]  [&lt;ffffffff81034667&gt;] irq_exit+0x42/0x9c
[  452.064012]  [&lt;ffffffff8125e146&gt;] do_IRQ+0x8e/0xa5
[  452.064012]  [&lt;ffffffff8125676e&gt;] common_interrupt+0x6e/0x6e
[  452.064012]  &lt;EOI&gt;
[  452.064012]  [&lt;ffffffff810b82a1&gt;] ? kfree+0x8a/0xa3
[  452.064012]  [&lt;ffffffffa01b2cc2&gt;] ? l2tp_xmit_skb+0x27a/0x4ac [l2tp_core]
[  452.064012]  [&lt;ffffffffa01b2c25&gt;] ? l2tp_xmit_skb+0x1dd/0x4ac [l2tp_core]
[  452.064012]  [&lt;ffffffffa01c2d36&gt;] pppol2tp_sendmsg+0x15e/0x19c [l2tp_ppp]
[  452.064012]  [&lt;ffffffff811c7872&gt;] __sock_sendmsg_nosec+0x22/0x24
[  452.064012]  [&lt;ffffffff811c83bd&gt;] sock_sendmsg+0xa1/0xb6
[  452.064012]  [&lt;ffffffff81254e88&gt;] ? __schedule+0x5c1/0x616
[  452.064012]  [&lt;ffffffff8103c7c6&gt;] ? __dequeue_signal+0xb7/0x10c
[  452.064012]  [&lt;ffffffff810bbd21&gt;] ? fget_light+0x75/0x89
[  452.064012]  [&lt;ffffffff811c8444&gt;] ? sockfd_lookup_light+0x20/0x56
[  452.064012]  [&lt;ffffffff811c9b34&gt;] sys_sendto+0x10c/0x13b
[  452.064012]  [&lt;ffffffff8125cac2&gt;] system_call_fastpath+0x16/0x1b
[  452.064012] Code: 89 e5 72 0c 31 c0 48 81 ff 45 66 25 81 0f 92 c0 5d c3 55 b8 00 01 00 00 48 89 e5 f0 66 0f c1 07 0f b6 d4 38 d0 74 06 f3 90 8a 07 &lt;eb&gt; f6 5d c3 90 90 55 48 89 e5 9c 58 0f 1f 44 00 00 5d c3 55 48
[  452.064012] Call Trace:
[  452.064012]  &lt;IRQ&gt;  [&lt;ffffffff81256559&gt;] _raw_spin_lock+0xe/0x10
[  452.064012]  [&lt;ffffffff8121c64a&gt;] spin_lock+0x9/0xb
[  452.064012]  [&lt;ffffffff8121ec7a&gt;] udp_queue_rcv_skb+0x186/0x269
[  452.064012]  [&lt;ffffffff8121f276&gt;] __udp4_lib_rcv+0x297/0x4ae
[  452.064012]  [&lt;ffffffff8121c178&gt;] ? raw_rcv+0xe9/0xf0
[  452.064012]  [&lt;ffffffff8121f4a7&gt;] udp_rcv+0x1a/0x1c
[  452.064012]  [&lt;ffffffff811fe385&gt;] ip_local_deliver_finish+0x12b/0x1a5
[  452.064012]  [&lt;ffffffff811fe54e&gt;] ip_local_deliver+0x53/0x84
[  452.064012]  [&lt;ffffffff811fe1d0&gt;] ip_rcv_finish+0x2bc/0x2f3
[  452.064012]  [&lt;ffffffff811fe78f&gt;] ip_rcv+0x210/0x269
[  452.064012]  [&lt;ffffffff8101911e&gt;] ? kvm_clock_get_cycles+0x9/0xb
[  452.064012]  [&lt;ffffffff811d88cd&gt;] __netif_receive_skb+0x3a5/0x3f7
[  452.064012]  [&lt;ffffffff811d8eba&gt;] netif_receive_skb+0x57/0x5e
[  452.064012]  [&lt;ffffffff811cf30f&gt;] ? __netdev_alloc_skb+0x1f/0x3b
[  452.064012]  [&lt;ffffffffa0049126&gt;] virtnet_poll+0x4ba/0x5a4 [virtio_net]
[  452.064012]  [&lt;ffffffff811d9417&gt;] net_rx_action+0x73/0x184
[  452.064012]  [&lt;ffffffffa01b2cc2&gt;] ? l2tp_xmit_skb+0x27a/0x4ac [l2tp_core]
[  452.064012]  [&lt;ffffffff810343b9&gt;] __do_softirq+0xc3/0x1a8
[  452.064012]  [&lt;ffffffff81013b56&gt;] ? ack_APIC_irq+0x10/0x12
[  452.064012]  [&lt;ffffffff81256559&gt;] ? _raw_spin_lock+0xe/0x10
[  452.064012]  [&lt;ffffffff8125e0ac&gt;] call_softirq+0x1c/0x26
[  452.064012]  [&lt;ffffffff81003587&gt;] do_softirq+0x45/0x82
[  452.064012]  [&lt;ffffffff81034667&gt;] irq_exit+0x42/0x9c
[  452.064012]  [&lt;ffffffff8125e146&gt;] do_IRQ+0x8e/0xa5
[  452.064012]  [&lt;ffffffff8125676e&gt;] common_interrupt+0x6e/0x6e
[  452.064012]  &lt;EOI&gt;  [&lt;ffffffff810b82a1&gt;] ? kfree+0x8a/0xa3
[  452.064012]  [&lt;ffffffffa01b2cc2&gt;] ? l2tp_xmit_skb+0x27a/0x4ac [l2tp_core]
[  452.064012]  [&lt;ffffffffa01b2c25&gt;] ? l2tp_xmit_skb+0x1dd/0x4ac [l2tp_core]
[  452.064012]  [&lt;ffffffffa01c2d36&gt;] pppol2tp_sendmsg+0x15e/0x19c [l2tp_ppp]
[  452.064012]  [&lt;ffffffff811c7872&gt;] __sock_sendmsg_nosec+0x22/0x24
[  452.064012]  [&lt;ffffffff811c83bd&gt;] sock_sendmsg+0xa1/0xb6
[  452.064012]  [&lt;ffffffff81254e88&gt;] ? __schedule+0x5c1/0x616
[  452.064012]  [&lt;ffffffff8103c7c6&gt;] ? __dequeue_signal+0xb7/0x10c
[  452.064012]  [&lt;ffffffff810bbd21&gt;] ? fget_light+0x75/0x89
[  452.064012]  [&lt;ffffffff811c8444&gt;] ? sockfd_lookup_light+0x20/0x56
[  452.064012]  [&lt;ffffffff811c9b34&gt;] sys_sendto+0x10c/0x13b
[  452.064012]  [&lt;ffffffff8125cac2&gt;] system_call_fastpath+0x16/0x1b

Reported-by: François Cachereul &lt;f.cachereul@alphalink.fr&gt;
Tested-by: François Cachereul &lt;f.cachereul@alphalink.fr&gt;
Signed-off-by: Eric Dumazet &lt;edumazet@google.com&gt;
Cc: James Chapman &lt;jchapman@katalix.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
Signed-off-by: Ben Hutchings &lt;ben@decadent.org.uk&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
[ Upstream commit 455cc32bf128e114455d11ad919321ab89a2c312 ]

François Cachereul made a very nice bug report and suspected
the bh_lock_sock() / bh_unlok_sock() pair used in l2tp_xmit_skb() from
process context was not good.

This problem was added by commit 6af88da14ee284aaad6e4326da09a89191ab6165
("l2tp: Fix locking in l2tp_core.c").

l2tp_eth_dev_xmit() runs from BH context, so we must disable BH
from other l2tp_xmit_skb() users.

[  452.060011] BUG: soft lockup - CPU#1 stuck for 23s! [accel-pppd:6662]
[  452.061757] Modules linked in: l2tp_ppp l2tp_netlink l2tp_core pppoe pppox
ppp_generic slhc ipv6 ext3 mbcache jbd virtio_balloon xfs exportfs dm_mod
virtio_blk ata_generic virtio_net floppy ata_piix libata virtio_pci virtio_ring virtio [last unloaded: scsi_wait_scan]
[  452.064012] CPU 1
[  452.080015] BUG: soft lockup - CPU#2 stuck for 23s! [accel-pppd:6643]
[  452.080015] CPU 2
[  452.080015]
[  452.080015] Pid: 6643, comm: accel-pppd Not tainted 3.2.46.mini #1 Bochs Bochs
[  452.080015] RIP: 0010:[&lt;ffffffff81059f6c&gt;]  [&lt;ffffffff81059f6c&gt;] do_raw_spin_lock+0x17/0x1f
[  452.080015] RSP: 0018:ffff88007125fc18  EFLAGS: 00000293
[  452.080015] RAX: 000000000000aba9 RBX: ffffffff811d0703 RCX: 0000000000000000
[  452.080015] RDX: 00000000000000ab RSI: ffff8800711f6896 RDI: ffff8800745c8110
[  452.080015] RBP: ffff88007125fc18 R08: 0000000000000020 R09: 0000000000000000
[  452.080015] R10: 0000000000000000 R11: 0000000000000280 R12: 0000000000000286
[  452.080015] R13: 0000000000000020 R14: 0000000000000240 R15: 0000000000000000
[  452.080015] FS:  00007fdc0cc24700(0000) GS:ffff8800b6f00000(0000) knlGS:0000000000000000
[  452.080015] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[  452.080015] CR2: 00007fdb054899b8 CR3: 0000000074404000 CR4: 00000000000006a0
[  452.080015] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
[  452.080015] DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
[  452.080015] Process accel-pppd (pid: 6643, threadinfo ffff88007125e000, task ffff8800b27e6dd0)
[  452.080015] Stack:
[  452.080015]  ffff88007125fc28 ffffffff81256559 ffff88007125fc98 ffffffffa01b2bd1
[  452.080015]  ffff88007125fc58 000000000000000c 00000000029490d0 0000009c71dbe25e
[  452.080015]  000000000000005c 000000080000000e 0000000000000000 ffff880071170600
[  452.080015] Call Trace:
[  452.080015]  [&lt;ffffffff81256559&gt;] _raw_spin_lock+0xe/0x10
[  452.080015]  [&lt;ffffffffa01b2bd1&gt;] l2tp_xmit_skb+0x189/0x4ac [l2tp_core]
[  452.080015]  [&lt;ffffffffa01c2d36&gt;] pppol2tp_sendmsg+0x15e/0x19c [l2tp_ppp]
[  452.080015]  [&lt;ffffffff811c7872&gt;] __sock_sendmsg_nosec+0x22/0x24
[  452.080015]  [&lt;ffffffff811c83bd&gt;] sock_sendmsg+0xa1/0xb6
[  452.080015]  [&lt;ffffffff81254e88&gt;] ? __schedule+0x5c1/0x616
[  452.080015]  [&lt;ffffffff8103c7c6&gt;] ? __dequeue_signal+0xb7/0x10c
[  452.080015]  [&lt;ffffffff810bbd21&gt;] ? fget_light+0x75/0x89
[  452.080015]  [&lt;ffffffff811c8444&gt;] ? sockfd_lookup_light+0x20/0x56
[  452.080015]  [&lt;ffffffff811c9b34&gt;] sys_sendto+0x10c/0x13b
[  452.080015]  [&lt;ffffffff8125cac2&gt;] system_call_fastpath+0x16/0x1b
[  452.080015] Code: 81 48 89 e5 72 0c 31 c0 48 81 ff 45 66 25 81 0f 92 c0 5d c3 55 b8 00 01 00 00 48 89 e5 f0 66 0f c1 07 0f b6 d4 38 d0 74 06 f3 90 &lt;8a&gt; 07 eb f6 5d c3 90 90 55 48 89 e5 9c 58 0f 1f 44 00 00 5d c3
[  452.080015] Call Trace:
[  452.080015]  [&lt;ffffffff81256559&gt;] _raw_spin_lock+0xe/0x10
[  452.080015]  [&lt;ffffffffa01b2bd1&gt;] l2tp_xmit_skb+0x189/0x4ac [l2tp_core]
[  452.080015]  [&lt;ffffffffa01c2d36&gt;] pppol2tp_sendmsg+0x15e/0x19c [l2tp_ppp]
[  452.080015]  [&lt;ffffffff811c7872&gt;] __sock_sendmsg_nosec+0x22/0x24
[  452.080015]  [&lt;ffffffff811c83bd&gt;] sock_sendmsg+0xa1/0xb6
[  452.080015]  [&lt;ffffffff81254e88&gt;] ? __schedule+0x5c1/0x616
[  452.080015]  [&lt;ffffffff8103c7c6&gt;] ? __dequeue_signal+0xb7/0x10c
[  452.080015]  [&lt;ffffffff810bbd21&gt;] ? fget_light+0x75/0x89
[  452.080015]  [&lt;ffffffff811c8444&gt;] ? sockfd_lookup_light+0x20/0x56
[  452.080015]  [&lt;ffffffff811c9b34&gt;] sys_sendto+0x10c/0x13b
[  452.080015]  [&lt;ffffffff8125cac2&gt;] system_call_fastpath+0x16/0x1b
[  452.064012]
[  452.064012] Pid: 6662, comm: accel-pppd Not tainted 3.2.46.mini #1 Bochs Bochs
[  452.064012] RIP: 0010:[&lt;ffffffff81059f6e&gt;]  [&lt;ffffffff81059f6e&gt;] do_raw_spin_lock+0x19/0x1f
[  452.064012] RSP: 0018:ffff8800b6e83ba0  EFLAGS: 00000297
[  452.064012] RAX: 000000000000aaa9 RBX: ffff8800b6e83b40 RCX: 0000000000000002
[  452.064012] RDX: 00000000000000aa RSI: 000000000000000a RDI: ffff8800745c8110
[  452.064012] RBP: ffff8800b6e83ba0 R08: 000000000000c802 R09: 000000000000001c
[  452.064012] R10: ffff880071096c4e R11: 0000000000000006 R12: ffff8800b6e83b18
[  452.064012] R13: ffffffff8125d51e R14: ffff8800b6e83ba0 R15: ffff880072a589c0
[  452.064012] FS:  00007fdc0b81e700(0000) GS:ffff8800b6e80000(0000) knlGS:0000000000000000
[  452.064012] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[  452.064012] CR2: 0000000000625208 CR3: 0000000074404000 CR4: 00000000000006a0
[  452.064012] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
[  452.064012] DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
[  452.064012] Process accel-pppd (pid: 6662, threadinfo ffff88007129a000, task ffff8800744f7410)
[  452.064012] Stack:
[  452.064012]  ffff8800b6e83bb0 ffffffff81256559 ffff8800b6e83bc0 ffffffff8121c64a
[  452.064012]  ffff8800b6e83bf0 ffffffff8121ec7a ffff880072a589c0 ffff880071096c62
[  452.064012]  0000000000000011 ffffffff81430024 ffff8800b6e83c80 ffffffff8121f276
[  452.064012] Call Trace:
[  452.064012]  &lt;IRQ&gt;
[  452.064012]  [&lt;ffffffff81256559&gt;] _raw_spin_lock+0xe/0x10
[  452.064012]  [&lt;ffffffff8121c64a&gt;] spin_lock+0x9/0xb
[  452.064012]  [&lt;ffffffff8121ec7a&gt;] udp_queue_rcv_skb+0x186/0x269
[  452.064012]  [&lt;ffffffff8121f276&gt;] __udp4_lib_rcv+0x297/0x4ae
[  452.064012]  [&lt;ffffffff8121c178&gt;] ? raw_rcv+0xe9/0xf0
[  452.064012]  [&lt;ffffffff8121f4a7&gt;] udp_rcv+0x1a/0x1c
[  452.064012]  [&lt;ffffffff811fe385&gt;] ip_local_deliver_finish+0x12b/0x1a5
[  452.064012]  [&lt;ffffffff811fe54e&gt;] ip_local_deliver+0x53/0x84
[  452.064012]  [&lt;ffffffff811fe1d0&gt;] ip_rcv_finish+0x2bc/0x2f3
[  452.064012]  [&lt;ffffffff811fe78f&gt;] ip_rcv+0x210/0x269
[  452.064012]  [&lt;ffffffff8101911e&gt;] ? kvm_clock_get_cycles+0x9/0xb
[  452.064012]  [&lt;ffffffff811d88cd&gt;] __netif_receive_skb+0x3a5/0x3f7
[  452.064012]  [&lt;ffffffff811d8eba&gt;] netif_receive_skb+0x57/0x5e
[  452.064012]  [&lt;ffffffff811cf30f&gt;] ? __netdev_alloc_skb+0x1f/0x3b
[  452.064012]  [&lt;ffffffffa0049126&gt;] virtnet_poll+0x4ba/0x5a4 [virtio_net]
[  452.064012]  [&lt;ffffffff811d9417&gt;] net_rx_action+0x73/0x184
[  452.064012]  [&lt;ffffffffa01b2cc2&gt;] ? l2tp_xmit_skb+0x27a/0x4ac [l2tp_core]
[  452.064012]  [&lt;ffffffff810343b9&gt;] __do_softirq+0xc3/0x1a8
[  452.064012]  [&lt;ffffffff81013b56&gt;] ? ack_APIC_irq+0x10/0x12
[  452.064012]  [&lt;ffffffff81256559&gt;] ? _raw_spin_lock+0xe/0x10
[  452.064012]  [&lt;ffffffff8125e0ac&gt;] call_softirq+0x1c/0x26
[  452.064012]  [&lt;ffffffff81003587&gt;] do_softirq+0x45/0x82
[  452.064012]  [&lt;ffffffff81034667&gt;] irq_exit+0x42/0x9c
[  452.064012]  [&lt;ffffffff8125e146&gt;] do_IRQ+0x8e/0xa5
[  452.064012]  [&lt;ffffffff8125676e&gt;] common_interrupt+0x6e/0x6e
[  452.064012]  &lt;EOI&gt;
[  452.064012]  [&lt;ffffffff810b82a1&gt;] ? kfree+0x8a/0xa3
[  452.064012]  [&lt;ffffffffa01b2cc2&gt;] ? l2tp_xmit_skb+0x27a/0x4ac [l2tp_core]
[  452.064012]  [&lt;ffffffffa01b2c25&gt;] ? l2tp_xmit_skb+0x1dd/0x4ac [l2tp_core]
[  452.064012]  [&lt;ffffffffa01c2d36&gt;] pppol2tp_sendmsg+0x15e/0x19c [l2tp_ppp]
[  452.064012]  [&lt;ffffffff811c7872&gt;] __sock_sendmsg_nosec+0x22/0x24
[  452.064012]  [&lt;ffffffff811c83bd&gt;] sock_sendmsg+0xa1/0xb6
[  452.064012]  [&lt;ffffffff81254e88&gt;] ? __schedule+0x5c1/0x616
[  452.064012]  [&lt;ffffffff8103c7c6&gt;] ? __dequeue_signal+0xb7/0x10c
[  452.064012]  [&lt;ffffffff810bbd21&gt;] ? fget_light+0x75/0x89
[  452.064012]  [&lt;ffffffff811c8444&gt;] ? sockfd_lookup_light+0x20/0x56
[  452.064012]  [&lt;ffffffff811c9b34&gt;] sys_sendto+0x10c/0x13b
[  452.064012]  [&lt;ffffffff8125cac2&gt;] system_call_fastpath+0x16/0x1b
[  452.064012] Code: 89 e5 72 0c 31 c0 48 81 ff 45 66 25 81 0f 92 c0 5d c3 55 b8 00 01 00 00 48 89 e5 f0 66 0f c1 07 0f b6 d4 38 d0 74 06 f3 90 8a 07 &lt;eb&gt; f6 5d c3 90 90 55 48 89 e5 9c 58 0f 1f 44 00 00 5d c3 55 48
[  452.064012] Call Trace:
[  452.064012]  &lt;IRQ&gt;  [&lt;ffffffff81256559&gt;] _raw_spin_lock+0xe/0x10
[  452.064012]  [&lt;ffffffff8121c64a&gt;] spin_lock+0x9/0xb
[  452.064012]  [&lt;ffffffff8121ec7a&gt;] udp_queue_rcv_skb+0x186/0x269
[  452.064012]  [&lt;ffffffff8121f276&gt;] __udp4_lib_rcv+0x297/0x4ae
[  452.064012]  [&lt;ffffffff8121c178&gt;] ? raw_rcv+0xe9/0xf0
[  452.064012]  [&lt;ffffffff8121f4a7&gt;] udp_rcv+0x1a/0x1c
[  452.064012]  [&lt;ffffffff811fe385&gt;] ip_local_deliver_finish+0x12b/0x1a5
[  452.064012]  [&lt;ffffffff811fe54e&gt;] ip_local_deliver+0x53/0x84
[  452.064012]  [&lt;ffffffff811fe1d0&gt;] ip_rcv_finish+0x2bc/0x2f3
[  452.064012]  [&lt;ffffffff811fe78f&gt;] ip_rcv+0x210/0x269
[  452.064012]  [&lt;ffffffff8101911e&gt;] ? kvm_clock_get_cycles+0x9/0xb
[  452.064012]  [&lt;ffffffff811d88cd&gt;] __netif_receive_skb+0x3a5/0x3f7
[  452.064012]  [&lt;ffffffff811d8eba&gt;] netif_receive_skb+0x57/0x5e
[  452.064012]  [&lt;ffffffff811cf30f&gt;] ? __netdev_alloc_skb+0x1f/0x3b
[  452.064012]  [&lt;ffffffffa0049126&gt;] virtnet_poll+0x4ba/0x5a4 [virtio_net]
[  452.064012]  [&lt;ffffffff811d9417&gt;] net_rx_action+0x73/0x184
[  452.064012]  [&lt;ffffffffa01b2cc2&gt;] ? l2tp_xmit_skb+0x27a/0x4ac [l2tp_core]
[  452.064012]  [&lt;ffffffff810343b9&gt;] __do_softirq+0xc3/0x1a8
[  452.064012]  [&lt;ffffffff81013b56&gt;] ? ack_APIC_irq+0x10/0x12
[  452.064012]  [&lt;ffffffff81256559&gt;] ? _raw_spin_lock+0xe/0x10
[  452.064012]  [&lt;ffffffff8125e0ac&gt;] call_softirq+0x1c/0x26
[  452.064012]  [&lt;ffffffff81003587&gt;] do_softirq+0x45/0x82
[  452.064012]  [&lt;ffffffff81034667&gt;] irq_exit+0x42/0x9c
[  452.064012]  [&lt;ffffffff8125e146&gt;] do_IRQ+0x8e/0xa5
[  452.064012]  [&lt;ffffffff8125676e&gt;] common_interrupt+0x6e/0x6e
[  452.064012]  &lt;EOI&gt;  [&lt;ffffffff810b82a1&gt;] ? kfree+0x8a/0xa3
[  452.064012]  [&lt;ffffffffa01b2cc2&gt;] ? l2tp_xmit_skb+0x27a/0x4ac [l2tp_core]
[  452.064012]  [&lt;ffffffffa01b2c25&gt;] ? l2tp_xmit_skb+0x1dd/0x4ac [l2tp_core]
[  452.064012]  [&lt;ffffffffa01c2d36&gt;] pppol2tp_sendmsg+0x15e/0x19c [l2tp_ppp]
[  452.064012]  [&lt;ffffffff811c7872&gt;] __sock_sendmsg_nosec+0x22/0x24
[  452.064012]  [&lt;ffffffff811c83bd&gt;] sock_sendmsg+0xa1/0xb6
[  452.064012]  [&lt;ffffffff81254e88&gt;] ? __schedule+0x5c1/0x616
[  452.064012]  [&lt;ffffffff8103c7c6&gt;] ? __dequeue_signal+0xb7/0x10c
[  452.064012]  [&lt;ffffffff810bbd21&gt;] ? fget_light+0x75/0x89
[  452.064012]  [&lt;ffffffff811c8444&gt;] ? sockfd_lookup_light+0x20/0x56
[  452.064012]  [&lt;ffffffff811c9b34&gt;] sys_sendto+0x10c/0x13b
[  452.064012]  [&lt;ffffffff8125cac2&gt;] system_call_fastpath+0x16/0x1b

Reported-by: François Cachereul &lt;f.cachereul@alphalink.fr&gt;
Tested-by: François Cachereul &lt;f.cachereul@alphalink.fr&gt;
Signed-off-by: Eric Dumazet &lt;edumazet@google.com&gt;
Cc: James Chapman &lt;jchapman@katalix.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
Signed-off-by: Ben Hutchings &lt;ben@decadent.org.uk&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>l2tp: add missing .owner to struct pppox_proto</title>
<updated>2013-08-02T20:14:47+00:00</updated>
<author>
<name>Wei Yongjun</name>
<email>yongjun_wei@trendmicro.com.cn</email>
</author>
<published>2013-07-02T01:02:07+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=0c0f762a5bf9aa3839311d99e04a3668c97e675e'/>
<id>0c0f762a5bf9aa3839311d99e04a3668c97e675e</id>
<content type='text'>
[ Upstream commit e1558a93b61962710733dc8c11a2bc765607f1cd ]

Add missing .owner of struct pppox_proto. This prevents the
module from being removed from underneath its users.

Signed-off-by: Wei Yongjun &lt;yongjun_wei@trendmicro.com.cn&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
Signed-off-by: Ben Hutchings &lt;ben@decadent.org.uk&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
[ Upstream commit e1558a93b61962710733dc8c11a2bc765607f1cd ]

Add missing .owner of struct pppox_proto. This prevents the
module from being removed from underneath its users.

Signed-off-by: Wei Yongjun &lt;yongjun_wei@trendmicro.com.cn&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
Signed-off-by: Ben Hutchings &lt;ben@decadent.org.uk&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>l2tp: Fix sendmsg() return value</title>
<updated>2013-06-29T03:06:43+00:00</updated>
<author>
<name>Guillaume Nault</name>
<email>g.nault@alphalink.fr</email>
</author>
<published>2013-06-12T14:07:36+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=46a000571be614e1b69eaacfc28e79e94393f1d5'/>
<id>46a000571be614e1b69eaacfc28e79e94393f1d5</id>
<content type='text'>
[ Upstream commit a6f79d0f26704214b5b702bbac525cb72997f984 ]

PPPoL2TP sockets should comply with the standard send*() return values
(i.e. return number of bytes sent instead of 0 upon success).

Signed-off-by: Guillaume Nault &lt;g.nault@alphalink.fr&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
Signed-off-by: Ben Hutchings &lt;ben@decadent.org.uk&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
[ Upstream commit a6f79d0f26704214b5b702bbac525cb72997f984 ]

PPPoL2TP sockets should comply with the standard send*() return values
(i.e. return number of bytes sent instead of 0 upon success).

Signed-off-by: Guillaume Nault &lt;g.nault@alphalink.fr&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
Signed-off-by: Ben Hutchings &lt;ben@decadent.org.uk&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>l2tp: Fix PPP header erasure and memory leak</title>
<updated>2013-06-29T03:06:43+00:00</updated>
<author>
<name>Guillaume Nault</name>
<email>g.nault@alphalink.fr</email>
</author>
<published>2013-06-12T14:07:23+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=480efdbc973db5797f68c3002432427893e78458'/>
<id>480efdbc973db5797f68c3002432427893e78458</id>
<content type='text'>
[ Upstream commit 55b92b7a11690bc377b5d373872a6b650ae88e64 ]

Copy user data after PPP framing header. This prevents erasure of the
added PPP header and avoids leaking two bytes of uninitialised memory
at the end of skb's data buffer.

Signed-off-by: Guillaume Nault &lt;g.nault@alphalink.fr&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
Signed-off-by: Ben Hutchings &lt;ben@decadent.org.uk&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
[ Upstream commit 55b92b7a11690bc377b5d373872a6b650ae88e64 ]

Copy user data after PPP framing header. This prevents erasure of the
added PPP header and avoids leaking two bytes of uninitialised memory
at the end of skb's data buffer.

Signed-off-by: Guillaume Nault &lt;g.nault@alphalink.fr&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
Signed-off-by: Ben Hutchings &lt;ben@decadent.org.uk&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>l2tp: Restore socket refcount when sendmsg succeeds</title>
<updated>2013-03-27T02:40:55+00:00</updated>
<author>
<name>Guillaume Nault</name>
<email>g.nault@alphalink.fr</email>
</author>
<published>2013-03-01T05:02:02+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=ba5c1a589629f7873fffef9d16ea9ac7614e49e9'/>
<id>ba5c1a589629f7873fffef9d16ea9ac7614e49e9</id>
<content type='text'>
[ Upstream commit 8b82547e33e85fc24d4d172a93c796de1fefa81a ]

The sendmsg() syscall handler for PPPoL2TP doesn't decrease the socket
reference counter after successful transmissions. Any successful
sendmsg() call from userspace will then increase the reference counter
forever, thus preventing the kernel's session and tunnel data from
being freed later on.

The problem only happens when writing directly on L2TP sockets.
PPP sockets attached to L2TP are unaffected as the PPP subsystem
uses pppol2tp_xmit() which symmetrically increase/decrease reference
counters.

This patch adds the missing call to sock_put() before returning from
pppol2tp_sendmsg().

Signed-off-by: Guillaume Nault &lt;g.nault@alphalink.fr&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
Signed-off-by: Ben Hutchings &lt;ben@decadent.org.uk&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
[ Upstream commit 8b82547e33e85fc24d4d172a93c796de1fefa81a ]

The sendmsg() syscall handler for PPPoL2TP doesn't decrease the socket
reference counter after successful transmissions. Any successful
sendmsg() call from userspace will then increase the reference counter
forever, thus preventing the kernel's session and tunnel data from
being freed later on.

The problem only happens when writing directly on L2TP sockets.
PPP sockets attached to L2TP are unaffected as the PPP subsystem
uses pppol2tp_xmit() which symmetrically increase/decrease reference
counters.

This patch adds the missing call to sock_put() before returning from
pppol2tp_sendmsg().

Signed-off-by: Guillaume Nault &lt;g.nault@alphalink.fr&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
Signed-off-by: Ben Hutchings &lt;ben@decadent.org.uk&gt;
</pre>
</div>
</content>
</entry>
</feed>
