From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.0 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E5481C282CE for ; Mon, 11 Feb 2019 15:16:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B590F222A8 for ; Mon, 11 Feb 2019 15:16:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1549898171; bh=DpZ03C1GVFdhWKD4pyUGz9sa0q59Td38wOkuSxGFUPE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=VOXeYVmTCHja87hy8XqjsMLz4CufHOqWfloKjy5Ahkg3652D1DMifbSoWEdWI9/T+ 0+IZ4hku0gE5UppI/5DGevfr86Xa5/sfimddPxMnjDvTz7Hvb6SfyOPfTSgRY8M6uJ T8yU+1REnWEWNj0cL4b2xmFPWS7CyJmdluNk7Qgk= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2391253AbfBKPQF (ORCPT ); Mon, 11 Feb 2019 10:16:05 -0500 Received: from mail.kernel.org ([198.145.29.99]:57038 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2391332AbfBKPHQ (ORCPT ); Mon, 11 Feb 2019 10:07:16 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 9D300217D9; Mon, 11 Feb 2019 15:07:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1549897636; bh=DpZ03C1GVFdhWKD4pyUGz9sa0q59Td38wOkuSxGFUPE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iB2o3MLOydTwl3P+vGydjWEW0mUmGcDX+6kg/TaoxYxQbiDvSYS9D21G9wpINZOX/ dq2/BJqA5eYNXhgFSHCk1nHk/MpMszuIvwP9PJJ5LKs3nqqSxx7NtHILjtTjVYwRTy 71pYyTch0snV/gV64S+yBuNwsL+CuY3IfPdjbcjs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Johan Hedberg , Luiz Augusto von Dentz , Marcel Holtmann , Sasha Levin Subject: [PATCH 4.9 064/137] Bluetooth: Fix unnecessary error message for HCI request completion Date: Mon, 11 Feb 2019 15:19:05 +0100 Message-Id: <20190211141817.895301690@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190211141811.964925535@linuxfoundation.org> References: <20190211141811.964925535@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org 4.9-stable review patch. If anyone has any objections, please let me know. ------------------ [ Upstream commit 1629db9c75342325868243d6bca5853017d91cf8 ] In case a command which completes in Command Status was sent using the hci_cmd_send-family of APIs there would be a misleading error in the hci_get_cmd_complete function, since the code would be trying to fetch the Command Complete parameters when there are none. Avoid the misleading error and silently bail out from the function in case the received event is a command status. Signed-off-by: Johan Hedberg Acked-by: Luiz Augusto von Dentz Signed-off-by: Marcel Holtmann Signed-off-by: Sasha Levin --- net/bluetooth/hci_event.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c index d2f9eb169ba8..6f78489fdb13 100644 --- a/net/bluetooth/hci_event.c +++ b/net/bluetooth/hci_event.c @@ -5212,6 +5212,12 @@ static bool hci_get_cmd_complete(struct hci_dev *hdev, u16 opcode, return true; } + /* Check if request ended in Command Status - no way to retreive + * any extra parameters in this case. + */ + if (hdr->evt == HCI_EV_CMD_STATUS) + return false; + if (hdr->evt != HCI_EV_CMD_COMPLETE) { BT_DBG("Last event is not cmd complete (0x%2.2x)", hdr->evt); return false; -- 2.19.1