From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 64ADC13D53C; Sat, 12 Sep 2026 19:43:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789242210; cv=none; b=Cx38fxhWRWbXx2pALUYZmsbQfbrQXOhH6PlaaKqUgoh/g5af1kz18XHMbdkuZxhb+19+n9C0XtRGjErhFEpi+umhRyYP/qklcN2wJzy+ZPdZOsRjYb8xgr39p7XVcM+CrhgjDhgts8Fg1jbIq74GMgyCyJCpI5L0fjX8Gw4PZ20= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789242210; c=relaxed/simple; bh=TkG8r3LRu8zBF2ZyBKC5ijSQwk1g5SiqSggRG5MBQms=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Y+7ru6x5exu3ghj+pEVASgcmQUUllUfivchWHkUbU89y4Ts1D9sUxNEJNiDskc6Kl5e+Z/EOFHbZfY4OENErwdRU3hde1ZrpoFnZRxbNfnOdpho9mNl9oQ72s4gvkXBYme1eoc+/9AiLeDXbB1RLthVgVJQUfP09vJt2TI/d9m0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=u361LjWj; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="u361LjWj" Received: by smtp.kernel.org (Postfix) with ESMTPSA id BDDDD1F000FF; Sat, 12 Sep 2026 19:43:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1789242209; bh=cq4+1iCYcdlcfkFy7tbAb9edXt/4LyCD9AlXhFDJbDo=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=u361LjWj24SD0OnIuqRfuJScRPejwHBpk0E4wxzMFo37w59JtZhO3VKx9SEQR3Ytu mO4y/ZMQBvRYTirQ0UWALGawxBxrT5TIGfCC+keHK4LEy0Xy4VNLzIhlI/r2hJl6FS 8cEs0DfGgUvnqNKys7Qlp2Q5xZijCdWe+QaBbN1I= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, David Ahern , Wang Liang , Simon Horman , Jakub Kicinski , Sasha Levin Subject: [PATCH 5.10 323/798] net: fix NULL pointer dereference in l3mdev_l3_rcv Date: Sat, 12 Sep 2026 08:59:11 +0200 Message-ID: <20260912065524.566427399@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260912065516.948645775@linuxfoundation.org> References: <20260912065516.948645775@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 5.10-stable review patch. If anyone has any objections, please let me know. ------------------ From: Wang Liang [ Upstream commit 0032c99e83b9ce6d5995d65900aa4b6ffb501cce ] When delete l3s ipvlan: ip link del link eth0 ipvlan1 type ipvlan mode l3s This may cause a null pointer dereference: Call trace: ip_rcv_finish+0x48/0xd0 ip_rcv+0x5c/0x100 __netif_receive_skb_one_core+0x64/0xb0 __netif_receive_skb+0x20/0x80 process_backlog+0xb4/0x204 napi_poll+0xe8/0x294 net_rx_action+0xd8/0x22c __do_softirq+0x12c/0x354 This is because l3mdev_l3_rcv() visit dev->l3mdev_ops after ipvlan_l3s_unregister() assign the dev->l3mdev_ops to NULL. The process like this: (CPU1) | (CPU2) l3mdev_l3_rcv() | check dev->priv_flags: | master = skb->dev; | | | ipvlan_l3s_unregister() | set dev->priv_flags | dev->l3mdev_ops = NULL; | visit master->l3mdev_ops | To avoid this by do not set dev->l3mdev_ops when unregister l3s ipvlan. Suggested-by: David Ahern Fixes: c675e06a98a4 ("ipvlan: decouple l3s mode dependencies from other modes") Signed-off-by: Wang Liang Reviewed-by: Simon Horman Link: https://patch.msgid.link/20250321090353.1170545-1-wangliang74@huawei.com Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin --- drivers/net/ipvlan/ipvlan_l3s.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/net/ipvlan/ipvlan_l3s.c b/drivers/net/ipvlan/ipvlan_l3s.c index d5b05e8032199..ca35a50bb6405 100644 --- a/drivers/net/ipvlan/ipvlan_l3s.c +++ b/drivers/net/ipvlan/ipvlan_l3s.c @@ -224,5 +224,4 @@ void ipvlan_l3s_unregister(struct ipvl_port *port) dev->priv_flags &= ~IFF_L3MDEV_RX_HANDLER; ipvlan_unregister_nf_hook(read_pnet(&port->pnet)); - dev->l3mdev_ops = NULL; } -- 2.53.0