Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp105805ybb; Fri, 27 Mar 2020 17:10:16 -0700 (PDT) X-Google-Smtp-Source: ADFU+vsSiUylORW21AmAMqC4uowZEC73zAoNZ29HnBY66Kl+KVTyrpLHL+UsAW1NvUtt6kUz3/vw X-Received: by 2002:a05:6830:144e:: with SMTP id w14mr1029825otp.75.1585354216389; Fri, 27 Mar 2020 17:10:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585354216; cv=none; d=google.com; s=arc-20160816; b=gmZtdVeUzxmXClkZz8LWcRLFL+6Nc9c8r7Og/46JGtmWhzHqaRnaHBrXLMBoEju0je 1NmtVAdxNlz7gSznp0n2zq7QNsjwVEXfJsmyJxIe9P8MG2kZrCdXJ+KHvSrQ3RwKiK3n HC1DCZoDh4zmZpwc5KvKYZfrndUfiChpUN6AhsUQxAJh1oYxanqmbL8YSeFp0q4a9TZD HOdErnU6mVZ0J4FkxboMvSdc15QBkLjX5ewsI/YbM1cHUz7ng7m20sDqZrNlsoGixZzh CW5nDj2Nerf+7rllUeN5C88VoJldIF6TpwM4LLDPpA9W2NAKmygbwU3Ob+m1kV7B4CSd LCAA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:to:subject:message-id:date:from :mime-version:dkim-signature; bh=WJms91HXX+7xCzd5cTG+KTHXD0CxMdfmfzkjjKZXMRQ=; b=SeEaDYN32TS9qMp4Mx4X2X23mcJWnxH4CYbHfr6re9dOtz/yuv4eYZAZdWIncOYhMj rAfjUrojFq4wL7/j/fuXAYSjKKJC2UDiMokYekn+IjBK8CJE1tAmv8bVkUfqIyM+u5Eh 7U/hJ+0VlHFGMzwn1lg9Lj8irkzNvaJngWSfG7j6lM3rS86wErkSmhuYI808KwMAfhMg hMlM7FcaOZsmCvDqgOfpwZnBFlZeqMm+2NVMidh5YlmkNEP3bRK54tGx+2v3u6NpxOIq UagkgxNr2hxoQOfsBpm9fldcaw7a/73ExieqrJcPCZKy7ORh1uKKklGGIjwd9FTB1dhX KlBw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b="V/6t1/wr"; spf=pass (google.com: best guess record for domain of linux-bluetooth-owner@vger.kernel.org designates 209.132.180.67 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. [209.132.180.67]) by mx.google.com with ESMTP id v9si3025681oib.201.2020.03.27.17.09.48; Fri, 27 Mar 2020 17:10:16 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-bluetooth-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b="V/6t1/wr"; spf=pass (google.com: best guess record for domain of linux-bluetooth-owner@vger.kernel.org designates 209.132.180.67 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 S1726225AbgC1AJm (ORCPT + 99 others); Fri, 27 Mar 2020 20:09:42 -0400 Received: from mail-ot1-f65.google.com ([209.85.210.65]:33705 "EHLO mail-ot1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726212AbgC1AJm (ORCPT ); Fri, 27 Mar 2020 20:09:42 -0400 Received: by mail-ot1-f65.google.com with SMTP id 22so11722078otf.0 for ; Fri, 27 Mar 2020 17:09:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:from:date:message-id:subject:to; bh=WJms91HXX+7xCzd5cTG+KTHXD0CxMdfmfzkjjKZXMRQ=; b=V/6t1/wrlarhTiIIdVrvDjExNcUDgrd4tll2blAqdX17YlLRQQcyX90GqLFnaromP9 LuDqJKQPQmH4Wq1aN4HCEWzhvPyHAOwgi/G9WQ3WYMff+SLL156lecVLTscduGJyrOCn 4t/07LVPc/OVTyrevCAxHfBaSE5k6rRWbfRN0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=WJms91HXX+7xCzd5cTG+KTHXD0CxMdfmfzkjjKZXMRQ=; b=XN+h7ybevMhqpBNIL6kj8H/kTgKJh43KY+Pom4XPGDM8cUSw1jusgb3dR0kCAlwFmT 9Verh+Nj6vrj7c+MgeNSnltNBI3gU8HIGn7fSLXzH1Ri9CnzBGsYyBL3ACHDjlW9Gq9n ajckHlvzAQ0BOwVf0C4f4isYxLl+nbOGYl4Aymz0bOs/8PmAlsyhjGcSqKd4euI0gwWs yLdgOPrL5uvSIx8g0MKccN5CKaZ0LER3XsEAbMPuChAYEIpcPPGvqqL1j0rf7pK0Lli8 LI97cTQCfpVMwZNtwKaPTgG5DnyPWUrJw6HnjrMPhnphu29dWynl8CjsO+3vstStWwrr VsAA== X-Gm-Message-State: ANhLgQ1BzgTYLUKJPKqdmWYbbFZRqj+yXl3drFhMXhWRk8NtO6EsAhTD o0xrKWE9tdfv8kwfPUQCNSze/R0wnaaE23wH8chv6pA2xAY= X-Received: by 2002:a9d:1b6d:: with SMTP id l100mr946856otl.70.1585354181011; Fri, 27 Mar 2020 17:09:41 -0700 (PDT) MIME-Version: 1.0 From: Sonny Sasaka Date: Fri, 27 Mar 2020 17:09:29 -0700 Message-ID: Subject: [PATCH] Bluetooth: Always request for user confirmation for Just Works To: BlueZ Content-Type: text/plain; charset="UTF-8" Sender: linux-bluetooth-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org To improve security, always give the user-space daemon a chance to accept or reject a Just Works pairing (LE). The daemon may decide to auto-accept based on the user's intent. Signed-off-by: Sonny Sasaka --- net/bluetooth/smp.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/net/bluetooth/smp.c b/net/bluetooth/smp.c index 1476a91ce935..d0b695ee49f6 100644 --- a/net/bluetooth/smp.c +++ b/net/bluetooth/smp.c @@ -855,6 +855,7 @@ static int tk_request(struct l2cap_conn *conn, u8 remote_oob, u8 auth, struct smp_chan *smp = chan->data; u32 passkey = 0; int ret = 0; + int err; /* Initialize key for JUST WORKS */ memset(smp->tk, 0, sizeof(smp->tk)); @@ -883,9 +884,16 @@ static int tk_request(struct l2cap_conn *conn, u8 remote_oob, u8 auth, hcon->io_capability == HCI_IO_NO_INPUT_OUTPUT) smp->method = JUST_WORKS; - /* If Just Works, Continue with Zero TK */ + /* If Just Works, Continue with Zero TK and ask user-space for + * confirmation */ if (smp->method == JUST_WORKS) { - set_bit(SMP_FLAG_TK_VALID, &smp->flags); + err = mgmt_user_confirm_request(hcon->hdev, &hcon->dst, + hcon->type, + hcon->dst_type, + passkey, 1); + if (err) + return SMP_UNSPECIFIED; + set_bit(SMP_FLAG_WAIT_USER, &smp->flags); return 0; } -- 2.17.1