Received: by 2002:a05:7412:7c14:b0:fa:6e18:a558 with SMTP id ii20csp460501rdb; Mon, 22 Jan 2024 09:20:48 -0800 (PST) X-Google-Smtp-Source: AGHT+IGgDpM1JD+oxMqwKL2MPXKpvsyF0lnXWGXi5j39QuHBuKAS/6XOmWO/ej53tblHaT+d/1ui X-Received: by 2002:a05:6870:b51f:b0:213:3133:b6af with SMTP id v31-20020a056870b51f00b002133133b6afmr219519oap.112.1705944047860; Mon, 22 Jan 2024 09:20:47 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705944047; cv=pass; d=google.com; s=arc-20160816; b=uzhKoYLtFvEyIojR5ZxOYbvB+zvlwKouJ3P/yVW+gzKk9uQq1/UUn3GcmLlg9RJanS 9L8RAy+bRWQr7uXiEB5OH/DacveXW7E3mR2qvEWNgEgL74ya//nbNSZrwYzbl0g5Lx9K M7xGlnnj2TTMSEXWfALpcn2KaRAa7HYTPNxvrfHReYcXBVAX9m/+GHGHNqi7iqYRweA2 ZcdjGsZi6ZyXZqVphmeWaJwxdXbi+spw2979MGD0X2Vv0QFA91P+LYKmN1Otl7/PhP3r rBouk6EX3JUhT3Q9xjpIQt2PKk3j+AlGDBybRUax6qT2r8dRnVp0f3IjP2j0XoN8g57K qdSw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:to:from :dkim-signature; bh=tbNABJqSzj0kqcHCMHSyKMQUwZZuuwuYl7pA/mkjWSQ=; fh=4lGQI6056MBa4/oovMyIYaKLn+Wz/24RGvUivMmQP8E=; b=BT0ba5yUht6TgTVjSYPTxhdBrusIz80L4gspl0ZRGMlV+5TXVOnjgF3PerTe+NrRHH V8Kpho0vdEHH0L7DDQefTHJIsOojXkP+QSYmJuDE+kLI0jCSZVSMNG4EhYSC44xZoQxF rYnnin76k19bFsIjZAwVlfm+HxeyYOHdEoSJtcL0kNmzVStvYoP3q1h6IRA3i2+PbUAR AQvilMvdVX4a+ArjMETdGvAuFYcKVxoeSH90RPoMx7Hx/8nepMobJWktUWZmPisp+DE0 OLCX0pLBVs8bUfGqWGUOPZ1bg0DdOl0EOEk6VnQcpbnljqQXmm/lqfEem4gnpyKJ/I8q 3oRg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=FFTd0fIa; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-bluetooth+bounces-1226-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-bluetooth+bounces-1226-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id b17-20020ac84f11000000b0042839f9aae5si5622029qte.769.2024.01.22.09.20.47 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Jan 2024 09:20:47 -0800 (PST) Received-SPF: pass (google.com: domain of linux-bluetooth+bounces-1226-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=FFTd0fIa; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-bluetooth+bounces-1226-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-bluetooth+bounces-1226-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id DC11F1C26E61 for ; Mon, 22 Jan 2024 17:20:30 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 02A2F3F8F2; Mon, 22 Jan 2024 16:15:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="FFTd0fIa" X-Original-To: linux-bluetooth@vger.kernel.org Received: from mail-qt1-f182.google.com (mail-qt1-f182.google.com [209.85.160.182]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 119093F8DF for ; Mon, 22 Jan 2024 16:15:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.182 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705940127; cv=none; b=sBszRQRDu7YNPCl9JZCXTapWyRJGZ6ucXAhRuXBeqe10KbKXxVBsZnAfLzVOcB+aiMNLf6AXlV690IWUad5tBDQwN9yuHzIt4Kvn1QucNtyaP8jEAcd6PRWzJMgC7EiXgR7P9DYEVWdTCAKAnE83fB+mK7jNM2rJskkAje1B4FU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705940127; c=relaxed/simple; bh=MJUAglIkAmUXngawOKbJZzoyQjgte/oTJ0mFNcy73lQ=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=ESPMbieOjXo4Imkn71kSoLaJX0A7WR9+3eaRp7Zs0jxFPctEs/7aZNDPiLVLfL+hflaEn2fVJsNFE9jV0ADwRME09KR3gxLQ+pHmUvaV35i0ZI33Yaem07m3kcNgL9c10DrSb2aD1zKM8k018AtVarn1tzpJKD7WLNv1bdmM19Y= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=FFTd0fIa; arc=none smtp.client-ip=209.85.160.182 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-qt1-f182.google.com with SMTP id d75a77b69052e-42a35982c09so12711941cf.1 for ; Mon, 22 Jan 2024 08:15:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1705940124; x=1706544924; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:from:to:cc:subject:date:message-id:reply-to; bh=tbNABJqSzj0kqcHCMHSyKMQUwZZuuwuYl7pA/mkjWSQ=; b=FFTd0fIaMI7ch7YG96Dy6NNcS7kBqVtsuyqmuJ/kNC8QQiv1dkQRix0UVsdSvZXT/u IXMwwK3bPICLVHzwPCeCxGCKwZodmPuNRQ5foeX5NFHfI3JYbJC6WmOnYu42yixYloLd Z4TDM5fLM0T885DWEqD0QDpTaIcZWdbeiuO5qlj/+tSarbA+1uTWLRhiL6XUHP3LpAFL RQpudiF6Nu5GBb5zcQlgyl42fVOJH+BjiaZM7SEC4SPkH+En1Bu7KxPf256LwiW2QVOJ G5Nal7XURBSO1nhhTsm6JqdD8qFMulDlYpw0TVOkVD6zlERVQeobyAGlYbyQ9NNDHFHw pmVw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705940124; x=1706544924; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=tbNABJqSzj0kqcHCMHSyKMQUwZZuuwuYl7pA/mkjWSQ=; b=pD0dpUatXGtnRArGvu+jYuATYTyTXW7uTdFB7n0B2eUBk5VpGyaQleqDXi0BO0ZClh t7VLrx1S27mcTaHgDiFZbe5jQR8w8PRLF7Scx1ezhX9dQpZzD6rWgtJUsjalj0X/QFn5 786qMc0XuwbI23ME6oDOgZwpsGfoMzOTK2mXKcxtJqQ75LW8wuywIi4dEUGi+Pb90vTy A5Dyn99t6TyTZM9DGUvXwCfhT9+RLviLjbpINXutJjwoHRWHNnXt5UHnucVtcZXhsJnY AmQ7rVhV0oCjjMMu93hvK5Of4xMWd0O9xBxGw2IZsUwtt1nga6Q5YVzUN9uKt+Ib3FhE zFhw== X-Gm-Message-State: AOJu0YxJGUzc8jOnVKUQQjQlukSjprG4dV1+VqSiyeDgW6VHzhEgLoDA zUpYB/6hS1N0zfWdr2Uv5hYBerwhuVj+ktwsFgH1FXziHg/AhbO6nTnFWh1b X-Received: by 2002:a05:6214:2686:b0:681:954c:39cb with SMTP id gm6-20020a056214268600b00681954c39cbmr6340297qvb.75.1705940123776; Mon, 22 Jan 2024 08:15:23 -0800 (PST) Received: from lvondent-mobl4.. (071-047-239-151.res.spectrum.com. [71.47.239.151]) by smtp.gmail.com with ESMTPSA id op23-20020a056214459700b0068681793468sm1798612qvb.36.2024.01.22.08.15.22 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Jan 2024 08:15:23 -0800 (PST) From: Luiz Augusto von Dentz To: linux-bluetooth@vger.kernel.org Subject: [PATCH v1] Bluetooth: hci_event: Fix handling of HCI_EV_IO_CAPA_REQUEST Date: Mon, 22 Jan 2024 11:15:21 -0500 Message-ID: <20240122161521.2650805-1-luiz.dentz@gmail.com> X-Mailer: git-send-email 2.43.0 Precedence: bulk X-Mailing-List: linux-bluetooth@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: Luiz Augusto von Dentz If we received HCI_EV_IO_CAPA_REQUEST while HCI_OP_READ_REMOTE_EXT_FEATURES is yet to be responded assume the remote does support SSP since otherwise this event shouldn't be generated. Link: https://lore.kernel.org/linux-bluetooth/CABBYNZ+9UdG1cMZVmdtN3U2aS16AKMCyTARZZyFX7xTEDWcMOw@mail.gmail.com/T/#t Fixes: c7f59461f5a7 ("Bluetooth: Fix a refcnt underflow problem for hci_conn") Signed-off-by: Luiz Augusto von Dentz --- net/bluetooth/hci_event.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c index 6130c969f361..a15924db83d9 100644 --- a/net/bluetooth/hci_event.c +++ b/net/bluetooth/hci_event.c @@ -5327,9 +5327,12 @@ static void hci_io_capa_request_evt(struct hci_dev *hdev, void *data, hci_dev_lock(hdev); conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, &ev->bdaddr); - if (!conn || !hci_conn_ssp_enabled(conn)) + if (!conn || !hci_dev_test_flag(hdev, HCI_SSP_ENABLED)) goto unlock; + /* Assume remote supports SSP since it has triggered this event */ + set_bit(HCI_CONN_SSP_ENABLED, &conn->flags); + hci_conn_hold(conn); if (!hci_dev_test_flag(hdev, HCI_MGMT)) -- 2.43.0