diff options
author | Sonny Sasaka <sonnysasaka@gmail.com> | 2020-03-27 17:34:23 -0700 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2020-04-02 08:25:19 +0200 |
commit | 92516cd97fd4d8ad5b1421a0d51771044f453a5f (patch) | |
tree | 55a30a20b5b6ee897785826ca77bc72b14ea4f76 /net/bluetooth | |
parent | 3ee7b7cd83900bb711efadbf16fa096a615a1566 (diff) | |
download | linux-92516cd97fd4d8ad5b1421a0d51771044f453a5f.tar.gz linux-92516cd97fd4d8ad5b1421a0d51771044f453a5f.tar.bz2 linux-92516cd97fd4d8ad5b1421a0d51771044f453a5f.zip |
Bluetooth: Always request for user confirmation for Just Works
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 <sonnysasaka@chromium.org>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to 'net/bluetooth')
-rw-r--r-- | net/bluetooth/smp.c | 12 |
1 files 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; } |