Skip to contentSkip to conversation

net: wwan: mhi_wwan_mbim: disable rx_refill work on removal

PATCH In review Myeonghun Pak 4 participants 5 messages Nov 10 – Nov 12

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net: wwan: mhi_wwan_mbim: disable rx_refill work on removal

mhi_mbim_remove() cancels rx_refill before wwan_unregister_ops() removes the links. Bringing a link up in between calls mhi_mbim_ndo_open() and queues the work again. With the MHI channels already reset, the work cannot refill RX buffers and keeps re-arming itself, eventually running after devres frees the context.

Use disable_delayed_work_sync() to drain the work and reject later queueing. Probe initializes fresh work on rebind.

Found by a static analysis tool under development.

Fixes aa730a9905b7 ("net: wwan: Add MHI MBIM network driver")
Cc [email protected] # v6.10+

---

drivers/net/wwan/mhi_wwan_mbim.c +1 -1
index 336f89756f10..3b6b0066f673 100644
@@ -650,7 +650,7 @@ static void mhi_mbim_remove(struct mhi_device *mhi_dev)
 	struct mhi_controller *cntrl = mhi_dev->mhi_cntrl;
 
 	mhi_unprepare_from_transfer(mhi_dev);
-	cancel_delayed_work_sync(&mbim->rx_refill);
+	disable_delayed_work_sync(&mbim->rx_refill);
 	wwan_unregister_ops(&cntrl->mhi_dev->dev);
 	kfree_skb(mbim->skbagg_head);
 	dev_set_drvdata(&mhi_dev->dev, NULL);

base-commit: 0edbc945eb9edd0086f25b151a79cfe4adc0dfa8

Signature · 1 line
2.43.0
#1 lore raw
This is an automated message. This series looks like a fix, but its commit messages seem to be missing some information:

Hi!

This is an automated message. This series looks like a fix, but its commit messages seem to be missing some information:

- Whether the issue was actually triggered, or is only theoretical (e.g. found by code inspection). If it was triggered please include the symptoms, like the stack trace or error messages.

Please do not repost the series just to address the above. Instead, reply to this email with the missing information, so that reviewers can take it into account. If the series needs another revision for other reasons, please include the information in the commit messages then.

The evaluation is done by an LLM so it may be wrong, if you think that is the case please reply and explain.

maintainer Reviewed-by on v1 1/1
#2 lore raw
In reply to Myeonghun Pak
Quoted 10 lines · Myeonghun Pak

mhi_mbim_remove() cancels rx_refill before wwan_unregister_ops() removes the links. Bringing a link up in between calls mhi_mbim_ndo_open() and queues the work again. With the MHI channels already reset, the work cannot refill RX buffers and keeps re-arming itself, eventually running after devres frees the context.

Use disable_delayed_work_sync() to drain the work and reject later queueing. Probe initializes fresh work on rebind.

Quoted 7 lines

Found by a static analysis tool under development.

Fixes aa730a9905b7 ("net: wwan: Add MHI MBIM network driver")
Cc [email protected] # v6.10+
Quoted 21 lines

---

drivers/net/wwan/mhi_wwan_mbim.c +1 -1
index 336f89756f10..3b6b0066f673 100644
@@ -650,7 +650,7 @@ static void mhi_mbim_remove(struct mhi_device *mhi_dev)
        struct mhi_controller *cntrl = mhi_dev->mhi_cntrl;
 
        mhi_unprepare_from_transfer(mhi_dev);
-       cancel_delayed_work_sync(&mbim->rx_refill);
+       disable_delayed_work_sync(&mbim->rx_refill);
        wwan_unregister_ops(&cntrl->mhi_dev->dev);
        kfree_skb(mbim->skbagg_head);
        dev_set_drvdata(&mhi_dev->dev, NULL);

base-commit: 0edbc945eb9edd0086f25b151a79cfe4adc0dfa8 --
2.43.0

