Skip to content

Commit 1c73213

Browse files
committed
selinux: fix a sock regression in selinux_ip_postroute_compat()
Unfortunately we can't rely on nf_hook_state->sk being the proper originating socket so revert to using skb_to_full_sk(skb). Fixes: 1d1e1de ("selinux: make better use of the nf_hook_state passed to the NF hooks") Reported-by: Linux Kernel Functional Testing <lkft@linaro.org> Suggested-by: Florian Westphal <fw@strlen.de> Signed-off-by: Paul Moore <paul@paul-moore.com>
1 parent 4d5b553 commit 1c73213

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

security/selinux/hooks.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5778,9 +5778,9 @@ static unsigned int selinux_ip_postroute_compat(struct sk_buff *skb,
57785778
struct lsm_network_audit net = {0,};
57795779
u8 proto;
57805780

5781-
if (state->sk == NULL)
5782-
return NF_ACCEPT;
57835781
sk = skb_to_full_sk(skb);
5782+
if (sk == NULL)
5783+
return NF_ACCEPT;
57845784
sksec = sk->sk_security;
57855785

57865786
ad.type = LSM_AUDIT_DATA_NET;

0 commit comments

Comments
 (0)