Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3336532imu; Sun, 11 Nov 2018 12:39:41 -0800 (PST) X-Google-Smtp-Source: AJdET5e28qtisXpZvb67bVAxW4YHjMHP45Hezjo665CoNOyQInnkVF3OyR+xyuMhoJC2rK/rq0Ih X-Received: by 2002:a63:c642:: with SMTP id x2-v6mr14677216pgg.16.1541968781338; Sun, 11 Nov 2018 12:39:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541968781; cv=none; d=google.com; s=arc-20160816; b=WFDmqH8ijfY1grCjY2T8lDc7qyVgwMWVrXBYHLKtqCd0mAvKkT6FpGKhMfqdJKr4Va +Ukns0OfBPp+hLEt5c0PkANT9XIRwvc9pyM/CxNZBeLzBGfNYKe3XmqaHWvJ1qIkt0Ub xmS4/XtezZscEN2+/PaEx/PBs82qVEPiLlCgTWMSOqnAmISlbD1+jgic7SWnlH6maR8K yEj+SRDKC2jECyG8MfUndWMTHJ6xF56y00xv6ICDp8eTeG9lLvrinAtHs55Mtb3fsTdN JELX8MZ7y7muwlD6RzTFhukeBvgzOYhs7nitLdpghkW4k2fGaYJTEmL/yBiXoRZnB79W 0tXw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:subject:message-id:date:cc:to :from:mime-version:content-transfer-encoding:content-disposition; bh=z1y3m3ueQ+uOts9gab9v6cb14qSYvy5fSdC8QttQ+tw=; b=SRc5fBgRfOSmrIcH7dYaAdMBaF6+kFVHDwCXukAjmmEQRjYxGKkwSzgrXmgGpeCFpb fLm4Q3hbAtOPpt+wKPWUzk6OjuJBNqpfEAjiqUabZKP15iiJwVKkKvMfuZ1TDujQgNeI IgPCXASGe7j3kx2/RTK/Ja8lza9M7yPHBR8PYfUGEoUhwzQKr/IKBpiGBMnFRlC8Jx/8 lIuWUs+VpDUt1Q5ZaG5/69/gEeQamSRK93IuOLoeAMOQCvJVBnroIrRGtQy1/UD2O2C5 yAQSL0j0jW1Xwam9ObL0yo7RNkMrRVGMay21JDJck3JLK3TG9MVMgbC+mjNivVLJNTAB ZneA== 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 a34-v6si16529090pld.249.2018.11.11.12.39.25; Sun, 11 Nov 2018 12:39:41 -0800 (PST) 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 S1731027AbeKLG1Q (ORCPT + 99 others); Mon, 12 Nov 2018 01:27:16 -0500 Received: from shadbolt.e.decadent.org.uk ([88.96.1.126]:49704 "EHLO shadbolt.e.decadent.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730065AbeKLFsK (ORCPT ); Mon, 12 Nov 2018 00:48:10 -0500 Received: from [192.168.4.242] (helo=deadeye) by shadbolt.decadent.org.uk with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1gLvsW-0000oU-Cd; Sun, 11 Nov 2018 19:58:40 +0000 Received: from ben by deadeye with local (Exim 4.91) (envelope-from ) id 1gLvsT-0001c6-Hj; Sun, 11 Nov 2018 19:58:37 +0000 Content-Type: text/plain; charset="UTF-8" Content-Disposition: inline Content-Transfer-Encoding: 8bit MIME-Version: 1.0 From: Ben Hutchings To: linux-kernel@vger.kernel.org, stable@vger.kernel.org CC: akpm@linux-foundation.org, "Joakim Tjernlund" , "Boris Brezillon" Date: Sun, 11 Nov 2018 19:49:05 +0000 Message-ID: X-Mailer: LinuxStableQueue (scripts by bwh) Subject: [PATCH 3.16 180/366] mtd: cfi_cmdset_0002: Avoid walking all chips when unlocking. In-Reply-To: X-SA-Exim-Connect-IP: 192.168.4.242 X-SA-Exim-Mail-From: ben@decadent.org.uk X-SA-Exim-Scanned: No (on shadbolt.decadent.org.uk); SAEximRunCond expanded to false Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 3.16.61-rc1 review patch. If anyone has any objections, please let me know. ------------------ From: Joakim Tjernlund commit f1ce87f6080b1dda7e7b1eda3da332add19d87b9 upstream. cfi_ppb_unlock() walks all flash chips when unlocking sectors, avoid walking chips unaffected by the unlock operation. Fixes: 1648eaaa1575 ("mtd: cfi_cmdset_0002: Support Persistent Protection Bits (PPB) locking") Signed-off-by: Joakim Tjernlund Signed-off-by: Boris Brezillon Signed-off-by: Ben Hutchings --- drivers/mtd/chips/cfi_cmdset_0002.c | 2 ++ 1 file changed, 2 insertions(+) --- a/drivers/mtd/chips/cfi_cmdset_0002.c +++ b/drivers/mtd/chips/cfi_cmdset_0002.c @@ -2356,6 +2356,8 @@ static int __maybe_unused cfi_ppb_unlock i++; if (adr >> cfi->chipshift) { + if (offset >= (ofs + len)) + break; adr = 0; chipnum++;