From patchwork Fri Jun 1 14:41:08 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Matias Bjorling X-Patchwork-Id: 10443627 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 B83E9602BD for ; Fri, 1 Jun 2018 14:44:10 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A98DA280CF for ; Fri, 1 Jun 2018 14:44:10 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9E21028946; Fri, 1 Jun 2018 14:44:10 +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 37364280CF for ; Fri, 1 Jun 2018 14:44:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752542AbeFAOoI (ORCPT ); Fri, 1 Jun 2018 10:44:08 -0400 Received: from mail-lf0-f68.google.com ([209.85.215.68]:36529 "EHLO mail-lf0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751554AbeFAOn7 (ORCPT ); Fri, 1 Jun 2018 10:43:59 -0400 Received: by mail-lf0-f68.google.com with SMTP id u4-v6so15206312lff.3 for ; Fri, 01 Jun 2018 07:43:58 -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=EOviyU6qtath0vHxLNbLtPoT2MxDVKCnOE3NV2I3vYQ=; b=BYDaFI8UkGBXXD/8EEhJ0XXK6msKoTsC1j4Xw4eLQPPyRPRo1aarWHeVyvJUCMi6z4 khjLAhlBOknz1TkS46Umc5h2KnK619j99z8UPZDYMqTHuqKopupUxMp39HixSSwx/hcS C6a+nJEz0DMvmdM9A5mkRApqMHyIdk6eRQJbiFDz6hJx8MBv9TP9HN+1sEWN1RvA23GI IckeU7QEw4jbbgJNCj4+tczSnF/cbObdjZOXKx1K8dudJheMvolPpJB9WVrm1Mbsoms1 KzmaKxerVxwAVYtz8HHZaqEY0ogEQCkglgJwvSgOWJwdz5WuGaLYnujeNFhLYLImgurq JMpA== 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=EOviyU6qtath0vHxLNbLtPoT2MxDVKCnOE3NV2I3vYQ=; b=jvjhKNkPoIYnBD5Vj1wT07pXwPrcLZu20tPMtwG1sGpOihpBIHvyPDHOaPr9KZExUE ImlEkNllWQ47ahWBAES4pHyVoWMRnj4K4xsnIR8lyhYmBTLMamp/aN6dfjelt9SdmlU1 xUxNKi98YG8ddnXX8vl9u2t7iBxECQ1oIVO7B+lSYbLfNDGmUE9AM4SGuh/yxzCxTwBi pdvgYDhGuXkHOhu1jIo5jgYqtPLPo/UecLEqhUz9TfUp1iioh5y0k5EGPfIHJPmz+uw8 qwhRvBlrf4OvbmmcB4xt7ey00F+B4gV5STzblNar8RAuYsKKC1sJMmhfa/TcKy76D6Vw Uo6A== X-Gm-Message-State: ALKqPwd3Z1shcq5fbXu2vAYDS9/vBiI5Lu9UXV+Y/HWOSei0hkwb6eCm bdvMQ79ha18ubU1XwZiBOgYOrA== X-Google-Smtp-Source: ADUXVKIJ5usG/nw0b85lPMWW9QikeFo2wDoGbnbjQksQqAznG1viYCqyRXPnrtHsiGuLZedrlG0F5A== X-Received: by 2002:a19:de0a:: with SMTP id v10-v6mr6667781lfg.94.1527864238249; Fri, 01 Jun 2018 07:43:58 -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 e65-v6sm356488lff.13.2018.06.01.07.43.56 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 01 Jun 2018 07:43:57 -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 04/10] lightnvm: proper error handling for pblk_bio_add_pages Date: Fri, 1 Jun 2018 16:41:08 +0200 Message-Id: <20180601144114.17490-5-mb@lightnvm.io> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180601144114.17490-1-mb@lightnvm.io> References: <20180601144114.17490-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 549341b24e3c..99036befb571 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; }