Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp945494pxf; Wed, 7 Apr 2021 15:46:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyVQBLVSbfeb6cs3JnbRmkTiP1cNOsIIV8N+F2NmV5BIxrvQMaunX1Dg27A1uybsDAAtXbH X-Received: by 2002:a17:907:1c1e:: with SMTP id nc30mr6666417ejc.34.1617835571280; Wed, 07 Apr 2021 15:46:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617835571; cv=none; d=google.com; s=arc-20160816; b=HlbUuiW6RNq7gqfPGODOgmlrK4enWXsDarW54SBObVDkWJKznv7X86xbui8FPTnZIv HZc3TkE9oR//NUwAQRCOW+r1bhW45FzaZ+YlM6Nlq/zO24TnzEe4BrVnRznAKZXQt6BF 4EWcvaUIq/3hsPF8/JNgMCllhpp/5uEJD4Xv8qJjaCt010rMQMHNGiJsWbxoUvs2BM4m 8JJuhuxSKO+ThDbnF5wR8B4gM+Uw+Rgt9Q2Ibw2++NSyGV0RKlhClj3gDmzOp7MMWHxO 0nM1LjvjMnvPItBHp5tmOfsgOnOQTYBUwP6aQ4nBveJ8m+d6bfUE/eEO5H1lORdkY/GK Gw4A== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=fafjcnBq2URM0Yjq6oNkQGwvUKtRbkBdR7ZQ9xqwnLI=; b=vCYxWarkGEzAMzKFsucoU1Vh8AiZv0/FYhBm8Sn9ZEa/Bq0LjyE0ypmmDz0YpXDvs6 PF0Dm+0g4yDRq5CLkIWeju7ASnEpmxMVxgsfUSY+RcWj6me9d0U6RvnTL2WCtbu3EGGI Bk7tIzhyCB0iPpQ1PwDAM8jOZF+gEAtozBD9HOBnSsgDPwdzFk2x0XUm3THvYa5t63oC xonvezL6KO2788WFJwF0OnTQDeW/W/nj8t7CQE5rCcpXOb5QQFTd4kpcuQejurhWDJ3a njtC7oA8/4oXi864vfFPRoXtz/eFJMpJGmKo7dvpuD1LL04lkMPHFsqW/XkzAmpmXVWK jaGQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=P7gvirZP; 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=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id x4si20503282edd.118.2021.04.07.15.45.38; Wed, 07 Apr 2021 15:46:11 -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=@chromium.org header.s=google header.b=P7gvirZP; 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=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230296AbhDGWeE (ORCPT + 99 others); Wed, 7 Apr 2021 18:34:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41796 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230019AbhDGWeE (ORCPT ); Wed, 7 Apr 2021 18:34:04 -0400 Received: from mail-pg1-x531.google.com (mail-pg1-x531.google.com [IPv6:2607:f8b0:4864:20::531]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1E8F9C061760 for ; Wed, 7 Apr 2021 15:33:54 -0700 (PDT) Received: by mail-pg1-x531.google.com with SMTP id h25so14139552pgm.3 for ; Wed, 07 Apr 2021 15:33:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=fafjcnBq2URM0Yjq6oNkQGwvUKtRbkBdR7ZQ9xqwnLI=; b=P7gvirZPj4+k7uUeuRVLQH39fjM7G5d+ltYQK+aQStMMnlCKcvvg0TPNund33LoZO3 t744kXiq5kbNC94LdveHl7vhjGDopv3UGo4pMDCjku3uf066RxrGaLTt0zfL0DiVQaSG 3yLFHjbMrSRgkCdAJMFuJg4/wxl8SUZbJzqvA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=fafjcnBq2URM0Yjq6oNkQGwvUKtRbkBdR7ZQ9xqwnLI=; b=KUS/FoHIS1Ucfz73MBovNWvay2DEGAN+Cqi5AajcAoDuD4F+Gc9J3xC+1XhB/+ZIom KBOlr1iMPePLLUAPouM/y6/tCEDAbE6f0p30e912AorgudIYomshdo0loBqNaOwgtBBd phZen+B1uLYUKq4a4WceU719fgXCsNRvDpx0rNaLRHT3mCjr+XgcupGD1wJmZp2ib2sx 65x1oCjEPl3Ovn6qRb9XeURgueUxVgUZCEB5WOHknh6ag0SyCQedl2T6HLpu+LZ8gxJd j1XiJysLCEPMtaJAsHLNYe7iCeFxIkIsnpheOHGbewljXYll6qAfaznPvbfid0RPcECk sfAw== X-Gm-Message-State: AOAM531PB4wPaFshR0ELvwf3o1w1QiWCYbkRLPPdxo0iAtikHPqZQfZ2 XUYmZ7RjTCoe9F4FZYXXiCLLAJ0WM+wptQ== X-Received: by 2002:a63:be0f:: with SMTP id l15mr5302966pgf.39.1617834833438; Wed, 07 Apr 2021 15:33:53 -0700 (PDT) Received: from sonnysasaka-chrome.mtv.corp.google.com ([2620:15c:202:201:c572:df03:d9fe:57c5]) by smtp.gmail.com with ESMTPSA id kx11sm6072674pjb.21.2021.04.07.15.33.52 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 07 Apr 2021 15:33:53 -0700 (PDT) From: Sonny Sasaka To: linux-bluetooth@vger.kernel.org Cc: Dmitry Torokhov Subject: [PATCH BlueZ] input/hog-lib: do not silently ignore missing connection in read_char() Date: Wed, 7 Apr 2021 15:33:47 -0700 Message-Id: <20210407223347.28669-1-sonnysasaka@chromium.org> X-Mailer: git-send-email 2.31.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org From: Dmitry Torokhov Currently we silently ignore missing connection (attrib) in read_char(), but not in the other GATT interfaces (such as write_char, discover_desc, etc). The code should avoid calling read_char() when there is no active connection instead, and logging errors will help us trace the offenders. --- profiles/input/hog-lib.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/profiles/input/hog-lib.c b/profiles/input/hog-lib.c index 6ac14e401..6605538cf 100644 --- a/profiles/input/hog-lib.c +++ b/profiles/input/hog-lib.c @@ -181,10 +181,6 @@ static void read_char(struct bt_hog *hog, GAttrib *attrib, uint16_t handle, struct gatt_request *req; unsigned int id; - /* Ignore if not connected */ - if (!attrib) - return; - req = create_request(hog, user_data); if (!req) return; -- 2.31.0