Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp123013imm; Tue, 31 Jul 2018 15:04:20 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfz//gEAUuznIQflP070g1G9vTEQ/OEhQSHbU+8ICmWEMo3SmHj5JCeTPukqyluI2QwAloc X-Received: by 2002:a62:9c17:: with SMTP id f23-v6mr24137597pfe.209.1533074660171; Tue, 31 Jul 2018 15:04:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533074660; cv=none; d=google.com; s=arc-20160816; b=MNHZwNjYBFHXn9xqkBWFCcy6S1QDpX/rhwRwbx6oJl1rPbxVxkhRna4Rl72MtVBUBN qzscN4wqGiyoiojVN5MD7zeZw7JHuiqSdaN1ShmYHnXd9QOnw4gQVaEBg5B8KKC3mIUd Fm9IP7GjJfnrxPIkNUqKxq0WMSen/5KvN94G7mgaJ37DsDg/eXinxkSyxjg144MXXA6S w/aGxgKlYTtTr1gvIzqtEjwTOBtZbkNYgq1BbMcDaVRUE+9MI5SMuYTwqy4D/PT0Micz C6PjeDe8ZioNbNNSYKu6XeTL/X8T8HZO79lDnuvwb9Csc9EAxswfptu5TX8fgEAxNQ96 kScg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=pj6b7/RsWBT0aQ+jchdnzHqrIb6BogBIBVUR0Iia8aQ=; b=EdCr6hWhrruIKzjgsFXAoGKm+eLUb4ds9LHZaGzV4iOzMHnbSX6YwilXPkj0bYLi8/ BqsLyCDM7+6Id7PhRsFSiOeeFVBPVt3kmulCNYpEXG+iRV8RlVcfATQMihthhYZb3vfg cv0RfM0SV78JZk4Wz2gGE+MCgqskGI5adfctMSJ5gEa03bzpbzA9/gfAJvSYvjBL1Bra cN0dlB9/Qt4z2XpHX4NFwSvC2ehvtnSobOAgSyShC25/c3tocTsVc2wYzY3GiBpH5pte wP34kpGf7HlUM+rwU8FRhFaMaF+CXSqtURd3B8L52/WZNBprlZIP6P9Yb11k/aW7JBdm ZwkA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@android.com header.s=20161025 header.b=vHRbNxB+; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=android.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y13-v6si13014611pgp.560.2018.07.31.15.03.58; Tue, 31 Jul 2018 15:04:20 -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; dkim=pass header.i=@android.com header.s=20161025 header.b=vHRbNxB+; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=android.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732602AbeGaXpS (ORCPT + 99 others); Tue, 31 Jul 2018 19:45:18 -0400 Received: from mail-ed1-f66.google.com ([209.85.208.66]:38892 "EHLO mail-ed1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732308AbeGaXpQ (ORCPT ); Tue, 31 Jul 2018 19:45:16 -0400 Received: by mail-ed1-f66.google.com with SMTP id t2-v6so5909066edr.5 for ; Tue, 31 Jul 2018 15:02:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=android.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=pj6b7/RsWBT0aQ+jchdnzHqrIb6BogBIBVUR0Iia8aQ=; b=vHRbNxB+AHgPplyqCsX5N0xKuzE471+lKPaF8UZP2JsNDifjbUSZr+tjjk0tHR13JI XG9qfYdLZQ0AzsUEfO4goxJf7bg+EMq1v4TUYnEtzd5s75iD8qVeKaviN7Nuh2PE/rlI Hpb0vzXnNds6BgZ8qKQPcAUVkJgKtGXKA48aspktdTtILlW4LYilI6LE7whj8AukB7Cq 4mwaI77nAYcNzV7MfE3YJQRCKuN2UCO1ZhH1y6VKxS6CHmB+qzrxVAZQLYGPLMbuz307 Gq2Es34Xi1GiBTzswrchDz5KyXI1FiHaY2UG95bC+BW0W1lmfT+oR/0JON2QnCwmmhmq l5Ww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=pj6b7/RsWBT0aQ+jchdnzHqrIb6BogBIBVUR0Iia8aQ=; b=hUhlGbMyV3RcmceFcIURS4jD9KnseMeVr6x0rO4nGBg/ZC6dbsPD3qiKE1YciPkp3M GeLeXycWEQbViijJq2WgayMgzDQNuD/WNj8E75jSlvNwlg+ZseuhJlNBfzl7hBujn/xF FuiW1Yln09ovrIZ37/pRysl1SAVcjnp8KLT+bOAYsihEvoAy6ORzZrNxkz4KiUdKwZz9 E7CRQsVSGozmsg77HURSoD0qk8OZzNvLqRGRqQC8fenSPOc2Vse8iFDDne2Kfr3NZm68 cN6Ce4J8YrdiE7qrJDtDMkRs9guNBuaDFdHasXNJDi2SSUSmrkfOnn07AsjoeOuePRZ+ GHEg== X-Gm-Message-State: AOUpUlHCczsSbSXXvbX/eDkc3LuUFZe2mpBl651Cs0sJi538JovJShoT MblASz+LtjC3CLOpMnOViU5m2nih/bc= X-Received: by 2002:aa7:d588:: with SMTP id r8-v6mr1301761edq.130.1533074570438; Tue, 31 Jul 2018 15:02:50 -0700 (PDT) Received: from nebulus.mtv.corp.google.com ([2620:0:1000:1611:8fc3:703d:7635:5997]) by smtp.gmail.com with ESMTPSA id g14-v6sm3431132edm.25.2018.07.31.15.02.47 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 31 Jul 2018 15:02:49 -0700 (PDT) From: Mark Salyzyn To: linux-kernel@vger.kernel.org Cc: Mark Salyzyn , Marcel Holtmann , Johan Hedberg , "David S. Miller" , Kees Cook , Benjamin Tissoires , linux-bluetooth@vger.kernel.org, netdev@vger.kernel.org, security@kernel.org, kernel-team@android.com, Jiri Kosina Subject: [PATCH] HID: Bluetooth: hidp: buffer overflow in hidp_process_report Date: Tue, 31 Jul 2018 15:02:13 -0700 Message-Id: <20180731220225.159741-1-salyzyn@android.com> X-Mailer: git-send-email 2.18.0.345.g5c9ce644c3-goog MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- net/bluetooth/hidp/core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/net/bluetooth/hidp/core.c b/net/bluetooth/hidp/core.c index 1036e4fa1ea2..3bba8f4b08a9 100644 --- a/net/bluetooth/hidp/core.c +++ b/net/bluetooth/hidp/core.c @@ -431,8 +431,8 @@ static void hidp_del_timer(struct hidp_session *session) 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; -- 2.18.0.345.g5c9ce644c3-goog