Received: by 2002:a05:6358:bb9e:b0:b9:5105:a5b4 with SMTP id df30csp4480506rwb; Tue, 6 Sep 2022 08:06:48 -0700 (PDT) X-Google-Smtp-Source: AA6agR49p73RdC4dAIJUOX3wF+XDjf1O984ludwXqg6jvUkrjN1AidzSfMk95KZ5ZiDh38uDdZCN X-Received: by 2002:a17:902:cf4a:b0:175:4fbb:7766 with SMTP id e10-20020a170902cf4a00b001754fbb7766mr30020317plg.94.1662476808182; Tue, 06 Sep 2022 08:06:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662476808; cv=none; d=google.com; s=arc-20160816; b=ZfOvj1f/q6GbPypU6+5O0tKtzw3ZIjPamGH9o/04vFb8kIjgp5vzbL1GzMcR3JexdH JpD1ijwUy21R+19192z8lJInJC8a1iL4bmVF8HVgD9/FlTyLxx+ALtyYc0pCQDduwXoC AVKn/zuxfaortQbbDR+NZToc2CGBz8wAKS1fHAio7dKAP/wlsWunSy5vzFzG6Kt6IKCb X1f6+LuxWEQqiWm4EzhnijqZHni+0YXbC1+NgqZoJe/lnXL55MHj+Ig/sAk9dbLhipcY HqTB5BQPx6qlhXWhRX1USvVCd+Xe11JX2gd6nSAjvaiGapjRq97BBPDjU2j8G3sY0swM 4icg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=ZkAHuROX48qMLsQk1Q4ZkqGynBWcS707Myirk7m0ZPg=; b=hZQZFepHvVYFoLFzfkJunH8UdzNvPCakquu3lumPJr2uefrpFig30si2dfJSn0tjG+ 3iF4JFR3F3My8tDOnNBlE+Wsv37lOwoVBel/4yggTzvmOMC1Fsuln4z6VKqi9ByZxNvH QA8X5DFMV98NAs++BTNhJBQUFhQQRQ1yUeYkzNt8mtQawqJN8YTdLCm82+PYN3RHVecP 7+DFO/ztDIyaJ1nfM9OxBb/YLb39CFQWQ+T+i+UgFqe722hYEfbfilXRs0oTwvDG+VfN ZI58Vg2y6/klqUEsotrRT+kO5kL52/0+e6qbpUQcezPlVATmliSxe2DEmPPaxQFUtImT tO4w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=EuD3O3Ds; 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=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y23-20020a631817000000b004298268026fsi115014pgl.142.2022.09.06.08.06.30; Tue, 06 Sep 2022 08:06:48 -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=@linuxfoundation.org header.s=korg header.b=EuD3O3Ds; 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=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240160AbiIFOC0 (ORCPT + 99 others); Tue, 6 Sep 2022 10:02:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57288 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240885AbiIFN7C (ORCPT ); Tue, 6 Sep 2022 09:59:02 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AAE5D80F77; Tue, 6 Sep 2022 06:42:51 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 55D006153B; Tue, 6 Sep 2022 13:42:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 65559C433D6; Tue, 6 Sep 2022 13:42:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1662471770; bh=443dFfJZz3E9xjACW/Tq456OiJbX29QowqloZsHGVA4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EuD3O3DsqS2BOUSknSWlBSRw/mqmfpAd4TkzzSOtCWDBW/DmgcKytugmQy5Xilo90 O8L1Q9FPTfoAbwv8OxiQzFPDMdlZrLCYDZxRYzTbcZCw8sEt0XNPc+O7PZBBqAqVaw /mAyOtp2MsaBE+YkOcnRHd8gKPqKw1jJo0SiwB9Y= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Archie Pusaka , Sonny Sasaka , Luiz Augusto von Dentz , Sasha Levin Subject: [PATCH 5.19 031/155] Bluetooth: hci_event: Fix checking conn for le_conn_complete_evt Date: Tue, 6 Sep 2022 15:29:39 +0200 Message-Id: <20220906132830.736065571@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220906132829.417117002@linuxfoundation.org> References: <20220906132829.417117002@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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 From: Archie Pusaka [ Upstream commit f48735a9aaf8258f39918e13adf464ccd7dce33b ] To prevent multiple conn complete events, we shouldn't look up the conn with hci_lookup_le_connect, since it requires the state to be BT_CONNECT. By the time the duplicate event is processed, the state might have changed, so we end up processing the new event anyway. Change the lookup function to hci_conn_hash_lookup_ba. Fixes: d5ebaa7c5f6f6 ("Bluetooth: hci_event: Ignore multiple conn complete events") Signed-off-by: Archie Pusaka Reviewed-by: Sonny Sasaka Signed-off-by: Luiz Augusto von Dentz Signed-off-by: Sasha Levin --- net/bluetooth/hci_event.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c index 67c61f5240596..2c320a8fe70d7 100644 --- a/net/bluetooth/hci_event.c +++ b/net/bluetooth/hci_event.c @@ -5568,7 +5568,7 @@ static void le_conn_complete_evt(struct hci_dev *hdev, u8 status, */ hci_dev_clear_flag(hdev, HCI_LE_ADV); - conn = hci_lookup_le_connect(hdev); + conn = hci_conn_hash_lookup_ba(hdev, LE_LINK, bdaddr); if (!conn) { /* In case of error status and there is no connection pending * just unlock as there is nothing to cleanup. -- 2.35.1