Received: by 10.192.165.148 with SMTP id m20csp2450602imm; Sun, 22 Apr 2018 07:18:49 -0700 (PDT) X-Google-Smtp-Source: AIpwx48BNKt6h3jFGKPpjfzxBbcvSojqxzEHhQmS12xUvyiq6U4ASfaNJh6Bgi1vDgTPPAjXUrPX X-Received: by 10.101.83.77 with SMTP id w13mr13041674pgr.429.1524406729874; Sun, 22 Apr 2018 07:18:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524406729; cv=none; d=google.com; s=arc-20160816; b=RP++/CSoUvDGXpxDUQBJ60AphP6cDEpbGw2LndVtJPdqnh8wnUoJPnZaPlMR+UDGjX tJ6gkT2Jvd3QucQM/0Gd6DGgWOJ0dodl4XyB6E85tiiBkUqn2V9DHCipR0ShGE22Z2AC drZMnbiGdAkdhbkLv8apEXNKDBHBqcsm0frPwVudnsZGdksdftSkb2RLwtXIzb/Be3KN WQzOUH2K60L6XM4IGOXNcWdUH68lvbAjY9peswYbyhrXRi+xAwoOa7pdMEnG2ZGsQEo2 B5iROTzD4gwhmy4p62a+6x2ihiF/lTewh8ACu2K28kIBxQsll2s6hzHNhV5RtizgVOEG oiww== 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=/XWvsGxuoFNoAai+Kg3VzLuu4Zklwxib8NhDfFg3Mpk=; b=0L8Kc3L1v4GFThhEGdzjJZMuR8/4A086f44sXTn8TkmMzzPcffOgTnsADPczEdiKkh mXk8CKrALFvFAuT8rkKoyKb53wZypHYPuef8PxrQN4/VFPbgfTM5erKfjeMYJwBbHW9L kBq5ob5IydSVwKEwfqp90D9MDyP+FGK/kFH4qjVCiximQ6LVDniZ4e7RdkHqLiKugUt0 HW8TuU9RKzGtrq+J+LbBa/O3jXtg0wnNDagMiumCtzk6kOOcNbOMWhtcG1DelrshqDb/ sBV/sTJPDgyUyL9Fb1kw4nVhOGwNEIAX0tzVSbBTpilBc86q4tCsaWDtnHjsWz7y0Lve zRzg== 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 b14-v6si9758090pll.116.2018.04.22.07.18.35; Sun, 22 Apr 2018 07:18:49 -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 S932473AbeDVORd (ORCPT + 99 others); Sun, 22 Apr 2018 10:17:33 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:58264 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932448AbeDVORZ (ORCPT ); Sun, 22 Apr 2018 10:17:25 -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 C7555CF3; Sun, 22 Apr 2018 14:17:24 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dan Carpenter , Mark Brown Subject: [PATCH 4.4 34/97] regmap: Fix reversed bounds check in regmap_raw_write() Date: Sun, 22 Apr 2018 15:53:12 +0200 Message-Id: <20180422135307.247294276@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180422135304.577223025@linuxfoundation.org> References: <20180422135304.577223025@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.4-stable review patch. If anyone has any objections, please let me know. ------------------ From: Dan Carpenter commit f00e71091ab92eba52122332586c6ecaa9cd1a56 upstream. We're supposed to be checking that "val_len" is not too large but instead we check if it is smaller than the max. The only function affected would be regmap_i2c_smbus_i2c_write() in drivers/base/regmap/regmap-i2c.c. Strangely that function has its own limit check which returns an error if (count >= I2C_SMBUS_BLOCK_MAX) so it doesn't look like it has ever been able to do anything except return an error. Fixes: c335931ed9d2 ("regmap: Add raw_write/read checks for max_raw_write/read sizes") Signed-off-by: Dan Carpenter Signed-off-by: Mark Brown Cc: stable@vger.kernel.org Signed-off-by: Greg Kroah-Hartman --- drivers/base/regmap/regmap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/base/regmap/regmap.c +++ b/drivers/base/regmap/regmap.c @@ -1582,7 +1582,7 @@ int regmap_raw_write(struct regmap *map, return -EINVAL; if (val_len % map->format.val_bytes) return -EINVAL; - if (map->max_raw_write && map->max_raw_write > val_len) + if (map->max_raw_write && map->max_raw_write < val_len) return -E2BIG; map->lock(map->lock_arg);