Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp9099149pxu; Mon, 28 Dec 2020 06:37:04 -0800 (PST) X-Google-Smtp-Source: ABdhPJzDLhWy4lKWxdBB5mJLTVPvZ9+gHNsRPSPg9Yo9H0k/txysJd1vFeakpswcdSsKvXOLSFvF X-Received: by 2002:a17:907:c10:: with SMTP id ga16mr41729778ejc.43.1609166223819; Mon, 28 Dec 2020 06:37:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609166223; cv=none; d=google.com; s=arc-20160816; b=GwPgLlj9x5XTOt/Uuih76xj7NLNSLzvliSNhK5WsRPN5m9Tb0RrN6DtCpnrk1N/OKZ rWUQhUA/P/8MHYApGzT8o3epI7aOOTWWoqMWSWGPaNkDLPGzYy6hYm64bKLyDVU1s7Mv TXgXLbQMi1w4zS+4IX5j6LrD2Hyj3yNYhTUjh9rmNDnejxxuiyi09GV+0ltapL/+aX6K ouD5cu/ovpbIdIsE+Q00aIrWJABc7UxnNGfioUdS0qz2WCTJIrXRnxUnI1LlpXRNWZ9y 4cOQqhtr6jJVvKrT8yBv2dNQWpDsRRYyW4J8L/thtdkIptZGLGNzaRXbJEj5VR2IbyEX P2xg== 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=nI8EAQEZdbF8S30CbSJI7Vt9v/vqOTazchcyd9sUEG8=; b=h/tvvdGtlfhqHSO8gEI911mhcYqou2lvbDvaJfJqZ5IooW4gX1wmG9+dl1lqCxNHCo XoTHvBJ4jGfN2OMR0F/24rK1mgi7T6YW4OkDO9ybFs3FLL5rBNUR8Fujr9eZ1cCOeyuP R4dY8nw5qxSHO7KUbqgQcdX5zxDL++fj4mD2z1Zf30VmTHctFsKr3zcX/KG6fuZ9/dxA K1cZg4WHouGsUlWR55dmVLDcIW3uXvSeRuUuKI+GCk342JljJEbYaGqo34S6iH2yxAa0 RYBTE7hyK4R0WGg+GR4VU2TLqua4IUmYcTU//gLJMDgI6tm0PlITAoMKExWNYt/NDabb Bgeg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=T8gYyfxw; 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 lm18si18001084ejb.160.2020.12.28.06.36.40; Mon, 28 Dec 2020 06:37:03 -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=T8gYyfxw; 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 S2505012AbgL1OdY (ORCPT + 99 others); Mon, 28 Dec 2020 09:33:24 -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 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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; }