Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp13386084ybl; Sun, 29 Dec 2019 10:37:52 -0800 (PST) X-Google-Smtp-Source: APXvYqxhMEcsvD7Z4rG3br7bkoGdoMr1/f/KHoXbA0rzBJTwWdSJksz/iz4n1uVyQP1LL1cuT4lw X-Received: by 2002:a9d:6196:: with SMTP id g22mr72402114otk.204.1577644672686; Sun, 29 Dec 2019 10:37:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1577644672; cv=none; d=google.com; s=arc-20160816; b=l+CpS1gmGjXylb/z4heyieqBZRv/aDEMcy+zn7pAqebZH8joUjc7rmiVqeZsdD2ynd 3/NfV5HXMOs8/waavMDSliuTOWCaFCO9Fq3617/UYTg0yZXch9d7dmOVwH7qVCnOPEyA ciSgH8TCloND++Kl3q5Yl3iRqCEqoYmaBNhWvCiI1ADix5mBYCJTMMairC7oYrFCZ97a TcqtjSfSEYFtGc+kWsX0JjNCwdi2LEZ7hJlSizs2WxnFTIFV/dMCngniGSvp9Nq4C2Ht +YoYYzbWKMrot2fDJd/XIjtVV/jlKMdHx2n2GMhUpknZi3Rv1JC3nuNxA14dQTeLKTH7 nw8A== 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=WIyDZ0lWIcDhMQRoaKjE/EenOucD0+vxjQD+6vlAq1s=; b=SKcdRfvZR4Ij2KYNAHLqNpnMEz11XOc7n3/MQJtt4msrXtwuSLKJOeP0LPkNt+FRtj ZMQ73eiNhW0M7g2KPn7fS21oJ0o5YWHzV1ojxr1HK8R6a+Kj+in6FUrOXln3xdQgf/HS YBCrDZm41oqzFTwsOYpH8Rae3LgFTW2RIn0Jax3avHcw9/kvx7nfTmUxG/zVMGYTlxmF h2a2cRdF2vxJ0zhyOF3pqKDmM1W2H7GLpn1KcNEPsVi4TqUQPJjKjxQJwqKVsWWhN4fY DcbPrnBcSjqZVSUwEr13s/u7CyZIgV0DaHbiOkT9miCcvK7VmgIkUSPPvL0QQ+wJhvZh UAgw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=lakirUxG; 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 h138si19636916oib.6.2019.12.29.10.37.40; Sun, 29 Dec 2019 10:37:52 -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=lakirUxG; 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 S1727567AbfL2RXh (ORCPT + 99 others); Sun, 29 Dec 2019 12:23:37 -0500 Received: from mail.kernel.org ([198.145.29.99]:41312 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726845AbfL2RXf (ORCPT ); Sun, 29 Dec 2019 12:23:35 -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 04B1A208E4; Sun, 29 Dec 2019 17:23:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1577640214; bh=YYJYdFm48ZsJMUlQy0NaxXt6BO854VGqsxoxQjZveWs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lakirUxGO9NxHAHhDHCDCjZdHgwwNicGXduMuaekGFgpbwxPT3VXKcwYF0GC3v4sE vYNlxZnto0qS3bZxFhG5NlQ9rosrHHKPc2aEnZQd85S07dsThZxIKX8yZEB8Dg1gsb G6X0YAQJmm9DVGdtS0XLUXXTNu38ZL6j32EckqWk= 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.14 065/161] Bluetooth: hci_core: fix init for HCI_USER_CHANNEL Date: Sun, 29 Dec 2019 18:18:33 +0100 Message-Id: <20191229162419.014024111@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20191229162355.500086350@linuxfoundation.org> References: <20191229162355.500086350@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 d6d7364838f4..ff80a9d41ce1 100644 --- a/net/bluetooth/hci_core.c +++ b/net/bluetooth/hci_core.c @@ -4215,7 +4215,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