From nobody Fri Dec 19 16:11:08 2025 Received: from m16.mail.163.com (m16.mail.163.com [220.197.31.3]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E7FF38C11; Sat, 24 May 2025 07:27:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=220.197.31.3 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1748071677; cv=none; b=ZoIRzo2RAtBWHCqHfdkx7MNE1tzxP4d5vGKWxisD052ek0A/XrHgd3vH466NwtFHRs4ZXL6fWTSEYrSWzt5S34FfNEHNOcCuebXN5bVK+7iUKFQEQ3xtxz28WRtA2sF7zMgqaytqw/t/PNwVtguZPTFe6n+qsGJpeKCg+wsiDcA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1748071677; c=relaxed/simple; bh=QsHCdBici6uZQb0MMP/UeIRDZiWNUzkYoYcveEjC4rU=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=TASr3t3com/js+Rd+AwutJzSL84rxCFeX8YEnUgBuQIJ+vKHiZTTcIuqmRm6Mwgl3n/m8hQHz7Tef+WFJrRqhiqfSqEuTGMyzg0pknrldYnJXCM6cHD5IK1yA+ZtvLB0NpLw3vHEbgSGnhXfEQrjRquaseQbge9QNV+q5jfhMQE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=163.com; spf=pass smtp.mailfrom=163.com; dkim=pass (1024-bit key) header.d=163.com header.i=@163.com header.b=kTo4zrev; arc=none smtp.client-ip=220.197.31.3 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=163.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=163.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=163.com header.i=@163.com header.b="kTo4zrev" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=From:To:Subject:Date:Message-Id:MIME-Version; bh=Hu 286s57mP1NPRtFysQLi/doib7qC4IDVyR6e/Hyw78=; b=kTo4zrevTgjipbrONC 5E8JWrSIjZ5R3+wDOjHE7BVrCcnQThZgLl3PBWAHEBXfId7ntFqu5S733kmCpxo8 bGTNCao/v0r58BcWLXaVHWxfTz7rF09XECe4bOjHFe7/O5H9v04qoC8VvIyiCe9e 7/D7hV+M1EOnFW31KUxtdAWPI= Received: from icess-ProLiant-DL380-Gen10.. (unknown []) by gzga-smtp-mtada-g0-1 (Coremail) with SMTP id _____wCH2R_DdDFow8_GDg--.1286S4; Sat, 24 May 2025 15:27:00 +0800 (CST) From: Haoxiang Li To: anthony.l.nguyen@intel.com, przemyslaw.kitszel@intel.com, andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, sergey.temerkhanov@intel.com Cc: intel-wired-lan@lists.osuosl.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Haoxiang Li , stable@vger.kernel.org Subject: [PATCH] ice: Fix a null pointer dereference in ice_copy_and_init_pkg() Date: Sat, 24 May 2025 15:26:58 +0800 Message-Id: <20250524072658.3586149-1-haoxiang_li2024@163.com> X-Mailer: git-send-email 2.25.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-CM-TRANSID: _____wCH2R_DdDFow8_GDg--.1286S4 X-Coremail-Antispam: 1Uf129KBjvdXoWruF1fXw1Duw47JFyftFyrJFb_yoWDJrcE9w 4SvFyfJrW5KryFv3yYkr47Z34SyF1DXr9Y9ay2939a9wnxGryDXwnrZr93Xr47WFyDuF9r Ars7ta42va42qjkaLaAFLSUrUUUUjb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUvcSsGvfC2KfnxnUUI43ZEXa7sRNvtCUUUUUU== X-CM-SenderInfo: xkdr5xpdqjszblsqjki6rwjhhfrp/xtbB0g9TbmgtChXmaQABs0 Content-Type: text/plain; charset="utf-8" Add check for the return value of devm_kmemdup() to prevent potential null pointer dereference. Fixes: 2ffd87d38d6b ("ice: Move support DDP code out of ice_flex_pipe.c") Cc: stable@vger.kernel.org Signed-off-by: Haoxiang Li Reviewed-by: Aleksandr Loktionov Reviewed-by: Michal Swiatkowski --- drivers/net/ethernet/intel/ice/ice_ddp.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/net/ethernet/intel/ice/ice_ddp.c b/drivers/net/etherne= t/intel/ice/ice_ddp.c index 59323c019544..351824dc3c62 100644 --- a/drivers/net/ethernet/intel/ice/ice_ddp.c +++ b/drivers/net/ethernet/intel/ice/ice_ddp.c @@ -2301,6 +2301,8 @@ enum ice_ddp_state ice_copy_and_init_pkg(struct ice_h= w *hw, const u8 *buf, return ICE_DDP_PKG_ERR; =20 buf_copy =3D devm_kmemdup(ice_hw_to_dev(hw), buf, len, GFP_KERNEL); + if (!buf_copy) + return ICE_DDP_PKG_ERR; =20 state =3D ice_init_pkg(hw, buf_copy, len); if (!ice_is_init_pkg_successful(state)) { --=20 2.25.1