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 DC7BE37FF50; Sat, 12 Sep 2026 18:33:54 +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=1789238035; cv=none; b=CGcb1nEwAM2L27MfRHOXdCjzgehCTj55JPGTyGKMC26lcAYPWbknmFjjurJ8eFHu68+rnehyGTvKRKCFQV1djzBKKulj08kr5hVBZ+f5NQaz0ULrwtFRA5IUezvVfnnDtHWYgt6NPkJOt1JZDQ+huAlSrTk5IHY8cc6ELKkQUm8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789238035; c=relaxed/simple; bh=RBLqBnomYd2DvPrqxyPiZ7teAwxZvtu5LjmhzFGQszc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=lvmJ+CBDsq3Gc/885acAI8rSwD5IzeTw0uR4ib2/mfEw49nff2TToLknd+JKi9coFbHGGzLfROWYjNSLJxbIgBA7zuBHabGssCPBvMqJitSJeEOuJTl4IE/vId9A2w4nSWYUmzy1kep2MO437qPXFlKjec7cnqmVMcHiiVSM934= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=x6ooLlu2; 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="x6ooLlu2" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 962EF1F000FF; Sat, 12 Sep 2026 18:33:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1789238034; bh=rB9pjc1nFBlhlnChh4c5CPwqSRirkKD7HJEL7FmoavM=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=x6ooLlu2CKA7zTwb5XK4F9tJejQm1aMIJK5xWxb9/veI1R4cNOwkiSsQB5hZg7605 67SbPA+5O7QCgX+JTSAME0CgxZrRMOXIPpLBS99D7e6JF259xtRfu5aqDe92RTCH1v tBbW9oeNAcvvYPxoG3E5doaYHR3bvmtILKkbp/7k= 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.15 380/935] net: fix NULL pointer dereference in l3mdev_l3_rcv Date: Sat, 12 Sep 2026 08:56:50 +0200 Message-ID: <20260912065535.534457251@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260912065526.833703348@linuxfoundation.org> References: <20260912065526.833703348@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.15-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