From patchwork Fri Jun 1 13:04:29 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Matias Bjorling X-Patchwork-Id: 10443363 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 9A359602BC for ; Fri, 1 Jun 2018 13:07:31 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 898BB28D90 for ; Fri, 1 Jun 2018 13:07:31 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7DBB528DA3; Fri, 1 Jun 2018 13:07:31 +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,DKIM_SIGNED, DKIM_VALID, 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 233DD28D90 for ; Fri, 1 Jun 2018 13:07:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752064AbeFANH2 (ORCPT ); Fri, 1 Jun 2018 09:07:28 -0400 Received: from mail-lf0-f68.google.com ([209.85.215.68]:42129 "EHLO mail-lf0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752365AbeFANFN (ORCPT ); Fri, 1 Jun 2018 09:05:13 -0400 Received: by mail-lf0-f68.google.com with SMTP id v135-v6so14745018lfa.9 for ; Fri, 01 Jun 2018 06:05:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=lightnvm-io.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=F8a11Omr1nmBsfBGo6FYNv9+oOqlGVF5zUl43Fl6Jkk=; b=1VXWVFnOLPU63Ce7lMEwraZAV+HKOU+O/VmadNzDBvxaOie++iQerf0KXPyN8UCPIw 7gGoaP60RQ1CpN0Awy+OXOLgbUnuCodVqwF3HLt6zqfLpocq7Fnl7B9f1u8V5A6hKiry nArDZ4zgm2scklt2RoCEiUS560r0F6BYtht0mZHFcUYrR/xySJQosIIRaVZ1hSk09bRL 4gO/q0QXnFhjKPpHN3lQsJBkDxj7elOqyEszNvCHJLyspdzSXhMnC9FjjeG59+e3VCkh CzeGwGRUSs0MUbLX2jhAM5CamdZ1zaA40wEWRORnaOK2x1/vl0XbTP2VxdTt8azR8jBL zWUQ== 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=F8a11Omr1nmBsfBGo6FYNv9+oOqlGVF5zUl43Fl6Jkk=; b=BOI5Dpk4oCRgWMwumgRFaTIbxuu6z0TbqVVeku6RQr1Qms07L7SoaK8Xo6KEGXrD9H vyD6tUqr2tzyQ88DAMGfYkZXLZT+VIoYd/SSIdyrAeinWo1B1KNsJcdGGuQZ/db04d1a 2q9+9G2PhDIBFkOBZtmgiYqdonDM47T9hF1bllYjnYRWDhqAr17k6Naxg3tTk/pN7Vp4 DtcIkkZMW+i1Bo6J0GLjKA0apbuc8GOx37D1DezTbc58jl9Rzuq2vHMBqlCP5c4QEU3z Ooigm7qTBnXkU+GSM2buLMKY5gwDV4ATq16agJzY6fG5gUhRqzSXdqJLaHTwcf2hu4MG rs0w== X-Gm-Message-State: ALKqPweBlA85nON0/8jIn8OLKAB3jJlWafUZFR6q/Ml/KpRx/HyGNwJO p14Igfga7rtqShxLc4YgVIvbRg== X-Google-Smtp-Source: ADUXVKIBhUqJVB/a1ZuSzQGF9yg9YdhVgh9BRzupEyCFvPSwAjtX+ESreyd5T3niKtt9H5CnHjOcQQ== X-Received: by 2002:a19:949d:: with SMTP id o29-v6mr7206089lfk.56.1527858312498; Fri, 01 Jun 2018 06:05:12 -0700 (PDT) Received: from Macroninja.cnexlabs.com (95-166-82-66-cable.dk.customer.tdc.net. [95.166.82.66]) by smtp.gmail.com with ESMTPSA id g5-v6sm303161lje.21.2018.06.01.06.05.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 01 Jun 2018 06:05:11 -0700 (PDT) From: =?UTF-8?q?Matias=20Bj=C3=B8rling?= To: axboe@fb.com Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, javier@cnexlabs.com, igor.j.konopko@intel.com, marcin.dziegielewski@intel.com, =?UTF-8?q?Matias=20Bj=C3=B8rling?= Subject: [GIT PULL 15/18] lightnvm: proper error handling for pblk_bio_add_pages Date: Fri, 1 Jun 2018 15:04:29 +0200 Message-Id: <20180601130432.30866-16-mb@lightnvm.io> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180601130432.30866-1-mb@lightnvm.io> References: <20180601130432.30866-1-mb@lightnvm.io> MIME-Version: 1.0 Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Igor Konopko Currently in case of error caused by bio_pc_add_page in pblk_bio_add_pages two issues occur when calling from pblk_rb_read_to_bio(). First one is in pblk_bio_free_pages, since we are trying to free pages not allocated from our mempool. Second one is the warn from dma_pool_free, that we are trying to free NULL pointer dma. This commit fix both issues. Signed-off-by: Igor Konopko Signed-off-by: Marcin Dziegielewski Signed-off-by: Matias Bjørling --- drivers/lightnvm/pblk-core.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/lightnvm/pblk-core.c b/drivers/lightnvm/pblk-core.c index e43093e27084..a20b41c355c5 100644 --- a/drivers/lightnvm/pblk-core.c +++ b/drivers/lightnvm/pblk-core.c @@ -278,7 +278,9 @@ void pblk_free_rqd(struct pblk *pblk, struct nvm_rq *rqd, int type) return; } - nvm_dev_dma_free(dev->parent, rqd->meta_list, rqd->dma_meta_list); + if (rqd->meta_list) + nvm_dev_dma_free(dev->parent, rqd->meta_list, + rqd->dma_meta_list); mempool_free(rqd, pool); } @@ -316,7 +318,7 @@ int pblk_bio_add_pages(struct pblk *pblk, struct bio *bio, gfp_t flags, return 0; err: - pblk_bio_free_pages(pblk, bio, 0, i - 1); + pblk_bio_free_pages(pblk, bio, (bio->bi_vcnt - i), i); return -1; }