Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp3449489pxb; Mon, 4 Apr 2022 17:20:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJztW8geu7XYd0ZKeiwdNolzsmfRvaq8zBUbl1vGIDl0UkQ6KxutKmhdtYTFlnlt0h08Tjqm X-Received: by 2002:a17:90a:e2c3:b0:1ca:75b7:63d5 with SMTP id fr3-20020a17090ae2c300b001ca75b763d5mr895624pjb.111.1649118018346; Mon, 04 Apr 2022 17:20:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649118018; cv=none; d=google.com; s=arc-20160816; b=CDhi9sogegDvKzX6wG1dxAkW7WDezeM9Uj6iq+8gVlHEa00bBu2jgali50QboyJUJX 3PoC/HB4bJNpNyIK1ZzMdWR0ZPnndvqv8eelq/WPFXkfX3uTe792qUHZcnFG861WzAv7 nkyIXJgrdLsTr58P4xc7JK5GI7aUSz5ITq5yTA5qXv94sR1o/XHoa2uXJQ5VzR0pqdty ZeolunJXZiCqvmFvbcmlGPKB4u+qXeIotvE1/Uk71icebm7EYfl+PSlQcWGG5yDfwQ+f BJtGFx/2MqD9UIaLfQMR0R99URRyJFIarLBFbZjKDQCz6+D97zz1qpjtJCFTqWEvzHcg FIDg== 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=I/wMKmV39eKVZApYqR+YjeHrK/STpFHZyep6v8uMBNE=; b=UF2gH0zD9omrSDXkQzGGzy4gEV6nE76Uz8PDfuCvzpdzmnvm9gwq9QZ7ObfVeiy1Ax COkvk+tbMwSUsNqfAYJBkxzmZdwBsxd/nloAOHvlQfT59VdAzBppY4n30wTNtBURDdho 4UOMUBgy0JGiOthSWHGcgZyWQHR51H3H56PZLg93kNg6sr1qntYCniTRiPHdAsNwN4O5 6Wj4wr2Y40VBeL2Kbp+Ua/ManxMiUPsML9jeJI63N98w8c6EoU7oDYQfsehZa5ywX/eD c55xNnbf3zCFLm3Qaxk2L9Zn6Exh+iQa32zvZ/D4zYiQl8Pg8mVAQo4cAbBhAd73CE12 G5EQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=TRtNySpJ; 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=kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id t14-20020a17090b018e00b001c6a15fe77bsi585305pjs.51.2022.04.04.17.20.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Apr 2022 17:20:18 -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=@kernel.org header.s=k20201202 header.b=TRtNySpJ; 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=kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 69C3B71A09; Mon, 4 Apr 2022 16:46:25 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347257AbiDAOcp (ORCPT + 99 others); Fri, 1 Apr 2022 10:32:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38538 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347371AbiDAOcE (ORCPT ); Fri, 1 Apr 2022 10:32:04 -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 79949369C2; Fri, 1 Apr 2022 07:28:27 -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 AE83361CB1; Fri, 1 Apr 2022 14:28:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BD111C340EE; Fri, 1 Apr 2022 14:28:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1648823306; bh=DrqH9cql0k3eM6eCKUpNDdtUpEA96OPz/k7Lh2O7sJ4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TRtNySpJ5I0Ba+M+MbBX4kNYoSvLVgEPsGhd+lEM2p30bN+QQoX4rfXtDBX7lgPtA n0vByzbTdwDw7Gm43+0xirRE8dDDezXlsa9niV82XZYrS5MJyWmiVluaj+hJ/2Tvwz fpEe3TUT+ABH1OyhWZwpr2htBg/O4alD8Aww1HIdGqT6qlQqk35Rn1Aiq+VASlFVmy 6DclzpoynA+vMlSEjxZgL3k33E2toZINZKPpYYM7i0VPNAkl8LPgGi4mG7ewx6x3/c BZaXV546c8Ti8bEsTaXhIThDnbYuYvbsvx6uyWuFjzIVpt441K1Niho5ImrcNycZQo Ar2C9lVyRwOKA== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Don Brace , Scott Benesh , Scott Teel , Kevin Barnett , "Martin K . Petersen" , Sasha Levin , jejb@linux.ibm.com, storagedev@microchip.com, linux-scsi@vger.kernel.org Subject: [PATCH AUTOSEL 5.17 049/149] scsi: smartpqi: Fix rmmod stack trace Date: Fri, 1 Apr 2022 10:23:56 -0400 Message-Id: <20220401142536.1948161-49-sashal@kernel.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220401142536.1948161-1-sashal@kernel.org> References: <20220401142536.1948161-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable 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: Don Brace [ Upstream commit c4ff687d25c05919382a759503bd3821689f4e2f ] Prevent "BUG: scheduling while atomic: rmmod" stack trace. Stop setting spin_locks before calling OS functions to remove devices. Link: https://lore.kernel.org/r/164375207296.440833.4996145011193819683.stgit@brunhilda.pdev.net Reviewed-by: Scott Benesh Reviewed-by: Scott Teel Reviewed-by: Kevin Barnett Signed-off-by: Don Brace Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin --- drivers/scsi/smartpqi/smartpqi_init.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/scsi/smartpqi/smartpqi_init.c b/drivers/scsi/smartpqi/smartpqi_init.c index f0897d587454..2db9f874cc51 100644 --- a/drivers/scsi/smartpqi/smartpqi_init.c +++ b/drivers/scsi/smartpqi/smartpqi_init.c @@ -2513,17 +2513,15 @@ static void pqi_remove_all_scsi_devices(struct pqi_ctrl_info *ctrl_info) struct pqi_scsi_dev *device; struct pqi_scsi_dev *next; - spin_lock_irqsave(&ctrl_info->scsi_device_list_lock, flags); - list_for_each_entry_safe(device, next, &ctrl_info->scsi_device_list, scsi_device_list_entry) { if (pqi_is_device_added(device)) pqi_remove_device(ctrl_info, device); + spin_lock_irqsave(&ctrl_info->scsi_device_list_lock, flags); list_del(&device->scsi_device_list_entry); pqi_free_device(device); + spin_unlock_irqrestore(&ctrl_info->scsi_device_list_lock, flags); } - - spin_unlock_irqrestore(&ctrl_info->scsi_device_list_lock, flags); } static int pqi_scan_scsi_devices(struct pqi_ctrl_info *ctrl_info) -- 2.34.1