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 B39D941323E; Wed, 4 Feb 2026 14:58:56 +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=1770217136; cv=none; b=Ffo4JRKEWHD3pc6r50UiX6af4BK/sVSiAPWBHrRoReCKCUu8Uz28Lzj3OAFr4Jb/Ox+xhIiUEf0v4rZAuP7lhk2PLGdApa/Ae7795YW8JM9T6fRav6vQOPSAwK6lyM6t94r+4byXe7dXPjEKYhpjbiTC+K9pVwED2HYUjq9GRn4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770217136; c=relaxed/simple; bh=f6Gl/4T4RxLlCimGiMWEZpM2ckll4uPOQw2wHDj2Jh0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=dV06bxuqZMT87DpS8K0oOz2gGPtJ8s9gtDIVD+XU0qn1nCBgXWhkAaCFFA7nRi7Z4cY506nXdI/5qaUXQ1vmxuqcNAFtTiank7YRccRvOCAEpv6iQGtK4HMn+huEUTQ6OqYYPF6WyCKByWFx5DggEuxQFbtx57M5UmgzNUk7LCM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=T9xdZq3D; 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="T9xdZq3D" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2A28AC4CEF7; Wed, 4 Feb 2026 14:58:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1770217136; bh=f6Gl/4T4RxLlCimGiMWEZpM2ckll4uPOQw2wHDj2Jh0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=T9xdZq3DhVFhQ2FJKsmsKkzx6HSoy41lGHD+itfLUHxSmSJG2gvqT2kctCUW4UMKY wlPtkY/V9Fge23goHNNJlKDjXMxTi9WXujYoJsb+Fzq5SO98puSO2Lwz42yPG/2rIR eZZzl52ZEUKkS+WEguO9ZvcURdgKCuZxQ/rnA7ww= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Andrey Vatoropin , Jakub Kicinski , Sasha Levin Subject: [PATCH 5.15 101/206] be2net: Fix NULL pointer dereference in be_cmd_get_mac_from_list Date: Wed, 4 Feb 2026 15:38:52 +0100 Message-ID: <20260204143901.849705069@linuxfoundation.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260204143858.193781818@linuxfoundation.org> References: <20260204143858.193781818@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 5.15-stable review patch. If anyone has any objections, please let me know. ------------------ From: Andrey Vatoropin [ Upstream commit 8215794403d264739cc676668087512950b2ff31 ] When the parameter pmac_id_valid argument of be_cmd_get_mac_from_list() is set to false, the driver may request the PMAC_ID from the firmware of the network card, and this function will store that PMAC_ID at the provided address pmac_id. This is the contract of this function. However, there is a location within the driver where both pmac_id_valid == false and pmac_id == NULL are being passed. This could result in dereferencing a NULL pointer. To resolve this issue, it is necessary to pass the address of a stub variable to the function. Fixes: 95046b927a54 ("be2net: refactor MAC-addr setup code") Signed-off-by: Andrey Vatoropin Link: https://patch.msgid.link/20260120113734.20193-1-a.vatoropin@crpt.ru Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin --- drivers/net/ethernet/emulex/benet/be_cmds.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/emulex/benet/be_cmds.c b/drivers/net/ethernet/emulex/benet/be_cmds.c index 96a8749cf34fb..92ee82d4b18f1 100644 --- a/drivers/net/ethernet/emulex/benet/be_cmds.c +++ b/drivers/net/ethernet/emulex/benet/be_cmds.c @@ -3796,6 +3796,7 @@ int be_cmd_get_perm_mac(struct be_adapter *adapter, u8 *mac) { int status; bool pmac_valid = false; + u32 pmac_id; eth_zero_addr(mac); @@ -3808,7 +3809,7 @@ int be_cmd_get_perm_mac(struct be_adapter *adapter, u8 *mac) adapter->if_handle, 0); } else { status = be_cmd_get_mac_from_list(adapter, mac, &pmac_valid, - NULL, adapter->if_handle, 0); + &pmac_id, adapter->if_handle, 0); } return status; -- 2.51.0