hc
2024-12-19 9370bb92b2d16684ee45cf24e879c93c509162da
kernel/net/packet/diag.c
....@@ -1,3 +1,4 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 #include <linux/module.h>
23 #include <linux/sock_diag.h>
34 #include <linux/net.h>
....@@ -22,9 +23,9 @@
2223 pinfo.pdi_flags = 0;
2324 if (po->running)
2425 pinfo.pdi_flags |= PDI_RUNNING;
25
- if (po->auxdata)
26
+ if (packet_sock_flag(po, PACKET_SOCK_AUXDATA))
2627 pinfo.pdi_flags |= PDI_AUXDATA;
27
- if (po->origdev)
28
+ if (packet_sock_flag(po, PACKET_SOCK_ORIGDEV))
2829 pinfo.pdi_flags |= PDI_ORIGDEV;
2930 if (po->has_vnet_hdr)
3031 pinfo.pdi_flags |= PDI_VNETHDR;
....@@ -39,7 +40,7 @@
3940 struct nlattr *mca;
4041 struct packet_mclist *ml;
4142
42
- mca = nla_nest_start(nlskb, PACKET_DIAG_MCLIST);
43
+ mca = nla_nest_start_noflag(nlskb, PACKET_DIAG_MCLIST);
4344 if (!mca)
4445 return -EMSGSIZE;
4546
....@@ -142,7 +143,7 @@
142143 rp = nlmsg_data(nlh);
143144 rp->pdiag_family = AF_PACKET;
144145 rp->pdiag_type = sk->sk_type;
145
- rp->pdiag_num = ntohs(po->num);
146
+ rp->pdiag_num = ntohs(READ_ONCE(po->num));
146147 rp->pdiag_ino = sk_ino;
147148 sock_diag_save_cookie(sk, rp->pdiag_cookie);
148149