From mboxrd@z Thu Jan 1 00:00:00 1970 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=-6.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS autolearn=ham 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 6CE3CC352A3 for ; Thu, 13 Feb 2020 04:25:34 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 420A221734 for ; Thu, 13 Feb 2020 04:25:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1581567934; bh=0Zn+V4RWRxLSMvrqHzl8sdeydbTCptxVUZweMDfXhx4=; h=Subject:To:Cc:From:Date:List-ID:From; b=RaD0QBzKUjSRK0815XQYcpn6a/ENagP1DRdKOfGpdzdYI3ZO1jCyTPFXiyqZldq6e N/mU1Vp4hxm2Qka7E1RrryU2DG4B2uzKLpeyEemqURokgQ33JgiNCNMd7Z/cSKpr3j 8AyJqmuzn2Nq6GmDLOfMCqlKt1dg0LI5BdjPB6ko= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729662AbgBMEZd (ORCPT ); Wed, 12 Feb 2020 23:25:33 -0500 Received: from wout1-smtp.messagingengine.com ([64.147.123.24]:45535 "EHLO wout1-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729358AbgBMEZd (ORCPT ); Wed, 12 Feb 2020 23:25:33 -0500 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.west.internal (Postfix) with ESMTP id 82FB9C8D; Wed, 12 Feb 2020 23:25:32 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute6.internal (MEProxy); Wed, 12 Feb 2020 23:25:32 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:message-id:mime-version:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm2; bh=LYMHEL fJ/Mflvvvv9fv9o/T7sHtIDm1c87hLMCLOjxk=; b=LXtDonJKpDMs+etKmbjomd VAbQ8tVAUFOMsnvhbRMtjnhaVQhR1dX3E6HlbRCvoZ84HhfTTO0gZYdKzYRDeLzr RTkJbJHeWuy7r0Vb9UJxRk6/Bh0AQbJ027u4Fd4BoKKIwIUH10hoFyR/lwJA4yLf QNr02jWYTzPwkqY8HTWR94Kpk1PX7FLoO9s+joOxcao1SCDVkllFLTQsAJquQttq 9dypeiUrNtRw8UI2+gf5U5rf78hMUAKxNUH2LaRBxvzShRljKRRzG/+cFgkQhMTj E3S0w68S8om8kEP5dtWDmPdM8XKeH+4FvbAYVBZmMhTqOOc8MZMIlSdB7oy0HZTA == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedugedrieejgdejvdcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecunecujfgurhepuffvhfffkfggtgfgsehtkeertddttd flnecuhfhrohhmpeeoghhrvghgkhhhsehlihhnuhigfhhouhhnuggrthhiohhnrdhorhhg qeenucffohhmrghinhepkhgvrhhnvghlrdhorhhgnecukfhppedvtdelrdefjedrleejrd duleegnecuvehluhhsthgvrhfuihiivgepheenucfrrghrrghmpehmrghilhhfrhhomhep ghhrvghgsehkrhhorghhrdgtohhm X-ME-Proxy: Received: from localhost (unknown [209.37.97.194]) by mail.messagingengine.com (Postfix) with ESMTPA id D2D0F3060B16; Wed, 12 Feb 2020 23:25:31 -0500 (EST) Subject: FAILED: patch "[PATCH] regmap: fix writes to non incrementing registers" failed to apply to 4.19-stable tree To: ben.whitten@gmail.com, broonie@kernel.org Cc: From: Date: Wed, 12 Feb 2020 20:25:31 -0800 Message-ID: <1581567931200128@kroah.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ANSI_X3.4-1968 Content-Transfer-Encoding: 8bit Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org The patch below does not apply to the 4.19-stable tree. If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to . thanks, greg k-h ------------------ original commit in Linus's tree ------------------ >From 2e31aab08bad0d4ee3d3d890a7b74cb6293e0a41 Mon Sep 17 00:00:00 2001 From: Ben Whitten Date: Sat, 18 Jan 2020 20:56:24 +0000 Subject: [PATCH] regmap: fix writes to non incrementing registers When checking if a register block is writable we must ensure that the block does not start with or contain a non incrementing register. Fixes: 8b9f9d4dc511 ("regmap: verify if register is writeable before writing operations") Signed-off-by: Ben Whitten Link: https://lore.kernel.org/r/20200118205625.14532-1-ben.whitten@gmail.com Signed-off-by: Mark Brown diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c index 19f57ccfbe1d..59f911e57719 100644 --- a/drivers/base/regmap/regmap.c +++ b/drivers/base/regmap/regmap.c @@ -1488,11 +1488,18 @@ static int _regmap_raw_write_impl(struct regmap *map, unsigned int reg, WARN_ON(!map->bus); - /* Check for unwritable registers before we start */ - for (i = 0; i < val_len / map->format.val_bytes; i++) - if (!regmap_writeable(map, - reg + regmap_get_offset(map, i))) - return -EINVAL; + /* Check for unwritable or noinc registers in range + * before we start + */ + if (!regmap_writeable_noinc(map, reg)) { + for (i = 0; i < val_len / map->format.val_bytes; i++) { + unsigned int element = + reg + regmap_get_offset(map, i); + if (!regmap_writeable(map, element) || + regmap_writeable_noinc(map, element)) + return -EINVAL; + } + } if (!map->cache_bypass && map->format.parse_val) { unsigned int ival;