Re: [PATCH v2] net: mac802154: fix race between slave_close() and in-flight async tx

From: Miquel Raynal

Date: Sun Oct 04 2026 - 10:50:56 EST


On 02/10/2026 at 14:48:27 GMT, Adi Prasan <itsadi2409@xxxxxxxxx> wrote:

> netif_stop_queue() prevents new packets from being sent to the driver,
> but it does not wait for a transmission that is already in progress.
>
> drv_xmit_async() can still be running on another CPU when
> mac802154_slave_close() calls drv_stop(). Stopping the queue only
> prevents new transmissions; it does not synchronize with an already
> running tx operation.
>
> This was checked against mac802154_hwsim as well. hwsim_hw_xmit() is
> synchronous, while hwsim_hw_stop() only sets a flag, so there is no
> pending work or locking in the driver that needs to be synchronized.
>
> The race is in the core between stopping the queue and an in-flight
> tx operation. The fix therefore belongs in the common mac802154 code,
> using the same handling already used by ieee802154_suspend(): hold and
> synchronize the queue around ieee802154_stop_device().
>
> Signed-off-by: Adi Prasan <itsadi2409@xxxxxxxxx>

Reviewed-by: Miquel Raynal <miquel.raynal@xxxxxxxxxxx>