Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp701233pxb; Tue, 5 Apr 2022 19:23:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwfaK+fQR3KhpsEaXpQqcIY7KPVXLT5lINONH4MXfYM5dewrzgZdYxOAX7wLeDj20HVwc5P X-Received: by 2002:a05:6a00:1304:b0:4e1:2338:f11e with SMTP id j4-20020a056a00130400b004e12338f11emr6530936pfu.24.1649211815231; Tue, 05 Apr 2022 19:23:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649211815; cv=none; d=google.com; s=arc-20160816; b=yAQEecirira1IRA2a7EG9W78/xBsDFtmzWlN7Iu8+bC5EkTepOis5HE+wc/dF+frt5 Cblj6SrhLKIFZkAjenf4aXmGJji62g8Z66kE1tUVClj71rFCjkpRhFZX9Ch1sqCtfTsf GxuGP8+9bRf+7NtuHyqZHENlikcuAZxyOzDEOPKanFG5AN+xl09KzRSKhRi4ljBpoUhT 6bKwXFUlMEoyFY1gBgtUUro/VsuiWkIowtVNS71ZSGFGYqLlyg8/qhltpO4pOFIPHLm0 hFwxUJNcJ/QZHPcGZ2Kx2IBnGyd7mrUyc8js35aPhwm1vNtmqo2W/FJwov4TAlK8Mq6C qs2w== 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=/E3pUm6D9mo8XhWie8bRRc+QW7ghkLBCBPi6Gm+MW2E=; b=T9jkTGZKP6XFc3jIBHLERD/aiuFBMiv/UyPInsdug7kZYyoJJC5mtZrTP05Wt3WNCG KJFstEpGadHwSXGK32SVM16k2ASFyYct4+dT87Ow1KSAWCmCHN/jwIkbX6WMN4VDnEza UWbKEn6PlDf1IBMiCTFuKS8zQSwi05FP1KaKrQxCpGbyT5Vp7DJCWtfhAZLc6Kt88xVP 01TgIx7I8J0bArUn73lOKxUjSLqkEVEb0p226cIcPR+NWU1DjvmUUzr5RYq9vpBJZqRP J64GRqxgeXGT/0RcYref6sGxr/mKapaRz5CGk8Da6TkYoiY6jXYVF+AAHcEEaH3WYVb0 D3sw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="L//RP/nJ"; 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 rj2-20020a17090b3e8200b001bedf1f3526si3833146pjb.146.2022.04.05.19.23.18; Tue, 05 Apr 2022 19:23:35 -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="L//RP/nJ"; 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 S1350096AbiDEKvI (ORCPT + 99 others); Tue, 5 Apr 2022 06:51:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52938 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240318AbiDEIbw (ORCPT ); Tue, 5 Apr 2022 04:31:52 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 781871E3C3; Tue, 5 Apr 2022 01:23:52 -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 sin.source.kernel.org (Postfix) with ESMTPS id 66B01CE1BE1; Tue, 5 Apr 2022 08:23:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 84179C385A6; Tue, 5 Apr 2022 08:23:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1649147020; bh=fkdUwpUrG/jDE4fqN8T3sCJjs6KYzmzagCalEt+f5gQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=L//RP/nJub/511zRELgtiVp+p6PHEWqNFSEHcjPI64Ov9B69aArn8NucRNqAGZaVu P1leS1b5t+mIt6bSydnE51Z+YiA9fCoHKUFoPt5nZReA0hFgNmwt18USQQxNd/l5G9 e5LsjeyU1umMAaFYmevLvGBY+rrIegi01XPB8CGU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Himanshu Madhani , Quinn Tran , Nilesh Javali , "Martin K. Petersen" Subject: [PATCH 5.17 0974/1126] scsi: qla2xxx: Fix scheduling while atomic Date: Tue, 5 Apr 2022 09:28:41 +0200 Message-Id: <20220405070436.092818735@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220405070407.513532867@linuxfoundation.org> References: <20220405070407.513532867@linuxfoundation.org> User-Agent: quilt/0.66 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: Quinn Tran commit afd438ff874ca40b74321b3fa19bd61adfd7ca0c upstream. The driver makes a call into midlayer (fc_remote_port_delete) which can put the thread to sleep. The thread that originates the call is in interrupt context. The combination of the two trigger a crash. Schedule the call in non-interrupt context where it is more safe. kernel: BUG: scheduling while atomic: swapper/7/0/0x00010000 kernel: Call Trace: kernel: kernel: dump_stack+0x66/0x81 kernel: __schedule_bug.cold.90+0x5/0x1d kernel: __schedule+0x7af/0x960 kernel: schedule+0x28/0x80 kernel: schedule_timeout+0x26d/0x3b0 kernel: wait_for_completion+0xb4/0x140 kernel: ? wake_up_q+0x70/0x70 kernel: __wait_rcu_gp+0x12c/0x160 kernel: ? sdev_evt_alloc+0xc0/0x180 [scsi_mod] kernel: synchronize_sched+0x6c/0x80 kernel: ? call_rcu_bh+0x20/0x20 kernel: ? __bpf_trace_rcu_invoke_callback+0x10/0x10 kernel: sdev_evt_alloc+0xfd/0x180 [scsi_mod] kernel: starget_for_each_device+0x85/0xb0 [scsi_mod] kernel: ? scsi_init_io+0x360/0x3d0 [scsi_mod] kernel: scsi_init_io+0x388/0x3d0 [scsi_mod] kernel: device_for_each_child+0x54/0x90 kernel: fc_remote_port_delete+0x70/0xe0 [scsi_transport_fc] kernel: qla2x00_schedule_rport_del+0x62/0xf0 [qla2xxx] kernel: qla2x00_mark_device_lost+0x9c/0xd0 [qla2xxx] kernel: qla24xx_handle_plogi_done_event+0x55f/0x570 [qla2xxx] kernel: qla2x00_async_login_sp_done+0xd2/0x100 [qla2xxx] kernel: qla24xx_logio_entry+0x13a/0x3c0 [qla2xxx] kernel: qla24xx_process_response_queue+0x306/0x400 [qla2xxx] kernel: qla24xx_msix_rsp_q+0x3f/0xb0 [qla2xxx] kernel: __handle_irq_event_percpu+0x40/0x180 kernel: handle_irq_event_percpu+0x30/0x80 kernel: handle_irq_event+0x36/0x60 Link: https://lore.kernel.org/r/20220110050218.3958-7-njavali@marvell.com Cc: stable@vger.kernel.org Reviewed-by: Himanshu Madhani Signed-off-by: Quinn Tran Signed-off-by: Nilesh Javali Signed-off-by: Martin K. Petersen Signed-off-by: Greg Kroah-Hartman --- drivers/scsi/qla2xxx/qla_init.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) --- a/drivers/scsi/qla2xxx/qla_init.c +++ b/drivers/scsi/qla2xxx/qla_init.c @@ -2231,12 +2231,7 @@ qla24xx_handle_plogi_done_event(struct s ql_dbg(ql_dbg_disc, vha, 0x20eb, "%s %d %8phC cmd error %x\n", __func__, __LINE__, ea->fcport->port_name, ea->data[1]); - ea->fcport->flags &= ~FCF_ASYNC_SENT; - qla2x00_set_fcport_disc_state(ea->fcport, DSC_LOGIN_FAILED); - if (ea->data[1] & QLA_LOGIO_LOGIN_RETRIED) - set_bit(RELOGIN_NEEDED, &vha->dpc_flags); - else - qla2x00_mark_device_lost(vha, ea->fcport, 1); + qlt_schedule_sess_for_deletion(ea->fcport); break; case MBS_LOOP_ID_USED: /* data[1] = IO PARAM 1 = nport ID */