Received: by 2002:a05:6358:5282:b0:b5:90e7:25cb with SMTP id g2csp3413397rwa; Tue, 23 Aug 2022 04:29:40 -0700 (PDT) X-Google-Smtp-Source: AA6agR7D/+96UQbSCIrTQUn74rlQTnSdx8P1Z0V4R1SaGk000X6AMCt7cdvwj1Swtv+QHVpou6b1 X-Received: by 2002:a05:6a00:3406:b0:535:f76f:c971 with SMTP id cn6-20020a056a00340600b00535f76fc971mr22451019pfb.5.1661254092062; Tue, 23 Aug 2022 04:28:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661254092; cv=none; d=google.com; s=arc-20160816; b=dRgY87eVJoEMUMZ/tCAX45zEYpKD/XRz11WGvD/OIK9QXOyLnbe4VpfSwfCpmxZpJf a1BGNFfPpp2hnJAgw0M2gZtgLPfAf3DrwCUyek209EHcWBkxmnaI4Tn3CXmonzmUsqI/ XFQ3pbz2YfXtlqOxUuWArvrYnBr9jusBom0tVnI+gAoTMspeuYDsfqaXSfYjGgc8LQ3P zHzHrkyH+gPdkriRePVe6lECEhPSMndf2swNh5NzdDUcGU102pO8BSOdrpPYiaGZ2VJ2 UZFJRnolxBWaMX+nRgvnp+TFb8LTm7DLrHuy8Gm5zJV94lOZvTBPLaUKyqrEjiAi2qfE wwtQ== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=2JTvtca2nyt/rlfFFbyLcY8Iy/qzolvWF1V0hdfaZzg=; b=ulL40Bd9QIXzNzxEgV8PY+wFkCCwS+iAnq6JgowB5V28NTzBi4mDEAdDB4JqoqgvOC iumr7AMLhnAFZAzCFC33tFHicU1jaDCk2iivsYjSWr2FGzXx1/iF6NSOxlnJCKiuEJ3l PeDoADyKbCZt+ADUj7XFDeVCJ9pzWcWPmJM5dxrn+RpaTNk9kZANIM6IeMrYAuwiZ9NN ENLKaUSWkzR35NT93eFEf4h3ZaR5vyhUw/mH7NwAyC4F3dc86fL3frpMCNs0QnspnVUH xb/gxvoJ8DqLmNPkDHSYvphKOEjmQ79ICILHRQkf08I986F2/hG4uGoxhW/dWaoYqKY7 Z/Dw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=hncDgs3b; 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=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t33-20020a635361000000b004197e33daf5si16641130pgl.863.2022.08.23.04.28.00; Tue, 23 Aug 2022 04:28:12 -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=@linuxfoundation.org header.s=korg header.b=hncDgs3b; 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=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1353994AbiHWKT3 (ORCPT + 99 others); Tue, 23 Aug 2022 06:19:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57828 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352715AbiHWKIf (ORCPT ); Tue, 23 Aug 2022 06:08:35 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D0D696DFA0; Tue, 23 Aug 2022 01:54:43 -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 ams.source.kernel.org (Postfix) with ESMTPS id 30426B81C52; Tue, 23 Aug 2022 08:30:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 94FD6C433C1; Tue, 23 Aug 2022 08:30:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661243435; bh=GeThJzFrqkRHTkXVI2SvRYQqWDZBlcG4+458WQ8cWxY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hncDgs3baYvmwJud0bd57IZ+efjGFk8HeSxa+Ab2Erxvm85WWRz1psl14zfavv5Yg fQaQrl0Y5XphZdEwmADZ5rBboy2EsGyNM465hvzD1/FYSDWQuqOXRBpWPe/pmgFvWb MFDZvHQ6YxOh2ITJVurAHelHBKabr2EojhzSCbQY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Nilesh Javali , Lee Duncan , Mike Christie , "Martin K. Petersen" , Sasha Levin Subject: [PATCH 5.19 277/365] scsi: iscsi: Fix HW conn removal use after free Date: Tue, 23 Aug 2022 10:02:58 +0200 Message-Id: <20220823080129.750454635@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 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 2a38cd2d24ef..02899e8849dd 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