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
Unified · Split
| @@ -3871,12 +3871,18 @@ static int smack_unix_stream_connect(struct sock *sock, · 3870 unmodified lines | ||
| 3871 | 3871 | } |
| 3872 | 3872 | } |
| 3873 | 3873 | |
| 3874 | − /* | |
| 3875 | − * Cross reference the peer labels for SO_PEERSEC. | |
| 3876 | − */ | |
| 3877 | 3874 | if (rc == 0) { |
| 3875 | + /* | |
| 3876 | + * Cross reference the peer labels for SO_PEERSEC. | |
| 3877 | + */ | |
| 3878 | 3878 | nsp->smk_packet = ssp->smk_out; |
| 3879 | 3879 | 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; | |
| 3880 | 3886 | } |
| 3881 | 3887 | |
| 3882 | 3888 | return rc; |
| @@ -4456,7 +4462,7 @@ static int smack_inet_conn_request(const struct sock *sk, struct sk_buff *skb, · 573 unmodified lines | ||
| 4456 | 4462 | rcu_read_unlock(); |
| 4457 | 4463 | |
| 4458 | 4464 | if (hskp == NULL) |
| 4459 | − rc = netlbl_req_setattr(req, &skp->smk_netlabel); | |
| 4465 | + rc = netlbl_req_setattr(req, &ssp->smk_out->smk_netlabel); | |
| 4460 | 4466 | else |
| 4461 | 4467 | netlbl_req_delattr(req); |
| 4462 | 4468 | |