Received: by 10.192.165.148 with SMTP id m20csp2490703imm; Sun, 22 Apr 2018 08:07:00 -0700 (PDT) X-Google-Smtp-Source: AIpwx481fK7JNMSmOPnL3LNxbQXcmI8an5TwS+Neuj3Z/W0PsrMXYDIx8Op1PdaiZHYsXqi69LqW X-Received: by 2002:a17:902:7b84:: with SMTP id w4-v6mr9731770pll.116.1524409620081; Sun, 22 Apr 2018 08:07:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524409620; cv=none; d=google.com; s=arc-20160816; b=uqPnRRR6qJpAp/6oFy6UKbo43yeQ0SZTKPD7Y4unoevPFKrprnJRqbwIbC5MCLnTrQ Srefjm776hJsOxmC+jI6CpO1WcID4at3PkrSQQU2iNqdrxe8tyLTV5/I+Qx9E1bzvHY2 F8lAk90VLV/XF9ul8gUEVYR9OxTok557EDI4AeelgAmXveMEEyjaMfhbxQW6eIOUBFTn m5MXfqOPMDmtpjx7jjFf2V5uFubKrXzmDsttUDq52fp49PJPglj5QU5FUGT54j//o3M/ WsrAMYDSFk05GR/67jXXXQpisVa+wm6sp87zm6Mial4YSzbmXvXjaKsVtU32iiutGDiR wX2w== 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=/JycSh8uK9DACxicAn5bGqFMYTBM7gOExI0w3J4m128=; b=mffy7rNTljeZtq4oUPvU/Rcr7phritRhIf/houj89UxfsHxFNIlpOH2el1mGu87zht n5yVpuydQK41iioceWVweqaeQtTll7E0MqXb72X8W+glrMMsJbTc8mKJk0AVdCBxMWL8 Fr5ZBgufvySK43LH2TpNMHJ6KhFUwm1UM4jvdGP4IITBQBuT4T/K7rYKDJfs24wN3jK0 Ft3dWqmzVwr7D53HpFcT3QRJiJ4WUK6NZs0hhCSb4WTBFYX/UcscS1evaOm2SCvbFxqA KR1Mr6enN3JGibRbh5TAwX0lCpVbzsC+Hb0krImQfROHBodD2h/bQrjkPiWlr/aYrmWD WxKQ== 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 s2si9454686pfb.39.2018.04.22.08.06.46; Sun, 22 Apr 2018 08:07:00 -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 S1756554AbeDVOLl (ORCPT + 99 others); Sun, 22 Apr 2018 10:11:41 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:54390 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756466AbeDVOL3 (ORCPT ); Sun, 22 Apr 2018 10:11:29 -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 CFBABCB0; Sun, 22 Apr 2018 14:11:28 +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.9 17/95] regmap: Fix reversed bounds check in regmap_raw_write() Date: Sun, 22 Apr 2018 15:52:46 +0200 Message-Id: <20180422135211.145528929@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180422135210.432103639@linuxfoundation.org> References: <20180422135210.432103639@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: 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 @@ -1736,7 +1736,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);