From patchwork Fri Oct 16 09:06:55 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 290318 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.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham 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 78FE5C43467 for ; Fri, 16 Oct 2020 09:07:08 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2DA4320EDD for ; Fri, 16 Oct 2020 09:07:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1602839228; bh=D56CHBhqkDkqdmq2YkfONlSrBMiXW1cfzPua78+u7pQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=i25ed/I0xoskXn2+JGDaSE32unJcKOPGZbH2sMi3rcgzH8vZ1jB+/VYDU2SiBPzRz ZAcYYn+PZJod+zQEgFkO37ThifYPCLrufhf87/B5ClMG+Vi5hrcFCKG5yZshN13jh7 6MuPQ8ic+qaAW6MQztTti1mvr9LYd4koykKO+qR4= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2404762AbgJPJHG (ORCPT ); Fri, 16 Oct 2020 05:07:06 -0400 Received: from mail.kernel.org ([198.145.29.99]:35198 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2405356AbgJPJHC (ORCPT ); Fri, 16 Oct 2020 05:07:02 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (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 DAE5420723; Fri, 16 Oct 2020 09:07:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1602839222; bh=D56CHBhqkDkqdmq2YkfONlSrBMiXW1cfzPua78+u7pQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mBuupXq6fcJqi9DsKXqx+R+PlhOGKYe71V3ac3ZN0rqLFcV94/6xz8Ty8cqpDkWVa giy16nR7V6Q1hK6gtJ2L9m8WabIVn3qpuph/KMaGIb4DqcBWJM/tDWYO1a88TlUzLy KcoFNSUq4CFZDFtMNwkMvUJsDRjPNQ+Y357xLEXw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Luiz Augusto von Dentz , Marcel Holtmann Subject: [PATCH 4.4 02/16] Bluetooth: MGMT: Fix not checking if BT_HS is enabled Date: Fri, 16 Oct 2020 11:06:55 +0200 Message-Id: <20201016090435.548052326@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201016090435.423923738@linuxfoundation.org> References: <20201016090435.423923738@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Luiz Augusto von Dentz commit b560a208cda0297fef6ff85bbfd58a8f0a52a543 upstream. This checks if BT_HS is enabled relecting it on MGMT_SETTING_HS instead of always reporting it as supported. Signed-off-by: Luiz Augusto von Dentz Signed-off-by: Marcel Holtmann Signed-off-by: Greg Kroah-Hartman --- net/bluetooth/mgmt.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) --- a/net/bluetooth/mgmt.c +++ b/net/bluetooth/mgmt.c @@ -628,7 +628,8 @@ static u32 get_supported_settings(struct if (lmp_ssp_capable(hdev)) { settings |= MGMT_SETTING_SSP; - settings |= MGMT_SETTING_HS; + if (IS_ENABLED(CONFIG_BT_HS)) + settings |= MGMT_SETTING_HS; } if (lmp_sc_capable(hdev)) @@ -2281,6 +2282,10 @@ static int set_link_security(struct sock BT_DBG("request for %s", hdev->name); + if (!IS_ENABLED(CONFIG_BT_HS)) + return mgmt_cmd_status(sk, hdev->id, MGMT_OP_SET_HS, + MGMT_STATUS_NOT_SUPPORTED); + status = mgmt_bredr_support(hdev); if (status) return mgmt_cmd_status(sk, hdev->id, MGMT_OP_SET_LINK_SECURITY, From patchwork Fri Oct 16 09:06:56 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 290317 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.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham 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 58401C43457 for ; Fri, 16 Oct 2020 09:07:13 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 07C5220878 for ; Fri, 16 Oct 2020 09:07:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1602839233; bh=He7kd/IWKk9HXeLmeyxEBnZSNgvB3+Usi8G4fnEe6Ag=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=qoOBYNXDcSRjfojm1pYGsUdJs0o68bRJv9lF1LG88gjfYECFM8zvXvl12Y89He3rg i7ueqIuz1aFyXwZnq7gzEhpHoneig7oNU+YAL8pdF3e/x/nBBHz75p7dyIvfLEnzM8 FTF25xVk9+psMMIN8GVByKTeiA25mmTvut3pf+8s= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2405375AbgJPJHL (ORCPT ); Fri, 16 Oct 2020 05:07:11 -0400 Received: from mail.kernel.org ([198.145.29.99]:35254 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2405360AbgJPJHG (ORCPT ); Fri, 16 Oct 2020 05:07:06 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (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 5BA2E20848; Fri, 16 Oct 2020 09:07:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1602839224; bh=He7kd/IWKk9HXeLmeyxEBnZSNgvB3+Usi8G4fnEe6Ag=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ye6FswX490LZqD/8VQJo5YZkQzu/ybEzcIJ4EUb2sOt422g1LieBuJPfHfcK+MXst dWZols0KVnFkYw1IJykthsRkHykrUgWRGrGtVMhh1bSdbniqVEb7cxUdAh2idDYkrN vPCFeKlKxyFmWudBdnKH9cSlGuAC0jAoEvtElfs0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Andy Nguyen , Linus Torvalds , Balakrishna Godavarthi , Alain Michaud , Sonny Sasaka , Marcel Holtmann Subject: [PATCH 4.4 03/16] Bluetooth: fix kernel oops in store_pending_adv_report Date: Fri, 16 Oct 2020 11:06:56 +0200 Message-Id: <20201016090435.598270778@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201016090435.423923738@linuxfoundation.org> References: <20201016090435.423923738@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Alain Michaud commit a2ec905d1e160a33b2e210e45ad30445ef26ce0e upstream. Fix kernel oops observed when an ext adv data is larger than 31 bytes. This can be reproduced by setting up an advertiser with advertisement larger than 31 bytes. The issue is not sensitive to the advertisement content. In particular, this was reproduced with an advertisement of 229 bytes filled with 'A'. See stack trace below. This is fixed by not catching ext_adv as legacy adv are only cached to be able to concatenate a scanable adv with its scan response before sending it up through mgmt. With ext_adv, this is no longer necessary. general protection fault: 0000 [#1] SMP PTI CPU: 6 PID: 205 Comm: kworker/u17:0 Not tainted 5.4.0-37-generic #41-Ubuntu Hardware name: Dell Inc. XPS 15 7590/0CF6RR, BIOS 1.7.0 05/11/2020 Workqueue: hci0 hci_rx_work [bluetooth] RIP: 0010:hci_bdaddr_list_lookup+0x1e/0x40 [bluetooth] Code: ff ff e9 26 ff ff ff 0f 1f 44 00 00 0f 1f 44 00 00 55 48 8b 07 48 89 e5 48 39 c7 75 0a eb 24 48 8b 00 48 39 f8 74 1c 44 8b 06 <44> 39 40 10 75 ef 44 0f b7 4e 04 66 44 39 48 14 75 e3 38 50 16 75 RSP: 0018:ffffbc6a40493c70 EFLAGS: 00010286 RAX: 4141414141414141 RBX: 000000000000001b RCX: 0000000000000000 RDX: 0000000000000000 RSI: ffff9903e76c100f RDI: ffff9904289d4b28 RBP: ffffbc6a40493c70 R08: 0000000093570362 R09: 0000000000000000 R10: 0000000000000000 R11: ffff9904344eae38 R12: ffff9904289d4000 R13: 0000000000000000 R14: 00000000ffffffa3 R15: ffff9903e76c100f FS: 0000000000000000(0000) GS:ffff990434580000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007feed125a000 CR3: 00000001b860a003 CR4: 00000000003606e0 Call Trace: process_adv_report+0x12e/0x560 [bluetooth] hci_le_meta_evt+0x7b2/0xba0 [bluetooth] hci_event_packet+0x1c29/0x2a90 [bluetooth] hci_rx_work+0x19b/0x360 [bluetooth] process_one_work+0x1eb/0x3b0 worker_thread+0x4d/0x400 kthread+0x104/0x140 Fixes: c215e9397b00 ("Bluetooth: Process extended ADV report event") Reported-by: Andy Nguyen Reported-by: Linus Torvalds Reported-by: Balakrishna Godavarthi Signed-off-by: Alain Michaud Tested-by: Sonny Sasaka Acked-by: Marcel Holtmann Signed-off-by: Linus Torvalds Signed-off-by: Greg Kroah-Hartman --- net/bluetooth/hci_event.c | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) --- a/net/bluetooth/hci_event.c +++ b/net/bluetooth/hci_event.c @@ -1133,6 +1133,9 @@ static void store_pending_adv_report(str { struct discovery_state *d = &hdev->discovery; + if (len > HCI_MAX_AD_LENGTH) + return; + bacpy(&d->last_adv_addr, bdaddr); d->last_adv_addr_type = bdaddr_type; d->last_adv_rssi = rssi; @@ -4752,6 +4755,11 @@ static void process_adv_report(struct hc u32 flags; u8 *ptr, real_len; + if (len > HCI_MAX_AD_LENGTH) { + pr_err_ratelimited("legacy adv larger than 31 bytes"); + return; + } + /* Find the end of the data in case the report contains padded zero * bytes at the end causing an invalid length value. * @@ -4812,7 +4820,7 @@ static void process_adv_report(struct hc */ conn = check_pending_le_conn(hdev, bdaddr, bdaddr_type, type, direct_addr); - if (conn && type == LE_ADV_IND) { + if (conn && type == LE_ADV_IND && len <= HCI_MAX_AD_LENGTH) { /* Store report for later inclusion by * mgmt_device_connected */ @@ -4937,10 +4945,14 @@ static void hci_le_adv_report_evt(struct struct hci_ev_le_advertising_info *ev = ptr; s8 rssi; - rssi = ev->data[ev->length]; - process_adv_report(hdev, ev->evt_type, &ev->bdaddr, - ev->bdaddr_type, NULL, 0, rssi, - ev->data, ev->length); + if (ev->length <= HCI_MAX_AD_LENGTH) { + rssi = ev->data[ev->length]; + process_adv_report(hdev, ev->evt_type, &ev->bdaddr, + ev->bdaddr_type, NULL, 0, rssi, + ev->data, ev->length); + } else { + bt_dev_err(hdev, "Dropping invalid advertising data"); + } ptr += sizeof(*ev) + ev->length + 1; } From patchwork Fri Oct 16 09:07:00 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 290315 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.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham 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 75C83C43457 for ; Fri, 16 Oct 2020 09:07:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2D93B214DB for ; Fri, 16 Oct 2020 09:07:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1602839247; bh=UmtclSfZhXzimd9NuXcKtwuugePYD7UcrFRljjiXOE8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=aAuI+jlD0+RxVsJgP9oVD3SPjyCA+bO8aVK2zGX9oUaz3vVffO9OIllG5lSi6YSST rzh2z+p4F2Xfy6VOiH66Igjr9ERY3NnaEcp7t0L4US7osbDxByem61gJ5vQM/TAtnr QftLAd83g7k7l+zmgtCwVhyqc+sVPHAatE61mLhA= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2405410AbgJPJH0 (ORCPT ); Fri, 16 Oct 2020 05:07:26 -0400 Received: from mail.kernel.org ([198.145.29.99]:35358 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2405387AbgJPJHP (ORCPT ); Fri, 16 Oct 2020 05:07:15 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (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 7338620878; Fri, 16 Oct 2020 09:07:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1602839235; bh=UmtclSfZhXzimd9NuXcKtwuugePYD7UcrFRljjiXOE8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xvGeH9i9UkmGVBtU1Am4UMO6F/b4iCcqRG2RFI7bUSukK/RFpV5NCPyNNlSZvBlTA wzRRoasAVt3JwtyfCiy0dJDON8tDPG4aQaE6ACPG4NLHt1O9DjJn1yoocXlKCzHs74 8LvZgUCIt4DQUlX/qqIPmXI1xSvl8myCsPMU+oSQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Oliver Neukum , Ben Hutchings , Hans Verkuil , Mauro Carvalho Chehab Subject: [PATCH 4.4 07/16] media: usbtv: Fix refcounting mixup Date: Fri, 16 Oct 2020 11:07:00 +0200 Message-Id: <20201016090435.783530200@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201016090435.423923738@linuxfoundation.org> References: <20201016090435.423923738@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Oliver Neukum commit bf65f8aabdb37bc1a785884374e919477fe13e10 upstream. The premature free in the error path is blocked by V4L refcounting, not USB refcounting. Thanks to Ben Hutchings for review. [v2] corrected attributions Signed-off-by: Oliver Neukum Fixes: 50e704453553 ("media: usbtv: prevent double free in error case") CC: stable@vger.kernel.org Reported-by: Ben Hutchings Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Greg Kroah-Hartman --- drivers/media/usb/usbtv/usbtv-core.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/drivers/media/usb/usbtv/usbtv-core.c +++ b/drivers/media/usb/usbtv/usbtv-core.c @@ -96,7 +96,8 @@ static int usbtv_probe(struct usb_interf usbtv_audio_fail: /* we must not free at this point */ - usb_get_dev(usbtv->udev); + v4l2_device_get(&usbtv->v4l2_dev); + /* this will undo the v4l2_device_get() */ usbtv_video_free(usbtv); usbtv_video_fail: From patchwork Fri Oct 16 09:07:02 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 290316 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.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham 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 4FF95C43457 for ; Fri, 16 Oct 2020 09:07:23 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E0AAC218AC for ; Fri, 16 Oct 2020 09:07:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1602839243; bh=NorBG2TeowhGPmzQJ3vEEn3CsRxigg/CdmoZBOiYtRc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=QXPyfrK6Y7fZcwby6jEyZmqM+1FVWPIp70EOpQZdVqMAjGdlL41GnW8vEBVvlwQbY OdS0N6pjQNQnf1KwUvs/p9/zUtKMYzVDGXDy5wI9JBwISyhVBd0FeEYpOtsOIGFpeN fiobViOTWbxmGNsSokZdvBci34MWe/2zpMRfVN04= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2405398AbgJPJHV (ORCPT ); Fri, 16 Oct 2020 05:07:21 -0400 Received: from mail.kernel.org ([198.145.29.99]:35426 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2405397AbgJPJHU (ORCPT ); Fri, 16 Oct 2020 05:07:20 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (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 B9D5921527; Fri, 16 Oct 2020 09:07:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1602839240; bh=NorBG2TeowhGPmzQJ3vEEn3CsRxigg/CdmoZBOiYtRc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qkyvGOoMSgPVbUX4EHKPhnJZZmpHdBrfmwwo047wrWiX6lriWWCBCXlktTrDgB6me 7U9u646xvsTyih8Em/ubIrM7hzcvFwhb9UvcVyxurxslJREeH+sQQf9A94e+deSEbb /DNrfj6QEiENKj51/awNyJeL/9Ovrnpf/wKmXOhY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Leonid Bloch , Johan Hovold Subject: [PATCH 4.4 09/16] USB: serial: option: Add Telit FT980-KS composition Date: Fri, 16 Oct 2020 11:07:02 +0200 Message-Id: <20201016090435.877920611@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201016090435.423923738@linuxfoundation.org> References: <20201016090435.423923738@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Leonid Bloch commit 924a9213358fb92fa3c3225d6d042aa058167405 upstream. This commit adds the following Telit FT980-KS composition: 0x1054: rndis, diag, adb, nmea, modem, modem, aux AT commands can be sent to /dev/ttyUSB2. Signed-off-by: Leonid Bloch Cc: stable@vger.kernel.org Link: https://lore.kernel.org/r/ce86bc05-f4e2-b199-0cdc-792715e3f275@asocscloud.com Link: https://lore.kernel.org/r/20201004155813.2342-1-lb.workbox@gmail.com Signed-off-by: Johan Hovold Signed-off-by: Greg Kroah-Hartman --- drivers/usb/serial/option.c | 2 ++ 1 file changed, 2 insertions(+) --- a/drivers/usb/serial/option.c +++ b/drivers/usb/serial/option.c @@ -1172,6 +1172,8 @@ static const struct usb_device_id option .driver_info = NCTRL(2) | RSVD(3) }, { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1053, 0xff), /* Telit FN980 (ECM) */ .driver_info = NCTRL(0) | RSVD(1) }, + { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1054, 0xff), /* Telit FT980-KS */ + .driver_info = NCTRL(2) | RSVD(3) }, { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_ME910), .driver_info = NCTRL(0) | RSVD(1) | RSVD(3) }, { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_ME910_DUAL_MODEM), From patchwork Fri Oct 16 09:07:04 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 290320 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.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham 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 70473C433DF for ; Fri, 16 Oct 2020 09:06:51 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1ED8D20872 for ; Fri, 16 Oct 2020 09:06:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1602839211; bh=Xs3UgQSYh54W2MdTbYCrFX0PD7eAZHMeoWxvebzHRHg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=l9tRiNR45Ed67z/J2eqF9Jiev1o59QbybY7dKzG0AS9bfZJO/a6M4OrjlCcEU9+UP 6DyWyULPTxvzlG7LbRCYMbBg/+V0XCyY1lOWmBLYB5HknUYySHx9Uz2E4oxsP19zxD NDgzrQpMX2ttXh35bs265y5O76dqALpg73OHRo8k= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2405310AbgJPJGt (ORCPT ); Fri, 16 Oct 2020 05:06:49 -0400 Received: from mail.kernel.org ([198.145.29.99]:34874 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2405300AbgJPJGr (ORCPT ); Fri, 16 Oct 2020 05:06:47 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (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 73BBD20723; Fri, 16 Oct 2020 09:06:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1602839206; bh=Xs3UgQSYh54W2MdTbYCrFX0PD7eAZHMeoWxvebzHRHg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1HnWkqBphmJ8jE4j5hCpg6TwhG8FevHMmbyZYcWlJC+NgqwDrounrHlvK6Kxxj7Tq l25LoDAbZO5SmYvSU1efDPBUf2PBMsK31U4m7nLNpAlxzLziPI0LfqaxqCI0Dq/eU0 0CYMCK84sf1//c92diUhC2OoKKzQ74BVTW+2/9f8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Scott Chen , Johan Hovold Subject: [PATCH 4.4 11/16] USB: serial: pl2303: add device-id for HP GC device Date: Fri, 16 Oct 2020 11:07:04 +0200 Message-Id: <20201016090435.971021031@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201016090435.423923738@linuxfoundation.org> References: <20201016090435.423923738@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Scott Chen commit 031f9664f8f9356cee662335bc56c93d16e75665 upstream. This is adds a device id for HP LD381 which is a pl2303GC-base device. Signed-off-by: Scott Chen Cc: stable@vger.kernel.org Signed-off-by: Johan Hovold Signed-off-by: Greg Kroah-Hartman --- drivers/usb/serial/pl2303.c | 1 + drivers/usb/serial/pl2303.h | 1 + 2 files changed, 2 insertions(+) --- a/drivers/usb/serial/pl2303.c +++ b/drivers/usb/serial/pl2303.c @@ -89,6 +89,7 @@ static const struct usb_device_id id_tab { USB_DEVICE(HP_VENDOR_ID, HP_LD220_PRODUCT_ID) }, { USB_DEVICE(HP_VENDOR_ID, HP_LD220TA_PRODUCT_ID) }, { USB_DEVICE(HP_VENDOR_ID, HP_LD381_PRODUCT_ID) }, + { USB_DEVICE(HP_VENDOR_ID, HP_LD381GC_PRODUCT_ID) }, { USB_DEVICE(HP_VENDOR_ID, HP_LD960_PRODUCT_ID) }, { USB_DEVICE(HP_VENDOR_ID, HP_LD960TA_PRODUCT_ID) }, { USB_DEVICE(HP_VENDOR_ID, HP_LCM220_PRODUCT_ID) }, --- a/drivers/usb/serial/pl2303.h +++ b/drivers/usb/serial/pl2303.h @@ -125,6 +125,7 @@ /* Hewlett-Packard POS Pole Displays */ #define HP_VENDOR_ID 0x03f0 +#define HP_LD381GC_PRODUCT_ID 0x0183 #define HP_LM920_PRODUCT_ID 0x026b #define HP_TD620_PRODUCT_ID 0x0956 #define HP_LD960_PRODUCT_ID 0x0b39 From patchwork Fri Oct 16 09:07:05 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 290319 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.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham 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 603C8C43467 for ; Fri, 16 Oct 2020 09:06:55 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0496C20878 for ; Fri, 16 Oct 2020 09:06:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1602839215; bh=ukzwW89ghWFCLaIzcYhBOI+R1oV1C7LDKFoyrtpgwjY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=mGmPnKJYCBVF/BQyk1C9yu7WlirvnCqvxQl/A+csYmO9xQ72d9iTjiLXAvhd4rv7a R69t1GTg3Wq0hVvdQFjWOXhP3gpygSPuFqhnmWtY7dLPqXq3w2Da1F+o9C/n65Bo2m lDMT9y+OULwcP/Lo2q8mQ3OXn0wVcspJJ3rCXdGU= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2405325AbgJPJGx (ORCPT ); Fri, 16 Oct 2020 05:06:53 -0400 Received: from mail.kernel.org ([198.145.29.99]:34914 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2404669AbgJPJGt (ORCPT ); Fri, 16 Oct 2020 05:06:49 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (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 D400520723; Fri, 16 Oct 2020 09:06:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1602839209; bh=ukzwW89ghWFCLaIzcYhBOI+R1oV1C7LDKFoyrtpgwjY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mAnC8MfCbKMomGCBZQSPzA7bur/+u+irvur3CLuDTIDbJcTBQkTJR1oQK78acwj6H oi63/ZtrQCD9t8AZPPRIqLkMPPF1XpqierN+wyupAufvAXwoGU03ajpYpiE6lZNJEr uPn1WUY+NV9ot1An9dDNtuCjcr3KRO955zSCiyOA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Mychaela N. Falconia" , Johan Hovold Subject: [PATCH 4.4 12/16] USB: serial: ftdi_sio: add support for FreeCalypso JTAG+UART adapters Date: Fri, 16 Oct 2020 11:07:05 +0200 Message-Id: <20201016090436.019351051@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201016090435.423923738@linuxfoundation.org> References: <20201016090435.423923738@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Mychaela N. Falconia commit 6cf87e5edd9944e1d3b6efd966ea401effc304ee upstream. There exist many FT2232-based JTAG+UART adapter designs in which FT2232 Channel A is used for JTAG and Channel B is used for UART. The best way to handle them in Linux is to have the ftdi_sio driver create a ttyUSB device only for Channel B and not for Channel A: a ttyUSB device for Channel A would be bogus and will disappear as soon as the user runs OpenOCD or other applications that access Channel A for JTAG from userspace, causing undesirable noise for users. The ftdi_sio driver already has a dedicated quirk for such JTAG+UART FT2232 adapters, and it requires assigning custom USB IDs to such adapters and adding these IDs to the driver with the ftdi_jtag_quirk applied. Boutique hardware manufacturer Falconia Partners LLC has created a couple of JTAG+UART adapter designs (one buffered, one unbuffered) as part of FreeCalypso project, and this hardware is specifically made to be used with Linux hosts, with the intent that Channel A will be accessed only from userspace via appropriate applications, and that Channel B will be supported by the ftdi_sio kernel driver, presenting a standard ttyUSB device to userspace. Toward this end the hardware manufacturer will be programming FT2232 EEPROMs with custom USB IDs, specifically with the intent that these IDs will be recognized by the ftdi_sio driver with the ftdi_jtag_quirk applied. Signed-off-by: Mychaela N. Falconia [johan: insert in PID order and drop unused define] Cc: stable@vger.kernel.org Signed-off-by: Johan Hovold Signed-off-by: Greg Kroah-Hartman --- drivers/usb/serial/ftdi_sio.c | 5 +++++ drivers/usb/serial/ftdi_sio_ids.h | 7 +++++++ 2 files changed, 12 insertions(+) --- a/drivers/usb/serial/ftdi_sio.c +++ b/drivers/usb/serial/ftdi_sio.c @@ -1032,6 +1032,11 @@ static const struct usb_device_id id_tab /* U-Blox devices */ { USB_DEVICE(UBLOX_VID, UBLOX_C099F9P_ZED_PID) }, { USB_DEVICE(UBLOX_VID, UBLOX_C099F9P_ODIN_PID) }, + /* FreeCalypso USB adapters */ + { USB_DEVICE(FTDI_VID, FTDI_FALCONIA_JTAG_BUF_PID), + .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk }, + { USB_DEVICE(FTDI_VID, FTDI_FALCONIA_JTAG_UNBUF_PID), + .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk }, { } /* Terminating entry */ }; --- a/drivers/usb/serial/ftdi_sio_ids.h +++ b/drivers/usb/serial/ftdi_sio_ids.h @@ -38,6 +38,13 @@ #define FTDI_LUMEL_PD12_PID 0x6002 +/* + * Custom USB adapters made by Falconia Partners LLC + * for FreeCalypso project, ID codes allocated to Falconia by FTDI. + */ +#define FTDI_FALCONIA_JTAG_BUF_PID 0x7150 +#define FTDI_FALCONIA_JTAG_UNBUF_PID 0x7151 + /* Sienna Serial Interface by Secyourit GmbH */ #define FTDI_SIENNA_PID 0x8348 From patchwork Fri Oct 16 09:07:08 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 290314 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.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,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 7737FC43457 for ; Fri, 16 Oct 2020 09:07:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 225AB20878 for ; Fri, 16 Oct 2020 09:07:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1602839257; bh=uPl725diAniH+EKCxObvvKRteIJ0bNRguYi2KdV3+vk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=pj5XzUA/wkhh/bDE8An0w4igYHYQTu+CRExqNIF1+w8Dnvr0ZLTC72kRZfe9K8//a FYlXXI2xFb4sifvPXyRFmRIWyderRz8J52pMiO2R437ajYRiXxhHtOYhff3Oxy+Dsa GFQGjrgu1LUXUIjyHCpgY0/6xxdXVbXkgeZ2ymp8= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2405342AbgJPJG7 (ORCPT ); Fri, 16 Oct 2020 05:06:59 -0400 Received: from mail.kernel.org ([198.145.29.99]:35096 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2405337AbgJPJG5 (ORCPT ); Fri, 16 Oct 2020 05:06:57 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (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 3043720848; Fri, 16 Oct 2020 09:06:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1602839216; bh=uPl725diAniH+EKCxObvvKRteIJ0bNRguYi2KdV3+vk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rNslfnaAZWrylxGet0vK7st6MvQVpmrMyR7XJN2VUJdzGPc6MaWWJ/eC5777XbQpI 0zeUgtEn2aU/g1KwVzo+lY1iRk0Q+vXzQdhM+BDVECZZvaYZLEGT7qiVGzFsOBZ11r jrxAnSLqm02rv3LfHhULjJoZOxPiRYdj4zoUH23g= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, yangerkun Subject: [PATCH 4.4 15/16] spi: unbinding slave before calling spi_destroy_queue Date: Fri, 16 Oct 2020 11:07:08 +0200 Message-Id: <20201016090436.166047102@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201016090435.423923738@linuxfoundation.org> References: <20201016090435.423923738@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: yangerkun We make a mistake while backport 'commit 84855678add8 ("spi: Fix controller unregister order")'. What we should do is call __unreigster for each device before spi_destroy_queue. This problem exist in linux-4.4.y/linux-4.9.y. Signed-off-by: yangerkun --- drivers/spi/spi.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/drivers/spi/spi.c +++ b/drivers/spi/spi.c @@ -1917,13 +1917,13 @@ static int __unregister(struct device *d */ void spi_unregister_master(struct spi_master *master) { + device_for_each_child(&master->dev, NULL, __unregister); + if (master->queued) { if (spi_destroy_queue(master)) dev_err(&master->dev, "queue remove failed\n"); } - device_for_each_child(&master->dev, NULL, __unregister); - mutex_lock(&board_lock); list_del(&master->list); mutex_unlock(&board_lock); From patchwork Fri Oct 16 09:07:09 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 290313 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.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham 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 E77E8C43457 for ; Fri, 16 Oct 2020 09:07:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 95A4220848 for ; Fri, 16 Oct 2020 09:07:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1602839260; bh=OA9ojlJD5BvhFcZM4dGPho+S/jI+oo7Wg7S4ULiNr1o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=rW2uZqSXJAacuDMm1Z45xIj6ND7ZvxkuzsRuzv/++/dWrP3D5GpT+7DSY26ob/xBb PN/fRn7jytt6vjbxEkp3HnK453Sqon4h6YZt5MhKs08gKSSOc/0CJ24Xdau9kQbUxS LrfiYdDBfeIVVPY9Gbm/J8NTLERgGDLuzQbvxRwc= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2405050AbgJPJHh (ORCPT ); Fri, 16 Oct 2020 05:07:37 -0400 Received: from mail.kernel.org ([198.145.29.99]:35166 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2405341AbgJPJG7 (ORCPT ); Fri, 16 Oct 2020 05:06:59 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (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 A2B8420878; Fri, 16 Oct 2020 09:06:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1602839219; bh=OA9ojlJD5BvhFcZM4dGPho+S/jI+oo7Wg7S4ULiNr1o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WTq6BAK2+Vb6W8woikmm8+o7KDHuALJ7LyEMJtMb1l+sAr/IMjF2Agy3x3j9BSGeD HjUOvGc8pD4m2+u2yeQ7azj1jcK3Xr941NzFFEc/NumWXg4C08V6Zeo7pFgWLxhXs9 ABFrzIovXJULP9zmhs1fKNLY+Pbh+R0a8u/NQhgI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dominik Przychodni , Giovanni Cabiddu , Herbert Xu Subject: [PATCH 4.4 16/16] crypto: qat - check cipher length for aead AES-CBC-HMAC-SHA Date: Fri, 16 Oct 2020 11:07:09 +0200 Message-Id: <20201016090436.213358749@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201016090435.423923738@linuxfoundation.org> References: <20201016090435.423923738@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Dominik Przychodni commit 45cb6653b0c355fc1445a8069ba78a4ce8720511 upstream. Return -EINVAL for authenc(hmac(sha1),cbc(aes)), authenc(hmac(sha256),cbc(aes)) and authenc(hmac(sha512),cbc(aes)) if the cipher length is not multiple of the AES block. This is to prevent an undefined device behaviour. Fixes: d370cec32194 ("crypto: qat - Intel(R) QAT crypto interface") Cc: Signed-off-by: Dominik Przychodni [giovanni.cabiddu@intel.com: reworded commit message] Signed-off-by: Giovanni Cabiddu Signed-off-by: Herbert Xu Signed-off-by: Greg Kroah-Hartman --- drivers/crypto/qat/qat_common/qat_algs.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) --- a/drivers/crypto/qat/qat_common/qat_algs.c +++ b/drivers/crypto/qat/qat_common/qat_algs.c @@ -822,6 +822,11 @@ static int qat_alg_aead_dec(struct aead_ struct icp_qat_fw_la_bulk_req *msg; int digst_size = crypto_aead_authsize(aead_tfm); int ret, ctr = 0; + u32 cipher_len; + + cipher_len = areq->cryptlen - digst_size; + if (cipher_len % AES_BLOCK_SIZE != 0) + return -EINVAL; ret = qat_alg_sgl_to_bufl(ctx->inst, areq->src, areq->dst, qat_req); if (unlikely(ret)) @@ -836,7 +841,7 @@ static int qat_alg_aead_dec(struct aead_ qat_req->req.comn_mid.src_data_addr = qat_req->buf.blp; qat_req->req.comn_mid.dest_data_addr = qat_req->buf.bloutp; cipher_param = (void *)&qat_req->req.serv_specif_rqpars; - cipher_param->cipher_length = areq->cryptlen - digst_size; + cipher_param->cipher_length = cipher_len; cipher_param->cipher_offset = areq->assoclen; memcpy(cipher_param->u.cipher_IV_array, areq->iv, AES_BLOCK_SIZE); auth_param = (void *)((uint8_t *)cipher_param + sizeof(*cipher_param)); @@ -865,6 +870,9 @@ static int qat_alg_aead_enc(struct aead_ uint8_t *iv = areq->iv; int ret, ctr = 0; + if (areq->cryptlen % AES_BLOCK_SIZE != 0) + return -EINVAL; + ret = qat_alg_sgl_to_bufl(ctx->inst, areq->src, areq->dst, qat_req); if (unlikely(ret)) return ret;