Files
linux/Documentation
Daniel Borkmann c3ac8a1343 packet: fix send path when running with proto == 0
[ Upstream commit 66e56cd46b ]

Commit e40526cb20 introduced a cached dev pointer, that gets
hooked into register_prot_hook(), __unregister_prot_hook() to
update the device used for the send path.

We need to fix this up, as otherwise this will not work with
sockets created with protocol = 0, plus with sll_protocol = 0
passed via sockaddr_ll when doing the bind.

So instead, assign the pointer directly. The compiler can inline
these helper functions automagically.

While at it, also assume the cached dev fast-path as likely(),
and document this variant of socket creation as it seems it is
not widely used (seems not even the author of TX_RING was aware
of that in his reference example [1]). Tested with reproducer
from e40526cb20.

 [1] http://wiki.ipxwarzone.com/index.php5?title=Linux_packet_mmap#Example

Fixes: e40526cb20 ("packet: fix use after free race in send path when dev is released")
Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
Tested-by: Salam Noureddine <noureddine@aristanetworks.com>
Tested-by: Jesper Dangaard Brouer <brouer@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-01-15 15:28:46 -08:00
..
2011-09-27 18:08:04 +02:00
2010-02-24 13:51:32 +01:00
2012-04-03 13:09:18 +02:00
2012-10-08 13:50:12 +10:30
2011-09-27 18:08:04 +02:00
2012-12-14 08:48:59 +01:00
2013-07-25 14:07:28 -07:00
2013-04-02 09:39:55 -07:00
2013-03-02 20:09:50 +00:00
2011-03-31 11:26:23 -03:00
2013-01-10 01:27:46 +01:00
2013-04-27 16:41:43 -07:00
2010-04-08 11:34:34 +02:00
2011-03-31 11:26:23 -03:00
2012-07-29 21:11:05 -03:00
2013-04-16 18:47:19 +09:00
2012-12-10 15:54:27 +01:00
2012-12-05 23:52:10 +00:00
2011-03-31 11:26:23 -03:00
2011-09-27 18:08:04 +02:00
2013-02-19 08:42:37 +01:00
2013-04-24 11:42:42 +10:00
2012-02-28 16:05:06 +01:00
2011-09-27 18:08:04 +02:00
2011-03-31 11:26:23 -03:00
2010-03-16 11:47:56 +01:00
2012-01-02 13:04:55 +01:00