Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Dec 23, 2025

MHI driver v1.3.8-r3 crashes when LAN cable is connected during active cellular data transfer. Root cause: aggressive WARN_ON() calls flood kernel log when non-QMAP packets arrive via bridge/LAN, triggering system instability.

Changes

driver/quectel_MHI/src/devices/mhi_netdev_quectel.c

  • Add NULL check in ndev_to_mhi() - Prevent dereference when unexpected device pointers arrive from bridge stack
  • Remove WARN_ON for protocol mismatch - Non-QMAP packets are normal for bridged traffic, pass through silently
  • Remove WARN_ON for NULL mhi_netdev - Expected when non-MHI packets arrive, handle gracefully
static struct mhi_netdev *ndev_to_mhi(struct net_device *ndev) {
	struct mhi_netdev_priv *mhi_netdev_priv;

	if (!ndev)
		return NULL;

	mhi_netdev_priv = netdev_priv(ndev);
	return mhi_netdev_priv->mhi_netdev;
}
if (skb->protocol != htons(ETH_P_MAP)) {
	/* Not a QMAP packet, may be bridged/LAN traffic */
	return RX_HANDLER_PASS;
}

The rx_handler registration with NULL (for HyFi compatibility) remains unchanged. This fix handles the resulting edge cases without warnings.

Testing

Requires validation on RM520N-GL module with immortalwrt 25.12, cellular data active + LAN connected.

Original prompt

This section details on the original issue you should resolve

<issue_title>[BUG]MHI1.3.8-r3版本只要网线使用蜂窝数据无限重启</issue_title>
<issue_description>设备:西瓜皮v3(遇到其他设备的人同样出现此问题,5G模块相同)
OS:immortalwrt25.12
5G模块:RM520N-GL
只要网线插入lan口使用,瞬间设备重启,日志都没有。
使用MHI1.3.8-r1就不会出现此问题。
</issue_description>

Comments on the Issue (you are @copilot in this section)


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI self-assigned this Dec 23, 2025
Copilot AI and others added 4 commits December 23, 2025 21:11
- Add NULL safety checks in ndev_to_mhi() function
- Remove aggressive WARN_ON() calls that can flood kernel log
- Handle bridged/LAN packets gracefully without warnings
- Prevents device reboots when cellular + LAN are used together

Co-authored-by: FUjr <53910283+FUjr@users.noreply.github.com>
Remove unnecessary NULL check for mhi_netdev_priv since netdev_priv()
cannot return NULL for valid net_device objects.

Co-authored-by: FUjr <53910283+FUjr@users.noreply.github.com>
Clean up extra tabs/spaces to match file coding style

Co-authored-by: FUjr <53910283+FUjr@users.noreply.github.com>
Co-authored-by: FUjr <53910283+FUjr@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix infinite reboot issue with MHI1.3.8-r3 on wired connection Fix MHI driver kernel panic with bridged/LAN traffic Dec 23, 2025
Copilot AI requested a review from FUjr December 23, 2025 21:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG]MHI1.3.8-r3版本只要网线使用蜂窝数据无限重启

2 participants