Received: by 2002:a05:6358:5282:b0:b5:90e7:25cb with SMTP id g2csp3099107rwa; Mon, 22 Aug 2022 21:31:51 -0700 (PDT) X-Google-Smtp-Source: AA6agR7VJMXHA6OBLvLcFiR0Lfh6Pa28vrwNmpYyS+XLRvZ9gUaKYNAsAgxbUlqaUpac+F2WYkNN X-Received: by 2002:a05:6a00:b82:b0:52f:518f:fe6c with SMTP id g2-20020a056a000b8200b0052f518ffe6cmr23631481pfj.80.1661229111524; Mon, 22 Aug 2022 21:31:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661229111; cv=none; d=google.com; s=arc-20160816; b=cM/0A5f7DhwVV50oAdHClszhnHpsqiDDU+A+LVxABa65RciCaQppsg4ZbCzFw3Ma7V DD043MQMmdUUEL0ry0BuD5nCkG7xZrb/6W68CU1pYoSwXDu8plV3Qq6Ar32s68W88yTv Py/Si+O8Abt/vhiHKA6FkFQmunfANaWk9mOpFQpdQfO4OJsv0hOdHAiV77par2SsBQBA PUOVWJXuXmx8KN5I6IvJ381ax5pDuUhikxypj/BRAANbGRsFCNKu2sbsvUUtdKPzHHRw cRQ/6LDeXPUfOvqnnHe9pmJNA2kYT5c54qe4/8Tj2FOfAHMJ60w0luFUhOpUoJfWoUQw z01Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:from:subject:references:mime-version :message-id:in-reply-to:date:dkim-signature; bh=26b2SOokG7fUG+DR/RGU1Ptb+ITmg2OiN31lztTaJ0E=; b=Zmu1y5cKI10cah266fEinKuISOEki4Ip0gpCdVkj2NBWkj9dNVkGWQWtjFEdypAR9m vfbhbFr68gXb5BGE+FCu4hTa5gXPuXrlg525OmcqVC5glYFjIXevBHjb0ajjoR0aiWH4 9/3KoZ/Ul846ns83bGerl5Z/+QhT0fxboBQM9pob0eZL3M2I25r8zSjdtvx3LnJaZFOH KlQtWiE9Y8C/Zj6lf5PJXiEKAUmnkcsxVReZ3wwvYMPHMliD4A7xbLUq4stXghLNRnFm JCZeU33LzAXEnY0yZri/60GhXsuZKtDr9FzYkPOZeeeuuffnHniGh0uike2Ww8cILnW1 zeJw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=RJz+cZRp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u17-20020a170902e5d100b0016a0e4d84b2si16087650plf.570.2022.08.22.21.31.39; Mon, 22 Aug 2022 21:31:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=RJz+cZRp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238000AbiHWERK (ORCPT + 99 others); Tue, 23 Aug 2022 00:17:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34404 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229684AbiHWERF (ORCPT ); Tue, 23 Aug 2022 00:17:05 -0400 Received: from mail-pj1-x104a.google.com (mail-pj1-x104a.google.com [IPv6:2607:f8b0:4864:20::104a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0A321481ED for ; Mon, 22 Aug 2022 21:17:05 -0700 (PDT) Received: by mail-pj1-x104a.google.com with SMTP id c21-20020a17090ae11500b001fab6a5be8aso5653896pjz.7 for ; Mon, 22 Aug 2022 21:17:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=cc:to:from:subject:references:mime-version:message-id:in-reply-to :date:from:to:cc; bh=26b2SOokG7fUG+DR/RGU1Ptb+ITmg2OiN31lztTaJ0E=; b=RJz+cZRp9RlbTvMhLM9LReOUXebomYIs9CcF6h6IFOZaYCUOoTQBII8VN6eEAOf3P+ 7n5Wj/DxmfjjFgfddOSWzeofOMTJ1hGWW6f02lUK2kW24cyObFMT46SscoNum2XKXJnn i/omxNVgV3/XWCFXwez4bSclwyBUJ/VrOmtQtpwVJvA7Qr5A6CbcNtgOj8M/PYzKVN1M Gv5Y7G80j24Z+ny3YYK6dxHG5hB0eTDI+wIBcGAL+8baV/94g7NBu8uzUiYeJuhqIdtb pHXzv6olzUgzW189/hVvcq3Sa7dwjyqr/oQRWCZCS3qcuItQcCx9W4+6is7/qKsm7ZQE huDw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:from:subject:references:mime-version:message-id:in-reply-to :date:x-gm-message-state:from:to:cc; bh=26b2SOokG7fUG+DR/RGU1Ptb+ITmg2OiN31lztTaJ0E=; b=51aMjq3rwM872CsKyayTjUTnzfWBMzXqdJ3iZiuFuM8MSmQTBdJbyzZz3Soed7KBBK IXI4IMl3TUWlxqR0GaUSlmFACmROmyvLNpoZIlLsuxXlo0yk19ZijQstxQV+alycMg0m N7OkS7+nvpRf1FM3ph6FrXumG63qo7pgAwFlabFcalAVqqNmwrGE8AZPjsCzg4fW2LaT wK0iB2f47j395MfoUE797nUyPKI1T6/Z5y1xrJ90uevlUXrysCkrXD9L2F5lc3uEBNVW +0A8a2YyRWEG5W8Ss47PXfDhRogEUoS1HO5/V9i/BJxfWEA+5B7Movtfou1Cg8YyYfrM qDSg== X-Gm-Message-State: ACgBeo0EchQCBev8NbGOtWqsc1Qit94kCAHCWR+vLjkZZ02A/b5Lna8K Cwp8NxhwLiQTILeQijPNSC95LNikln4Q X-Received: from jiangzp-glinux-dev.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:4c52]) (user=jiangzp job=sendgmr) by 2002:a17:90a:249:b0:1e0:a8a3:3c6c with SMTP id t9-20020a17090a024900b001e0a8a33c6cmr119787pje.0.1661228224252; Mon, 22 Aug 2022 21:17:04 -0700 (PDT) Date: Mon, 22 Aug 2022 21:16:56 -0700 In-Reply-To: <20220823041656.3398118-1-jiangzp@google.com> Message-Id: <20220822211644.kernel.v1.1.I1d10fc551cadae988dcf2fc66ad8c9eec2d7026b@changeid> Mime-Version: 1.0 References: <20220823041656.3398118-1-jiangzp@google.com> X-Mailer: git-send-email 2.37.1.595.g718a3a8f04-goog Subject: [kernel PATCH v1 1/1] Bluetooth: hci_sync: hold hdev->lock when cleanup hci_conn From: Zhengping Jiang To: linux-bluetooth@vger.kernel.org, marcel@holtmann.org Cc: Zhengping Jiang , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Johan Hedberg , Luiz Augusto von Dentz , Paolo Abeni , linux-kernel@vger.kernel.org, netdev@vger.kernel.org Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-9.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,USER_IN_DEF_DKIM_WL autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When disconnecting all devices, hci_conn_failed is used to cleanup hci_conn object when the hci_conn object cannot be aborted. The function hci_conn_failed requires the caller holds hdev->lock. Fixes: 9b3628d79b46f ("Bluetooth: hci_sync: Cleanup hci_conn if it cannot be aborted") series-to: chromeos-bluetooth-upstreaming@chromium.org Signed-off-by: Zhengping Jiang --- Changes in v1: - Hold hdev->lock for hci_conn_failed net/bluetooth/hci_sync.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/net/bluetooth/hci_sync.c b/net/bluetooth/hci_sync.c index 74a0cd5d0b37f..e08c0503027d8 100644 --- a/net/bluetooth/hci_sync.c +++ b/net/bluetooth/hci_sync.c @@ -5034,9 +5034,11 @@ int hci_abort_conn_sync(struct hci_dev *hdev, struct hci_conn *conn, u8 reason) /* Cleanup hci_conn object if it cannot be cancelled as it * likelly means the controller and host stack are out of sync. */ - if (err) + if (err) { + hci_dev_lock(hdev); hci_conn_failed(conn, err); - + hci_dev_unlock(hdev); + } return err; case BT_CONNECT2: return hci_reject_conn_sync(hdev, conn, reason); -- 2.37.1.595.g718a3a8f04-goog