Commit 1c73213b authored by Paul Moore's avatar Paul Moore
Browse files

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: 1d1e1ded ("selinux: make better use of the nf_hook_state passed to the NF hooks")
Reported-by: default avatarLinux Kernel Functional Testing <lkft@linaro.org>
Suggested-by: default avatarFlorian Westphal <fw@strlen.de>
Signed-off-by: default avatarPaul Moore <paul@paul-moore.com>
parent 4d5b5539
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -5778,9 +5778,9 @@ static unsigned int selinux_ip_postroute_compat(struct sk_buff *skb,
	struct lsm_network_audit net = {0,};
	u8 proto;

	if (state->sk == NULL)
		return NF_ACCEPT;
	sk = skb_to_full_sk(skb);
	if (sk == NULL)
		return NF_ACCEPT;
	sksec = sk->sk_security;

	ad.type = LSM_AUDIT_DATA_NET;