From patchwork Fri Apr 15 12:42:29 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chesnokov Gleb X-Patchwork-Id: 562995 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 45602C433F5 for ; Fri, 15 Apr 2022 12:43:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1353747AbiDOMqJ (ORCPT ); Fri, 15 Apr 2022 08:46:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47688 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1353766AbiDOMqI (ORCPT ); Fri, 15 Apr 2022 08:46:08 -0400 Received: from smtp.digdes.com (smtp.digdes.com [85.114.5.12]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 94AC8C90C7 for ; Fri, 15 Apr 2022 05:43:38 -0700 (PDT) Received: from DDSM-MAIL01.digdes.com (172.16.100.67) by mail.digdes.com (172.16.96.60) with Microsoft SMTP Server (TLS) id 14.3.498.0; Fri, 15 Apr 2022 15:42:31 +0300 Received: from DDSM-MAIL01.digdes.com (172.16.100.67) by DDSM-MAIL01.digdes.com (172.16.100.67) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.12; Fri, 15 Apr 2022 15:42:31 +0300 Received: from smtp.digdes.com (172.16.96.24) by DDSM-MAIL01.digdes.com (172.16.100.67) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.1.2375.12 via Frontend Transport; Fri, 15 Apr 2022 15:42:31 +0300 Received: from EUR05-VI1-obe.outbound.protection.outlook.com (104.47.17.173) by relay.digdes.com (172.16.96.24) with Microsoft SMTP Server (TLS) id 14.3.498.0; Fri, 15 Apr 2022 15:42:31 +0300 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UTHDSfJXEd+ZF6NrQODP61Je0dnjay2ZpwvJNkErUwMR2QUaqvYlRW7ZIVUH/1GrONhO/td7ymOpkt1MGW3tdg/WUuFfk+mJ1m94ApVmHg7FtHNpoTP1nNsnLitxL8JZ0wTUA7o5csN/DWJa+t03nvK6M0PQ0j2ylfKiFHl1q/UVfKJ14akFc/lnEjLll2IKDvAUfEwOjOY2+NtKphKlvnoe/CHtB0pFC8k3Ish5f0gNxez6rBVcXtuDXhVudewF1syD7F6/UCbG4EXyehP921oMCcl3SIOZuJ5uFUoe2A46qi9JmafzKhKQLlSGn0l8to9wLb6nmcfCJdqDDpb3BA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=jwnsXjghJMriGNJ40ms1bvXOK0icnKT0if3Ux0OEVwM=; b=jTL5uEFStLeSFwjRRj0CcQytGsbyzt4kmyIQemCoiSOdgB8K6kdXxMMHwq7+cOYy9C8TgG/1lkPhgaUEecngeBCbufuC/NrjCm/0WflaxXd00bBWZ86pnPnA5JGiYbJQAu6vVHy178Ya9Wnq20I197erSYXGLZ3bB5m8nZLMGCQZw0VqJK7ng1HYmbs61FIKxzJCqXoc+q3dwR0uZU2cWiWqzLM4k+FkslbdDLdni3OZjCYMCVqLVcoXcmAwfT7DPsZ27w4t9tqzRIcaHYaZghSYk/j8ZB4027U0kYAOoGj4/xZDG7bpsCfJ1SbyGbQ8H7XVrT5e2tyKex8PYz8DEA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=raidix.com; dmarc=pass action=none header.from=raidix.com; dkim=pass header.d=raidix.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=digdes.onmicrosoft.com; s=selector2-digdes-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=jwnsXjghJMriGNJ40ms1bvXOK0icnKT0if3Ux0OEVwM=; b=l3hzL5XbohdO3Fy8S123QQTj/1DhuvY6tDeyY0J2picNf0lBESxRWtO1CQ84xRNOZthzBrCSDBjhG4fOF10q5/KsK0qHyi76vpBiwg1fW/2dUsrvdg0JdR9GQDsVWxaGjnEaol/a185nIKDjy+df9KDlgBXi5DTLWvdG9MCES2s= Received: from AS8PR10MB4952.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:20b:403::6) by AS8PR10MB4519.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:20b:2e2::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5144.22; Fri, 15 Apr 2022 12:42:29 +0000 Received: from AS8PR10MB4952.EURPRD10.PROD.OUTLOOK.COM ([fe80::74ca:aa66:a112:d987]) by AS8PR10MB4952.EURPRD10.PROD.OUTLOOK.COM ([fe80::74ca:aa66:a112:d987%3]) with mapi id 15.20.5164.020; Fri, 15 Apr 2022 12:42:29 +0000 From: Chesnokov Gleb To: "linux-scsi@vger.kernel.org" Subject: [PATCH 2/2] qla2xxx: Fix missed DMA unmap for aborted cmds Thread-Topic: [PATCH 2/2] qla2xxx: Fix missed DMA unmap for aborted cmds Thread-Index: AQHYUMYtkLBbKidY90SJACyXGZHZ2A== Date: Fri, 15 Apr 2022 12:42:29 +0000 Message-ID: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: suggested_attachment_session_id: c0caa8e8-5278-c7bb-7451-4ffacdaec45d authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=raidix.com; x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 449a68fe-b835-4be5-31b4-08da1edd6780 x-ms-traffictypediagnostic: AS8PR10MB4519:EE_ x-microsoft-antispam-prvs: x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: gmCIbQoGnEiQrAaNcJSdSYjDjGnHXZjbIH5KNtaLNN1On1DtIOrbtqE/ngZKdHBep/FT/bNXU+Y7qnz8fTFbJ96ITqt3TXp0UcxdkjkEyvfn0Trh62Oh373qKJi/BVBa/ZAmha5HNgjHR3ql1bdVoPEVZT3f2vP/DKJixu3ZQyto4sUMwxBNpPvdhllCBhR66ChzzMotMqGxZFTD7a4paKiZE7tqR+ouv1mfZjBa+BUxgiqbR85AnaULaDNhWKHFIDZTNLhJ5mi0sJAsOSdbF3Tpe221AcXU6kI8IbPKYX75DKFvjn0WuNSAp7V+cab8CfXkAlEcSvCQLCT0Tv1lRu0wPoAkvz9a2uRBl1yMDAWdnB6/gRoGip9E0qczsw9T/9PJ3NnIQgpInycNiIiaeXTWsf1k0qXR5bR9Lppl4kuJNFB+jSioGpTkd3dUZHU008NbGqGTMpb5SoGg2T3uqVw+Peoc5d3sARAPcC9F4k6le2rDTdE2q1RS7DmJTwS0MddwCK/9xmEBAI8KHoNVJIvQc31hAySQj4X87Kncm4oOBN48VSFBvFdYsrvLvMHFaV9KoxTsX2lLCox72m8cbHHjhlpvOJ1e8HVU7oK1HurMriSg2C4t7/m0Y3WVcF/zR/7372J12J2gkBH3vfWboQS6lRtdkR5QyDl6tPgHgCQBP/4NbADYWpfVeuFtsG1FY2My2cRKFF879+a+B/ox+w== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AS8PR10MB4952.EURPRD10.PROD.OUTLOOK.COM; PTR:; CAT:NONE; SFS:(13230001)(4636009)(366004)(64756008)(66946007)(76116006)(9686003)(2906002)(38070700005)(122000001)(71200400001)(33656002)(55016003)(8936002)(316002)(186003)(5660300002)(52536014)(7696005)(66446008)(26005)(66476007)(8676002)(66556008)(83380400001)(6506007)(91956017)(6916009)(38100700002)(508600001)(86362001); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?iso-8859-1?q?NInTtHrOM1JZIM1jce6zFcV?= =?iso-8859-1?q?ah10jNeoYmcOyhWzXA2jQEdU8qe+FxdLmrEddj+vvqTWHll6ExMaZRKX6qhW?= =?iso-8859-1?q?TGWpH0BTp2buHzAUMdRp8ZAnddW90O6mQyoYL0GvvoGCwJVH37BD+Ti8z8X8?= =?iso-8859-1?q?FqLE58AwlBCx/8MMx+CahzLEJ1z/id4uvZrlc512QB+wFQhWqbd6Cu+OVUcA?= =?iso-8859-1?q?P49g7NLXFGr5t+8OBzNIAGixNOlQIGgfBMUccZhme5sVac4YupGIu4zlXMaF?= =?iso-8859-1?q?cjThR+9r+BlSYq9Dcm1ULlUOCSZ1Wbl57y/RHMzVGTtA/+6KROxI5kKWiNda?= =?iso-8859-1?q?sNBfLmAhS+Zou9uqa9zcvAcyUJ+cRwcWER7zHNjZh/PVyRpEgkV7XWFHuLY6?= =?iso-8859-1?q?P3B7srjRx5IFRdjAwArulyYcB7IBOqj3p0Q3DcooeaNSmJeHTnhQPy3uoQhT?= =?iso-8859-1?q?Ok/udE20GwVnDyIMtggUVyVOwlRhkLaicEhgS13mPavyrUbqdSF0rNFGEzJy?= =?iso-8859-1?q?3L2H3qIw4BqQvs4fJZwqEPDaEbA4GebUf7jkXEjfrZ7WoEacyAgHrEWRkC78?= =?iso-8859-1?q?fy42RITnrJzuiM2sHZ9aUet6Sy0OPzk1yvOXLihVI+QZcsbLhyf2LJokxKOK?= =?iso-8859-1?q?4z7ZUU90RAWDc072I614iUAtbzwX/asXCKc29QnayAFKQr3X61BcfgcLClwO?= =?iso-8859-1?q?YtlbSEF/Ai12Toca3FUPm68/b8pl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?= =?iso-8859-1?q?Gt2aMWFYWl4ki6mkn9ZBla5cV7v8D2bCK/4LK897y+kBBwmT3wKAMgRRjBvf?= =?iso-8859-1?q?BG+UM6hRyE2cEw7gxAbsyScpJ/OG+P2Nqm/ggHJudfkJkOvCv2AA7qqHAaBT?= =?iso-8859-1?q?w5W4o1pi+F+MkdTlo9AzUdCipjpDxMqZ4Dlaw7mSXD3S4ZQ=3D=3D?= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: AS8PR10MB4952.EURPRD10.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-Network-Message-Id: 449a68fe-b835-4be5-31b4-08da1edd6780 X-MS-Exchange-CrossTenant-originalarrivaltime: 15 Apr 2022 12:42:29.8781 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 70c55e28-9cd7-4753-937e-c751128a9d38 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: wbCXgTD2R5nuy4TZiooK8cdskzl6ySnsPX/+nSYltSn6+6TeIMyhpvetyxMfa6XmhpBoMMdl+5ixNP/HTeZWsA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR10MB4519 X-OriginatorOrg: raidix.com Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Aborting commands that have already been sent to the firmware can cause BUG in qlt_free_cmd(): BUG_ON(cmd->sg_mapped) For instance: - command passes rdx_to_xfer state, maps sgl, sends to the fimware - reset occurs, qla2xxx performs ISP error recovery, aborts the command - target stack calls qlt_abort_cmd() and then qlt_free_cmd() - BUG_ON(cmd->sg_mapped) in qlt_free_cmd() occurs because sgl was not unmapped Thus, unmap sgl in qlt_abort_cmd() for commands with the aborted flag set. Signed-off-by: Gleb Chesnokov Reviewed-by: Himanshu Madhani --- drivers/scsi/qla2xxx/qla_target.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/scsi/qla2xxx/qla_target.c b/drivers/scsi/qla2xxx/qla_target.c index 2d30578aebcf..a02235a6a8e9 100644 --- a/drivers/scsi/qla2xxx/qla_target.c +++ b/drivers/scsi/qla2xxx/qla_target.c @@ -3826,6 +3826,9 @@ int qlt_abort_cmd(struct qla_tgt_cmd *cmd) spin_lock_irqsave(&cmd->cmd_lock, flags); if (cmd->aborted) { + if (cmd->sg_mapped) + qlt_unmap_sg(vha, cmd); + spin_unlock_irqrestore(&cmd->cmd_lock, flags); /* * It's normal to see 2 calls in this path: