Received: by 10.213.65.68 with SMTP id h4csp903539imn; Fri, 6 Apr 2018 10:53:53 -0700 (PDT) X-Google-Smtp-Source: AIpwx49ULgFyL9VbCJl2vm9R+uTdH4couZmBVg8qLS6uNDXYxduSmJ5t8bqVn/dXmXbv1UuJV/WM X-Received: by 10.98.163.68 with SMTP id s65mr21258204pfe.13.1523037233412; Fri, 06 Apr 2018 10:53:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523037233; cv=none; d=google.com; s=arc-20160816; b=yPU42ZCpy8BgHuveMpKAh9ZZu8jNn0MQjglXB1q05Qnr36HmYNGoSh/ES253Cg6KCv lKY4C4I8esB7JTpvIMVzXPOetpYaoDezBb29a6ot40bGcQeH1rejCMniCU/0dqM9QiQ4 CsnMKiQ8qXW1idMs8kBcw2NrWNYyZhB2ayzncA3jzSNL4d7ucsm1gbBk59ABkIDNQejO GukWysOVyR4kGR+U+cHJUkBRqr6MtpgqksyK6KxwU9M4S3PARjjmDcOgOSv+LWcZjKnT la8zCcVQeKJMgncRb8/MRWw0mIbf6puIxVQjkU4eZEOll5gMQ8N+l+pUwy+fsEPD+FyF HTVQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=BH6HB4HA6PIqC550qXMUd9VwuuSOXh2Qy6HrIznWr5Y=; b=x4kx/RiRX5F++KhlQOMOI/bIo+cfMx2b+8iEhSodju9h3YSKErw6y+5EQIZ0sQ24QZ Z7Wu9nDaAc+uX/XfdA4xmlmIUjCnuIBS2P5EFp94qL4Bfk8XgsLVw0lu2UgbJeCkgJh3 FKqeq86511r0s+G9ulKbi9njUZUlI/Sf7+sOQMTPAV/wJ4TFHE8Gg1kR0o+E4Mo05y4B EGtw9Ja7zEw/Tf/B8NimkpfdaC/hGaBxgE1tur6wjT6hWjRisPWP15hbQtEuP6yvOcr/ Ok57E8B8EC4aPIPupryVKmzqTlB/BudV6j3LikAmiADmuI0M4IxJxQL+ujbw9OxeJJKs AI+w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a1-v6si8865504plt.693.2018.04.06.10.53.13; Fri, 06 Apr 2018 10:53:53 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756551AbeDFNmS (ORCPT + 99 others); Fri, 6 Apr 2018 09:42:18 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:36840 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756540AbeDFNmL (ORCPT ); Fri, 6 Apr 2018 09:42:11 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 1FF42C64; Fri, 6 Apr 2018 13:42:10 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Szymon Janc , Marcel Holtmann Subject: [PATCH 4.15 38/72] Bluetooth: Fix missing encryption refresh on Security Request Date: Fri, 6 Apr 2018 15:24:13 +0200 Message-Id: <20180406084352.393370616@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180406084349.367583460@linuxfoundation.org> References: <20180406084349.367583460@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.15-stable review patch. If anyone has any objections, please let me know. ------------------ From: Szymon Janc commit 64e759f58f128730b97a3c3a26d283c075ad7c86 upstream. If Security Request is received on connection that is already encrypted with sufficient security master should perform encryption key refresh procedure instead of just ignoring Slave Security Request (Core Spec 5.0 Vol 3 Part H 2.4.6). > ACL Data RX: Handle 3585 flags 0x02 dlen 6 SMP: Security Request (0x0b) len 1 Authentication requirement: Bonding, No MITM, SC, No Keypresses (0x09) < HCI Command: LE Start Encryption (0x08|0x0019) plen 28 Handle: 3585 Random number: 0x0000000000000000 Encrypted diversifier: 0x0000 Long term key: 44264272a5c426a9e868f034cf0e69f3 > HCI Event: Command Status (0x0f) plen 4 LE Start Encryption (0x08|0x0019) ncmd 1 Status: Success (0x00) > HCI Event: Encryption Key Refresh Complete (0x30) plen 3 Status: Success (0x00) Handle: 3585 Signed-off-by: Szymon Janc Signed-off-by: Marcel Holtmann Signed-off-by: Greg Kroah-Hartman --- net/bluetooth/smp.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) --- a/net/bluetooth/smp.c +++ b/net/bluetooth/smp.c @@ -2296,8 +2296,14 @@ static u8 smp_cmd_security_req(struct l2 else sec_level = authreq_to_seclevel(auth); - if (smp_sufficient_security(hcon, sec_level, SMP_USE_LTK)) + if (smp_sufficient_security(hcon, sec_level, SMP_USE_LTK)) { + /* If link is already encrypted with sufficient security we + * still need refresh encryption as per Core Spec 5.0 Vol 3, + * Part H 2.4.6 + */ + smp_ltk_encrypt(conn, hcon->sec_level); return 0; + } if (sec_level > hcon->pending_sec_level) hcon->pending_sec_level = sec_level;