Received: by 2002:ac0:aed5:0:0:0:0:0 with SMTP id t21csp2542634imb; Mon, 4 Mar 2019 07:45:56 -0800 (PST) X-Google-Smtp-Source: AHgI3IbdCukiwrsG9WTc/iFXTbgPBBmLCejAank7FB6wYXCGP5J7MJpQH/Ghi1ZZMPj/iZRWJuUe X-Received: by 2002:a62:e214:: with SMTP id a20mr20139935pfi.192.1551714356496; Mon, 04 Mar 2019 07:45:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551714356; cv=none; d=google.com; s=arc-20160816; b=gBEhL4ws7+Rms2ZG5Oxt4skAufm0awvV2QU2GLp8fnoc/o93hm/CSLT86XXkmTSPO/ 1PSb9zhj/ikYk9RpGFEx7hJkc5AWyTdSqZ2fRbIQfWm7YBHqJ2D4ROtEFIvafXJ2kADv STmVd+NPXAh9clf/iJ7UMQjZyBGQbqgK/extMMIacqAK0QQgMb444uyEsxR04nhlAzAG 8Eahmz3KZ8tu5UCqURJGwlS44iLGNaOYYz4J3BbrJpzLdd70fOakXWlKaxSxUnpIq7VL Bp7/OXjvW/TSjYEaM4Pd7UaXPxJmPcfCPFdnm6tmjFg/pDspbIp2Qf6LeRjHrgmTtiVS yrPA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:message-id:subject:cc:to:from:date :dkim-signature; bh=Jmb7OR6WedKa0aRencvDZGsGP5c8FJeKpFMOBkWkpIA=; b=QKKrjbneamCtohZvKlVEHmUpqU/HIKFD9AXmOze1Wsk8vR06uDMJBE5dTrAP0/O6dP 0GKL0cf388P8uIWGA/YYDX0MYjCS2kP1LN+7FZqKTJjcb7H5jDEBRprZg0IutVDrdaYN Z9DnddzIy5cY+G12lxnPwQLRAIL/3SHTyvoAdsPz5y96JASn5taeY10y9ZwSQiqLwmpN +XFLQVVn+17daPAt5yOPdUBZ4MCMoDRvemxw9SGMTHvMGHq1XgyjiY9a1vTF0OCju05c rleHvt09jMORbg8Ka2QlODQonB2wvguY8abxQ8jIyJZ5s7dmMR8IRBkOe2PNLA0nTEDi roxw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2018-07-02 header.b=A0JR+F9A; 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=oracle.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id bi11si5632133plb.164.2019.03.04.07.45.17; Mon, 04 Mar 2019 07:45:56 -0800 (PST) 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=@oracle.com header.s=corp-2018-07-02 header.b=A0JR+F9A; 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=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726800AbfCDPEp (ORCPT + 99 others); Mon, 4 Mar 2019 10:04:45 -0500 Received: from userp2120.oracle.com ([156.151.31.85]:56874 "EHLO userp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726082AbfCDPEp (ORCPT ); Mon, 4 Mar 2019 10:04:45 -0500 Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x24ExCLC074058; Mon, 4 Mar 2019 15:04:34 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=date : from : to : cc : subject : message-id : mime-version : content-type : in-reply-to; s=corp-2018-07-02; bh=Jmb7OR6WedKa0aRencvDZGsGP5c8FJeKpFMOBkWkpIA=; b=A0JR+F9AU71iWr3jfNhIYVGEzT1kqd6msWMtzLgc5oe2CLhH+ULsLJ9xw1G8l9iaShZP rht2MtO7X7+MblekV6dxkr9QA4ULXaqB571FeywifugCuROvK45r0nbrPDh/U9pHJYfa WnfBdfuWxYUM5kxyMG3kANf6XQkZ1QxNMRNEKV8wOq/00wvP3B+yVpWTCahRoDbW6bdU UkkjKlHVs3RCAXYO4/QtbbJuu8pNpnQWRmSVnQuGnMiBSSXk/TqgAL0F3c/Iulg0mqbw i6bFilk4S2/WjEfjPjnnkPxA+6jUR+5rIIOZ20Gx200mgeHvdcy3xmkMWHadpfD1K9Tn CA== Received: from aserv0022.oracle.com (aserv0022.oracle.com [141.146.126.234]) by userp2120.oracle.com with ESMTP id 2qyjfr777x-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 04 Mar 2019 15:04:33 +0000 Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by aserv0022.oracle.com (8.14.4/8.14.4) with ESMTP id x24F4UoG028789 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 4 Mar 2019 15:04:32 GMT Received: from abhmp0014.oracle.com (abhmp0014.oracle.com [141.146.116.20]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id x24F4S3Z027394; Mon, 4 Mar 2019 15:04:28 GMT Received: from kadam (/197.157.34.180) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 04 Mar 2019 07:04:27 -0800 Date: Mon, 4 Mar 2019 18:04:19 +0300 From: Dan Carpenter To: kbuild@01.org, Tomas Bortoli Cc: kbuild-all@01.org, marcel@holtmann.org, johan.hedberg@gmail.com, davem@davemloft.net, linux-bluetooth@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, syzkaller@googlegroups.com, Tomas Bortoli Subject: Re: [PATCH] net/bluetooth: Fix bound check in event handling Message-ID: <20190304150419.GC13452@kadam> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190228195939.30685-1-tomasbortoli@gmail.com> User-Agent: Mutt/1.9.4 (2018-02-28) X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9184 signatures=668685 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1011 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1903040110 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Tomas, url: https://github.com/0day-ci/linux/commits/Tomas-Bortoli/net-bluetooth-Fix-bound-check-in-event-handling/20190301-213647 base: https://git.kernel.org/pub/scm/linux/kernel/git/bluetooth/bluetooth-next.git master smatch warnings: net/bluetooth/hci_event.c:3986 hci_inquiry_result_with_rssi_evt() warn: potential pointer math issue ('info' is a 120 bit pointer) # https://github.com/0day-ci/linux/commit/00305742c021794f147b348d45eb10ea26e5a514 git remote add linux-review https://github.com/0day-ci/linux git remote update linux-review git checkout 00305742c021794f147b348d45eb10ea26e5a514 vim +3986 net/bluetooth/hci_event.c a9de9248 Marcel Holtmann 2007-10-20 3979 if ((skb->len - 1) / num_rsp != sizeof(struct inquiry_info_with_rssi)) { 138d22ef Szymon Janc 2011-02-17 3980 struct inquiry_info_with_rssi_and_pscan_mode *info; ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 138d22ef Szymon Janc 2011-02-17 3981 info = (void *) (skb->data + 1); a9de9248 Marcel Holtmann 2007-10-20 3982 e17acd40 Johan Hedberg 2011-03-30 3983 for (; num_rsp; num_rsp--, info++) { af58925c Marcel Holtmann 2014-07-01 3984 u32 flags; af58925c Marcel Holtmann 2014-07-01 3985 00305742 Tomas Bortoli 2019-02-28 @3986 if ((void *)(info + sizeof(info)) > ^^^^^^^^^^^^^^^^^^^ This is a pointer math bug. The options to fix it are: if ((void *)info + sizeof(info) > Or: if ((void *)(info + 1) > 00305742 Tomas Bortoli 2019-02-28 3987 (void *)(skb->data + skb->len)) 00305742 Tomas Bortoli 2019-02-28 3988 break; 00305742 Tomas Bortoli 2019-02-28 3989 a9de9248 Marcel Holtmann 2007-10-20 3990 bacpy(&data.bdaddr, &info->bdaddr); a9de9248 Marcel Holtmann 2007-10-20 3991 data.pscan_rep_mode = info->pscan_rep_mode; a9de9248 Marcel Holtmann 2007-10-20 3992 data.pscan_period_mode = info->pscan_period_mode; a9de9248 Marcel Holtmann 2007-10-20 3993 data.pscan_mode = info->pscan_mode; a9de9248 Marcel Holtmann 2007-10-20 3994 memcpy(data.dev_class, info->dev_class, 3); a9de9248 Marcel Holtmann 2007-10-20 3995 data.clock_offset = info->clock_offset; a9de9248 Marcel Holtmann 2007-10-20 3996 data.rssi = info->rssi; 41a96212 Marcel Holtmann 2008-07-14 3997 data.ssp_mode = 0x00; 3175405b Johan Hedberg 2012-01-04 3998 regards, dan carpenter --- 0-DAY kernel test infrastructure Open Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation