From patchwork Wed Apr 17 21:44:23 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 10906219 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 8E5621390 for ; Wed, 17 Apr 2019 21:45:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7AD6028A93 for ; Wed, 17 Apr 2019 21:45:15 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6F53728BAA; Wed, 17 Apr 2019 21:45:15 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 21BA628A93 for ; Wed, 17 Apr 2019 21:45:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387931AbfDQVpN (ORCPT ); Wed, 17 Apr 2019 17:45:13 -0400 Received: from mail-pg1-f193.google.com ([209.85.215.193]:43396 "EHLO mail-pg1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387928AbfDQVpM (ORCPT ); Wed, 17 Apr 2019 17:45:12 -0400 Received: by mail-pg1-f193.google.com with SMTP id z9so141254pgu.10 for ; Wed, 17 Apr 2019 14:45:11 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=G+W1R4QhuYvCkvm9QmQ0c7+um7CKrbU5VKvEfoFqdko=; b=tVgtaHK3lO+OrP8igDOGXaIoHHZNIouIOuYRRsyEJTAityImsK8PuZPr49UJk12Zit RBtSBsgKT5CcdK2pV/W6o6dSaBMe/xPTFb7R5jbLCG/h9kbCq6ROEtksFSdUyWqd67Nf boeZSk/rX7+3r8GZBS5pJvTOd7946nW0We3p0/WKM8GvNI9pPyY56fX0jwSLjdb4EYVb b4RW8Sd8Ugbt9klnpSRA408/G8Cz/Wd0GW9w/DvXDD135TZDfOIsvdTVS0IFlsQ7d7rN O7vlNFYZxoeIotPYNTqZAQIWU4ztMlTQlg5jzEadqtWtKBUhF3awPww6RjSeLm7XMkGU U3Dw== X-Gm-Message-State: APjAAAVQSeFn8kJqQjcK2eAVzT9srH6F7aWpNZxA+axSTjuhOWZKgx5h VG+dZKcUUxiun4zeYOqOklcgH0uw X-Google-Smtp-Source: APXvYqxzxCAgi1KbN3zuzYgEC3AyuQPVoWM+/J+uuEhZha+FxnyOsLInteUJOiMa62MrmAHEhb4lug== X-Received: by 2002:a65:5682:: with SMTP id v2mr86278429pgs.100.1555537511521; Wed, 17 Apr 2019 14:45:11 -0700 (PDT) Received: from desktop-bart.svl.corp.google.com ([2620:15c:2cd:203:5cdc:422c:7b28:ebb5]) by smtp.gmail.com with ESMTPSA id d68sm219314pfg.16.2019.04.17.14.45.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 17 Apr 2019 14:45:10 -0700 (PDT) From: Bart Van Assche To: "Martin K . Petersen" , "James E . J . Bottomley" Cc: linux-scsi@vger.kernel.org, Christoph Hellwig , Bart Van Assche , Himanshu Madhani , Giridhar Malavali Subject: [PATCH 14/34] qla2xxx: Avoid that qla2x00_mem_free() crashes if called twice Date: Wed, 17 Apr 2019 14:44:23 -0700 Message-Id: <20190417214443.243152-15-bvanassche@acm.org> X-Mailer: git-send-email 2.20.GIT In-Reply-To: <20190417214443.243152-1-bvanassche@acm.org> References: <20190417214443.243152-1-bvanassche@acm.org> MIME-Version: 1.0 Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Clear each pointer after having freed memory such that it becomes safe to call qla2x00_mem_free() twice. Cc: Himanshu Madhani Cc: Giridhar Malavali Signed-off-by: Bart Van Assche --- drivers/scsi/qla2xxx/qla_os.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c index b90eed1c989e..6d5dfe12760e 100644 --- a/drivers/scsi/qla2xxx/qla_os.c +++ b/drivers/scsi/qla2xxx/qla_os.c @@ -4715,6 +4715,8 @@ qla2x00_mem_free(struct qla_hw_data *ha) if (ha->flt) dma_free_coherent(&ha->pdev->dev, SFP_DEV_SIZE, ha->flt, ha->flt_dma); + ha->flt = NULL; + ha->flt_dma = 0; if (ha->ms_iocb) dma_pool_free(ha->s_dma_pool, ha->ms_iocb, ha->ms_iocb_dma); @@ -4790,6 +4792,7 @@ qla2x00_mem_free(struct qla_hw_data *ha) if (ha->dif_bundl_pool) dma_pool_destroy(ha->dif_bundl_pool); + ha->dif_bundl_pool = NULL; qlt_mem_free(ha);