Received: by 2002:ac0:a591:0:0:0:0:0 with SMTP id m17-v6csp1414588imm; Thu, 5 Jul 2018 22:58:24 -0700 (PDT) X-Google-Smtp-Source: AAOMgpdZrtjQhCH696rbmFvvFHrsKmpG/oHMWJc6mU7dnvgYF/gaQezyyMlTgI8Q4CwhpJhRjvSN X-Received: by 2002:a63:8dca:: with SMTP id z193-v6mr8323498pgd.228.1530856704225; Thu, 05 Jul 2018 22:58:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530856704; cv=none; d=google.com; s=arc-20160816; b=PWSCBVFdQVcflyZhPG1wyctZ/GrHrOTgFYYrIaCilhjzayHA/yaC4B7a4g6H4247bo 43S+jen9S7dlARaU9xgLOgoxHQ20ALKa+Jo/JkHOcKZtQYfzZqU3FcXvZ0nUf2Y09jbV dB0v4/Xk6ta0VMFvfTOCjjfgopzB0sbDlHJGcTJH1nSiq/lwzijtnW6hSRsuO2B1THxR TtDKjptJ3m+280Qa07zmeFohuLzjW/OupuvY09MWvm0YuiTs9Sd7gZPBt9VAtMQ44XbX 4c2dTKFrLzE4/mT9UQvZnDGcG1N2PsSKj70hu+catEhIF0ORK8sU7Zi3Rd/VKI10wROP nOeQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=JoM9+O66jKgw8glVHfu73vdwp1o4dPGINnb06eLkC88=; b=LaEIjQDLmnjNowmncfE1zIdkE3tdM3Jqi1IXcp8n9yP1APn3YIw6Qa1BKVXpsfCeZF A7gsX2pvERxp3lD6n0wdoJaczvdpYkcOMyhEYV0CPQ0MbCFaPRDkJl918pAdTNFV4gRX 8R6gqUo8w7f30ZHVU4GWyLcdZ0NQqvQu1qs5C+9yk7EGZzZfvuBD1qWKgPrswLy6hBCh L9OvFOKhS5fVqSybgnZlk55eNtUNlD6O0lcOeqRLWdnVMyxLiy2x6dB2Z0L1HrcP4c1r 7mI5Sa1DnIIK0w2+EwEudT0ht/IgtsjZLghxVXjjE+E2+pdMo6SB++bmjvV0modR42eH shEQ== 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 c11-v6si7245880plo.271.2018.07.05.22.58.10; Thu, 05 Jul 2018 22:58:24 -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 S934445AbeGFF4S (ORCPT + 99 others); Fri, 6 Jul 2018 01:56:18 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:33534 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934415AbeGFFvt (ORCPT ); Fri, 6 Jul 2018 01:51:49 -0400 Received: from localhost (D57D388D.static.ziggozakelijk.nl [213.125.56.141]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id B211AC3C; Fri, 6 Jul 2018 05:51:48 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Abhishek Sahu , Miquel Raynal , Boris Brezillon Subject: [PATCH 4.14 44/61] mtd: rawnand: fix return value check for bad block status Date: Fri, 6 Jul 2018 07:47:08 +0200 Message-Id: <20180706054714.024064715@linuxfoundation.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180706054712.332416244@linuxfoundation.org> References: <20180706054712.332416244@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Abhishek Sahu commit e9893e6fa932f42c90c4ac5849fa9aa0f0f00a34 upstream. Positive return value from read_oob() is making false BAD blocks. For some of the NAND controllers, OOB bytes will be protected with ECC and read_oob() will return number of bitflips. If there is any bitflip in ECC protected OOB bytes for BAD block status page, then that block is getting treated as BAD. Fixes: c120e75e0e7d ("mtd: nand: use read_oob() instead of cmdfunc() for bad block check") Cc: Signed-off-by: Abhishek Sahu Reviewed-by: Miquel Raynal Signed-off-by: Boris Brezillon [backported to 4.14.y] Signed-off-by: Abhishek Sahu Signed-off-by: Greg Kroah-Hartman --- drivers/mtd/nand/nand_base.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/mtd/nand/nand_base.c +++ b/drivers/mtd/nand/nand_base.c @@ -440,7 +440,7 @@ static int nand_block_bad(struct mtd_inf for (; page < page_end; page++) { res = chip->ecc.read_oob(mtd, chip, page); - if (res) + if (res < 0) return res; bad = chip->oob_poi[chip->badblockpos];