Skip to content
This repository was archived by the owner on Nov 8, 2023. It is now read-only.

Commit 42b5a01

Browse files
committed
Merge tag 'Smack-for-6.10' of https://github.com/cschaufler/smack-next
Pull smack updates from Casey Schaufler: "Two fixes for Smack networking labeling by Konstantin Andreev" * tag 'Smack-for-6.10' of https://github.com/cschaufler/smack-next: smack: unix sockets: fix accept()ed socket label smack: tcp: ipv4, fix incorrect labeling
2 parents 11ab4cd + e86cac0 commit 42b5a01

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

security/smack/smack_lsm.c

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3871,12 +3871,18 @@ static int smack_unix_stream_connect(struct sock *sock,
38713871
}
38723872
}
38733873

3874-
/*
3875-
* Cross reference the peer labels for SO_PEERSEC.
3876-
*/
38773874
if (rc == 0) {
3875+
/*
3876+
* Cross reference the peer labels for SO_PEERSEC.
3877+
*/
38783878
nsp->smk_packet = ssp->smk_out;
38793879
ssp->smk_packet = osp->smk_out;
3880+
3881+
/*
3882+
* new/child/established socket must inherit listening socket labels
3883+
*/
3884+
nsp->smk_out = osp->smk_out;
3885+
nsp->smk_in = osp->smk_in;
38803886
}
38813887

38823888
return rc;
@@ -4456,7 +4462,7 @@ static int smack_inet_conn_request(const struct sock *sk, struct sk_buff *skb,
44564462
rcu_read_unlock();
44574463

44584464
if (hskp == NULL)
4459-
rc = netlbl_req_setattr(req, &skp->smk_netlabel);
4465+
rc = netlbl_req_setattr(req, &ssp->smk_out->smk_netlabel);
44604466
else
44614467
netlbl_req_delattr(req);
44624468

0 commit comments

Comments
 (0)