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 EE52D2B9C7; Sun, 1 Sep 2024 16:37:29 +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=1725208650; cv=none; b=Bjlo4o4HGtn2vDjZU0wTuo0OmAx0vRjUisI5Rvozy6Ki7DLO9Ngz4svzT87+97AHfGJfvz+b5LtjIpPL3354uFDveqeSo73YN/mOkXeayBRVuW35TxPz3bhzInZ1cgvFGXTA8Gvd+abWzDpDl5+x6SsnmuHVGBLREqoNWOz6OA0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725208650; c=relaxed/simple; bh=yBRDzq/eVsrf5+o12vAJG7uPCKk+GAnblzMk3cEW4hg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=LOxJx5F62aFrBhE3Oaq+oLfHimnKe4spWf1nZVAvfDz8Wf3GI5S8LhxTfJOkJUQm5sc2VVtd5i5HqJTLpU+Zz8Xucc0Nffx7hMzHnhQSFBmoRdzavsbrUl2oS99PCLfjfqUUH8Rtayn8ewi1q2+uvUjtIHtHo3BoLAfL4yI3aPI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=sBi1XB0G; 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="sBi1XB0G" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 61F95C4CEC3; Sun, 1 Sep 2024 16:37:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1725208649; bh=yBRDzq/eVsrf5+o12vAJG7uPCKk+GAnblzMk3cEW4hg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sBi1XB0Ge8V5LpoxU/Alffw5/3xHLu0tEUUE1FAdaIvYiu6z6Pe2pXxBZj4x7lFV9 oV524MMf7LuS5qfFJhFDdOQH/jQwO9cnbOC0jldWetEO4m44U082jLI/BCIgz17CcR 3hlT/c6J2ncqP58LO37jNKhxFxSGzD+E1fFxYgvk= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Michael Gordon , Ben Hutchings , "Martin K. Petersen" , Sasha Levin Subject: [PATCH 6.10 147/149] scsi: aacraid: Fix double-free on probe failure Date: Sun, 1 Sep 2024 18:17:38 +0200 Message-ID: <20240901160822.974505544@linuxfoundation.org> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20240901160817.461957599@linuxfoundation.org> References: <20240901160817.461957599@linuxfoundation.org> User-Agent: quilt/0.67 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 6.10-stable review patch. If anyone has any objections, please let me know. ------------------ From: Ben Hutchings [ Upstream commit 919ddf8336f0b84c0453bac583808c9f165a85c2 ] aac_probe_one() calls hardware-specific init functions through the aac_driver_ident::init pointer, all of which eventually call down to aac_init_adapter(). If aac_init_adapter() fails after allocating memory for aac_dev::queues, it frees the memory but does not clear that member. After the hardware-specific init function returns an error, aac_probe_one() goes down an error path that frees the memory pointed to by aac_dev::queues, resulting.in a double-free. Reported-by: Michael Gordon Link: https://bugs.debian.org/1075855 Fixes: 8e0c5ebde82b ("[SCSI] aacraid: Newer adapter communication iterface support") Signed-off-by: Ben Hutchings Link: https://lore.kernel.org/r/ZsZvfqlQMveoL5KQ@decadent.org.uk Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin --- drivers/scsi/aacraid/comminit.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/scsi/aacraid/comminit.c b/drivers/scsi/aacraid/comminit.c index bd99c5492b7d4..0f64b02443037 100644 --- a/drivers/scsi/aacraid/comminit.c +++ b/drivers/scsi/aacraid/comminit.c @@ -642,6 +642,7 @@ struct aac_dev *aac_init_adapter(struct aac_dev *dev) if (aac_comm_init(dev)<0){ kfree(dev->queues); + dev->queues = NULL; return NULL; } /* @@ -649,6 +650,7 @@ struct aac_dev *aac_init_adapter(struct aac_dev *dev) */ if (aac_fib_setup(dev) < 0) { kfree(dev->queues); + dev->queues = NULL; return NULL; } -- 2.43.0