From: Paolo Abeni <pabeni@redhat.com>
To: Vivek Pernamitta <vivek.pernamitta@oss.qualcomm.com>,
Andrew Lunn <andrew+netdev@lunn.ch>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v10 1/2] net: mhi: Enable Ethernet interface support
Date: Mon, 13 Apr 2026 15:31:42 +0200 [thread overview]
Message-ID: <77d813af-bfc8-495c-ad50-7401b86065a5@redhat.com> (raw)
In-Reply-To: <20260409-vdev_b1_eth_b1_next-20260408-v10-1-6d44ca48f189@oss.qualcomm.com>
On 4/9/26 8:08 AM, Vivek Pernamitta wrote:
> @@ -208,17 +235,20 @@ static void mhi_net_dl_callback(struct mhi_device *mhi_dev,
> skb = mhi_net_skb_agg(mhi_netdev, skb);
> mhi_netdev->skbagg_head = NULL;
> }
> -
> - switch (skb->data[0] & 0xf0) {
> - case 0x40:
> - skb->protocol = htons(ETH_P_IP);
> - break;
> - case 0x60:
> - skb->protocol = htons(ETH_P_IPV6);
> - break;
> - default:
> - skb->protocol = htons(ETH_P_MAP);
> - break;
> + if (mhi_netdev->ndev->type == ARPHRD_ETHER) {
> + skb->protocol = eth_type_trans(skb, mhi_netdev->ndev);
Sashiko says:
Is there a risk of an out-of-bounds read or kernel panic here if a malformed
or fragmented packet is received?
eth_type_trans() assumes the SKB has at least a 14-byte MAC header and calls
skb_pull_inline(). If the linear portion of the SKB is smaller than 14
bytes,
__skb_pull() will trigger a BUG_ON(skb->len < skb->data_len).
Should we call pskb_may_pull(skb, ETH_HLEN) before parsing the Ethernet
header?
> + } else {
> + switch (skb->data[0] & 0xf0) {
> + case 0x40:
> + skb->protocol = htons(ETH_P_IP);
> + break;
> + case 0x60:
> + skb->protocol = htons(ETH_P_IPV6);
> + break;
> + default:
> + skb->protocol = htons(ETH_P_MAP);
> + break;
> + }
> }
>
> u64_stats_update_begin(&mhi_netdev->stats.rx_syncp);
> @@ -306,6 +336,9 @@ static int mhi_net_newlink(struct mhi_device *mhi_dev, struct net_device *ndev)
> struct mhi_net_dev *mhi_netdev;
> int err;
>
> + if (ndev->header_ops)
> + eth_hw_addr_random(ndev);
> +
> mhi_netdev = netdev_priv(ndev);
>
> dev_set_drvdata(&mhi_dev->dev, mhi_netdev);
> @@ -356,7 +389,8 @@ static int mhi_net_probe(struct mhi_device *mhi_dev,
> int err;
>
> ndev = alloc_netdev(sizeof(struct mhi_net_dev), info->netname,
> - NET_NAME_PREDICTABLE, mhi_net_setup);
> + NET_NAME_ENUM, info->ethernet_if ?
> + mhi_ethernet_setup : mhi_net_setup);
Sashiko says:
Does changing the name assignment type from NET_NAME_PREDICTABLE to
NET_NAME_ENUM break backwards compatibility for existing legacy interfaces?
NET_NAME_PREDICTABLE instructs userspace to leave the kernel-provided
name alone, while NET_NAME_ENUM signals that the interface is a generic
enumeration and should be renamed. Applying this to existing interfaces
like mhi_hwip0 and mhi_swip0 might cause them to be unexpectedly renamed
on boot, potentially breaking existing userspace network configurations.
please have a look at the full report:
https://sashiko.dev/#/patchset/20260409-vdev_b1_eth_b1_next-20260408-v10-0-6d44ca48f189%40oss.qualcomm.com
/P
next prev parent reply other threads:[~2026-04-13 13:31 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-09 6:08 [PATCH v10 0/2] net: mhi: Add support to enable ethernet interface Vivek Pernamitta
2026-04-09 6:08 ` [PATCH v10 1/2] net: mhi: Enable Ethernet interface support Vivek Pernamitta
2026-04-13 13:31 ` Paolo Abeni [this message]
2026-04-09 6:08 ` [PATCH v10 2/2] net: mhi: Add IP_SW1 interface for M-plane support over MHI Vivek Pernamitta
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=77d813af-bfc8-495c-ad50-7401b86065a5@redhat.com \
--to=pabeni@redhat.com \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=vivek.pernamitta@oss.qualcomm.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox