Received: by 2002:a17:90a:9103:0:0:0:0 with SMTP id k3csp11799632pjo; Thu, 2 Jan 2020 14:29:30 -0800 (PST) X-Google-Smtp-Source: APXvYqwagVbOJQxn37kZuiCjdIyQQS0piQdHlWce/3Do0QSkLoBovnYM/hOYy3TK+Wr/Wo81DuPM X-Received: by 2002:a9d:7b4e:: with SMTP id f14mr96612069oto.355.1578004169929; Thu, 02 Jan 2020 14:29:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1578004169; cv=none; d=google.com; s=arc-20160816; b=G/7xge1HT8jVcRdp1ACuNXgWad7mP/g2B7n5tOjWwvPae9i/MdEpm3WbjI/xYZXvoB MPY95icdyjArKhXeC3vGoRpXu4Np0MIO9buvaxXLUeDETDVqSkEtqt9ebnqnqyoJQtWW QL2hz1er6LRoWenXRX8GZzAumw1lCN9wI5VSiMnv+rNv+joikR79ApejFM02CEpRz9BB 7MhWBi9RlUsgsvFWwUIrZ5NPFvljDbeeq61Ij+QMyJ27dnuSXOq/jVBiPR10Jdk35HBF K/z07VWOZ54gAi8pP4+a791tF3Uq4MU36SonAbGaDxG6/QrjqXCGGlG2tASoYw34qOUU jbww== 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=lPo6QJRRcsaE5jZz8jE5DDgUhDTauKTqFfrPm86QHcQ=; b=dgK2aHa5YqnRBJtDU0laCYPCP9IcY2IfNP6fhut4gwd0k0ROzM32QLuzFe7Dh4NrJp PklEhq9jUuWtHzZzeHFcq6HeB2DvisYEAImoHmwYX8HBtRNiull6AWaoV/Mi7AqLrgKM p2CmyUHGi4zVG+TEepnJTUJMRDwFkGjsgYSHXSmcUNXPbPQReEjWEnWQBhF88oF4jp02 CQM8Sr0B4wkuQ9vou2AyWMaPvEDdf9iGD2ob/Q6jRsUbRnd1UIdgSKsGycGdIfHhwR1c YqX/Dq0mvCN6buMxa6Vkb3/oBz4xvVrB6E8iolMSCjX4R1+TGrB+ARNRVeUp7kTj+uic eFZA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=PII6lmwF; 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 b20si29247349otf.199.2020.01.02.14.29.18; Thu, 02 Jan 2020 14:29:29 -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=PII6lmwF; 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 S1729508AbgABW2a (ORCPT + 99 others); Thu, 2 Jan 2020 17:28:30 -0500 Received: from mail.kernel.org ([198.145.29.99]:57970 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729931AbgABW2V (ORCPT ); Thu, 2 Jan 2020 17:28:21 -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 77C5922525; Thu, 2 Jan 2020 22:28:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578004100; bh=5HZd+angLuBfQ7Vz9rgI+/1dGFQl1b/EuLaDifaVf1U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PII6lmwF6C0HSECY+DxPSQ+L7yzvOKnnFU+1OBoiLkacTbRU5BLuUPZUUHrXJl97O wnU7vaoTV3E9kX96oN1/WTkkmqipJcfIw6FaJ9Rz7gtX+Cz704WjJhk39q9jFqgNaH eWPkxs3hYXAviyxRphYl2AuTj/OBRbzeRIxiYX9U= 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.9 037/171] Bluetooth: hci_core: fix init for HCI_USER_CHANNEL Date: Thu, 2 Jan 2020 23:06:08 +0100 Message-Id: <20200102220552.181592808@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200102220546.960200039@linuxfoundation.org> References: <20200102220546.960200039@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 4bd72d2fe415..a70b078ceb3c 100644 --- a/net/bluetooth/hci_core.c +++ b/net/bluetooth/hci_core.c @@ -4180,7 +4180,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