mirror of
https://github.com/torvalds/linux.git
synced 2024-11-21 19:46:16 +00:00
netrom: Fix data-races around sysctl_netrom_network_ttl_initialiser
We need to protect the reader reading the sysctl value because the
value can be changed concurrently.
Fixes: 1da177e4c3
("Linux-2.6.12-rc2")
Signed-off-by: Jason Xing <kernelxing@tencent.com>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
This commit is contained in:
parent
cfd9f4a740
commit
119cae5ea3
@ -81,7 +81,7 @@ static int nr_header(struct sk_buff *skb, struct net_device *dev,
|
||||
buff[6] |= AX25_SSSID_SPARE;
|
||||
buff += AX25_ADDR_LEN;
|
||||
|
||||
*buff++ = sysctl_netrom_network_ttl_initialiser;
|
||||
*buff++ = READ_ONCE(sysctl_netrom_network_ttl_initialiser);
|
||||
|
||||
*buff++ = NR_PROTO_IP;
|
||||
*buff++ = NR_PROTO_IP;
|
||||
|
@ -204,7 +204,7 @@ void nr_transmit_buffer(struct sock *sk, struct sk_buff *skb)
|
||||
dptr[6] |= AX25_SSSID_SPARE;
|
||||
dptr += AX25_ADDR_LEN;
|
||||
|
||||
*dptr++ = sysctl_netrom_network_ttl_initialiser;
|
||||
*dptr++ = READ_ONCE(sysctl_netrom_network_ttl_initialiser);
|
||||
|
||||
if (!nr_route_frame(skb, NULL)) {
|
||||
kfree_skb(skb);
|
||||
|
@ -182,7 +182,8 @@ void nr_write_internal(struct sock *sk, int frametype)
|
||||
*dptr++ = nr->my_id;
|
||||
*dptr++ = frametype;
|
||||
*dptr++ = nr->window;
|
||||
if (nr->bpqext) *dptr++ = sysctl_netrom_network_ttl_initialiser;
|
||||
if (nr->bpqext)
|
||||
*dptr++ = READ_ONCE(sysctl_netrom_network_ttl_initialiser);
|
||||
break;
|
||||
|
||||
case NR_DISCREQ:
|
||||
@ -236,7 +237,7 @@ void __nr_transmit_reply(struct sk_buff *skb, int mine, unsigned char cmdflags)
|
||||
dptr[6] |= AX25_SSSID_SPARE;
|
||||
dptr += AX25_ADDR_LEN;
|
||||
|
||||
*dptr++ = sysctl_netrom_network_ttl_initialiser;
|
||||
*dptr++ = READ_ONCE(sysctl_netrom_network_ttl_initialiser);
|
||||
|
||||
if (mine) {
|
||||
*dptr++ = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user