From patchwork Mon Dec 28 12:51:02 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 354841 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_RED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 137C1C43381 for ; Mon, 28 Dec 2020 14:36:51 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id DDB2A206D4 for ; Mon, 28 Dec 2020 14:36:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2504028AbgL1Oc6 (ORCPT ); Mon, 28 Dec 2020 09:32:58 -0500 Received: from mail.kernel.org ([198.145.29.99]:38046 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2503691AbgL1Oab (ORCPT ); Mon, 28 Dec 2020 09:30:31 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 59AB020739; Mon, 28 Dec 2020 14:30:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1609165815; bh=ENg6qW3FNxh7A1g0yGc+Pr1A3OjjWu1/O7a7oUE5/Rg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=T8gYyfxwi49ntXh35iHqFtMKUmesolAtZiCBmECEm+1han18VQAATJjEyull3zhCs NgM2ywhywh0TAsJSPMb6711C1BNThKOWTugqM8KSIhoWelOLKOoC9NJLCLPMr/RRWQ C5ySGEUK0zf5YKXx2MRsiF8OCcW01fJlpBURuPFY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Miquel Raynal Subject: [PATCH 5.10 664/717] mtd: spinand: Fix OOB read Date: Mon, 28 Dec 2020 13:51:02 +0100 Message-Id: <20201228125052.791387869@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201228125020.963311703@linuxfoundation.org> References: <20201228125020.963311703@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Miquel Raynal commit 868cbe2a6dcee451bd8f87cbbb2a73cf463b57e5 upstream. So far OOB have never been used in SPI-NAND, add the missing memcpy to make it work properly. Fixes: 7529df465248 ("mtd: nand: Add core infrastructure to support SPI NANDs") Cc: stable@vger.kernel.org Signed-off-by: Miquel Raynal Link: https://lore.kernel.org/linux-mtd/20201001102014.20100-6-miquel.raynal@bootlin.com Signed-off-by: Greg Kroah-Hartman --- drivers/mtd/nand/spi/core.c | 4 ++++ 1 file changed, 4 insertions(+) --- a/drivers/mtd/nand/spi/core.c +++ b/drivers/mtd/nand/spi/core.c @@ -318,6 +318,10 @@ static int spinand_write_to_cache_op(str buf += ret; } + if (req->ooblen) + memcpy(req->oobbuf.in, spinand->oobbuf + req->ooboffs, + req->ooblen); + return 0; }