Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp1680958rwb; Sun, 14 Aug 2022 09:23:25 -0700 (PDT) X-Google-Smtp-Source: AA6agR7fN89NGub290OcZrRHn02Mf3PEwOr/Htsn8GKBnENxh1XHPTWZZMkEQBWZpmYuZ6i+1BL8 X-Received: by 2002:a63:d84f:0:b0:428:ee87:3769 with SMTP id k15-20020a63d84f000000b00428ee873769mr1404741pgj.212.1660494205129; Sun, 14 Aug 2022 09:23:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660494205; cv=none; d=google.com; s=arc-20160816; b=yCZcL0xRV0t3RBWHXdoLLZjK9kgsGH627g8/ZOm2YN59ar7JFbgSRG/iCJfifODE7W YIkgcqV47W4WNULDlFgCOqBiYtARBMpUn/71T32/7ptf6JtkmvdPdui/l5AvEq/cf8mh VtI0U0jnM9FMj++7s/rLi0cLlEXS0cx34ErIcz8wRAAIOMkXcawT5K3g2Owa1rB8sFyp jGJ7d37ocPfFJH8n7ATGGcwuFQ0hBQYg9uGluqsFWxdmj3GdVpeHPU21YcP63me/A8Vc UEPaRUm9OB//pT1XYFLfmJjnUIBLQ/TA6k8B4KKSHPuz0L5L8WV1228joBv+zHDOtCaf a1fw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=5aRyD3PtdloBUTAoFKEPlxT38xa8KkBOfOe6je1Z9iY=; b=X9p0NJBLFQ4HAmRG00oBytFYILob0QbT9APCAPp1LpQC2QM2KTHqnJ3xHhTkvoPYuk GGXWiFSvL7qBUPsfxvgW6q0DDPI4fSsCpDioRQe2tbzabnxnBsWLji/rxkqlcLGViZE8 aZqCeKREhAQAs2SRTQa1TXbJFAeeDh5TKqEQ6n4LC6Za4ENjeqal+Kn7RlHV6c1jSWmM +IGIATR7qBzdVVw2SOSdOoa49mUI0fBgLYB3SCkpyg4ZyPDlNEyrPaCeCbLRMOhvHkQV EQSxhEQU4qYgC3kHp4PpGk4H97N8kWeHl4M7kD5NwPzK+l5vcvro0XahCtcwfcIaSPLW LFCA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="rY/r9Frv"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l19-20020a63f313000000b0041af9b92fb9si8354975pgh.520.2022.08.14.09.23.14; Sun, 14 Aug 2022 09:23:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="rY/r9Frv"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240416AbiHNP3e (ORCPT + 99 others); Sun, 14 Aug 2022 11:29:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37950 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240067AbiHNP2m (ORCPT ); Sun, 14 Aug 2022 11:28:42 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 685D2AE7A; Sun, 14 Aug 2022 08:28:41 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id F3C0360C05; Sun, 14 Aug 2022 15:28:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4FD36C433D7; Sun, 14 Aug 2022 15:28:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1660490920; bh=mr9tRLqQ8X+aGtXimse11oHRXOJPJJGTmgtdeuO+DJw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rY/r9FrvBaySEajKV7KlfNFD1OUkXpaCvUdIvASZBHchpQXkK6QbTqudehEWcvzOC m/mBPR1OjsKsM46RVbIHs1JyPtiND9FZw6DrmA4GhG0XK+JxGdJUd4uMcGSQTaXgfa c3sd647nfj4B9yHX/6MIowq/ATSLJ54yXMBondqnmCJxgfgkm4hFvaJ0Ck6srZZ5CR WUx2EJtDda17a4DveeTnOimAOfeBKqACX2vRberNsj8cS0T2IYsmevWVp+yj3T2Pj3 3ESZ8vRI4kUFZ0D6YfOsmG1gYxWKnb9SFTOzn/mEYPUlXT/sGWav3+ZYeAfMkasQzW +aV1HMoDpcv1g== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Mike Christie , Nilesh Javali , Lee Duncan , "Martin K . Petersen" , Sasha Levin , cleech@redhat.com, jejb@linux.ibm.com, open-iscsi@googlegroups.com, linux-scsi@vger.kernel.org Subject: [PATCH AUTOSEL 5.19 22/64] scsi: iscsi: Fix HW conn removal use after free Date: Sun, 14 Aug 2022 11:23:55 -0400 Message-Id: <20220814152437.2374207-22-sashal@kernel.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220814152437.2374207-1-sashal@kernel.org> References: <20220814152437.2374207-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.2 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Mike Christie [ Upstream commit c577ab7ba5f3bf9062db8a58b6e89d4fe370447e ] If qla4xxx doesn't remove the connection before the session, the iSCSI class tries to remove the connection for it. We were doing a iscsi_put_conn() in the iter function which is not needed and will result in a use after free because iscsi_remove_conn() will free the connection. Link: https://lore.kernel.org/r/20220616222738.5722-2-michael.christie@oracle.com Tested-by: Nilesh Javali Reviewed-by: Lee Duncan Reviewed-by: Nilesh Javali Signed-off-by: Mike Christie Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin --- drivers/scsi/scsi_transport_iscsi.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/scsi/scsi_transport_iscsi.c b/drivers/scsi/scsi_transport_iscsi.c index 5d21f07456c6..6e73f14b9749 100644 --- a/drivers/scsi/scsi_transport_iscsi.c +++ b/drivers/scsi/scsi_transport_iscsi.c @@ -2143,8 +2143,6 @@ static int iscsi_iter_destroy_conn_fn(struct device *dev, void *data) return 0; iscsi_remove_conn(iscsi_dev_to_conn(dev)); - iscsi_put_conn(iscsi_dev_to_conn(dev)); - return 0; } -- 2.35.1