Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp2973857imm; Sun, 1 Jul 2018 09:29:08 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJ10XXUtFANTGz8YKiOvdWZxR6m2uhJsQtCDfxBRLzkJst0eXhYCGRUQLAHVSySgdepKXYv X-Received: by 2002:a17:902:d711:: with SMTP id w17-v6mr22160991ply.200.1530462548840; Sun, 01 Jul 2018 09:29:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530462548; cv=none; d=google.com; s=arc-20160816; b=NcaqCLRycY/K/J/9DGnPxgnW4TNKtECSCv/0xj0vfv5c+Kl5P/VK6hBeEJHZlRhkRb LurIgXmpstSF9QujK5RCLylj0cqz5mQEgC9H9X5qEYhNSIZTTn+mGwyywxQrnR/myyHe /zy33t9yCXOkB2FqTvxbcQsU4VZY/pr+1ycZ11OsxJfIz0EqyeXnGT7wrsP4Z7lPAcfM EcQCNc3wAmfPv9bmo2xV/w3zOTdUS9JcfTvSaByl7wH4pczYXDxMPwX8YQT9WP94c9sJ /ETRV5bsX2nd3MtAQJRpW67+0diocQ6FYegJGK5H3rj9axxl2KSgcDWAnPB5m4FlQV54 DV1Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=L2gqCu5uL1EhvMqXo0m15aqehRMfSlEBJ92DcR6JBJ0=; b=sRBn2HuRdKjFxPZjXoqxykyhzrVFLIop2UiL7/OWKTXbjVvGhYVRNmF/zHC8dfNRPG onkFeTbXSZCapGdO1hvLHaAofMWly5rzXCl5hvBtq5+OQJdzczMP1DeQB8deD6sjn6YI ErgrGEg+K1cFGYxOP9UzKJlY9ZNVr2wHAp2ab5MjjRA7QrxCCSpSSx8OZDNpcYdmAOQy bexvRfQ1QvKA+XLsQpDQu8GJmp+cm7PpadWh8yhAntOxsbD2kQt4ahUfEbBWMJxxzVpJ GK7JVThcBcHbggh8bel+H1/yDBDu+gSM4+fKUTuDYFNJd9oFYJhB/KSwBCUxRKgEgjGF Hiug== 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 x1-v6si12663147pga.205.2018.07.01.09.28.54; Sun, 01 Jul 2018 09:29:08 -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 S965617AbeGAQ2A (ORCPT + 99 others); Sun, 1 Jul 2018 12:28:00 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:34210 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965572AbeGAQ1x (ORCPT ); Sun, 1 Jul 2018 12:27:53 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id DAF1C92B; Sun, 1 Jul 2018 16:27:52 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Joakim Tjernlund , Boris Brezillon Subject: [PATCH 4.9 044/101] mtd: cfi_cmdset_0002: Avoid walking all chips when unlocking. Date: Sun, 1 Jul 2018 18:21:30 +0200 Message-Id: <20180701160758.919971773@linuxfoundation.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180701160757.138608453@linuxfoundation.org> References: <20180701160757.138608453@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.9-stable 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") Cc: stable@vger.kernel.org Signed-off-by: Joakim Tjernlund Signed-off-by: Boris Brezillon Signed-off-by: Greg Kroah-Hartman --- 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 @@ -2681,6 +2681,8 @@ static int __maybe_unused cfi_ppb_unlock i++; if (adr >> cfi->chipshift) { + if (offset >= (ofs + len)) + break; adr = 0; chipnum++;