From: Simon Wunderlich <sw@simonwunderlich.de>
To: b.a.t.m.a.n@lists.open-mesh.org, Sven Eckelmann <sven@narfation.org>
Subject: Re: [PATCH RFC batadv] batman-adv: bla: fix report_work leak on backbone_gw purge
Date: Tue, 12 May 2026 14:09:53 +0200 [thread overview]
Message-ID: <2317125.72vocr9iq0@prime> (raw)
In-Reply-To: <20260510-bla-cancel-work-v1-1-3654903495ef@narfation.org>
On Sunday, May 10, 2026 12:03:42 PM Central European Summer Time Sven
Eckelmann wrote:
> batadv_bla_purge_backbone_gw() removes stale backbone gateway entries,
> but fails to properly handle their associated report_work:
>
> - If report_work is running, the purge must wait for it to finish before
> freeing the backbone_gw, otherwise the worker may access freed memory
> (e.g. bat_priv).
> - If report_work is pending, the purge must cancel it and release the
> reference held for that pending work item.
>
> The previous implementation called hlist_for_each_entry_safe() inside a
> spin_lock_bh() section, but cancel_work_sync() may sleep and therefore
> cannot be called from within a spinlock-protected region.
>
> Restructure the loop to handle one entry per spinlock critical section:
> acquire the lock, find the next entry to purge, remove it from the hash
> list, then release the lock before calling cancel_work_sync() and
> dropping the hash_entry reference. Repeat until no more entries require
> purging.
>
> Fixes: a998bf5dfbd7 ("batman-adv: add detection for complex bridge loops")
> Signed-off-by: Sven Eckelmann <sven@narfation.org>
This looks good, thank you!
Reviewed-by: Simon Wunderlich <sw@simonwunderlich.de>
Cheers,
Simon
prev parent reply other threads:[~2026-05-12 12:10 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-10 10:03 [PATCH RFC batadv] batman-adv: bla: fix report_work leak on backbone_gw purge Sven Eckelmann
2026-05-12 12:09 ` Simon Wunderlich [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=2317125.72vocr9iq0@prime \
--to=sw@simonwunderlich.de \
--cc=b.a.t.m.a.n@lists.open-mesh.org \
--cc=sven@narfation.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.