Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp5202754ybb; Tue, 24 Mar 2020 12:49:22 -0700 (PDT) X-Google-Smtp-Source: ADFU+vtv7wjNy+9Wnm0GD33AEmDE5tzTGrWSwb2ocVx6Q3HcAn0XPoKEg0OHB2gpAaJ0L6abdiBT X-Received: by 2002:a9d:b8f:: with SMTP id 15mr23030339oth.256.1585079362274; Tue, 24 Mar 2020 12:49:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585079362; cv=none; d=google.com; s=arc-20160816; b=yTt3SAPZD1jFrVzJN04Iwql7rMoTNC4dUVZJMmnXObhfpu4IdkQAAFEDON56EjEE+g 0MlAVnuRSKT6ZXagfOev37vTjUPzqr5aXN8r0hTFL5Ek8ZkWUGp1sjqV99QObx5nKmPf oiuQB5UTGstba9xUfhfx2IQc4TTfSJcU8KsVvIE6lBqJGaYQIjst9gEJanBAEkRl+7gg ttHnRSlq8EFsGAMmD88V5L46EOSL1FCQFRPenO2PMfV7nAMUMSdHrD6oMmHCelRcS2A1 vhkSzPdnTsOl491gQuEkaVardo9MMrw2QEwbdy83/Ap8FfN3vj+dP0+A4YxBmbbuUx/L EfgA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=Zj/kubDeaOKk7jPAD2N4BH8hUZPMzmvbaNoa/07GPr8=; b=sGiL3IzFoHmzo2Scj4navFUiGHwPI2i+HOpBz9xim2bygOMPJIZLCCc5sIxg1cRp0C tL3ln4Lp/wWZ8Fu9Hnctihb8Fjd+gkAfVTng2I972NhZAPjJI/xe/BZ5UuppxhiqzGxI pHgarI4/OXqQeLig5mec5QmKA9KHaU71Um8T3ANQKYQ2imB3MVKIiOrMCa2bhcHLNZHv vutcfd3glZcyP04KcWsk9xRQHOGocbia86JeVBAga18kZBLzTtWqkEcNnsZE3fO3kdey UYwt81p7yKAPMi5IEZ/01uqDq+iRLa/wKosykdFPHPRMuexLzKrkgSZF1BImvA2a/lHJ XOhA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=Pz3712hd; 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 r23si9755598otq.255.2020.03.24.12.49.02; Tue, 24 Mar 2020 12:49:22 -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=Pz3712hd; 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 S1725866AbgCXTs4 (ORCPT + 99 others); Tue, 24 Mar 2020 15:48:56 -0400 Received: from mail-vs1-f65.google.com ([209.85.217.65]:45212 "EHLO mail-vs1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725877AbgCXTs4 (ORCPT ); Tue, 24 Mar 2020 15:48:56 -0400 Received: by mail-vs1-f65.google.com with SMTP id x82so25457vsc.12 for ; Tue, 24 Mar 2020 12:48: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=Zj/kubDeaOKk7jPAD2N4BH8hUZPMzmvbaNoa/07GPr8=; b=Pz3712hdF6puiwzUy9h7Cg7iGrjnhgat/ncuxIBJiYEwkQjmXKz8IlujSaSB6JiBnX WvfNcKPZKdKllr02IBQjLNryY1EcPoubeIwMzrEXu34cvkilTNiOV6Flro7BLhNkwitC HltyuaOWDEuPGeGpaZHJwTLVFWVjAOIdeyEPc= 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=Zj/kubDeaOKk7jPAD2N4BH8hUZPMzmvbaNoa/07GPr8=; b=laC0YKV+/U8vAHUH78x2yVfChbWtszScpQsvl8DsJOvetyb+OgnoiM5M9rheUBg78j PtTs8fSfYlrocy7rJKRBamzJb34cu095ef/hzMNe7wS9RbLGknZXDEeEWqztx2AeqfKb orKbATrgJX+SUaMHKOrd0rtQNYSlTFCc4GhuxL0MqpvpNL1bmHItWc9kmGQot6+nkb/V Q2AEIxEl2kjLi6b/qZXMDf+gdDHBV1RSaypkqcbpC72RUTMPdRRAl6QjjXqwGj4Omnsb 2PHZjGcs4YK3JHe7wE01wA3HDPTbGsRY7VL18lr9DJiFFWIJa7a4lo2sk50WxpH4bvZS 9B8w== X-Gm-Message-State: ANhLgQ24L7NzmljFOky3whLvJ2L7ooTZUqo+ZTOvvwpKytK+9lssGjmm NiEiwkQHULs0cks9BrMhPr5R5y20O6s= X-Received: by 2002:a67:2786:: with SMTP id n128mr21790663vsn.21.1585079333439; Tue, 24 Mar 2020 12:48:53 -0700 (PDT) Received: from alain.c.googlers.com.com (57.152.190.35.bc.googleusercontent.com. [35.190.152.57]) by smtp.gmail.com with ESMTPSA id x78sm9351572vsc.17.2020.03.24.12.48.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Mar 2020 12:48:52 -0700 (PDT) From: Alain Michaud To: linux-bluetooth@vger.kernel.org Cc: Alain Michaud Subject: [PATCH v1] bluetooth: don't assume key size is 16 when the command fails. Date: Tue, 24 Mar 2020 19:48:49 +0000 Message-Id: <20200324194849.10084-1-alainm@chromium.org> X-Mailer: git-send-email 2.25.1.696.g5e7596f4ac-goog MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-bluetooth-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org With this change, the encryption key size is not assumed to be 16 if the read_encryption_key_size command fails for any reason. This ensures that if the controller fails the command for any reason that the encryption key size isn't implicitely set to 16 and instead take a more concervative posture to assume it is 0. Signed-off-by: Alain Michaud --- net/bluetooth/hci_event.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c index cd3d7d90029b..10703c4b7347 100644 --- a/net/bluetooth/hci_event.c +++ b/net/bluetooth/hci_event.c @@ -2970,7 +2970,7 @@ static void read_enc_key_size_complete(struct hci_dev *hdev, u8 status, if (rp->status) { bt_dev_err(hdev, "failed to read key size for handle %u", handle); - conn->enc_key_size = HCI_LINK_KEY_SIZE; + conn->enc_key_size = 0; } else { conn->enc_key_size = rp->key_size; } -- 2.25.1.696.g5e7596f4ac-goog