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 86AE418A6C4; Tue, 26 Aug 2025 13:24:06 +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=1756214646; cv=none; b=XLljIUmT+MK18iK9LGEUA05gish5ekuEDwGT1oTRcnDXKx5nsO/9hVn4aYDurTHYTiO++2U6kny6rhimSZE70tPxDiLf1m9mDaq1Q+ACZNWfZawiZWwpcSlI7LUEufduwWvwyTGW8Pd83d+nnYU05U08cJUK08TaWDnobdm8sFA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756214646; c=relaxed/simple; bh=KD2z3VgZBT6+wEPMcvL5yHEGq+UICdEeq7NVDsAG+GM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=loYeHZGsSg/4hueMjL2PPnbO973DPaBSWQlouAUENa/IJhqTiBtXW8E0mSsViFwWBK8oxiDDRyE2XVITX6UH35SZqNJ+yeL9wjGZcKW1MhpCV9lILMGppnRTLr1f6/xTUJYOnxvFXbr16VsQtF9WH2xu6UrBr7s/glWHVii/epg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=u7NnqhZL; 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="u7NnqhZL" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 171EFC4CEF1; Tue, 26 Aug 2025 13:24:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1756214646; bh=KD2z3VgZBT6+wEPMcvL5yHEGq+UICdEeq7NVDsAG+GM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=u7NnqhZL7XtHDSSvS+6pXoK75lTOGwcPoiXIj2evgzdR0Yo4OvHZ8mzziuwm8uVnj gG89E6T3fv1JJfFI0dFsGBSbR0K4Y1wwbngsgiPjVBdftzdqrsUqweY/rhYoVAljze B86itIL0N8TibLCyGttWS4GZKgCrgY2Mv8cMXnwA= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, jackysliu <1972843537@qq.com>, "Martin K. Petersen" , Sasha Levin Subject: [PATCH 6.1 185/482] scsi: bfa: Double-free fix Date: Tue, 26 Aug 2025 13:07:18 +0200 Message-ID: <20250826110935.377003290@linuxfoundation.org> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20250826110930.769259449@linuxfoundation.org> References: <20250826110930.769259449@linuxfoundation.org> User-Agent: quilt/0.68 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.1-stable review patch. If anyone has any objections, please let me know. ------------------ From: jackysliu <1972843537@qq.com> [ Upstream commit add4c4850363d7c1b72e8fce9ccb21fdd2cf5dc9 ] When the bfad_im_probe() function fails during initialization, the memory pointed to by bfad->im is freed without setting bfad->im to NULL. Subsequently, during driver uninstallation, when the state machine enters the bfad_sm_stopping state and calls the bfad_im_probe_undo() function, it attempts to free the memory pointed to by bfad->im again, thereby triggering a double-free vulnerability. Set bfad->im to NULL if probing fails. Signed-off-by: jackysliu <1972843537@qq.com> Link: https://lore.kernel.org/r/tencent_3BB950D6D2D470976F55FC879206DE0B9A09@qq.com Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin --- drivers/scsi/bfa/bfad_im.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/scsi/bfa/bfad_im.c b/drivers/scsi/bfa/bfad_im.c index c335f7a188d2..8f2bd0a6a08c 100644 --- a/drivers/scsi/bfa/bfad_im.c +++ b/drivers/scsi/bfa/bfad_im.c @@ -706,6 +706,7 @@ bfad_im_probe(struct bfad_s *bfad) if (bfad_thread_workq(bfad) != BFA_STATUS_OK) { kfree(im); + bfad->im = NULL; return BFA_STATUS_FAILED; } -- 2.39.5