Received: by 10.192.165.148 with SMTP id m20csp2542874imm; Sun, 22 Apr 2018 09:12:42 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/S4YWgPVVCshSLHD1KE9MF4UDKR8Jwo0nT3o2FvsGwmrxs8rgZMwyFkCk6P0ntsIUL7FCi X-Received: by 2002:a17:902:125:: with SMTP id 34-v6mr18125822plb.42.1524413562110; Sun, 22 Apr 2018 09:12:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524413562; cv=none; d=google.com; s=arc-20160816; b=GaKN14HpkhzN6bEebEgPAu7o89usgMGnwnDj59bxJbCRqCyrUGxUl7BDhr/nb6decS zDTfvOt5pJdEuwatZr5RKIK+XaOHXYtEreGKY2FooieCB5PDjxJOP2SyWf+Si7TNgi5Y qg62lMZanmQ1kwyEKg9VNFZMWVi7I2Qe7lhBEriivIPiMK6yqZxNhQVsD3V0GcxXeF6y 37XsUj95nLiuykbWSyt0zD3MbyxDjRW7mKCZfOq1s8Rr7yMAO+GJfC/nvrS8OvXaUuQ6 DfoYLo4stxq5cGqQeUJOn+2w9fNS4J2/1MCYlytT9dKLUxN9/v7jL6dwslDcnPFdvrqt aDeg== 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=UQQsLldgQDJTvyJF5ZX2HgcsJTLGMC12aMzg8Lb1SOw=; b=coyJ5fvb1jR3rvD1uQiV1j1NDmDI96DuNdXcLkEUvXAIMactA+HY50bsYi8v6PGerx TatmKWUf0iSa/YUnP0g1LlIbFz7wTvA/h6zD91kv+GHxiKZRXGrjWrrSFB9FiUpVrkIM B3UfPJlyrQA67GKKyX4Q/i9wdZg4JadSbvFJ0i9w9SLZ8D893InPEJeq+vgWicXG7QJG /F6C4lEIgwFPk1PjbUOh7S8j9ThABi7XoIGL505SCXGNx3ZuWuXziRXmHfp8VfGGvCTH ZuE8lDygAVBUobUrUYuT4oQcjdrRGiqbeXabvQA8KNby4TllOJ9gjbIIHAAysND7G4Le HwQw== 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 r6si8127669pgp.21.2018.04.22.09.12.27; Sun, 22 Apr 2018 09:12:42 -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 S1753886AbeDVQL2 (ORCPT + 99 others); Sun, 22 Apr 2018 12:11:28 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:44876 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753650AbeDVNz7 (ORCPT ); Sun, 22 Apr 2018 09:55:59 -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 79B579CE; Sun, 22 Apr 2018 13:55:58 +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.16 036/196] regmap: Fix reversed bounds check in regmap_raw_write() Date: Sun, 22 Apr 2018 15:50:56 +0200 Message-Id: <20180422135105.964617622@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180422135104.278511750@linuxfoundation.org> References: <20180422135104.278511750@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.16-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 @@ -1831,7 +1831,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);