]> git.baikalelectronics.ru Git - kernel.git/commit
udp: preserve head state for IP_CMSG_PASSSEC
authorPaolo Abeni <pabeni@redhat.com>
Tue, 25 Jul 2017 15:57:47 +0000 (17:57 +0200)
committerDavid S. Miller <davem@davemloft.net>
Tue, 25 Jul 2017 17:00:58 +0000 (10:00 -0700)
commit106e23b12bf6aef83eea3691a5975d479d66e995
tree37ebe575b7c880828a938de778803ddf3f943d7d
parent53b00c39f103475c321f5d080930156393122ec7
udp: preserve head state for IP_CMSG_PASSSEC

Paul Moore reported a SELinux/IP_PASSSEC regression
caused by missing skb->sp at recvmsg() time. We need to
preserve the skb head state to process the IP_CMSG_PASSSEC
cmsg.

With this commit we avoid releasing the skb head state in the
BH even if a secpath is attached to the current skb, and stores
the skb status (with/without head states) in the scratch area,
so that we can access it at skb deallocation time, without
incurring in cache-miss penalties.

This also avoids misusing the skb CB for ipv6 packets,
as introduced by the commit ff4607634f5c ("udp: preserve
skb->dst if required for IP options processing").

Clean a bit the scratch area helpers implementation, to
reduce the code differences between 32 and 64 bits build.

Reported-by: Paul Moore <paul@paul-moore.com>
Fixes: 255370ee4ad1 ("udp: avoid a cache miss on dequeue")
Fixes: ff4607634f5c ("udp: preserve skb->dst if required for IP options processing")
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Tested-by: Paul Moore <paul@paul-moore.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/net/udp.h
net/ipv4/udp.c