Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp690684pxk; Thu, 24 Sep 2020 16:20:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxc1omCx8W4hvMLcVMxz5pLwRkaXex+R+PRyHdNfAx+Cr2MTgEeR70SJX7Rp0YeZMRS/pAP X-Received: by 2002:a50:f687:: with SMTP id d7mr1166042edn.353.1600989631538; Thu, 24 Sep 2020 16:20:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600989631; cv=none; d=google.com; s=arc-20160816; b=fwX2tXHE0qIzwoEaVhHy4sq9BpsdvBdnA2pDFZFmnw4IlJq/hcmneuhCOoWtE15BY7 YGfcRq5y0U4ledpxCbaUDJa3SXv4cTcccvBTvvwJTHQNo0k1m7sMUYLAFBXGTLYjY+7P k6hPBjvNLqBeNf4Dx1H7wIQrg1pKAJaSBB0jBQchdFqhE/dybgb9WJgITFkwZVGxTXe5 GESPw8jMqz2iFrzfPV4YZ6YYLRzLeO2utQ5xjO9h/3o8Gd4yggFdbwo6aJpNzDqQDnEd oN0z6lmMA/Vin/VuqEnRYYVdPNZOS4RFFliC4QaaP8n8nLmvK24nRf35qHx1EpWcM2L8 o/8A== 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:mime-version:message-id:date :sender:dkim-signature; bh=CtNAdJymCzf7XlDy5wdKVNQNGbifZpqsFxJiW1M5VxQ=; b=uWQAd55pACAIHBF4p9qrN544IJ/w76Q2vSs57LZpar3ujQNf+4EXT5Eh+SjQLt1am/ 7vGHB62BZHoWNZUwDkgAWyz97imZPsLnyJPRQVegTsYNPV+b06UQl53XZX4KnJuqUUfA LoI+hTjsBYpcrcvGxCRjarrr1HKZbtUYR0gSeunUxYU8snWAjVgUPuBWgSx4kx9La1ol uVIALUXOP02wJt5jFCmVrHvNFdvTIMt+lH9V+MC4BLb6Yt5QkDUEQUSd80w9ZRW4vNEY ctPn+JjxPuEF/hE1kOpf1HOBjkbpLv2mvLd0eBPCw3RlcTMb1hus7OUrjOeA/CHRHijj reug== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b="hq/CgtnC"; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id qh9si671460ejb.613.2020.09.24.16.20.06; Thu, 24 Sep 2020 16:20:31 -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=@google.com header.s=20161025 header.b="hq/CgtnC"; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726604AbgIXXUC (ORCPT + 99 others); Thu, 24 Sep 2020 19:20:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55010 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726397AbgIXXUC (ORCPT ); Thu, 24 Sep 2020 19:20:02 -0400 Received: from mail-qt1-x849.google.com (mail-qt1-x849.google.com [IPv6:2607:f8b0:4864:20::849]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A50D0C0613CE for ; Thu, 24 Sep 2020 16:20:02 -0700 (PDT) Received: by mail-qt1-x849.google.com with SMTP id y53so572821qth.2 for ; Thu, 24 Sep 2020 16:20:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=sender:date:message-id:mime-version:subject:from:to:cc; bh=CtNAdJymCzf7XlDy5wdKVNQNGbifZpqsFxJiW1M5VxQ=; b=hq/CgtnCB0wG8Y12Hw9IfV/RmhGJnpDSjFoMTP///heap8Y/nGrQ52wcXu4Ry9/moC fp4Um2Q4LWgwZVQuWr5uKQAo44nRnpVJcpBiK+jrKc5VByqZYE9PJUdDyJeeteS/PhZI ftfcVJIBS5NoIT3RgwH4sAcdDQgFeS6JsDvtQpQlprdb2bnWIhmbaCqnU+sXZXkD6Awb BFyzbAkoO6V52sgsAnFqNIpOKn4RNtc1YxX4cVcz5QV8hJLfXvANBJdipSU1r3qp+w2G KYLDgauC5iLGc4TIZrhV5gZh5PUcHwNmpdK+NSj7U79J1XLmNarYNc4Q79ABHudI2hLf YFUg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:message-id:mime-version:subject:from :to:cc; bh=CtNAdJymCzf7XlDy5wdKVNQNGbifZpqsFxJiW1M5VxQ=; b=skoc+MOLsaZkobPZ4THtPP7yTRSYNqsNaBHz5phXINlh1u+GTcD7CUmJvjpJQfuidM CyfgdFwHn9EOGMqN8/tfYk3KyVp/jvj5SXEbaUTkrdJEyx2hAYCJ8XBUNqbiXbsi7AgS kuLxRHXNGpKB/13W2vdwq55TnN/iq5ABq0v7+DXmiofgmHmNV+n42Vg8VALzz1Uj/tBw o/uLq8n7RvETOooMMaITtQ0jhKK36pFhw1EHyjMkXh4LIkSya48jwWGVAw9zF5bDkLjD EyLpolCL8oPSAKqvQsod2FalcuRbg7ZvXdNQAoBdhFqdQ23vnQGCZTUE1YIpMXI8dald QV0Q== X-Gm-Message-State: AOAM530mwo9B9k3CG+HYdufpKcSgGb9NEwNMOFf6XUgtxdrYSpwFFh6/ m6lAewqf/a2xI1W5uwWLoarP7J1ijwp5zS8KKlaZbEpaPOyy4q7xeIwBojKsLx+mb67TdQnOagC cNRKEsKHD21FYYUR6CUA+mR6E7GdWtyNDtYwzw6DNe6gFADzHZBV+/Cfy68m9DMjPT2Iovm3arW NH Sender: "yudiliu via sendgmr" X-Received: from yudiliu.mtv.corp.google.com ([2620:15c:202:201:8edc:d4ff:fe53:2823]) (user=yudiliu job=sendgmr) by 2002:a05:6214:d6b:: with SMTP id 11mr1772084qvs.30.1600989601782; Thu, 24 Sep 2020 16:20:01 -0700 (PDT) Date: Thu, 24 Sep 2020 16:19:58 -0700 Message-Id: <20200924161949.Bluez.v2.1.Iedecbb8c8ebb111b14206dddc5bea3c40dfa1771@changeid> Mime-Version: 1.0 X-Mailer: git-send-email 2.28.0.681.g6f77f65b4e-goog Subject: [Bluez PATCH v2] device: Disable auto connect for temporary devices From: Yu Liu To: linux-bluetooth@vger.kernel.org Cc: Yu Liu Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org When connecting a LE keyboard, if the user input the wrong passkey, the stack would keep auto connect and thus allow the user to retry the passkey indefinitely which is a security concern. This fix would disallow the auto connect if the authentication failed. --- Changes in v2: - Move the logic into btd_device_set_temporary Changes in v1: - Initial change src/device.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/device.c b/src/device.c index a4b5968d4..a5ef46730 100644 --- a/src/device.c +++ b/src/device.c @@ -5684,6 +5684,10 @@ void btd_device_set_temporary(struct btd_device *device, bool temporary) if (device->bredr) adapter_whitelist_remove(device->adapter, device); adapter_connect_list_remove(device->adapter, device); + if (device->auto_connect) { + device->disable_auto_connect = TRUE; + device_set_auto_connect(device, FALSE); + } device->temporary_timer = g_timeout_add_seconds(main_opts.tmpto, device_disappeared, device); -- 2.28.0.681.g6f77f65b4e-goog