Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp1610802pxb; Fri, 6 Nov 2020 14:27:44 -0800 (PST) X-Google-Smtp-Source: ABdhPJzuoRlm9Bl05Im1+4u2qHMcTCB7GA1+MWtZsew0QJupV10Lunxf5/TaP9EwQf1RA8pTQidX X-Received: by 2002:a05:6402:170e:: with SMTP id y14mr4285426edu.115.1604701664644; Fri, 06 Nov 2020 14:27:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604701664; cv=none; d=google.com; s=arc-20160816; b=Hz0MajQM8tIIOEYYiF8DlQdVuia4ZPbQAUfsS5sCQRK9+ZeLdQPGMvKbkZxTloXFrz vK92Vz9vNPYk+CQ00g3+alxOCsYJXdU/3NDVncOCWcYHENlH8mlsEaflPn4OAlMIJgcY qA0Dm9OtrUDjaem7jTnFQIm1r91PQKR6+/OSTr43FZmBd6EXWyMJNbkQC/htp75HDWaN exVysATy+0EviU/PAVlgV7OWcAnjHiok9fsyUKMeuR3J5y4rvW/YfTyh/Wn8rFsu4JFN nv8s/AwPHq9qYwgrgalkSKOUSU5oVHpO1BNx34fPaahB7EYw7+z4eEWq5sS08E4yfRnc tzjQ== 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:date:cc:to:from:subject:message-id:dkim-signature :dkim-signature; bh=bjNU4Px6C35vF/rnAJHS1qTkuFRFQs0q7AqHt5BvvuQ=; b=XfKNJPAwEtlZd762sCyOWWqAIFBVtBIBIXrtb3pfzxMq48rKQ32X7KNYTb7Wu4mY+e VSV9NOjwzm8Y7TQX9lk7MBRVit1/U2QKZqPhkZHJ47fBTn/exRBWDRk4PSy3gEex1Wza 3wr7DyDwXCmeWwKeLVlRWfqXqs34bqmvR5BMOjIjOjOn2LEqMIscd6klbYZNdSHLm7H5 Sm/UcddoO1d/u42Pecgdb1kZXbHPtRZO5X4ePGjpHpOTr4+ngNXexeXuQF6coqJhgAZD Fa1dOixtZgMEKlbriaAu+Kk1ZK/1/gR3W+MAgVoYc1pdacHjB5bRCcUb+rfIDsz5hBZG m89w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@hansenpartnership.com header.s=20151216 header.b=scKvWdzI; dkim=pass header.i=@hansenpartnership.com header.s=20151216 header.b=scKvWdzI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=hansenpartnership.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g18si1930971edh.40.2020.11.06.14.27.21; Fri, 06 Nov 2020 14:27:44 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@hansenpartnership.com header.s=20151216 header.b=scKvWdzI; dkim=pass header.i=@hansenpartnership.com header.s=20151216 header.b=scKvWdzI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=hansenpartnership.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728821AbgKFW0H (ORCPT + 99 others); Fri, 6 Nov 2020 17:26:07 -0500 Received: from bedivere.hansenpartnership.com ([96.44.175.130]:48732 "EHLO bedivere.hansenpartnership.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728482AbgKFW0H (ORCPT ); Fri, 6 Nov 2020 17:26:07 -0500 Received: from localhost (localhost [127.0.0.1]) by bedivere.hansenpartnership.com (Postfix) with ESMTP id 8B02712803E5; Fri, 6 Nov 2020 14:26:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=hansenpartnership.com; s=20151216; t=1604701566; bh=UOouGRZVfPPrkFoBKImXA/neRmAkbXmdMwxFyJVL7u4=; h=Message-ID:Subject:From:To:Date:From; b=scKvWdzIjPLsqAHIxEaCm602YQgcETDIATJ+mvW9BgANqr+3BWPHEVnwWkLflkXUz yqCOMAk2tDl1Gt2R016u4KxbQplzoUhOorEPFZL7+W0e1yt7x4h+3tJiell5Jc4E/2 BQt8XBAF/9UTssqdw3JT9N+AW7SKsscpitxnymio= Received: from bedivere.hansenpartnership.com ([127.0.0.1]) by localhost (bedivere.hansenpartnership.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Dy0DS38CLrMq; Fri, 6 Nov 2020 14:26:06 -0800 (PST) Received: from jarvis.int.hansenpartnership.com (unknown [IPv6:2601:600:8280:66d1::527]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bedivere.hansenpartnership.com (Postfix) with ESMTPSA id 2EFAD1280386; Fri, 6 Nov 2020 14:26:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=hansenpartnership.com; s=20151216; t=1604701566; bh=UOouGRZVfPPrkFoBKImXA/neRmAkbXmdMwxFyJVL7u4=; h=Message-ID:Subject:From:To:Date:From; b=scKvWdzIjPLsqAHIxEaCm602YQgcETDIATJ+mvW9BgANqr+3BWPHEVnwWkLflkXUz yqCOMAk2tDl1Gt2R016u4KxbQplzoUhOorEPFZL7+W0e1yt7x4h+3tJiell5Jc4E/2 BQt8XBAF/9UTssqdw3JT9N+AW7SKsscpitxnymio= Message-ID: <8a60c7bd72f908a637f0f9e60cce7ab3a047e343.camel@HansenPartnership.com> Subject: [GIT PULL] SCSI fixes for 5.10-rc2 From: James Bottomley To: Andrew Morton , Linus Torvalds Cc: linux-scsi , linux-kernel Date: Fri, 06 Nov 2020 14:26:05 -0800 Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.34.4 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Three driver fixes. Two (alua and hpsa) are in hard to trigger attach/detach situations but the mp3sas one involves a polled to interrupt switch over that could trigger in any high IOPS situation. The patch is available here: git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi.git scsi-fixes The short changelog is: Hannes Reinecke (1): scsi: scsi_dh_alua: Avoid crash during alua_bus_detach() Keita Suzuki (1): scsi: hpsa: Fix memory leak in hpsa_init_one() Sreekanth Reddy (1): scsi: mpt3sas: Fix timeouts observed while reenabling IRQ And the diffstat: drivers/scsi/device_handler/scsi_dh_alua.c | 9 +++++---- drivers/scsi/hpsa.c | 4 +++- drivers/scsi/mpt3sas/mpt3sas_base.c | 7 +++++++ 3 files changed, 15 insertions(+), 5 deletions(-) With full diff below. James --- diff --git a/drivers/scsi/device_handler/scsi_dh_alua.c b/drivers/scsi/device_handler/scsi_dh_alua.c index f32da0ca529e..308bda2e9c00 100644 --- a/drivers/scsi/device_handler/scsi_dh_alua.c +++ b/drivers/scsi/device_handler/scsi_dh_alua.c @@ -658,8 +658,8 @@ static int alua_rtpg(struct scsi_device *sdev, struct alua_port_group *pg) rcu_read_lock(); list_for_each_entry_rcu(h, &tmp_pg->dh_list, node) { - /* h->sdev should always be valid */ - BUG_ON(!h->sdev); + if (!h->sdev) + continue; h->sdev->access_state = desc[0]; } rcu_read_unlock(); @@ -705,7 +705,8 @@ static int alua_rtpg(struct scsi_device *sdev, struct alua_port_group *pg) pg->expiry = 0; rcu_read_lock(); list_for_each_entry_rcu(h, &pg->dh_list, node) { - BUG_ON(!h->sdev); + if (!h->sdev) + continue; h->sdev->access_state = (pg->state & SCSI_ACCESS_STATE_MASK); if (pg->pref) @@ -1147,7 +1148,6 @@ static void alua_bus_detach(struct scsi_device *sdev) spin_lock(&h->pg_lock); pg = rcu_dereference_protected(h->pg, lockdep_is_held(&h->pg_lock)); rcu_assign_pointer(h->pg, NULL); - h->sdev = NULL; spin_unlock(&h->pg_lock); if (pg) { spin_lock_irq(&pg->lock); @@ -1156,6 +1156,7 @@ static void alua_bus_detach(struct scsi_device *sdev) kref_put(&pg->kref, release_port_group); } sdev->handler_data = NULL; + synchronize_rcu(); kfree(h); } diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c index 83ce4f11a589..8df70c92911d 100644 --- a/drivers/scsi/hpsa.c +++ b/drivers/scsi/hpsa.c @@ -8855,7 +8855,7 @@ static int hpsa_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) /* hook into SCSI subsystem */ rc = hpsa_scsi_add_host(h); if (rc) - goto clean7; /* perf, sg, cmd, irq, shost, pci, lu, aer/h */ + goto clean8; /* lastlogicals, perf, sg, cmd, irq, shost, pci, lu, aer/h */ /* Monitor the controller for firmware lockups */ h->heartbeat_sample_interval = HEARTBEAT_SAMPLE_INTERVAL; @@ -8870,6 +8870,8 @@ static int hpsa_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) HPSA_EVENT_MONITOR_INTERVAL); return 0; +clean8: /* lastlogicals, perf, sg, cmd, irq, shost, pci, lu, aer/h */ + kfree(h->lastlogicals); clean7: /* perf, sg, cmd, irq, shost, pci, lu, aer/h */ hpsa_free_performant_mode(h); h->access.set_intr_mask(h, HPSA_INTR_OFF); diff --git a/drivers/scsi/mpt3sas/mpt3sas_base.c b/drivers/scsi/mpt3sas/mpt3sas_base.c index 93230cd1982f..e4cc92bc4d94 100644 --- a/drivers/scsi/mpt3sas/mpt3sas_base.c +++ b/drivers/scsi/mpt3sas/mpt3sas_base.c @@ -1740,6 +1740,13 @@ _base_irqpoll(struct irq_poll *irqpoll, int budget) reply_q->irq_poll_scheduled = false; reply_q->irq_line_enable = true; enable_irq(reply_q->os_irq); + /* + * Go for one more round of processing the + * reply descriptor post queue incase if HBA + * Firmware has posted some reply descriptors + * while reenabling the IRQ. + */ + _base_process_reply_queue(reply_q); } return num_entries;