From patchwork Wed Sep 6 15:01:01 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?UTF-8?q?Javier=20Gonz=C3=A1lez?= X-Patchwork-Id: 9940971 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 85E5C60216 for ; Wed, 6 Sep 2017 15:03:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 79B1028501 for ; Wed, 6 Sep 2017 15:03:20 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6EA9C28C13; Wed, 6 Sep 2017 15:03:20 +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=-6.4 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM 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 0A0C628501 for ; Wed, 6 Sep 2017 15:03:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932730AbdIFPDT (ORCPT ); Wed, 6 Sep 2017 11:03:19 -0400 Received: from mail-wm0-f45.google.com ([74.125.82.45]:36805 "EHLO mail-wm0-f45.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932650AbdIFPBP (ORCPT ); Wed, 6 Sep 2017 11:01:15 -0400 Received: by mail-wm0-f45.google.com with SMTP id i145so30539409wmf.1 for ; Wed, 06 Sep 2017 08:01:15 -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=ixGk3x1mi5iCMXLphlttL0HUxMkZA0Ooq01uLT/ohUU=; b=zgqBW1NUzfdSssFvhT6KHi7umGh3Puxvf6qV9K5DY8Hv/BdFB8NLycjgYSuGIGMV72 pkRUxiKKYpdUjyMjbItVaqfsB3UhYz9ImuFZ9jIehCkXUeBEc4dz9tdINbdnhvAOt2Wz Res/EsPdEo3F69nvBqVy5OP4K+hnpsu/GZnBUm2r70KAIpF0MIic4619FgRtKpSrQ8/0 e5anMlyl4W3U2LBStVwiLlW6L0WPpoUm7QHNRH4GF6PWwV6NPKOi410cOJ7W/aRYFpuj Yqjrrc4kC7HNBaugB+0JNz/XOf5LppczEMFzPo7lciet0vgI8MXSXPl3hHFVX3u/ayNz cGRA== 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=ixGk3x1mi5iCMXLphlttL0HUxMkZA0Ooq01uLT/ohUU=; b=kDKD/Ju6nBIUrcdBAB8fK0O8iAme6o0DUtNJQjY4BJ2QDinyCybzfryjhcQOWLeG5S rgd9K3gUWX0AE5qP4R4qi42utfLCVa9xzw5pdZWwE5tUi8+zZipVEl5//GFjv6cW7/XS iL9cdifF6kQCfY8xcmhJ61ieHceOvmdReEvXFHHwsBYRDKxmKSnP3+PmSWnbgjJ7z8bL w1mmffPScfM10G09jG321S7LvN5r8Tu4N2ZHV1GUp+eZt5IddeJVPcfmchzgJMYoanir byJ5WNkC/bpm5/qlFEqI6TfLp7Mn5u0umAkmBg2UKR8jzxE6UFAApFxP2M4ZYLIFXxKL mMnA== X-Gm-Message-State: AHPjjUgPmDzTScWr/bZzv6Rcg1C32OIgOuKSZLMWUN+ePC2l/W9WOsv8 tBDtBveHUdEE7Wf3 X-Google-Smtp-Source: ADKCNb6zjCOpBMuOtmkaOXldDpoqTZMHKrbtNO4erCk++YGoHf6i5UerGieoMuL6AY5Cmk3wujA0UQ== X-Received: by 10.80.137.227 with SMTP id h32mr46213edh.70.1504710074517; Wed, 06 Sep 2017 08:01:14 -0700 (PDT) Received: from uHalley.cnexlabs.com (6164211-cl69.boa.fiberby.dk. [193.106.164.211]) by smtp.gmail.com with ESMTPSA id p16sm1408260eda.78.2017.09.06.08.01.13 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 06 Sep 2017 08:01:13 -0700 (PDT) From: "=?UTF-8?q?Javier=20Gonz=C3=A1lez?=" X-Google-Original-From: =?UTF-8?q?Javier=20Gonz=C3=A1lez?= To: mb@lightnvm.io, axboe@fb.com Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, =?UTF-8?q?Javier=20Gonz=C3=A1lez?= , =?UTF-8?q?Matias=20Bj=C3=B8rling?= Subject: [PATCH 1/6] lightnvm: pblk: check for failed mempool alloc. Date: Wed, 6 Sep 2017 17:01:01 +0200 Message-Id: <1504710066-4699-2-git-send-email-javier@cnexlabs.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1504710066-4699-1-git-send-email-javier@cnexlabs.com> References: <1504710066-4699-1-git-send-email-javier@cnexlabs.com> 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 Check for failed mempool allocations and act accordingly. Signed-off-by: Javier González Signed-off-by: Matias Bjørling --- drivers/lightnvm/pblk-core.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/lightnvm/pblk-core.c b/drivers/lightnvm/pblk-core.c index 81501644fb15..acb07bbcb416 100644 --- a/drivers/lightnvm/pblk-core.c +++ b/drivers/lightnvm/pblk-core.c @@ -165,6 +165,8 @@ struct nvm_rq *pblk_alloc_rqd(struct pblk *pblk, int rw) } rqd = mempool_alloc(pool, GFP_KERNEL); + if (!rqd) + return NULL; memset(rqd, 0, rq_size); return rqd; @@ -1478,6 +1480,8 @@ int pblk_blk_erase_async(struct pblk *pblk, struct ppa_addr ppa) int err; rqd = mempool_alloc(pblk->g_rq_pool, GFP_KERNEL); + if (!rqd) + return -ENOMEM; memset(rqd, 0, pblk_g_rq_size); pblk_setup_e_rq(pblk, rqd, ppa);