From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 2B21D349AF2; Tue, 6 Jan 2026 17:18:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767719907; cv=none; b=fA37RRHVOeMgQ6JMCoBjLicXHXIov3+L7cSLyd+RA4gyAHI4iFzIkYuCvGTNc71wYffx3FXLN7ORDR8I5utrgU85JHjGctK5FE3n6xliwtp1CgwM0zLWuPGQyayJlRsH41qAwz0XS+ua3Obs9BXV/MPbCnKfuKd+Fp0Gin/oGW8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767719907; c=relaxed/simple; bh=YdCcgI1NCLVvL/h4/4fQX7E0QCl0Xd8FjoLK7TvSz3g=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=BDKl8Sl35e177dhhkFO4t1RXBsdjXqhdd4+4itNKnIsa9RknpjvFFL/CTQHRtu7OCZCL/TAkddKSLisxwDDrJRhXAPafHXC8BptExSVyIe/UJTiDQRcS41gxypcmSKyqn9Brzve1IQrR+tz1jpeUy3U/SK1gLMJzRtZRh98jW+c= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=Gr3mGOvk; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="Gr3mGOvk" Received: by smtp.kernel.org (Postfix) with ESMTPSA id A8323C116C6; Tue, 6 Jan 2026 17:18:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1767719907; bh=YdCcgI1NCLVvL/h4/4fQX7E0QCl0Xd8FjoLK7TvSz3g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Gr3mGOvkV1oKO3GcjAj6tEvfZjMnxgwG+0h68XY/OcfwN1a5QTercfAQwCLoSq/3G hwaCJo0USmdewNTqZhE5TPfyLQGlB/hobbIH9D8spBiyZ3RSrhu6h9NE8exGKnB0pI fWqXYhR9hYXKGd20Mq6bEYGMihdfycmm2KsMNdcU= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Jian Shen , Jijie Shao , Simon Horman , Paolo Abeni , Sasha Levin Subject: [PATCH 6.12 077/567] net: hns3: add VLAN id validation before using Date: Tue, 6 Jan 2026 17:57:39 +0100 Message-ID: <20260106170454.181909781@linuxfoundation.org> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260106170451.332875001@linuxfoundation.org> References: <20260106170451.332875001@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.12-stable review patch. If anyone has any objections, please let me know. ------------------ From: Jian Shen [ Upstream commit 6ef935e65902bfed53980ad2754b06a284ea8ac1 ] Currently, the VLAN id may be used without validation when receive a VLAN configuration mailbox from VF. The length of vlan_del_fail_bmap is BITS_TO_LONGS(VLAN_N_VID). It may cause out-of-bounds memory access once the VLAN id is bigger than or equal to VLAN_N_VID. Therefore, VLAN id needs to be checked to ensure it is within the range of VLAN_N_VID. Fixes: fe4144d47eef ("net: hns3: sync VLAN filter entries when kill VLAN ID failed") Signed-off-by: Jian Shen Signed-off-by: Jijie Shao Reviewed-by: Simon Horman Link: https://patch.msgid.link/20251211023737.2327018-4-shaojijie@huawei.com Signed-off-by: Paolo Abeni Signed-off-by: Sasha Levin --- drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c index f5eafd1ded413..8dd970ef02ac6 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c @@ -10572,6 +10572,9 @@ int hclge_set_vlan_filter(struct hnae3_handle *handle, __be16 proto, bool writen_to_tbl = false; int ret = 0; + if (vlan_id >= VLAN_N_VID) + return -EINVAL; + /* When device is resetting or reset failed, firmware is unable to * handle mailbox. Just record the vlan id, and remove it after * reset finished. -- 2.51.0