Re: [PATCH net-next 09/15] batman-adv: annotate originator last_seen with READ/WRITE_ONCE

From
Sven Eckelmann <sven@narfation.org>
Date
2026-11-12 10:57:41
Also in
batman, sashiko-reviews
On Thursday, 12 November 2026 11:34:43 CET sashiko-bot@kernel.org wrote:
[...]
[Severity: Medium]
This problem wasn't introduced by this patch, but can
batadv_v_neigh_dump_neigh() and batadv_iv_neigh_dump_neigh()
batadv_iv_neigh_dump_neigh? There is no function with this name in the source 
code. There is only batadv_iv_ogm_neigh_dump_neigh()
suffer from
the same timestamp underflow [1]?

net/batman-adv/bat_v.c:batadv_v_neigh_dump_neigh() {
    ...
        last_seen_msecs = jiffies_to_msecs(jiffies - hardif_neigh->last_seen);
    ...
}

Because hardif_neigh->last_seen is updated locklessly on packet reception
and read without READ_ONCE() or jiffies_delta_to_msecs(), a concurrent
update can leave hardif_neigh->last_seen ahead of the sampled jiffies
value, wrapping the subtraction and exporting a huge last_seen_msecs
value over netlink.
This is adjusted in the next two patches in this patchset.

Regards,
	Sven

Attachments

Thread (1 message) 1 message, 1 author, last reply 1d ago
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help