Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3977062pxb; Tue, 25 Jan 2022 00:27:57 -0800 (PST) X-Google-Smtp-Source: ABdhPJx70KHE3M6Bq2nxc+neqJmCjIObBTXdRC0OvzfXGpdSRtEP9kWznPAbQRwyeBADckl2JZ2n X-Received: by 2002:a17:907:86a7:: with SMTP id qa39mr7109374ejc.548.1643099276897; Tue, 25 Jan 2022 00:27:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643099276; cv=none; d=google.com; s=arc-20160816; b=hbO6jVpUJbgsN8TkdptLfRhSdjXGKfIOrKx1T0FdTaB/Xjlc4jjeXL9LN/VdK+AeGk TyvrhGIgMS/3Ja53e7ZVmdCX48IDsDMX4HVxWhhCYSk8yJ0Jy/pcwehrGL2zHRrUA0Hb S42S+V8Jo2ChSQOqPJ/x+3zCMqf+3ExYL5LIOObKs87iWvhBefhgbPSD6hz/QM12mfTQ OtS0bpLfZlw9Rm/cmEv3siFDUbn8WsTixdt0HFeVj8L6wcyflMqyRMlQ4oWFrMksiFsy UAOE00xuol6bcOHS56y8ZVtAGL7vZ3igLed4uqQDtwUKAWgPsJ6DcmGh+3vD8J7f6cHH cVfw== 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=fEkbXgmosHavSxnvxNXEKSNpbFnTS5PmRkwU+/py3z/qjXv8Fvnt33uIlfdnnXQQs4 c4A/ZPXjC8UymqiA3pgg0AEXXSFXhfuzxABTHBYzZnjQ22s9J25tIrG82QGj7Np2XDZc dIr+k7xS7smK8vf/7DCtkwg1NQBq4gibGc1AtC3VHxt67taqHcMC1aM3fZpD7WzKdkq3 PAhZi6MgNlKLoUpYl/RjQbCATdlnLDfeQrLwlEd2RMYnl4KihI+Ouo+sUVyEe4/nd47D 7Na57y1B7dEa8+YvZMreVlQtbf5DvGUIEDT27yz6tXvG9TjWY7XNd5d9B6MLp6uiaA3K nmWA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=m9hPhN6U; 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 n14si10371075edx.94.2022.01.25.00.27.32; Tue, 25 Jan 2022 00:27:56 -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=m9hPhN6U; 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 S3421599AbiAYC1Q (ORCPT + 99 others); Mon, 24 Jan 2022 21:27:16 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57632 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1357626AbiAXTvF (ORCPT ); Mon, 24 Jan 2022 14:51:05 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 46BC4C019B2B; Mon, 24 Jan 2022 11:24:10 -0800 (PST) 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 ams.source.kernel.org (Postfix) with ESMTPS id 0CCF2B81223; Mon, 24 Jan 2022 19:24:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 21941C340E5; Mon, 24 Jan 2022 19:24:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052247; bh=o4vXwjtGO5bckZbOzF25uhyLz3mbp8Clz6bUC0ZiGSE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=m9hPhN6Uv920AUX7Mm1fSy6WYhypYg3PF9t9DvCLWUpT6lWB9nRR63pE2mtFjiy4i qINXOtNtyfiI6q8KmvDBiTqrAwPUeIW+2eZP8Ty5+5FIZU9L6JHrwPylu0ZlBOcaKR iwcriwCW6D36s6jt/I/tr1X1ZGxyDSYxUr/rs5aY= 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 4.19 236/239] mtd: nand: bbt: Fix corner case in bad block table handling Date: Mon, 24 Jan 2022 19:44:34 +0100 Message-Id: <20220124183950.604686824@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183943.102762895@linuxfoundation.org> References: <20220124183943.102762895@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;