From patchwork Tue Jan 14 10:01: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: 233921 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=-6.8 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,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 0C7C7C33CB3 for ; Tue, 14 Jan 2020 10:15:32 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D87D524676 for ; Tue, 14 Jan 2020 10:15:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578996931; bh=/zh7hUGsbKPWP/EZmi18VLr6WqJo0rJEHGMtCmg7Y3w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=go/gyeOPWXXWLwZhR1AMoXtf425/HoFcdXim3wis2GvBAIoQvXGuIuv+05w+UlHyM nn8e6AVawbWecOoldZpijyZ5iC4ZI+NcPYm+r9+Woc++BP5rHPappRpwTkLwXlKcS8 liwIjj6NTzwHO0byCAS2uoCjdbwCB+LbToGFMGn4= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732274AbgANKLD (ORCPT ); Tue, 14 Jan 2020 05:11:03 -0500 Received: from mail.kernel.org ([198.145.29.99]:45730 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731458AbgANKLD (ORCPT ); Tue, 14 Jan 2020 05:11:03 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.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 E90752467A; Tue, 14 Jan 2020 10:11:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578996662; bh=/zh7hUGsbKPWP/EZmi18VLr6WqJo0rJEHGMtCmg7Y3w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Y+P9GnyMe7Qsk/DfYL5vTBaQDoM4uvALG4/cFOP06U/k8xrYvSYpEt8ZGo2dOyGBa H9+qbZpaBfgZAot3m5AWdTVPl7mSXB0tKI8L4e6wta6FLo5d/6GJ1+YTREGXJVTKgl CRpbhAS/XYFjVQZhQiLNKefg5YFC4hLAiZQXc7tQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Michael Grzeschik , Peter Chen , Guenter Roeck , Peter Chen Subject: [PATCH 4.9 03/31] usb: chipidea: host: Disable port power only if previously enabled Date: Tue, 14 Jan 2020 11:01:55 +0100 Message-Id: <20200114094337.955093296@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200114094334.725604663@linuxfoundation.org> References: <20200114094334.725604663@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Guenter Roeck commit c1ffba305dbcf3fb9ca969c20a97acbddc38f8e9 upstream. On shutdown, ehci_power_off() is called unconditionally to power off each port, even if it was never called to power on the port. For chipidea, this results in a call to ehci_ci_portpower() with a request to power off ports even if the port was never powered on. This results in the following warning from the regulator code. WARNING: CPU: 0 PID: 182 at drivers/regulator/core.c:2596 _regulator_disable+0x1a8/0x210 unbalanced disables for usb_otg2_vbus Modules linked in: CPU: 0 PID: 182 Comm: init Not tainted 5.4.6 #1 Hardware name: Freescale i.MX7 Dual (Device Tree) [] (unwind_backtrace) from [] (show_stack+0x10/0x14) [] (show_stack) from [] (dump_stack+0xe0/0x10c) [] (dump_stack) from [] (__warn+0xf4/0x10c) [] (__warn) from [] (warn_slowpath_fmt+0x78/0xbc) [] (warn_slowpath_fmt) from [] (_regulator_disable+0x1a8/0x210) [] (_regulator_disable) from [] (regulator_disable+0x38/0xe8) [] (regulator_disable) from [] (ehci_ci_portpower+0x38/0xdc) [] (ehci_ci_portpower) from [] (ehci_port_power+0x50/0xa4) [] (ehci_port_power) from [] (ehci_silence_controller+0x5c/0xc4) [] (ehci_silence_controller) from [] (ehci_stop+0x3c/0xcc) [] (ehci_stop) from [] (usb_remove_hcd+0xe0/0x19c) [] (usb_remove_hcd) from [] (host_stop+0x38/0xa8) [] (host_stop) from [] (ci_hdrc_remove+0x44/0xe4) ... Keeping track of the power enable state avoids the warning and traceback. Fixes: c8679a2fb8dec ("usb: chipidea: host: add portpower override") Cc: Michael Grzeschik Cc: Peter Chen Cc: stable@vger.kernel.org Signed-off-by: Guenter Roeck Acked-by: Peter Chen Link: https://lore.kernel.org/r/20191226155754.25451-1-linux@roeck-us.net Signed-off-by: Greg Kroah-Hartman --- drivers/usb/chipidea/host.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) --- a/drivers/usb/chipidea/host.c +++ b/drivers/usb/chipidea/host.c @@ -37,6 +37,7 @@ static int (*orig_bus_suspend)(struct us struct ehci_ci_priv { struct regulator *reg_vbus; + bool enabled; }; static int ehci_ci_portpower(struct usb_hcd *hcd, int portnum, bool enable) @@ -48,7 +49,7 @@ static int ehci_ci_portpower(struct usb_ int ret = 0; int port = HCS_N_PORTS(ehci->hcs_params); - if (priv->reg_vbus) { + if (priv->reg_vbus && enable != priv->enabled) { if (port > 1) { dev_warn(dev, "Not support multi-port regulator control\n"); @@ -64,6 +65,7 @@ static int ehci_ci_portpower(struct usb_ enable ? "enable" : "disable", ret); return ret; } + priv->enabled = enable; } if (enable && (ci->platdata->phy_mode == USBPHY_INTERFACE_MODE_HSIC)) { From patchwork Tue Jan 14 10:01:57 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 233944 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=-6.8 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, 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 E91DDC33CB3 for ; Tue, 14 Jan 2020 10:12:17 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C02A824692 for ; Tue, 14 Jan 2020 10:12:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578996737; bh=UoeNj3LierfqBK3dFQablLeSko3NlsPKQVgd4DF+MxY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=AP9PVE5OFj75DElp3LFF7d7KHibXRUMN9FT7o493AWnwqZQrOsI/ss3M5dBg3oLdk peBlg4xpjNFlVqiUPSXv9foD6SatBn/oJwKlm7yB9KMIpRCcpcorv2oGC67L78JdFC tKOuc9w9Facch4r3FxjjieaZ0rOo49M2R3G14zeE= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731608AbgANKMR (ORCPT ); Tue, 14 Jan 2020 05:12:17 -0500 Received: from mail.kernel.org ([198.145.29.99]:48374 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731515AbgANKMQ (ORCPT ); Tue, 14 Jan 2020 05:12:16 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.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 BF29024677; Tue, 14 Jan 2020 10:12:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578996735; bh=UoeNj3LierfqBK3dFQablLeSko3NlsPKQVgd4DF+MxY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Fa0wulJajRP2mhVKvGnnyKvwJEmJxiEbVmRYCApIBCHjCt6/4EDSw0+iHts/PlyuK ckSZrNfOcr3DqVRG4G+ZG4yWXaZiTp2vBKZdRJdHAlGRITwRYftG+SOB16wWA0IE9T e6jrNt4r/FLq9Ve2h9oddii9vIAoV0j0rLLSyodc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Markus Trippelsdorf , Eric Dumazet , Marcelo Ricardo Leitner , "David S. Miller" , Salvatore Bonaccorso Subject: [PATCH 4.9 05/31] tcp: minimize false-positives on TCP/GRO check Date: Tue, 14 Jan 2020 11:01:57 +0100 Message-Id: <20200114094340.570688818@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200114094334.725604663@linuxfoundation.org> References: <20200114094334.725604663@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Marcelo Ricardo Leitner commit 0b9aefea860063bb39e36bd7fe6c7087fed0ba87 upstream. Markus Trippelsdorf reported that after commit dcb17d22e1c2 ("tcp: warn on bogus MSS and try to amend it") the kernel started logging the warning for a NIC driver that doesn't even support GRO. It was diagnosed that it was possibly caused on connections that were using TCP Timestamps but some packets lacked the Timestamps option. As we reduce rcv_mss when timestamps are used, the lack of them would cause the packets to be bigger than expected, although this is a valid case. As this warning is more as a hint, getting a clean-cut on the threshold is probably not worth the execution time spent on it. This patch thus alleviates the false-positives with 2 quick checks: by accounting for the entire TCP option space and also checking against the interface MTU if it's available. These changes, specially the MTU one, might mask some real positives, though if they are really happening, it's possible that sooner or later it will be triggered anyway. Reported-by: Markus Trippelsdorf Cc: Eric Dumazet Signed-off-by: Marcelo Ricardo Leitner Signed-off-by: David S. Miller Cc: Salvatore Bonaccorso Signed-off-by: Greg Kroah-Hartman --- net/ipv4/tcp_input.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) --- a/net/ipv4/tcp_input.c +++ b/net/ipv4/tcp_input.c @@ -129,7 +129,8 @@ int sysctl_tcp_invalid_ratelimit __read_ #define REXMIT_LOST 1 /* retransmit packets marked lost */ #define REXMIT_NEW 2 /* FRTO-style transmit of unsent/new packets */ -static void tcp_gro_dev_warn(struct sock *sk, const struct sk_buff *skb) +static void tcp_gro_dev_warn(struct sock *sk, const struct sk_buff *skb, + unsigned int len) { static bool __once __read_mostly; @@ -140,8 +141,9 @@ static void tcp_gro_dev_warn(struct sock rcu_read_lock(); dev = dev_get_by_index_rcu(sock_net(sk), skb->skb_iif); - pr_warn("%s: Driver has suspect GRO implementation, TCP performance may be compromised.\n", - dev ? dev->name : "Unknown driver"); + if (!dev || len >= dev->mtu) + pr_warn("%s: Driver has suspect GRO implementation, TCP performance may be compromised.\n", + dev ? dev->name : "Unknown driver"); rcu_read_unlock(); } } @@ -164,8 +166,10 @@ static void tcp_measure_rcv_mss(struct s if (len >= icsk->icsk_ack.rcv_mss) { icsk->icsk_ack.rcv_mss = min_t(unsigned int, len, tcp_sk(sk)->advmss); - if (unlikely(icsk->icsk_ack.rcv_mss != len)) - tcp_gro_dev_warn(sk, skb); + /* Account for possibly-removed options */ + if (unlikely(len > icsk->icsk_ack.rcv_mss + + MAX_TCP_OPTION_SPACE)) + tcp_gro_dev_warn(sk, skb, len); } else { /* Otherwise, we make more careful check taking into account, * that SACKs block is variable. From patchwork Tue Jan 14 10:01:58 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 233922 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=-6.8 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,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 ADE6FC33CB1 for ; Tue, 14 Jan 2020 10:15:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 7BC9724682 for ; Tue, 14 Jan 2020 10:15:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578996927; bh=8W7dvBwMRQLuHVRZsMPvivPXSG58cKKOr57Wv6sdDI8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=TouDZLzTy5aqkxsRKeOqnzoAPnnB5jGesB+dj8TTeK9LBS59zMhZHi0TNUT5wz5fr vV2yYy+KYJgCd4jbYCbPxE/td5j32UFJIA4xUN3d/GIaZC5eurA316yTh7Og1RHcvO 9UevTqBKteghZGbBVBWI7CG0RWzPZ8vrrbOxuwKI= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729610AbgANKLN (ORCPT ); Tue, 14 Jan 2020 05:11:13 -0500 Received: from mail.kernel.org ([198.145.29.99]:46018 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732375AbgANKLK (ORCPT ); Tue, 14 Jan 2020 05:11:10 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.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 B1C2124687; Tue, 14 Jan 2020 10:11:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578996670; bh=8W7dvBwMRQLuHVRZsMPvivPXSG58cKKOr57Wv6sdDI8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=o3rxuf2StITQYBVMOnSQQewZuNoIlyiGEGONXGMbVz6kKYqc8VAkqLjIU/DJWc3Sf jvuEDaFVJ05IpxBrAJWWHitT7VYDHDEZsIxcUSbMV8rrExne66+FU3TBwJdtEizlop iOF8RpRdAjmlBBgr0MEizXYG+i3Qm7pgHubmVeTQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kaitao Cheng , "Steven Rostedt (VMware)" Subject: [PATCH 4.9 06/31] kernel/trace: Fix do not unregister tracepoints when register sched_migrate_task fail Date: Tue, 14 Jan 2020 11:01:58 +0100 Message-Id: <20200114094340.855869396@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200114094334.725604663@linuxfoundation.org> References: <20200114094334.725604663@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Kaitao Cheng commit 50f9ad607ea891a9308e67b81f774c71736d1098 upstream. In the function, if register_trace_sched_migrate_task() returns error, sched_switch/sched_wakeup_new/sched_wakeup won't unregister. That is why fail_deprobe_sched_switch was added. Link: http://lkml.kernel.org/r/20191231133530.2794-1-pilgrimtao@gmail.com Cc: stable@vger.kernel.org Fixes: 478142c39c8c2 ("tracing: do not grab lock in wakeup latency function tracing") Signed-off-by: Kaitao Cheng Signed-off-by: Steven Rostedt (VMware) Signed-off-by: Greg Kroah-Hartman --- kernel/trace/trace_sched_wakeup.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) --- a/kernel/trace/trace_sched_wakeup.c +++ b/kernel/trace/trace_sched_wakeup.c @@ -625,7 +625,7 @@ static void start_wakeup_tracer(struct t if (ret) { pr_info("wakeup trace: Couldn't activate tracepoint" " probe to kernel_sched_migrate_task\n"); - return; + goto fail_deprobe_sched_switch; } wakeup_reset(tr); @@ -643,6 +643,8 @@ static void start_wakeup_tracer(struct t printk(KERN_ERR "failed to start wakeup tracer\n"); return; +fail_deprobe_sched_switch: + unregister_trace_sched_switch(probe_wakeup_sched_switch, NULL); fail_deprobe_wake_new: unregister_trace_sched_wakeup_new(probe_wakeup, NULL); fail_deprobe: From patchwork Tue Jan 14 10:01:59 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 233925 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=-6.8 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,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 F0C67C33CB1 for ; Tue, 14 Jan 2020 10:15:00 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id BB39A20678 for ; Tue, 14 Jan 2020 10:15:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578996900; bh=rd1SIbmXxYvtm9wWt8urLuw3HKsMhen7Kfo3TD0jJA8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=MaTFfpurGpbLTZH+tpEGi6dWEB6PPoiay6b0g79dJUUi2ML7zVAfiExd3CeBd/ym0 6lDDsig3BL31pahYzyc8JBzmUDPbfW7cVRG9+YLffOXXIvmXeScp613j39DIDSrAdT NV35/2zLF+Uy+VkMvdztdmv7qNYoSWV68Xo4QJGE= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732644AbgANKLl (ORCPT ); Tue, 14 Jan 2020 05:11:41 -0500 Received: from mail.kernel.org ([198.145.29.99]:47074 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730904AbgANKLj (ORCPT ); Tue, 14 Jan 2020 05:11:39 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.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 C7493207FF; Tue, 14 Jan 2020 10:11:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578996699; bh=rd1SIbmXxYvtm9wWt8urLuw3HKsMhen7Kfo3TD0jJA8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MsUJx0xZasCYVU40EzxiHjctm8zYr41L2NbXeGjEa48aiWxCYdLh6Ob3CcF7DYPZ9 K/vBsoZ5oU92KOS6Zbzfofm7W+Tij9NKzWpn1bNn8Kru0lsMTIQVJ3INdMgsXJ0+GB bTpOUODQbFDtj57fKQP9KtaDn1LYJRCnvBN5eyuY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, kbuild test robot , "Steven Rostedt (VMware)" Subject: [PATCH 4.9 07/31] tracing: Have stack tracer compile when MCOUNT_INSN_SIZE is not defined Date: Tue, 14 Jan 2020 11:01:59 +0100 Message-Id: <20200114094341.048111684@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200114094334.725604663@linuxfoundation.org> References: <20200114094334.725604663@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Steven Rostedt (VMware) commit b8299d362d0837ae39e87e9019ebe6b736e0f035 upstream. On some archs with some configurations, MCOUNT_INSN_SIZE is not defined, and this makes the stack tracer fail to compile. Just define it to zero in this case. Link: https://lore.kernel.org/r/202001020219.zvE3vsty%lkp@intel.com Cc: stable@vger.kernel.org Fixes: 4df297129f622 ("tracing: Remove most or all of stack tracer stack size from stack_max_size") Reported-by: kbuild test robot Signed-off-by: Steven Rostedt (VMware) Signed-off-by: Greg Kroah-Hartman --- kernel/trace/trace_stack.c | 5 +++++ 1 file changed, 5 insertions(+) --- a/kernel/trace/trace_stack.c +++ b/kernel/trace/trace_stack.c @@ -201,6 +201,11 @@ check_stack(unsigned long ip, unsigned l local_irq_restore(flags); } +/* Some archs may not define MCOUNT_INSN_SIZE */ +#ifndef MCOUNT_INSN_SIZE +# define MCOUNT_INSN_SIZE 0 +#endif + static void stack_trace_call(unsigned long ip, unsigned long parent_ip, struct ftrace_ops *op, struct pt_regs *pt_regs) From patchwork Tue Jan 14 10:02:01 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 233928 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=-6.8 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,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 10F4DC33CB1 for ; Tue, 14 Jan 2020 10:14:48 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id CEE63207FF for ; Tue, 14 Jan 2020 10:14:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578996887; bh=y3hojQXEA8XV+d/pNvuWwQg0+T/RPwpbZaLgU7memec=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=Ky84R8sOPBMYmg9yIvqbsjnhl7GFCpbo1cB/PcWsaUAfcei7fnOhGRwWq5xkRAsJd uy6TlbkdmcqaRhxx3osfhNcE64GFjy5C558zl15EeI5rrw+aztlNxgU/IZixYXZcmR AXuwRMi6OdPmqjHZMDwGahM141bUSLoL348tZ+Y0= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731636AbgANKL7 (ORCPT ); Tue, 14 Jan 2020 05:11:59 -0500 Received: from mail.kernel.org ([198.145.29.99]:47808 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731514AbgANKL6 (ORCPT ); Tue, 14 Jan 2020 05:11:58 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.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 2C1EB207FF; Tue, 14 Jan 2020 10:11:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578996717; bh=y3hojQXEA8XV+d/pNvuWwQg0+T/RPwpbZaLgU7memec=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NK+jxkqwKMHjnsGmNMWe9/M5vWMapUYTl9nAMu++iCYZ2RsOibexStEgeHbL85SCV 7Xxbk1l/h5IkI3PVTQiB8gftHT/r+JM9w41zjiuzkH+K/mRZnkC3SrMP9bq/zs9+9n 3wW2GOiv35eVxYUGo/0QSHEsbuteO7ey85jeCAFc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Marcel Holtmann , Jiri Kosina Subject: [PATCH 4.9 09/31] HID: uhid: Fix returning EPOLLOUT from uhid_char_poll Date: Tue, 14 Jan 2020 11:02:01 +0100 Message-Id: <20200114094341.392739255@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200114094334.725604663@linuxfoundation.org> References: <20200114094334.725604663@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Marcel Holtmann commit be54e7461ffdc5809b67d2aeefc1ddc9a91470c7 upstream. Always return EPOLLOUT from uhid_char_poll to allow polling /dev/uhid for writable state. Fixes: 1f9dec1e0164 ("HID: uhid: allow poll()'ing on uhid devices") Signed-off-by: Marcel Holtmann Cc: stable@vger.kernel.org Signed-off-by: Jiri Kosina Signed-off-by: Greg Kroah-Hartman --- drivers/hid/uhid.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/drivers/hid/uhid.c +++ b/drivers/hid/uhid.c @@ -26,6 +26,7 @@ #include #include #include +#include #define UHID_NAME "uhid" #define UHID_BUFSIZE 32 @@ -774,7 +775,7 @@ static unsigned int uhid_char_poll(struc if (uhid->head != uhid->tail) return POLLIN | POLLRDNORM; - return 0; + return EPOLLOUT | EPOLLWRNORM; } static const struct file_operations uhid_fops = { From patchwork Tue Jan 14 10:02:03 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 233945 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=-6.8 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, 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 CF096C33CB3 for ; Tue, 14 Jan 2020 10:12:06 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id A4B1024677 for ; Tue, 14 Jan 2020 10:12:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578996726; bh=DoIPfZziECD6tc3pZa+7+EklBI/JBt2TdCcOCy1LjUc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=D/aBuWo2sNJfJ8TnHJhtbRHgYH7+aFnIsHfj6/jHI1LPPIPRYmZGEeJ4PU6M5qkkI UWqrnipcDKbm9V3cARVa8UsOO4x8SLJwsTqwW9HdyjR/xE4WR+8wk2F7S0Fyc2U/80 COaK1UEPuHuobbk6lNE/c9Yp8VCU02bge64XU/l4= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731065AbgANKMF (ORCPT ); Tue, 14 Jan 2020 05:12:05 -0500 Received: from mail.kernel.org ([198.145.29.99]:48012 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731498AbgANKME (ORCPT ); Tue, 14 Jan 2020 05:12:04 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.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 5D9E02468E; Tue, 14 Jan 2020 10:12:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578996724; bh=DoIPfZziECD6tc3pZa+7+EklBI/JBt2TdCcOCy1LjUc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=m5RYb0phE0cUuRfwOj3p6LFvlNyJq6UXLdMjPZOdBf3Bcck2edPG+lFR2OHqOgzmx 9PPzDbsTnq+uTh76nz9ypXAfT+mamEDs+CBkFmHjinndWvPpw39XtEq+8oBjIWv/2G ziJN2vHU7oYbdJeZGW5q5ZyEALlG/tBwItzE4MJ4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, syzbot+c769968809f9359b07aa@syzkaller.appspotmail.com, syzbot+76f3a30e88d256644c78@syzkaller.appspotmail.com, Dmitry Torokhov Subject: [PATCH 4.9 11/31] Input: add safety guards to input_set_keycode() Date: Tue, 14 Jan 2020 11:02:03 +0100 Message-Id: <20200114094341.796816739@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200114094334.725604663@linuxfoundation.org> References: <20200114094334.725604663@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Dmitry Torokhov commit cb222aed03d798fc074be55e59d9a112338ee784 upstream. If we happen to have a garbage in input device's keycode table with values too big we'll end up doing clear_bit() with offset way outside of our bitmaps, damaging other objects within an input device or even outside of it. Let's add sanity checks to the returned old keycodes. Reported-by: syzbot+c769968809f9359b07aa@syzkaller.appspotmail.com Reported-by: syzbot+76f3a30e88d256644c78@syzkaller.appspotmail.com Link: https://lore.kernel.org/r/20191207212757.GA245964@dtor-ws Signed-off-by: Dmitry Torokhov Signed-off-by: Greg Kroah-Hartman --- drivers/input/input.c | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) --- a/drivers/input/input.c +++ b/drivers/input/input.c @@ -850,16 +850,18 @@ static int input_default_setkeycode(stru } } - __clear_bit(*old_keycode, dev->keybit); - __set_bit(ke->keycode, dev->keybit); - - for (i = 0; i < dev->keycodemax; i++) { - if (input_fetch_keycode(dev, i) == *old_keycode) { - __set_bit(*old_keycode, dev->keybit); - break; /* Setting the bit twice is useless, so break */ + if (*old_keycode <= KEY_MAX) { + __clear_bit(*old_keycode, dev->keybit); + for (i = 0; i < dev->keycodemax; i++) { + if (input_fetch_keycode(dev, i) == *old_keycode) { + __set_bit(*old_keycode, dev->keybit); + /* Setting the bit twice is useless, so break */ + break; + } } } + __set_bit(ke->keycode, dev->keybit); return 0; } @@ -915,9 +917,13 @@ int input_set_keycode(struct input_dev * * Simulate keyup event if keycode is not present * in the keymap anymore */ - if (test_bit(EV_KEY, dev->evbit) && - !is_event_supported(old_keycode, dev->keybit, KEY_MAX) && - __test_and_clear_bit(old_keycode, dev->key)) { + if (old_keycode > KEY_MAX) { + dev_warn(dev->dev.parent ?: &dev->dev, + "%s: got too big old keycode %#x\n", + __func__, old_keycode); + } else if (test_bit(EV_KEY, dev->evbit) && + !is_event_supported(old_keycode, dev->keybit, KEY_MAX) && + __test_and_clear_bit(old_keycode, dev->key)) { struct input_value vals[] = { { EV_KEY, old_keycode, 0 }, input_value_sync From patchwork Tue Jan 14 10:02: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: 233923 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=-6.8 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,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 5C8D2C33CB1 for ; Tue, 14 Jan 2020 10:15:23 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 2EB4224681 for ; Tue, 14 Jan 2020 10:15:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578996923; bh=++IoPrVeOtNpc/HS3RKMmAtk7RWzKjdx1GR1mIE0UVs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=gEaXh+jqud0hY0kJ1Vzc2h5ks5cBP/gw7FyBYnSLFT9HPkGD2HKj/4B67s/nTv6cU rx2aqWNyBMb5c8b1QNNrXJhcC0U2hV/86UBK+W1loRYWB/l/3zsx6MhItkgk/b4LB4 FeQBjceSQzj+UzAvreBuMUzkXk+k5PaILKg0p/s0= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730779AbgANKLV (ORCPT ); Tue, 14 Jan 2020 05:11:21 -0500 Received: from mail.kernel.org ([198.145.29.99]:46286 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730385AbgANKLU (ORCPT ); Tue, 14 Jan 2020 05:11:20 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.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 CD70D24681; Tue, 14 Jan 2020 10:11:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578996679; bh=++IoPrVeOtNpc/HS3RKMmAtk7RWzKjdx1GR1mIE0UVs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vCu5cVapQJ/3q4AbCHnQK+Fu1zSpHrar5hY+C7nQick1DiAqKgkkHlUzNWv0XSaTf NfD8PKTVn+F9d55DRL5rXaKZ9w/wJxemmgK1f+iZHmBW6Rj9skMP683f9qIKieT16Y 3oE8atdtf5k8d1f5QA/G8+YzOS+/f9L765Gta/jw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Daniele Palmas , Johan Hovold Subject: [PATCH 4.9 17/31] USB: serial: option: add ZLP support for 0x1bc7/0x9010 Date: Tue, 14 Jan 2020 11:02:09 +0100 Message-Id: <20200114094343.106228975@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200114094334.725604663@linuxfoundation.org> References: <20200114094334.725604663@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Daniele Palmas commit 2438c3a19dec5e98905fd3ffcc2f24716aceda6b upstream. Telit FN980 flashing device 0x1bc7/0x9010 requires zero packet to be sent if out data size is is equal to the endpoint max size. Signed-off-by: Daniele Palmas [ johan: switch operands in conditional ] Cc: stable Signed-off-by: Johan Hovold Signed-off-by: Greg Kroah-Hartman --- drivers/usb/serial/option.c | 8 ++++++++ drivers/usb/serial/usb-wwan.h | 1 + drivers/usb/serial/usb_wwan.c | 4 ++++ 3 files changed, 13 insertions(+) --- a/drivers/usb/serial/option.c +++ b/drivers/usb/serial/option.c @@ -566,6 +566,9 @@ static void option_instat_callback(struc /* Interface is reserved */ #define RSVD(ifnum) ((BIT(ifnum) & 0xff) << 0) +/* Device needs ZLP */ +#define ZLP BIT(17) + static const struct usb_device_id option_ids[] = { { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_COLT) }, @@ -1193,6 +1196,8 @@ static const struct usb_device_id option .driver_info = NCTRL(0) | RSVD(1) }, { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1901, 0xff), /* Telit LN940 (MBIM) */ .driver_info = NCTRL(0) }, + { USB_DEVICE(TELIT_VENDOR_ID, 0x9010), /* Telit SBL FN980 flashing device */ + .driver_info = NCTRL(0) | ZLP }, { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_MF622, 0xff, 0xff, 0xff) }, /* ZTE WCDMA products */ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0002, 0xff, 0xff, 0xff), .driver_info = RSVD(1) }, @@ -2097,6 +2102,9 @@ static int option_attach(struct usb_seri if (!(device_flags & NCTRL(iface_desc->bInterfaceNumber))) data->use_send_setup = 1; + if (device_flags & ZLP) + data->use_zlp = 1; + spin_lock_init(&data->susp_lock); usb_set_serial_data(serial, data); --- a/drivers/usb/serial/usb-wwan.h +++ b/drivers/usb/serial/usb-wwan.h @@ -35,6 +35,7 @@ struct usb_wwan_intf_private { spinlock_t susp_lock; unsigned int suspended:1; unsigned int use_send_setup:1; + unsigned int use_zlp:1; int in_flight; unsigned int open_ports; void *private; --- a/drivers/usb/serial/usb_wwan.c +++ b/drivers/usb/serial/usb_wwan.c @@ -495,6 +495,7 @@ static struct urb *usb_wwan_setup_urb(st void (*callback) (struct urb *)) { struct usb_serial *serial = port->serial; + struct usb_wwan_intf_private *intfdata = usb_get_serial_data(serial); struct urb *urb; urb = usb_alloc_urb(0, GFP_KERNEL); /* No ISO */ @@ -505,6 +506,9 @@ static struct urb *usb_wwan_setup_urb(st usb_sndbulkpipe(serial->dev, endpoint) | dir, buf, len, callback, ctx); + if (intfdata->use_zlp && dir == USB_DIR_OUT) + urb->transfer_flags |= URB_ZERO_PACKET; + return urb; } From patchwork Tue Jan 14 10:02:11 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 233924 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=-6.8 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,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 32098C33CB3 for ; Tue, 14 Jan 2020 10:15:09 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 06FDA20678 for ; Tue, 14 Jan 2020 10:15:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578996909; bh=fU+uoKOXpuBcf++EMnv2Fo9GfhZpAn5vxVCa+VZOIWo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=FxjC2GQBU1K7nMjZgn7il0IcvbkyIeUIIJJpYJDYCfPmZCNLLCEsBQyiVotTCfJy5 RCPIRY0ORGZyKQDIkAIaIEW+e6BC8Vtfb2UnE/fcdQvEE1SBAo2deA5ndE/sUB555L L1AC71HddMH/HdbzCLkChyzhGU2paPrheL2/W9sE= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729190AbgANKPE (ORCPT ); Tue, 14 Jan 2020 05:15:04 -0500 Received: from mail.kernel.org ([198.145.29.99]:46482 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732469AbgANKLY (ORCPT ); Tue, 14 Jan 2020 05:11:24 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.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 C706A24682; Tue, 14 Jan 2020 10:11:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578996684; bh=fU+uoKOXpuBcf++EMnv2Fo9GfhZpAn5vxVCa+VZOIWo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SoRf1YikQ6C8SZ5bIbprFJsRZ+36zpNpoL5Y1OVi63h1uSSRjfuBSJxtY3wzsQaEA vSqeOQ75RVwtkRf7IiG4r00Wyq6BdM5lb82PlpCLcQAX5uHXA2JwMUey1DtMqRbH3N DuXQ4j6W/EaLWCDoMo1Da1AzZkdR/699c2xXCPKs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Paul Cercueil , Bin Liu Subject: [PATCH 4.9 19/31] usb: musb: Disable pullup at init Date: Tue, 14 Jan 2020 11:02:11 +0100 Message-Id: <20200114094343.516551634@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200114094334.725604663@linuxfoundation.org> References: <20200114094334.725604663@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Paul Cercueil commit 96a0c12843109e5c4d5eb1e09d915fdd0ce31d25 upstream. The pullup may be already enabled before the driver is initialized. This happens for instance on JZ4740. It has to be disabled at init time, as we cannot guarantee that a gadget driver will be bound to the UDC. Signed-off-by: Paul Cercueil Suggested-by: Bin Liu Cc: stable@vger.kernel.org Signed-off-by: Bin Liu Link: https://lore.kernel.org/r/20200107152625.857-3-b-liu@ti.com Signed-off-by: Greg Kroah-Hartman --- drivers/usb/musb/musb_core.c | 3 +++ 1 file changed, 3 insertions(+) --- a/drivers/usb/musb/musb_core.c +++ b/drivers/usb/musb/musb_core.c @@ -2317,6 +2317,9 @@ musb_init_controller(struct device *dev, musb_platform_disable(musb); musb_generic_disable(musb); + /* MUSB_POWER_SOFTCONN might be already set, JZ4740 does this. */ + musb_writeb(musb->mregs, MUSB_POWER, 0); + /* Init IRQ workqueue before request_irq */ INIT_DELAYED_WORK(&musb->irq_work, musb_irq_work); INIT_DELAYED_WORK(&musb->deassert_reset_work, musb_deassert_reset); From patchwork Tue Jan 14 10:02:12 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 233948 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=-6.8 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, 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 17775C33CB3 for ; Tue, 14 Jan 2020 10:11:29 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id E39CB24677 for ; Tue, 14 Jan 2020 10:11:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578996689; bh=cjlnCtikVhdsPP03FSvBdeIWwsBF8I4ietu7C61I0N8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=Bx0R7EuLmxQOU4xtj4d/PzWrIdehZcgE5e65vZi8BQ3/9yJ1ynlHWL7v8wtHI81BE RzBx+9mDEDO/BwpE0LTV/Jt/iMuiHAwdJ0qGO8n0efCDegnKjBYe1g5cu/WsQTeUN6 4gFo5LLMBWh04er1YHjMzIwjwc3VoRKxP1nxVU/o= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732452AbgANKL1 (ORCPT ); Tue, 14 Jan 2020 05:11:27 -0500 Received: from mail.kernel.org ([198.145.29.99]:46578 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731618AbgANKL1 (ORCPT ); Tue, 14 Jan 2020 05:11:27 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.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 6097C20678; Tue, 14 Jan 2020 10:11:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578996686; bh=cjlnCtikVhdsPP03FSvBdeIWwsBF8I4ietu7C61I0N8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PVZb/cOnIMoXzYmjkR2C3ZvUCALNSjumufQsE+g9wm1RBvBBjEGLrufXa/ss2vX54 8f74eaZZo8IrAg6e3m9Yg+uNwI/d0eqQb5LgbQL1CQ7FKBijxVyTwxkFxobIvIQX6H rgcNHW/AhC8LfK5uwDedthvITXIe7la+PPGf1878= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Paul Cercueil , Artur Rojek , Bin Liu Subject: [PATCH 4.9 20/31] usb: musb: dma: Correct parameter passed to IRQ handler Date: Tue, 14 Jan 2020 11:02:12 +0100 Message-Id: <20200114094343.709242477@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200114094334.725604663@linuxfoundation.org> References: <20200114094334.725604663@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Paul Cercueil commit c80d0f4426c7fdc7efd6ae8d8b021dcfc89b4254 upstream. The IRQ handler was passed a pointer to a struct dma_controller, but the argument was then casted to a pointer to a struct musb_dma_controller. Fixes: 427c4f333474 ("usb: struct device - replace bus_id with dev_name(), dev_set_name()") Signed-off-by: Paul Cercueil Tested-by: Artur Rojek Cc: stable@vger.kernel.org Signed-off-by: Bin Liu Link: https://lore.kernel.org/r/20191216161844.772-2-b-liu@ti.com Signed-off-by: Greg Kroah-Hartman --- drivers/usb/musb/musbhsdma.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/usb/musb/musbhsdma.c +++ b/drivers/usb/musb/musbhsdma.c @@ -399,7 +399,7 @@ struct dma_controller *musbhs_dma_contro controller->controller.channel_abort = dma_channel_abort; if (request_irq(irq, dma_controller_irq, 0, - dev_name(musb->controller), &controller->controller)) { + dev_name(musb->controller), controller)) { dev_err(dev, "request_irq %d failed!\n", irq); musb_dma_controller_destroy(&controller->controller); From patchwork Tue Jan 14 10:02:14 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 233947 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=-11.8 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, MENTIONS_GIT_HOSTING, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, 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 426E8C33CB1 for ; Tue, 14 Jan 2020 10:11:34 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 1883824677 for ; Tue, 14 Jan 2020 10:11:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578996694; bh=rkSjrn7Hqd8PJz5qq88E2kS3hyDaQ57gfM2PwtCM6EU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=Ah8gHp2qIT3RBsruDSwP7E7eNq2HF5ITvh4bF65DN5HVRG6dbiC322bhQpRVHoJ6E Akz56Yekh4xDOV+1L2ri3IxC4G57L5Iw+ZB1qVSr4wbdpp7iqHZ9BKYj/ujcZkoLMi WN1h2qJXjnLF6usGuvHdl/31sDNz7STqQB6zI7Gw= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732546AbgANKLd (ORCPT ); Tue, 14 Jan 2020 05:11:33 -0500 Received: from mail.kernel.org ([198.145.29.99]:46766 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731651AbgANKLc (ORCPT ); Tue, 14 Jan 2020 05:11:32 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.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 34C6220678; Tue, 14 Jan 2020 10:11:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578996691; bh=rkSjrn7Hqd8PJz5qq88E2kS3hyDaQ57gfM2PwtCM6EU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PObRDJSF+kPwSO2DcNEugt9wiF6jQe+3sbJLynd3csmZ6E5th1dNnnUvAxZWKHpao 8rXiKVYxz48vF7bEf1SPM2/ZGuEewKBAlR+sQqwVMzPg03JQJLgodo5x38RintTJXD x+w1Jvyh+d0OnO4Tm4RiKiuPxyPtZsT57TzDuQxM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Michael Straube Subject: [PATCH 4.9 22/31] staging: rtl8188eu: Add device code for TP-Link TL-WN727N v5.21 Date: Tue, 14 Jan 2020 11:02:14 +0100 Message-Id: <20200114094344.081944689@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200114094334.725604663@linuxfoundation.org> References: <20200114094334.725604663@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Michael Straube commit 58dcc5bf4030cab548d5c98cd4cd3632a5444d5a upstream. This device was added to the stand-alone driver on github. Add it to the staging driver as well. Link: https://github.com/lwfinger/rtl8188eu/commit/b9b537aa25a8 Signed-off-by: Michael Straube Cc: stable Link: https://lore.kernel.org/r/20191228143725.24455-1-straube.linux@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8188eu/os_dep/usb_intf.c | 1 + 1 file changed, 1 insertion(+) --- a/drivers/staging/rtl8188eu/os_dep/usb_intf.c +++ b/drivers/staging/rtl8188eu/os_dep/usb_intf.c @@ -45,6 +45,7 @@ static struct usb_device_id rtw_usb_id_t {USB_DEVICE(0x2001, 0x3311)}, /* DLink GO-USB-N150 REV B1 */ {USB_DEVICE(0x2001, 0x331B)}, /* D-Link DWA-121 rev B1 */ {USB_DEVICE(0x2357, 0x010c)}, /* TP-Link TL-WN722N v2 */ + {USB_DEVICE(0x2357, 0x0111)}, /* TP-Link TL-WN727N v5.21 */ {USB_DEVICE(0x0df6, 0x0076)}, /* Sitecom N150 v2 */ {USB_DEVICE(USB_VENDER_ID_REALTEK, 0xffef)}, /* Rosewill RNX-N150NUB */ {} /* Terminating entry */ From patchwork Tue Jan 14 10:02:18 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 233946 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=-6.8 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, 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 D25C8C33CB1 for ; Tue, 14 Jan 2020 10:11:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id A3F3D24687 for ; Tue, 14 Jan 2020 10:11:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578996706; bh=NPgvTnMt8y/vHE1YdGuf4btulsHpnSuYylIwKFq+mqo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=DZ9xOTMi0RyRwRfoK8dkzWadkYKPm7jHnqxw7DdyYd3lerHt4QtOInwOoDy802oKk 59/v6L2z3wR5YDyvVCgwO38HNOA4BPKfIuUit63WKZuart/HkxAJPW4AeA9I15inDA C6BUzuwcze17x+YvUGSlb8WdyAFX6pmPbXqoAbbY= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732686AbgANKLq (ORCPT ); Tue, 14 Jan 2020 05:11:46 -0500 Received: from mail.kernel.org ([198.145.29.99]:47268 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728983AbgANKLo (ORCPT ); Tue, 14 Jan 2020 05:11:44 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.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 94D802467D; Tue, 14 Jan 2020 10:11:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578996704; bh=NPgvTnMt8y/vHE1YdGuf4btulsHpnSuYylIwKFq+mqo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SjlN80SpCPns4li6BEbMCWyE4YjmObPr03KgJ9SABfAim6WG2Ka5jyW2F3BNCgdo6 6SIHqOK+jFiaGVIB7hr970xzpa6jssXxS5ikyWqOGCzXsCun++454ObvMip2UmoBRg kU9F1h3C8pphioLixWQwZliudQr/WSQQRjl6AzhY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Navid Emamdoost , Ganapathi Bhat , Kalle Valo , Ben Hutchings Subject: [PATCH 4.9 26/31] mwifiex: pcie: Fix memory leak in mwifiex_pcie_alloc_cmdrsp_buf Date: Tue, 14 Jan 2020 11:02:18 +0100 Message-Id: <20200114094344.857241415@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200114094334.725604663@linuxfoundation.org> References: <20200114094334.725604663@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Navid Emamdoost commit db8fd2cde93227e566a412cf53173ffa227998bc upstream. In mwifiex_pcie_alloc_cmdrsp_buf, a new skb is allocated which should be released if mwifiex_map_pci_memory() fails. The release is added. Fixes: fc3314609047 ("mwifiex: use pci_alloc/free_consistent APIs for PCIe") Signed-off-by: Navid Emamdoost Acked-by: Ganapathi Bhat Signed-off-by: Kalle Valo Cc: Ben Hutchings Signed-off-by: Greg Kroah-Hartman --- drivers/net/wireless/marvell/mwifiex/pcie.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) --- a/drivers/net/wireless/marvell/mwifiex/pcie.c +++ b/drivers/net/wireless/marvell/mwifiex/pcie.c @@ -976,8 +976,10 @@ static int mwifiex_pcie_alloc_cmdrsp_buf } skb_put(skb, MWIFIEX_UPLD_SIZE); if (mwifiex_map_pci_memory(adapter, skb, MWIFIEX_UPLD_SIZE, - PCI_DMA_FROMDEVICE)) + PCI_DMA_FROMDEVICE)) { + kfree_skb(skb); return -1; + } card->cmdrsp_buf = skb; From patchwork Tue Jan 14 10:02:19 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 233926 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=-6.8 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,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 0ACD7C33CB3 for ; Tue, 14 Jan 2020 10:14:53 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C8BCC20678 for ; Tue, 14 Jan 2020 10:14:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578996892; bh=k7kjU9j0TYsN5f6EiBfMNCH3voyuC2Mmp1NyQsEfLoI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=WL68H6jbvBEHXtvkPFUxCF9AxeE1+I6lHEiiat5w8ouUFPcenN83ZfrrcaAliDc1R +nt/OGxu1WPPMN2ttdi9/k25kH7ljibmmkbx9LF/cZ9VcjgWy3SFtgm5cpVKmClGWg rmhxpTQJkx3evLuil/TIpr5ayRC1g+IG1hLvbMDg= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731750AbgANKLs (ORCPT ); Tue, 14 Jan 2020 05:11:48 -0500 Received: from mail.kernel.org ([198.145.29.99]:47402 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728983AbgANKLr (ORCPT ); Tue, 14 Jan 2020 05:11:47 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.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 A96E524689; Tue, 14 Jan 2020 10:11:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578996707; bh=k7kjU9j0TYsN5f6EiBfMNCH3voyuC2Mmp1NyQsEfLoI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eFwUdS+uTwBuuuI1GoWjsyvdm0dsor/co/Xbx63iWwHWmMcNqmhMHLa+LiFsenyk/ j7tSoT3B0ScFUh9wdxMQHY3rAlaByB/qecT5Ez9klJu0JR2C9AamFm7UTVeYQC4rb5 B8Qu3Yfs2zj2MNwH/Vn6AYCIAMfHzdf0jXaQXOY8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Navid Emamdoost , "Martin K. Petersen" , Ben Hutchings Subject: [PATCH 4.9 27/31] scsi: bfa: release allocated memory in case of error Date: Tue, 14 Jan 2020 11:02:19 +0100 Message-Id: <20200114094345.035651201@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200114094334.725604663@linuxfoundation.org> References: <20200114094334.725604663@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Navid Emamdoost commit 0e62395da2bd5166d7c9e14cbc7503b256a34cb0 upstream. In bfad_im_get_stats if bfa_port_get_stats fails, allocated memory needs to be released. Link: https://lore.kernel.org/r/20190910234417.22151-1-navid.emamdoost@gmail.com Signed-off-by: Navid Emamdoost Signed-off-by: Martin K. Petersen Cc: Ben Hutchings Signed-off-by: Greg Kroah-Hartman --- drivers/scsi/bfa/bfad_attr.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) --- a/drivers/scsi/bfa/bfad_attr.c +++ b/drivers/scsi/bfa/bfad_attr.c @@ -283,8 +283,10 @@ bfad_im_get_stats(struct Scsi_Host *shos rc = bfa_port_get_stats(BFA_FCPORT(&bfad->bfa), fcstats, bfad_hcb_comp, &fcomp); spin_unlock_irqrestore(&bfad->bfad_lock, flags); - if (rc != BFA_STATUS_OK) + if (rc != BFA_STATUS_OK) { + kfree(fcstats); return NULL; + } wait_for_completion(&fcomp.comp); From patchwork Tue Jan 14 10:02:21 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 233927 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=-6.8 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,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 6570BC33CB1 for ; Tue, 14 Jan 2020 10:14:50 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 2F12D20678 for ; Tue, 14 Jan 2020 10:14:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578996890; bh=jMxOhpWReMdooUfFA0VgQedI3t3wXCKo7DdVSS9QIQU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=kLNMOykTLN3FvZf+qU2g7LUeTMtorxhzXhHOpGmvtipmc+/Ds2jKe4+bLXsD4lxRc mo3ToL8OuatVYN9ZeNVBB6VAsGl9RSQP7pkGUy8Rz3OTUqiG/zVj3PMQF1bLvbXKpD STYz7sP7MOJ5biJnDE37XJNRDdA93X3Ys+fvsNwA= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730937AbgANKLx (ORCPT ); Tue, 14 Jan 2020 05:11:53 -0500 Received: from mail.kernel.org ([198.145.29.99]:47606 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731893AbgANKLx (ORCPT ); Tue, 14 Jan 2020 05:11:53 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.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 0DA9A24679; Tue, 14 Jan 2020 10:11:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578996712; bh=jMxOhpWReMdooUfFA0VgQedI3t3wXCKo7DdVSS9QIQU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Veu0RE5KYNtCDrfNUC33Hbt+rNTE8AIAeee0LSerRyDBD5gS4UphsBXEQdN1FXoRk 0XwpT5KkIBN3uHi5wSkvXRQXbD3a2VPqQ1S94KSVYTtB17MOcZ65S6wK4SxIaWNm9E KSAqsz/VSeO6bd44PQDB+jupn/9vjn2jzbHtHs38= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alan Stern , Laurent Pinchart , Roger Whittaker Subject: [PATCH 4.9 29/31] USB: Fix: Dont skip endpoint descriptors with maxpacket=0 Date: Tue, 14 Jan 2020 11:02:21 +0100 Message-Id: <20200114094345.439636433@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200114094334.725604663@linuxfoundation.org> References: <20200114094334.725604663@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Alan Stern commit 2548288b4fb059b2da9ceada172ef763077e8a59 upstream. It turns out that even though endpoints with a maxpacket length of 0 aren't useful for data transfer, the descriptors do serve other purposes. In particular, skipping them will also skip over other class-specific descriptors for classes such as UVC. This unexpected side effect has caused some UVC cameras to stop working. In addition, the USB spec requires that when isochronous endpoint descriptors are present in an interface's altsetting 0 (which is true on some devices), the maxpacket size _must_ be set to 0. Warning about such things seems like a bad idea. This patch updates an earlier commit which would log a warning and skip these endpoint descriptors. Now we only log a warning, and we don't even do that for isochronous endpoints in altsetting 0. We don't need to worry about preventing endpoints with maxpacket = 0 from ever being used for data transfers; usb_submit_urb() already checks for this. Reported-and-tested-by: Roger Whittaker Fixes: d482c7bb0541 ("USB: Skip endpoints with 0 maxpacket length") Signed-off-by: Alan Stern CC: Laurent Pinchart Link: https://marc.info/?l=linux-usb&m=157790377329882&w=2 Link: https://lore.kernel.org/r/Pine.LNX.4.44L0.2001061040270.1514-100000@iolanthe.rowland.org Signed-off-by: Greg Kroah-Hartman --- drivers/usb/core/config.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) --- a/drivers/usb/core/config.c +++ b/drivers/usb/core/config.c @@ -387,12 +387,16 @@ static int usb_parse_endpoint(struct dev endpoint->desc.wMaxPacketSize = cpu_to_le16(8); } - /* Validate the wMaxPacketSize field */ + /* + * Validate the wMaxPacketSize field. + * Some devices have isochronous endpoints in altsetting 0; + * the USB-2 spec requires such endpoints to have wMaxPacketSize = 0 + * (see the end of section 5.6.3), so don't warn about them. + */ maxp = usb_endpoint_maxp(&endpoint->desc); - if (maxp == 0) { - dev_warn(ddev, "config %d interface %d altsetting %d endpoint 0x%X has wMaxPacketSize 0, skipping\n", + if (maxp == 0 && !(usb_endpoint_xfer_isoc(d) && asnum == 0)) { + dev_warn(ddev, "config %d interface %d altsetting %d endpoint 0x%X has invalid wMaxPacketSize 0\n", cfgno, inum, asnum, d->bEndpointAddress); - goto skip_to_next_endpoint_or_interface_descriptor; } /* Find the highest legal maxpacket size for this endpoint */ From patchwork Tue Jan 14 10:02:23 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 233929 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=-6.8 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,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 58804C33CB1 for ; Tue, 14 Jan 2020 10:14:43 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 2F7C9207FF for ; Tue, 14 Jan 2020 10:14:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578996883; bh=m+6CnTgFPLZVAN1JPjTJS+EawGXCA13mNcIhkE9Q0mw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=CM9V5SC7cDT/bwIv8yALkLjic7YjrUV7IgomnvdUa2sottgvTxD6xGV01Ep4VxKMR txnPexi8YbgEZ+qMXWrPZznImf1E+t4R6XqAHw9M0lA7nlZrkPnmfGpkI7Z+iBu/mi MN2pWsazjr5A5UtSDV65oJ7OEN5255WTpohWMDhg= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732959AbgANKMU (ORCPT ); Tue, 14 Jan 2020 05:12:20 -0500 Received: from mail.kernel.org ([198.145.29.99]:48512 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732937AbgANKMS (ORCPT ); Tue, 14 Jan 2020 05:12:18 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.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 6418624686; Tue, 14 Jan 2020 10:12:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578996738; bh=m+6CnTgFPLZVAN1JPjTJS+EawGXCA13mNcIhkE9Q0mw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UzD0L4f9uyfJraffvE9+z8uk95Z3leZUnJ2b8NIckhXxXsq98jib9VAM7g/8UxJh/ /dIrNrxwwrDW/RGiNgzYb+RWEXps4F3BBTF6Yac+hZ0LmlEAkhj+cP4+J4/OVEizej ByjbcHI2xPuS96JCHmIzk+65nnIZQBHPHItudaVQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jozsef Kadlecsik , syzbot+34bd2369d38707f3f4a7@syzkaller.appspotmail.com, Florian Westphal , Pablo Neira Ayuso Subject: [PATCH 4.9 31/31] netfilter: ipset: avoid null deref when IPSET_ATTR_LINENO is present Date: Tue, 14 Jan 2020 11:02:23 +0100 Message-Id: <20200114094345.829995252@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200114094334.725604663@linuxfoundation.org> References: <20200114094334.725604663@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Florian Westphal commit 22dad713b8a5ff488e07b821195270672f486eb2 upstream. The set uadt functions assume lineno is never NULL, but it is in case of ip_set_utest(). syzkaller managed to generate a netlink message that calls this with LINENO attr present: general protection fault: 0000 [#1] PREEMPT SMP KASAN RIP: 0010:hash_mac4_uadt+0x1bc/0x470 net/netfilter/ipset/ip_set_hash_mac.c:104 Call Trace: ip_set_utest+0x55b/0x890 net/netfilter/ipset/ip_set_core.c:1867 nfnetlink_rcv_msg+0xcf2/0xfb0 net/netfilter/nfnetlink.c:229 netlink_rcv_skb+0x177/0x450 net/netlink/af_netlink.c:2477 nfnetlink_rcv+0x1ba/0x460 net/netfilter/nfnetlink.c:563 pass a dummy lineno storage, its easier than patching all set implementations. This seems to be a day-0 bug. Cc: Jozsef Kadlecsik Reported-by: syzbot+34bd2369d38707f3f4a7@syzkaller.appspotmail.com Fixes: a7b4f989a6294 ("netfilter: ipset: IP set core support") Signed-off-by: Florian Westphal Acked-by: Jozsef Kadlecsik Signed-off-by: Pablo Neira Ayuso Signed-off-by: Greg Kroah-Hartman --- net/netfilter/ipset/ip_set_core.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/net/netfilter/ipset/ip_set_core.c +++ b/net/netfilter/ipset/ip_set_core.c @@ -1634,6 +1634,7 @@ static int ip_set_utest(struct net *net, struct ip_set *set; struct nlattr *tb[IPSET_ATTR_ADT_MAX + 1] = {}; int ret = 0; + u32 lineno; if (unlikely(protocol_failed(attr) || !attr[IPSET_ATTR_SETNAME] || @@ -1650,7 +1651,7 @@ static int ip_set_utest(struct net *net, return -IPSET_ERR_PROTOCOL; rcu_read_lock_bh(); - ret = set->variant->uadt(set, tb, IPSET_TEST, NULL, 0, 0); + ret = set->variant->uadt(set, tb, IPSET_TEST, &lineno, 0, 0); rcu_read_unlock_bh(); /* Userspace can't trigger element to be re-added */ if (ret == -EAGAIN)