Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp2331443imm; Thu, 7 Jun 2018 08:55:35 -0700 (PDT) X-Google-Smtp-Source: ADUXVKIwQyTVpTZdg4Q4W4hI+0BTBooAQB+ki0K4U9vcv34dZF8PLEUOBHQtd9COWdB6NF+ihxfu X-Received: by 2002:a62:da59:: with SMTP id w25-v6mr2273585pfl.161.1528386935589; Thu, 07 Jun 2018 08:55:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528386935; cv=none; d=google.com; s=arc-20160816; b=o8HA4Ze0XreZEVYm11VBNWQeKxrtmMlY9QtzJEmGxZs2HaUbIfgFJXLNVZoZUzwZN+ aB5ILplXcffeUss3S2+C1zmu564oUk5EFtYDzBgDRX5aDZi8bhF12EHLnVuWiSGxqIRh 4X8on97oZDnYU74Evy40gXzZ1he+hu5cOPDODwhAFPQBf4WsyMKG4wWlqhU2WymYvcEt +rl3QWyt0pkPzQSiTWtMV9AH9PxLcqnzNkgCEGu76YZ4BBE1ngHCHUu96qrIhf8sZthw gIYv3AsItcvTYr4HiAS3/2CnKH2V+5bRxwfTyYXoHqb6a3gY5c3KwMcHbfQ8RyoyDnDU TR2Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:subject:message-id:date:cc:to :from:mime-version:content-transfer-encoding:content-disposition :arc-authentication-results; bh=7JXySbqar3e6n9z2WdIy0nYz8tlNm9yuH4COhC83WLI=; b=T6vyjCCoW+aw3OBmriwQyIekvEgliLXAudeTgbJ/WYwwcNcgfNTtzO9nWIw6pABo/Y P944/C0BJVhBInnCZnvzYvz0x+hu4SLkYub/0QqeK3vsM4l07Sa7HlALY/47NqD6kSLo y/3tn+6nsohF/FVXOVNrBP73LyEoGkl7CUMkIfvf/B/Jp/vQqmBxLOUlgxI4y3zIWwOV w7Z+JxEX22YM0qxSdNucDKvxPfVpJhL2zslsyjocGN8GA8MvZ0ePGCxAuVXrR+usKPGx A4Sx0kL82qLq/3OwekoTjCc/+Sd3vlE4Oi/7lEXqJyBZVXOsbzIED7Munmy8xT3/lAXX 9Qsw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v14-v6si5214427pgq.146.2018.06.07.08.55.21; Thu, 07 Jun 2018 08:55:35 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934188AbeFGPyW (ORCPT + 99 others); Thu, 7 Jun 2018 11:54:22 -0400 Received: from shadbolt.e.decadent.org.uk ([88.96.1.126]:40336 "EHLO shadbolt.e.decadent.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933751AbeFGOeH (ORCPT ); Thu, 7 Jun 2018 10:34:07 -0400 Received: from [148.252.241.226] (helo=deadeye) by shadbolt.decadent.org.uk with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1fQvbm-0005Zs-Pt; Thu, 07 Jun 2018 15:09:47 +0100 Received: from ben by deadeye with local (Exim 4.91) (envelope-from ) id 1fQvb3-0002sa-31; Thu, 07 Jun 2018 15:09:01 +0100 Content-Type: text/plain; charset="UTF-8" Content-Disposition: inline Content-Transfer-Encoding: 8bit MIME-Version: 1.0 From: Ben Hutchings To: linux-kernel@vger.kernel.org, stable@vger.kernel.org CC: akpm@linux-foundation.org, "Wei Yongjun" , "Richard Weinberger" , "Boris Brezillon" Date: Thu, 07 Jun 2018 15:05:21 +0100 Message-ID: X-Mailer: LinuxStableQueue (scripts by bwh) Subject: [PATCH 3.16 140/410] mtd: ubi: wl: Fix error return code in ubi_wl_init() In-Reply-To: X-SA-Exim-Connect-IP: 148.252.241.226 X-SA-Exim-Mail-From: ben@decadent.org.uk X-SA-Exim-Scanned: No (on shadbolt.decadent.org.uk); SAEximRunCond expanded to false Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 3.16.57-rc1 review patch. If anyone has any objections, please let me know. ------------------ From: Wei Yongjun commit 7233982ade15eeac05c6f351e8d347406e6bcd2f upstream. Fix to return error code -ENOMEM from the kmem_cache_alloc() error handling case instead of 0, as done elsewhere in this function. Fixes: f78e5623f45b ("ubi: fastmap: Erase outdated anchor PEBs during attach") Signed-off-by: Wei Yongjun Reviewed-by: Boris Brezillon Signed-off-by: Richard Weinberger Signed-off-by: Ben Hutchings --- drivers/mtd/ubi/wl.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) --- a/drivers/mtd/ubi/wl.c +++ b/drivers/mtd/ubi/wl.c @@ -1925,8 +1925,10 @@ int ubi_wl_init(struct ubi_device *ubi, cond_resched(); e = kmem_cache_alloc(ubi_wl_entry_slab, GFP_KERNEL); - if (!e) + if (!e) { + err = -ENOMEM; goto out_free; + } e->pnum = aeb->pnum; e->ec = aeb->ec; @@ -1966,8 +1968,10 @@ int ubi_wl_init(struct ubi_device *ubi, cond_resched(); e = kmem_cache_alloc(ubi_wl_entry_slab, GFP_KERNEL); - if (!e) + if (!e) { + err = -ENOMEM; goto out_free; + } e->pnum = aeb->pnum; e->ec = aeb->ec;