From patchwork Thu Apr 2 19:17:24 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 228231 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=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, 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 0ADF1C2BA16 for ; Thu, 2 Apr 2020 19:16:59 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id CB16B20737 for ; Thu, 2 Apr 2020 19:16:58 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="ViZxw2ff" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729549AbgDBTQ6 (ORCPT ); Thu, 2 Apr 2020 15:16:58 -0400 Received: from mail-wm1-f66.google.com ([209.85.128.66]:50272 "EHLO mail-wm1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388571AbgDBTQ6 (ORCPT ); Thu, 2 Apr 2020 15:16:58 -0400 Received: by mail-wm1-f66.google.com with SMTP id t128so4662320wma.0 for ; Thu, 02 Apr 2020 12:16:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=VpbOaOtIIxM0qlnpSC/R72ufsSNvdYgk1tUvm25+WkY=; b=ViZxw2ffnRsvv/6mq2hQHzwWaZj5ZhCT9B52pphcZe+5dVuqm5GAoKuwl6qPz5WZaS PmBpJ4k5WKnTlliKsRJTRQ2GiRUWwxPky0wBigzSCeAHFzR0onNWUDdZpDJSCp6rLhHG 7x0EB50JrlT8HLSmvPHdeO4zhKSpTlsGmBHvFxTkT1Nm19uHuyqhOz6On8B630dDoYHM p9Xmk+iD0KcTeNvF1yefo595cA37JMw8ZPvYetmUlR4yPwnNL4KAfbB1nNA16vbX/4md DeSY9+xYyGv4uXQNvNmBFZxyDXhXwZt5/NDF78A9KBPNbZSWvQRnsaaw7B2arLz5k69X XoyQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=VpbOaOtIIxM0qlnpSC/R72ufsSNvdYgk1tUvm25+WkY=; b=EmQgrBmaHFuN+rL2OQmVMcj422jZcUeEEWkxvpu4z0s3T5MBPE6Yd2I4cTRyoB6Bcf sMKzzqTD5KOCFgYvT/dn/sLHpMr0zNi0CjQaNBX/WhRg26UxJndp+kxWf+zPKhC5jolg b3J+NKReqvwzx84XK+COMDXAroKLex1fSAHy9B4a2yEr0Kbbw/C8kQpAdA/FzTUB/BVe 5IXNM5dyDLwB+ijCzs1YcdnoBiMloQe5Kc6y0T1knblTSI1qHibM4frdwXJdC6s6ItXC OJ2w+T7M8UwM6dsyYkzYh9Hrnc6oAJr7zJWMpY06NttY9DwhJqbWdXABPxlzVopnLcJx GCdQ== X-Gm-Message-State: AGi0PuazWX9F//CLuOwq8rAEqdqgvCTWVg/hZm/YkzNtO4x5Ldt/p5zj 6Rh6ZQPabhAmP9UzChIXkuApuEMoZr/Qjg== X-Google-Smtp-Source: APiQypLzMVlDe74yfO+6SwIbYVWCAgDIvdeOiPUMdRyi3vLxn/m1IIBSSUpL4pbaYTN1IGqLpZEOFw== X-Received: by 2002:a7b:c145:: with SMTP id z5mr4833855wmi.55.1585855015091; Thu, 02 Apr 2020 12:16:55 -0700 (PDT) Received: from localhost.localdomain ([95.149.164.95]) by smtp.gmail.com with ESMTPSA id y1sm879050wmd.14.2020.04.02.12.16.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Apr 2020 12:16:54 -0700 (PDT) From: Lee Jones To: stable@vger.kernel.org Subject: [PATCH 4.9 01/24] clk: qcom: rcg: Return failure for RCG update Date: Thu, 2 Apr 2020 20:17:24 +0100 Message-Id: <20200402191747.789097-1-lee.jones@linaro.org> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Taniya Das [ Upstream commit 21ea4b62e1f3dc258001a68da98c9663a9dbd6c7 ] In case of update config failure, return -EBUSY, so that consumers could handle the failure gracefully. Signed-off-by: Taniya Das Link: https://lkml.kernel.org/r/1557339895-21952-2-git-send-email-tdas@codeaurora.org Signed-off-by: Stephen Boyd Signed-off-by: Lee Jones --- drivers/clk/qcom/clk-rcg2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/clk/qcom/clk-rcg2.c b/drivers/clk/qcom/clk-rcg2.c index d8601b138dc1e..29abb600d7e15 100644 --- a/drivers/clk/qcom/clk-rcg2.c +++ b/drivers/clk/qcom/clk-rcg2.c @@ -107,7 +107,7 @@ static int update_config(struct clk_rcg2 *rcg) } WARN(1, "%s: rcg didn't update its configuration.", name); - return 0; + return -EBUSY; } static int clk_rcg2_set_parent(struct clk_hw *hw, u8 index) From patchwork Thu Apr 2 19:17:26 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 228230 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=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, 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 6D80EC2BA12 for ; Thu, 2 Apr 2020 19:17:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 3A6FA206F8 for ; Thu, 2 Apr 2020 19:17:01 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="bvOWUkqP" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388669AbgDBTRA (ORCPT ); Thu, 2 Apr 2020 15:17:00 -0400 Received: from mail-wr1-f67.google.com ([209.85.221.67]:40068 "EHLO mail-wr1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388621AbgDBTRA (ORCPT ); Thu, 2 Apr 2020 15:17:00 -0400 Received: by mail-wr1-f67.google.com with SMTP id s8so3459511wrt.7 for ; Thu, 02 Apr 2020 12:16:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=rG8NefQITkcFodUASgLVxmZcYdKDQhtnZoRraZbfXxk=; b=bvOWUkqP/3jhVGkgj/rXDHu7JjW+UI6zRYqd4XRKiIsRlmTf+S87hj1e+guP3zU5Ry G/jnc+pIbuZ+atklusXheOzJygw//1+aS/EJ6yNybmLxDkhDkyIwrN0i3iAzYBCifMdG ao5GXY3wfYUB9czkaZkBSwOq/jYESdXb2xDbrBTNqizcoI9MxNkp4flvjg0P1lNcx85b lM83bGPAyShrcmO7NurK7vn5aqjCCbFSxMfD0NJyCW6FS4W++uHm5YOr58AtRW6YN1xZ Dwb8McP0lSZeN7nisIfFb1+3XDE77qm5UNKJgSwPLL3zpSdiN3/xfiCMY/NVWcGghD6O Ujvg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=rG8NefQITkcFodUASgLVxmZcYdKDQhtnZoRraZbfXxk=; b=r1HllT6u/RlEYRkMmwF09PGgobb+QtenXPCKbAWx2/yOwdVZtBfKDHFvAc0MEnGoEh 36vKWQLZBqJ/ObXk5t58CZXw5i367aH1Zy85xSlN9u5fXmJkb8BxkI7iZm04v6UKpEiB j4mWZIr/bJSFXsz+usPH4vbRKGI1gxnUf46x05byhT74YOC90JcrJ6XJ+VUYddeaFHVr O+9UBssXv0Z3WO0lPqmOFQU5TRvq1ib/f6PVaOF/NHzCh0FdCCKIXkgh9WZECltKIbex MgayM1o1tZhxxHcZEELJtxeEmeh3e2yqXq9KcJdGO35jfm2Duu10NZRK2KSc487sbgFn paUA== X-Gm-Message-State: AGi0PuYwQWzzwRsezthAwmHaLJ0Q+yIS1y/s2nmtBKCLnKH/y69P54aO D1w9P/HxJ2rSspAWFXNmEU5yHH3wAuQPyg== X-Google-Smtp-Source: APiQypLeLCP+MquopneDYoZ7hW9Obp4ulEOIOq4xZtkdXDoZMafvyfM4ZRfIaNL02Hhynq546LrEVQ== X-Received: by 2002:adf:b31d:: with SMTP id j29mr4897868wrd.218.1585855017101; Thu, 02 Apr 2020 12:16:57 -0700 (PDT) Received: from localhost.localdomain ([95.149.164.95]) by smtp.gmail.com with ESMTPSA id y1sm879050wmd.14.2020.04.02.12.16.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Apr 2020 12:16:56 -0700 (PDT) From: Lee Jones To: stable@vger.kernel.org Subject: [PATCH 4.9 03/24] arm64: Fix size of __early_cpu_boot_status Date: Thu, 2 Apr 2020 20:17:26 +0100 Message-Id: <20200402191747.789097-3-lee.jones@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200402191747.789097-1-lee.jones@linaro.org> References: <20200402191747.789097-1-lee.jones@linaro.org> MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Arun KS [ Upstream commit 61cf61d81e326163ce1557ceccfca76e11d0e57c ] __early_cpu_boot_status is of type long. Use quad assembler directive to allocate proper size. Acked-by: Mark Rutland Signed-off-by: Arun KS Signed-off-by: Will Deacon Signed-off-by: Lee Jones --- arch/arm64/kernel/head.S | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm64/kernel/head.S b/arch/arm64/kernel/head.S index 3b10b93959607..aba534959377b 100644 --- a/arch/arm64/kernel/head.S +++ b/arch/arm64/kernel/head.S @@ -650,7 +650,7 @@ ENTRY(__boot_cpu_mode) * with MMU turned off. */ ENTRY(__early_cpu_boot_status) - .long 0 + .quad 0 .popsection From patchwork Thu Apr 2 19:17:28 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 228229 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=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, 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 7694AC2BA16 for ; Thu, 2 Apr 2020 19:17:02 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 4911B206F8 for ; Thu, 2 Apr 2020 19:17:02 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="O7/5GI48" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388571AbgDBTRB (ORCPT ); Thu, 2 Apr 2020 15:17:01 -0400 Received: from mail-wr1-f66.google.com ([209.85.221.66]:39526 "EHLO mail-wr1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388668AbgDBTRB (ORCPT ); Thu, 2 Apr 2020 15:17:01 -0400 Received: by mail-wr1-f66.google.com with SMTP id p10so5591542wrt.6 for ; Thu, 02 Apr 2020 12:17:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=MsgQu2s5Ine+vEQU/kp8/4vrgQB3e/69fxJksj4R8LU=; b=O7/5GI48MxA+FT3i0PbzJRsTTHjysb3rIX9ZtfieGrJ8Qp7MaTPl7rG82xr/KMnTEP QdcGaIvQlcwb+neCN0gW5PaAgiT65sEyUfEU6tHAkXuWx5X/OZkxLpirjDYv5+QJ1VZz AY4noQ+WeNqOm8jwwqRabRBK/HYK3oIRzmX5Gv5/3gOh+PrHj0qVVBD9YmICVPFBBrR/ QO4WLhBPOEVqr2drMdm7KeHSk7pwDJ/AO43M819nuNn0+22Vmlq3z0t+8YrPvueZwBEP fI4H73Tk9BS642H1YHMgaWL7jEs/ig4YxONMEZSGBMXHl8V8omdVRmRYxhoEWn47yGvx 2TBA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=MsgQu2s5Ine+vEQU/kp8/4vrgQB3e/69fxJksj4R8LU=; b=YzRHpuPIYVUaiZPLkyRbGRcXYrPnnIai9TC11u3ZvuFZCcEpEJJ8QtBhe+LgLeF04W PmPb8+2JajpvvpA4d5vYxSKLyRavIAej43lyLDMQ1dUbuvoy+IYKHSdc1716IKknUvdc /XlVLD8wTWiNMUYPsgFeDNPItBzHQEd0ck/9j2dkaxhY8Do4T5ZO+ighEU3ZKQlWsngK w3t7Tk9bpIp/Iy1OrD9d+ca9VjxjP0h0nE+RKCW9iQmojaiIH7Dc2FL3Oxu1ARn+o5LH NK4h2/usRm604sMkpvptVjuyXMQf6nPc2VwmavdK6tmTsvxJggtEpuu8ycjDE+WFt1sZ Dz6Q== X-Gm-Message-State: AGi0PuYNCHXTf8xTeZiBlxFpjbtyeDaAMDGgIm6U1v5CgtgYPLerD1cw SL16Scw6ONkPKlv2shZBeRqnykONyjgKIQ== X-Google-Smtp-Source: APiQypL401ZQY47DLEAbSOs16/DAStlA4lmnuqykhVz8LO/cYBpsUCBVsudur2X14rX6hbEi833OfA== X-Received: by 2002:a05:6000:4:: with SMTP id h4mr4874935wrx.236.1585855019226; Thu, 02 Apr 2020 12:16:59 -0700 (PDT) Received: from localhost.localdomain ([95.149.164.95]) by smtp.gmail.com with ESMTPSA id y1sm879050wmd.14.2020.04.02.12.16.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Apr 2020 12:16:58 -0700 (PDT) From: Lee Jones To: stable@vger.kernel.org Subject: [PATCH 4.9 05/24] drm_dp_mst_topology: fix broken drm_dp_sideband_parse_remote_dpcd_read() Date: Thu, 2 Apr 2020 20:17:28 +0100 Message-Id: <20200402191747.789097-5-lee.jones@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200402191747.789097-1-lee.jones@linaro.org> References: <20200402191747.789097-1-lee.jones@linaro.org> MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Hans Verkuil [ Upstream commit a4c30a4861c54af78c4eb8b7855524c1a96d9f80 ] When parsing the reply of a DP_REMOTE_DPCD_READ DPCD command the result is wrong due to a missing idx increment. This was never noticed since DP_REMOTE_DPCD_READ is currently not used, but if you enable it, then it is all wrong. Signed-off-by: Hans Verkuil Reviewed-by: Lyude Paul Acked-by: Alex Deucher Link: https://patchwork.freedesktop.org/patch/msgid/e72ddac2-1dc0-100a-d816-9ac98ac009dd@xs4all.nl Signed-off-by: Lee Jones --- drivers/gpu/drm/drm_dp_mst_topology.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/gpu/drm/drm_dp_mst_topology.c b/drivers/gpu/drm/drm_dp_mst_topology.c index 17aedaaf364c1..93f2033b414a2 100644 --- a/drivers/gpu/drm/drm_dp_mst_topology.c +++ b/drivers/gpu/drm/drm_dp_mst_topology.c @@ -431,6 +431,7 @@ static bool drm_dp_sideband_parse_remote_dpcd_read(struct drm_dp_sideband_msg_rx if (idx > raw->curlen) goto fail_len; repmsg->u.remote_dpcd_read_ack.num_bytes = raw->msg[idx]; + idx++; if (idx > raw->curlen) goto fail_len; From patchwork Thu Apr 2 19:17:30 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 228228 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=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, 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 414BAC2BA12 for ; Thu, 2 Apr 2020 19:17:04 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 130ED206F8 for ; Thu, 2 Apr 2020 19:17:04 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="vo6W9dlR" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388726AbgDBTRD (ORCPT ); Thu, 2 Apr 2020 15:17:03 -0400 Received: from mail-wm1-f66.google.com ([209.85.128.66]:54343 "EHLO mail-wm1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388668AbgDBTRD (ORCPT ); Thu, 2 Apr 2020 15:17:03 -0400 Received: by mail-wm1-f66.google.com with SMTP id c81so4631409wmd.4 for ; Thu, 02 Apr 2020 12:17:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=8n9PuhMajM7WvWxCjQiwhBj7Uis5bjcy3z0jj02FBf0=; b=vo6W9dlRhe5Qz+GhdZL+EGPCE3kcfywClHKyQslkjPIZiiYFzFnuOYuZGbF/dhs+cF 03g2oN2xQ/5odkS40v417g7j4ocCzQaPr8Hf1zTVLco4QjMu4GNRgcvGeX5YwwurFf85 aO1wrFKyuIyLisMbEB+uWUUdzVBx0XR/HOFL/+3Wf5VKpyF52ZjI4mj7nimA89tcxVyv qTLLgLyz5UcC/sofS1Uafr7Q3JEylcmCyXbhhT8k1Fr/QzOodUU70mQZWKMPjEuXmdwE oplP8TUoNeugTbGCyGT4fW0wt8FEKuZ++vH5ihwIG0kjfeC5/1EolqQ4L3ApW7qACQTB j3JA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=8n9PuhMajM7WvWxCjQiwhBj7Uis5bjcy3z0jj02FBf0=; b=gSLhjL5NsjqhUVznF0TdIFyiW6gaFreouASsVcFaQKzO5fKIpyWwkP6vkdEZDMgS3K nQZpzu0MCKLG0qYYRfHH6L434q4N+BQxxRt3lWSv07ybLQKofSnrChvMP/Kkj5d4YstC 6mshMb98c7aA0a/RVwpuEKSuXwr/JPyXIkXuLBOgIRMJ/EnOryYrXMKiitSbO95AInpW 8/0wlpUAYSPSqxwTKjQ+70jYzcTBs8vFL0IWRn+Og+KxB45r/ea9wnINEXto2EH3iaPW p3jsMm91Wi/5IjPEc3C20JhUenGihG1G4y96+K0ChJtmVja9xOc0pfa4aWITzMOTehGM YisQ== X-Gm-Message-State: AGi0PuYnyjLgnI2P9RIaFzCto5wUdXp7WLr8VaYdtjyzrr77akV5Ibfr 1WXSHFUyAivy6PVuF/tQA1W4ndcOnGrxsw== X-Google-Smtp-Source: APiQypK4qBca4/OdOy0sz2KYJDMpL3MvAVx/PfXDzQBKdbIKEk8fqVXYmtze9vY0PYjsy/B9kqfMNg== X-Received: by 2002:a1c:3105:: with SMTP id x5mr5031191wmx.51.1585855021078; Thu, 02 Apr 2020 12:17:01 -0700 (PDT) Received: from localhost.localdomain ([95.149.164.95]) by smtp.gmail.com with ESMTPSA id y1sm879050wmd.14.2020.04.02.12.17.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Apr 2020 12:17:00 -0700 (PDT) From: Lee Jones To: stable@vger.kernel.org Subject: [PATCH 4.9 07/24] clk: Fix debugfs_create_*() usage Date: Thu, 2 Apr 2020 20:17:30 +0100 Message-Id: <20200402191747.789097-7-lee.jones@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200402191747.789097-1-lee.jones@linaro.org> References: <20200402191747.789097-1-lee.jones@linaro.org> MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Geert Uytterhoeven [ Upstream commit 4c8326d5ebb0de3191e98980c80ab644026728d0 ] When exposing data access through debugfs, the correct debugfs_create_*() functions must be used, matching the data types. Remove all casts from data pointers passed to debugfs_create_*() functions, as such casts prevent the compiler from flagging bugs. clk_core.rate and .accuracy are "unsigned long", hence casting their addresses to "u32 *" exposed the wrong halves on big-endian 64-bit systems. Fix this by using debugfs_create_ulong() instead. Octal permissions are preferred, as they are easier to read than symbolic permissions. Hence replace "S_IRUGO" by "0444" throughout. Signed-off-by: Geert Uytterhoeven [sboyd@codeaurora.org: Squash the octal change in too] Signed-off-by: Stephen Boyd Signed-off-by: Lee Jones --- drivers/clk/clk.c | 30 ++++++++++++++---------------- 1 file changed, 14 insertions(+), 16 deletions(-) diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c index af4f2ffc4fc50..b901bea814b6d 100644 --- a/drivers/clk/clk.c +++ b/drivers/clk/clk.c @@ -2145,18 +2145,16 @@ static int clk_debug_create_one(struct clk_core *core, struct dentry *pdentry) core->dentry = d; - d = debugfs_create_u32("clk_rate", S_IRUGO, core->dentry, - (u32 *)&core->rate); + d = debugfs_create_ulong("clk_rate", 0444, core->dentry, &core->rate); if (!d) goto err_out; - d = debugfs_create_u32("clk_accuracy", S_IRUGO, core->dentry, - (u32 *)&core->accuracy); + d = debugfs_create_ulong("clk_accuracy", 0444, core->dentry, + &core->accuracy); if (!d) goto err_out; - d = debugfs_create_u32("clk_phase", S_IRUGO, core->dentry, - (u32 *)&core->phase); + d = debugfs_create_u32("clk_phase", 0444, core->dentry, &core->phase); if (!d) goto err_out; @@ -2165,18 +2163,18 @@ static int clk_debug_create_one(struct clk_core *core, struct dentry *pdentry) if (!d) goto err_out; - d = debugfs_create_u32("clk_prepare_count", S_IRUGO, core->dentry, - (u32 *)&core->prepare_count); + d = debugfs_create_u32("clk_prepare_count", 0444, core->dentry, + &core->prepare_count); if (!d) goto err_out; - d = debugfs_create_u32("clk_enable_count", S_IRUGO, core->dentry, - (u32 *)&core->enable_count); + d = debugfs_create_u32("clk_enable_count", 0444, core->dentry, + &core->enable_count); if (!d) goto err_out; - d = debugfs_create_u32("clk_notifier_count", S_IRUGO, core->dentry, - (u32 *)&core->notifier_count); + d = debugfs_create_u32("clk_notifier_count", 0444, core->dentry, + &core->notifier_count); if (!d) goto err_out; @@ -2270,22 +2268,22 @@ static int __init clk_debug_init(void) if (!rootdir) return -ENOMEM; - d = debugfs_create_file("clk_summary", S_IRUGO, rootdir, &all_lists, + d = debugfs_create_file("clk_summary", 0444, rootdir, &all_lists, &clk_summary_fops); if (!d) return -ENOMEM; - d = debugfs_create_file("clk_dump", S_IRUGO, rootdir, &all_lists, + d = debugfs_create_file("clk_dump", 0444, rootdir, &all_lists, &clk_dump_fops); if (!d) return -ENOMEM; - d = debugfs_create_file("clk_orphan_summary", S_IRUGO, rootdir, + d = debugfs_create_file("clk_orphan_summary", 0444, rootdir, &orphan_list, &clk_summary_fops); if (!d) return -ENOMEM; - d = debugfs_create_file("clk_orphan_dump", S_IRUGO, rootdir, + d = debugfs_create_file("clk_orphan_dump", 0444, rootdir, &orphan_list, &clk_dump_fops); if (!d) return -ENOMEM; From patchwork Thu Apr 2 19:17:32 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 228226 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=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, 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 5C2FAC43331 for ; Thu, 2 Apr 2020 19:17:08 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 34E94206F8 for ; Thu, 2 Apr 2020 19:17:08 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="H9rIX5St" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388822AbgDBTRH (ORCPT ); Thu, 2 Apr 2020 15:17:07 -0400 Received: from mail-wr1-f65.google.com ([209.85.221.65]:40076 "EHLO mail-wr1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388761AbgDBTRH (ORCPT ); Thu, 2 Apr 2020 15:17:07 -0400 Received: by mail-wr1-f65.google.com with SMTP id s8so3459840wrt.7 for ; Thu, 02 Apr 2020 12:17:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=BeyLphkFLnP4CTEflF/utnlR8G5qa5q59+49c7r8kS0=; b=H9rIX5St6Cpc0s13sla67hTjy0gu9/KMBi9l9yyxjUWgyVd+RkKIVUiQ6r6xdWTewq AHGJ9M5wOC681pQIAiewupxW6poqX5IKF+o7LQUKondRb8PmlaWzexY5vPP1VYcLix8N XsAXVOLxlD/4npfDf6ZiOLb8ds5m0DWuaGPg4HaPYZf+BTGijTGIM1OoOU/sK+K3xNTp jyUu3Ey0nBlIuKgGWSdcmiWttD7OO9GBpFjuAkemJSVjnbDKAk0dqgFwRQvHN2Yki5DX fwqRVsvPmV85lDHOIpBpPao0ZzTrkMmr5dZgVrqQNOv7yUu/4HWdVVIiebk93Nw3IZGs EaiQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=BeyLphkFLnP4CTEflF/utnlR8G5qa5q59+49c7r8kS0=; b=GJUDqXqmuH0JC5gVYq+BTK6zjcL//rk4outw5vwRu5SHQkRLMEZ7Jww/pQ0qnFOM8Z D/h9nX8RJ5Nojtr0GsjzUiUC15WWQgYuRoxKfMGsK/KWWGVdiFpxFe2DD6Wm/CPQQdf9 HESg3G/GTWHIvdNrqQsZ5CTjUjlxTJPJiCysX0CJh+EIRzx4018PB7kAljuGof++4fL9 /pna/rVhYKTh+LNAowoXvn9pE/kyz/2MXyV9pLbBINTmKRa5GU74EUFb85cqdkvies/B /QZkttD9l4GOCQsHeoSHTi9FNgxQSuVaWSKHUbmwqtkgdKWiiPOguIuf5x2c81cQw/BK yQlA== X-Gm-Message-State: AGi0PuZsEHJYOAgnfAPCh09KJ1FCe+5Vx0muH38lufWrLlyOZPsQUjq3 t6SitcKyw4ikDFvVPCiFAoaytDAHAhb51Q== X-Google-Smtp-Source: APiQypIAyytBz78o0nSdrTAMzff/UMtf/Rwh17hChZaTZhUjbZj/2N28mduUI1BbqhNyOTEE1MZ3sQ== X-Received: by 2002:adf:ff81:: with SMTP id j1mr4880611wrr.171.1585855023297; Thu, 02 Apr 2020 12:17:03 -0700 (PDT) Received: from localhost.localdomain ([95.149.164.95]) by smtp.gmail.com with ESMTPSA id y1sm879050wmd.14.2020.04.02.12.17.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Apr 2020 12:17:02 -0700 (PDT) From: Lee Jones To: stable@vger.kernel.org Subject: [PATCH 4.9 09/24] arm64: traps: Don't print stack or raw PC/LR values in backtraces Date: Thu, 2 Apr 2020 20:17:32 +0100 Message-Id: <20200402191747.789097-9-lee.jones@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200402191747.789097-1-lee.jones@linaro.org> References: <20200402191747.789097-1-lee.jones@linaro.org> MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Will Deacon [ Upstream commit a25ffd3a6302a67814280274d8f1aa4ae2ea4b59 ] Printing raw pointer values in backtraces has potential security implications and are of questionable value anyway. This patch follows x86's lead and removes the "Exception stack:" dump from kernel backtraces, as well as converting PC/LR values to symbols such as "sysrq_handle_crash+0x20/0x30". Tested-by: Laura Abbott Signed-off-by: Will Deacon Signed-off-by: Lee Jones --- arch/arm64/kernel/process.c | 8 ++-- arch/arm64/kernel/traps.c | 74 ++----------------------------------- 2 files changed, 6 insertions(+), 76 deletions(-) diff --git a/arch/arm64/kernel/process.c b/arch/arm64/kernel/process.c index e917d119490ce..6b073a31eec1c 100644 --- a/arch/arm64/kernel/process.c +++ b/arch/arm64/kernel/process.c @@ -182,11 +182,9 @@ void __show_regs(struct pt_regs *regs) } show_regs_print_info(KERN_DEFAULT); - print_symbol("PC is at %s\n", instruction_pointer(regs)); - print_symbol("LR is at %s\n", lr); - printk("pc : [<%016llx>] lr : [<%016llx>] pstate: %08llx\n", - regs->pc, lr, regs->pstate); - printk("sp : %016llx\n", sp); + print_symbol("pc : %s\n", regs->pc); + print_symbol("lr : %s\n", lr); + printk("sp : %016llx pstate : %08llx\n", sp, regs->pstate); i = top_reg; diff --git a/arch/arm64/kernel/traps.c b/arch/arm64/kernel/traps.c index 5962badb33462..ac73d8d8cd81d 100644 --- a/arch/arm64/kernel/traps.c +++ b/arch/arm64/kernel/traps.c @@ -52,55 +52,9 @@ static const char *handler[]= { int show_unhandled_signals = 0; -/* - * Dump out the contents of some kernel memory nicely... - */ -static void dump_mem(const char *lvl, const char *str, unsigned long bottom, - unsigned long top) -{ - unsigned long first; - mm_segment_t fs; - int i; - - /* - * We need to switch to kernel mode so that we can use __get_user - * to safely read from kernel space. - */ - fs = get_fs(); - set_fs(KERNEL_DS); - - printk("%s%s(0x%016lx to 0x%016lx)\n", lvl, str, bottom, top); - - for (first = bottom & ~31; first < top; first += 32) { - unsigned long p; - char str[sizeof(" 12345678") * 8 + 1]; - - memset(str, ' ', sizeof(str)); - str[sizeof(str) - 1] = '\0'; - - for (p = first, i = 0; i < (32 / 8) - && p < top; i++, p += 8) { - if (p >= bottom && p < top) { - unsigned long val; - - if (__get_user(val, (unsigned long *)p) == 0) - sprintf(str + i * 17, " %016lx", val); - else - sprintf(str + i * 17, " ????????????????"); - } - } - printk("%s%04lx:%s\n", lvl, first & 0xffff, str); - } - - set_fs(fs); -} - static void dump_backtrace_entry(unsigned long where) { - /* - * Note that 'where' can have a physical address, but it's not handled. - */ - print_ip_sym(where); + printk(" %pS\n", (void *)where); } static void __dump_instr(const char *lvl, struct pt_regs *regs) @@ -174,10 +128,8 @@ static void dump_backtrace(struct pt_regs *regs, struct task_struct *tsk) skip = !!regs; printk("Call trace:\n"); - while (1) { + do { unsigned long where = frame.pc; - unsigned long stack; - int ret; /* skip until specified stack frame */ if (!skip) { @@ -193,25 +145,7 @@ static void dump_backtrace(struct pt_regs *regs, struct task_struct *tsk) */ dump_backtrace_entry(regs->pc); } - ret = unwind_frame(tsk, &frame); - if (ret < 0) - break; - stack = frame.sp; - if (in_exception_text(where)) { - /* - * If we switched to the irq_stack before calling this - * exception handler, then the pt_regs will be on the - * task stack. The easiest way to tell is if the large - * pt_regs would overlap with the end of the irq_stack. - */ - if (stack < irq_stack_ptr && - (stack + sizeof(struct pt_regs)) > irq_stack_ptr) - stack = IRQ_STACK_TO_TASK_STACK(irq_stack_ptr); - - dump_mem("", "Exception stack", stack, - stack + sizeof(struct pt_regs)); - } - } + } while (!unwind_frame(tsk, &frame)); } void show_stack(struct task_struct *tsk, unsigned long *sp) @@ -248,8 +182,6 @@ static int __die(const char *str, int err, struct thread_info *thread, TASK_COMM_LEN, tsk->comm, task_pid_nr(tsk), thread + 1); if (!user_mode(regs)) { - dump_mem(KERN_EMERG, "Stack: ", regs->sp, - THREAD_SIZE + (unsigned long)task_stack_page(tsk)); dump_backtrace(regs, tsk); dump_instr(KERN_EMERG, regs); } From patchwork Thu Apr 2 19:17:33 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 228227 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=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, 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 EF217C2BA16 for ; Thu, 2 Apr 2020 19:17:06 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C4B16206F8 for ; Thu, 2 Apr 2020 19:17:06 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="cx6kp2JT" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388853AbgDBTRG (ORCPT ); Thu, 2 Apr 2020 15:17:06 -0400 Received: from mail-wm1-f67.google.com ([209.85.128.67]:40269 "EHLO mail-wm1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388621AbgDBTRG (ORCPT ); Thu, 2 Apr 2020 15:17:06 -0400 Received: by mail-wm1-f67.google.com with SMTP id a81so4925494wmf.5 for ; Thu, 02 Apr 2020 12:17:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=TV3arK5WUb34bvJty3z/ZBkIfATI4h4LTn5/l2uId24=; b=cx6kp2JT7RZH7M7jjfuVQmwfEjefw6ue5UWWPbe+DFqiBnsq9PpBA+SPt+mzCBsr31 NUZk/FTNklIwdcYrb0VWZaBJjmGf4tGZjr8mcRTVe2DVNyqKSFnPotMZ9SCR3jGVgM09 ulvWTN70gvAN24ZpvWXG8hO0Tiu9cALQKSNLYaYQYYKy7IVM5HC2H2lOfY60QEzyd2TL EwQKSWl/Xm/y4nZG0TjmFsm/8LOdkJo3XOAbLxFfWqDCshXfpeFQYsUMKEtyOSnYnzo1 prUc88jiqDIQKiVFJq4ctgJNrW3D7QWTcZiE2zACmWKCjlyAIyAGBIfIOgp7HnR4rNHU p/1A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=TV3arK5WUb34bvJty3z/ZBkIfATI4h4LTn5/l2uId24=; b=kV75ok5OSNhyS0/ShSKfzuRVx6kuCdv7wuDvqGXp6RuKpfYPvIA49cfLvz/yYxm4Tf m774NRugNk6+Yc6ibzr2eC69984tkg5evHlZ3nkC9yAg0LEAssy7dyDxCRDtRUuQk+aV KaVuMRB7hq4mprNYCyUazXy4//Dy6AQQOZhELmEZr/n7J8JVjdHuolPb8PRgkmgr8aYv ++KjFd3Fw60eqGSlHLJOMpoVorpIe1WL93wGPzz4ClR1sDfc8Xq3pwW/A7GAZgO15qLI vFP0aUTD5hFh5z2Di1k+Lnlw0pZrbkUOa2yTGeBPMfbLjKkwOIb79c2q7dWtc/cdPdgE fsyw== X-Gm-Message-State: AGi0PuabyM9tXWP70V7SpUzTob0HRu+BcbdrIbVkgEDWQecNhXlNYKU4 PEMizhwFMkW6nBlI9tehiRNSqxF8AcjiDA== X-Google-Smtp-Source: APiQypI7d4d6XKzWPatZAO1guJcFAKGHrOHtFh/q8l+TRRUtYbfGte2otLFsa9szeSD9Ka9zOExuRw== X-Received: by 2002:a7b:c8cd:: with SMTP id f13mr4952969wml.181.1585855024068; Thu, 02 Apr 2020 12:17:04 -0700 (PDT) Received: from localhost.localdomain ([95.149.164.95]) by smtp.gmail.com with ESMTPSA id y1sm879050wmd.14.2020.04.02.12.17.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Apr 2020 12:17:03 -0700 (PDT) From: Lee Jones To: stable@vger.kernel.org Subject: [PATCH 4.9 10/24] scsi: ufs: Fix error handing during hibern8 enter Date: Thu, 2 Apr 2020 20:17:33 +0100 Message-Id: <20200402191747.789097-10-lee.jones@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200402191747.789097-1-lee.jones@linaro.org> References: <20200402191747.789097-1-lee.jones@linaro.org> MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Subhash Jadavani [ Upstream commit 6d303e4b19d694cdbebf76bcdb51ada664ee953d ] During clock gating (ufshcd_gate_work()), we first put the link hibern8 by calling ufshcd_uic_hibern8_enter() and if ufshcd_uic_hibern8_enter() returns success (0) then we gate all the clocks. Now let’s zoom in to what ufshcd_uic_hibern8_enter() does internally: It calls __ufshcd_uic_hibern8_enter() and if failure is encountered, link recovery shall put the link back to the highest HS gear and returns success (0) to ufshcd_uic_hibern8_enter() which is the issue as link is still in active state due to recovery! Now ufshcd_uic_hibern8_enter() returns success to ufshcd_gate_work() and hence it goes ahead with gating the UFS clock while link is still in active state hence I believe controller would raise UIC error interrupts. But when we service the interrupt, clocks might have already been disabled! This change fixes for this by returning failure from __ufshcd_uic_hibern8_enter() if recovery succeeds as link is still not in hibern8, upon receiving the error ufshcd_hibern8_enter() would initiate retry to put the link state back into hibern8. Link: https://lore.kernel.org/r/1573798172-20534-8-git-send-email-cang@codeaurora.org Reviewed-by: Avri Altman Reviewed-by: Bean Huo Signed-off-by: Subhash Jadavani Signed-off-by: Can Guo Signed-off-by: Martin K. Petersen Signed-off-by: Lee Jones --- drivers/scsi/ufs/ufshcd.c | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c index 394df57894e6b..0b268f0151c67 100644 --- a/drivers/scsi/ufs/ufshcd.c +++ b/drivers/scsi/ufs/ufshcd.c @@ -2804,15 +2804,24 @@ static int __ufshcd_uic_hibern8_enter(struct ufs_hba *hba) ret = ufshcd_uic_pwr_ctrl(hba, &uic_cmd); if (ret) { + int err; + dev_err(hba->dev, "%s: hibern8 enter failed. ret = %d\n", __func__, ret); /* - * If link recovery fails then return error so that caller - * don't retry the hibern8 enter again. + * If link recovery fails then return error code returned from + * ufshcd_link_recovery(). + * If link recovery succeeds then return -EAGAIN to attempt + * hibern8 enter retry again. */ - if (ufshcd_link_recovery(hba)) - ret = -ENOLINK; + err = ufshcd_link_recovery(hba); + if (err) { + dev_err(hba->dev, "%s: link recovery failed", __func__); + ret = err; + } else { + ret = -EAGAIN; + } } return ret; @@ -2824,7 +2833,7 @@ static int ufshcd_uic_hibern8_enter(struct ufs_hba *hba) for (retries = UIC_HIBERN8_ENTER_RETRIES; retries > 0; retries--) { ret = __ufshcd_uic_hibern8_enter(hba); - if (!ret || ret == -ENOLINK) + if (!ret) goto out; } out: From patchwork Thu Apr 2 19:17:36 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 228225 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=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, 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 14EE5C2BA19 for ; Thu, 2 Apr 2020 19:17:10 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id DD08A206F8 for ; Thu, 2 Apr 2020 19:17:09 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="bqgbNdES" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388888AbgDBTRJ (ORCPT ); Thu, 2 Apr 2020 15:17:09 -0400 Received: from mail-wm1-f67.google.com ([209.85.128.67]:40273 "EHLO mail-wm1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388761AbgDBTRJ (ORCPT ); Thu, 2 Apr 2020 15:17:09 -0400 Received: by mail-wm1-f67.google.com with SMTP id a81so4925643wmf.5 for ; Thu, 02 Apr 2020 12:17:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=oWWMrX1if+NURhdB8TkNNjFtRd1Em0TKkYZf+SndQ1w=; b=bqgbNdESxnuadHy6kJlQhm3UQnQ5KuF7J/hjdu4VxYxM403j6Rf5v3cxo7i6k3tLFW UmOG2tma7GfibGj0z4tbRNvt2TYIhgChh6XgCtB8DKBUPZxSXVUXo6hWD/RkDZ7u5Z29 zhnHqepFxd0chBUFIXKxoR4pl2Jdl8CoXmc4tBYsYJfRNotbZuDtpjCOkXNJpMPPijF3 9ut9kKQMZOv6S6GLjhdz6EEEHVtEurzNHrQwG0fwAOp6elDnKGka42WGtzZdrkxkJoNm u77g2Rd4QfKmK1PITgmc9t63TM2FffcgDZivJ5UX4JPjWT8SaFMmxkbidwOaIt1b5w/J 4SbQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=oWWMrX1if+NURhdB8TkNNjFtRd1Em0TKkYZf+SndQ1w=; b=i6aGqlIiUwfoFMqmUOWcFyzyird/tahx21D0DOUXtgJgbZJ8GIAfBhsx9PFKw1pYL+ CfJ4cRM5yRut5yvo0eDsLmv8N62jZ87lue4ObUD004zM7HLFv1cvd7DXBzIZXZ9AT9YT Nw6s4g5cdif7J/LZOfla0Y8dnPvBJEvWuFUVTx0tGzmH9WpE2XBf2Q7Wi23KEWBOmTTG 1XJsA7iHvWEUVgHgJrO7ctHbjflYfblRk5DYUBjp28jqcOKkSKYD/VeemO8BpQuexYCw ng29YNmtfIGgNMLukLzDaZ0QA6h6gxmM9FEy05cDmI34LCMj1kHtkZy8EfHQyQFsSLCN qmpg== X-Gm-Message-State: AGi0Pubwk+0Li7SsnF4S+WqWSzWGm+JFI4aVpFX2rP2PTh1h8/8XCtQx K9kyyEDzQc79VnsUpJ4tqdVyLwW1I8LDdA== X-Google-Smtp-Source: APiQypLB4CG8AXMGDRdNztZ5yFt5bfI01cvpasIkny2eGlO3pmBUpJp+YUjZWKIQ188yrOiZKwkZxQ== X-Received: by 2002:a1c:1d93:: with SMTP id d141mr5051102wmd.134.1585855027180; Thu, 02 Apr 2020 12:17:07 -0700 (PDT) Received: from localhost.localdomain ([95.149.164.95]) by smtp.gmail.com with ESMTPSA id y1sm879050wmd.14.2020.04.02.12.17.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Apr 2020 12:17:06 -0700 (PDT) From: Lee Jones To: stable@vger.kernel.org Subject: [PATCH 4.9 13/24] wil6210: fix temperature debugfs Date: Thu, 2 Apr 2020 20:17:36 +0100 Message-Id: <20200402191747.789097-13-lee.jones@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200402191747.789097-1-lee.jones@linaro.org> References: <20200402191747.789097-1-lee.jones@linaro.org> MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Dedy Lansky [ Upstream commit 6d9eb7ebae3d7e951bc0999235ae7028eb4cae4f ] For negative temperatures, "temp" debugfs is showing wrong values. Use signed types so proper calculations is done for sub zero temperatures. Signed-off-by: Dedy Lansky Signed-off-by: Maya Erez Signed-off-by: Kalle Valo Signed-off-by: Lee Jones --- drivers/net/wireless/ath/wil6210/debugfs.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/net/wireless/ath/wil6210/debugfs.c b/drivers/net/wireless/ath/wil6210/debugfs.c index 8c9c06fb6d655..53e8f0be3df10 100644 --- a/drivers/net/wireless/ath/wil6210/debugfs.c +++ b/drivers/net/wireless/ath/wil6210/debugfs.c @@ -1065,7 +1065,7 @@ static const struct file_operations fops_ssid = { }; /*---------temp------------*/ -static void print_temp(struct seq_file *s, const char *prefix, u32 t) +static void print_temp(struct seq_file *s, const char *prefix, s32 t) { switch (t) { case 0: @@ -1073,7 +1073,8 @@ static void print_temp(struct seq_file *s, const char *prefix, u32 t) seq_printf(s, "%s N/A\n", prefix); break; default: - seq_printf(s, "%s %d.%03d\n", prefix, t / 1000, t % 1000); + seq_printf(s, "%s %s%d.%03d\n", prefix, (t < 0 ? "-" : ""), + abs(t / 1000), abs(t % 1000)); break; } } @@ -1081,7 +1082,7 @@ static void print_temp(struct seq_file *s, const char *prefix, u32 t) static int wil_temp_debugfs_show(struct seq_file *s, void *data) { struct wil6210_priv *wil = s->private; - u32 t_m, t_r; + s32 t_m, t_r; int rc = wmi_get_temperature(wil, &t_m, &t_r); if (rc) { From patchwork Thu Apr 2 19:17:39 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 228224 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=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, 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 03A46C2BA16 for ; Thu, 2 Apr 2020 19:17:13 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D0BE520737 for ; Thu, 2 Apr 2020 19:17:12 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="YVc7RzDH" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388995AbgDBTRM (ORCPT ); Thu, 2 Apr 2020 15:17:12 -0400 Received: from mail-wm1-f65.google.com ([209.85.128.65]:36800 "EHLO mail-wm1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388894AbgDBTRM (ORCPT ); Thu, 2 Apr 2020 15:17:12 -0400 Received: by mail-wm1-f65.google.com with SMTP id d202so4979648wmd.1 for ; Thu, 02 Apr 2020 12:17:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=7n6+1RB+Povmh3mXFIHzZpp6IxvkbnS6OC8yNx3V8CE=; b=YVc7RzDHgult9o8iVm3G8+4DFyBMMEHtZCJEc1VKwGEfWCa1E3V1TWhlvJrU3S9a8P zpAFWIEjOLv3AqdOqmUM8+rqv0itco1xNPlUu3Mek02uU6ieIIWCKGM64IL2bA/ncYRi 27UFhbdIYyoQ0GyuNnvV9O4Sp35oaA90S+t5a13x3y68NZ4x353CLf6YAWCsKs4KHbRa e7QoNbrulhKupOrId+BM+XKoLWUmaG37wIpXtVzpBZr1qqHco0MjJ6M8WbV1BSqcykgq r0D7oFPa4zGUnBvKFgnafpkyWPLr7c681hzaIiWDup/mLMX4M54kc0OtF31SLwY67mtP I+RQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=7n6+1RB+Povmh3mXFIHzZpp6IxvkbnS6OC8yNx3V8CE=; b=eQF2nMC7Ohca2X3s3HezcBOJdoKy03YAaCRJPpA73BUS2/ymnEPHnaL9xp2Xci8gxc dQJcgJjOEyPbE0Ye0L22yvdx5og1rH7VgHxSjTVrrSTLBq4w1JpWcoUYdBc/WW5VqBXj 5ovqbrgE0Ta+upiCM3vGAklsn5kK2OdOfgZsaN5k9Y/lM9WggqYldNL8nwjhXFQjSAZQ 1mx2m1rrZfVX4IvUyhqfGcf/Ltz++h45ZesZTGDr2r/AZ+3olLGUI8hxcU47MHRRJto6 MASN15aq/fmxXAnKDFVIq6bAVa4GPW8qb2r2Pd2rcUBGB0HAhluW28y+G5Y8jU1Rl/B9 EPzA== X-Gm-Message-State: AGi0PuYV5x03hcGFO1WdZ/gtlGEpHVL1AUMRMEJID/fcjGSvR5N5Y9h5 KZ00St1ACj7h3xF5G+gPWbGn5drOQretNQ== X-Google-Smtp-Source: APiQypKtvAIRekWV/b4ihfndixpchVPgSoAIFXI89etQobNf4xn005EKa06P9Am99m7GJP8BSHpj+A== X-Received: by 2002:a1c:e203:: with SMTP id z3mr4956595wmg.71.1585855030039; Thu, 02 Apr 2020 12:17:10 -0700 (PDT) Received: from localhost.localdomain ([95.149.164.95]) by smtp.gmail.com with ESMTPSA id y1sm879050wmd.14.2020.04.02.12.17.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Apr 2020 12:17:09 -0700 (PDT) From: Lee Jones To: stable@vger.kernel.org Subject: [PATCH 4.9 16/24] wil6210: rate limit wil_rx_refill error Date: Thu, 2 Apr 2020 20:17:39 +0100 Message-Id: <20200402191747.789097-16-lee.jones@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200402191747.789097-1-lee.jones@linaro.org> References: <20200402191747.789097-1-lee.jones@linaro.org> MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Dedy Lansky [ Upstream commit 3d6b72729cc2933906de8d2c602ae05e920b2122 ] wil_err inside wil_rx_refill can flood the log buffer. Replace it with wil_err_ratelimited. Signed-off-by: Dedy Lansky Signed-off-by: Maya Erez Signed-off-by: Kalle Valo Signed-off-by: Lee Jones --- drivers/net/wireless/ath/wil6210/txrx.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/ath/wil6210/txrx.c b/drivers/net/wireless/ath/wil6210/txrx.c index 4c38520d4dd2d..72e8fea05e5e1 100644 --- a/drivers/net/wireless/ath/wil6210/txrx.c +++ b/drivers/net/wireless/ath/wil6210/txrx.c @@ -546,8 +546,8 @@ static int wil_rx_refill(struct wil6210_priv *wil, int count) v->swtail = next_tail) { rc = wil_vring_alloc_skb(wil, v, v->swtail, headroom); if (unlikely(rc)) { - wil_err(wil, "Error %d in wil_rx_refill[%d]\n", - rc, v->swtail); + wil_err_ratelimited(wil, "Error %d in rx refill[%d]\n", + rc, v->swtail); break; } } From patchwork Thu Apr 2 19:17:40 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 228223 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=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, 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 87F54C2BA18 for ; Thu, 2 Apr 2020 19:17:13 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 60DAF206F8 for ; Thu, 2 Apr 2020 19:17:13 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="jFjnihIq" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388902AbgDBTRN (ORCPT ); Thu, 2 Apr 2020 15:17:13 -0400 Received: from mail-wm1-f67.google.com ([209.85.128.67]:37761 "EHLO mail-wm1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388921AbgDBTRM (ORCPT ); Thu, 2 Apr 2020 15:17:12 -0400 Received: by mail-wm1-f67.google.com with SMTP id j19so4952283wmi.2 for ; Thu, 02 Apr 2020 12:17:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=8Z20wcAGJt+rsOO0qFIXrokKyfVoYrM8wAvpmSP5OEA=; b=jFjnihIqkOTp7NEEDsK3bcVJKV31J4IIwIFLiYOMbK8xdvjsHFXdpDyd57EMzzPQVr C9iY2LfVjRf7/Af8ITbIZUrQoJlLTrLQ28c1hfLE+gZuS3zlZMuaEmYIRY1lL38cxeWv WqTw/YZCASt5Qr9xZeQq415QokcM06f+2BM3MEtJxUXcpl8gIqQHmTHeFlZNFR+57Qkq zJFtkVsrceA4xqfDSUgQCdEuC2oblVlehb0Aj+I4tYMjtxp60Sm55VGWzdNWZ9ZLAlqP PPnAWuNN1zRX0hgFICxSY+jnIrxL/X9k6+enz6gUYcnL8pwOGg8arZ/KQa4phZs+Fb3Y vA6Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=8Z20wcAGJt+rsOO0qFIXrokKyfVoYrM8wAvpmSP5OEA=; b=QJCGRoAF4MHPcpVBykji39Rm3OcSoxJgt0HvWXSfOheIM6xgIVT5zmYtlnNDsyOsCO R/SBLq8edLCL+WMWzBScPrOrEurFIRajQmrsn72QUiKmrIHKJvFH19khWSFojdTazC5o foQlfv4zBJM5cwDcm5Y9n2ADynh2A3gwtAGBDkrMhADV0TUsa47J0BcYbSoue1mz3clB BT52QocFJwbsgWdOwKH59zqkVi+GBOsFC1LgJsErZttzKo41y3VAflLa+r/kUugPbPLv vnw5pSTIMuCIW4AGT0aCQBZuLbvhVH/qgr9TywdfrWEX645e/QyqScVYtAXxgY+Rh4Yi ka4A== X-Gm-Message-State: AGi0PuZFT7eV+bUtNNYTVUxpu4ROJn6HdSUdrQjBjrIADA/y3T+AR3b+ 9oMrgr8w/cM0/pNiYFFIzDtgXSW4bBxsig== X-Google-Smtp-Source: APiQypKFWqn0/RGCnvFk2nkGihtA1fZ4oVsezYMjHZUvkU8+wLpyi9tKjd9jAECNE1oCAxHcUucI4g== X-Received: by 2002:a1c:6a14:: with SMTP id f20mr4597118wmc.125.1585855030890; Thu, 02 Apr 2020 12:17:10 -0700 (PDT) Received: from localhost.localdomain ([95.149.164.95]) by smtp.gmail.com with ESMTPSA id y1sm879050wmd.14.2020.04.02.12.17.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Apr 2020 12:17:10 -0700 (PDT) From: Lee Jones To: stable@vger.kernel.org Subject: [PATCH 4.9 17/24] rtc: pm8xxx: Fix issue in RTC write path Date: Thu, 2 Apr 2020 20:17:40 +0100 Message-Id: <20200402191747.789097-17-lee.jones@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200402191747.789097-1-lee.jones@linaro.org> References: <20200402191747.789097-1-lee.jones@linaro.org> MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Mohit Aggarwal [ Upstream commit 83220bf38b77a830f8e62ab1a0d0408304f9b966 ] In order to set time in rtc, need to disable rtc hw before writing into rtc registers. Also fixes disabling of alarm while setting rtc time. Signed-off-by: Mohit Aggarwal Signed-off-by: Alexandre Belloni Signed-off-by: Lee Jones --- drivers/rtc/rtc-pm8xxx.c | 49 +++++++++++++++++++++++++++++++--------- 1 file changed, 38 insertions(+), 11 deletions(-) diff --git a/drivers/rtc/rtc-pm8xxx.c b/drivers/rtc/rtc-pm8xxx.c index a1b4b0ed1f196..3b619b7b2c530 100644 --- a/drivers/rtc/rtc-pm8xxx.c +++ b/drivers/rtc/rtc-pm8xxx.c @@ -74,16 +74,18 @@ struct pm8xxx_rtc { /* * Steps to write the RTC registers. * 1. Disable alarm if enabled. - * 2. Write 0x00 to LSB. - * 3. Write Byte[1], Byte[2], Byte[3] then Byte[0]. - * 4. Enable alarm if disabled in step 1. + * 2. Disable rtc if enabled. + * 3. Write 0x00 to LSB. + * 4. Write Byte[1], Byte[2], Byte[3] then Byte[0]. + * 5. Enable rtc if disabled in step 2. + * 6. Enable alarm if disabled in step 1. */ static int pm8xxx_rtc_set_time(struct device *dev, struct rtc_time *tm) { int rc, i; unsigned long secs, irq_flags; - u8 value[NUM_8_BIT_RTC_REGS], alarm_enabled = 0; - unsigned int ctrl_reg; + u8 value[NUM_8_BIT_RTC_REGS], alarm_enabled = 0, rtc_disabled = 0; + unsigned int ctrl_reg, rtc_ctrl_reg; struct pm8xxx_rtc *rtc_dd = dev_get_drvdata(dev); const struct pm8xxx_rtc_regs *regs = rtc_dd->regs; @@ -92,23 +94,38 @@ static int pm8xxx_rtc_set_time(struct device *dev, struct rtc_time *tm) rtc_tm_to_time(tm, &secs); + dev_dbg(dev, "Seconds value to be written to RTC = %lu\n", secs); + for (i = 0; i < NUM_8_BIT_RTC_REGS; i++) { value[i] = secs & 0xFF; secs >>= 8; } - dev_dbg(dev, "Seconds value to be written to RTC = %lu\n", secs); - spin_lock_irqsave(&rtc_dd->ctrl_reg_lock, irq_flags); - rc = regmap_read(rtc_dd->regmap, regs->ctrl, &ctrl_reg); + rc = regmap_read(rtc_dd->regmap, regs->alarm_ctrl, &ctrl_reg); if (rc) goto rtc_rw_fail; if (ctrl_reg & regs->alarm_en) { alarm_enabled = 1; ctrl_reg &= ~regs->alarm_en; - rc = regmap_write(rtc_dd->regmap, regs->ctrl, ctrl_reg); + rc = regmap_write(rtc_dd->regmap, regs->alarm_ctrl, ctrl_reg); + if (rc) { + dev_err(dev, "Write to RTC Alarm control register failed\n"); + goto rtc_rw_fail; + } + } + + /* Disable RTC H/w before writing on RTC register */ + rc = regmap_read(rtc_dd->regmap, regs->ctrl, &rtc_ctrl_reg); + if (rc) + goto rtc_rw_fail; + + if (rtc_ctrl_reg & PM8xxx_RTC_ENABLE) { + rtc_disabled = 1; + rtc_ctrl_reg &= ~PM8xxx_RTC_ENABLE; + rc = regmap_write(rtc_dd->regmap, regs->ctrl, rtc_ctrl_reg); if (rc) { dev_err(dev, "Write to RTC control register failed\n"); goto rtc_rw_fail; @@ -137,11 +154,21 @@ static int pm8xxx_rtc_set_time(struct device *dev, struct rtc_time *tm) goto rtc_rw_fail; } + /* Enable RTC H/w after writing on RTC register */ + if (rtc_disabled) { + rtc_ctrl_reg |= PM8xxx_RTC_ENABLE; + rc = regmap_write(rtc_dd->regmap, regs->ctrl, rtc_ctrl_reg); + if (rc) { + dev_err(dev, "Write to RTC control register failed\n"); + goto rtc_rw_fail; + } + } + if (alarm_enabled) { ctrl_reg |= regs->alarm_en; - rc = regmap_write(rtc_dd->regmap, regs->ctrl, ctrl_reg); + rc = regmap_write(rtc_dd->regmap, regs->alarm_ctrl, ctrl_reg); if (rc) { - dev_err(dev, "Write to RTC control register failed\n"); + dev_err(dev, "Write to RTC Alarm control register failed\n"); goto rtc_rw_fail; } } From patchwork Thu Apr 2 19:17:41 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 228222 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=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, 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 31939C2BA12 for ; Thu, 2 Apr 2020 19:17:17 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 07E6520737 for ; Thu, 2 Apr 2020 19:17:17 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="YsgSmnBq" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388921AbgDBTRQ (ORCPT ); Thu, 2 Apr 2020 15:17:16 -0400 Received: from mail-wr1-f65.google.com ([209.85.221.65]:33602 "EHLO mail-wr1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389006AbgDBTRQ (ORCPT ); Thu, 2 Apr 2020 15:17:16 -0400 Received: by mail-wr1-f65.google.com with SMTP id a25so5654145wrd.0 for ; Thu, 02 Apr 2020 12:17:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=s6FBZN4nRWiUrKVfoyflfqov+eXkWkgr9+0BkVt9Xfw=; b=YsgSmnBqLLCxi/nTyjiE2C4dYnXY4JmecfKAUg7aQGQ+hxgr82mbLs+fbbLybgTPxb uVCvbcQvBhMiiLjTcHCr6kn1ENUK/6VYa0GqP1DYeyOQ6mJO7locAJ2wrd997OwiFn9C 9fFHzZt+WhW5Js2Cf+6k/KSE24ots3GljPaXSrNVMmLXi2caEcyXe78ws7l22ioAbWoA lEBSY/EqcTNt312JYb0rXnqCEEYTbZDDpToEqQksTTyU98IdhuZ1GL6+O4Kzk4Z+ntlQ 5yFIMB2ANNu9KB+X786nlpLt5D79KVn24dGKRalPbLrNac6yeu31jfQpV2cWLX7ctRl5 34nQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=s6FBZN4nRWiUrKVfoyflfqov+eXkWkgr9+0BkVt9Xfw=; b=tSkzBUN7tN0NyQsAKX1bjB/t8H0rdtNc6I+vNMfMxMH3vOM8Osc3Pf5sM+YG7S/j99 3Cv9CxvMnhO/N7+dexvg+J31i1FEw9gZDmcI1dk+TOsGTBYHSHdGKLiqJWYwZq1zaadJ KJ4Ugqy+PEAqcYzzOsi2y4fXylcd5bIdyt/3NNrzHmqM7xWxBNecuGbyaUf96fA3HK+T YVuh5jn4wFLvi2NDEJScOVlmzPiHWJzTgbLnurTfqXKMzkJ30HjDR3Q0cXnmOB9X2lZ1 9bjaUt6pbyafxOuUpd/oKzeGW4fZ/WjgWCiQd4m8dPxNp04N8YjBYTIV57MODL6skcoa N9Cg== X-Gm-Message-State: AGi0PuaHdODr/kbAtCLs6Lh0WjuT5uyDp2BUUjQ4s3Mpov5188QlIjSn Q7tHquN/wo5bLfB+Ji0OTm8wyRPWgiuvhg== X-Google-Smtp-Source: APiQypJgd75wT7eQO6kk3CykXOJOCT33FRlFAXWrO5amIQ8ZBeOjxvbpUTd6z1D+/sOB5xurUV9KeA== X-Received: by 2002:a5d:630b:: with SMTP id i11mr4732881wru.94.1585855032082; Thu, 02 Apr 2020 12:17:12 -0700 (PDT) Received: from localhost.localdomain ([95.149.164.95]) by smtp.gmail.com with ESMTPSA id y1sm879050wmd.14.2020.04.02.12.17.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Apr 2020 12:17:11 -0700 (PDT) From: Lee Jones To: stable@vger.kernel.org Subject: [PATCH 4.9 18/24] wil6210: fix length check in __wmi_send Date: Thu, 2 Apr 2020 20:17:41 +0100 Message-Id: <20200402191747.789097-18-lee.jones@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200402191747.789097-1-lee.jones@linaro.org> References: <20200402191747.789097-1-lee.jones@linaro.org> MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Lior David [ Upstream commit 26a6d5274865532502c682ff378ac8ebe2886238 ] The current length check: sizeof(cmd) + len > r->entry_size will allow very large values of len (> U16_MAX - sizeof(cmd)) and can cause a buffer overflow. Fix the check to cover this case. In addition, ensure the mailbox entry_size is not too small, since this can also bypass the above check. Signed-off-by: Lior David Signed-off-by: Maya Erez Signed-off-by: Kalle Valo Signed-off-by: Lee Jones --- drivers/net/wireless/ath/wil6210/interrupt.c | 22 +++++++++++++++++++- drivers/net/wireless/ath/wil6210/wmi.c | 2 +- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/ath/wil6210/interrupt.c b/drivers/net/wireless/ath/wil6210/interrupt.c index 64046e0bd0a22..a37533cffc7ca 100644 --- a/drivers/net/wireless/ath/wil6210/interrupt.c +++ b/drivers/net/wireless/ath/wil6210/interrupt.c @@ -356,6 +356,25 @@ static void wil_cache_mbox_regs(struct wil6210_priv *wil) wil_mbox_ring_le2cpus(&wil->mbox_ctl.tx); } +static bool wil_validate_mbox_regs(struct wil6210_priv *wil) +{ + size_t min_size = sizeof(struct wil6210_mbox_hdr) + + sizeof(struct wmi_cmd_hdr); + + if (wil->mbox_ctl.rx.entry_size < min_size) { + wil_err(wil, "rx mbox entry too small (%d)\n", + wil->mbox_ctl.rx.entry_size); + return false; + } + if (wil->mbox_ctl.tx.entry_size < min_size) { + wil_err(wil, "tx mbox entry too small (%d)\n", + wil->mbox_ctl.tx.entry_size); + return false; + } + + return true; +} + static irqreturn_t wil6210_irq_misc(int irq, void *cookie) { struct wil6210_priv *wil = cookie; @@ -391,7 +410,8 @@ static irqreturn_t wil6210_irq_misc(int irq, void *cookie) if (isr & ISR_MISC_FW_READY) { wil_dbg_irq(wil, "IRQ: FW ready\n"); wil_cache_mbox_regs(wil); - set_bit(wil_status_mbox_ready, wil->status); + if (wil_validate_mbox_regs(wil)) + set_bit(wil_status_mbox_ready, wil->status); /** * Actual FW ready indicated by the * WMI_FW_READY_EVENTID diff --git a/drivers/net/wireless/ath/wil6210/wmi.c b/drivers/net/wireless/ath/wil6210/wmi.c index 61419d1b45435..3f6ac1ca0e575 100644 --- a/drivers/net/wireless/ath/wil6210/wmi.c +++ b/drivers/net/wireless/ath/wil6210/wmi.c @@ -209,7 +209,7 @@ static int __wmi_send(struct wil6210_priv *wil, u16 cmdid, void *buf, u16 len) uint retry; int rc = 0; - if (sizeof(cmd) + len > r->entry_size) { + if (len > r->entry_size - sizeof(cmd)) { wil_err(wil, "WMI size too large: %d bytes, max is %d\n", (int)(sizeof(cmd) + len), r->entry_size); return -ERANGE; From patchwork Thu Apr 2 19:17:45 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 228221 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=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, 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 5ADC2C43331 for ; Thu, 2 Apr 2020 19:17:20 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 3259B206F8 for ; Thu, 2 Apr 2020 19:17:20 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="i8Eo3y72" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389053AbgDBTRT (ORCPT ); Thu, 2 Apr 2020 15:17:19 -0400 Received: from mail-wm1-f65.google.com ([209.85.128.65]:53466 "EHLO mail-wm1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389043AbgDBTRT (ORCPT ); Thu, 2 Apr 2020 15:17:19 -0400 Received: by mail-wm1-f65.google.com with SMTP id d77so4649478wmd.3 for ; Thu, 02 Apr 2020 12:17:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=fR75NvuHzXWg21/KSMcbyqxjqVfNasU7sbSgFf4Y3Rw=; b=i8Eo3y72Nb6T5m6OYWCDeUX7UAUNXWsCTUjfBwCFGo3TtQ1VFt85OQ63fiZhQXZwxS cqRi5V7cx699F5PSisCnQn6mYh7iwe+MgcZbA5vbEj/zaq2cNwsz0xDsICaloLRNwBxr 8txLbiWDUUJQEOkY2n6yEGuQ5gSuipDiPUg76Cr4V6jvzz39XdoERTr6pHhLFMaWD9fN QqX2D9Cwuerv56wr+4LEYLLFTyB0mLI0OUJ+gTNkUVUs0a+IyJHx7NNqvI2i19D+AP0/ LZPUULJLH1nt280acs8xV+Rc/fK/hMeUkch/N/pKko/1PF4xwT/llg+P0qTbVmp+CIeJ YyWg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=fR75NvuHzXWg21/KSMcbyqxjqVfNasU7sbSgFf4Y3Rw=; b=iw+fvZHw3A5hWMbEMhvtxG9Ls57ej8SAd+LOMJFYbg2WhSINcOqSZWFACGzvBkfW9m S4dSse0mKqbi+C6kyMh6ZaXTmTkpNDGXCnPdaFBTgPvotIUUKZY6YM8lP9P9z3MtMizT pcUgRGJomncMbBXJ2bQ00qgqP5F9D8wwudTR6Ym5pkCyEimUZ5fnTw2HhB36SHqtWHPt Jc+z7jLLLSu52Wc8N2X3OE/6QOMWfhypqZLJ3FUDw98veyLScQ5GpvMqKJ6Gxa+YCEGA em98Q8GjqJIO+CzkWLlQEKUctBTo01u3q25vOw93pB+aBChViUFFi+DXEcQRlH/l8MAd kMng== X-Gm-Message-State: AGi0PubC7y1cNfsV8xQUjQbm1tQdWJ15OC4RnFgQ2Ve6xJvNv8vICdTJ tzrOwHnVET6fhgG6uWoQ6OA2mcnbV5iVmw== X-Google-Smtp-Source: APiQypIv4P1IsrN+Gno7DmGmSxiWzkRMFrXkzpt9+zjHDGmlJ5/qJBpmN0BSBPv7NZzrc6iqE3XUdw== X-Received: by 2002:a7b:cb45:: with SMTP id v5mr4729003wmj.17.1585855037549; Thu, 02 Apr 2020 12:17:17 -0700 (PDT) Received: from localhost.localdomain ([95.149.164.95]) by smtp.gmail.com with ESMTPSA id y1sm879050wmd.14.2020.04.02.12.17.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Apr 2020 12:17:16 -0700 (PDT) From: Lee Jones To: stable@vger.kernel.org Subject: [PATCH 4.9 22/24] mm/vmalloc.c: move 'area->pages' after if statement Date: Thu, 2 Apr 2020 20:17:45 +0100 Message-Id: <20200402191747.789097-22-lee.jones@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200402191747.789097-1-lee.jones@linaro.org> References: <20200402191747.789097-1-lee.jones@linaro.org> MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Austin Kim [ Upstream commit 7ea362427c170061b8822dd41bafaa72b3bcb9ad ] If !area->pages statement is true where memory allocation fails, area is freed. In this case 'area->pages = pages' should not executed. So move 'area->pages = pages' after if statement. [akpm@linux-foundation.org: give area->pages the same treatment] Link: http://lkml.kernel.org/r/20190830035716.GA190684@LGEARND20B15 Signed-off-by: Austin Kim Acked-by: Michal Hocko Reviewed-by: Andrew Morton Cc: Uladzislau Rezki (Sony) Cc: Roman Gushchin Cc: Roman Penyaev Cc: Rick Edgecombe Cc: Mike Rapoport Cc: Andrey Ryabinin Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds Signed-off-by: Lee Jones --- mm/vmalloc.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/mm/vmalloc.c b/mm/vmalloc.c index dd66f1fb3fcf6..45e8d51d73233 100644 --- a/mm/vmalloc.c +++ b/mm/vmalloc.c @@ -1624,7 +1624,6 @@ static void *__vmalloc_area_node(struct vm_struct *area, gfp_t gfp_mask, nr_pages = get_vm_area_size(area) >> PAGE_SHIFT; array_size = (nr_pages * sizeof(struct page *)); - area->nr_pages = nr_pages; /* Please note that the recursion is strictly bounded. */ if (array_size > PAGE_SIZE) { pages = __vmalloc_node(array_size, 1, nested_gfp|__GFP_HIGHMEM, @@ -1632,13 +1631,16 @@ static void *__vmalloc_area_node(struct vm_struct *area, gfp_t gfp_mask, } else { pages = kmalloc_node(array_size, nested_gfp, node); } - area->pages = pages; - if (!area->pages) { + + if (!pages) { remove_vm_area(area->addr); kfree(area); return NULL; } + area->pages = pages; + area->nr_pages = nr_pages; + for (i = 0; i < area->nr_pages; i++) { struct page *page; From patchwork Thu Apr 2 19:17:46 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 228220 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=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, 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 C1BA4C43331 for ; Thu, 2 Apr 2020 19:17:23 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 92C6620737 for ; Thu, 2 Apr 2020 19:17:23 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="UOdamzfS" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389069AbgDBTRX (ORCPT ); Thu, 2 Apr 2020 15:17:23 -0400 Received: from mail-wr1-f65.google.com ([209.85.221.65]:38028 "EHLO mail-wr1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388452AbgDBTRX (ORCPT ); Thu, 2 Apr 2020 15:17:23 -0400 Received: by mail-wr1-f65.google.com with SMTP id c7so5587913wrx.5 for ; Thu, 02 Apr 2020 12:17:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=tivNM/PEWJwAHGJj+MV6vEaMnomGFhEGX1VywED1rVs=; b=UOdamzfSwkhpyTPC+9IvvOBkzPiVIpmr3X6LAJfJNCGon+oL2xCZur5kEsAiT64bTM j7KMD+I9ATH2k+0/+v2zjnr+X3QzNnZdDsW7f73xkI2A2Ud1qlUvmebGPEor02+CVVnw RCl+eauMiNL8RVZl7wPSql7C6HskUJ9aT3c4RqZNKLAKmNE/AK0rMNR9MmvCH/a/VRU2 TjuDOPfWq00hDGjvMM2PYFHqYAvHD1CnVhmFeHrlIdxIsNddAZPoqt/0CFxR6rBsNevZ pf1vY9OJaDk9Al68GkXB5fNubhIXFSeUbRuluRw9NuInCIW7BNdsJAfrCLgwnbVpKngL lP+Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=tivNM/PEWJwAHGJj+MV6vEaMnomGFhEGX1VywED1rVs=; b=hsoywLJ1nWmPQm2x1YXUWiPOoV16Ft6V6AeCQ+bWbU0Sjry7jW972qDSiuwsob6Bv8 euIF8RTlqRUfl9ZrKwqvGvSorhytXB4CVb2PAIm/S3wGUioHaYZZYBjN7GAEusx+Koye CiLmZrnGvEtUbBDsm6LgGrcMdVjxKfducANLz54c1voJiL8DZP22JOAvowtKxbZOC0iB aL7ojY9v1leHxiebYESLu8mTPiQKj4VBAzvAyDOFyAlnNwwSyZf0GfrDj/P+SGYFg9a6 uo+Z6dY96bx0IPptWsFANgKpxgjBv8BgPLOCJ1aV8M9Hxl5mn45q8a+kj0IBBMeex7VX m/gQ== X-Gm-Message-State: AGi0PuZoeWlDBRhuuykmWmCnI4Aq2TP8FP1eGdk5J8961HtmCsX+2dwZ kKV4NjVUQXaNAGSpcKgkifv0vN/5wPLVtQ== X-Google-Smtp-Source: APiQypJoImhX0wrzHjvMxFAHCxbM4QN+eXeDREW0GvdLbTqIXepYpTqUZFrVDb9bXkZ2gv2WatDlNw== X-Received: by 2002:adf:e288:: with SMTP id v8mr3552652wri.141.1585855038813; Thu, 02 Apr 2020 12:17:18 -0700 (PDT) Received: from localhost.localdomain ([95.149.164.95]) by smtp.gmail.com with ESMTPSA id y1sm879050wmd.14.2020.04.02.12.17.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Apr 2020 12:17:17 -0700 (PDT) From: Lee Jones To: stable@vger.kernel.org Subject: [PATCH 4.9 23/24] usb: dwc3: don't set gadget->is_otg flag Date: Thu, 2 Apr 2020 20:17:46 +0100 Message-Id: <20200402191747.789097-23-lee.jones@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200402191747.789097-1-lee.jones@linaro.org> References: <20200402191747.789097-1-lee.jones@linaro.org> MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Roger Quadros [ Upstream commit c09b73cfac2a9317f1104169045c519c6021aa1d ] This reverts commit 6a4290cc28be1 ("usb: dwc3: gadget: set the OTG flag in dwc3 gadget driver.") We don't yet support any of the OTG mechanisms (HNP/SRP/ADP) and are not setting gadget->otg_caps, so don't set gadget->is_otg flag. If we do then we end up publishing a OTG1.0 descriptor in the gadget descriptor which causes device enumeration to fail if we are connected to a host with CONFIG_USB_OTG enabled. Host side log without this patch [ 96.720453] usb 1-1: new high-speed USB device number 2 using xhci-hcd [ 96.901391] usb 1-1: Dual-Role OTG device on non-HNP port [ 96.907552] usb 1-1: set a_alt_hnp_support failed: -32 [ 97.060447] usb 1-1: new high-speed USB device number 3 using xhci-hcd [ 97.241378] usb 1-1: Dual-Role OTG device on non-HNP port [ 97.247536] usb 1-1: set a_alt_hnp_support failed: -32 [ 97.253606] usb usb1-port1: attempt power cycle [ 97.960449] usb 1-1: new high-speed USB device number 4 using xhci-hcd [ 98.141383] usb 1-1: Dual-Role OTG device on non-HNP port [ 98.147540] usb 1-1: set a_alt_hnp_support failed: -32 [ 98.300453] usb 1-1: new high-speed USB device number 5 using xhci-hcd [ 98.481391] usb 1-1: Dual-Role OTG device on non-HNP port [ 98.487545] usb 1-1: set a_alt_hnp_support failed: -32 [ 98.493532] usb usb1-port1: unable to enumerate USB device Signed-off-by: Roger Quadros Signed-off-by: Felipe Balbi Signed-off-by: Lee Jones --- drivers/usb/dwc3/gadget.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c index 712bd450f8573..bf36eda082d65 100644 --- a/drivers/usb/dwc3/gadget.c +++ b/drivers/usb/dwc3/gadget.c @@ -2996,7 +2996,6 @@ int dwc3_gadget_init(struct dwc3 *dwc) dwc->gadget.speed = USB_SPEED_UNKNOWN; dwc->gadget.sg_supported = true; dwc->gadget.name = "dwc3-gadget"; - dwc->gadget.is_otg = dwc->dr_mode == USB_DR_MODE_OTG; /* * FIXME We might be setting max_speed to