From patchwork Tue Oct 9 11:12:13 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Matias Bjorling X-Patchwork-Id: 10632279 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 3C2DA112B for ; Tue, 9 Oct 2018 11:16:00 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1966F28A5E for ; Tue, 9 Oct 2018 11:16:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0C7A528A69; Tue, 9 Oct 2018 11:16:00 +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 A507028A6F for ; Tue, 9 Oct 2018 11:15:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727195AbeJIScH (ORCPT ); Tue, 9 Oct 2018 14:32:07 -0400 Received: from mail-pl1-f182.google.com ([209.85.214.182]:33175 "EHLO mail-pl1-f182.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726770AbeJIScH (ORCPT ); Tue, 9 Oct 2018 14:32:07 -0400 Received: by mail-pl1-f182.google.com with SMTP id s4-v6so681755plp.0 for ; Tue, 09 Oct 2018 04:15:40 -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=evQI4Gz4N8LGWm/76tEq/RRDa+8TbPgOzrAOKpZRfSY=; b=Yua7By9oBlyrE3lwY42J8LxDLRkesDbinzmZIrYjAuZGiXC4gsyd+32GMqvvEet5Z/ 8C8iQR4sAcYMpnOH3hJCMAxZ7L4dNX1CvMfU+jpvgjN20GDKZp9yfX6KGc1a2Fajxxzj sEZLJpY4h7l+7AjFF+L2i8RTVP/Wu221lE14aqE60CmWmMp88vAWwzAMvUzbuize01V3 8OGRgaGod7isXKHsHxRFfgiDLO6C6nnyNSFWLMSr554JRmC35EYSN8+F1AcYSpH930f2 4usy4GaCMqtjj9dou45pT3/OHL2KoItd96XEtVACwldkVVGCOKjUN9O5Qo9/u4xOqC5X txQg== 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=evQI4Gz4N8LGWm/76tEq/RRDa+8TbPgOzrAOKpZRfSY=; b=XFe9JyU1yyqseczH97wuYe5UoVLQU0t0Ir1yXoe+O7bJE6ECOqvQsZ9f65GJC392P+ l4tP+6U4h1tcVWmz4tMWKuc6ceDxYrpI/1Yb/XQFgR4okvjTdn8ie+hfWambLN2Zulh7 mg3MAq/9V/026yVrJ7ZYyD22LyjLsx/LsQFIpy366QBocaRZET3wo+NHD8LJDi7P0WHy 6OTYu52kyjrDWgFIdtBf5MGQuEad5/FXtJU3Vjh6Gvct8xJvOCQv8cNVOARoHExuBEw0 1xTS6MpTp/s1aUXJuJnLLrzTNLGmJFsClxlYQcXqYc3jyYlq73LyjPiA0UkX2BSiqXTU YaUw== X-Gm-Message-State: ABuFfohQ/1ZMzhjYZPb9FFsZ16k4NcgVdZam5X3IN/Iso/YWsf891lfn tcmR/ak12JSn0o/180VYqqXiKA== X-Google-Smtp-Source: ACcGV63JUHc3kDom5OnydYjGTzS4fQod6Qt65dkYArTPeA+hWnMnCZKTa5DsM/37BtWj4bkGPXVrAQ== X-Received: by 2002:a17:902:5a89:: with SMTP id r9-v6mr27885290pli.95.1539083740029; Tue, 09 Oct 2018 04:15:40 -0700 (PDT) Received: from skyninja.hgst.com (rap-us.hgst.com. [199.255.44.250]) by smtp.gmail.com with ESMTPSA id p1-v6sm25342380pff.128.2018.10.09.04.15.36 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 09 Oct 2018 04:15:38 -0700 (PDT) From: =?utf-8?q?Matias_Bj=C3=B8rling?= To: axboe@fb.com Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, Wei Yongjun , =?utf-8?q?Matias_Bj=C3=B8rling?= Subject: [GIT PULL 43/45] lightnvm: pblk: fix error handling of pblk_lines_init() Date: Tue, 9 Oct 2018 13:12:13 +0200 Message-Id: <20181009111215.7653-44-mb@lightnvm.io> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181009111215.7653-1-mb@lightnvm.io> References: <20181009111215.7653-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: Wei Yongjun In the too many bad blocks error handling case, we should release all the allocated resources, otherwise it will cause memory leak. Fixes: 2deeefc02dff ("lightnvm: pblk: fail gracefully on line alloc. failure") Signed-off-by: Wei Yongjun Reviewed-by: Hans Holmberg Signed-off-by: Matias Bjørling --- drivers/lightnvm/pblk-init.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/lightnvm/pblk-init.c b/drivers/lightnvm/pblk-init.c index e0db0cb3122d..e3573880dbda 100644 --- a/drivers/lightnvm/pblk-init.c +++ b/drivers/lightnvm/pblk-init.c @@ -1024,7 +1024,8 @@ static int pblk_lines_init(struct pblk *pblk) if (!nr_free_chks) { pblk_err(pblk, "too many bad blocks prevent for sane instance\n"); - return -EINTR; + ret = -EINTR; + goto fail_free_lines; } pblk_set_provision(pblk, nr_free_chks);