From owner-svn-src-head@freebsd.org Thu Apr 2 09:21:48 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 31A2227C04F; Thu, 2 Apr 2020 09:21:48 +0000 (UTC) (envelope-from takawata@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 48tHd72bvXz4HHL; Thu, 2 Apr 2020 09:21:47 +0000 (UTC) (envelope-from takawata@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6D8FCE5C0; Thu, 2 Apr 2020 09:15:32 +0000 (UTC) (envelope-from takawata@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0329FWw3034432; Thu, 2 Apr 2020 09:15:32 GMT (envelope-from takawata@FreeBSD.org) Received: (from takawata@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0329FWAr034431; Thu, 2 Apr 2020 09:15:32 GMT (envelope-from takawata@FreeBSD.org) Message-Id: <202004020915.0329FWAr034431@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: takawata set sender to takawata@FreeBSD.org using -f From: Takanori Watanabe Date: Thu, 2 Apr 2020 09:15:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r359560 - head/sys/netgraph/bluetooth/hci X-SVN-Group: head X-SVN-Commit-Author: takawata X-SVN-Commit-Paths: head/sys/netgraph/bluetooth/hci X-SVN-Commit-Revision: 359560 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 02 Apr 2020 09:21:48 -0000 Author: takawata Date: Thu Apr 2 09:15:31 2020 New Revision: 359560 URL: https://svnweb.freebsd.org/changeset/base/359560 Log: Fix mbuf handling in le advertize packet processing. Submitted by: Marc Veldman Modified: head/sys/netgraph/bluetooth/hci/ng_hci_evnt.c Modified: head/sys/netgraph/bluetooth/hci/ng_hci_evnt.c ============================================================================== --- head/sys/netgraph/bluetooth/hci/ng_hci_evnt.c Thu Apr 2 07:42:29 2020 (r359559) +++ head/sys/netgraph/bluetooth/hci/ng_hci_evnt.c Thu Apr 2 09:15:31 2020 (r359560) @@ -381,17 +381,20 @@ le_advertizing_report(ng_hci_unit_p unit, struct mbuf ng_hci_neighbor_p n = NULL; bdaddr_t bdaddr; int error = 0; + int num_reports = 0; u_int8_t event_type; u_int8_t addr_type; - + NG_HCI_M_PULLUP(event, sizeof(*ep)); if (event == NULL) return (ENOBUFS); ep = mtod(event, ng_hci_le_advertising_report_ep *); + num_reports = ep->num_reports; m_adj(event, sizeof(*ep)); - - for (; ep->num_reports > 0; ep->num_reports --) { + ep = NULL; + + for (; num_reports > 0; num_reports --) { /* Get remote unit address */ NG_HCI_M_PULLUP(event, sizeof(u_int8_t)); event_type = *mtod(event, u_int8_t *);