Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp26235imm; Fri, 21 Sep 2018 17:20:25 -0700 (PDT) X-Google-Smtp-Source: ACcGV61J5yofd2mrd2cyONqhRx+wBRd+4E1lBzb/+Xgc1NW6shsi/kxf+gT0SVBnuJ36fXp7u/Xq X-Received: by 2002:a63:9712:: with SMTP id n18-v6mr109597pge.69.1537575625907; Fri, 21 Sep 2018 17:20:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537575625; cv=none; d=google.com; s=arc-20160816; b=sGwIbpKAdeDli0RA5xbUSjOZxQcz7ZTkCa+ndusRapFmcMUnmj5s5CVINjH5f1sS0x Wt67g9TxCZo3WvYE8zvu/xOolX3LJVTcAzpCXQGdCyU2I5VFiV+65CPI9sRu/AhFDtPl 74IPW+S0Srcz9X4w/TDT7MAlnhVawfNYb0+/t0e1jTueNW3/w+l/ob2PIeSkUpmX4/8y xyK8xzpWGrC00AA0QcivI8DCTvSzVyr+a/yW4iNzk4jgfIx7exGGdRfihHrZrXuXTpqX H0hgK8QSDx+ZyyihgQ3Hbscf+zCQzrruJPGgP5eUbFC+k5/HouXHewP8RyHYVRy18t0N f8jg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:subject:message-id:date:cc:to :from:mime-version:content-transfer-encoding:content-disposition; bh=zFLPOCo0cZRwWnfKqxBapVnhT3N45Eb5tpysjrXk7Qc=; b=kWfBKHw7OHdPvsD9JGKB0DRhNg9i+zSW+meKaqsoF37s7YRYFQVCX6nM7BXjrHtirv GdpQ04Ntatu4haek/K+MIYhdWIHrEgxjo1eJeAq+BE/qV0O/iGHjLqGOzttiqjnJNJcZ wtR6fVBe0C8LeZQFbdOAluzNWz8+L6lPzil8izekOn4+eFTe83VK7VBj60/Zfg/hCh4m Y+zt/0ZwBkoa5A9E/eILTLjy5wuvGlWtQUxbXEXLDDD1ypVPdSV1p9WHkvDWoxmSvTXN XtpIP/RPZwPYbza/EnHruMqt2GVLLIL85GLY7o9KGSSWbInLUraR0OB9tT8QdclZ9rtR SwMA== 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 z63-v6si28297290pfi.214.2018.09.21.17.20.10; Fri, 21 Sep 2018 17:20:25 -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 S2392185AbeIVGK4 (ORCPT + 99 others); Sat, 22 Sep 2018 02:10:56 -0400 Received: from shadbolt.e.decadent.org.uk ([88.96.1.126]:44371 "EHLO shadbolt.e.decadent.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2392140AbeIVGKz (ORCPT ); Sat, 22 Sep 2018 02:10:55 -0400 Received: from [2a02:8011:400e:2:cbab:f00:c93f:614] (helo=deadeye) by shadbolt.decadent.org.uk with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1g3Ve1-0008BR-2L; Sat, 22 Sep 2018 01:19:33 +0100 Received: from ben by deadeye with local (Exim 4.91) (envelope-from ) id 1g3Vdn-0000rN-Ol; Sat, 22 Sep 2018 01:19:19 +0100 Content-Type: text/plain; charset="UTF-8" Content-Disposition: inline Content-Transfer-Encoding: 8bit MIME-Version: 1.0 From: Ben Hutchings To: linux-kernel@vger.kernel.org, stable@vger.kernel.org CC: akpm@linux-foundation.org, netdev@vger.kernel.org, "Benjamin Tissoires" , "Kees Cook" , "David S. Miller" , linux-bluetooth@vger.kernel.org, kernel-team@android.com, security@kernel.org, "Johan Hedberg" , "Marcel Holtmann" , "Mark Salyzyn" Date: Sat, 22 Sep 2018 01:15:42 +0100 Message-ID: X-Mailer: LinuxStableQueue (scripts by bwh) Subject: [PATCH 3.16 21/63] Bluetooth: hidp: buffer overflow in hidp_process_report In-Reply-To: X-SA-Exim-Connect-IP: 2a02:8011:400e:2:cbab:f00:c93f:614 X-SA-Exim-Mail-From: ben@decadent.org.uk X-SA-Exim-Scanned: No (on shadbolt.decadent.org.uk); SAEximRunCond expanded to false Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 3.16.58-rc1 review patch. If anyone has any objections, please let me know. ------------------ From: Mark Salyzyn commit 7992c18810e568b95c869b227137a2215702a805 upstream. CVE-2018-9363 The buffer length is unsigned at all layers, but gets cast to int and checked in hidp_process_report and can lead to a buffer overflow. Switch len parameter to unsigned int to resolve issue. This affects 3.18 and newer kernels. Signed-off-by: Mark Salyzyn Fixes: a4b1b5877b514b276f0f31efe02388a9c2836728 ("HID: Bluetooth: hidp: make sure input buffers are big enough") Cc: Marcel Holtmann Cc: Johan Hedberg Cc: "David S. Miller" Cc: Kees Cook Cc: Benjamin Tissoires Cc: linux-bluetooth@vger.kernel.org Cc: netdev@vger.kernel.org Cc: linux-kernel@vger.kernel.org Cc: security@kernel.org Cc: kernel-team@android.com Acked-by: Kees Cook Signed-off-by: Marcel Holtmann Signed-off-by: Ben Hutchings --- net/bluetooth/hidp/core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/net/bluetooth/hidp/core.c +++ b/net/bluetooth/hidp/core.c @@ -429,8 +429,8 @@ static void hidp_del_timer(struct hidp_s del_timer(&session->timer); } -static void hidp_process_report(struct hidp_session *session, - int type, const u8 *data, int len, int intr) +static void hidp_process_report(struct hidp_session *session, int type, + const u8 *data, unsigned int len, int intr) { if (len > HID_MAX_BUFFER_SIZE) len = HID_MAX_BUFFER_SIZE;