Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3578818pxb; Mon, 24 Jan 2022 12:41:08 -0800 (PST) X-Google-Smtp-Source: ABdhPJyMrB0HEJNWGZmbvYdNvksqzah1nwq7qMR48dh1mcYcGJFcX1tpHZ/ppVTp783O55oE0JjW X-Received: by 2002:a17:90a:1fcf:: with SMTP id z15mr77433pjz.185.1643056868713; Mon, 24 Jan 2022 12:41:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643056868; cv=none; d=google.com; s=arc-20160816; b=fhA7ykPDohGvHd/61TJVY9m0ne7hSM+zoAhTj/CNDCmSXvU7yP/kxHCTfk864sunPy Ax1p3rWidD7xcKZcH3mZhDOz3+88gdbY3L51YjrwyRuZE2Yxx783ku3FRCFTaNTNhU4/ pdmUQ6hq00H9L3Ck0tV7as9Z+nddm8LaYPlSHMUjYY/PsnCXlLc/nnwqi6tqPMwLVL98 BrwFzxlkZctHo7wcJOXSC5R32HJM4EbQcK/7I0M96EogXG40m1zT8oy12uM0nND/bzil 9yrYcGZ3FQwBhfZ0E5pFG9qQm4gro6NWyI+yNRbl9FB3RQyoZiFfQbTLQJRAwU+WRNHZ 9wQQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=5okQNdf2DLt+h5lohrVoVCZetYyOeEm4G7BHeNDlDnQ=; b=JEKfKuKBYBuHILdOy2cBGoeb4GNo2kjRLPJG4oMdW0EbQQWQYPfsO75Wx5xNeqB/C3 o6I1BdaGKwek/B3mfSzS2FE0QhKP5waMe05T9xI5LI2DHFDckEHzHmcLZS7bgrstVzKP b0yXmZfNYjjm6me3ZU0mIjG3r1tufxs05vTDSbyQvAWFsmHPvfZcbPmA4y6HvNBVT58W 3VdaGIC/rfFdrkLR4MeDmPCDdSwB3HKNhOnSZxaKTwzYZw7VB41sh4sUT28YqHD3MsmC /pVhhsuKWM2yNio6ZRkopX+FELm+MdvJwMMDShz6OXidy89gcCAG/2mjiTa+lEEdrktW 7Dmw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=gUpzveh7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z3si7760783plg.361.2022.01.24.12.40.54; Mon, 24 Jan 2022 12:41:08 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=gUpzveh7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1358831AbiAXTzx (ORCPT + 99 others); Mon, 24 Jan 2022 14:55:53 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:37778 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1355335AbiAXTkc (ORCPT ); Mon, 24 Jan 2022 14:40:32 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 9A14F6135E; Mon, 24 Jan 2022 19:40:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7C863C340E5; Mon, 24 Jan 2022 19:40:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053230; bh=o4vXwjtGO5bckZbOzF25uhyLz3mbp8Clz6bUC0ZiGSE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gUpzveh7nC8uOE/NkthwF7fMpdZJWvJ6fslIRb5vFAZ6ho408ZQgGpsfn+nroDBL1 y5Cm8pneoEDB3GR1KD4YHNegtwTQ9z5BPLCq/SO/J7NEAQ+NW14VsAG6HNLgERRbay zPtrCIm/PK5cSI7362awXwwrbzNM43QchJ6//Gq4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Patrick Doyle , Richard Weinberger , Yoshio Furuyama , Miquel Raynal , Frieder Schrempf Subject: [PATCH 5.4 319/320] mtd: nand: bbt: Fix corner case in bad block table handling Date: Mon, 24 Jan 2022 19:45:03 +0100 Message-Id: <20220124184004.787407516@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Doyle, Patrick commit fd0d8d85f7230052e638a56d1bfea170c488e6bc upstream. In the unlikely event that both blocks 10 and 11 are marked as bad (on a 32 bit machine), then the process of marking block 10 as bad stomps on cached entry for block 11. There are (of course) other examples. Signed-off-by: Patrick Doyle Reviewed-by: Richard Weinberger Signed-off-by: Yoshio Furuyama [: Fixed the title] Signed-off-by: Miquel Raynal Cc: Frieder Schrempf Link: https://lore.kernel.org/linux-mtd/774a92693f311e7de01e5935e720a179fb1b2468.1616635406.git.ytc-mb-yfuruyama7@kioxia.com Signed-off-by: Greg Kroah-Hartman --- drivers/mtd/nand/bbt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/mtd/nand/bbt.c +++ b/drivers/mtd/nand/bbt.c @@ -123,7 +123,7 @@ int nanddev_bbt_set_block_status(struct unsigned int rbits = bits_per_block + offs - BITS_PER_LONG; pos[1] &= ~GENMASK(rbits - 1, 0); - pos[1] |= val >> rbits; + pos[1] |= val >> (bits_per_block - rbits); } return 0;