linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] ice: Fix a null pointer dereference in ice_copy_and_init_pkg()
@ 2025-07-03  9:52 Haoxiang Li
  2025-07-07  9:01 ` Simon Horman
  2025-07-18 16:44 ` [Intel-wired-lan] " Rinitha, SX
  0 siblings, 2 replies; 3+ messages in thread
From: Haoxiang Li @ 2025-07-03  9:52 UTC (permalink / raw)
  To: anthony.l.nguyen, przemyslaw.kitszel, andrew+netdev, davem,
	edumazet, kuba, pabeni
  Cc: intel-wired-lan, netdev, linux-kernel, Haoxiang Li, stable,
	Michal Swiatkowski, Aleksandr Loktionov

Add check for the return value of devm_kmemdup()
to prevent potential null pointer dereference.

Fixes: c76488109616 ("ice: Implement Dynamic Device Personalization (DDP) download")
Cc: stable@vger.kernel.org
Signed-off-by: Haoxiang Li <haoxiang_li2024@163.com>
Reviewed-by: Michal Swiatkowski <michal.swiatkowski@linux.intel.com>
Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
---
Changes in v2:
- modify the Fixes commit number. Thanks, Michal!
---
 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/ethernet/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_hw *hw, const u8 *buf,
 		return ICE_DDP_PKG_ERR;
 
 	buf_copy = devm_kmemdup(ice_hw_to_dev(hw), buf, len, GFP_KERNEL);
+	if (!buf_copy)
+		return ICE_DDP_PKG_ERR;
 
 	state = ice_init_pkg(hw, buf_copy, len);
 	if (!ice_is_init_pkg_successful(state)) {
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] ice: Fix a null pointer dereference in ice_copy_and_init_pkg()
  2025-07-03  9:52 [PATCH v2] ice: Fix a null pointer dereference in ice_copy_and_init_pkg() Haoxiang Li
@ 2025-07-07  9:01 ` Simon Horman
  2025-07-18 16:44 ` [Intel-wired-lan] " Rinitha, SX
  1 sibling, 0 replies; 3+ messages in thread
From: Simon Horman @ 2025-07-07  9:01 UTC (permalink / raw)
  To: Haoxiang Li
  Cc: anthony.l.nguyen, przemyslaw.kitszel, andrew+netdev, davem,
	edumazet, kuba, pabeni, intel-wired-lan, netdev, linux-kernel,
	stable, Michal Swiatkowski, Aleksandr Loktionov

On Thu, Jul 03, 2025 at 05:52:32PM +0800, Haoxiang Li wrote:
> Add check for the return value of devm_kmemdup()
> to prevent potential null pointer dereference.
> 
> Fixes: c76488109616 ("ice: Implement Dynamic Device Personalization (DDP) download")
> Cc: stable@vger.kernel.org
> Signed-off-by: Haoxiang Li <haoxiang_li2024@163.com>
> Reviewed-by: Michal Swiatkowski <michal.swiatkowski@linux.intel.com>
> Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
> ---
> Changes in v2:
> - modify the Fixes commit number. Thanks, Michal!

Reviewed-by: Simon Horman <horms@kernel.org>


^ permalink raw reply	[flat|nested] 3+ messages in thread

* RE: [Intel-wired-lan] [PATCH v2] ice: Fix a null pointer dereference in ice_copy_and_init_pkg()
  2025-07-03  9:52 [PATCH v2] ice: Fix a null pointer dereference in ice_copy_and_init_pkg() Haoxiang Li
  2025-07-07  9:01 ` Simon Horman
@ 2025-07-18 16:44 ` Rinitha, SX
  1 sibling, 0 replies; 3+ messages in thread
From: Rinitha, SX @ 2025-07-18 16:44 UTC (permalink / raw)
  To: Haoxiang Li, Nguyen, Anthony L, Kitszel, Przemyslaw,
	andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@google.com,
	kuba@kernel.org, pabeni@redhat.com
  Cc: intel-wired-lan@lists.osuosl.org, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org, stable@vger.kernel.org,
	Michal Swiatkowski, Loktionov, Aleksandr

> -----Original Message-----
> From: Intel-wired-lan <intel-wired-lan-bounces@osuosl.org> On Behalf Of Haoxiang Li
> Sent: 03 July 2025 15:23
> To: Nguyen, Anthony L <anthony.l.nguyen@intel.com>; Kitszel, Przemyslaw <przemyslaw.kitszel@intel.com>; andrew+netdev@lunn.ch; davem@davemloft.net; edumazet@google.com; kuba@kernel.org; pabeni@redhat.com
> Cc: intel-wired-lan@lists.osuosl.org; netdev@vger.kernel.org; linux-kernel@vger.kernel.org; Haoxiang Li <haoxiang_li2024@163.com>; stable@vger.kernel.org; Michal Swiatkowski <michal.swiatkowski@linux.intel.com>; Loktionov, Aleksandr <aleksandr.loktionov@intel.com>
> Subject: [Intel-wired-lan] [PATCH v2] ice: Fix a null pointer dereference in ice_copy_and_init_pkg()
>
> Add check for the return value of devm_kmemdup() to prevent potential null pointer dereference.
>
> Fixes: c76488109616 ("ice: Implement Dynamic Device Personalization (DDP) download")
> Cc: stable@vger.kernel.org
> Signed-off-by: Haoxiang Li <haoxiang_li2024@163.com>
> Reviewed-by: Michal Swiatkowski <michal.swiatkowski@linux.intel.com>
> Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
> ---
> Changes in v2:
> - modify the Fixes commit number. Thanks, Michal!
> ---
> drivers/net/ethernet/intel/ice/ice_ddp.c | 2 ++
> 1 file changed, 2 insertions(+)
>

Tested-by: Rinitha S <sx.rinitha@intel.com> (A Contingent worker at Intel)

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-07-18 16:44 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-03  9:52 [PATCH v2] ice: Fix a null pointer dereference in ice_copy_and_init_pkg() Haoxiang Li
2025-07-07  9:01 ` Simon Horman
2025-07-18 16:44 ` [Intel-wired-lan] " Rinitha, SX

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).