Received: by 2002:a05:7412:e794:b0:fa:551:50a7 with SMTP id o20csp1232953rdd; Wed, 10 Jan 2024 12:54:11 -0800 (PST) X-Google-Smtp-Source: AGHT+IEUWHWIqndZhYCuOx0N14s/+sGmixh2b8Kr3tHplzEWg6v26ZiNPvDZScY2aNSJaoxxkC3Q X-Received: by 2002:a17:902:cecc:b0:1d4:f12a:ad84 with SMTP id d12-20020a170902cecc00b001d4f12aad84mr199003plg.11.1704920051085; Wed, 10 Jan 2024 12:54:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704920051; cv=none; d=google.com; s=arc-20160816; b=TnCnxxhYXpNHNjDdv/GDJEqGZhOWhm6QQCtJ6Zu9Wi0ByyRjaG6HFGtv9ztzgQjZ2j 6JTwCNHdNow+KDa4XjWpYclBsdSwiFya5lT8sp5CJ1g3d0GE8pYc04Pd0bcXnY3RuC3u N4fS1ZD4DN2izLf4m6x/veUdmd4geYvbOAaKg/SLpUpHTsac12R3cloSl6T0f/ljR9Me 7uq8ezV8L797Ot7/aQzhAdp4zQhL+9/cHtVf2IeQkuhR1HvOy1BxDpdMAnAJVyBZ6dmg 9kaDW21iG/2VVQILjNNvDz2gEvyzl/b0yLL42AgTNZx3m9T9XcxPD5Z56eLvDJOE9F1a 8mBw== ARC-Message-Signature: i=1; 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=zj++l+mf3FDa72zdeI87pU80V590WTDaa275VKlcuWo=; fh=4lGQI6056MBa4/oovMyIYaKLn+Wz/24RGvUivMmQP8E=; b=YClGPaLKZjffI6GNhm4nVPeT9OYPZL/R9SPkLmmZ89bGq6AyuVt4mLVgQ2RXYMNCz3 s3qohMY07sFMkes2JtznCW5rdn/VnJiJaE4rRZW4jf/lVMFMh8cJJXMNCV8KOqbWFdvk pMWOtCtN2KO94VNYCOzTkEM51gnnPNhj2n9BYYeZg2yTjf9EMBZKDMTYSHs0HiaoGZyq yqRoirayUPXWwqf0O78OcVwFi8fn/63IfdWFVof3DzECSVd0jSpiSDZmmf5zhaH5TlWP EcArZjMREQ0FhR4H4Zww3REhWH86pLdtF1+SorflksZSkpLyq3pAvTWlqWIrXwiHokLd oR5w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=bYy1vbn6; spf=pass (google.com: domain of linux-bluetooth+bounces-1035-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-bluetooth+bounces-1035-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id iz7-20020a170902ef8700b001d3eec878cfsi4295102plb.618.2024.01.10.12.54.10 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Jan 2024 12:54:11 -0800 (PST) Received-SPF: pass (google.com: domain of linux-bluetooth+bounces-1035-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=bYy1vbn6; spf=pass (google.com: domain of linux-bluetooth+bounces-1035-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-bluetooth+bounces-1035-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id C5E65283DC5 for ; Wed, 10 Jan 2024 20:50:41 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 902E44F1E2; Wed, 10 Jan 2024 20:47:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="bYy1vbn6" X-Original-To: linux-bluetooth@vger.kernel.org Received: from mail-oo1-f41.google.com (mail-oo1-f41.google.com [209.85.161.41]) (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 AD3014F209 for ; Wed, 10 Jan 2024 20:47:37 +0000 (UTC) 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-oo1-f41.google.com with SMTP id 006d021491bc7-59612e4a21eso1565426eaf.3 for ; Wed, 10 Jan 2024 12:47:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1704919656; x=1705524456; 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=zj++l+mf3FDa72zdeI87pU80V590WTDaa275VKlcuWo=; b=bYy1vbn6JgCV1LLIl7bNhBKq26caQpi53faHXPdEJGBo00L6U4TPjBU3bNEpRbvYjD q7vDsr/09DtCH92prbMHbUdOp2bWR9f/DJE6FsF9D2t3ICpwhquFBvw/gQAIJ06AAEqD PqK3mwlhX1N7BQu/3shAxi5C1tJm8iJ5gfwlRLK3VtTyYsGZIVBzkKIUJeE0Jm54UpCU qrbtCZGtYj16ytDh3J2dK31ILJt8ZiZm6SIDXpHgOS+giGGpNA1lDZHZagp6UN4AwJ/g e8t2eOA/R8X5cige+PrG1yIg2hfQCLNnKfxUa0yeolTxGpJ4rFw+hFmCzmfNK58f2hmI 1Ujw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704919656; x=1705524456; 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=zj++l+mf3FDa72zdeI87pU80V590WTDaa275VKlcuWo=; b=kcQRKLZ9uv9Pv5EFRfQ/MoPul9v6+hnBE3E7hrX5L6G/zvRVvks1t2/PleF1KYmeux HZ3kNovky1hkz0JQ1cUfj6P00i+UlCNnVmcGGSpm6Ddw57yM4F6AwIVu3qPMc9YGn1fS 761MWrelIbclRzsVC9TqAurOHrJLxZySxP72gQmjJRSxzRC9D3zYmgOXZR7gBEdZH+ON jv/TRBF5bITtytmOe1vwknYxNmPznz4UK+b4AAtUoFBaBQYnKpaHLlnLY1l4AjI4ELQy h6Pts6efDa3bTOQEYNsNE1E+v+OBdC9XQjlxt8BeVFZ61oHBhAx+Cq8otq01zWjNcIHq Abzg== X-Gm-Message-State: AOJu0Yy0HYU1jI72laIGHpTAb5/XJXyqjcAiGw/8bY1OEhCb02mNLdaO vYGEtWC4KVOOtAAEanWPxpEpfrxBR9o= X-Received: by 2002:a05:6820:22a0:b0:594:6f:f6d6 with SMTP id ck32-20020a05682022a000b00594006ff6d6mr205603oob.8.1704919655802; Wed, 10 Jan 2024 12:47:35 -0800 (PST) Received: from lvondent-mobl4.. (071-047-239-151.res.spectrum.com. [71.47.239.151]) by smtp.gmail.com with ESMTPSA id e12-20020a4ae0cc000000b00591cdc0f2f3sm913732oot.19.2024.01.10.12.47.34 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Jan 2024 12:47:35 -0800 (PST) From: Luiz Augusto von Dentz To: linux-bluetooth@vger.kernel.org Subject: [PATCH v2] Bluetooth: hci_core: Cancel request on command timeout Date: Wed, 10 Jan 2024 15:47:33 -0500 Message-ID: <20240110204733.685963-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 command has timed out call __hci_cmd_sync_cancel to notify the hci_req since it will inevitably cause a timeout. Signed-off-by: Luiz Augusto von Dentz --- net/bluetooth/hci_core.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c index e5cb618fa6d3..af82f903163e 100644 --- a/net/bluetooth/hci_core.c +++ b/net/bluetooth/hci_core.c @@ -1523,10 +1523,11 @@ static void hci_cmd_timeout(struct work_struct *work) cmd_timer.work); if (hdev->sent_cmd) { - struct hci_command_hdr *sent = (void *) hdev->sent_cmd->data; - u16 opcode = __le16_to_cpu(sent->opcode); + u16 opcode = hci_skb_opcode(hdev->sent_cmd); bt_dev_err(hdev, "command 0x%4.4x tx timeout", opcode); + + __hci_cmd_sync_cancel(hdev, -ETIMEDOUT); } else { bt_dev_err(hdev, "command tx timeout"); } -- 2.43.0