]> git.baikalelectronics.ru Git - kernel.git/commit
selinux: fix random read in selinux_ip_postroute_compat()
authorEric Dumazet <edumazet@google.com>
Thu, 5 Nov 2015 21:39:24 +0000 (13:39 -0800)
committerDavid S. Miller <davem@davemloft.net>
Thu, 5 Nov 2015 21:45:51 +0000 (16:45 -0500)
commit99f286380146fe7221c0f16e0eb36823d9bca84e
treec4f9be4c046587df4fad72299a5888096153f4c9
parentf0cf7a23d045c29a3acf6f9f6db635fbdc75730e
selinux: fix random read in selinux_ip_postroute_compat()

In commit 2aeab73fa7a2 ("net: synack packets can be attached to request
sockets"), I missed one remaining case of invalid skb->sk->sk_security
access.

Dmitry Vyukov got a KASan report pointing to it.

Add selinux_skb_sk() helper that is responsible to get back to the
listener if skb is attached to a request socket, instead of
duplicating the logic.

Fixes: 9ac0bfc1a9dd ("tcp: attach SYNACK messages to request sockets instead of listener")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Reported-by: Dmitry Vyukov <dvyukov@google.com>
Cc: Paul Moore <paul@paul-moore.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
security/selinux/hooks.c