Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp13343189ybl; Sun, 29 Dec 2019 09:43:14 -0800 (PST) X-Google-Smtp-Source: APXvYqwV7Zb36COY82inY+HJeTMgOphkjh2sE07PQRyxYQblj/bPNYg1oxD9dtkZftVrm9oBiEKR X-Received: by 2002:a9d:8f1:: with SMTP id 104mr64607151otf.107.1577641394318; Sun, 29 Dec 2019 09:43:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1577641394; cv=none; d=google.com; s=arc-20160816; b=fk1f3GMfL5sO4XSAFjxff2GrrMOLpteco5X5kv9NH4PpWc+GeA6+m17RlqKlDgWnzG T67VPntkJ+dZwKexfvobWadzCpgwXN3VbzumO2Qy5w1BmvxfveleK91ZUOeYcwBjC63q iTr50s8jdd0I+4mVPRNQPzvTU8hUtLs/L6KsEjDj/BliTNy4x6IC6hHcsfq5B8AF/RKm AFpF+lhEASeqUIcXPDgc/2mwuJrnWFxRYcNx7ptL/1aJfwB48qrXy9NNrQZC70Rd8uEO Vd49vf1Ntt33974OD3LzflfWioz+06/i2tOg1ukx2Dn3om9mPKHk8XrIQjGPIMv1/XQn bfMQ== 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=n2eHU9Y0+U8tuZnGt9faShSLml7xh+HGr0e8J2xoHf8=; b=AWJAkb2L5KKw0lmUH3zlVeY29fJ87fdCbUs6dNoGzTJJcvy+9wGjnEht8Acxai83qM to1isVNG9BSUDHNtASJrANw0Lx++/3wlA+/RpVVUTCo6ksBmOt6TAMM8sVmc5VnfH3GC g7ywFdtzhRG7oJ6uczK48qo+KWV4s7za1oZKmF9AL84RiW6ZPvAmaYDLByttkTrEW9QR BbfQH5FuLJK5TJXdKGradaTawODE/aQpNHTvjtXKLUs7MIwGelGriqaC7qYpjzLusUny cEPRoU+DYvxjAwg3VG974UsxR1IHFk5hlvgVRZ6Qk/xL9QowQiRsytIMX2sdawSCVsDP mhHw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=DoKi6Ynn; 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 y8si19635357oih.141.2019.12.29.09.43.02; Sun, 29 Dec 2019 09:43:14 -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=@kernel.org header.s=default header.b=DoKi6Ynn; 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 S1729409AbfL2RlD (ORCPT + 99 others); Sun, 29 Dec 2019 12:41:03 -0500 Received: from mail.kernel.org ([198.145.29.99]:57558 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728608AbfL2Ra4 (ORCPT ); Sun, 29 Dec 2019 12:30:56 -0500 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 0D010207FD; Sun, 29 Dec 2019 17:30:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1577640655; bh=sA8eLhluhSMs7/Y3L4AlWclq8bPsmkhxG0GMjZ9tt6w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DoKi6YnnIpGgA8uVyg09coO0q87Vk1W927ZGKF+D8V7a66iHPpdNpxkvWByA0N7vt KJT+wNdTX8kvzmxZ3HKJHFNPqvHdKoVOX3OeFKdkmmzJFYyMjnWSq99xQP8bD5ExUs 1lLvSmEG3kC3BGQc4dX6b2P5SB4bPjefJ9bYZ3do= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mattijs Korpershoek , Marcel Holtmann , Sasha Levin Subject: [PATCH 4.19 083/219] Bluetooth: hci_core: fix init for HCI_USER_CHANNEL Date: Sun, 29 Dec 2019 18:18:05 +0100 Message-Id: <20191229162518.074127450@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20191229162508.458551679@linuxfoundation.org> References: <20191229162508.458551679@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: Mattijs Korpershoek [ Upstream commit eb8c101e28496888a0dcfe16ab86a1bee369e820 ] During the setup() stage, HCI device drivers expect the chip to acknowledge its setup() completion via vendor specific frames. If userspace opens() such HCI device in HCI_USER_CHANNEL [1] mode, the vendor specific frames are never tranmitted to the driver, as they are filtered in hci_rx_work(). Allow HCI devices which operate in HCI_USER_CHANNEL mode to receive frames if the HCI device is is HCI_INIT state. [1] https://www.spinics.net/lists/linux-bluetooth/msg37345.html Fixes: 23500189d7e0 ("Bluetooth: Introduce new HCI socket channel for user operation") Signed-off-by: Mattijs Korpershoek Signed-off-by: Marcel Holtmann Signed-off-by: Sasha Levin --- net/bluetooth/hci_core.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c index e0de9a609265..e03faca84919 100644 --- a/net/bluetooth/hci_core.c +++ b/net/bluetooth/hci_core.c @@ -4330,7 +4330,14 @@ static void hci_rx_work(struct work_struct *work) hci_send_to_sock(hdev, skb); } - if (hci_dev_test_flag(hdev, HCI_USER_CHANNEL)) { + /* If the device has been opened in HCI_USER_CHANNEL, + * the userspace has exclusive access to device. + * When device is HCI_INIT, we still need to process + * the data packets to the driver in order + * to complete its setup(). + */ + if (hci_dev_test_flag(hdev, HCI_USER_CHANNEL) && + !test_bit(HCI_INIT, &hdev->flags)) { kfree_skb(skb); continue; } -- 2.20.1