From patchwork Sat Aug 1 16:29:55 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Samuel Holland X-Patchwork-Id: 11696159 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id AC6FC912 for ; Sat, 1 Aug 2020 16:30:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 941422080C for ; Sat, 1 Aug 2020 16:30:07 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=sholland.org header.i=@sholland.org header.b="RGpVdE6R"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="RaOPscq5" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726534AbgHAQ37 (ORCPT ); Sat, 1 Aug 2020 12:29:59 -0400 Received: from out3-smtp.messagingengine.com ([66.111.4.27]:44369 "EHLO out3-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725841AbgHAQ37 (ORCPT ); Sat, 1 Aug 2020 12:29:59 -0400 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.nyi.internal (Postfix) with ESMTP id F400B5C0073; Sat, 1 Aug 2020 12:29:57 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute3.internal (MEProxy); Sat, 01 Aug 2020 12:29:58 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sholland.org; h= from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; s=fm3; bh=53Jxaj3NoHeE/kFuF4Ggf7Os2J Cj0STpNlmUixXXrgc=; b=RGpVdE6RgdbHMd8hiA7W9m/ow2qPINGWeYYQs9VWrt gSEjZ4HEu33hx36JMWxDB46Vt7J8T92XYF1CVoOhG3PaYIwfFUQS/y5InIabgTpF ZaMz0IMKuAChOSJWw7UfzbBqzU4DbrfAnYO7BZCPPsH3u7Sb6Zzj+efMDky/enh0 6tKqdnuYlLAmRIGWYMThepHEhC74gsJ4CpI2Xtfaiqjle5kiYKjb/ntc2QbewKei 6uf8KwQw6USi1nSnYbmrIHt1hw7zcHXiP0PGORfEGibNdYMzCttWt3eNKuZPWkdr UTCFwjeGmpTPoEJpiHFNBpzC6bjeMY28uQITgcC6O2Fg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :message-id:mime-version:subject:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; bh=53Jxaj3NoHeE/kFuF 4Ggf7Os2JCj0STpNlmUixXXrgc=; b=RaOPscq5J9gKRyrU9eXsuO48kqRwOcFV4 erpZMPM0/Cb1DpJjtTYXVXgN7U27dNfAN5qCEhLofjPh8ZfRuMDuTX6LNaXUvQey L0BeoNnTNPwblCPXpCocM7WNuScNCcVIOxWTUaxEypiXf4NZr3KIhAxY7vamx+FS RhRBMYlL+SUS1+eWdxSpusAVrVjCX6KAkyUaoY12ypFbOeDJU8JR7vsAnmY88LOQ 2JYDHF3gwJ78jNxtHkFKLrR5KSag0F5t3ZobItiSJS+7eTArB1zCHzf90u0C7R1z nbE6P8fqFbXbHsFEsplOq3Mh128JsbjMi8CciyYNSVrSgtCJ4RhRQ== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduiedrjedtgddutdefucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvufffkffoggfgsedtkeertdertddtnecuhfhrohhmpefurghmuhgvlhcu jfholhhlrghnugcuoehsrghmuhgvlhesshhhohhllhgrnhgurdhorhhgqeenucggtffrrg htthgvrhhnpeeiteekhfehuddugfeltddufeejjeefgeevheekueffhffhjeekheeiffdt vedtveenucfkphepjedtrddufeehrddugeekrdduhedunecuvehluhhsthgvrhfuihiivg eptdenucfrrghrrghmpehmrghilhhfrhhomhepshgrmhhuvghlsehshhholhhlrghnugdr ohhrgh X-ME-Proxy: Received: from titanium.stl.sholland.net (70-135-148-151.lightspeed.stlsmo.sbcglobal.net [70.135.148.151]) by mail.messagingengine.com (Postfix) with ESMTPA id 1E5D730600A3; Sat, 1 Aug 2020 12:29:57 -0400 (EDT) From: Samuel Holland To: Marcel Holtmann , Johan Hedberg Cc: Gustavo Padovan , Hans de Goede , linux-bluetooth@vger.kernel.org, linux-kernel@vger.kernel.org, Samuel Holland Subject: [PATCH 1/2] Bluetooth: hci_h5: Remove ignored flag HCI_UART_RESET_ON_INIT Date: Sat, 1 Aug 2020 11:29:55 -0500 Message-Id: <20200801162956.22610-1-samuel@sholland.org> X-Mailer: git-send-email 2.26.2 MIME-Version: 1.0 Sender: linux-bluetooth-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org Since commit cba736465e5c ("Bluetooth: hci_serdev: Remove setting of HCI_QUIRK_RESET_ON_CLOSE."), this flag is ignored for hci_serdev users, so let's remove setting it. Signed-off-by: Samuel Holland --- drivers/bluetooth/hci_h5.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/bluetooth/hci_h5.c b/drivers/bluetooth/hci_h5.c index e41854e0d79a..981d96cc7695 100644 --- a/drivers/bluetooth/hci_h5.c +++ b/drivers/bluetooth/hci_h5.c @@ -793,8 +793,6 @@ static int h5_serdev_probe(struct serdev_device *serdev) if (!h5) return -ENOMEM; - set_bit(HCI_UART_RESET_ON_INIT, &h5->serdev_hu.hdev_flags); - h5->hu = &h5->serdev_hu; h5->serdev_hu.serdev = serdev; serdev_device_set_drvdata(serdev, h5); From patchwork Sat Aug 1 16:29:56 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Samuel Holland X-Patchwork-Id: 11696157 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 183FE138C for ; Sat, 1 Aug 2020 16:30:06 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id EA1DD20829 for ; Sat, 1 Aug 2020 16:30:05 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=sholland.org header.i=@sholland.org header.b="QpBmy8JE"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="gmwiPuLf" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726947AbgHAQ37 (ORCPT ); Sat, 1 Aug 2020 12:29:59 -0400 Received: from out3-smtp.messagingengine.com ([66.111.4.27]:37301 "EHLO out3-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726300AbgHAQ37 (ORCPT ); Sat, 1 Aug 2020 12:29:59 -0400 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.nyi.internal (Postfix) with ESMTP id 08F835C00CD; Sat, 1 Aug 2020 12:29:58 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute3.internal (MEProxy); Sat, 01 Aug 2020 12:29:58 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sholland.org; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=fm3; bh=FhcIa5vl19H1Q blhkWUef9NQmw0YCfpphgojts1RzX8=; b=QpBmy8JELAjTsoUSWhhnQ8Xsdarfx j45BkSPOB3LmOa0asJz/gYTMUMp5RIRFpnsT4ckK0XkbW0KtxgNAzAlY2MQDaAD7 uKnqjuJs9BxSAAbvY68kZipHASbjPK+VBpKO3Pu/8vyaHKke9447zy1H1py4od+Y 4PdihZQL/7lj9/oAr5KL98gFrioLT5d+cfUTjR6e7Ssl6KI8C0EhPmcxz7n6Db87 0R+oCAEauWH0HZUXuwAmO7v63EyZXCTj1V1zH5WxLh3IjlaNqjGMGPFZ7mucaXUt EVqlxbFtq4+QPd9sGV1jhe48Vqgls/5khhHO2I5GoUQByr410L+DPgqLQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm3; bh=FhcIa5vl19H1QblhkWUef9NQmw0YCfpphgojts1RzX8=; b=gmwiPuLf ty1/QDRZRbPvvrv/SqW6plo6h4QMXFosA6rGaWIqn8N6gdztx5cuQTZVzZLktmVA UzI8GGNGoZl1o1Y7Zt38/f2oPhDVt42ac6erQVMjl2q6dFmvyAjnhFq2h70bAuaF S4P+b+aQ3VhZOzXYqhrCFbmLwxJOn8Y79II4dCRVc7NRmdXNBvHfKmH7z+R2czZt 6vloy6fyudN8+JJyosbv5cLijoRtAjiqfo2khnRwPkJ2QQx84NGAjiMijvz5YFtk qfzAjzsSJoXp683vK/FPektO9wso9u/I07yMZXV+zQoSpcdRqYO5ng/Tlzb9IIe6 q6tdD6wXVLjJhg== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduiedrjedtgddutdefucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpefurghmuhgv lhcujfholhhlrghnugcuoehsrghmuhgvlhesshhhohhllhgrnhgurdhorhhgqeenucggtf frrghtthgvrhhnpeduhfejfedvhffgfeehtefghfeiiefgfeehgfdvvdevfeegjeehjedv gfejheeuieenucfkphepjedtrddufeehrddugeekrdduhedunecuvehluhhsthgvrhfuih iivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepshgrmhhuvghlsehshhholhhlrghn ugdrohhrgh X-ME-Proxy: Received: from titanium.stl.sholland.net (70-135-148-151.lightspeed.stlsmo.sbcglobal.net [70.135.148.151]) by mail.messagingengine.com (Postfix) with ESMTPA id 8C2C23060067; Sat, 1 Aug 2020 12:29:57 -0400 (EDT) From: Samuel Holland To: Marcel Holtmann , Johan Hedberg Cc: Gustavo Padovan , Hans de Goede , linux-bluetooth@vger.kernel.org, linux-kernel@vger.kernel.org, Samuel Holland Subject: [PATCH 2/2] Bluetooth: hci_ldisc/hci_serdev: Cancel init work before unregistering Date: Sat, 1 Aug 2020 11:29:56 -0500 Message-Id: <20200801162956.22610-2-samuel@sholland.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200801162956.22610-1-samuel@sholland.org> References: <20200801162956.22610-1-samuel@sholland.org> MIME-Version: 1.0 Sender: linux-bluetooth-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org If hci_uart_tty_close() or hci_uart_unregister_device() is called while hu->init_ready is scheduled, hci_register_dev() could be called after the hci_uart is torn down. Avoid this by ensuring the work is complete or canceled before checking the HCI_UART_REGISTERED flag. Fixes: 9f2aee848fe6 ("Bluetooth: Add delayed init sequence support for UART controllers") Signed-off-by: Samuel Holland --- drivers/bluetooth/hci_ldisc.c | 1 + drivers/bluetooth/hci_serdev.c | 2 ++ 2 files changed, 3 insertions(+) diff --git a/drivers/bluetooth/hci_ldisc.c b/drivers/bluetooth/hci_ldisc.c index 85a30fb9177b..f83d67eafc9f 100644 --- a/drivers/bluetooth/hci_ldisc.c +++ b/drivers/bluetooth/hci_ldisc.c @@ -538,6 +538,7 @@ static void hci_uart_tty_close(struct tty_struct *tty) clear_bit(HCI_UART_PROTO_READY, &hu->flags); percpu_up_write(&hu->proto_lock); + cancel_work_sync(&hu->init_ready); cancel_work_sync(&hu->write_work); if (hdev) { diff --git a/drivers/bluetooth/hci_serdev.c b/drivers/bluetooth/hci_serdev.c index 7b233312e723..3977bba485c2 100644 --- a/drivers/bluetooth/hci_serdev.c +++ b/drivers/bluetooth/hci_serdev.c @@ -355,6 +355,8 @@ void hci_uart_unregister_device(struct hci_uart *hu) struct hci_dev *hdev = hu->hdev; clear_bit(HCI_UART_PROTO_READY, &hu->flags); + + cancel_work_sync(&hu->init_ready); if (test_bit(HCI_UART_REGISTERED, &hu->flags)) hci_unregister_dev(hdev); hci_free_dev(hdev);