maintainer
#3 lore raw
In reply to Myeonghun Pak
Quoted 24 lines · On Mon, 9 Nov 2026 23:30:06 -0500 Myeonghun Pak wrote:

mhi_mbim_remove() cancels rx_refill before wwan_unregister_ops() removes the links. Bringing a link up in between calls mhi_mbim_ndo_open() and queues the work again. With the MHI channels already reset, the work cannot refill RX buffers and keeps re-arming itself, eventually running after devres frees the context.

Use disable_delayed_work_sync() to drain the work and reject later queueing. Probe initializes fresh work on rebind.

Found by a static analysis tool under development.

Fixes aa730a9905b7 ("net: wwan: Add MHI MBIM network driver")
Cc [email protected] # v6.10+

---

drivers/net/wwan/mhi_wwan_mbim.c +0 -0
index 336f89756f10..3b6b0066f673 100644

drivers/net/wwan/mhi_wwan_mbim.c static void mhi_mbim_remove(struct mhi_device *mhi_dev) · line 656

Quoted 8 lines
drivers/net/wwan/mhi_wwan_mbim.c +1 -1
@@ -650,7 +650,7 @@ static void mhi_mbim_remove(struct mhi_device *mhi_dev)
 	struct mhi_controller *cntrl = mhi_dev->mhi_cntrl;
 
 	mhi_unprepare_from_transfer(mhi_dev);
-	cancel_delayed_work_sync(&mbim->rx_refill);
+	disable_delayed_work_sync(&mbim->rx_refill);
 	wwan_unregister_ops(&cntrl->mhi_dev->dev);
 	kfree_skb(mbim->skbagg_head);
 	dev_set_drvdata(&mhi_dev->dev, NULL);

AI says this is not enough for make the teardown correct:

https://netdev-ai.bots.linux.dev/sashiko/#/patchset/[email protected]

Signature · 1 line
pw-bot: cr
maintainer
#4 lore raw
Quoted 37 lines · Jakub Kicinski
Quoted 24 lines · On Mon, 9 Nov 2026 23:30:06 -0500 Myeonghun Pak wrote:

mhi_mbim_remove() cancels rx_refill before wwan_unregister_ops() removes the links. Bringing a link up in between calls mhi_mbim_ndo_open() and queues the work again. With the MHI channels already reset, the work cannot refill RX buffers and keeps re-arming itself, eventually running after devres frees the context.

Use disable_delayed_work_sync() to drain the work and reject later queueing. Probe initializes fresh work on rebind.

Found by a static analysis tool under development.

Fixes aa730a9905b7 ("net: wwan: Add MHI MBIM network driver")
Cc [email protected] # v6.10+

---

drivers/net/wwan/mhi_wwan_mbim.c +0 -0
index 336f89756f10..3b6b0066f673 100644

drivers/net/wwan/mhi_wwan_mbim.c static void mhi_mbim_remove(struct mhi_device *mhi_dev) · line 656

Quoted 8 lines
drivers/net/wwan/mhi_wwan_mbim.c +1 -1
@@ -650,7 +650,7 @@ static void mhi_mbim_remove(struct mhi_device *mhi_dev)
      struct mhi_controller *cntrl = mhi_dev->mhi_cntrl;
 
      mhi_unprepare_from_transfer(mhi_dev);
-     cancel_delayed_work_sync(&mbim->rx_refill);
+     disable_delayed_work_sync(&mbim->rx_refill);
      wwan_unregister_ops(&cntrl->mhi_dev->dev);
      kfree_skb(mbim->skbagg_head);
      dev_set_drvdata(&mhi_dev->dev, NULL);

AI says this is not enough for make the teardown correct:

Quoted 1 line

https://netdev-ai.bots.linux.dev/sashiko/#/patchset/[email protected]

Indeed, thank you.

Myeonghun, could you move the disable_delayed_work_sync() call to the appropriate location, as described in the link above?

Thanks,
Loic