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 C4F313B27DD for ; Thu, 28 May 2026 09:58:10 +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=1779962292; cv=none; b=M7UOgta7fLOSNBI14DUYq1jQD6mnBZzEbtDVM2jy5M7bIT29bbnUrp/LdGbb4OAaTTSpORib2N4jzZiZ81nkfaRqAubaLawjWHozHG441tF6QYdNHzf+1EI5+n41fX2fEb7g94bSOOpqEhqAJ3lDUugaT6Eh3C7AfkvYrdzNtzk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779962292; c=relaxed/simple; bh=dl/CzPeaiW4z0F+jqLufMKNo7Lb6yUcIcTzk+ZJ19tU=; h=Subject:To:Cc:From:Date:Message-ID:MIME-Version:Content-Type; b=htcJKESiktYB1t9Uq3ckX3xv3sIli0HY4qaL52m3Fj73VXyh1WjpwGG/JZ0FsS1wCT3g1dplvkf94GhmKgj1wwhD/KJ8QHYvbhpeOZBlTV7f3nFaVOVT33V5UcXqZ5OtsTA8oi/j4VfowbjixWRdj+ZAs/wpGJdRwrPgbL30gUo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=MJjyKduC; 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="MJjyKduC" Received: by smtp.kernel.org (Postfix) with ESMTPSA id D211C1F000E9; Thu, 28 May 2026 09:58:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1779962290; bh=hrn5ilekqt9RmBZQuhHwHbKH/fig2i5dhBtev/ckl6A=; h=Subject:To:Cc:From:Date; b=MJjyKduCXCgZzJAFcD70L2EsN80XQu8XS2z4QP2dyI2lsfMfp1R1gToeF8HCqU8rt 9Pll4tZi1pIVW6gi7pG7F2eFpvSDXWwLRKgWmjtFZ6yEH5fdsXY8QszpA08LhdqwGF SpkoFW+XTpEloYwB9b7pKD0ONaVR95GMEebl0KLg= Subject: FAILED: patch "[PATCH] qed: fix double free in qed_cxt_tables_alloc()" failed to apply to 5.10-stable tree To: dawei.feng@seu.edu.cn,kuba@kernel.org,zilin@seu.edu.cn Cc: From: Date: Thu, 28 May 2026 11:57:09 +0200 Message-ID: <2026052809-snowfall-thermos-6a66@gregkh> Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=ANSI_X3.4-1968 Content-Transfer-Encoding: 8bit The patch below does not apply to the 5.10-stable tree. If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to . To reproduce the conflict and resubmit, you may use the following commands: git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-5.10.y git checkout FETCH_HEAD git cherry-pick -x 2bccfb8476ca5f3548afbd623dc7a6980d4e77de # git commit -s git send-email --to '' --in-reply-to '2026052809-snowfall-thermos-6a66@gregkh' --subject-prefix 'PATCH 5.10.y' HEAD^.. Possible dependencies: thanks, greg k-h ------------------ original commit in Linus's tree ------------------ >From 2bccfb8476ca5f3548afbd623dc7a6980d4e77de Mon Sep 17 00:00:00 2001 From: Dawei Feng Date: Wed, 20 May 2026 15:03:23 +0800 Subject: [PATCH] qed: fix double free in qed_cxt_tables_alloc() If one of the later PF or VF CID bitmap allocations fails, qed_cid_map_alloc() jumps to cid_map_fail and frees the previously allocated CID bitmaps before returning an error. qed_cxt_tables_alloc() then calls qed_cxt_mngr_free(), which invokes qed_cid_map_free() again. Fix this by setting each CID bitmap pointer to NULL after bitmap_free() to avoid double free. The bug was first flagged by an experimental analysis tool we are developing for kernel memory-management bugs while analyzing v6.13-rc1. The tool is still under development and is not yet publicly available. Manual inspection confirms that the bug is still present in v7.1-rc3. Runtime reproduction was not attempted because exercising the failing allocation path requires device-specific setup. Fixes: fe56b9e6a8d9 ("qed: Add module with basic common support") Cc: stable@vger.kernel.org Signed-off-by: Zilin Guan Signed-off-by: Dawei Feng Link: https://patch.msgid.link/20260520070323.2762379-1-dawei.feng@seu.edu.cn Signed-off-by: Jakub Kicinski diff --git a/drivers/net/ethernet/qlogic/qed/qed_cxt.c b/drivers/net/ethernet/qlogic/qed/qed_cxt.c index 9861daa82d9e..b70262e70baf 100644 --- a/drivers/net/ethernet/qlogic/qed/qed_cxt.c +++ b/drivers/net/ethernet/qlogic/qed/qed_cxt.c @@ -1036,11 +1036,13 @@ static void qed_cid_map_free(struct qed_hwfn *p_hwfn) for (type = 0; type < MAX_CONN_TYPES; type++) { bitmap_free(p_mngr->acquired[type].cid_map); + p_mngr->acquired[type].cid_map = NULL; p_mngr->acquired[type].max_count = 0; p_mngr->acquired[type].start_cid = 0; for (vf = 0; vf < MAX_NUM_VFS; vf++) { bitmap_free(p_mngr->acquired_vf[type][vf].cid_map); + p_mngr->acquired_vf[type][vf].cid_map = NULL; p_mngr->acquired_vf[type][vf].max_count = 0; p_mngr->acquired_vf[type][vf].start_cid = 0; }