Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp3076347imm; Sun, 1 Jul 2018 11:42:31 -0700 (PDT) X-Google-Smtp-Source: AAOMgpereE91/WqqnL9OxndlzjcLZkIDRZuv1YKzGiXvOBuYekDmHgRlqgDEOmw/4yMJmAYtTuM3 X-Received: by 2002:a62:3b03:: with SMTP id i3-v6mr14677792pfa.197.1530470551504; Sun, 01 Jul 2018 11:42:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530470551; cv=none; d=google.com; s=arc-20160816; b=p3RdIKBfN91E+YUccoOIhmH6mgHYP9zX95hab8SuGRGsrjC+k6pKyY2kbzkfbNFKwn fEoRztdJu0MAGCDGEH1W8Cj5nR/Zfe+otbHsTs10iD4UskN0zRra7pRk65QcXwcrtK2b Gt0v55wx05rCSWbu4rLqJ1GhT0gpAKdabiiHl9jdSd4csop8kjDghSu1/BIPSMUHthIg Zb5LeUiebA3btyyd1oZb3py7dfUl52ADRBAg2WktIco+ovY0UyDOdSjbJVRVWHLrtMYW dIOCcpI8kdJFaB/bBEXrlaOOLYmDcSm9wuLOYLWgXnNVBwjzOwBkgKG6Mb8QYbUCrxTs +JZg== 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=utEzHymi8i05vqLot+kHKFvbyAAMPXIzyYMd4Y5i8YA=; b=bgTI+4uF698PSwSchUK+Ywh5SXn4slnbB00oC5w3cN7vxyfxw85h6lGYrQynjpWWIA JIImlDeymLgFZzZHsq3vMXtbtZ9DSl50vHd4AlvFP5zHVrutGuc/woq9lgbaXBU7PRyV GUwrADlgg3T0sSuJGxwnuPzwIoTrcNeMh/aCuAKLYc98y9TzIhOdltbjU3aN/3TmaEQl f+HQGXNg9gTOdlCN0JjM7MaVtLJZR2gdAnyiKAx9zHtQOm6gys8Ies3AbSBX1zno11HV NtgUFw1UE1WDBcZDbu0M3N+4JM6C30sBI7RxbkmsODzFtY9enpeV6SzOS0V+V+MNIId3 Ta4A== 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 n187-v6si13002483pgn.368.2018.07.01.11.42.17; Sun, 01 Jul 2018 11:42:31 -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 S1753166AbeGASln (ORCPT + 99 others); Sun, 1 Jul 2018 14:41:43 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:60216 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932671AbeGAQNt (ORCPT ); Sun, 1 Jul 2018 12:13:49 -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 CD7D94A3; Sun, 1 Jul 2018 16:13:48 +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 3.18 67/85] mtd: cfi_cmdset_0002: Avoid walking all chips when unlocking. Date: Sun, 1 Jul 2018 18:02:25 +0200 Message-Id: <20180701153125.048815778@linuxfoundation.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180701153122.365061142@linuxfoundation.org> References: <20180701153122.365061142@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 3.18-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 @@ -2683,6 +2683,8 @@ static int __maybe_unused cfi_ppb_unlock i++; if (adr >> cfi->chipshift) { + if (offset >= (ofs + len)) + break; adr = 0; chipnum++;