]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
netrom: Fix a data-race around sysctl_netrom_routing_control
authorJason Xing <kernelxing@tencent.com>
Mon, 4 Mar 2024 08:20:44 +0000 (16:20 +0800)
committerPaolo Abeni <pabeni@redhat.com>
Thu, 7 Mar 2024 09:36:58 +0000 (10:36 +0100)
We need to protect the reader reading the sysctl value because the
value can be changed concurrently.

Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Signed-off-by: Jason Xing <kernelxing@tencent.com>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
net/netrom/nr_route.c

index b8ddd8048f352c4bad595b58d820d283b535f90b..89e12e6eea2efd92ed345ccb7f630f11687a964f 100644 (file)
@@ -780,7 +780,7 @@ int nr_route_frame(struct sk_buff *skb, ax25_cb *ax25)
                return ret;
        }
 
-       if (!sysctl_netrom_routing_control && ax25 != NULL)
+       if (!READ_ONCE(sysctl_netrom_routing_control) && ax25 != NULL)
                return 0;
 
        /* Its Time-To-Live has expired */