]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
rxrpc: Fix data-race warning and potential load/store tearing
authorDavid Howells <dhowells@redhat.com>
Tue, 20 Jan 2026 10:13:05 +0000 (10:13 +0000)
committerJakub Kicinski <kuba@kernel.org>
Thu, 22 Jan 2026 03:59:29 +0000 (19:59 -0800)
commit5d5fe8bcd331f1e34e0943ec7c18432edfcf0e8b
tree6151a31738c6ace92b6df20350b98695723330b0
parent869f3f7f1f622f7894decef7078bb963148be0ef
rxrpc: Fix data-race warning and potential load/store tearing

Fix the following:

        BUG: KCSAN: data-race in rxrpc_peer_keepalive_worker / rxrpc_send_data_packet

which is reporting an issue with the reads and writes to ->last_tx_at in:

        conn->peer->last_tx_at = ktime_get_seconds();

and:

        keepalive_at = peer->last_tx_at + RXRPC_KEEPALIVE_TIME;

The lockless accesses to these to values aren't actually a problem as the
read only needs an approximate time of last transmission for the purposes
of deciding whether or not the transmission of a keepalive packet is
warranted yet.

Also, as ->last_tx_at is a 64-bit value, tearing can occur on a 32-bit
arch.

Fix both of these by switching to an unsigned int for ->last_tx_at and only
storing the LSW of the time64_t.  It can then be reconstructed at need
provided no more than 68 years has elapsed since the last transmission.

Fixes: ace45bec6d77 ("rxrpc: Fix firewall route keepalive")
Reported-by: syzbot+6182afad5045e6703b3d@syzkaller.appspotmail.com
Closes: https://lore.kernel.org/r/695e7cfb.050a0220.1c677c.036b.GAE@google.com/
Signed-off-by: David Howells <dhowells@redhat.com>
cc: Marc Dionne <marc.dionne@auristor.com>
cc: Simon Horman <horms@kernel.org>
cc: linux-afs@lists.infradead.org
cc: stable@kernel.org
Link: https://patch.msgid.link/1107124.1768903985@warthog.procyon.org.uk
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
net/rxrpc/ar-internal.h
net/rxrpc/conn_event.c
net/rxrpc/output.c
net/rxrpc/peer_event.c
net/rxrpc/proc.c
net/rxrpc/rxgk.c
net/rxrpc/rxkad.c