Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp629216pxb; Tue, 5 Apr 2022 16:31:54 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxXrVOHkj6Cen2UhmaVYr5aQygPr4HvjUJoYwyLbhkfg+7anl2ek34yHG/9wrUJ9tyF99PO X-Received: by 2002:a17:903:32c7:b0:156:b536:2fc2 with SMTP id i7-20020a17090332c700b00156b5362fc2mr5581854plr.173.1649201514108; Tue, 05 Apr 2022 16:31:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649201514; cv=none; d=google.com; s=arc-20160816; b=Pnun91zZKFtB+bBVkXoI1Y7ImCSWiiiCZI6xcKukDDZYjVEjQmdoFbCs5aCiy8aNIc UFBEOf5lFJ8goDJVGTzb17PsmWmldr2b6rQRH3noz+WbH5kdi2Bg3ayRZG/T7HZk8hK+ R4tZjUqwDh7fsiEPSc/x745HRAZON7TZHVvAzN6pTIBMdAqYAf0a6JY20atT7oZJATZD 85olVP7mw40yweUP16KVPzKtpu8tEst1QXP69RI/pfnIWoMMMUH8ABu8tYj06SViQLqS OFPHqLfhzx4UHCBZl6Q2XKFDx+9cuGt8j0JZSzCX9PZaIBM9ZGtJlApHNFltpi533HIa gEIQ== 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=dhxGjiZbYF4ww420QAqqoQ+Qu+wRGfVCJGebFMHXVInG1qitkozfJPB2awt03wxTUR H2SaU2pLToL6QzIdUIb6S2FXoBd4LW0KtCC7b+U6798XRodXw+sHj2InK7WcMfgAgPxy ebMDU3kjqgaIhkfG6gL98rjSdSaWkZcSm3uREa/eImqnWJCnUzwDpmd/PDItdykvItlV CVxYohfbwU+wZJbFeUIF501U9sksppmh5WZDGw8IacBsInpisY09jFF7UrJUVbjnx1/e MXxYwi0QC/V7MJ9YKGNeybmUee2Fumxhy0FjdhEW6zn3l8fv37240X+aakwyeU6VPUix ++Ew== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=GNtNH8Bd; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id r18-20020a170902be1200b00153b2d1646asi13012699pls.114.2022.04.05.16.31.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Apr 2022 16:31:54 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=GNtNH8Bd; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email [IPv6:2620:137:e000::1:20]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 36231BD7EE; Tue, 5 Apr 2022 16:16:21 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1389111AbiDENdW (ORCPT + 99 others); Tue, 5 Apr 2022 09:33:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60100 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346329AbiDEJXo (ORCPT ); Tue, 5 Apr 2022 05:23:44 -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 15445D95FF; Tue, 5 Apr 2022 02:13:17 -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 98E7AB81C6F; Tue, 5 Apr 2022 09:13:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D1AE6C385A0; Tue, 5 Apr 2022 09:13:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1649149995; bh=fkdUwpUrG/jDE4fqN8T3sCJjs6KYzmzagCalEt+f5gQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GNtNH8BdvNsmWvY+2NU3G8yy6tvO5Wr5Y0iBW7vrg6/LFYbGd4QiO5FUaZTluZxyn Wjzr1GavbO8D4I/K/hYRsAzLU8reDmtCxYzKYLWmUr0tEUb6mAazgCxqIE37crJmzE Z+XTBzIGAU9L7KgUXyE66Wv40xkQOuietAJo99Bc= 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.16 0879/1017] scsi: qla2xxx: Fix scheduling while atomic Date: Tue, 5 Apr 2022 09:29:52 +0200 Message-Id: <20220405070420.326520567@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220405070354.155796697@linuxfoundation.org> References: <20220405070354.155796697@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=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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 */