Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp4415260pxa; Mon, 10 Aug 2020 08:33:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyiTTbEq9DjnQjUlTXwdu1sbx7EsUb0fRBJ5h9IUvq7wDNwkpBqgFGWEAz0UCnnZk7Z/uH1 X-Received: by 2002:a17:906:858:: with SMTP id f24mr21742092ejd.543.1597073621026; Mon, 10 Aug 2020 08:33:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597073621; cv=none; d=google.com; s=arc-20160816; b=a2xmZfrMzla15Z3Eg16syn72o241G/mBoswhUQ//PNxabCizaa5tMwYqL/T+0IM4d4 xHqK8EsgaKMJEwuR/o4w4wtIcCvh/5IVTTrLzNn/uhl/wx5b9VM2Bt3JlizjDJASlhO9 zcQ1Gv33ABm6vR37BDzeIW9iHaRfGBZ+WrYM/fRGpZCDa1EgukN38+5FTGdgV7oaJmxz P+k00N8TGojka/fLfQbFXzdTK+mr3VgUp/7RpqrvsYLDz4K4qOUWc9IJg6gb15wFrTyc Yp8i7gs2SwTvr4cHym7wgkfOag5/kH5hIE25zjeqI/cnsu+3GIEvRIqTvl5PP5sGse9M WNjA== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=EUHa47UZ83Lfh0GEyxPM1VWaBxSmNVIZuKYlzvyOh5o=; b=UzcxZKEMTq9mCyTYYJo1z6PKqGAFjxOzOmTZt95+irJ7TUcIroSmrOSVvv4GucKZ2P kjV8toBRFqeAXLFqchGYVVZ68G11f3iVcgzwlD2JUH7mc30dWuVdbH0iKO06DPHwKWm2 EQWdJOMVqk+6X+ayJPBo3CraC1ndNXZ/9jdGIohRCO2+2wwsULJg0pGWWdSeygwUTdTI wMASjX7rrA2tdH01fjLhvVyy0dgFufouVN6auBgvN2s5KP7uf0er9Sf7xCZc6TFOO+8q bSQk7+XaCYc4BKz9aD0bompAD6vlhFVPCCeyQripIdPdrVls3Rgd8NGxCL5HY9aqKL4m I+bw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=AIAK9XlJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l18si10489103edq.425.2020.08.10.08.33.17; Mon, 10 Aug 2020 08:33:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=AIAK9XlJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728690AbgHJPaN (ORCPT + 99 others); Mon, 10 Aug 2020 11:30:13 -0400 Received: from mail.kernel.org ([198.145.29.99]:36804 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729048AbgHJPaF (ORCPT ); Mon, 10 Aug 2020 11:30:05 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 609D022D08; Mon, 10 Aug 2020 15:30:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1597073404; bh=kBMYDFhRnChutM/t5d6Xdcinvd6tqSpoUz7KNV5h4G0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AIAK9XlJbOSJjykCdMIKxjl21muabZUWXBn31Bkas2Cg//w+CFLltJ9hbel6NpwB3 ctF1PQm152yjaxP0XzY4VhtwvJjlbGnUpy0Gq+sQMJItHpjhcvQc66seUTOKElpZEs zp48D/dvNtkgoGgKesi2ryHPn9CCQm4FMtfhCpJE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, syzbot+d8489a79b781849b9c46@syzkaller.appspotmail.com, Peilin Ye , Marcel Holtmann Subject: [PATCH 4.19 08/48] Bluetooth: Fix slab-out-of-bounds read in hci_extended_inquiry_result_evt() Date: Mon, 10 Aug 2020 17:21:30 +0200 Message-Id: <20200810151804.617146256@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200810151804.199494191@linuxfoundation.org> References: <20200810151804.199494191@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Peilin Ye commit 51c19bf3d5cfaa66571e4b88ba2a6f6295311101 upstream. Check upon `num_rsp` is insufficient. A malformed event packet with a large `num_rsp` number makes hci_extended_inquiry_result_evt() go out of bounds. Fix it. This patch fixes the following syzbot bug: https://syzkaller.appspot.com/bug?id=4bf11aa05c4ca51ce0df86e500fce486552dc8d2 Reported-by: syzbot+d8489a79b781849b9c46@syzkaller.appspotmail.com Cc: stable@vger.kernel.org Signed-off-by: Peilin Ye Acked-by: Greg Kroah-Hartman Signed-off-by: Marcel Holtmann Signed-off-by: Greg Kroah-Hartman --- net/bluetooth/hci_event.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/net/bluetooth/hci_event.c +++ b/net/bluetooth/hci_event.c @@ -4151,7 +4151,7 @@ static void hci_extended_inquiry_result_ BT_DBG("%s num_rsp %d", hdev->name, num_rsp); - if (!num_rsp) + if (!num_rsp || skb->len < num_rsp * sizeof(*info) + 1) return; if (hci_dev_test_flag(hdev, HCI_PERIODIC_INQ))