dccp: Call security_inet_conn_request() after setting IPv4 addresses.
[ Upstream commit fa2df45af13091f76b89adb84a28f13818d5d631 ] Initially, commit4237c75c0a
("[MLSXFRM]: Auto-labeling of child sockets") introduced security_inet_conn_request() in some functions where reqsk is allocated. The hook is added just after the allocation, so reqsk's IPv4 remote address was not initialised then. However, SELinux/Smack started to read it in netlbl_req_setattr() after the cited commits. This bug was partially fixed by commit284904aa79
("lsm: Relocate the IPv4 security_inet_conn_request() hooks"). This patch fixes the last bug in DCCPv4. Fixes:389fb800ac
("netlabel: Label incoming TCP connections correctly in SELinux") Fixes:07feee8f81
("netlabel: Cleanup the Smack/NetLabel code to fix incoming TCP connections") Signed-off-by: Kuniyuki Iwashima <kuniyu@amazon.com> Acked-by: Paul Moore <paul@paul-moore.com> Signed-off-by: Paolo Abeni <pabeni@redhat.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
afa49774d8
commit
3af0af2f98
@ -611,9 +611,6 @@ int dccp_v4_conn_request(struct sock *sk, struct sk_buff *skb)
|
|||||||
if (dccp_parse_options(sk, dreq, skb))
|
if (dccp_parse_options(sk, dreq, skb))
|
||||||
goto drop_and_free;
|
goto drop_and_free;
|
||||||
|
|
||||||
if (security_inet_conn_request(sk, skb, req))
|
|
||||||
goto drop_and_free;
|
|
||||||
|
|
||||||
ireq = inet_rsk(req);
|
ireq = inet_rsk(req);
|
||||||
sk_rcv_saddr_set(req_to_sk(req), ip_hdr(skb)->daddr);
|
sk_rcv_saddr_set(req_to_sk(req), ip_hdr(skb)->daddr);
|
||||||
sk_daddr_set(req_to_sk(req), ip_hdr(skb)->saddr);
|
sk_daddr_set(req_to_sk(req), ip_hdr(skb)->saddr);
|
||||||
@ -621,6 +618,9 @@ int dccp_v4_conn_request(struct sock *sk, struct sk_buff *skb)
|
|||||||
ireq->ireq_family = AF_INET;
|
ireq->ireq_family = AF_INET;
|
||||||
ireq->ir_iif = sk->sk_bound_dev_if;
|
ireq->ir_iif = sk->sk_bound_dev_if;
|
||||||
|
|
||||||
|
if (security_inet_conn_request(sk, skb, req))
|
||||||
|
goto drop_and_free;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Step 3: Process LISTEN state
|
* Step 3: Process LISTEN state
|
||||||
*
|
*
|
||||||
|
Loading…
Reference in New Issue
Block a user