summaryrefslogtreecommitdiff
path: root/net/packet/diag.c
diff options
context:
space:
mode:
authorEric Dumazet <edumazet@google.com>2023-03-16 01:10:07 +0000
committerDavid S. Miller <davem@davemloft.net>2023-03-17 08:52:05 +0000
commitee5675ecdf7a4e713ed21d98a70c2871d6ebed01 (patch)
treebe50e68015ab84229d2f3cd223e352be1df2bb2f /net/packet/diag.c
parentb9d83ab8a708f23a4001d60e9d8d0b3be3d9f607 (diff)
net/packet: convert po->origdev to an atomic flag
syzbot/KCAN reported that po->origdev can be read while another thread is changing its value. We can avoid this splat by converting this field to an actual bit. Following patches will convert remaining 1bit fields. Fixes: 80feaacb8a64 ("[AF_PACKET]: Add option to return orig_dev to userspace.") Signed-off-by: Eric Dumazet <edumazet@google.com> Reported-by: syzbot <syzkaller@googlegroups.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/packet/diag.c')
-rw-r--r--net/packet/diag.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/net/packet/diag.c b/net/packet/diag.c
index 07812ae5ca07..e1ac9bb375b3 100644
--- a/net/packet/diag.c
+++ b/net/packet/diag.c
@@ -25,7 +25,7 @@ static int pdiag_put_info(const struct packet_sock *po, struct sk_buff *nlskb)
pinfo.pdi_flags |= PDI_RUNNING;
if (po->auxdata)
pinfo.pdi_flags |= PDI_AUXDATA;
- if (po->origdev)
+ if (packet_sock_flag(po, PACKET_SOCK_ORIGDEV))
pinfo.pdi_flags |= PDI_ORIGDEV;
if (po->has_vnet_hdr)
pinfo.pdi_flags |= PDI_VNETHDR;