Received: by 2002:a05:6a10:c7c6:0:0:0:0 with SMTP id h6csp1963896pxy; Mon, 2 Aug 2021 15:16:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxGZXBsmqQdL4PJiQguXgAYbN3afWvk20nPULOCWWURRglU+Vf/eNbt29cHw6QeHvmnvn4c X-Received: by 2002:a05:6602:20c9:: with SMTP id 9mr2641245ioz.34.1627942572071; Mon, 02 Aug 2021 15:16:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1627942572; cv=none; d=google.com; s=arc-20160816; b=T4ZPIgy/ltAJCaBiRBdG8GzmtyP+gy5PNVNWPci8ASLa/RbibCxKA1GjbjmuWho/Eu s3Z5uyIUcGGFvVovPckvtuU984v4VY/KG2ih0XSfAcW1fFw5fC6LD1YCzIvYvL5Y6O24 ZBhOdiB3wcsg8b8orM0WMOpHmtXlkDKs/jKgEEPqEDKDtE899RVVfSaRgTj47Fb6dZkz HPBXs9KbTPTSbmV7OrL+Q6iTOmKMbURz+tRaXgl2bBdFPBIicIfJ8fSH6yaLAuSR5Ktq BbHyHNQnECun3ST9pIW4vchoEXPMpY8yHi5wK/XZa8jqQA0Nl4Ou7qiUNM4W3DX+YqR0 AYLA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-disposition:mime-version:message-id :subject:cc:to:from:date:dkim-signature; bh=DehFgworsYY8Z4elnk8GHXrsWT2MFnGFLCsMTbpqwMY=; b=y5jbXrcnOkgMW4GDIocTI4i6i8c0eXu4wTqjYSKZs+O4wjDpT0HQu0eHzYHl6ZDDrI NM5rO+deIIB4DNYqS5Alra1WPlWpJGeM/pBAo7feUAj2G6YmyaZcwd8+y7MDB4DSj2ms G/m8P7MAa5BwRqR8EdXZYGJjC304gcu1p98qYiPo+rObPse/2xw0Fkwr5f3VSK04gR8z JAmTjJLMSIV1wDfy0BbwXazzNnEkcTM/jl74jWSsmlWF7KF/4Ku52WbYNuOa46fj0IWf aRkaAsrmoSvkilfP8yiy9CGI3xb0cmbHh7U+Sg5Txi336tp9MuS1NDp4vnc4cy6Y3l5k x4zA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Cs9ZUq9i; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g2si15583926jat.88.2021.08.02.15.15.41; Mon, 02 Aug 2021 15:16:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Cs9ZUq9i; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230313AbhHBWOr (ORCPT + 99 others); Mon, 2 Aug 2021 18:14:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52188 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231907AbhHBWOp (ORCPT ); Mon, 2 Aug 2021 18:14:45 -0400 Received: from mail-wm1-x32f.google.com (mail-wm1-x32f.google.com [IPv6:2a00:1450:4864:20::32f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5B60DC06175F; Mon, 2 Aug 2021 15:14:34 -0700 (PDT) Received: by mail-wm1-x32f.google.com with SMTP id i10-20020a05600c354ab029025a0f317abfso422327wmq.3; Mon, 02 Aug 2021 15:14:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:mime-version:content-disposition; bh=DehFgworsYY8Z4elnk8GHXrsWT2MFnGFLCsMTbpqwMY=; b=Cs9ZUq9iAzEM/26fGnMSLab0UWRgKRLovKtO5XkgucS2o8tFPcYBFJy6WIdrovg+D7 owKfatd8z3HEVFuWfbYbcbWkBgndpI+ui2NomqrRLE8RzxVkVXnIVE0qi2vIuTxG9UKY pj+IbPl9Kryo+JOCuvZGEdZ7nn4m+p4DJCoYOHT2AnvEhc3onmG25/DZPGzTLgcbgf0a 75twUEuJn0m/2+uKRvCApfTQ0UofN8aDuxX4Mv9w6Iv0e96VS4bkWNFTOPS8NqYJoAZJ U6kHQmXEDebCetZxyApBmXXvJD70wKoWvWgqjJpVijYSJCzbXT9vyoddasmr0A4MjTVB A+dg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition; bh=DehFgworsYY8Z4elnk8GHXrsWT2MFnGFLCsMTbpqwMY=; b=KL4YF0+4/JBDxU9SjjdSgYXz8HLfrZC6k/MpsobC2WMevwFF8lppHGOTwhmkuubTwk ZzNUegtdC3x5TdIOdV/BItDc994ydcTfAWkTSyy1l50bJHauXdQ2yR0rnp05DGdYMQMD 0yoUdKYC57Big4B1VxQX45yDmsSxu7Px1Z95FzydsbC08IpC0HWMQasIlWHiJTlGqTjv xNqNyF6zDEfVmGUxqCInZGP6R2WTEZ8FD+gFQ/aV4Iuq6M6G/dRT/iqOxHlUiuhKkO/N Kb2mDfp5gwQTAY9qCL/zvMFQ2d/XcGduJDDk2VLP8vOY7Nf/LUBegg+7ZxuXcJe8mYs3 d7JQ== X-Gm-Message-State: AOAM531aZM2JfniWM9e+NZtVS6Mv5F22Fj+WQlaGk9V9n+hrmTX5/Wlf ADRZ6MLptN6MeBmVGLzGf5OCmAoands= X-Received: by 2002:a05:600c:2909:: with SMTP id i9mr1025024wmd.74.1627942472985; Mon, 02 Aug 2021 15:14:32 -0700 (PDT) Received: from pc ([196.235.140.151]) by smtp.gmail.com with ESMTPSA id t23sm600719wmi.32.2021.08.02.15.14.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Aug 2021 15:14:32 -0700 (PDT) Date: Mon, 2 Aug 2021 23:14:29 +0100 From: Salah Triki To: Marcel Holtmann , Johan Hedberg , Luiz Augusto von Dentz , gregkh@linuxfoundation.org Cc: linux-bluetooth@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] usb: bluetooth: get lock before calling usb_[disable|enable]_autosuspend() Message-ID: <20210802221429.GA1370657@pc> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org Based on the documentation of usb_[disable|enable]_autosuspend(), the caller must hold udev's device lock. Signed-off-by: Salah Triki --- drivers/bluetooth/btusb.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c index a9855a2dd561..2ceb48164b6d 100644 --- a/drivers/bluetooth/btusb.c +++ b/drivers/bluetooth/btusb.c @@ -1939,8 +1939,11 @@ static int btusb_setup_csr(struct hci_dev *hdev) device_set_wakeup_capable(&data->udev->dev, false); /* Re-enable autosuspend if this was requested */ - if (enable_autosuspend) + if (enable_autosuspend) { + usb_lock_device(data->udev); usb_enable_autosuspend(data->udev); + usb_unlock_device(data->udev); + } } } -- 2.25.1