Received: by 2002:a25:e7d8:0:0:0:0:0 with SMTP id e207csp955188ybh; Tue, 10 Mar 2020 11:32:52 -0700 (PDT) X-Google-Smtp-Source: ADFU+vsUXWtbTHr3p2XKkjMWbv1/MAU3TqDnCKS3PGgUq9EbsLsoOqzyTvMuosXVQrD6DT8tmUv9 X-Received: by 2002:a9d:600d:: with SMTP id h13mr12229301otj.213.1583865172217; Tue, 10 Mar 2020 11:32:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1583865172; cv=none; d=google.com; s=arc-20160816; b=T3lWm4BRn1F33+hSzRCarHoKGXjYdQCGmvJ2LonhKeITv+6VJ/u9hp55R1v5m+D2qO bX3vus52r+5CSxOIk7sd0PyDBa80sjVlNLNFLQJK4962lzGOOOXCOBdRxfkBCS/7+MlM GSQRhjmnr4L0RxpOhhbDrEcTW2DoPAc2PRx0eHmB8wH+FvUD/MaoEy84sj9y4LRHuTwp 1olgMWMkw8iEG8HZ/ZzwQY53SirGzf+vjvy/Rv0gXw2xqF0PetqaatTPgDhaGGANZY2/ 5LBcHL8j5ypAS21YPFYbtJwXsWwvbp5q2Yg07HxCMIizw7OJRx880ap391+79n9BQ4jX Q9eQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=2TaOTLqiM4gRs0ieNg3ToB3O3Da/P1S88VMuhMTSom4=; b=tZYyxt/zzDQQW7T1VoRWK8tsGVZSpkCQX7S2cA0nvqJUnqol0BOE/CBTrEMtz5kHnx 3yYqlnptUrH4AzeJWkD5Pnc1F+vIZLl9kIvwaw+HFJ7v3i4IswaTDMYBzXnri29SXjxV rZWtg2wYM29Nz24ZGSox3juR9KIJLhv10lAqxr+ISTk+T4GluIrk5lRrUZovz8Kqgoqi WBUsW2QDSyEiVmXpuZiuKUVJVtpfDnLHTMnqQAH11JTTV5xV1NnCyM2I4IIDHQJCZvNg QvAa+Yxre3egcBokN7iYCnWATOUUQSjuSAZvoncr0UP271lvYuV66YpgIHLo3G9IbQJM SxOA== 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 7si501618oij.97.2020.03.10.11.32.40; Tue, 10 Mar 2020 11:32:52 -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 S1727574AbgCJSbx (ORCPT + 99 others); Tue, 10 Mar 2020 14:31:53 -0400 Received: from relay7-d.mail.gandi.net ([217.70.183.200]:51699 "EHLO relay7-d.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727268AbgCJSbx (ORCPT ); Tue, 10 Mar 2020 14:31:53 -0400 X-Originating-IP: 91.224.148.103 Received: from localhost.localdomain (unknown [91.224.148.103]) (Authenticated sender: miquel.raynal@bootlin.com) by relay7-d.mail.gandi.net (Postfix) with ESMTPSA id 74E9820004; Tue, 10 Mar 2020 18:31:50 +0000 (UTC) From: Miquel Raynal To: Schrempf Frieder , Boris Brezillon , Jeff Kletsky , liaoweixiong , Miquel Raynal Cc: Richard Weinberger , "linux-mtd@lists.infradead.org" , "linux-kernel@vger.kernel.org" , "stable@vger.kernel.org" Subject: Re: [PATCH v3 1/3] mtd: spinand: Stop using spinand->oobbuf for buffering bad block markers Date: Tue, 10 Mar 2020 19:31:49 +0100 Message-Id: <20200310183149.18839-1-miquel.raynal@bootlin.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200218100432.32433-2-frieder.schrempf@kontron.de> References: MIME-Version: 1.0 X-linux-mtd-patch-notification: thanks X-linux-mtd-patch-commit: 683ca5c1668a74c87902e5715b6f15bb5c9f523c Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 2020-02-18 at 10:05:14 UTC, Schrempf Frieder wrote: > From: Frieder Schrempf > > For reading and writing the bad block markers, spinand->oobbuf is > currently used as a buffer for the marker bytes. During the > underlying read and write operations to actually get/set the content > of the OOB area, the content of spinand->oobbuf is reused and changed > by accessing it through spinand->oobbuf and/or spinand->databuf. > > This is a flaw in the original design of the SPI NAND core and at the > latest from 13c15e07eedf ("mtd: spinand: Handle the case where > PROGRAM LOAD does not reset the cache") on, it results in not having > the bad block marker written at all, as the spinand->oobbuf is > cleared to 0xff after setting the marker bytes to zero. > > To fix it, we now just store the two bytes for the marker on the > stack and let the read/write operations copy it from/to the page > buffer later. > > Fixes: 7529df465248 ("mtd: nand: Add core infrastructure to support SPI NANDs") > Cc: stable@vger.kernel.org > Signed-off-by: Frieder Schrempf > Reviewed-by: Boris Brezillon Applied to https://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux.git nand/next, thanks. Miquel