From patchwork Mon Oct 24 11:28:41 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8655 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp421676wru; Mon, 24 Oct 2022 05:21:01 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6hB3Ynr2nXmIpAM0ZpVKAHcQd8GaEXY9prsBp/2pzgO8ToF6+4KAIfvVnIFi8p2tBQ596D X-Received: by 2002:a17:907:8a09:b0:78d:b81e:f92f with SMTP id sc9-20020a1709078a0900b0078db81ef92fmr28530666ejc.620.1666614061049; Mon, 24 Oct 2022 05:21:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666614061; cv=none; d=google.com; s=arc-20160816; b=iL0zglf/U5YZO+KN1t7IhoNkfyiLkwcs4e++S81+ZfNAPPzrpbBQGQv+kugDyQRSzB hrseLB0rzrXRmw4AnPLgq0FjQUKyBVyu04RmYGlRmhPNFucP4/ok4NNyZJs5scTWUsR7 IqSg8wnTW3urcMveFuV9uybNDiKz+ZODrXnRT6S6PbYuHHk+fWhA/ByIDK94JMv50mOn Em+Fk/bbUcLInOHcDX1yrFn5Y9wY2xd1quBixIOfdYvJjvJ2I9Ibc7iyW+q/KM7h/HNv OZ721g5KhF6zsdojoXq497RObdKoeZlJ1f+q8+IhGPbZIivL2RTlfOyHZDCrlQXuei4R P0BA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=GW3I7QMCt5XNNKH9xzPrp3GgviC2C4CwERVvI3tdbdA=; b=cCqGRSPdxK38EBYWnoT0PaeSlqJJiRlvxFU+pPze20PRVGd8N6V7FPOg5V88DlkQeo gtK+uAu8tb6krlfOnehOXSWtVlt8MU6NTZqzQ9fd5jwrlv3NEN4/k5uiZ+Eyvuoz0jhZ P42tHMglqhyXp7h5wJFLk0YYHSOLlrzAZ+6C2mlUERcGav0BYB56WVPLxX/4wlJgl0fi jXESu69Qf5auQwXE8G6YVbImxjKRIDZPUSU7YepMG68JNh89s6qdj7WOBU64jx5yLuwe t3UT0gozM1HkKvrRw4xfvO226yEPb5sjh7o8pxrnilkBpWNzS22DE2gsPLcPJ5tmdTdo j27A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=MURE368Q; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i15-20020a0564020f0f00b00461c0cb486asi3068819eda.311.2022.10.24.05.20.35; Mon, 24 Oct 2022 05:21:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=MURE368Q; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232938AbiJXMQf (ORCPT + 99 others); Mon, 24 Oct 2022 08:16:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59854 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233313AbiJXMOs (ORCPT ); Mon, 24 Oct 2022 08:14:48 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 732147739A; Mon, 24 Oct 2022 04:55:35 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 918116126B; Mon, 24 Oct 2022 11:55:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A3571C433C1; Mon, 24 Oct 2022 11:55:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612513; bh=7a+WTDLovQeSm3K4+3q8ZCqpy2ODJ1EzuBZHDte6j3s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MURE368QAnM1DEWIYCfn/kr14lRU6c5Ee+u/90UutcbrBDbL/EOU24NMQI1Fl/stu SfvKYzho2VkFuYIKfQJ1xd+6Yuc92BeiT3nwg6TkGRDQuDVIq1qVuh3hQs8O5n3J9/ nCiwYNZGzxpRBB94quEeF3YPA7EzbIcvL6xXFGHk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Shuah Khan , Jonathan Corbet Subject: [PATCH 4.19 002/229] docs: update mediator information in CoC docs Date: Mon, 24 Oct 2022 13:28:41 +0200 Message-Id: <20221024112959.182109794@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747571505373295615?= X-GMAIL-MSGID: =?utf-8?q?1747571505373295615?= From: Shuah Khan commit 8bfdfa0d6b929ede7b6189e0e546ceb6a124d05d upstream. Update mediator information in the CoC interpretation document. Signed-off-by: Shuah Khan Link: https://lore.kernel.org/r/20220901212319.56644-1-skhan@linuxfoundation.org Cc: stable@vger.kernel.org Signed-off-by: Jonathan Corbet Signed-off-by: Greg Kroah-Hartman --- Documentation/process/code-of-conduct-interpretation.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/Documentation/process/code-of-conduct-interpretation.rst +++ b/Documentation/process/code-of-conduct-interpretation.rst @@ -51,7 +51,7 @@ the Technical Advisory Board (TAB) or ot uncertain how to handle situations that come up. It will not be considered a violation report unless you want it to be. If you are uncertain about approaching the TAB or any other maintainers, please -reach out to our conflict mediator, Mishi Choudhary . +reach out to our conflict mediator, Joanna Lee . In the end, "be kind to each other" is really what the end goal is for everybody. We know everyone is human and we all fail at times, but the From patchwork Mon Oct 24 11:28:42 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 10034 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp622498wru; Mon, 24 Oct 2022 12:45:38 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4X8cPudhhE0QgbRNycakvFgJmZacQylEd4NYFpNs0rTi0X1PlP2Gwk3kz9LyyQrUR6HpXc X-Received: by 2002:a17:907:3e0f:b0:791:9529:3674 with SMTP id hp15-20020a1709073e0f00b0079195293674mr28977759ejc.503.1666640737807; Mon, 24 Oct 2022 12:45:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666640737; cv=none; d=google.com; s=arc-20160816; b=EWIVzxh7rYiP98BRrK53jNYIIphuI48kQDbGBk5XDDIeucitdH8DfQXcjjBFt6VYKA a1IMEfdeQAc/pYFInrmEuoQUs6ZGI0ICpZrzOmpCNik6Uh6zI/kb/2fpav11JTqzONkY V1ic3o7jh4ivjmrMlLRy41P70+TygjE+W32f8aStBLPDwcmhPu2U5lnqGfL+NxMGlRmu TYhxrV0nSb72qXcBq4dI41YnuusQflvPGYAkE4lLHdV05AoEnw/qzqrHiJGE25GIiBk3 ePiTvK82/uQo2szCkimpcYA7CyL4JSltKqNyp+h1xemR2gyefrjfAdqsE7GB4Ua7eA6r 0I5A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=p/lcatgRWi+8tsmXslWyRyjXl8E6kTIOym4FOfEI2Bg=; b=SF1b15ySxA7NGD/Kg+xBGlKLYuk5sF6JeqLOZwNteJcm6O5CfS0vAZw+TpRarQpXqA kAnW9tIRgQ2OJQIbK5gVHXTeuvsRkK/eStMDy0BZN4AwzlIdqFSocQ6xhLKH09EIsomh PuoggQX3c1czfWMPZSaTEalrcbYcs1EXUrlWGHPU7dywQUpT6KFDgRZXkaitQAQJkQq0 W+28J/+8UeSJcJj4vCI2RYJKeakTtGoNznFSMh07EDTXBJm4YYPfBKcwiO2GOIKTRT+G nULylrHFNiIw/0v+vVl3K38YoFcIj4Q6HxEuVkhOJk3RQW5I7bL/3tfzMtCvQmSXeKx4 h0MA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=cbLxqiRy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k19-20020aa7c393000000b0045829a1c0b3si542495edq.251.2022.10.24.12.45.13; Mon, 24 Oct 2022 12:45:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=cbLxqiRy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230229AbiJXTmj (ORCPT + 99 others); Mon, 24 Oct 2022 15:42:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38256 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233460AbiJXTl3 (ORCPT ); Mon, 24 Oct 2022 15:41:29 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F1CF8263F15; Mon, 24 Oct 2022 11:11:24 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 1889DB811D8; Mon, 24 Oct 2022 11:55:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 45F5BC433C1; Mon, 24 Oct 2022 11:55:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612515; bh=ijZSo/cdeKszAc/rK+X/Vy4APaR0n/bBdD5341uT48Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cbLxqiRytFYmBfMT0SQFBhg0c52p8/tNcljVufLmg5LiJFNMAYpjSJvqJH5HeELSS FoHpNFhWB2pTo7Qn+hbV4Qrthd/fholl2W7hn9SC25MtaW4CGZC8kn8nWaSnlNDHwX sotujj+18nlNQeVd2sGt2XYyNIAJ98WDinRaAz50= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Masami Hiramatsu , Russell King , Sebastian Andrzej Siewior , Danilo Cezar Zanella Subject: [PATCH 4.19 003/229] ARM: fix function graph tracer and unwinder dependencies Date: Mon, 24 Oct 2022 13:28:42 +0200 Message-Id: <20221024112959.221989184@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747599478776610825?= X-GMAIL-MSGID: =?utf-8?q?1747599478776610825?= From: Russell King commit 503621628b32782a07b2318e4112bd4372aa3401 upstream. Naresh Kamboju recently reported that the function-graph tracer crashes on ARM. The function-graph tracer assumes that the kernel is built with frame pointers. We explicitly disabled the function-graph tracer when building Thumb2, since the Thumb2 ABI doesn't have frame pointers. We recently changed the way the unwinder method was selected, which seems to have made it more likely that we can end up with the function- graph tracer enabled but without the kernel built with frame pointers. Fix up the function graph tracer dependencies so the option is not available when we have no possibility of having frame pointers, and adjust the dependencies on the unwinder option to hide the non-frame pointer unwinder options if the function-graph tracer is enabled. Reviewed-by: Masami Hiramatsu Tested-by: Masami Hiramatsu Signed-off-by: Russell King Signed-off-by: Sebastian Andrzej Siewior Reported-by: Danilo Cezar Zanella Signed-off-by: Greg Kroah-Hartman --- arch/arm/Kconfig | 2 +- arch/arm/Kconfig.debug | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -68,7 +68,7 @@ config ARM select HAVE_EFFICIENT_UNALIGNED_ACCESS if (CPU_V6 || CPU_V6K || CPU_V7) && MMU select HAVE_EXIT_THREAD select HAVE_FTRACE_MCOUNT_RECORD if (!XIP_KERNEL) - select HAVE_FUNCTION_GRAPH_TRACER if (!THUMB2_KERNEL) + select HAVE_FUNCTION_GRAPH_TRACER if (!THUMB2_KERNEL && !CC_IS_CLANG) select HAVE_FUNCTION_TRACER if (!XIP_KERNEL) select HAVE_FUTEX_CMPXCHG if FUTEX select HAVE_GCC_PLUGINS --- a/arch/arm/Kconfig.debug +++ b/arch/arm/Kconfig.debug @@ -47,8 +47,8 @@ config DEBUG_WX choice prompt "Choose kernel unwinder" - default UNWINDER_ARM if AEABI && !FUNCTION_GRAPH_TRACER - default UNWINDER_FRAME_POINTER if !AEABI || FUNCTION_GRAPH_TRACER + default UNWINDER_ARM if AEABI + default UNWINDER_FRAME_POINTER if !AEABI help This determines which method will be used for unwinding kernel stack traces for panics, oopses, bugs, warnings, perf, /proc//stack, @@ -65,7 +65,7 @@ config UNWINDER_FRAME_POINTER config UNWINDER_ARM bool "ARM EABI stack unwinder" - depends on AEABI + depends on AEABI && !FUNCTION_GRAPH_TRACER select ARM_UNWIND help This option enables stack unwinding support in the kernel From patchwork Mon Oct 24 11:28:43 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8653 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp421617wru; Mon, 24 Oct 2022 05:20:54 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7L0mL4Tk8JzaOq1e8OzMKofyOd9we6ml3peiOzuSKW01E0yd7+r/0hXwSVzDOx+1GP/WMp X-Received: by 2002:a17:907:6d9b:b0:78d:f24b:e358 with SMTP id sb27-20020a1709076d9b00b0078df24be358mr27126333ejc.714.1666614054141; Mon, 24 Oct 2022 05:20:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666614054; cv=none; d=google.com; s=arc-20160816; b=XDNSi+Sz7ssoKuOXIktm5UYaTf61U7XV3Gok21Z/ZrxG07FqqNk21CLx0YfkKI9MYl +NdwOOiezzDKQuS3ViLKyLjCC+z8jfjXTYdcUHRpMgPWGf6U+RgYV8okDJZ/2e6c9ckn 7n+quaKPTDvZ+lD20oLGpyMVHZ7dhas2seXeWw49LeppL1heldqUcJXsSY+B9dpP7DrO i6L3aSvvd7amzUoQCVWc3Dr1WK602jI2A2ewrBPZ+uL1eZMpE17mN56B2NDgF7lStVn1 ue2q7zKtu4GoHWQxUO/+zJs1ujU3OtSuqYV7ovlGO7Bj6L/6utlAwMcWX7hzpQzhkzWd bNrg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=dBqRME20xtcxrraugAO1eimHq51Xs+0Q6Yxad/KNPck=; b=sSqtsmM+VY/wNgvyVper/5RxWAx8TKGlTDAHFRCXmC+QSW4K7ydq0494/MXs3bR1JV +Ro4IrDCtPSKrGQQ3xFQNyX92GYok0kIUEWDpdCPUhX29L76jrx19hHA9RH8OYVH6pWp dg2DBm71RyMESN8NmdxxGLQHqbbh6AKYk0T+tR0sSh/LsYs/EeEZxOqasd4nj4qnOhpi PRN7xENJ8/gQuBRlOoBQyERH6/smvCf5mHK8EU/uaYPpuzaWNVq+q3B0KFIc7K29O9yF uFAFVtBygu2BlAF/+r2TybMeXvYI/RJD7raroH70ZSdnKyNDpitaQA3+EkptmYuj3flo OK5Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=f3pP83Nd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s22-20020a056402037600b00461891a8138si5440521edw.446.2022.10.24.05.20.29; Mon, 24 Oct 2022 05:20:54 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=f3pP83Nd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233105AbiJXMQR (ORCPT + 99 others); Mon, 24 Oct 2022 08:16:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59530 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233293AbiJXMOo (ORCPT ); Mon, 24 Oct 2022 08:14:44 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E58F67822C; Mon, 24 Oct 2022 04:55:41 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id EA7E7612B9; Mon, 24 Oct 2022 11:55:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 083D2C433C1; Mon, 24 Oct 2022 11:55:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612518; bh=CKXWZAtQuVRe+X7bbPl5H9fJbh3N4z3sK9sltqAfEyI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=f3pP83NdUfPLytgmptuPk5oyyGX49Hh48YhjTgnwjQH/JL7EKZGdK5UsVPf1ycLnY jfzxdeyN0sw04zyT7QnKqyQxbITjyM0EnOSBCfgcZx/be3x3+PJLSq6kpjpyycUy2W UBT4gieFnMjr72dGSGFHUG8CAOHArnK7wT1vrqJo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, butt3rflyh4ck , Hao Sun , Jiacheng Xu , "Christian Brauner (Microsoft)" , Dongliang Mu , Al Viro Subject: [PATCH 4.19 004/229] fs: fix UAF/GPF bug in nilfs_mdt_destroy Date: Mon, 24 Oct 2022 13:28:43 +0200 Message-Id: <20221024112959.252205817@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747571498520083615?= X-GMAIL-MSGID: =?utf-8?q?1747571498520083615?= From: Dongliang Mu commit 2e488f13755ffbb60f307e991b27024716a33b29 upstream. In alloc_inode, inode_init_always() could return -ENOMEM if security_inode_alloc() fails, which causes inode->i_private uninitialized. Then nilfs_is_metadata_file_inode() returns true and nilfs_free_inode() wrongly calls nilfs_mdt_destroy(), which frees the uninitialized inode->i_private and leads to crashes(e.g., UAF/GPF). Fix this by moving security_inode_alloc just prior to this_cpu_inc(nr_inodes) Link: https://lkml.kernel.org/r/CAFcO6XOcf1Jj2SeGt=jJV59wmhESeSKpfR0omdFRq+J9nD1vfQ@mail.gmail.com Reported-by: butt3rflyh4ck Reported-by: Hao Sun Reported-by: Jiacheng Xu Reviewed-by: Christian Brauner (Microsoft) Signed-off-by: Dongliang Mu Cc: Al Viro Cc: stable@vger.kernel.org Signed-off-by: Al Viro Signed-off-by: Greg Kroah-Hartman --- fs/inode.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) --- a/fs/inode.c +++ b/fs/inode.c @@ -166,8 +166,6 @@ int inode_init_always(struct super_block inode->i_wb_frn_history = 0; #endif - if (security_inode_alloc(inode)) - goto out; spin_lock_init(&inode->i_lock); lockdep_set_class(&inode->i_lock, &sb->s_type->i_lock_key); @@ -195,11 +193,12 @@ int inode_init_always(struct super_block inode->i_fsnotify_mask = 0; #endif inode->i_flctx = NULL; + + if (unlikely(security_inode_alloc(inode))) + return -ENOMEM; this_cpu_inc(nr_inodes); return 0; -out: - return -ENOMEM; } EXPORT_SYMBOL(inode_init_always); From patchwork Mon Oct 24 11:28:44 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8654 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp421633wru; Mon, 24 Oct 2022 05:20:55 -0700 (PDT) X-Google-Smtp-Source: AMsMyM616mstxUfG5b43MEqatVoILiBHuQyUjXwzqpCbMVfi82k9S6YgFdTBBGmeVMaF7zueQFJI X-Received: by 2002:a17:907:802:b0:781:8017:b2df with SMTP id wv2-20020a170907080200b007818017b2dfmr27166265ejb.606.1666614055562; Mon, 24 Oct 2022 05:20:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666614055; cv=none; d=google.com; s=arc-20160816; b=SQkdI2K4ZxRVflWN6hnsxcTOmu7vU43A/U7KrGOzdMX3IheS2m+JLTxD+dQKKAXVFM ZhLmIxMTXNTkazsuLPZ2po5Fcwrpwejm6FwlD0d2xBB5FCa9mXAWtEro+Jm8RCRvLRfU ABX3R4gBntZqCZcN4JZ1dUqgcKIh2qRtX6KZpTFD4ngsh/8YPnMCNDkPj/PN7z/NKXnv S5K3aKGq2lI74vqWeGAx3GvMmFCmYNA8/Iu7FB18iz04dvU5QiYc5j6XaZbGNJw2EFsP m5DSqduLHeR1u5/oj33qvee2UmtrtRAOeuhilS9L7Bndz1kzaOWBIwr8UYiwF7/IdV/y VlAw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=b9O1oXn1b9817mgfg1io8cP8Nz6QiWg+ZuMvRFEMec0=; b=u9mD1/jY2kEALYqqANQ1IFh9msQdJJZ+pLQxK0Sdyg+M+f15Eyr/XSny9x+K77JpmS 9ql/c5wYoC0SO4AyPngdn41c/WuTI2GZupMvL/2AqF3xkfLc7WcLPuZOIwN1QjoxsZ9N NGmcLq6QV53/H57DN9fbSYu1GIjGfe1v51wgDB2dZmD4dBQ82hh3iyLeMaIZ5RhQXXIE VTxvzZW9voAcXmtaSCV/P2kijxHxoMwnlDa5PT5ZZl1ZnPwXM7W63NNKQ5ewVssgDJWJ WjQUZkkEx3UejyAJ0McXCR28k7Y/LRUZqNuu1Fe0pI5JJW4YlQ9XjBH6oS675ANP2Yjd oyUQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=RkIPHnW9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d11-20020a170906370b00b007818378f560si21262977ejc.383.2022.10.24.05.20.31; Mon, 24 Oct 2022 05:20:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=RkIPHnW9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233120AbiJXMQ0 (ORCPT + 99 others); Mon, 24 Oct 2022 08:16:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59542 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233297AbiJXMOp (ORCPT ); Mon, 24 Oct 2022 08:14:45 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C073978BC6; Mon, 24 Oct 2022 04:55:43 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 911A2612D5; Mon, 24 Oct 2022 11:55:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A409BC433D6; Mon, 24 Oct 2022 11:55:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612521; bh=clqMLo8si0W5e46evh3BggiIvOUCFs2EZmoLr7MDpF8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RkIPHnW9/izg0UGt7bJA7lEj6b1GCuEKqd8Z/x1L4whYVUm/TQ0e5978CCQiEb7ir W2m05JO/NrMamF0xnI32WcgmJQzu0bgEPq1gTrI6vhy1DKG1oS7MKWMW0B9wizDsgs edcFF/MoZ1EsLzvqcYgECzLzUr+mCIrBtLn2ARzc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Cristian Marussi , Sudeep Holla , Sasha Levin Subject: [PATCH 4.19 005/229] firmware: arm_scmi: Add SCMI PM driver remove routine Date: Mon, 24 Oct 2022 13:28:44 +0200 Message-Id: <20221024112959.290577200@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747571499873470045?= X-GMAIL-MSGID: =?utf-8?q?1747571499873470045?= From: Cristian Marussi [ Upstream commit dea796fcab0a219830831c070b8dc367d7e0f708 ] Currently, when removing the SCMI PM driver not all the resources registered with genpd subsystem are properly de-registered. As a side effect of this after a driver unload/load cycle you get a splat with a few warnings like this: | debugfs: Directory 'BIG_CPU0' with parent 'pm_genpd' already present! | debugfs: Directory 'BIG_CPU1' with parent 'pm_genpd' already present! | debugfs: Directory 'LITTLE_CPU0' with parent 'pm_genpd' already present! | debugfs: Directory 'LITTLE_CPU1' with parent 'pm_genpd' already present! | debugfs: Directory 'LITTLE_CPU2' with parent 'pm_genpd' already present! | debugfs: Directory 'LITTLE_CPU3' with parent 'pm_genpd' already present! | debugfs: Directory 'BIG_SSTOP' with parent 'pm_genpd' already present! | debugfs: Directory 'LITTLE_SSTOP' with parent 'pm_genpd' already present! | debugfs: Directory 'DBGSYS' with parent 'pm_genpd' already present! | debugfs: Directory 'GPUTOP' with parent 'pm_genpd' already present! Add a proper scmi_pm_domain_remove callback to the driver in order to take care of all the needed cleanups not handled by devres framework. Link: https://lore.kernel.org/r/20220817172731.1185305-7-cristian.marussi@arm.com Signed-off-by: Cristian Marussi Signed-off-by: Sudeep Holla Signed-off-by: Sasha Levin --- drivers/firmware/arm_scmi/scmi_pm_domain.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/drivers/firmware/arm_scmi/scmi_pm_domain.c b/drivers/firmware/arm_scmi/scmi_pm_domain.c index 177874adccf0..b0c8962b9885 100644 --- a/drivers/firmware/arm_scmi/scmi_pm_domain.c +++ b/drivers/firmware/arm_scmi/scmi_pm_domain.c @@ -106,9 +106,28 @@ static int scmi_pm_domain_probe(struct scmi_device *sdev) scmi_pd_data->domains = domains; scmi_pd_data->num_domains = num_domains; + dev_set_drvdata(dev, scmi_pd_data); + return of_genpd_add_provider_onecell(np, scmi_pd_data); } +static void scmi_pm_domain_remove(struct scmi_device *sdev) +{ + int i; + struct genpd_onecell_data *scmi_pd_data; + struct device *dev = &sdev->dev; + struct device_node *np = dev->of_node; + + of_genpd_del_provider(np); + + scmi_pd_data = dev_get_drvdata(dev); + for (i = 0; i < scmi_pd_data->num_domains; i++) { + if (!scmi_pd_data->domains[i]) + continue; + pm_genpd_remove(scmi_pd_data->domains[i]); + } +} + static const struct scmi_device_id scmi_id_table[] = { { SCMI_PROTOCOL_POWER }, { }, @@ -118,6 +137,7 @@ MODULE_DEVICE_TABLE(scmi, scmi_id_table); static struct scmi_driver scmi_power_domain_driver = { .name = "scmi-power-domain", .probe = scmi_pm_domain_probe, + .remove = scmi_pm_domain_remove, .id_table = scmi_id_table, }; module_scmi_driver(scmi_power_domain_driver); From patchwork Mon Oct 24 11:28:45 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8726 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp423591wru; Mon, 24 Oct 2022 05:25:22 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4no67eEmko8UvVUJAiZZLUwqzy0q6lRW10HAcT6TWOWTwLy1i5Z4jnbA+BFCxyxQ+/lvNy X-Received: by 2002:a17:90b:3505:b0:20d:ba2e:994b with SMTP id ls5-20020a17090b350500b0020dba2e994bmr62084095pjb.46.1666614311827; Mon, 24 Oct 2022 05:25:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666614311; cv=none; d=google.com; s=arc-20160816; b=cepjSSCC+LAM/k2EMIdowfhwE+x8Rh1GDLlqKJ+KSWtm29r/bThbI8B/aojfp4Ckdm H6EQs/GZQ1BI+osqgqR5pbXuzO+V3G7VN/py23M8l7O9Le4f3dA46NwBo4VgNQt1NGYM BD9QkZ9fzndHXJ09rtOgKj2IeGffTN6sOjd/z6Pb0yyNBX41s33ZVPAVEEIZPxf8P94h g3y+oC9k/mlPbe8HrXQnFnvcq987zJEocs1s1yf9qgj+Reu1THXwtPIf/jLV0Yif6aey zfOhILog3v6LTVPohz4sdji/IWajaYo3UHkXjOS2ogBhjrw2FqtrzIbgvWBqLoRxk1er OkCQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=a8G+K6J6Pe4e9UxGxrjb80rjiggFOam/UjK+65teEhU=; b=mNEpqAfN8BXs48GXDUYqc5vjnUQvw0sQbXlYijBRj3eptY6PpDzX0lBvIzNzvTOwTU xjPKY2NnzcUyqcV8ZKQLhNSD5+zefNg5HK8FMkyg2Oi5oKexN9dWk3bsLwLLA5bJdhJG DVhoaNcIKw0e2DKiaXdHG8NIkGAcVWDzOvtYmS2nq0BUCkEdgZhRh5SAvryxpGaoeKQw QOa3ksMGJjY4UXp4FtgvsbYehNYp1/VBuYVYbi/oAgkYTZzFTO8HNv0eLE9MzsqhCpoV RdkyiCAYgvjJG48GT3K+3zP+4ouAmmyDMekxqL4iXhN7ZUktaxikfS2XXriu2ujldrCf IrbA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ZF3IV2JH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u65-20020a637944000000b0045d1aa2a586si34888168pgc.197.2022.10.24.05.24.59; Mon, 24 Oct 2022 05:25:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ZF3IV2JH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233687AbiJXMYF (ORCPT + 99 others); Mon, 24 Oct 2022 08:24:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41624 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233348AbiJXMWz (ORCPT ); Mon, 24 Oct 2022 08:22:55 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 25E0D10FDE; Mon, 24 Oct 2022 04:59:27 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id E5B8AB811DC; Mon, 24 Oct 2022 11:55:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 45DC7C43470; Mon, 24 Oct 2022 11:55:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612523; bh=u5TzAJ+V988KQo6k184h+K2UMiphbxZiON4R8VGPRfA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZF3IV2JH+nb6ystb4CD34pp2PB80VPUiM5iTobiYtdtRW11tUN+sQLx88hqNMxm7I vo1X5JQnwE1x337/4aO2qo2narZ6uO5OiL8wuKde3gz7hh5SBnd88E1w90Tmu5CpIk EYJLkJhfKx24cs2Kek3a7D7w9WrkpbWdjTLZ5Hgo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Swati Agarwal , Vinod Koul , Sasha Levin Subject: [PATCH 4.19 006/229] dmaengine: xilinx_dma: cleanup for fetching xlnx,num-fstores property Date: Mon, 24 Oct 2022 13:28:45 +0200 Message-Id: <20221024112959.321028491@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747571768704346578?= X-GMAIL-MSGID: =?utf-8?q?1747571768704346578?= From: Swati Agarwal [ Upstream commit 462bce790e6a7e68620a4ce260cc38f7ed0255d5 ] Free the allocated resources for missing xlnx,num-fstores property. Signed-off-by: Swati Agarwal Link: https://lore.kernel.org/r/20220817061125.4720-3-swati.agarwal@xilinx.com Signed-off-by: Vinod Koul Signed-off-by: Sasha Levin --- drivers/dma/xilinx/xilinx_dma.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/dma/xilinx/xilinx_dma.c b/drivers/dma/xilinx/xilinx_dma.c index 3f38df6b51f2..f72803587b8f 100644 --- a/drivers/dma/xilinx/xilinx_dma.c +++ b/drivers/dma/xilinx/xilinx_dma.c @@ -2654,7 +2654,7 @@ static int xilinx_dma_probe(struct platform_device *pdev) if (err < 0) { dev_err(xdev->dev, "missing xlnx,num-fstores property\n"); - return err; + goto disable_clks; } err = of_property_read_u32(node, "xlnx,flush-fsync", From patchwork Mon Oct 24 11:28:46 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8680 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp422312wru; Mon, 24 Oct 2022 05:22:21 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5uxXkaZfxa2iQcTyMMACUbdrTHkWulwpGLgsS4x78t1B6fglizmmK77vs4DAbfDdFy1oCC X-Received: by 2002:a17:906:4a09:b0:78d:b6bb:ff5f with SMTP id w9-20020a1709064a0900b0078db6bbff5fmr26277691eju.538.1666614141113; Mon, 24 Oct 2022 05:22:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666614141; cv=none; d=google.com; s=arc-20160816; b=OhjxrgL1w5lGGQf/1v9JPrKu/exfsq4Ylv1VwJabff8kIawSCXZgRqxUrWtVy7kSyP RS567cd0+wUfor5MfBt6JAsKDGJWobHcz0AVT5Sl/VAC07pDzNowr/umt7p0bTVldh80 mJ0slsA3qB6FpfnhHcDANEzhLhTJDM0raCckEzTIvFl11VxuBiwFT6niyjO6BstdZv8f t1r/BEtgMEv0NQAaTrjafvA9faRQS325zPTnO2Nk61pBdq13Jam2kpw58bEJNSg0pNKE g4lr3K6hL/JlggBQhpy5G3+khCUyApO5NfoXL+OqRmO0wqkCelCIAqDTxK9fuRszuO4X qXaA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=w955c8chhQa/V1yjdvlmKNDAdSC0STi9VH34C9q484Y=; b=pVLbXL1EjlR9HfUHvKhgd25fEzdHVYKDhL9cBfLvHqJp02dB0M6dEgg15pPFnEiFOS /GLKRs7khiccPF/forEswf9J721ZVfIlvubz/K1OBXjkgNTwi047LZqNKL0JbvKA6mJ2 blGAqjaJZxH05d8Z4XtLIw33QuWtUpuBQFLcS8FauXdMsbL7OR6cgDS8pApincwax1jq Xu42rMhGMKutX8f45YvXYil0aBWCwbv81u9e0xkHKMS7uI+ZKjJd79d5Mby8le/hlVbb THBGKy+QVom4Zbaxk2OCGv0kChsCNnjJvmK+fiA5lhUigh7Dqqyn5M9jLX1uJqgYAtqf Z/9g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="INOL/Vcp"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y10-20020a056402270a00b0045dc9b4c034si21351519edd.582.2022.10.24.05.21.57; Mon, 24 Oct 2022 05:22:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="INOL/Vcp"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233231AbiJXMUS (ORCPT + 99 others); Mon, 24 Oct 2022 08:20:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36980 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233273AbiJXMTF (ORCPT ); Mon, 24 Oct 2022 08:19:05 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4A02982842; Mon, 24 Oct 2022 04:57:33 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id D5016612DB; Mon, 24 Oct 2022 11:55:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E5B79C433C1; Mon, 24 Oct 2022 11:55:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612526; bh=fSVz+OkgMcoaGQ/swcxjK7pSryFkqY9VNBJa73jPodY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=INOL/VcpuRPIlhpUFoO9DlAcdvD3sTWUWtWzDMqJUlP1znwD2/CMbC2ps9C9/J9iE x7GF7rVemaCxYTgcn/KMMQXNVMHkrd5Fc80/BaCLkrQKxLd1kPU5iO3njBa1p7oEsw 4RFyEkeJ31+2LqvbYtRWQaRCUmOyckVfTABiSOng= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Swati Agarwal , Radhey Shyam Pandey , Vinod Koul , Sasha Levin Subject: [PATCH 4.19 007/229] dmaengine: xilinx_dma: Report error in case of dma_set_mask_and_coherent API failure Date: Mon, 24 Oct 2022 13:28:46 +0200 Message-Id: <20221024112959.355783611@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747571589794453818?= X-GMAIL-MSGID: =?utf-8?q?1747571589794453818?= From: Swati Agarwal [ Upstream commit 8f2b6bc79c32f0fa60df000ae387a790ec80eae9 ] The driver does not handle the failure case while calling dma_set_mask_and_coherent API. In case of failure, capture the return value of API and then report an error. Addresses-coverity: Unchecked return value (CHECKED_RETURN) Signed-off-by: Swati Agarwal Reviewed-by: Radhey Shyam Pandey Link: https://lore.kernel.org/r/20220817061125.4720-4-swati.agarwal@xilinx.com Signed-off-by: Vinod Koul Signed-off-by: Sasha Levin --- drivers/dma/xilinx/xilinx_dma.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/dma/xilinx/xilinx_dma.c b/drivers/dma/xilinx/xilinx_dma.c index f72803587b8f..0ba70be4ea85 100644 --- a/drivers/dma/xilinx/xilinx_dma.c +++ b/drivers/dma/xilinx/xilinx_dma.c @@ -2674,7 +2674,11 @@ static int xilinx_dma_probe(struct platform_device *pdev) xdev->ext_addr = false; /* Set the dma mask bits */ - dma_set_mask_and_coherent(xdev->dev, DMA_BIT_MASK(addr_width)); + err = dma_set_mask_and_coherent(xdev->dev, DMA_BIT_MASK(addr_width)); + if (err < 0) { + dev_err(xdev->dev, "DMA mask error %d\n", err); + goto disable_clks; + } /* Initialize the DMA engine */ xdev->common.dev = &pdev->dev; From patchwork Mon Oct 24 11:28:47 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8690 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp422556wru; Mon, 24 Oct 2022 05:22:55 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6z8KBay+HORr4pNS6ZVt0m83hGqCWj5p6x8adeN4a2SBEF8vKbprZnCMK49hOC5cFWGMTY X-Received: by 2002:a17:907:a077:b0:7ab:be2:b3ff with SMTP id ia23-20020a170907a07700b007ab0be2b3ffmr469741ejc.704.1666614175165; Mon, 24 Oct 2022 05:22:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666614175; cv=none; d=google.com; s=arc-20160816; b=hCeGpi1fn0Ts5eg4ptJQUV4TPuio0AwWeOjccIAKRA5njVpvYOcG2JwhEn1/M/Z665 SWov8gs4Ci+0Kz6OyvwggPxpOkgiGGLJ9DN7jsDbPA0MHdfPMaqjdDMilzSjeuXUtRXM PXRPW5tPSFpLYFV7qns+kjYuud0uJkf/2FDTASpfVZl8CiS9YcGKGIiz/qKCyfgXFbzE 2wAL1lF06V4y9BXIuINJhdUS6fhAoB/TzpnXfxBw2AaOXEvbtOZiXxlLA+IUHUBxM8Rl t/yVA/UO157H2X4DuJ/bhQa7E6LiqWj37+E0fiVjXMVGhyyqMWxb8MwB3z/byNkP9x67 Zs/Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=RAYN8+oZmpVhDqq+MDPqGhdHYQGe7GpH1LSpCKg/oGg=; b=JUKXeYGA9FxeL0vvTnS3bNU/q3f91Wib0KECf0WgSddeUdgqvSBvSqjlf/S5eft7ES AlPN3I+v7dw8HxM1fU5/z8diUcX2RrqF2rFFZRXiJwU2VMN4wOBBpKbTxu7QLr7MeMEJ iVBGaGGC7DerTjOq7oRc1uRWpQOAUMcyDvhQgxbAv/KoWQrWb/ErznFQUvL5nCX/nImu 7XIJfHwvgmD4G9eD9hYE0exx0mP+SGSTFlhOjpIndAZiIY+i6GHfp6qHsgbOg/LG9pHX n7tn+6IWPfrXk4Xp97w2IxNd4uLZRKyOBRdoexYd2BbO45IaSU6ECyWvvDDF5+l6Qo0a wAnw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=aOFMJQDH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hq15-20020a1709073f0f00b0078dcd8dfac5si27744309ejc.467.2022.10.24.05.22.30; Mon, 24 Oct 2022 05:22:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=aOFMJQDH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233288AbiJXMUe (ORCPT + 99 others); Mon, 24 Oct 2022 08:20:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51026 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233308AbiJXMTJ (ORCPT ); Mon, 24 Oct 2022 08:19:09 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D0F288285D; Mon, 24 Oct 2022 04:57:39 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 6F593612B2; Mon, 24 Oct 2022 11:55:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8209CC433D7; Mon, 24 Oct 2022 11:55:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612528; bh=baATQorB7E7tji15g54jQol3I3flzO4pwiVl9pgM6Bk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=aOFMJQDH7NE589CQuVTvNkQNSIq4zPzviMr7VY1KNV+LYCISOiDEIGKN3KSHNr44u kxJvaYwvLJl2h/qX8P3oRXMGk2C5seycSloMuroz08VVvjJlNI2UVfXiMEsUWxpqmY EhBbxa3JtKokM81FLjhS8cZ8RAEJBd/4eUpOlzB4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Arnd Bergmann , Sergei Antonov , Jonas Jensen , Sasha Levin Subject: [PATCH 4.19 008/229] ARM: dts: fix Moxa SDIO compatible, remove sdhci misnomer Date: Mon, 24 Oct 2022 13:28:47 +0200 Message-Id: <20221024112959.385972274@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747571625229776817?= X-GMAIL-MSGID: =?utf-8?q?1747571625229776817?= From: Sergei Antonov [ Upstream commit 02181e68275d28cab3c3f755852770367f1bc229 ] Driver moxart-mmc.c has .compatible = "moxa,moxart-mmc". But moxart .dts/.dtsi and the documentation file moxa,moxart-dma.txt contain compatible = "moxa,moxart-sdhci". Change moxart .dts/.dtsi files and moxa,moxart-dma.txt to match the driver. Replace 'sdhci' with 'mmc' in names too, since SDHCI is a different controller from FTSDC010. Suggested-by: Arnd Bergmann Signed-off-by: Sergei Antonov Cc: Jonas Jensen Link: https://lore.kernel.org/r/20220907175341.1477383-1-saproj@gmail.com' Signed-off-by: Arnd Bergmann Signed-off-by: Sasha Levin --- Documentation/devicetree/bindings/dma/moxa,moxart-dma.txt | 4 ++-- arch/arm/boot/dts/moxart-uc7112lx.dts | 2 +- arch/arm/boot/dts/moxart.dtsi | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Documentation/devicetree/bindings/dma/moxa,moxart-dma.txt b/Documentation/devicetree/bindings/dma/moxa,moxart-dma.txt index 8a9f3559335b..7e14e26676ec 100644 --- a/Documentation/devicetree/bindings/dma/moxa,moxart-dma.txt +++ b/Documentation/devicetree/bindings/dma/moxa,moxart-dma.txt @@ -34,8 +34,8 @@ Example: Use specific request line passing from dma For example, MMC request line is 5 - sdhci: sdhci@98e00000 { - compatible = "moxa,moxart-sdhci"; + mmc: mmc@98e00000 { + compatible = "moxa,moxart-mmc"; reg = <0x98e00000 0x5C>; interrupts = <5 0>; clocks = <&clk_apb>; diff --git a/arch/arm/boot/dts/moxart-uc7112lx.dts b/arch/arm/boot/dts/moxart-uc7112lx.dts index 4a962a26482d..59d8775a3a93 100644 --- a/arch/arm/boot/dts/moxart-uc7112lx.dts +++ b/arch/arm/boot/dts/moxart-uc7112lx.dts @@ -80,7 +80,7 @@ &clk_pll { clocks = <&ref12>; }; -&sdhci { +&mmc { status = "okay"; }; diff --git a/arch/arm/boot/dts/moxart.dtsi b/arch/arm/boot/dts/moxart.dtsi index da7b3237bfe9..804a2bc6ec82 100644 --- a/arch/arm/boot/dts/moxart.dtsi +++ b/arch/arm/boot/dts/moxart.dtsi @@ -93,8 +93,8 @@ watchdog: watchdog@98500000 { clock-names = "PCLK"; }; - sdhci: sdhci@98e00000 { - compatible = "moxa,moxart-sdhci"; + mmc: mmc@98e00000 { + compatible = "moxa,moxart-mmc"; reg = <0x98e00000 0x5C>; interrupts = <5 IRQ_TYPE_LEVEL_HIGH>; clocks = <&clk_apb>; From patchwork Mon Oct 24 11:28:48 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8657 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp421693wru; Mon, 24 Oct 2022 05:21:02 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5BfmweI+yhfyn1Yox83/IAsTxzdQEvkEp3YmlzKOUEwAlyADGwlgtX0ycHxWkx1OmgGB8S X-Received: by 2002:a05:6402:33c5:b0:447:e4a3:c930 with SMTP id a5-20020a05640233c500b00447e4a3c930mr30297976edc.401.1666614062754; Mon, 24 Oct 2022 05:21:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666614062; cv=none; d=google.com; s=arc-20160816; b=MkTHz1F1iOAJl8LcC0+Ltxr/W/4Ll3FJH+rowFs1DxxTwrwN6E6ti+EFYGaWXfjk0h kevAZ2zHSBYny5Hx2fqsYqIhu3P1wtQU3hoKRO5J8PyXwgU31y3DC78iV7AQDvHb8OIu niESSLAGzLR2eO8kv13vDJrIfswDv6WvwujRrZI729Id2bLpk/zHBkekmrjklQHu9pK0 UrKS7d4lpLZw3jJwqPiHQjtrtDperbHXNHqgHy4VXXJTt/LPhCL/0h1aNs3BfdbJc0hP ux3cqnEMUBLGugJwZN4+qU+RmsUG3Kj+n243bjw2+sjzPP9VUFrxu0rfe6pAUHSXpriN aV3Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=kaIg8SAxiwHzzibYdkQ2qxRAPV7KueIgKgANmhOD2ZY=; b=QvlC0GpRLGicOnHQfY0fYKqWsn9tQy0ouXBsajg/+wDRhCjK0ENNfLLzCTC9rXZcAB uRXpQKf/A1pEvKkqaHhov307fMp6jzis7or4xSZwInXzULZoHUc2+W8KUy8mEjKReoFS 50/6sIabY/dZhe581KHcMCXNg17kKomnOBtQga9XILvQiTRJGeGXmnKVb+YIhSuAKa3Q EhonxrjSp9G2vYssKTYIB67x6s9uOOdqvzNrRqhEuq8zk0HK84cnv908/5R5OOPsuf4b pD9V4wYq6ZNPdpYbaTFyZtK0aMzJjnxq4oRoTL7LlLpcfo9PENyHF5mmawf2BEz8lYeK LW9g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=nZxNdhhX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f17-20020a0564021e9100b00456e33b69e1si35181618edf.347.2022.10.24.05.20.37; Mon, 24 Oct 2022 05:21:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=nZxNdhhX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233150AbiJXMQr (ORCPT + 99 others); Mon, 24 Oct 2022 08:16:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50576 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233385AbiJXMO7 (ORCPT ); Mon, 24 Oct 2022 08:14:59 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 089993055D; Mon, 24 Oct 2022 04:55:46 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 1EC52612E9; Mon, 24 Oct 2022 11:55:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2EE60C433D7; Mon, 24 Oct 2022 11:55:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612531; bh=ruyn6ny/iz6Zqxp+/ivNz+r7BDWMhMcf5ChJDxysrYo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nZxNdhhXWGFuuj00OvT3WfcMRFq7sFDEHyGujjQTb/Q4YYJVSR/AxlRo7vr806CZZ tDHjRccWHaFlchA2LpEZEJ1YhPYh/hGdSMjp8wED89ZIobRk3ts1NAFmu5g/cnLpTa VRSAjZQtECdaIPT6/f7a2+xbAvdf0Ne6khD1CnAY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zheyu Ma , Saurav Kashyap , Wende Tan , Letu Ren , "Martin K. Petersen" , Sasha Levin Subject: [PATCH 4.19 009/229] scsi: qedf: Fix a UAF bug in __qedf_probe() Date: Mon, 24 Oct 2022 13:28:48 +0200 Message-Id: <20221024112959.416076778@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747571507619692609?= X-GMAIL-MSGID: =?utf-8?q?1747571507619692609?= From: Letu Ren [ Upstream commit fbfe96869b782364caebae0445763969ddb6ea67 ] In __qedf_probe(), if qedf->cdev is NULL which means qed_ops->common->probe() failed, then the program will goto label err1, and scsi_host_put() will free lport->host pointer. Because the memory qedf points to is allocated by libfc_host_alloc(), it will be freed by scsi_host_put(). However, the if statement below label err0 only checks whether qedf is NULL but doesn't check whether the memory has been freed. So a UAF bug can occur. There are two ways to reach the statements below err0. The first one is described as before, "qedf" should be set to NULL. The second one is goto "err0" directly. In the latter scenario qedf hasn't been changed and it has the initial value NULL. As a result the if statement is not reachable in any situation. The KASAN logs are as follows: [ 2.312969] BUG: KASAN: use-after-free in __qedf_probe+0x5dcf/0x6bc0 [ 2.312969] [ 2.312969] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS rel-1.12.0-59-gc9ba5276e321-prebuilt.qemu.org 04/01/2014 [ 2.312969] Call Trace: [ 2.312969] dump_stack_lvl+0x59/0x7b [ 2.312969] print_address_description+0x7c/0x3b0 [ 2.312969] ? __qedf_probe+0x5dcf/0x6bc0 [ 2.312969] __kasan_report+0x160/0x1c0 [ 2.312969] ? __qedf_probe+0x5dcf/0x6bc0 [ 2.312969] kasan_report+0x4b/0x70 [ 2.312969] ? kobject_put+0x25d/0x290 [ 2.312969] kasan_check_range+0x2ca/0x310 [ 2.312969] __qedf_probe+0x5dcf/0x6bc0 [ 2.312969] ? selinux_kernfs_init_security+0xdc/0x5f0 [ 2.312969] ? trace_rpm_return_int_rcuidle+0x18/0x120 [ 2.312969] ? rpm_resume+0xa5c/0x16e0 [ 2.312969] ? qedf_get_generic_tlv_data+0x160/0x160 [ 2.312969] local_pci_probe+0x13c/0x1f0 [ 2.312969] pci_device_probe+0x37e/0x6c0 Link: https://lore.kernel.org/r/20211112120641.16073-1-fantasquex@gmail.com Reported-by: Zheyu Ma Acked-by: Saurav Kashyap Co-developed-by: Wende Tan Signed-off-by: Wende Tan Signed-off-by: Letu Ren Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin --- drivers/scsi/qedf/qedf_main.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/drivers/scsi/qedf/qedf_main.c b/drivers/scsi/qedf/qedf_main.c index b253523217b8..01e27285b26b 100644 --- a/drivers/scsi/qedf/qedf_main.c +++ b/drivers/scsi/qedf/qedf_main.c @@ -3345,11 +3345,6 @@ static int __qedf_probe(struct pci_dev *pdev, int mode) err1: scsi_host_put(lport->host); err0: - if (qedf) { - QEDF_INFO(&qedf->dbg_ctx, QEDF_LOG_DISC, "Probe done.\n"); - - clear_bit(QEDF_PROBING, &qedf->flags); - } return rc; } From patchwork Mon Oct 24 11:28:49 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8651 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp421573wru; Mon, 24 Oct 2022 05:20:50 -0700 (PDT) X-Google-Smtp-Source: AMsMyM79m66Ai5KD2NXqn+lr74bjWAKr6be8gqgsjhpRpUck8DuM3eXEWGi5zmwsPXb6qnDD8/8K X-Received: by 2002:a05:6402:31f4:b0:461:604d:2607 with SMTP id dy20-20020a05640231f400b00461604d2607mr14098386edb.330.1666614050140; Mon, 24 Oct 2022 05:20:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666614050; cv=none; d=google.com; s=arc-20160816; b=N/rikB/mmKWzHcO5i967qG/NpsqEC8BT5BCYouvQtB9x8cc7QU47pKdnNFhgehV11v EG8Kv2ea8nvB/KfELucoUh15iqG+qO37O7cL1tU8+1E8D4UACKySvUHf7TehXOBN4jOW f6MYFYUbr/UGa5mhTXmu8ZbS5VPpbSLGJDSCEz+RPnKrQAePVJcsoQ8HqO3XtBA6aG4S iT/o+m0DOBPdfCiDgeA3I9sgKNMWyM1hEhbXJV1lSntsToBerZXHdW9xiZi7u0AHiirL YjQNUgyaiKA2acoA2nJWeip9NDVB6RBa5GcY+/R4eOgvS66QSzE4yIFVYy6EBOYbso+2 X4pA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=o0sGbeQu0O9TzdAHM5ZcBSPoL0ystPkzEkzdfSd6nsA=; b=bhObLVpNa/OsLL+fziEocF3Gx2J/nBggatUgcYnTwgfwRE/0lGy7S16FAZNhQou1Kh jotg4ZGPmYtG73q0WAxqX7M+lTewzS4I8kBE2dkacQGMqEOG3xzTgujGlpsl0iMQAUuO J3DTPgiXPcuoXThZtWWRGofu/a1gCcyBmyMQ4l91hMBd7r8/xpO4rcK25j2thrDg3u6k UqNitV0ubFnLdy0iGn66Q/abMRrYRNP3xA1V+R73eUsdC9PHsYILr1bI6QG2Nay4Ec0V CyjlrxGihmF0jRKgrGtRaMktAWVBI4KtJCJvekYKAKMHBXs2E2KkcJUn+rr2q+kCXfQ/ uOkA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=B2e1jw2j; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id og17-20020a1709071dd100b007912fb7ad6esi21698374ejc.893.2022.10.24.05.20.26; Mon, 24 Oct 2022 05:20:50 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=B2e1jw2j; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233027AbiJXMQO (ORCPT + 99 others); Mon, 24 Oct 2022 08:16:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41154 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233253AbiJXMOe (ORCPT ); Mon, 24 Oct 2022 08:14:34 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 993321900C; Mon, 24 Oct 2022 04:55:29 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 396E1612CF; Mon, 24 Oct 2022 11:54:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 51F4FC433C1; Mon, 24 Oct 2022 11:54:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612496; bh=cW9DTzYMjgNHsVuHUn4fbOPet6ne6uDPFkRbm3I+/mk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=B2e1jw2jQFXEknTjRFvgKmbukEFag85e2gDy79k9Cy1r4ElTlpc6mxc4tjxlI/2J2 RkGpWreUJnTte4+D3L0I9Hxvggdpi2YEUQnJWSl+JwMvJtAF5bxVlhN0ID8pPQR0Ad 4xx4VxOtt9jDeUsxYiMvp0Cz9F0lxK4VuzFklzls= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Haimin Zhang , "David S. Miller" , Sasha Levin Subject: [PATCH 4.19 010/229] net/ieee802154: fix uninit value bug in dgram_sendmsg Date: Mon, 24 Oct 2022 13:28:49 +0200 Message-Id: <20221024112959.464885362@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747571494131706564?= X-GMAIL-MSGID: =?utf-8?q?1747571494131706564?= From: Haimin Zhang [ Upstream commit 94160108a70c8af17fa1484a37e05181c0e094af ] There is uninit value bug in dgram_sendmsg function in net/ieee802154/socket.c when the length of valid data pointed by the msg->msg_name isn't verified. We introducing a helper function ieee802154_sockaddr_check_size to check namelen. First we check there is addr_type in ieee802154_addr_sa. Then, we check namelen according to addr_type. Also fixed in raw_bind, dgram_bind, dgram_connect. Signed-off-by: Haimin Zhang Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- include/net/ieee802154_netdev.h | 37 +++++++++++++++++++++++++++++ net/ieee802154/socket.c | 42 ++++++++++++++++++--------------- 2 files changed, 60 insertions(+), 19 deletions(-) diff --git a/include/net/ieee802154_netdev.h b/include/net/ieee802154_netdev.h index c4b31601cd53..fd1665baa179 100644 --- a/include/net/ieee802154_netdev.h +++ b/include/net/ieee802154_netdev.h @@ -23,6 +23,22 @@ #ifndef IEEE802154_NETDEVICE_H #define IEEE802154_NETDEVICE_H +#define IEEE802154_REQUIRED_SIZE(struct_type, member) \ + (offsetof(typeof(struct_type), member) + \ + sizeof(((typeof(struct_type) *)(NULL))->member)) + +#define IEEE802154_ADDR_OFFSET \ + offsetof(typeof(struct sockaddr_ieee802154), addr) + +#define IEEE802154_MIN_NAMELEN (IEEE802154_ADDR_OFFSET + \ + IEEE802154_REQUIRED_SIZE(struct ieee802154_addr_sa, addr_type)) + +#define IEEE802154_NAMELEN_SHORT (IEEE802154_ADDR_OFFSET + \ + IEEE802154_REQUIRED_SIZE(struct ieee802154_addr_sa, short_addr)) + +#define IEEE802154_NAMELEN_LONG (IEEE802154_ADDR_OFFSET + \ + IEEE802154_REQUIRED_SIZE(struct ieee802154_addr_sa, hwaddr)) + #include #include #include @@ -173,6 +189,27 @@ static inline void ieee802154_devaddr_to_raw(void *raw, __le64 addr) memcpy(raw, &temp, IEEE802154_ADDR_LEN); } +static inline int +ieee802154_sockaddr_check_size(struct sockaddr_ieee802154 *daddr, int len) +{ + struct ieee802154_addr_sa *sa; + + sa = &daddr->addr; + if (len < IEEE802154_MIN_NAMELEN) + return -EINVAL; + switch (sa->addr_type) { + case IEEE802154_ADDR_SHORT: + if (len < IEEE802154_NAMELEN_SHORT) + return -EINVAL; + break; + case IEEE802154_ADDR_LONG: + if (len < IEEE802154_NAMELEN_LONG) + return -EINVAL; + break; + } + return 0; +} + static inline void ieee802154_addr_from_sa(struct ieee802154_addr *a, const struct ieee802154_addr_sa *sa) { diff --git a/net/ieee802154/socket.c b/net/ieee802154/socket.c index 14c6fac039f9..80495c88bfb9 100644 --- a/net/ieee802154/socket.c +++ b/net/ieee802154/socket.c @@ -213,8 +213,9 @@ static int raw_bind(struct sock *sk, struct sockaddr *_uaddr, int len) int err = 0; struct net_device *dev = NULL; - if (len < sizeof(*uaddr)) - return -EINVAL; + err = ieee802154_sockaddr_check_size(uaddr, len); + if (err < 0) + return err; uaddr = (struct sockaddr_ieee802154 *)_uaddr; if (uaddr->family != AF_IEEE802154) @@ -509,7 +510,8 @@ static int dgram_bind(struct sock *sk, struct sockaddr *uaddr, int len) ro->bound = 0; - if (len < sizeof(*addr)) + err = ieee802154_sockaddr_check_size(addr, len); + if (err < 0) goto out; if (addr->family != AF_IEEE802154) @@ -580,8 +582,9 @@ static int dgram_connect(struct sock *sk, struct sockaddr *uaddr, struct dgram_sock *ro = dgram_sk(sk); int err = 0; - if (len < sizeof(*addr)) - return -EINVAL; + err = ieee802154_sockaddr_check_size(addr, len); + if (err < 0) + return err; if (addr->family != AF_IEEE802154) return -EINVAL; @@ -620,6 +623,7 @@ static int dgram_sendmsg(struct sock *sk, struct msghdr *msg, size_t size) struct ieee802154_mac_cb *cb; struct dgram_sock *ro = dgram_sk(sk); struct ieee802154_addr dst_addr; + DECLARE_SOCKADDR(struct sockaddr_ieee802154*, daddr, msg->msg_name); int hlen, tlen; int err; @@ -628,10 +632,20 @@ static int dgram_sendmsg(struct sock *sk, struct msghdr *msg, size_t size) return -EOPNOTSUPP; } - if (!ro->connected && !msg->msg_name) - return -EDESTADDRREQ; - else if (ro->connected && msg->msg_name) - return -EISCONN; + if (msg->msg_name) { + if (ro->connected) + return -EISCONN; + if (msg->msg_namelen < IEEE802154_MIN_NAMELEN) + return -EINVAL; + err = ieee802154_sockaddr_check_size(daddr, msg->msg_namelen); + if (err < 0) + return err; + ieee802154_addr_from_sa(&dst_addr, &daddr->addr); + } else { + if (!ro->connected) + return -EDESTADDRREQ; + dst_addr = ro->dst_addr; + } if (!ro->bound) dev = dev_getfirstbyhwtype(sock_net(sk), ARPHRD_IEEE802154); @@ -667,16 +681,6 @@ static int dgram_sendmsg(struct sock *sk, struct msghdr *msg, size_t size) cb = mac_cb_init(skb); cb->type = IEEE802154_FC_TYPE_DATA; cb->ackreq = ro->want_ack; - - if (msg->msg_name) { - DECLARE_SOCKADDR(struct sockaddr_ieee802154*, - daddr, msg->msg_name); - - ieee802154_addr_from_sa(&dst_addr, &daddr->addr); - } else { - dst_addr = ro->dst_addr; - } - cb->secen = ro->secen; cb->secen_override = ro->secen_override; cb->seclevel = ro->seclevel; From patchwork Mon Oct 24 11:28:50 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 10052 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp622884wru; Mon, 24 Oct 2022 12:46:48 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5w140/QOnHZjSDStvNt2Kci4jSq9ZLGXdFyTid6d5nYzjFDOFPq6PE0IzObv+/fBlaKF5V X-Received: by 2002:a17:90b:4b0c:b0:20d:7ffa:4b1b with SMTP id lx12-20020a17090b4b0c00b0020d7ffa4b1bmr74595553pjb.16.1666640808537; Mon, 24 Oct 2022 12:46:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666640808; cv=none; d=google.com; s=arc-20160816; b=dl6LRQ0dhYRIpZ/5mZPLfkErQe0JCPIzfF+C/0X/kNnDLDG8Aio4XMwJOVz84wAOzj aCXJN2mdFTfSFIPibNEAt2R6a539OrRlCQ4vEL70k4WX4ovyrpvp4skmCN2YZUeZxtZj RPu8guBxDX8L2ncuYcEEARCmSjTjeuQYUvNhoU+inZVhnvJ+t569ulyDOqDhFesGL7JE i6nAboGX+3r/nWO8IjSFa67HcIxKxfhFG8BF84OCbUk4nHfrqIY6riu0PxkLpR0J9AEa 3nlPmiehqZk6CvGolxCCNEud7JMW3C99KynNgqVdO+/OQCS2i+ZwFmkWgmLH0xCs46x4 oNGA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=dJDs24JJyfkZtcB06WpgN5odIe0hQNCVeW1Sj9XLBNg=; b=k4bofC3Vtizkasd+9Rt7rdkPSkCyCdArZe3i3Z4uPEeVj1nkwaiSX1zt/WrCb4RVhU 6n1FkdIzvW3sQTs8MAseoplYNqejvf2adngj7TAWOJ0HKwBkMh2uDMramKvNjSUFL3WM 9zFpDMe1xz1TPou+CgNVx6JAfOW4cHgE9sLtSc+trGuL/WgABUoegWBrgYkwul11JvTF WgQmnv/NirQDoXKbiaxG66w/73bfZGYu5gyTpENjYZioEiZKWcw4oiZ0OJJL2OzNsrIZ GUNuB3DVQIqS3WbkNGjN+RRLtrpH0TNiTTYBe1yw4oSAMMJ1rBvH0xm3RXC5rDXpRb37 qcLg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="Qo/aFpVo"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d8-20020a17090a628800b0020d3d140013si688293pjj.182.2022.10.24.12.46.33; Mon, 24 Oct 2022 12:46:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="Qo/aFpVo"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232623AbiJXTnO (ORCPT + 99 others); Mon, 24 Oct 2022 15:43:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56330 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233519AbiJXTlg (ORCPT ); Mon, 24 Oct 2022 15:41:36 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4B18020991; Mon, 24 Oct 2022 11:11:28 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 903D9B811CE; Mon, 24 Oct 2022 11:55:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DC364C433B5; Mon, 24 Oct 2022 11:54:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612499; bh=Oo5dzfgUvi7RFuvhID2RTEtBjZh0y9xtz/tZcCFnyi8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Qo/aFpVorSzGJCC/yMtCya7QWiF1qIG2+tva80cUYp6J4PrUq1KHYnI14XY3+wlQm JvNBeSnd+5yyaI0dCUiGSHNjDahxHZsV/cWPioM7Ue8qTBKjtM7bTHO724eMiAwHv7 FbQwsojzLhjVQMqIGroBs8ZPiGWWNHKSTWIf03OQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Lukas Straub , Richard Weinberger , Sasha Levin , Randy Dunlap Subject: [PATCH 4.19 011/229] um: Cleanup syscall_handler_t cast in syscalls_32.h Date: Mon, 24 Oct 2022 13:28:50 +0200 Message-Id: <20221024112959.505038051@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747599552627924700?= X-GMAIL-MSGID: =?utf-8?q?1747599552627924700?= From: Lukas Straub [ Upstream commit 61670b4d270c71219def1fbc9441debc2ac2e6e9 ] Like in f4f03f299a56ce4d73c5431e0327b3b6cb55ebb9 "um: Cleanup syscall_handler_t definition/cast, fix warning", remove the cast to to fix the compiler warning. Signed-off-by: Lukas Straub Acked-by: Randy Dunlap # build-tested Signed-off-by: Richard Weinberger Signed-off-by: Sasha Levin --- arch/x86/um/shared/sysdep/syscalls_32.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/arch/x86/um/shared/sysdep/syscalls_32.h b/arch/x86/um/shared/sysdep/syscalls_32.h index 68fd2cf526fd..f6e9f84397e7 100644 --- a/arch/x86/um/shared/sysdep/syscalls_32.h +++ b/arch/x86/um/shared/sysdep/syscalls_32.h @@ -6,10 +6,9 @@ #include #include -typedef long syscall_handler_t(struct pt_regs); +typedef long syscall_handler_t(struct syscall_args); extern syscall_handler_t *sys_call_table[]; #define EXECUTE_SYSCALL(syscall, regs) \ - ((long (*)(struct syscall_args)) \ - (*sys_call_table[syscall]))(SYSCALL_ARGS(®s->regs)) + ((*sys_call_table[syscall]))(SYSCALL_ARGS(®s->regs)) From patchwork Mon Oct 24 11:28:51 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8666 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp421886wru; Mon, 24 Oct 2022 05:21:23 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7BWYxU/5tKTYMX2IJ3NPm57Vbj13oxqUOby8POOd2XTj4Eawu4/Uzs9g0jdfisnaINTLNL X-Received: by 2002:a17:907:6087:b0:78d:ee99:a06a with SMTP id ht7-20020a170907608700b0078dee99a06amr27355196ejc.52.1666614083758; Mon, 24 Oct 2022 05:21:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666614083; cv=none; d=google.com; s=arc-20160816; b=m1WdcB3Sq2VmVj9A+9Flrzr65v35974OVYWQooLGt1yvJvLyFCB4DyZAsQMMAmP1OL 1DvYvn++6O6S27EOOpxMDmu4dQyHr73PRItXM+JZUTKCdaB9ch3I2z7MxX8vAi+/GnNu AArbbaCNEWXZuAZ7M1tDI8Rz+WMCB/5mVOqcZJFLwP/KFt+vxOvlQhJOLeiaxeQWZwvz ApX6t/YSwmd+W1gkft48HP5EXV60ZjjE794tCsh+d18zQ2Ayci5y3r5mdm6Pf8+PMO1V H53iymgB/xVPQHjHhWBf7Syf3Qvw3WPHzB4kGWoXNOYTmaRr6CNqObHO9PLOFqij4FBm rU0A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Kvf1wUbNwSVSBWwIV5fL8bkIuY3EWSCL26/lalVKqzk=; b=g24Xs5BcMJBEsMDPOjFArpqsLEq3crnzmT2aivsQHncloFETmCYKVs7f+Y+zdGSAnS xMxORynD93JftH2297XivdiVZ15nsac2U38HkVbAC9/jWWlTdMocxpNpLMSYfSXv3ovN xUIcO9IC4LX38JeLinxLLo+Y/cFCBQg9QjRWkAm/qRr/eRB5bsjBZY9nM/fWIrY79MTs tqYEN0NSd8e1Brd60CH0WvWeQTLXns2ES66T6MLBW77i8ho1Bt5G2/fw5/3pfHJmIDO8 EMHCD5SdBSAYDw7ajn67FsmRiSqws4ZRDUiU8hQTG34R8hJF3hu5GzLh1tVPy8YpSuj7 QZOQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ayFnQDQm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y17-20020a50ce11000000b0045cda8e8383si25407884edi.542.2022.10.24.05.20.59; Mon, 24 Oct 2022 05:21:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ayFnQDQm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233081AbiJXMQb (ORCPT + 99 others); Mon, 24 Oct 2022 08:16:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59852 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233314AbiJXMOs (ORCPT ); Mon, 24 Oct 2022 08:14:48 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4AC2DBF44; Mon, 24 Oct 2022 04:55:33 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 0CD686129E; Mon, 24 Oct 2022 11:55:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B5219C433C1; Mon, 24 Oct 2022 11:55:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612502; bh=H6SVqnoMJtqjUi9uRgeMH0tCUlsjckGSZG/7dl6Ssrk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ayFnQDQmhBpqWgNGpgoUyhzD+ywSIQTd8SLlGcQ8MguSV5C5gObw6+NwJRu4TD500 NJEflaYTTWyxwpxM2i1ROWh2UDVa3GLRi3pGMbbtmgiK1pV9lIBHmMwdJRTPAjchdu hN4K62B4JXr0dbZcU0sjGH30JmVaOns5HN+DvJxA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Lukas Straub , Richard Weinberger , Sasha Levin , Randy Dunlap Subject: [PATCH 4.19 012/229] um: Cleanup compiler warning in arch/x86/um/tls_32.c Date: Mon, 24 Oct 2022 13:28:51 +0200 Message-Id: <20221024112959.535925369@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747571529515567536?= X-GMAIL-MSGID: =?utf-8?q?1747571529515567536?= From: Lukas Straub [ Upstream commit d27fff3499671dc23a08efd01cdb8b3764a391c4 ] arch.tls_array is statically allocated so checking for NULL doesn't make sense. This causes the compiler warning below. Remove the checks to silence these warnings. ../arch/x86/um/tls_32.c: In function 'get_free_idx': ../arch/x86/um/tls_32.c:68:13: warning: the comparison will always evaluate as 'true' for the address of 'tls_array' will never be NULL [-Waddress] 68 | if (!t->arch.tls_array) | ^ In file included from ../arch/x86/um/asm/processor.h:10, from ../include/linux/rcupdate.h:30, from ../include/linux/rculist.h:11, from ../include/linux/pid.h:5, from ../include/linux/sched.h:14, from ../arch/x86/um/tls_32.c:7: ../arch/x86/um/asm/processor_32.h:22:31: note: 'tls_array' declared here 22 | struct uml_tls_struct tls_array[GDT_ENTRY_TLS_ENTRIES]; | ^~~~~~~~~ ../arch/x86/um/tls_32.c: In function 'get_tls_entry': ../arch/x86/um/tls_32.c:243:13: warning: the comparison will always evaluate as 'true' for the address of 'tls_array' will never be NULL [-Waddress] 243 | if (!t->arch.tls_array) | ^ ../arch/x86/um/asm/processor_32.h:22:31: note: 'tls_array' declared here 22 | struct uml_tls_struct tls_array[GDT_ENTRY_TLS_ENTRIES]; | ^~~~~~~~~ Signed-off-by: Lukas Straub Acked-by: Randy Dunlap # build-tested Signed-off-by: Richard Weinberger Signed-off-by: Sasha Levin --- arch/x86/um/tls_32.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/arch/x86/um/tls_32.c b/arch/x86/um/tls_32.c index 5bd949da7a4a..b69ab2409430 100644 --- a/arch/x86/um/tls_32.c +++ b/arch/x86/um/tls_32.c @@ -65,9 +65,6 @@ static int get_free_idx(struct task_struct* task) struct thread_struct *t = &task->thread; int idx; - if (!t->arch.tls_array) - return GDT_ENTRY_TLS_MIN; - for (idx = 0; idx < GDT_ENTRY_TLS_ENTRIES; idx++) if (!t->arch.tls_array[idx].present) return idx + GDT_ENTRY_TLS_MIN; @@ -242,9 +239,6 @@ static int get_tls_entry(struct task_struct *task, struct user_desc *info, { struct thread_struct *t = &task->thread; - if (!t->arch.tls_array) - goto clear; - if (idx < GDT_ENTRY_TLS_MIN || idx > GDT_ENTRY_TLS_MAX) return -EINVAL; From patchwork Mon Oct 24 11:28:52 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8677 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp422203wru; Mon, 24 Oct 2022 05:22:06 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6mitnBBDFeTYuGhIVV9aQ3hDd4WQQZa2XHH/092n1M1YzuQBSAPsbqVd9daoRovd7Q/ohi X-Received: by 2002:a17:906:846c:b0:7a5:ccb:c174 with SMTP id hx12-20020a170906846c00b007a50ccbc174mr6228430ejc.583.1666614126194; Mon, 24 Oct 2022 05:22:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666614126; cv=none; d=google.com; s=arc-20160816; b=GPTC/FOYhPlAq/iP1YPugOrajCSs8h0CGKZw0a6OpnBNCwOVKomcc3/i2EpM5CD6EP Xbhu7kDAVqf9qdnr9zimzkiY617MRB9SkJHnip+PHMenC15c+B6etgFGqCc/OP+mRrJA 7tRahAehQ/sU+FLBgQDKVDXeEeJxHNgBGwIDrkVYkoLTlV6ro9K++0YPvWOYOmLId40f 0wJcqD0szrATY5v+SZcO05WceX7WcZ+QIppCa9D916k0cJfXQtZfzVDZ5pKOyCgFGL2q 2Ey34TXdKKsA5oM78Eou3fLt4t0nKdECXfM/cx5kYbkT3r07BoajmdIaGz2RSQSxEXJK TWZg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=/99HhorlSEtRK1O8lF2dwiBzQkiIMdwAYwHSdrKnUc4=; b=w1xMgPqg6kel0Mnv8Fx2oTtjeQn6DfkNaiWq2HUcPtQByx332XJ8PFKavEDRkOzkOv SoZRdS0aGxtajL5zxxKH7iCsZKRJxu0IfbB0UAKKl5gs8qoIgHomCSX46IZ6DD1pd15e +ZqKsyOq+A60ZqXWOUFNPjmaNUuXd93DN3hocMvi84g32LD6mueOJ8410LNfRikkpXwt 59px0M8wg5e1dNPkGykGg4Y5HgiG3N1KiYPCftyhZBdIcuKq86L+BgoQ7iMPNiw3jOMj O3mQkt5oF5RO8p5vEljZ1Ckddr6H1UFUdsYZRFaXcJ0juw3+ZbMhhdMtSgGdlpcWcBjt 2AqA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=MNeRCenC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id sz15-20020a1709078b0f00b007313312730esi21657643ejc.85.2022.10.24.05.21.42; Mon, 24 Oct 2022 05:22:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=MNeRCenC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232587AbiJXMUA (ORCPT + 99 others); Mon, 24 Oct 2022 08:20:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47544 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233005AbiJXMSn (ORCPT ); Mon, 24 Oct 2022 08:18:43 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E365080E95; Mon, 24 Oct 2022 04:57:18 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id A4DE061291; Mon, 24 Oct 2022 11:55:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B4955C433C1; Mon, 24 Oct 2022 11:55:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612505; bh=xxDHkhWXn9LWoUKnTOuFYR63Zphxmul0hUMh47XisPY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MNeRCenC61q5K5K3kG+Mt7NSuMhycgfio2NCGHyKPMBWhHoZQ9qnuKRq66fgXLgTE KAK+LZ3H986RgVy0dUa3UI4sZO0Ql8iY7bE03ITswmitogBDsIjaRhGAUJLBAg9xu5 QJJMbS+eMxzTEEO+1h9/DZoF2YKp+BJHwOlEtlf4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Dmitry Vyukov" , stable , syzbot+23f57c5ae902429285d7@syzkaller.appspotmail.com, Tadeusz Struk , PaX Team Subject: [PATCH 4.19 013/229] usb: mon: make mmapped memory read only Date: Mon, 24 Oct 2022 13:28:52 +0200 Message-Id: <20221024112959.566961406@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747571573965668077?= X-GMAIL-MSGID: =?utf-8?q?1747571573965668077?= From: Tadeusz Struk commit a659daf63d16aa883be42f3f34ff84235c302198 upstream. Syzbot found an issue in usbmon module, where the user space client can corrupt the monitor's internal memory, causing the usbmon module to crash the kernel with segfault, UAF, etc. The reproducer mmaps the /dev/usbmon memory to user space, and overwrites it with arbitrary data, which causes all kinds of issues. Return an -EPERM error from mon_bin_mmap() if the flag VM_WRTIE is set. Also clear VM_MAYWRITE to make it impossible to change it to writable later. Cc: "Dmitry Vyukov" Cc: stable Fixes: 6f23ee1fefdc ("USB: add binary API to usbmon") Suggested-by: PaX Team # for the VM_MAYRITE portion Link: https://syzkaller.appspot.com/bug?id=2eb1f35d6525fa4a74d75b4244971e5b1411c95a Reported-by: syzbot+23f57c5ae902429285d7@syzkaller.appspotmail.com Signed-off-by: Tadeusz Struk Link: https://lore.kernel.org/r/20220919215957.205681-1-tadeusz.struk@linaro.org Signed-off-by: Greg Kroah-Hartman --- drivers/usb/mon/mon_bin.c | 5 +++++ 1 file changed, 5 insertions(+) --- a/drivers/usb/mon/mon_bin.c +++ b/drivers/usb/mon/mon_bin.c @@ -1268,6 +1268,11 @@ static int mon_bin_mmap(struct file *fil { /* don't do anything here: "fault" will set up page table entries */ vma->vm_ops = &mon_bin_vm_ops; + + if (vma->vm_flags & VM_WRITE) + return -EPERM; + + vma->vm_flags &= ~VM_MAYWRITE; vma->vm_flags |= VM_DONTEXPAND | VM_DONTDUMP; vma->vm_private_data = filp->private_data; mon_bin_vma_open(vma); From patchwork Mon Oct 24 11:28:53 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8652 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp421604wru; Mon, 24 Oct 2022 05:20:52 -0700 (PDT) X-Google-Smtp-Source: AMsMyM55qi/fc7U5Y7HLa6HOjRrlM06CLsxofH1zyXj8whSB7kUDW+rolS/GcDUfWFxwNLJ14MEC X-Received: by 2002:a17:907:6ea9:b0:794:8b93:2e44 with SMTP id sh41-20020a1709076ea900b007948b932e44mr22387757ejc.407.1666614052833; Mon, 24 Oct 2022 05:20:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666614052; cv=none; d=google.com; s=arc-20160816; b=uL+GXqg2ww37l8Kbotqrs6hg1w5nUJ9qU8pZeAlcZ6W6KQHRrexmSk4j8Zm6yptz/V 1zsWl8pAEZlSNwSalUupnXtEI+Q8U9ShOJCK9Zkn99KUbyAfUiCBO+CvwS67O2/0+pq1 HfKLyDWTH/l/nBNMa2hkdo8+isxU+nRBJKvWOT66tuWuyfOEKMJLwUzPPLG3XOGqCwoI GFDI93nOMfklI3fzS+sfYbcG7CTCKVbKAJSoST8X9oyayz90T/TlQ/uruqUlMosh+SQA wQjye5/KPqeiEWgL/jBM31Ckb8dqX+NSxemsvbCXRfgr8uQbndCBd1l+BZeAAj4KHu4c nNrA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=ZUqxbdN/MLGRLL2SO+JNTqhG+EqU+sUkONTXStK0AQc=; b=ZFj2SIoUzeHVnt45ogXR7RiTYpoAHjwrlt+ANpAvdQi20Y8jpLAmngESbW2zUagpD4 JUkZlAWkVKhurX3Aicb1FwwlNuhWDvTC1+rUrL+qif29NwLWuH4YBNtUJljE2r/CUGgA C5KlNn4KfR7ppZ+ObwcaR/ey138QR8eIUTWLewNur7pvB0RZ3IlGVDWVKEQFXlR6YmP1 w3kFGi8U8YG41tjoE3ee9pAmgqtV3ImHfsvMUiueVBffxoB1tBxRkfHjkcD/2zdGJs5w TMTsW8ZN9xPlkbNjoa9G1gQk1Sh78SMuhKFIIjATn/z8rQuKpFT0bLJICmEgpdTIdlzK lgNg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=JUmQI2wK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b20-20020a056402279400b00461d5afea01si2259752ede.165.2022.10.24.05.20.28; Mon, 24 Oct 2022 05:20:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=JUmQI2wK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233114AbiJXMQW (ORCPT + 99 others); Mon, 24 Oct 2022 08:16:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59532 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233294AbiJXMOo (ORCPT ); Mon, 24 Oct 2022 08:14:44 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4B11A18350; Mon, 24 Oct 2022 04:55:33 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 42ADC612BB; Mon, 24 Oct 2022 11:55:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 559A4C433C1; Mon, 24 Oct 2022 11:55:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612507; bh=pKT/iQfxBxGioKBlfo90x9MW0lGwQY8QgTHrj5HQNl4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JUmQI2wKs8AyNhafoVJbp+Z4gPI1wkY59zQG/zS8icN6M3NlU8N29XU41bRs/enVX xzSVJTmFD600LoPz3MXn7da6pZ56AxmfS9Pm60CXgYqdKpQtJE5iKcUS6aZUlT9qs2 rATxg53oQ9iV7ksEvx0t6T448BHPH/JIxdTfUs3k= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Johan Hovold Subject: [PATCH 4.19 014/229] USB: serial: ftdi_sio: fix 300 bps rate for SIO Date: Mon, 24 Oct 2022 13:28:53 +0200 Message-Id: <20221024112959.601347548@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747571496784610894?= X-GMAIL-MSGID: =?utf-8?q?1747571496784610894?= From: Johan Hovold commit 7bd7ad3c310cd6766f170927381eea0aa6f46c69 upstream. The 300 bps rate of SIO devices has been mapped to 9600 bps since 2003... Let's fix the regression. Cc: stable@vger.kernel.org Signed-off-by: Johan Hovold Signed-off-by: Greg Kroah-Hartman --- drivers/usb/serial/ftdi_sio.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) --- a/drivers/usb/serial/ftdi_sio.c +++ b/drivers/usb/serial/ftdi_sio.c @@ -1304,8 +1304,7 @@ static u32 get_ftdi_divisor(struct tty_s case 38400: div_value = ftdi_sio_b38400; break; case 57600: div_value = ftdi_sio_b57600; break; case 115200: div_value = ftdi_sio_b115200; break; - } /* baud */ - if (div_value == 0) { + default: dev_dbg(dev, "%s - Baudrate (%d) requested is not supported\n", __func__, baud); div_value = ftdi_sio_b9600; From patchwork Mon Oct 24 11:28:54 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8711 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp423093wru; Mon, 24 Oct 2022 05:24:05 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5wXT2YVn+qzxH7wzlWP4B5dMsRqKzKWCIFVP9UAI430pGKcx+Dngm04XJz0YbYnhuHL9Q8 X-Received: by 2002:a05:6402:358e:b0:461:ea80:fb61 with SMTP id y14-20020a056402358e00b00461ea80fb61mr1663435edc.356.1666614244816; Mon, 24 Oct 2022 05:24:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666614244; cv=none; d=google.com; s=arc-20160816; b=WTgpKCcafUztanWXa6ej0m6x3Q5vsJOmuwYGN6+eQimSFbqnVcjE7rm7FAJ7h1U3rR g2j+jxg2EJa05Je6bcI5bm90htSJihmWocTqO9ZlJdPQGbX5Zl+RuFjwKa85HDyWvbmn cl5za3DmjYLoEm9Uo4Go7XN1EWTapfUkppgOxwY9QRUhggrtxThiFn4NBfEvY7LVMpUh pT1JraCxeQdEJHLcZ0m9PuLdAxjmvhjkWTRQz3Bydm8TxysP3Gq6bqjSRC2K3I0OJdZt AseAc9Qxaw+fJap2cN5SXgpbRmUdFaWKb2KsaZj4Rxxf3jyrZ/48lMhzjegSnUbC4ZC3 SQmw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=bXFKKxb+Sx6/Z/Ex09+yx74N5W9qV9cB9Zy/fDJtQ+A=; b=PKN+dc+9N0TrkUU/P6PnHyS/rrbatWjSAnkmnAzH7u7tFft6c8LbHv1mi9XYLMGvbW Ta+iqUd770Y2hyM10PI/b+Y54cUrgy7WXYrMyx2VSTawYRCw2jtJZm2cGVMEIZDekvmn 1A1PmWIydj501/8TSOanTcg0KrUASrf867cd721NKLb5SdtUc62IAHjHZfgWRmChMYbo LpM3pjHeLA3UW2JeD8yVr6hsdIfyO65Z0VzLM9vAjC7x9lJdW/t0odEM9Td0UM+TGnWu f29spfVqjLx1GwrfpGwEEGpqoVQwHYAOZ6MpnTyxVOnsUn837XQJPGnrsZQMtwk3uqQw VQKA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=xV11g1IH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id cw10-20020a170906478a00b0078db89b526asi29650045ejc.108.2022.10.24.05.23.41; Mon, 24 Oct 2022 05:24:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=xV11g1IH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233521AbiJXMWl (ORCPT + 99 others); Mon, 24 Oct 2022 08:22:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40992 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233233AbiJXMUS (ORCPT ); Mon, 24 Oct 2022 08:20:18 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6D6847B7A8; Mon, 24 Oct 2022 04:58:58 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id A678AB811D3; Mon, 24 Oct 2022 11:55:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F3FCEC433C1; Mon, 24 Oct 2022 11:55:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612510; bh=XGcTzqv5yDKn4JVe+5V7/VB4DHTX2abKHi6H8xwzecI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xV11g1IHhIT3I5AamcPDLg5evsH9lduKAlG8vpHTbsJ+EvtGeCwRnb82ThXt9eBsD vGK22+cr1IJLfRZCYqzcPMcksIoe1DselgbSx9ELV9mJVxDjmuAFc9IRgVqnQRAKob k/1Z6vZvqWCCD3hAUei7NFWOXp/eY2gBMcpKME18= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, ChanWoo Lee , Linus Walleij , Ulf Hansson , Brian Norris Subject: [PATCH 4.19 015/229] mmc: core: Replace with already defined values for readability Date: Mon, 24 Oct 2022 13:28:54 +0200 Message-Id: <20221024112959.634831426@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747571697973632344?= X-GMAIL-MSGID: =?utf-8?q?1747571697973632344?= From: ChanWoo Lee commit e427266460826bea21b70f9b2bb29decfb2c2620 upstream. SD_ROCR_S18A is already defined and is used to check the rocr value, so let's replace with already defined values for readability. Signed-off-by: ChanWoo Lee Reviewed-by: Linus Walleij Link: https://lore.kernel.org/r/20220706004840.24812-1-cw9316.lee@samsung.com Signed-off-by: Ulf Hansson Signed-off-by: Brian Norris Signed-off-by: Greg Kroah-Hartman --- drivers/mmc/core/sd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/mmc/core/sd.c +++ b/drivers/mmc/core/sd.c @@ -787,7 +787,7 @@ try_again: * the CCS bit is set as well. We deliberately deviate from the spec in * regards to this, which allows UHS-I to be supported for SDSC cards. */ - if (!mmc_host_is_spi(host) && rocr && (*rocr & 0x01000000)) { + if (!mmc_host_is_spi(host) && rocr && (*rocr & SD_ROCR_S18A)) { err = mmc_set_uhs_voltage(host, pocr); if (err == -EAGAIN) { retries--; From patchwork Mon Oct 24 11:28:55 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8727 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp423722wru; Mon, 24 Oct 2022 05:25:38 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6Q2aQ0CvpjdDbYusYoWNVBBtlFa6XUP3V3kouFdpMriQ1ftGcRtzxjNcdF8+W26BJX9S26 X-Received: by 2002:a17:902:7c12:b0:186:8111:ade2 with SMTP id x18-20020a1709027c1200b001868111ade2mr15524942pll.111.1666614337887; Mon, 24 Oct 2022 05:25:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666614337; cv=none; d=google.com; s=arc-20160816; b=bz7JUoUkd2XldHp0Q7NtlQ3q/wHq08VQwUpgXzsfY0Z/nkv2hlIslR0Y3aBGrTY2dy vVEEh6I3V+yT6WnYEJvoy2cWf6eUevJpGBkvGic04SYAMzB7TzueQYjs+iYUT3HUxB9/ ieDWxyyMHuQA/PCnue4pNG9hTama5NBBjJ/7SejJHSNQgP4w4Kjp+615/mNbIIxnmrsY isVHv+6BuTefPf090BSApG5EZfC5ApCHkesfVFMgm1jiV4u65VKUscwKmaMiNSL7uAZv xedHULAq+Yn5RzA4s6AUSUfPkNns0QsPNL06rpFkGSZFp3Lwp5TwLADHYWfoD/GadK07 zfYA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=J/JyS1HSQpiL71EJ21JKyZRHgCBN3LbOYZvaa9jGqvs=; b=vB9BWEi1Gh0weMWhBhIiS0EGsm0HQ1hQWzAJiaa65oVu9OMyR2iGDfgjyYjccn9qol pWjsKRmn4pVV9Cmx0ROg7kJXUqB/8+1LQYzIheC2YPRMQURog86RNQTKcFVABOUbyTP4 Qzo2fI0S4YSGvdBby0x2n7Opwh+ZWByprTnlPGQis1T5p6LwNMHS9g8aSP22Vhti2zM+ PnF9o4/HaxLeXRUyk2FKpZEqe2QyM5mlLh5SJV3/bwoFZAH4A+uuM8c8No6e78E2C/gX ooSVRTlf48DzRDAtTm8A2JBwn0wa/Z0bSjaljkE8QqDYXiGYQ9bhkMq0j1w1wH2GLQjA ObaA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=m3TAHe5m; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id pi16-20020a17090b1e5000b0020d47757829si10523969pjb.144.2022.10.24.05.25.25; Mon, 24 Oct 2022 05:25:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=m3TAHe5m; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233488AbiJXMYz (ORCPT + 99 others); Mon, 24 Oct 2022 08:24:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40674 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233371AbiJXMXM (ORCPT ); Mon, 24 Oct 2022 08:23:12 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B6522DEF0; Mon, 24 Oct 2022 04:59:33 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id E47A761257; Mon, 24 Oct 2022 11:57:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 02073C433D6; Mon, 24 Oct 2022 11:57:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612622; bh=doyM6GFH95BLQzDNCiBz6c5XV379cRQ4AYunJVs8eqA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=m3TAHe5m2sRQvzogrSIPmCq72dxsyc3tApwigjxHaQZlY98m445+CSQfB1nLF0ZZG kdAtYDZMRlvF5pE90/MZMN5aY2Od6fzjvhHIoCZxz3Xmo7SEZvjO42GT9zCdRr47iA BwuAD8uJDawMiYBV2uWLZ794bovFl2Rbgw3uE9N0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Brian Norris , Guenter Roeck , Ulf Hansson Subject: [PATCH 4.19 016/229] mmc: core: Terminate infinite loop in SD-UHS voltage switch Date: Mon, 24 Oct 2022 13:28:55 +0200 Message-Id: <20221024112959.668731263@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747571795684690766?= X-GMAIL-MSGID: =?utf-8?q?1747571795684690766?= From: Brian Norris commit e9233917a7e53980664efbc565888163c0a33c3f upstream. This loop intends to retry a max of 10 times, with some implicit termination based on the SD_{R,}OCR_S18A bit. Unfortunately, the termination condition depends on the value reported by the SD card (*rocr), which may or may not correctly reflect what we asked it to do. Needless to say, it's not wise to rely on the card doing what we expect; we should at least terminate the loop regardless. So, check both the input and output values, so we ensure we will terminate regardless of the SD card behavior. Note that SDIO learned a similar retry loop in commit 0797e5f1453b ("mmc: core: Fixup signal voltage switch"), but that used the 'ocr' result, and so the current pre-terminating condition looks like: rocr & ocr & R4_18V_PRESENT (i.e., it doesn't have the same bug.) This addresses a number of crash reports seen on ChromeOS that look like the following: ... // lots of repeated: ... <4>[13142.846061] mmc1: Skipping voltage switch <4>[13143.406087] mmc1: Skipping voltage switch <4>[13143.964724] mmc1: Skipping voltage switch <4>[13144.526089] mmc1: Skipping voltage switch <4>[13145.086088] mmc1: Skipping voltage switch <4>[13145.645941] mmc1: Skipping voltage switch <3>[13146.153969] INFO: task halt:30352 blocked for more than 122 seconds. ... Fixes: f2119df6b764 ("mmc: sd: add support for signal voltage switch procedure") Cc: Signed-off-by: Brian Norris Reviewed-by: Guenter Roeck Link: https://lore.kernel.org/r/20220914014010.2076169-1-briannorris@chromium.org Signed-off-by: Ulf Hansson Signed-off-by: Greg Kroah-Hartman --- drivers/mmc/core/sd.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/drivers/mmc/core/sd.c +++ b/drivers/mmc/core/sd.c @@ -787,7 +787,8 @@ try_again: * the CCS bit is set as well. We deliberately deviate from the spec in * regards to this, which allows UHS-I to be supported for SDSC cards. */ - if (!mmc_host_is_spi(host) && rocr && (*rocr & SD_ROCR_S18A)) { + if (!mmc_host_is_spi(host) && (ocr & SD_OCR_S18R) && + rocr && (*rocr & SD_ROCR_S18A)) { err = mmc_set_uhs_voltage(host, pocr); if (err == -EAGAIN) { retries--; From patchwork Mon Oct 24 11:28:56 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8676 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp422194wru; Mon, 24 Oct 2022 05:22:05 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5BOHzvElw+dIldUznzpbn4G2qWChGqK+R/g2mHNz47DZnJtshzeZsWJtlu6nB6bzUHOYt+ X-Received: by 2002:a05:6402:524e:b0:461:fa05:aff8 with SMTP id t14-20020a056402524e00b00461fa05aff8mr419348edd.283.1666614124910; Mon, 24 Oct 2022 05:22:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666614124; cv=none; d=google.com; s=arc-20160816; b=qBa7yvoWoqzE0O6u6hFZ6JhvndsRS4tNXb6q3cpobD63FYCyPVC+LbObNDhqw0dvHL 5v9jaSQYll4X3hZscMw30sVjfWNap6MJJpQckA2sF7MWbxW7s2uExeYTWHSampBOn87v ZDtx2qKsjrpQe9jBnIR2ySvbtTAeVaQpSq6+1go8SzBIwV2Twrjke9aV0gmx5Y4uYo5a PuDLVLN38Pr40DYimg2BOOExztlSlgiWNNVC8nKgoVdo1B87wi2Gdweu5tcllpva31Dc UsDLiRYjLVP+60ZE1aXFJRUr3/Laybs7lGT22uQdDoCK2hrWjTZZJ6bNkYZHzO7yj4u6 fSCw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Pk89Ne7J7uv4B7cRzuJ+HfQoXxeNskDzRj2up5O6c7E=; b=FH5cYsoR/+KOdCZtHv9BMJECZCYSEhfhuVFhYxDCM8JhYue6dNvGA/QZVMJge/yWDB /ZVxlq8yA59GrrmbUE3BsHeRioyX5VR1RHH/JZYdO7uwxc5juUWIhkL56vscNRFw7eZK VD5hfsHiuPC5nU11qmwZlbUgtwqCgBof3uLQnSJf4yEu0pFKZTy3zssy2my5cPWjhKvO ycbfwkpprxPJE9lMw9GRuRhxF8VbgxvYB5LZlqhgonEmz0DkP5urdN+pVOkvEBwUUwot 7B5px5vBdI3Iy7Y5BTQ65Ged3RE1nCqW8c3k1l6tjFTZTACFG5bPbNoyPJ6nGvDNJl/1 GDaA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="sQ6YD/5/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q22-20020a170906771600b0078da3218b54si26659366ejm.171.2022.10.24.05.21.41; Mon, 24 Oct 2022 05:22:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="sQ6YD/5/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233158AbiJXMQx (ORCPT + 99 others); Mon, 24 Oct 2022 08:16:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50692 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233400AbiJXMPB (ORCPT ); Mon, 24 Oct 2022 08:15:01 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 08EDC7962F; Mon, 24 Oct 2022 04:55:46 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 8A60061252; Mon, 24 Oct 2022 11:55:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A062EC433D6; Mon, 24 Oct 2022 11:55:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612537; bh=Nrjzs/H2egeDQFrckuWu56rSL09kwzfFao0QMA0ZHHY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sQ6YD/5/Z7h2HP9Z81MG/4R7lL7UzjXPJOk4NnjV+7WVffOG3JXfs2eMHR11NvP3E Bi6NfNsLNV8NbXkw5N6ikHE/XF8WV93Nmd2WUweQWaiIe6YkZ3xJPb2mjv8V8PmbWu MY5udkiLQTBaqQK6kh6xdqRYba/L2ZzRDYqZkoiQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Krzysztof Kozlowski , Stephen Boyd , Bjorn Andersson , Andrew Chernyakov Subject: [PATCH 4.19 017/229] rpmsg: qcom: glink: replace strncpy() with strscpy_pad() Date: Mon, 24 Oct 2022 13:28:56 +0200 Message-Id: <20221024112959.697830355@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747571572433438547?= X-GMAIL-MSGID: =?utf-8?q?1747571572433438547?= From: Krzysztof Kozlowski commit 766279a8f85df32345dbda03b102ca1ee3d5ddea upstream. The use of strncpy() is considered deprecated for NUL-terminated strings[1]. Replace strncpy() with strscpy_pad(), to keep existing pad-behavior of strncpy, similarly to commit 08de420a8014 ("rpmsg: glink: Replace strncpy() with strscpy_pad()"). This fixes W=1 warning: In function ‘qcom_glink_rx_close’, inlined from ‘qcom_glink_work’ at ../drivers/rpmsg/qcom_glink_native.c:1638:4: drivers/rpmsg/qcom_glink_native.c:1549:17: warning: ‘strncpy’ specified bound 32 equals destination size [-Wstringop-truncation] 1549 | strncpy(chinfo.name, channel->name, sizeof(chinfo.name)); [1] https://www.kernel.org/doc/html/latest/process/deprecated.html#strncpy-on-nul-terminated-strings Signed-off-by: Krzysztof Kozlowski Reviewed-by: Stephen Boyd Signed-off-by: Bjorn Andersson Link: https://lore.kernel.org/r/20220519073330.7187-1-krzysztof.kozlowski@linaro.org Signed-off-by: Andrew Chernyakov Signed-off-by: Greg Kroah-Hartman --- drivers/rpmsg/qcom_glink_native.c | 2 +- drivers/rpmsg/qcom_smd.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) --- a/drivers/rpmsg/qcom_glink_native.c +++ b/drivers/rpmsg/qcom_glink_native.c @@ -1472,7 +1472,7 @@ static void qcom_glink_rx_close(struct q cancel_work_sync(&channel->intent_work); if (channel->rpdev) { - strncpy(chinfo.name, channel->name, sizeof(chinfo.name)); + strscpy_pad(chinfo.name, channel->name, sizeof(chinfo.name)); chinfo.src = RPMSG_ADDR_ANY; chinfo.dst = RPMSG_ADDR_ANY; --- a/drivers/rpmsg/qcom_smd.c +++ b/drivers/rpmsg/qcom_smd.c @@ -1073,7 +1073,7 @@ static int qcom_smd_create_device(struct /* Assign public information to the rpmsg_device */ rpdev = &qsdev->rpdev; - strncpy(rpdev->id.name, channel->name, RPMSG_NAME_SIZE); + strscpy_pad(rpdev->id.name, channel->name, RPMSG_NAME_SIZE); rpdev->src = RPMSG_ADDR_ANY; rpdev->dst = RPMSG_ADDR_ANY; @@ -1304,7 +1304,7 @@ static void qcom_channel_state_worker(st spin_unlock_irqrestore(&edge->channels_lock, flags); - strncpy(chinfo.name, channel->name, sizeof(chinfo.name)); + strscpy_pad(chinfo.name, channel->name, sizeof(chinfo.name)); chinfo.src = RPMSG_ADDR_ANY; chinfo.dst = RPMSG_ADDR_ANY; rpmsg_unregister_device(&edge->dev, &chinfo); From patchwork Mon Oct 24 11:28:57 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8691 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp422568wru; Mon, 24 Oct 2022 05:22:57 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6a9R/j/LxoXs+VpwW4J3RFeSSh+YIxmvhW4B9lrCU0peFKdT2LYC8XEIUaVv7TvWfMpx4w X-Received: by 2002:a50:a44c:0:b0:45c:6451:363d with SMTP id v12-20020a50a44c000000b0045c6451363dmr30574686edb.115.1666614177436; Mon, 24 Oct 2022 05:22:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666614177; cv=none; d=google.com; s=arc-20160816; b=fZZRh9Dye5W8l4QPAyYKFnIHe17KAFMrfGmLLq8lOUd82ggshsPy3NNssKxxqQ2fDh lCnGTyTMZnHMZ2lJ3hmXTL/Y1G523NEpteU+MWR5Fbfz7z3Pk9owZSdNeDs+qk7v0ndJ SUF1s0fxWPEREWagM6lqMFpXTf9RR/3kQsAgURwbiGt2vkQgTA19x2Zh8pXQk7SGgPu6 KY8Z6VHzK1dFa14+PRKurgjenzIFaYcefT69f8S71dhrDEGzEqW+MC57KRLx689zF1/v 3E5PyMgf7nAZPxwi5UXx5Q+ZOkIZOWhv72yVdHhUyvgckEgXKIKLLPek5VqwmSD3PghJ 6rVA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=rOBkAhKcePJSZfI0be+tPaBSsuf21vdCx3kTaKZI1w8=; b=iTEpyqgZoiG0WaJcMtDY5mexVpGb1NqIan5Jj76nSbeYwOEolfS/q7LiBTqNZl4U9E veSWu+vPEva3AWRDAwzzKf6LA23VrcobD9+y5PKlx9slwZwsToCNb0c2Qf/I8dqMI3tk 9yD/WNCCECJJs8+agcDO4B/n6+KcGxNZVnjS8DhnAHdG8vomtHc5ZEoAU4QFy+ygb1M1 bK8DCvwe2CGKoxHoV86XDc9oksojWuWaUV/zZDKHqp5TEUa1jnwJx0foGrDUUJeGia6V ZbPim+btipoEBLneisIKbQ6BXO+RFVBqBLxMOq5ksRczq86DMk65jvg0qX/LXh9F8WbZ fQVQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=irx3rxgJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id jg16-20020a170907971000b00782686da1d1si26661140ejc.761.2022.10.24.05.22.33; Mon, 24 Oct 2022 05:22:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=irx3rxgJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233404AbiJXMVe (ORCPT + 99 others); Mon, 24 Oct 2022 08:21:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40674 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233483AbiJXMTk (ORCPT ); Mon, 24 Oct 2022 08:19:40 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3FE1282D14; Mon, 24 Oct 2022 04:58:02 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id ED61F6129E; Mon, 24 Oct 2022 11:56:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 08E1EC433C1; Mon, 24 Oct 2022 11:56:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612566; bh=F//YHv1bkUtABcaNo0CCRonpfHuEaxZGVHMrMkrR4lY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=irx3rxgJzsVnCmLHJ6evza4kILRLkyt+7bdDU/PUq2mozPOu39yDa97x+uOYvEa5A dEs1kNtYW+3KBRjSH+tg79A2feGobG+uLZRxM7UamsHJ6KsWr5AJzv1YcfPmld7npz xG3hedm6vN3d290U9UgcvzVSaFH7kCgyzhhk9QhE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ryusuke Konishi , syzbot+2b32eb36c1a825b7a74c@syzkaller.appspotmail.com, Tetsuo Handa , Andrew Morton Subject: [PATCH 4.19 018/229] nilfs2: fix NULL pointer dereference at nilfs_bmap_lookup_at_level() Date: Mon, 24 Oct 2022 13:28:57 +0200 Message-Id: <20221024112959.727858779@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747571627583661694?= X-GMAIL-MSGID: =?utf-8?q?1747571627583661694?= From: Ryusuke Konishi commit 21a87d88c2253350e115029f14fe2a10a7e6c856 upstream. If the i_mode field in inode of metadata files is corrupted on disk, it can cause the initialization of bmap structure, which should have been called from nilfs_read_inode_common(), not to be called. This causes a lockdep warning followed by a NULL pointer dereference at nilfs_bmap_lookup_at_level(). This patch fixes these issues by adding a missing sanitiy check for the i_mode field of metadata file's inode. Link: https://lkml.kernel.org/r/20221002030804.29978-1-konishi.ryusuke@gmail.com Signed-off-by: Ryusuke Konishi Reported-by: syzbot+2b32eb36c1a825b7a74c@syzkaller.appspotmail.com Reported-by: Tetsuo Handa Tested-by: Ryusuke Konishi Cc: Signed-off-by: Andrew Morton Signed-off-by: Greg Kroah-Hartman --- fs/nilfs2/inode.c | 2 ++ 1 file changed, 2 insertions(+) --- a/fs/nilfs2/inode.c +++ b/fs/nilfs2/inode.c @@ -451,6 +451,8 @@ int nilfs_read_inode_common(struct inode inode->i_atime.tv_nsec = le32_to_cpu(raw_inode->i_mtime_nsec); inode->i_ctime.tv_nsec = le32_to_cpu(raw_inode->i_ctime_nsec); inode->i_mtime.tv_nsec = le32_to_cpu(raw_inode->i_mtime_nsec); + if (nilfs_is_metadata_file_inode(inode) && !S_ISREG(inode->i_mode)) + return -EIO; /* this inode is for metadata and corrupted */ if (inode->i_nlink == 0) return -ESTALE; /* this inode is deleted */ From patchwork Mon Oct 24 11:28:58 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8782 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp430721wru; Mon, 24 Oct 2022 05:42:10 -0700 (PDT) X-Google-Smtp-Source: AMsMyM77eDv7m7KqWHHdP6WOXV4u0Tm0xT/eRB70VgCklR50u6KB8S5qmuwM4/GzlhbzQdAxMf2c X-Received: by 2002:a17:902:c94d:b0:186:a7d7:c50 with SMTP id i13-20020a170902c94d00b00186a7d70c50mr5322972pla.72.1666615329632; Mon, 24 Oct 2022 05:42:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666615329; cv=none; d=google.com; s=arc-20160816; b=L/vVkngimYS0gmmdAb989dQsISAw1aRXSrwBe40cH7VbayxjSMfxTViE+OMIAvuzch yoY5HuJdr2FpzBYonbKQRDhXLXQEgQtAC2JQbD/cHtB2D1ZyzAQ+zEpEQQxrE8K3SORm TB9rInc6/V892dt2KjdjJcp4sW56GZKXayJPnyXZqbjodzW96kYqhBIzYlD/aKMPpYzJ IX7vL9RkYJSfYOjdlNpZDP33qWhy1CFWz/R73hnyreF0DeNAjGK5LOouhGks+GU9KCpo AmZckp5PN3d6d1EVHnzEW7p34iXmCaFeUBKlTHoyp9u4LiMOmjZfC36CNsLcZ6ARG39P aT7Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=2b2/wfbgbXHKU9tF9t50KaWRwLvzMNyAJEdOZl2R4UA=; b=geK0K0qsh3NJNsTKDz2x+PrB3jz3scWnSSVcZpkj847QJwZpHXObwWUGJQS+0RoOow PH7b2zf0EpbLQQO0yKiZ5wSBGeDMuzxURUUueuEPhdOk2TO6MuGt+fMk/sVTiL9c2suV wZNqvJrz+EllcC2RQS8bNGRftZZ0sJcVsYgVPKItjG6hVHSSouCxI8PxxHRtp0zVL4LM hw/Rnql38QsdXhCf1ntI4wW6zSEQ+quhBLyRvRDHfk9iCkfmgbJcs7zOaj/lAG80MCTA 8hBExtUgEBaGjBfipZEXFJpPSpn0xzSeuUGqJatlxyYpzWXv1pcTuMvPrMKvWSYpks2F dEsQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=NCzedvpQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h7-20020a635307000000b00450200a1078si36346905pgb.853.2022.10.24.05.41.55; Mon, 24 Oct 2022 05:42:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=NCzedvpQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233798AbiJXM2R (ORCPT + 99 others); Mon, 24 Oct 2022 08:28:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60586 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230499AbiJXM1I (ORCPT ); Mon, 24 Oct 2022 08:27:08 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 102C37B1E0; Mon, 24 Oct 2022 05:01:32 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id B82BBB811D7; Mon, 24 Oct 2022 11:56:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 180B8C433C1; Mon, 24 Oct 2022 11:56:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612595; bh=4/0gbWRoGgXhcpCItadg29FCqoOIDIWdJPHkOeinRzA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NCzedvpQOFX7vgVeWYxiERiZXxGvG2QJWpJV9E8NtnmZqgYjOiXbmjRF85mjxxIE0 G8bB5Ntca/w00xPVJ9g9UHNzoNe2X0qDo1rXLJW5WjvSTrd38Ln4tFHpf7ImPOrCfO 9ts6bXV52/UfBgy1S/Xs0Pgpciu2OgzgPGOE5pwA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ryusuke Konishi , syzbot+7381dc4ad60658ca4c05@syzkaller.appspotmail.com, Andrew Morton Subject: [PATCH 4.19 019/229] nilfs2: fix leak of nilfs_root in case of writer thread creation failure Date: Mon, 24 Oct 2022 13:28:58 +0200 Message-Id: <20221024112959.757408197@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747572835684650630?= X-GMAIL-MSGID: =?utf-8?q?1747572835684650630?= From: Ryusuke Konishi commit d0d51a97063db4704a5ef6bc978dddab1636a306 upstream. If nilfs_attach_log_writer() failed to create a log writer thread, it frees a data structure of the log writer without any cleanup. After commit e912a5b66837 ("nilfs2: use root object to get ifile"), this causes a leak of struct nilfs_root, which started to leak an ifile metadata inode and a kobject on that struct. In addition, if the kernel is booted with panic_on_warn, the above ifile metadata inode leak will cause the following panic when the nilfs2 kernel module is removed: kmem_cache_destroy nilfs2_inode_cache: Slab cache still has objects when called from nilfs_destroy_cachep+0x16/0x3a [nilfs2] WARNING: CPU: 8 PID: 1464 at mm/slab_common.c:494 kmem_cache_destroy+0x138/0x140 ... RIP: 0010:kmem_cache_destroy+0x138/0x140 Code: 00 20 00 00 e8 a9 55 d8 ff e9 76 ff ff ff 48 8b 53 60 48 c7 c6 20 70 65 86 48 c7 c7 d8 69 9c 86 48 8b 4c 24 28 e8 ef 71 c7 00 <0f> 0b e9 53 ff ff ff c3 48 81 ff ff 0f 00 00 77 03 31 c0 c3 53 48 ... Call Trace: ? nilfs_palloc_freev.cold.24+0x58/0x58 [nilfs2] nilfs_destroy_cachep+0x16/0x3a [nilfs2] exit_nilfs_fs+0xa/0x1b [nilfs2] __x64_sys_delete_module+0x1d9/0x3a0 ? __sanitizer_cov_trace_pc+0x1a/0x50 ? syscall_trace_enter.isra.19+0x119/0x190 do_syscall_64+0x34/0x80 entry_SYSCALL_64_after_hwframe+0x63/0xcd ... Kernel panic - not syncing: panic_on_warn set ... This patch fixes these issues by calling nilfs_detach_log_writer() cleanup function if spawning the log writer thread fails. Link: https://lkml.kernel.org/r/20221007085226.57667-1-konishi.ryusuke@gmail.com Fixes: e912a5b66837 ("nilfs2: use root object to get ifile") Signed-off-by: Ryusuke Konishi Reported-by: syzbot+7381dc4ad60658ca4c05@syzkaller.appspotmail.com Tested-by: Ryusuke Konishi Cc: Signed-off-by: Andrew Morton Signed-off-by: Greg Kroah-Hartman --- fs/nilfs2/segment.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) --- a/fs/nilfs2/segment.c +++ b/fs/nilfs2/segment.c @@ -2786,10 +2786,9 @@ int nilfs_attach_log_writer(struct super inode_attach_wb(nilfs->ns_bdev->bd_inode, NULL); err = nilfs_segctor_start_thread(nilfs->ns_writer); - if (err) { - kfree(nilfs->ns_writer); - nilfs->ns_writer = NULL; - } + if (unlikely(err)) + nilfs_detach_log_writer(sb); + return err; } From patchwork Mon Oct 24 11:28:59 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8962 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp436761wru; Mon, 24 Oct 2022 05:58:05 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7mSYOZ8hkZrCmRhje3HaXaa/YHk0iqj+7+1bRhXhhc1otQsvyG1uFgQ5nKuJpIQsTdU38O X-Received: by 2002:a63:9144:0:b0:45f:c9f5:1bb with SMTP id l65-20020a639144000000b0045fc9f501bbmr27257055pge.165.1666616285679; Mon, 24 Oct 2022 05:58:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666616285; cv=none; d=google.com; s=arc-20160816; b=JXt5ilsROhiwnq62bMR1jRWmlvBxOpe17kIQfIEq4jIPwkjnhjp9YnSDRS9hR6GCeG LKy3x3F6FbHC41Pizx2i+KPec4gKpMjScE1fagXb/pAV1xOmCmh57LUJdZfpVaCy/314 45q0Oz+rCv5tmbX/d0UQ5jsEzf3DF49psi8k/J11YWTEjcv1h6K15PfNWygtuEqDPklN qDg5cGp+SGS1W59Vs3sC4mdyrbH5VD6E42HdXzKj/z7cHTodvPNigYE+BGEMAIHHx39W QVxpATr6HVAeMeNJvB+EdejMtzdnA2Mj1+rQ+FzIWt7FzfPBDxWp8P3KrypuCYyhy/KO bc4g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=kSkOSNfZFT7Qfmz2zilc5ELgLBIkqCQTebf1ovSKwEA=; b=SFwGEw9NZLkOXdq2Hkn67i8axPnQlFLZp4rlMQBcQuLiPF6bg0CBN3IMsi+Kr2Dbwm MDWuqo0FGlCn6mrKJ3BjhkuTogFnC2TfSM3rXMzQoeZrGNRIdUbRdORVMsx/Sw/xogYG fkx5rRvLsN7YhRuButhZe8WLFsKwSUkz8eT9AKzIw4dg7+luQZxXvNqEQ9tXGixKfd4j b1u4l1+zcBV0c/WtE6t+IeiAaUnJagdrX3ndHtUoKdU18BWH5/FehCBkhkmB1EXVWCRk SUlMo53xQe4dfunN3pr3ABrd1AFBNitpuZNgYp1ptxTJI78X0949dat6ccNFCOvN7MVe 4AgA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="ge9O/pTE"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b7-20020a170902b60700b0017f685c2e4dsi31231784pls.136.2022.10.24.05.57.49; Mon, 24 Oct 2022 05:58:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="ge9O/pTE"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234743AbiJXMzI (ORCPT + 99 others); Mon, 24 Oct 2022 08:55:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60698 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234946AbiJXMyW (ORCPT ); Mon, 24 Oct 2022 08:54:22 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CB20D14D2E; Mon, 24 Oct 2022 05:14:49 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 23004612B3; Mon, 24 Oct 2022 11:56:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 348DFC433D6; Mon, 24 Oct 2022 11:56:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612606; bh=5/+T7+Hbc+gs+Q2MxLjLyv7qCijM55C8bgamH/I/2XQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ge9O/pTENp2klJzHO4VlyiHqLK3YDCVeS45Wt6/+sEumoQ9FwY/Wg56ridGV1/G+B 6Msr6nl1wtyO74eKN4IaF+8t4f1W2tXpWGcC5dCHDKrJJ09l9leMmGfOZ1rOd0YHim 7stdK2V+zCQxH6F652gIUO24ZIId/IZkx15uLxpk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ryusuke Konishi , syzbot+fbb3e0b24e8dae5a16ee@syzkaller.appspotmail.com, Andrew Morton Subject: [PATCH 4.19 020/229] nilfs2: replace WARN_ONs by nilfs_error for checkpoint acquisition failure Date: Mon, 24 Oct 2022 13:28:59 +0200 Message-Id: <20221024112959.796764482@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747573837940634316?= X-GMAIL-MSGID: =?utf-8?q?1747573837940634316?= From: Ryusuke Konishi commit 723ac751208f6d6540191689cfbf6c77135a7a1b upstream. If creation or finalization of a checkpoint fails due to anomalies in the checkpoint metadata on disk, a kernel warning is generated. This patch replaces the WARN_ONs by nilfs_error, so that a kernel, booted with panic_on_warn, does not panic. A nilfs_error is appropriate here to handle the abnormal filesystem condition. This also replaces the detected error codes with an I/O error so that neither of the internal error codes is returned to callers. Link: https://lkml.kernel.org/r/20220929123330.19658-1-konishi.ryusuke@gmail.com Signed-off-by: Ryusuke Konishi Reported-by: syzbot+fbb3e0b24e8dae5a16ee@syzkaller.appspotmail.com Signed-off-by: Andrew Morton Signed-off-by: Greg Kroah-Hartman --- fs/nilfs2/segment.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) --- a/fs/nilfs2/segment.c +++ b/fs/nilfs2/segment.c @@ -880,9 +880,11 @@ static int nilfs_segctor_create_checkpoi nilfs_mdt_mark_dirty(nilfs->ns_cpfile); nilfs_cpfile_put_checkpoint( nilfs->ns_cpfile, nilfs->ns_cno, bh_cp); - } else - WARN_ON(err == -EINVAL || err == -ENOENT); - + } else if (err == -EINVAL || err == -ENOENT) { + nilfs_error(sci->sc_super, + "checkpoint creation failed due to metadata corruption."); + err = -EIO; + } return err; } @@ -896,7 +898,11 @@ static int nilfs_segctor_fill_in_checkpo err = nilfs_cpfile_get_checkpoint(nilfs->ns_cpfile, nilfs->ns_cno, 0, &raw_cp, &bh_cp); if (unlikely(err)) { - WARN_ON(err == -EINVAL || err == -ENOENT); + if (err == -EINVAL || err == -ENOENT) { + nilfs_error(sci->sc_super, + "checkpoint finalization failed due to metadata corruption."); + err = -EIO; + } goto failed_ibh; } raw_cp->cp_snapshot_list.ssl_next = 0; From patchwork Mon Oct 24 11:29:00 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8885 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp433547wru; Mon, 24 Oct 2022 05:49:53 -0700 (PDT) X-Google-Smtp-Source: AMsMyM45nAp1UwsHvLIWGl9KSVejsDXGUfIuKE4CxZtziDOWG4v35k11ksdhSlTso4PU/xqKGwO+ X-Received: by 2002:a17:902:e804:b0:186:5736:2b70 with SMTP id u4-20020a170902e80400b0018657362b70mr27420948plg.127.1666615792858; Mon, 24 Oct 2022 05:49:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666615792; cv=none; d=google.com; s=arc-20160816; b=j3+xHrXyTXMp2grGy3JgNrFwWoaLap6vQD9oN9QfjOImG/VEBB2ir0ojS9M7PKbcAq ZisJMOly5begWr/hFKCvGbg5LJYv/phoCdeiQ0cIdKuYufGcBwdVTBx5ng4OjTHVnLga xK/WP/qUchbFFAI4+wjMvA+IXmt+KyaIJ4abRbqleLMbWkcPr0/VVTOa6P7xKGCOYVo4 1qt2PoT9ZLFIqCf8jH16H4MR0UX7JE3x+1Mf5+SRqUElpndFoawwRxzbbzFUvaR0B0de l78NwPy3Ai4KFWJFKtwzhU6kuNhet0qkmE2pidhgYuSOv9a3gQc+C88kTG7eNGk0tmrs dwjA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=JsgkDUA1EV3JxPLkguaDFJmRlht2o2HwjqJcgXNpNpc=; b=aYf5E58FGsf02Hm5XToS02k9LZKVT4sriGROYspgrebhfdiuVsa7Zr4Al/43CKfDSQ bRzSpGQCfsaWfSscqxaPPRdbNlaWav75HHyndGGyLiRqn3WZynDIYwn37kjKzwAS1MWd I+vo21tk+/vCwh59SdmC2JARIT9I7FO1XnnEKQQbMNL13qFg5xYtLnUpOOu/aykasS1j e6o5kDcAOFHt2D1dUbH/hv9fsUNGZdG56oiecY9Zizrz/apZP6I3WgjdF5VS+gKXfu+x wX1QNMDkuMZ9/sWWGeHvfv2mDGcCCnJOHM5w/BCdKR/pmRZguHrO6vopv41mHfBt2mdV d6mg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=urhT5Zua; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m6-20020a17090b068600b00212fd5f1ad5si5014021pjz.160.2022.10.24.05.49.39; Mon, 24 Oct 2022 05:49:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=urhT5Zua; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234198AbiJXMni (ORCPT + 99 others); Mon, 24 Oct 2022 08:43:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37504 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234081AbiJXMlz (ORCPT ); Mon, 24 Oct 2022 08:41:55 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 720C28A7FB; Mon, 24 Oct 2022 05:08:34 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id B0581612B9; Mon, 24 Oct 2022 11:56:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C03D2C433D6; Mon, 24 Oct 2022 11:56:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612609; bh=2Q21U+OZtgQgt7+d3W97F/pzkhbw11NkEC8p2AfJ2q0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=urhT5ZuajtL4XZ+Y1udKcnzab0aupcjTfsS6nF4Pp4F923OghplBappwQTQWHI0Fl om6tsh963BgZ9juqga7Q9Hg3gFSoI6rzFB38SBhRG9kJsm7iEcyQJ2BED8/hSmSDms 0BI1/8FNIpzfzaZopawAjIRFZCSZfwoTL6g/av3w= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hu Weiwen , Xiubo Li , Ilya Dryomov Subject: [PATCH 4.19 021/229] ceph: dont truncate file in atomic_open Date: Mon, 24 Oct 2022 13:29:00 +0200 Message-Id: <20221024112959.826609588@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747573321511967942?= X-GMAIL-MSGID: =?utf-8?q?1747573321511967942?= From: Hu Weiwen commit 7cb9994754f8a36ae9e5ec4597c5c4c2d6c03832 upstream. Clear O_TRUNC from the flags sent in the MDS create request. `atomic_open' is called before permission check. We should not do any modification to the file here. The caller will do the truncation afterward. Fixes: 124e68e74099 ("ceph: file operations") Signed-off-by: Hu Weiwen Reviewed-by: Xiubo Li Signed-off-by: Ilya Dryomov [Xiubo: fixed a trivial conflict for 5.10 backport] Signed-off-by: Xiubo Li Signed-off-by: Greg Kroah-Hartman --- fs/ceph/file.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) --- a/fs/ceph/file.c +++ b/fs/ceph/file.c @@ -446,6 +446,12 @@ int ceph_atomic_open(struct inode *dir, if (dentry->d_name.len > NAME_MAX) return -ENAMETOOLONG; + /* + * Do not truncate the file, since atomic_open is called before the + * permission check. The caller will do the truncation afterward. + */ + flags &= ~O_TRUNC; + if (flags & O_CREAT) { if (ceph_quota_is_max_files_exceeded(dir)) return -EDQUOT; @@ -478,9 +484,7 @@ int ceph_atomic_open(struct inode *dir, req->r_parent = dir; set_bit(CEPH_MDS_R_PARENT_LOCKED, &req->r_req_flags); - err = ceph_mdsc_do_request(mdsc, - (flags & (O_CREAT|O_TRUNC)) ? dir : NULL, - req); + err = ceph_mdsc_do_request(mdsc, (flags & O_CREAT) ? dir : NULL, req); err = ceph_handle_snapdir(req, dentry, err); if (err) goto out_req; From patchwork Mon Oct 24 11:29:01 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8710 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp423089wru; Mon, 24 Oct 2022 05:24:04 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7YJrOvJmXzWpg8egKKjV+AO9MIxRTlTjTkb1dnPldd5ij/Zs9HxWDH/Qbmf/ittaR4ofrJ X-Received: by 2002:a17:90b:1e03:b0:20d:7f0:7671 with SMTP id pg3-20020a17090b1e0300b0020d07f07671mr37404159pjb.174.1666614244460; Mon, 24 Oct 2022 05:24:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666614244; cv=none; d=google.com; s=arc-20160816; b=u7sg6yJuC5m6xkNNJUC4BJ4KDAK/xe57IU2mhjpU2BTEYz9QdeSkifijW/3rfz9OY8 nkU3KmQ4SNJCFwaxF0C4r6GyHMLdtybJTwvbEkZVA6iCHybm3IlSItovAG9d6wk0OXDs 1v5UWvDnT5L1DQIGB9oUIPyDBf7zMH6u0jXHMsLEe136MVG6G5XFM4WMTOpeKqCEB4RZ gwwkV51iOERNilOKA0lor1zaYJSdMdSTLkCM3SWO7yoLK/nDVp52oiK94FZ0j/372adi j6kygTYYmpTHh3p1Ns2ld7aUutvP22YenNC2/o+DvWENbAeXta4BGWNlJkL/zA7/FVQe wp5Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=pmf6mzXEJEilQdJUZRxaNdE4ILcO7NZa149O8jke8BI=; b=MGPfHynmn9GvaBQrYDIs/KPTU3hCVbSHVADCwRZsfM5dcO8OybIzKxSBMe6WdflY0B FJkg5bzkQruQJ2cBmYueGlyyPoQsmS84UDwvKsUZ9ybFNaa+fHrUhPzN7GR6koWcEVd1 EXqcNWgwr8NqtjcTNptEF5MbiPJ8j28CMVA4ALoygZcgYUaeVsXLApUUTJDDVAThNPhp PtY6malAsO9VDV5TBXFNjer/79LUDh/e/yqlAIYmnqykclHvPAyHRIvVziNC1HJvOrcr CsCu9OUWD8laEnO4TGaDxu6HKB/mZP1/SXwf5jgfRwyPVVQT5EQRypesOiZ0trbwPY4l hsFQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=lL7JG+Aa; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q8-20020a654948000000b0045d1aa2a589si36416855pgs.840.2022.10.24.05.23.50; Mon, 24 Oct 2022 05:24:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=lL7JG+Aa; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233337AbiJXMW4 (ORCPT + 99 others); Mon, 24 Oct 2022 08:22:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37440 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233339AbiJXMUx (ORCPT ); Mon, 24 Oct 2022 08:20:53 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2250C7B5AF; Mon, 24 Oct 2022 04:59:08 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 44567612F4; Mon, 24 Oct 2022 11:56:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 57A0DC433C1; Mon, 24 Oct 2022 11:56:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612611; bh=Sf4p/I5+I0rasfxMUpNRv3gda7JlSUROFiBRNveWqCk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lL7JG+AadCkavVvKX5AoANZP4mRPuBxUOaE/3UUoV46dwNGfVkZQeZLfgQaipgxhQ owgQPHBx5qLocySI/ug5q/nPBqhJrpg+9bhpCCPJZv6dL+P00zCvlLLBwhC3opuV1t nze3fg1tjoXm5QgwNvcjxUa4iX9IoEwf8tMeeCkI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Jason A. Donenfeld" Subject: [PATCH 4.19 022/229] random: clamp credited irq bits to maximum mixed Date: Mon, 24 Oct 2022 13:29:01 +0200 Message-Id: <20221024112959.856505864@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747571698393172111?= X-GMAIL-MSGID: =?utf-8?q?1747571698393172111?= From: Jason A. Donenfeld commit e78a802a7b4febf53f2a92842f494b01062d85a8 upstream. Since the most that's mixed into the pool is sizeof(long)*2, don't credit more than that many bytes of entropy. Fixes: e3e33fc2ea7f ("random: do not use input pool from hard IRQs") Cc: stable@vger.kernel.org Signed-off-by: Jason A. Donenfeld Signed-off-by: Greg Kroah-Hartman --- drivers/char/random.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/char/random.c +++ b/drivers/char/random.c @@ -976,7 +976,7 @@ static void mix_interrupt_randomness(str local_irq_enable(); mix_pool_bytes(pool, sizeof(pool)); - credit_init_bits(max(1u, (count & U16_MAX) / 64)); + credit_init_bits(clamp_t(unsigned int, (count & U16_MAX) / 64, 1, sizeof(pool) * 8)); memzero_explicit(pool, sizeof(pool)); } From patchwork Mon Oct 24 11:29:02 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 10297 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp654329wru; Mon, 24 Oct 2022 14:12:00 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6JSGQfHPgUjAVUakdtw3adcdADjQR+3e53ub7YZdSM+qB4nA82QqWRrMxGhcK3ktspAxsE X-Received: by 2002:a17:90b:2741:b0:20a:ebc3:6513 with SMTP id qi1-20020a17090b274100b0020aebc36513mr41518200pjb.29.1666645919857; Mon, 24 Oct 2022 14:11:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666645919; cv=none; d=google.com; s=arc-20160816; b=t24nzQsuxCCJ6kmhpYK8fWZFfgMl390O/XtjpYcShV5X0YCV+Bi0EecAzr+WzvzMH0 ZyzFoFQYJUZFyUm4n6WHMqEk1vGiS38D/mT8KPnXGPGfVrMSvkQAnqDN1tDNvMDs7xvc S8VWJSMWgfsr4hjkOPdswg+XlYLtOcSC385JMT8iU7X7UxOlpNwMrnPN2jd0Fry75Yqa 4HGr/3IooiPt8KScb/pJqMDyLTll+atr5NTlSCkq0h3uVriCNsxCnjCjiSRP8paDMLHm B/JQOn2Kh4PC7/RXYv9pJByaIH6+Ht+zgZlnDQ9qBLUv/jez8FvKPFpPLIpm3xL0kbfY PNjw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=r66xg6lfmnt2LWIH7rWF9mXF3VBGFssYCnkEIGhOO3Q=; b=OmMT0XWoK3BsblyqGU37Q0u1DkexiY1K9jDmiF1IsAVaQfQwA0KrpUuwtPoWHnyGzo wd+DGWlrDQegwYCBDZBfL56P3gwzgBIPmisyVL7r2QFdHHzykJPL9Iw5rylPr0+iPYbU 8WW6YrFnOTmCesriR25bNQ623hPxihlzlFHxSB6+YGlQbjPnZ1WINGp8FTTlpCf8/gBm GWLHfz3WdPyJ+A+TtLlDBnPI0Vm0X8XRJhCLNvdRTpFnYUvzvFmDID2a9H/DGUSZXCOz taoaKe873Z7gm/3nFH567Rl5By+XB6SXUGN2gEI+jGXRJNHicAQfadTClPHdcnpoDLKf gprA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=mUhlY4kh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y3-20020a170902cac300b0017340861a6bsi503815pld.611.2022.10.24.14.11.44; Mon, 24 Oct 2022 14:11:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=mUhlY4kh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233794AbiJXUxm (ORCPT + 99 others); Mon, 24 Oct 2022 16:53:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53274 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235126AbiJXUxS (ORCPT ); Mon, 24 Oct 2022 16:53:18 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C37C64C01C; Mon, 24 Oct 2022 11:59:57 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id CFC4A612D3; Mon, 24 Oct 2022 11:56:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E66EBC433D6; Mon, 24 Oct 2022 11:56:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612614; bh=UOXF6r60LZMSfW1hV/2thug7CAKN/lJDdqAzbNeAB/c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mUhlY4kh7jK3ctKy85nI9Sbx5s5mB5v1y4BArFu5siUY0TZk6WDJ+Kqw93xaxUp9C ckSFkbi07a903EkY6b/XWzWncEm1OFSqeBtlqD5UcC7WTeysqy/qNLHjvv38kWRA4w TTAe47oatNUZVtdpwdYujQpx3Jy8yK2JUT6iY0Gg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Takashi Iwai , Hans de Goede Subject: [PATCH 4.19 023/229] ALSA: hda: Fix position reporting on Poulsbo Date: Mon, 24 Oct 2022 13:29:02 +0200 Message-Id: <20221024112959.895135654@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747604912226323185?= X-GMAIL-MSGID: =?utf-8?q?1747604912226323185?= From: Takashi Iwai commit 56e696c0f0c71b77fff921fc94b58a02f0445b2c upstream. Hans reported that his Sony VAIO VPX11S1E showed the broken sound behavior at the start of the stream for a couple of seconds, and it turned out that the position_fix=1 option fixes the issue. It implies that the position reporting is inaccurate, and very likely hitting on all Poulsbo devices. The patch applies the workaround for Poulsbo generically to switch to LPIB mode instead of the default position buffer. Reported-and-tested-by: Hans de Goede Cc: Link: https://lore.kernel.org/r/3e8697e1-87c6-7a7b-d2e8-b21f1d2f181b@redhat.com Link: https://lore.kernel.org/r/20221001142124.7241-1-tiwai@suse.de Signed-off-by: Takashi Iwai Signed-off-by: Greg Kroah-Hartman --- sound/pci/hda/hda_intel.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/sound/pci/hda/hda_intel.c +++ b/sound/pci/hda/hda_intel.c @@ -2638,7 +2638,8 @@ static const struct pci_device_id azx_id .driver_data = AZX_DRIVER_SCH | AZX_DCAPS_INTEL_PCH_NOPM }, /* Poulsbo */ { PCI_DEVICE(0x8086, 0x811b), - .driver_data = AZX_DRIVER_SCH | AZX_DCAPS_INTEL_PCH_BASE }, + .driver_data = AZX_DRIVER_SCH | AZX_DCAPS_INTEL_PCH_BASE | + AZX_DCAPS_POSFIX_LPIB }, /* Oaktrail */ { PCI_DEVICE(0x8086, 0x080a), .driver_data = AZX_DRIVER_SCH | AZX_DCAPS_INTEL_PCH_BASE }, From patchwork Mon Oct 24 11:29:03 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8763 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp430359wru; Mon, 24 Oct 2022 05:41:19 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6izJ8/3xoiih9Wj0n1a4GaRxYAWiSUKUNQlfPqXAC+6NNYdeOQ8MabCjNUjTJZxId3Ggvg X-Received: by 2002:a05:6a00:1504:b0:56b:bebb:4d2f with SMTP id q4-20020a056a00150400b0056bbebb4d2fmr6480825pfu.48.1666615279107; Mon, 24 Oct 2022 05:41:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666615279; cv=none; d=google.com; s=arc-20160816; b=RlwpTpdZ6R0QnkN7aYGRL81COngZtvNI6shM4/0Bkc/kEUuye9Ja4wD5lams5h2w+u giaUqT48TNO5/PKhDQIwmM0JzeUyF1GFjUTi8WmXF8c6RpSMNKdDrwvjKMw/sbk3NqsN IYv9n4WmH55tr+V9AFx5ztv5OeTjjqSxkrPw7t/K1i7oRWBdB6NGtxlrVzkxawRirrsM 78nmEKc4PtZCfIg1p5vDLT2nYdubUuHiWZVqmS4jEe/ODAxJIeNMZPPki+2YZrCe5LQD pumS8TYeAASzvmdCraPkn7e7Hal3yhIUDKV2u/PIPCn+beGP34GvuqywBfZjswPvG+ng BbzA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=fhVmN+bFBJYuO8Pc5atW+csvgSYvL2gZWb5qraxiozM=; b=CCBa0Dgbta7ilZ5iJtuypPpG2tkQe7Fiv89+KLcGoWi8Ee4bouN1oVBTryJhMYXZcb OQHKy7WjbfeOgtBd9y8wzP6JDUbj4tueCICFEcmfSuqbUCh7Ky23+sX4YrO5bW4Raljh 3AIylDUiCBzYgkkDaxfBwqmFjxr3e3uCbxmyY2yHC1q38mJSkPXw9XrtRDDmH+HGNx22 wHeVdlph/gucxrBRgBN+27denYeIo3BkTHYS2Oz1yQcAB5VpHZCZvmWpl9YKcLtUCpaj YKI3h9HgmCqqJ/M2l0mbqS9MdB2rbbMGcf63J05c/4fbTe6rV3iHOymfYk/XuHsmmL8l C9Cw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=AAUKHaTh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f23-20020a63dc57000000b004197e33daf5si32513569pgj.863.2022.10.24.05.41.04; Mon, 24 Oct 2022 05:41:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=AAUKHaTh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233233AbiJXM2p (ORCPT + 99 others); Mon, 24 Oct 2022 08:28:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45124 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233690AbiJXM1q (ORCPT ); Mon, 24 Oct 2022 08:27:46 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9F95F7C19B; Mon, 24 Oct 2022 05:01:38 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 2E002B811E1; Mon, 24 Oct 2022 11:56:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 85F60C433C1; Mon, 24 Oct 2022 11:56:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612616; bh=us6ue9vSRt2c17tFp447DxLwrnn5iehx+Hhhpi2jCH8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AAUKHaThwI3fW7qwuJTplmapXt3T27bbsfxfaf3yTbgC8NC4qbUhobGu39VMyzWV9 pbOyvadczMx70n0ANbEXoprLwm+QE7fu6m5wBnWBha7znpwMHT/2hH4vrqWjs3rdGE POB3vqSYdVX4nxq2v6x9N7TXd5888xXQ1c/qSpFs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, stable@kernel.org, "James E.J. Bottomley" , "Martin K. Petersen" , Dan Carpenter , hdthky , Linus Torvalds Subject: [PATCH 4.19 024/229] scsi: stex: Properly zero out the passthrough command structure Date: Mon, 24 Oct 2022 13:29:03 +0200 Message-Id: <20221024112959.924166476@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747572782516122492?= X-GMAIL-MSGID: =?utf-8?q?1747572782516122492?= From: Linus Torvalds commit 6022f210461fef67e6e676fd8544ca02d1bcfa7a upstream. The passthrough structure is declared off of the stack, so it needs to be set to zero before copied back to userspace to prevent any unintentional data leakage. Switch things to be statically allocated which will fill the unused fields with 0 automatically. Link: https://lore.kernel.org/r/YxrjN3OOw2HHl9tx@kroah.com Cc: stable@kernel.org Cc: "James E.J. Bottomley" Cc: "Martin K. Petersen" Cc: Dan Carpenter Reported-by: hdthky Signed-off-by: Linus Torvalds Signed-off-by: Greg Kroah-Hartman Signed-off-by: Martin K. Petersen Signed-off-by: Greg Kroah-Hartman --- drivers/scsi/stex.c | 17 +++++++++-------- include/scsi/scsi_cmnd.h | 2 +- 2 files changed, 10 insertions(+), 9 deletions(-) --- a/drivers/scsi/stex.c +++ b/drivers/scsi/stex.c @@ -673,16 +673,17 @@ stex_queuecommand_lck(struct scsi_cmnd * return 0; case PASSTHRU_CMD: if (cmd->cmnd[1] == PASSTHRU_GET_DRVVER) { - struct st_drvver ver; + const struct st_drvver ver = { + .major = ST_VER_MAJOR, + .minor = ST_VER_MINOR, + .oem = ST_OEM, + .build = ST_BUILD_VER, + .signature[0] = PASSTHRU_SIGNATURE, + .console_id = host->max_id - 1, + .host_no = hba->host->host_no, + }; size_t cp_len = sizeof(ver); - ver.major = ST_VER_MAJOR; - ver.minor = ST_VER_MINOR; - ver.oem = ST_OEM; - ver.build = ST_BUILD_VER; - ver.signature[0] = PASSTHRU_SIGNATURE; - ver.console_id = host->max_id - 1; - ver.host_no = hba->host->host_no; cp_len = scsi_sg_copy_from_buffer(cmd, &ver, cp_len); cmd->result = sizeof(ver) == cp_len ? DID_OK << 16 | COMMAND_COMPLETE << 8 : --- a/include/scsi/scsi_cmnd.h +++ b/include/scsi/scsi_cmnd.h @@ -227,7 +227,7 @@ static inline struct scsi_data_buffer *s } static inline int scsi_sg_copy_from_buffer(struct scsi_cmnd *cmd, - void *buf, int buflen) + const void *buf, int buflen) { return sg_copy_from_buffer(scsi_sglist(cmd), scsi_sg_count(cmd), buf, buflen); From patchwork Mon Oct 24 11:29:04 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 10042 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp622657wru; Mon, 24 Oct 2022 12:46:05 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5R58/LJ2N/ODadCOn1Ek5fFLwMYK4tGATFOhJ8S8q9m42qoq6dJEGStq5mNKfhj59t+9Eb X-Received: by 2002:a17:906:7304:b0:6ff:a76:5b09 with SMTP id di4-20020a170906730400b006ff0a765b09mr28695430ejc.193.1666640765585; Mon, 24 Oct 2022 12:46:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666640765; cv=none; d=google.com; s=arc-20160816; b=C0MzzuUJFtIHE/wr7inKkAonJuXiJivab8vomVV0buSSj4ICIlwdUS9bgSqtSeSO1u 0sACw84XFCy/cZnIAR8EqfI6xKBCgL5G5CQmhMP5+l4ddmZKP3eA4uABCNj3cojEC0Wx U+BVwS3Wvjd1XD3wi1ppAdQgL97n1/Ro6kJ7CZHfgZ+4rFzOt6AT/YNGU+GNWyW1XhjK yU/hqh3Ni4f/jOcxKpD1aacG4NhketCi0aJQLzuZ0UdzNr8F8v0GGkrREsG/5uh85jli 1HA/P/zNGbpfeFaUiLcIe+irhds8GyVJEwSlYtlvv7NRWXBf19HySo+N0Ao6E1rTbIkr FUaw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=n94YcU9eJvk4YYatYbbgQVbMk25EJupsfQK6OtcSIF8=; b=Z90LtDMLlG/UUpzgMK1vLFoWwp7bJRCFzjE5C0D1UvI9fw6lRBLlRjW4LQ3LULoc9s +j+J7QJA3QZGhB4614uw2gchELKYjNAib7m9bMA/ONSRj6diRBdAg18Wr5CixIzAtPN0 65zewuA6g4cQBBI3Z5mb7brkpUCLjbsddGpXhiZQNgYyl0DK8WKytv/d3vuSmrYSPRm+ xa2KUBp6RnTn6ILT6wxthMgwrKR+MKhK+Ey7r5A3BUmI08azR1TDyR0iaF/NDEITgCX2 rojXonOCFr+7ee6AW/qbxeX9d9KiRuJ0n6qCVHzB/9kbcfAi25hxQzXV81esTjko5lQ8 vMbA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="udwI/yRA"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a70-20020a509ecc000000b00461bff75d84si571987edf.463.2022.10.24.12.45.40; Mon, 24 Oct 2022 12:46:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="udwI/yRA"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232152AbiJXTnW (ORCPT + 99 others); Mon, 24 Oct 2022 15:43:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37782 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230501AbiJXTlm (ORCPT ); Mon, 24 Oct 2022 15:41:42 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 724C026479A; Mon, 24 Oct 2022 11:11:30 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id E8CD2B811E9; Mon, 24 Oct 2022 11:57:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 506BAC433D7; Mon, 24 Oct 2022 11:56:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612619; bh=xm4dJk+a4xXbTCFuEdRLmVRDxS983Q+yBTlQeFFvqXU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=udwI/yRA9QUaubCqRvpRpy7/dMGlW1D5ZkBq0iCr6LU8V6TLy7gHZFKqlqMgHklBc dcDcuK/ZnIL2kwIR8AMPWbpgREw3t2QXGSlseuUm+EmOhcuFAiBpuRXOcfi0kuPUtU yKFGkkbiyHFQpSJO9iwV5cvIQJRNgfUeCpWF7vhk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Frank Wunderlich , Johan Hovold Subject: [PATCH 4.19 025/229] USB: serial: qcserial: add new usb-id for Dell branded EM7455 Date: Mon, 24 Oct 2022 13:29:04 +0200 Message-Id: <20221024112959.952938060@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747599507402194110?= X-GMAIL-MSGID: =?utf-8?q?1747599507402194110?= From: Frank Wunderlich commit eee48781ea199e32c1d0c4732641c494833788ca upstream. Add support for Dell 5811e (EM7455) with USB-id 0x413c:0x81c2. Signed-off-by: Frank Wunderlich Cc: stable@vger.kernel.org Signed-off-by: Johan Hovold Signed-off-by: Greg Kroah-Hartman --- drivers/usb/serial/qcserial.c | 1 + 1 file changed, 1 insertion(+) --- a/drivers/usb/serial/qcserial.c +++ b/drivers/usb/serial/qcserial.c @@ -177,6 +177,7 @@ static const struct usb_device_id id_tab {DEVICE_SWI(0x413c, 0x81b3)}, /* Dell Wireless 5809e Gobi(TM) 4G LTE Mobile Broadband Card (rev3) */ {DEVICE_SWI(0x413c, 0x81b5)}, /* Dell Wireless 5811e QDL */ {DEVICE_SWI(0x413c, 0x81b6)}, /* Dell Wireless 5811e QDL */ + {DEVICE_SWI(0x413c, 0x81c2)}, /* Dell Wireless 5811e */ {DEVICE_SWI(0x413c, 0x81cb)}, /* Dell Wireless 5816e QDL */ {DEVICE_SWI(0x413c, 0x81cc)}, /* Dell Wireless 5816e */ {DEVICE_SWI(0x413c, 0x81cf)}, /* Dell Wireless 5819 */ From patchwork Mon Oct 24 11:29:05 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8656 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp421685wru; Mon, 24 Oct 2022 05:21:02 -0700 (PDT) X-Google-Smtp-Source: AMsMyM76WgqJmLcbaXPdkmeuZhYY4Oc4sFecbqXjzYZwGuiiDR+hiYRMOiaFLXlGmUOoYLg/B+fB X-Received: by 2002:a17:907:728b:b0:7a1:b545:b39b with SMTP id dt11-20020a170907728b00b007a1b545b39bmr8810869ejc.661.1666614061866; Mon, 24 Oct 2022 05:21:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666614061; cv=none; d=google.com; s=arc-20160816; b=YsLhbwbAQXjbUGNLwH5mstCk3kHSpr4ImAVLnOGGrLNIpo4q5WOxmJgf3OYrVo3lpr /E7vOmG0KkETe8Y3seybv7Apx9ktTIsfqeA6sf1+PyuotDBXjsyk6gPXMXPMi+dvlLxL NYGtIpLgIgsgNW3+IaZczU82XjF3EVJJobSxi3JTysxna3Ie4Hwa+fZoFprtu2Xw8oZs jWro+Hl43l0PhwdCnE/D2oHvKQyYbnkwagx1jaQ4h7Jta6HnozX2jliYIqB4OOh8u3rF vsf08WepwU9AGZ9AHx2UPPfhr+qa4SKXMYgyW+ssNqPXUOclx3b7UiI2dOGmhpO1Eaa8 ALUw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=CQ67gAsOfhLp0OGuXrY/gH8htmq5Z1URGnt2rp2jegA=; b=IC9TTJAk8yyHf2JLsG2FqqGH+J64kcSTzYN6qY0osQvbkf8BoTpCHpTAwf7rSNCqXs qVd0AsODDe8f6epzWsGrB2bGlJjUSCo7PleASTEuyHIdRJTCc4JHJUznax3wGF31055R oYE2FZW75BTCiZhLNproDc5QMQ8A0co2gqX46uPQ3JPr2mYdGkrOFZfHi4KXnAVIF+60 wQh2Pyct8nCVzK4eoc2rwsnrcbsMgEPLzNtlqxyWtqse+V69MDxINLC/9w+beszBnjYK h3X/C4wkTP8yS34mUgmNuAzsp/J0l12iD49Z/Bmqw2FtKGUV+5GGP2JTmRQUBXSFgCVX ZaNw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=zKSG+gyF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n19-20020a170906165300b0077c5ec87ec2si22167078ejd.297.2022.10.24.05.20.37; Mon, 24 Oct 2022 05:21:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=zKSG+gyF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233145AbiJXMQm (ORCPT + 99 others); Mon, 24 Oct 2022 08:16:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41154 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233383AbiJXMO7 (ORCPT ); Mon, 24 Oct 2022 08:14:59 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9F4BD7963A; Mon, 24 Oct 2022 04:55:47 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 2F6BA612FE; Mon, 24 Oct 2022 11:55:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 45502C433D7; Mon, 24 Oct 2022 11:55:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612539; bh=AtPuK4+6wjQ0bpEyIlTUi6fm79RRmk4Cm/SAy7YgL4w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zKSG+gyFPC1GvqnUUe0SgPNnyrP5UrcMMRF/liRRU1sgP7IzXbUWhx8yZ4D5JASY1 PBuifkj6Og4st26s9lVfJP4AkNA2K9zXH9DS48/BPu4W8/fDhgjW8FppoQchrH6ZXA zGWzLmAk/jv600ClA/IfGzmt8fis2PgzKgFUyMxQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Guozihua , Zhongguohua , Al Viro , Theodore Tso , Andrew Lutomirski , "Jason A. Donenfeld" Subject: [PATCH 4.19 026/229] random: restore O_NONBLOCK support Date: Mon, 24 Oct 2022 13:29:05 +0200 Message-Id: <20221024112959.982158381@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747571506624127680?= X-GMAIL-MSGID: =?utf-8?q?1747571506624127680?= From: Jason A. Donenfeld commit cd4f24ae9404fd31fc461066e57889be3b68641b upstream. Prior to 5.6, when /dev/random was opened with O_NONBLOCK, it would return -EAGAIN if there was no entropy. When the pools were unified in 5.6, this was lost. The post 5.6 behavior of blocking until the pool is initialized, and ignoring O_NONBLOCK in the process, went unnoticed, with no reports about the regression received for two and a half years. However, eventually this indeed did break somebody's userspace. So we restore the old behavior, by returning -EAGAIN if the pool is not initialized. Unlike the old /dev/random, this can only occur during early boot, after which it never blocks again. In order to make this O_NONBLOCK behavior consistent with other expectations, also respect users reading with preadv2(RWF_NOWAIT) and similar. Fixes: 30c08efec888 ("random: make /dev/random be almost like /dev/urandom") Reported-by: Guozihua Reported-by: Zhongguohua Cc: Al Viro Cc: Theodore Ts'o Cc: Andrew Lutomirski Cc: stable@vger.kernel.org Signed-off-by: Jason A. Donenfeld Signed-off-by: Greg Kroah-Hartman --- drivers/char/mem.c | 4 ++-- drivers/char/random.c | 5 +++++ 2 files changed, 7 insertions(+), 2 deletions(-) --- a/drivers/char/mem.c +++ b/drivers/char/mem.c @@ -893,8 +893,8 @@ static const struct memdev { #endif [5] = { "zero", 0666, &zero_fops, 0 }, [7] = { "full", 0666, &full_fops, 0 }, - [8] = { "random", 0666, &random_fops, 0 }, - [9] = { "urandom", 0666, &urandom_fops, 0 }, + [8] = { "random", 0666, &random_fops, FMODE_NOWAIT }, + [9] = { "urandom", 0666, &urandom_fops, FMODE_NOWAIT }, #ifdef CONFIG_PRINTK [11] = { "kmsg", 0644, &kmsg_fops, 0 }, #endif --- a/drivers/char/random.c +++ b/drivers/char/random.c @@ -1294,6 +1294,11 @@ static ssize_t random_read_iter(struct k { int ret; + if (!crng_ready() && + ((kiocb->ki_flags & IOCB_NOWAIT) || + (kiocb->ki_filp->f_flags & O_NONBLOCK))) + return -EAGAIN; + ret = wait_for_random_bytes(); if (ret != 0) return ret; From patchwork Mon Oct 24 11:29:06 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8748 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp429207wru; Mon, 24 Oct 2022 05:38:03 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6gkTmHE76a079Byqjavffc+xuFuYtD++4YD7Zr0n/SoxY3/fOzdYI965mBaYcKf5pbTN5u X-Received: by 2002:a17:90b:3892:b0:20d:4bb5:91fe with SMTP id mu18-20020a17090b389200b0020d4bb591femr39272370pjb.31.1666615083591; Mon, 24 Oct 2022 05:38:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666615083; cv=none; d=google.com; s=arc-20160816; b=aGSonMXi4OpPtYVE4eXYyDEEsSeqOd962CT6wEXFTGW6KP/Y+I1uBa5P9G3wzV3wjx zRVREIHrcvnQgSItZXX1w0QF82ij3+VHaZqW+VL5ufUlnObUz8E04twvU1qCpWqNzpUB 8trnQSLAuKCR+FgtXYm4E5NvXrsvMo45gtQXMFPRgssHU89v6e5wmSxbtnqx3nu8ZjIZ J2UK+zpT0SYKzZZMfzRCkuYgvUklCZkYqq62XQTAbxLochFWCSJBl0e/XngxNFGphtwt o2mCxhic58mw4GpybxMIW7m530fvsiHaISze/FVcxk6A1bdAk5JCXa0hz3OPcU1VTBd1 DLZg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=WIR2DLtrEX0dj9NkuFSYbj1Dtbakne4q5wM7kqmAms0=; b=jUKxlKYTdpKvJDZ1beDTSL3ke5SJR4MUq0407x3tOAf5JMl8Y2RSa4VeRGJRQ20ClS sdtuWyrlod5TZPt5p50HazSOXjbU8n+3Bu4306yfrHrDkN3Mqj9JATLFND3FCW3FBIFp XuXnfCNYwAdI5chs5ZE49p1F+Rfo8VyDYQbabzWxQAn8bnHkouq/fSFDKbPcyD8canP3 DeswYy374eJEwyEi307R19ONBiKRbjiEJYGjoqZ584LmRJvmeqmSzjeFyYVSIlKJs10z oQP0smqwSixj/We/nx+094dInWTkT75yaLMpx48PWK+vAl5cqx99c5GH2dPGm+RBJ6V/ z2pg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=JYbh09bN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v20-20020a170902f0d400b00186a98b58d8si2827165pla.134.2022.10.24.05.37.50; Mon, 24 Oct 2022 05:38:03 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=JYbh09bN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232911AbiJXM1N (ORCPT + 99 others); Mon, 24 Oct 2022 08:27:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60566 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231238AbiJXM0r (ORCPT ); Mon, 24 Oct 2022 08:26:47 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B328583233; Mon, 24 Oct 2022 05:01:04 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 91AE9B81199; Mon, 24 Oct 2022 11:55:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E02B7C433C1; Mon, 24 Oct 2022 11:55:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612542; bh=HvNQLbDFpQyKb6hj8OG6baMZ1QDProYxanDCjhbgJvM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JYbh09bNAZ7/T/ysJOIMz7/xfGSSAQDtPcLbFN21KshsU2dS62qpUlqoq5X3iZ6Pv u4KPuoCDcN7zHAit47Gz8xg8oLZiU8FgQEYikuW8xsLeFisZhu5u27oRVVqJCNeWzA LQkFm9og4z+o13cD3iyvp76AJkDlnxjE0q1fYyXU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sebastian Andrzej Siewior , "Jason A. Donenfeld" Subject: [PATCH 4.19 027/229] random: avoid reading two cache lines on irq randomness Date: Mon, 24 Oct 2022 13:29:06 +0200 Message-Id: <20221024113000.011600600@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747572578201242433?= X-GMAIL-MSGID: =?utf-8?q?1747572578201242433?= From: Jason A. Donenfeld commit 9ee0507e896b45af6d65408c77815800bce30008 upstream. In order to avoid reading and dirtying two cache lines on every IRQ, move the work_struct to the bottom of the fast_pool struct. add_ interrupt_randomness() always touches .pool and .count, which are currently split, because .mix pushes everything down. Instead, move .mix to the bottom, so that .pool and .count are always in the first cache line, since .mix is only accessed when the pool is full. Fixes: 58340f8e952b ("random: defer fast pool mixing to worker") Reviewed-by: Sebastian Andrzej Siewior Signed-off-by: Jason A. Donenfeld Signed-off-by: Greg Kroah-Hartman --- drivers/char/random.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/char/random.c +++ b/drivers/char/random.c @@ -890,10 +890,10 @@ void __init add_bootloader_randomness(co } struct fast_pool { - struct work_struct mix; unsigned long pool[4]; unsigned long last; unsigned int count; + struct work_struct mix; }; static DEFINE_PER_CPU(struct fast_pool, irq_randomness) = { From patchwork Mon Oct 24 11:29:07 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8776 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp430589wru; Mon, 24 Oct 2022 05:41:55 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7oH0A5XTN6S6jNmN+j8cRgVadZJ1/yLlcQ8+DiC0yI62Jt43Lpz61mE+sa24uLq7iILwxP X-Received: by 2002:a17:90b:3a8b:b0:20d:b254:e30e with SMTP id om11-20020a17090b3a8b00b0020db254e30emr38586725pjb.206.1666615304633; Mon, 24 Oct 2022 05:41:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666615304; cv=none; d=google.com; s=arc-20160816; b=tcx8zFDNziRplK05OvFkh2jfz5b3Wu3q/VoHW8rbMsbo1EVFz0rZPqihTDDFLY+xNE HCUlM2KDo3xJs50vf/+AA0ebXtuDHXV74Unao3hGXUtvWjkTa+yApf8PJasHnjuLA+QK jj7+8mcuHrnGqrguuh7mxi/2YZxvE/SCVXCLahtE8PqiWpDmpT7iaHx6KS8ygPFus8g0 4qCNCRY868XEf1dQoMVPbgMf16FYDO93rc2DqaEwTXhRt6A8hKMP2ZGgGTSJ8EnGYtQk AIiJmCAdTS90IYmUamShug4CEhipxR4ioteJDWw+6Zf0jvIlz+xmFt6cjpF78WxadtTW REXg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=ioubYNgkpR2S2hgGiJHYezCKV0aAVCCL5dUrlNdT+lA=; b=izLhNp2/A4u/fGhe+EC2wJe4AF7TJ0yIqGfBthEca65gmeFx2ZKM2GOvm04XYnh2Xd IZuJbsQ0CFDzXmMPNxsLkclzFQrTq58MoPisEO+mN/GyCJ53zV8XzrWbq4kG5FiDmC9s TM3YgKrxyEX4/9ka/becLUu1dAa4j+vKEwhRhUfbdB2I0ozpadLI44YfjdEZoXQi5G7v HpYxEP1H1mmB7ntiy4EVGffKPMx5OgdFIwOZsmXCKmhsK7vV0MxF1vdKvy178eWQzVcx GHu/lxY7PHxJStBbEnQCyiPRDdVBKtJZUfD/kXbp4hJPbJuMjdn7pqEI8ivUne1UsXJv NBIg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=EDLiSRqG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i7-20020aa796e7000000b00557c8a20395si32551574pfq.120.2022.10.24.05.41.30; Mon, 24 Oct 2022 05:41:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=EDLiSRqG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233748AbiJXM1T (ORCPT + 99 others); Mon, 24 Oct 2022 08:27:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60602 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233644AbiJXM0v (ORCPT ); Mon, 24 Oct 2022 08:26:51 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 04428836DA; Mon, 24 Oct 2022 05:01:04 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 34058B811D6; Mon, 24 Oct 2022 11:55:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6094DC433D6; Mon, 24 Oct 2022 11:55:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612544; bh=0BtEtaqo1qvb6/8NaIqhM/IATK+MTO39ghHl/kvdoIo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EDLiSRqGrf6pftq9HT3ArtpSXiJVBocHgx0ow6FjoTKV5mwi04z605W9yLQJWfvdR fnzoEOYjyuDZtS2dd7kMS/PZ2lGU0o4izQLb1Z5UdYhyqsx1YPCauABQ02jo4IuEM2 bX8zOLji5THkUyjY1yTPupq3XL5o2QaR/TGRHe8U= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sherry Yang , Paul Webb , Phillip Goerl , Jack Vogel , Nicky Veitch , Colm Harrington , Ramanan Govindarajan , Sebastian Andrzej Siewior , Dominik Brodowski , Tejun Heo , Sultan Alsawaf , "Jason A. Donenfeld" Subject: [PATCH 4.19 028/229] random: use expired timer rather than wq for mixing fast pool Date: Mon, 24 Oct 2022 13:29:07 +0200 Message-Id: <20221024113000.040737892@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747572809383315226?= X-GMAIL-MSGID: =?utf-8?q?1747572809383315226?= From: Jason A. Donenfeld commit 748bc4dd9e663f23448d8ad7e58c011a67ea1eca upstream. Previously, the fast pool was dumped into the main pool periodically in the fast pool's hard IRQ handler. This worked fine and there weren't problems with it, until RT came around. Since RT converts spinlocks into sleeping locks, problems cropped up. Rather than switching to raw spinlocks, the RT developers preferred we make the transformation from originally doing: do_some_stuff() spin_lock() do_some_other_stuff() spin_unlock() to doing: do_some_stuff() queue_work_on(some_other_stuff_worker) This is an ordinary pattern done all over the kernel. However, Sherry noticed a 10% performance regression in qperf TCP over a 40gbps InfiniBand card. Quoting her message: > MT27500 Family [ConnectX-3] cards: > Infiniband device 'mlx4_0' port 1 status: > default gid: fe80:0000:0000:0000:0010:e000:0178:9eb1 > base lid: 0x6 > sm lid: 0x1 > state: 4: ACTIVE > phys state: 5: LinkUp > rate: 40 Gb/sec (4X QDR) > link_layer: InfiniBand > > Cards are configured with IP addresses on private subnet for IPoIB > performance testing. > Regression identified in this bug is in TCP latency in this stack as reported > by qperf tcp_lat metric: > > We have one system listen as a qperf server: > [root@yourQperfServer ~]# qperf > > Have the other system connect to qperf server as a client (in this > case, it’s X7 server with Mellanox card): > [root@yourQperfClient ~]# numactl -m0 -N0 qperf 20.20.20.101 -v -uu -ub --time 60 --wait_server 20 -oo msg_size:4K:1024K:*2 tcp_lat Rather than incur the scheduling latency from queue_work_on, we can instead switch to running on the next timer tick, on the same core. This also batches things a bit more -- once per jiffy -- which is okay now that mix_interrupt_randomness() can credit multiple bits at once. Reported-by: Sherry Yang Tested-by: Paul Webb Cc: Sherry Yang Cc: Phillip Goerl Cc: Jack Vogel Cc: Nicky Veitch Cc: Colm Harrington Cc: Ramanan Govindarajan Cc: Sebastian Andrzej Siewior Cc: Dominik Brodowski Cc: Tejun Heo Cc: Sultan Alsawaf Cc: stable@vger.kernel.org Fixes: 58340f8e952b ("random: defer fast pool mixing to worker") Signed-off-by: Jason A. Donenfeld Signed-off-by: Greg Kroah-Hartman --- drivers/char/random.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) --- a/drivers/char/random.c +++ b/drivers/char/random.c @@ -893,17 +893,20 @@ struct fast_pool { unsigned long pool[4]; unsigned long last; unsigned int count; - struct work_struct mix; + struct timer_list mix; }; +static void mix_interrupt_randomness(struct timer_list *work); + static DEFINE_PER_CPU(struct fast_pool, irq_randomness) = { #ifdef CONFIG_64BIT #define FASTMIX_PERM SIPHASH_PERMUTATION - .pool = { SIPHASH_CONST_0, SIPHASH_CONST_1, SIPHASH_CONST_2, SIPHASH_CONST_3 } + .pool = { SIPHASH_CONST_0, SIPHASH_CONST_1, SIPHASH_CONST_2, SIPHASH_CONST_3 }, #else #define FASTMIX_PERM HSIPHASH_PERMUTATION - .pool = { HSIPHASH_CONST_0, HSIPHASH_CONST_1, HSIPHASH_CONST_2, HSIPHASH_CONST_3 } + .pool = { HSIPHASH_CONST_0, HSIPHASH_CONST_1, HSIPHASH_CONST_2, HSIPHASH_CONST_3 }, #endif + .mix = __TIMER_INITIALIZER(mix_interrupt_randomness, 0) }; /* @@ -945,7 +948,7 @@ int __cold random_online_cpu(unsigned in } #endif -static void mix_interrupt_randomness(struct work_struct *work) +static void mix_interrupt_randomness(struct timer_list *work) { struct fast_pool *fast_pool = container_of(work, struct fast_pool, mix); /* @@ -999,10 +1002,11 @@ void add_interrupt_randomness(int irq) if (new_count < 1024 && !time_is_before_jiffies(fast_pool->last + HZ)) return; - if (unlikely(!fast_pool->mix.func)) - INIT_WORK(&fast_pool->mix, mix_interrupt_randomness); fast_pool->count |= MIX_INFLIGHT; - queue_work_on(raw_smp_processor_id(), system_highpri_wq, &fast_pool->mix); + if (!timer_pending(&fast_pool->mix)) { + fast_pool->mix.expires = jiffies; + add_timer_on(&fast_pool->mix, raw_smp_processor_id()); + } } EXPORT_SYMBOL_GPL(add_interrupt_randomness); From patchwork Mon Oct 24 11:29:08 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8660 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp421744wru; Mon, 24 Oct 2022 05:21:08 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7hVabx/lREkBIgN9P+GIg7Q3X1MGTABn11ywjODpFYbGFsX7vogkQ1eavbmEXRC1J3nbFO X-Received: by 2002:a17:906:9b87:b0:733:1795:2855 with SMTP id dd7-20020a1709069b8700b0073317952855mr27417911ejc.156.1666614067861; Mon, 24 Oct 2022 05:21:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666614067; cv=none; d=google.com; s=arc-20160816; b=R55jkibuNWP1LGfPZZSRQSfLy0AXVYDe3THlGWxY4FEVuDxcx16jhXfGjOUFqDeDv/ JzhocpnRkqc+dLhM/eOzfqBjI6CYIyhCFSRjfm7IJPR1IGoyhvyyxpZNzljiBNlZKHwf I1pDE+g4JMfxCXYXtR9Lzx41rcgMspUoMOt45YeH/YoGlfzhkstck8C3IaA6gnrx3Lsx 92ctdAFkM0Aqlks1JTxjn2vU5Vkf3XmdEIUZUMrTbHAiQVD/1odPmlqh0H4NYeZ/jThH lFL+It7aL2Ds3UJAPHo9Zf5I4zZFzHcL3vV4BgFJddYSTIlkhXdOlHVSlPF9t4vCqDKf YbjQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=wvsIiPxMt4KilhM2Co755tGxIhX5mC1Vj0QnSB5WorI=; b=MOvys++j49RzgXDsvGfavrj7veOTOdJ9QjeIyGL+n2+9q8/4Y90qrhAcYTsCKN1wU/ 1hnhWmdA8zaUGn6Us6vNAGYCPgIscwXQXtVDyanAAD4KCYD1ERzkfde44abT0AbQoUqZ dZuBhAKbO1sWnJquJrWCRYw4Z3EM/eeXN1HUpBfdtVvOdl61IIubmR2ah4Qh4U7UUIU8 zRLIBiG6PRb6ix/bgNi7UFdvuM7XWRyFx2FZzoVUY+hHT2HxtKpBTwqnNvNfviNuiI1b RxWIccwHZGY0C/ZnTG5G+YfnWE/k74DL1/TfPSfYQe+8mfnJY5O53yBmEJLPv/Qovbao qHHw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ldUVLxGo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i7-20020a1709064fc700b0078d6418dcb8si30958940ejw.456.2022.10.24.05.20.43; Mon, 24 Oct 2022 05:21:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ldUVLxGo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233184AbiJXMRN (ORCPT + 99 others); Mon, 24 Oct 2022 08:17:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47642 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233482AbiJXMPN (ORCPT ); Mon, 24 Oct 2022 08:15:13 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4B7558052B; Mon, 24 Oct 2022 04:56:00 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 1208B6126B; Mon, 24 Oct 2022 11:55:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 25222C433C1; Mon, 24 Oct 2022 11:55:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612547; bh=kQIWC0ZgBV/lLuQ8oDBM12FE6Kn6eno2vD1KsA9VkqA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ldUVLxGorLc03Lz+J/5lB0KVih3+Y3d3KedVmHDyYCxSgMNyVTLMmdH359ztOharK fhQOD8IxIJ81konEVqX/wB3mSItFUT7WO1K6aygSeAQZSllpP1J+zOFNwUDK4fqH0D GnUJ8s0QRnTFj6jPB7P7Wvmi4Q3vxpsHQ8bcyfR0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?utf-8?q?S=C3=B6nke_Huster?= , Johannes Berg Subject: [PATCH 4.19 029/229] wifi: mac80211_hwsim: avoid mac80211 warning on bad rate Date: Mon, 24 Oct 2022 13:29:08 +0200 Message-Id: <20221024113000.070441529@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747571513003951475?= X-GMAIL-MSGID: =?utf-8?q?1747571513003951475?= From: Johannes Berg commit 1833b6f46d7e2830251a063935ab464256defe22 upstream. If the tool on the other side (e.g. wmediumd) gets confused about the rate, we hit a warning in mac80211. Silence that by effectively duplicating the check here and dropping the frame silently (in mac80211 it's dropped with the warning). Reported-by: Sönke Huster Tested-by: Sönke Huster Signed-off-by: Johannes Berg Signed-off-by: Greg Kroah-Hartman --- drivers/net/wireless/mac80211_hwsim.c | 2 ++ 1 file changed, 2 insertions(+) --- a/drivers/net/wireless/mac80211_hwsim.c +++ b/drivers/net/wireless/mac80211_hwsim.c @@ -3270,6 +3270,8 @@ static int hwsim_cloned_frame_received_n rx_status.band = data2->channel->band; rx_status.rate_idx = nla_get_u32(info->attrs[HWSIM_ATTR_RX_RATE]); + if (rx_status.rate_idx >= data2->hw->wiphy->bands[rx_status.band]->n_bitrates) + goto out; rx_status.signal = nla_get_u32(info->attrs[HWSIM_ATTR_SIGNAL]); memcpy(IEEE80211_SKB_RXCB(skb), &rx_status, sizeof(rx_status)); From patchwork Mon Oct 24 11:29:09 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9015 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp441112wru; Mon, 24 Oct 2022 06:05:23 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7vQqu/S+YUnkP48Rh92rAwYWgVPyWYgUzn/loZPK+o+scXz9ka8q+9PfJSlTix3X25VzrZ X-Received: by 2002:a17:90b:2812:b0:20d:7a3b:df3e with SMTP id qb18-20020a17090b281200b0020d7a3bdf3emr74453845pjb.169.1666616717042; Mon, 24 Oct 2022 06:05:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666616713; cv=none; d=google.com; s=arc-20160816; b=KUTvW7Lm7unVRNVoCBR2U6YDHBVRZECpdK8EKpervNHXs+6rNKlwzJuOcAmOjvUukZ zy6S9b8Yq2rKIEvVpz40OFHr+kSeeWEDYtArgBi8mcQfxUdmWK5dKNM+Gd2cJLaolAMl t1dZrntE/jlmTlSv2//Uzsb5VcwCIXOEmRyrnjGfPylfHuMgqJIXY8sAeE5MVhEVP93A cOq4GRZ7h6tfy98TKqxMViuV9PBARLHTx2M+YXUb7I9uMrgLEYZvpFKE3W0Kes81XKoq CAD3KlAu3CGA8mC2tKqs9ptXR2AUM9jMC5OMyPbDE8Wn1j51eaVMUZeqt/IBr/zHN37B E6Pw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=GfUgyEQg2R9UacDQwyaV2nEhVAEtUSFHBcjMBxx2loA=; b=afwiLkZbSx4F45qK7QB89vOVArfQgqBd2PaOS7eufu4IP9TCMwvi1fnw1UPwENrzAB TdNTUthBLDzw3Eh5A7JEPlOyPfl7kdV0+fgLilKo8Z6qFgkhpPmo2jbujQynLGu/e0wc JLaqchFyrz0hZMNNeMlBfkGgtpltUquv/CMXsUEDBYl6k26MfLHACvnyr9jfqDXIiPBF c2BZ4t1ymBTLOUEg6tIvUmH2MdHAToLH7kUd0WhCoWN1Jr437IoBRIzrEWAzqkMJOR8P IZxkZSTz5+ME40KZBX9/sTB0LfaWFyaCBoPE+W+UOD+r8L7FcoGtDuaUx3JqyBGtSPju AyvQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=kl7DdIr9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r3-20020a635d03000000b0046ed58fb265si10328843pgb.277.2022.10.24.06.04.59; Mon, 24 Oct 2022 06:05:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=kl7DdIr9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235250AbiJXNDz (ORCPT + 99 others); Mon, 24 Oct 2022 09:03:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54094 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235371AbiJXNAF (ORCPT ); Mon, 24 Oct 2022 09:00:05 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C32612635; Mon, 24 Oct 2022 05:19:28 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id A5F07612DD; Mon, 24 Oct 2022 11:55:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BBD3FC433C1; Mon, 24 Oct 2022 11:55:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612550; bh=F3Ps/24EELtdaxeGL9mejddTcm6hhRtKHdm9tH9l8nY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kl7DdIr9ZYh0JnYJId0KdK3+Ne8lnxTXowNybuFv96yWk1exDaq6wHx1g6QyUVsb5 6qbjAqgcOR+tUdYErlTYp667J+SFe12K4kjR8XiWgyZ9/xpnImoj39s+oVXxeZta2e nVX1Avt800zPy4hziH32oXm9TZFruGhvmQ16A1rA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jasper Poppe , Jeremy Palmer , Ruineka , Cleber de Mattos Casali , Kyle Gospodnetich , Pavel Rojtberg , Dmitry Torokhov Subject: [PATCH 4.19 030/229] Input: xpad - add supported devices as contributed on github Date: Mon, 24 Oct 2022 13:29:09 +0200 Message-Id: <20221024113000.099381072@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747574286748894009?= X-GMAIL-MSGID: =?utf-8?q?1747574286748894009?= From: Pavel Rojtberg commit b382c5e37344883dc97525d05f1f6b788f549985 upstream. This is based on multiple commits at https://github.com/paroj/xpad Cc: stable@vger.kernel.org Signed-off-by: Jasper Poppe Signed-off-by: Jeremy Palmer Signed-off-by: Ruineka Signed-off-by: Cleber de Mattos Casali Signed-off-by: Kyle Gospodnetich Signed-off-by: Pavel Rojtberg Link: https://lore.kernel.org/r/20220818154411.510308-2-rojtberg@gmail.com Signed-off-by: Dmitry Torokhov Signed-off-by: Greg Kroah-Hartman --- drivers/input/joystick/xpad.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) --- a/drivers/input/joystick/xpad.c +++ b/drivers/input/joystick/xpad.c @@ -126,6 +126,8 @@ static const struct xpad_device { u8 xtype; } xpad_device[] = { { 0x0079, 0x18d4, "GPD Win 2 X-Box Controller", 0, XTYPE_XBOX360 }, + { 0x03eb, 0xff01, "Wooting One (Legacy)", 0, XTYPE_XBOX360 }, + { 0x03eb, 0xff02, "Wooting Two (Legacy)", 0, XTYPE_XBOX360 }, { 0x044f, 0x0f00, "Thrustmaster Wheel", 0, XTYPE_XBOX }, { 0x044f, 0x0f03, "Thrustmaster Wheel", 0, XTYPE_XBOX }, { 0x044f, 0x0f07, "Thrustmaster, Inc. Controller", 0, XTYPE_XBOX }, @@ -256,6 +258,7 @@ static const struct xpad_device { { 0x0f0d, 0x0063, "Hori Real Arcade Pro Hayabusa (USA) Xbox One", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOXONE }, { 0x0f0d, 0x0067, "HORIPAD ONE", 0, XTYPE_XBOXONE }, { 0x0f0d, 0x0078, "Hori Real Arcade Pro V Kai Xbox One", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOXONE }, + { 0x0f0d, 0x00c5, "Hori Fighting Commander ONE", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOXONE }, { 0x0f30, 0x010b, "Philips Recoil", 0, XTYPE_XBOX }, { 0x0f30, 0x0202, "Joytech Advanced Controller", 0, XTYPE_XBOX }, { 0x0f30, 0x8888, "BigBen XBMiniPad Controller", 0, XTYPE_XBOX }, @@ -272,6 +275,7 @@ static const struct xpad_device { { 0x1430, 0x8888, "TX6500+ Dance Pad (first generation)", MAP_DPAD_TO_BUTTONS, XTYPE_XBOX }, { 0x1430, 0xf801, "RedOctane Controller", 0, XTYPE_XBOX360 }, { 0x146b, 0x0601, "BigBen Interactive XBOX 360 Controller", 0, XTYPE_XBOX360 }, + { 0x146b, 0x0604, "Bigben Interactive DAIJA Arcade Stick", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOX360 }, { 0x1532, 0x0037, "Razer Sabertooth", 0, XTYPE_XBOX360 }, { 0x1532, 0x0a00, "Razer Atrox Arcade Stick", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOXONE }, { 0x1532, 0x0a03, "Razer Wildcat", 0, XTYPE_XBOXONE }, @@ -336,6 +340,7 @@ static const struct xpad_device { { 0x24c6, 0x5502, "Hori Fighting Stick VX Alt", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOX360 }, { 0x24c6, 0x5503, "Hori Fighting Edge", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOX360 }, { 0x24c6, 0x5506, "Hori SOULCALIBUR V Stick", 0, XTYPE_XBOX360 }, + { 0x24c6, 0x5510, "Hori Fighting Commander ONE (Xbox 360/PC Mode)", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOX360 }, { 0x24c6, 0x550d, "Hori GEM Xbox controller", 0, XTYPE_XBOX360 }, { 0x24c6, 0x550e, "Hori Real Arcade Pro V Kai 360", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOX360 }, { 0x24c6, 0x551a, "PowerA FUSION Pro Controller", 0, XTYPE_XBOXONE }, @@ -345,6 +350,14 @@ static const struct xpad_device { { 0x24c6, 0x5b03, "Thrustmaster Ferrari 458 Racing Wheel", 0, XTYPE_XBOX360 }, { 0x24c6, 0x5d04, "Razer Sabertooth", 0, XTYPE_XBOX360 }, { 0x24c6, 0xfafe, "Rock Candy Gamepad for Xbox 360", 0, XTYPE_XBOX360 }, + { 0x2563, 0x058d, "OneXPlayer Gamepad", 0, XTYPE_XBOX360 }, + { 0x2dc8, 0x2000, "8BitDo Pro 2 Wired Controller fox Xbox", 0, XTYPE_XBOXONE }, + { 0x31e3, 0x1100, "Wooting One", 0, XTYPE_XBOX360 }, + { 0x31e3, 0x1200, "Wooting Two", 0, XTYPE_XBOX360 }, + { 0x31e3, 0x1210, "Wooting Lekker", 0, XTYPE_XBOX360 }, + { 0x31e3, 0x1220, "Wooting Two HE", 0, XTYPE_XBOX360 }, + { 0x31e3, 0x1300, "Wooting 60HE (AVR)", 0, XTYPE_XBOX360 }, + { 0x31e3, 0x1310, "Wooting 60HE (ARM)", 0, XTYPE_XBOX360 }, { 0x3285, 0x0607, "Nacon GC-100", 0, XTYPE_XBOX360 }, { 0x3767, 0x0101, "Fanatec Speedster 3 Forceshock Wheel", 0, XTYPE_XBOX }, { 0xffff, 0xffff, "Chinese-made Xbox Controller", 0, XTYPE_XBOX }, @@ -430,6 +443,7 @@ static const signed short xpad_abs_trigg static const struct usb_device_id xpad_table[] = { { USB_INTERFACE_INFO('X', 'B', 0) }, /* X-Box USB-IF not approved class */ XPAD_XBOX360_VENDOR(0x0079), /* GPD Win 2 Controller */ + XPAD_XBOX360_VENDOR(0x03eb), /* Wooting Keyboards (Legacy) */ XPAD_XBOX360_VENDOR(0x044f), /* Thrustmaster X-Box 360 controllers */ XPAD_XBOX360_VENDOR(0x045e), /* Microsoft X-Box 360 controllers */ XPAD_XBOXONE_VENDOR(0x045e), /* Microsoft X-Box One controllers */ @@ -440,6 +454,7 @@ static const struct usb_device_id xpad_t { USB_DEVICE(0x0738, 0x4540) }, /* Mad Catz Beat Pad */ XPAD_XBOXONE_VENDOR(0x0738), /* Mad Catz FightStick TE 2 */ XPAD_XBOX360_VENDOR(0x07ff), /* Mad Catz GamePad */ + XPAD_XBOX360_VENDOR(0x0c12), /* Zeroplus X-Box 360 controllers */ XPAD_XBOX360_VENDOR(0x0e6f), /* 0x0e6f X-Box 360 controllers */ XPAD_XBOXONE_VENDOR(0x0e6f), /* 0x0e6f X-Box One controllers */ XPAD_XBOX360_VENDOR(0x0f0d), /* Hori Controllers */ @@ -460,8 +475,12 @@ static const struct usb_device_id xpad_t XPAD_XBOXONE_VENDOR(0x20d6), /* PowerA Controllers */ XPAD_XBOX360_VENDOR(0x24c6), /* PowerA Controllers */ XPAD_XBOXONE_VENDOR(0x24c6), /* PowerA Controllers */ + XPAD_XBOX360_VENDOR(0x2563), /* OneXPlayer Gamepad */ + XPAD_XBOX360_VENDOR(0x260d), /* Dareu H101 */ + XPAD_XBOXONE_VENDOR(0x2dc8), /* 8BitDo Pro 2 Wired Controller for Xbox */ XPAD_XBOXONE_VENDOR(0x2e24), /* Hyperkin Duke X-Box One pad */ XPAD_XBOX360_VENDOR(0x2f24), /* GameSir Controllers */ + XPAD_XBOX360_VENDOR(0x31e3), /* Wooting Keyboards */ XPAD_XBOX360_VENDOR(0x3285), /* Nacon GC-100 */ { } }; From patchwork Mon Oct 24 11:29:10 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8735 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp423945wru; Mon, 24 Oct 2022 05:26:14 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6cmeqbFaA0nO99Gy+hoPFW2KmH3rz+aUf2o9o8jdS4XzWjhF+A8GOGK8b+D6sMGYwETOHp X-Received: by 2002:a05:6a00:2384:b0:566:813c:ae24 with SMTP id f4-20020a056a00238400b00566813cae24mr33410572pfc.17.1666614373986; Mon, 24 Oct 2022 05:26:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666614373; cv=none; d=google.com; s=arc-20160816; b=EM1a7+sRbVTvCLAiVT7uPBAAYCf7U61cHwK+H5NSmAMwZiLAGs+t0M0RE0Tsh/vwQD p0AZUUhN1YzFoGQ+CJ3HRqqwyHyu2ljXGR6JEQTidZyxfvp8H5freQ9Vy3gJ61lFOMb0 jH2TTbCaCxxSY/mq2YfGwZL9hn/lBgytDdH4Tcjuw8ckarD2B+to8i07TKrsfI+7/4Nj yDbeD7YBbbSN9Ky0OHqA4UJPm3TkHu+FMkCGlfYWdAAdBTeSa4KZEfJ1yoxROMYst2Sp EKDyQWjdiOpdcbZ4AYWucUNb/XIZdajmxAAlXIEB5KI/UnfEgWMR2cu4wp6a6sT7ENBR lW3g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=zda8vrA8qy/s3uMGDlMQxf3Cs3PEBS/mp2MMjyuA0rw=; b=02t1rZptsAUukwIPK9N4f1iEvkg2Lm2htyK/hZ/iT6hueyBMCVj0wfx1hwe5d5Ra0D eN/me4bxalHfKrrkDTsxJw41sSDahwtZyk4izYrP1/rAuKjy1dvtUuTxIKoa/Wmponh+ u/GQz4/E43OxvhHmR9qaQSvUL8GMx7M1ZmSnijmc7DRN2gT/ymInyPA184cozfJBCJIk 8+jprhe9H2DDdUMxP98f+/vNdQjj0iK+n9g04GiG6tWcjn8TeZNd6GMbSFLT3qRuRN4u riyIXa18RI9UKwkw6nu6RhEJC0ErsDEx7TN0TXjeRCmCnc0wDb6GIbZTQZoN6a9q141/ Q8yg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=nyTKwyOg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p2-20020a170902b08200b00180556e1b6bsi32267025plr.609.2022.10.24.05.26.00; Mon, 24 Oct 2022 05:26:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=nyTKwyOg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230494AbiJXMZh (ORCPT + 99 others); Mon, 24 Oct 2022 08:25:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42812 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233674AbiJXMYC (ORCPT ); Mon, 24 Oct 2022 08:24:02 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5C7732D772; Mon, 24 Oct 2022 04:59:59 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 1320CB811D2; Mon, 24 Oct 2022 11:55:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 60B3AC433C1; Mon, 24 Oct 2022 11:55:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612552; bh=VMRx9wwHDaT/MiBy+1sQ0ULWsCHQy9lDoV0BLn6XwFo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nyTKwyOgbjQpsUVQ7A7Ii3XP5K80AFrkSc7bqnVJ/OrZ+D4kyGvaXslbAjju8Io+O L7cH9oUdFhr4urG98Bj7l9ldsyYfTSEU/pcoNlj5ivlssXVgdSibqN5HM3YPbm3Lm7 xXR2hL1opmvTNXuXOU+NzTbi61tSgQFHeYNlku9A= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Cameron Gutman , Pavel Rojtberg , Dmitry Torokhov Subject: [PATCH 4.19 031/229] Input: xpad - fix wireless 360 controller breaking after suspend Date: Mon, 24 Oct 2022 13:29:10 +0200 Message-Id: <20221024113000.128741561@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747571833734646915?= X-GMAIL-MSGID: =?utf-8?q?1747571833734646915?= From: Cameron Gutman commit a17b9841152e7f4621619902b347e2cc39c32996 upstream. Suspending and resuming the system can sometimes cause the out URB to get hung after a reset_resume. This causes LED setting and force feedback to break on resume. To avoid this, just drop the reset_resume callback so the USB core rebinds xpad to the wireless pads on resume if a reset happened. A nice side effect of this change is the LED ring on wireless controllers is now set correctly on system resume. Cc: stable@vger.kernel.org Fixes: 4220f7db1e42 ("Input: xpad - workaround dead irq_out after suspend/ resume") Signed-off-by: Cameron Gutman Signed-off-by: Pavel Rojtberg Link: https://lore.kernel.org/r/20220818154411.510308-3-rojtberg@gmail.com Signed-off-by: Dmitry Torokhov Signed-off-by: Greg Kroah-Hartman --- drivers/input/joystick/xpad.c | 1 - 1 file changed, 1 deletion(-) --- a/drivers/input/joystick/xpad.c +++ b/drivers/input/joystick/xpad.c @@ -1997,7 +1997,6 @@ static struct usb_driver xpad_driver = { .disconnect = xpad_disconnect, .suspend = xpad_suspend, .resume = xpad_resume, - .reset_resume = xpad_resume, .id_table = xpad_table, }; From patchwork Mon Oct 24 11:29:11 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8659 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp421739wru; Mon, 24 Oct 2022 05:21:07 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6OC/QppOr7sVe2cl5Pkx4DAFy3dZfHpIGg14bYW9MiwA41cdy+reDPnemmKHfPo58RGBMd X-Received: by 2002:a17:906:4fd1:b0:787:434f:d755 with SMTP id i17-20020a1709064fd100b00787434fd755mr26373402ejw.356.1666614067566; Mon, 24 Oct 2022 05:21:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666614067; cv=none; d=google.com; s=arc-20160816; b=HBxDlogUHPvAu+k5lBUoS27bqAZ8js/+1/ESnFbxdPaZ8Wf7GLfiILlcWVZBW/NeiM qNCNqw81Ah0ReRgQ6dc0qtGmS+4I2y0cxc3X0e5/XHpnHrIZQt5/7fhscSyC70AyBvtj i/scuAM3vdv+UpSW++WK/Jk0L6ZT754rAfUe1g3X0v8uzUAnni/CM3SZb3YsMGRecPkv G5bhShgV49WY0oWjOmZWngGYumfkjiuWUvJk7jqJrZXchfxDI/6OzIbNiKNJvTaFnyiI jOQNsk/lmBTiyu6hktfLQy9jvdIMjCXOttTMFezsA0aklhpoJL8VW+1Jdq/nyk1ydMOL fe/w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=/rVgWEN/XvYtdR9D5WlUOGgkhy8f36m8Xe4TlpkiVu8=; b=uSn8RozZ92biFXSFe1rfNy//7wU21iZpjG1KK30jfjzQk9ouwXFpRcCPUB5Vz1gz51 UpQtwbMbw/hc4yI1LhhJdLJT75wEoN3AkRia4aLvfjwT5HNvE98r/jCfmAFclLbyI7hQ VW0VnJs/o8lt/g6zvhX8s/iTXQ3ZsOjfQip7S19ZkIFNpMdd4O5NPfiSfApBneacegfk OVLIyyS6M0oPugtR+AvvwqK8Hg+VP4Rc9mwlrG2YbbKzwMR4d/Sbda+bsJV0VGFEK2+y G4LlxBxkr3aYCOGaM1gqwppFhTjdzCC3w/3zw0eM2M1t1QJpnf2NZeaHI71W0bjFL+hV LzfQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=JhYGwyK2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id fk24-20020a056402399800b0045cafc51fbfsi26877479edb.525.2022.10.24.05.20.42; Mon, 24 Oct 2022 05:21:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=JhYGwyK2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232968AbiJXMRD (ORCPT + 99 others); Mon, 24 Oct 2022 08:17:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51020 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233428AbiJXMPG (ORCPT ); Mon, 24 Oct 2022 08:15:06 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C042880531; Mon, 24 Oct 2022 04:56:00 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 03AEA612E6; Mon, 24 Oct 2022 11:55:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 14FA6C433D6; Mon, 24 Oct 2022 11:55:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612555; bh=3WzImQnkbjG9/1b+5+7IqgwI/RK4Rp5ceJx3SH2/qCg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JhYGwyK2KzLbYK2vh6bfBV5xZ/bSWBfLRA3EpqZv1YNn0nyzu9SKEpuTUv8+mWTT/ Ghv/U5cOCZs9oQkr6f7nWo2SvtMynXl2cYdtChBpVqC6C1ym5BB9WGbVRoe84Ykp3l emueMsbYgtm6SCy1qUj1fJpTmzaLVCoI+BRMSayI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Takashi Iwai Subject: [PATCH 4.19 032/229] ALSA: oss: Fix potential deadlock at unregistration Date: Mon, 24 Oct 2022 13:29:11 +0200 Message-Id: <20221024113000.158366599@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747571512151200078?= X-GMAIL-MSGID: =?utf-8?q?1747571512151200078?= From: Takashi Iwai commit 97d917879d7f92df09c3f21fd54609a8bcd654b2 upstream. We took sound_oss_mutex around the calls of unregister_sound_special() at unregistering OSS devices. This may, however, lead to a deadlock, because we manage the card release via the card's device object, and the release may happen at unregister_sound_special() call -- which will take sound_oss_mutex again in turn. Although the deadlock might be fixed by relaxing the rawmidi mutex in the previous commit, it's safer to move unregister_sound_special() calls themselves out of the sound_oss_mutex, too. The call is race-safe as the function has a spinlock protection by itself. Link: https://lore.kernel.org/r/CAB7eexJP7w1B0mVgDF0dQ+gWor7UdkiwPczmL7pn91xx8xpzOA@mail.gmail.com Cc: Link: https://lore.kernel.org/r/20221011070147.7611-2-tiwai@suse.de Signed-off-by: Takashi Iwai Signed-off-by: Greg Kroah-Hartman --- sound/core/sound_oss.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) --- a/sound/core/sound_oss.c +++ b/sound/core/sound_oss.c @@ -177,7 +177,6 @@ int snd_unregister_oss_device(int type, mutex_unlock(&sound_oss_mutex); return -ENOENT; } - unregister_sound_special(minor); switch (SNDRV_MINOR_OSS_DEVICE(minor)) { case SNDRV_MINOR_OSS_PCM: track2 = SNDRV_MINOR_OSS(cidx, SNDRV_MINOR_OSS_AUDIO); @@ -189,12 +188,18 @@ int snd_unregister_oss_device(int type, track2 = SNDRV_MINOR_OSS(cidx, SNDRV_MINOR_OSS_DMMIDI1); break; } - if (track2 >= 0) { - unregister_sound_special(track2); + if (track2 >= 0) snd_oss_minors[track2] = NULL; - } snd_oss_minors[minor] = NULL; mutex_unlock(&sound_oss_mutex); + + /* call unregister_sound_special() outside sound_oss_mutex; + * otherwise may deadlock, as it can trigger the release of a card + */ + unregister_sound_special(minor); + if (track2 >= 0) + unregister_sound_special(track2); + kfree(mptr); return 0; } From patchwork Mon Oct 24 11:29:12 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8737 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp424009wru; Mon, 24 Oct 2022 05:26:25 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5+6e/rIxc3+pdmarw9Wp4tpQhrf1u8FFvPCFKg5gdf9Xmk6L80B4cL6iNOaMBdlJ+hCru7 X-Received: by 2002:a63:8bc8:0:b0:461:ff70:7546 with SMTP id j191-20020a638bc8000000b00461ff707546mr28447963pge.70.1666614384979; Mon, 24 Oct 2022 05:26:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666614384; cv=none; d=google.com; s=arc-20160816; b=HByHUWWEAT7rshw9O3Uascs7yqJNBJ1+NnKDQyYvc6Mla7BBwHxuSv7lpE7UI5npZ2 FgqAuoJODLkQHt6FFlmYuI5les5t8yVnrNHnt7GRb7tsCevlf5VyUIkFTYbewAvuLhY8 jPDBA+Gbim/zvJnkLz5MZU+ka2ehhzK2LfSBJTWxmmKKvdvZIhIIbsNKunaZz5rpFsJR wk2r+2BqjP0H48gkTwWvp0ekBjpfbqhGaP88THm2YalIKR2eAz1YxQJdDV6STpzExa8b pzkg8KZXuf/uGza1nKRzdPInQu0Dc0dDThejB5xtL5bKqMYCbJqH9Al2JNlMmvQMgQ47 YBag== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=dBLLpsR1iPYwE8shFTvqe4zT2W/wYiW7XgileQ+R40U=; b=q3DSkR2yNYyZ85iErGxScuNXxIBMgpuGyI3FSbfiOZCNZqLugbm5m3/k3JK72Udxy3 +tmjs7OoPoOtVP2HBUgwRxG10vrMsrjbXzvbvI6wXyeZ2+B4mXxIC+uYc++vq8uW0DKc Hb5XIZ+ZB3rloppaXo0TTgQEbCotWI6sN9CidY3JIK01iEMycTFowInPMbDtp+2ZnB+/ +zgQxZe6wmT6/jG7d7DA20D+7RoZfEmwR7yiKx0rnGV86nAfjHz2Sk0vcOAT+JqdhwiY KO1jYj7BlUDfHsfZtoUdyNGJyUPL2XJZKq8DQ7DEAEKskkqF7ped+pEZrJRmMBG6s1bV K2yQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Mw8ddgqm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s13-20020a056a0008cd00b00565ab6fdd86si39016875pfu.56.2022.10.24.05.26.11; Mon, 24 Oct 2022 05:26:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Mw8ddgqm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233651AbiJXMZr (ORCPT + 99 others); Mon, 24 Oct 2022 08:25:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40682 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233756AbiJXMYN (ORCPT ); Mon, 24 Oct 2022 08:24:13 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5C64D37F8C; Mon, 24 Oct 2022 05:00:10 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 5A795B811E0; Mon, 24 Oct 2022 11:55:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id ABC89C433C1; Mon, 24 Oct 2022 11:55:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612558; bh=FyCdJYzELcqWqBl95dcc8i6zX3vwHF5ZkCWr/GY/HQQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Mw8ddgqmRcpKv/CE7zpye7vkn8KIbb4wFj6h0LZ47fkAqSs9Qk0fOgk5WvmRnjzsH uGFpBEbKU+bwGc/nUwK/kdExQuw0fq03gvMDxJyUbSbBBezMH7J8OVKBI7UZxVLdvS J56v9Df7n78I7cEA7hiq+cOe3dirAeGbA9cmxcrA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Takashi Iwai Subject: [PATCH 4.19 033/229] ALSA: rawmidi: Drop register_mutex in snd_rawmidi_free() Date: Mon, 24 Oct 2022 13:29:12 +0200 Message-Id: <20221024113000.187580600@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747571845312600952?= X-GMAIL-MSGID: =?utf-8?q?1747571845312600952?= From: Takashi Iwai commit a70aef7982b012e86dfd39fbb235e76a21ae778a upstream. The register_mutex taken around the dev_unregister callback call in snd_rawmidi_free() may potentially lead to a mutex deadlock, when OSS emulation and a hot unplug are involved. Since the mutex doesn't protect the actual race (as the registration itself is already protected by another means), let's drop it. Link: https://lore.kernel.org/r/CAB7eexJP7w1B0mVgDF0dQ+gWor7UdkiwPczmL7pn91xx8xpzOA@mail.gmail.com Cc: Link: https://lore.kernel.org/r/20221011070147.7611-1-tiwai@suse.de Signed-off-by: Takashi Iwai Signed-off-by: Greg Kroah-Hartman --- sound/core/rawmidi.c | 2 -- 1 file changed, 2 deletions(-) --- a/sound/core/rawmidi.c +++ b/sound/core/rawmidi.c @@ -1655,10 +1655,8 @@ static int snd_rawmidi_free(struct snd_r snd_info_free_entry(rmidi->proc_entry); rmidi->proc_entry = NULL; - mutex_lock(®ister_mutex); if (rmidi->ops && rmidi->ops->dev_unregister) rmidi->ops->dev_unregister(rmidi); - mutex_unlock(®ister_mutex); snd_rawmidi_free_substreams(&rmidi->streams[SNDRV_RAWMIDI_STREAM_INPUT]); snd_rawmidi_free_substreams(&rmidi->streams[SNDRV_RAWMIDI_STREAM_OUTPUT]); From patchwork Mon Oct 24 11:29:13 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8687 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp422453wru; Mon, 24 Oct 2022 05:22:44 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6X/Wd0XMW3+lmYLAmI91G8PgJbAckWhq7ohxcskqB6EW3hNs2s2x8FvX9lbCn8VrA6oWbf X-Received: by 2002:a05:6402:1906:b0:45d:db20:7709 with SMTP id e6-20020a056402190600b0045ddb207709mr29781979edz.406.1666614163813; Mon, 24 Oct 2022 05:22:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666614163; cv=none; d=google.com; s=arc-20160816; b=n+9NXM5YO43zGZV9CgwnIO3u4KhojZne8i6EPMoal2YS8ct9AP11gXG6A0ZIxQHoFV GBW7WKEY5HSdC0JzTaPVFUaoeQznJdXuoXlo8yORRQ1aY7IiE6YCygDVS89lrL1TIwsQ qmEaQPzh5Z1qOIu1gn5xoF0YSS/spn8DE+0pgxvq9YlrZHR/0/4ZbOZqfz9YzkkVbyEo iV4scMx5xvifYU65oVGwbpnF+ruZ7bWkrZmrbwPjRdzCZnzluQBf5ik/N4byL1SG1sXs ocHc8O5/uxPxMWDlaJ9kyS7ZoHA8mjK8t9bRjj/Z8mBrfyx8XXhPRwOOAXwCTB3oaLQ7 cIlA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=LLIRqXNUq9qxGPpZxoEFbMqvsp6UGVM0k/gVAKOl0/Q=; b=0LjLv5pDAT8GfUpHUgYYp14k2/KhrupXLjtVcKMHDELrGDE5VXPDnQbW8TVpYzJuDx fPQ9cuvsq/+gOE3p7gHHXchHNlrT/t+wU3xMvZFOX4YUbZz1gMXUkSIQQ8VxDFGW3vWo 09z0AmocmX9Q8cBEoq9vDRrlLdv6IFikB++Bv5b4KWkVnTKWwN6s4/wS/IjxfDV6Vd3o DqkPiXuXEANAWwUpsaTeu++c97nNZ+bQLrXX2IO+5zfRd4OyyEfAVhP/Y7a5cuixOJEd HqY2wWYJ3H436Rda+aGy4ziTe9Tz6VapDqxeQov/upHUYQGiyVLwIQ4OFO1dI8Hdb/sK Q2SA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=UYTyzqvK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id dn3-20020a17090794c300b007806a130086si26627745ejc.302.2022.10.24.05.22.19; Mon, 24 Oct 2022 05:22:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=UYTyzqvK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233285AbiJXMVL (ORCPT + 99 others); Mon, 24 Oct 2022 08:21:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50692 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233409AbiJXMTZ (ORCPT ); Mon, 24 Oct 2022 08:19:25 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 22F4882D29; Mon, 24 Oct 2022 04:58:02 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id BA24161252; Mon, 24 Oct 2022 11:56:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C9C24C433D7; Mon, 24 Oct 2022 11:56:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612561; bh=alxBghWNnhholB3VzlLrbDxYywOEImlsaWDNbu24k10=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UYTyzqvKbAppaqqepP5BwAh2zDAx82l6o7DbzWgtrrz/7cGvEMs0eqmbvtxCeZzkN KAOVP5Fbn7rX5phAJXcKmX/AY7HaI0BvXfEohFYoVWg+t9+E1dGHr16x2B+I5Svl+A PnvmOpzrS9ytw/HGavb8tn9w8vvELSUMknfmjsrk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Takashi Iwai Subject: [PATCH 4.19 034/229] ALSA: usb-audio: Fix potential memory leaks Date: Mon, 24 Oct 2022 13:29:13 +0200 Message-Id: <20221024113000.217616844@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747571613366435930?= X-GMAIL-MSGID: =?utf-8?q?1747571613366435930?= From: Takashi Iwai commit 6382da0828995af87aa8b8bef28cc61aceb4aff3 upstream. When the driver hits -ENOMEM at allocating a URB or a buffer, it aborts and goes to the error path that releases the all previously allocated resources. However, when -ENOMEM hits at the middle of the sync EP URB allocation loop, the partially allocated URBs might be left without released, because ep->nurbs is still zero at that point. Fix it by setting ep->nurbs at first, so that the error handler loops over the full URB list. Cc: Link: https://lore.kernel.org/r/20220930100151.19461-1-tiwai@suse.de Signed-off-by: Takashi Iwai Signed-off-by: Greg Kroah-Hartman --- sound/usb/endpoint.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) --- a/sound/usb/endpoint.c +++ b/sound/usb/endpoint.c @@ -816,6 +816,7 @@ static int sync_ep_set_params(struct snd if (!ep->syncbuf) return -ENOMEM; + ep->nurbs = SYNC_URBS; for (i = 0; i < SYNC_URBS; i++) { struct snd_urb_ctx *u = &ep->urb[i]; u->index = i; @@ -835,8 +836,6 @@ static int sync_ep_set_params(struct snd u->urb->complete = snd_complete_urb; } - ep->nurbs = SYNC_URBS; - return 0; out_of_memory: From patchwork Mon Oct 24 11:29:14 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8661 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp421747wru; Mon, 24 Oct 2022 05:21:08 -0700 (PDT) X-Google-Smtp-Source: AMsMyM50+nlVIfZmp9ZAyJei750R24YTwyNQ+SCif3fIxIAMEEu6PtU5J1zacT2yyM22OkCXxuRr X-Received: by 2002:a17:907:9707:b0:78d:45d1:487e with SMTP id jg7-20020a170907970700b0078d45d1487emr26898571ejc.566.1666614067843; Mon, 24 Oct 2022 05:21:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666614067; cv=none; d=google.com; s=arc-20160816; b=fNR4f+UUbd6htbzAqnY5NC4dPlurI2ZKGBjelqQdcWzySqUO4GHlCsjTJi9AosL580 KaJ+3bEQ7LNhO/ZI2vLWIXH9qiCm9uf3ocVRgA8HYRYM511rNAxUuENjDmZy6ItUNONQ JrSx5bvW44EWkHJeuwBe0fWKL7cEyDAoFgvc6VL1MkGz87xNtv013u8git53g8mt65kp LNybF9AzH+01diGK157ySj1tr0XicVm7nOGm6OE1bHQLKgxPaFpMbniMuaNJO7xilcqJ pz4TY1D6gqXdc2nRg+5RsiaXo2C+/vmjSuHFhVTmtZiA44xMdGjcdj6I38nb4hEMllCm tTrA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=DdFZ1cinygSsriobG550QUqAq5pltVLrhdrXA4ROhCc=; b=LxefP1LFjtZYe7ylOZUO5MlxjhXvhUYnL3tn30Em73S5TcTd9OVmzyL9p1P9yraSI3 x3AYwrJQlXwrFKdr9mSuakre96nSpDz42s2L+yFZPoOgUelqHIHKaxKSzBfKc/L57nze LuNC90zfEDkAmO7WS9C/zBOFOlKb7g3NkzcqMowfNmeh8sZlgTG25ILxCUAs0eEnkMsb YL7hgcnkbzsNxGaIH8hyzCRnHKVyGqUvvAlEon6W0iThw3FHW3E08xrQKWmIzM/cK7vO 9pq1vAdFEi90OGJUWdI3feKT8gqnRPI7WYlCqmudn+vgeIZ3mMV2UnbnuY19eMs955PF MkUQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=HmbJg15G; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r11-20020a05640251cb00b0045d9ceae6d8si20641901edd.492.2022.10.24.05.20.43; Mon, 24 Oct 2022 05:21:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=HmbJg15G; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233178AbiJXMRJ (ORCPT + 99 others); Mon, 24 Oct 2022 08:17:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51230 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233442AbiJXMPH (ORCPT ); Mon, 24 Oct 2022 08:15:07 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 91B6E773BF; Mon, 24 Oct 2022 04:56:04 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 5544B612B9; Mon, 24 Oct 2022 11:56:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 63D5DC433D6; Mon, 24 Oct 2022 11:56:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612563; bh=FSdbiPueVjPIiHHnV4K5YK5PYMbHBcrAoHkWO81VVtQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HmbJg15GqgeJFEPZJBCchrIDPK2tHZFFiHCXRSoQTLNQrTuqNWjnSGQcqhgtS4n7c y3AryHt1rtpgPVbSgE9uKPxYH9jfocf8g4ouQ1dyIFkN9+WqN47v2GgHVjZT0Ooo4R xzxlZFQoC9Xhqm+2CpgUOKRXWqJXGwv+72QBCnrY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Sabri N. Ferreiro" , Takashi Iwai Subject: [PATCH 4.19 035/229] ALSA: usb-audio: Fix NULL dererence at error path Date: Mon, 24 Oct 2022 13:29:14 +0200 Message-Id: <20221024113000.246577547@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747571512730635301?= X-GMAIL-MSGID: =?utf-8?q?1747571512730635301?= From: Takashi Iwai commit 568be8aaf8a535f79c4db76cabe17b035aa2584d upstream. At an error path to release URB buffers and contexts, the driver might hit a NULL dererence for u->urb pointer, when u->buffer_size has been already set but the actual URB allocation failed. Fix it by adding the NULL check of urb. Also, make sure that buffer_size is cleared after the error path or the close. Cc: Reported-by: Sabri N. Ferreiro Link: https://lore.kernel.org/r/CAKG+3NRjTey+fFfUEGwuxL-pi_=T4cUskYG9OzpzHytF+tzYng@mail.gmail.com Link: https://lore.kernel.org/r/20220930100129.19445-1-tiwai@suse.de Signed-off-by: Takashi Iwai Signed-off-by: Greg Kroah-Hartman --- sound/usb/endpoint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/sound/usb/endpoint.c +++ b/sound/usb/endpoint.c @@ -86,12 +86,13 @@ static inline unsigned get_usb_high_spee */ static void release_urb_ctx(struct snd_urb_ctx *u) { - if (u->buffer_size) + if (u->urb && u->buffer_size) usb_free_coherent(u->ep->chip->dev, u->buffer_size, u->urb->transfer_buffer, u->urb->transfer_dma); usb_free_urb(u->urb); u->urb = NULL; + u->buffer_size = 0; } static const char *usb_error_string(int err) From patchwork Mon Oct 24 11:29:15 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8744 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp427304wru; Mon, 24 Oct 2022 05:33:21 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4bOBLGmZn7xQsNws1fXT1V9WJ9QZzVUejH6Cx2tLKaEUwTzkvl47cgidjlcvnnuPBibOB9 X-Received: by 2002:a05:6402:518d:b0:45d:d319:2a88 with SMTP id q13-20020a056402518d00b0045dd3192a88mr29717707edd.35.1666614801206; Mon, 24 Oct 2022 05:33:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666614801; cv=none; d=google.com; s=arc-20160816; b=zT7mzwnb6mOGTnJf7vcycY/T/i2wTnmpT76+1JlZJDC5cll7XI1+T6JQgFR7BYEQA2 EPHDO/WWfxJ5ICAnovxMQb1BMjDZjHFK+s8kpnWlWedV7KG4hOxqdKci6retSwwsKJkS o9mGJSSs/Go9dcYa5KcUe0fHaUMe/MfSKpf751WYTpC/u2ia6bdOZMKco/2X2zBf4YKD L9PwM//EDaJMMyjsLP08wMGWwC90GFsTU/NqOkhSLvKz+BXggwX5NgcTlnMAZvWSbv8X RZjk+B0y/SjFVoajNmVxZCFaZfNfm5mRVYKTE7RuMazhkOiC1V9Kg7f4yp0brCzIaepy xdhQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=HG+enwRiIuEkJiHM3XIDjJbjIVnHKm+FiM8QnTd6IYs=; b=DRLXm2wBkclm4XeISoCg92nmENzpP1atDP0+C4j3f8a5l9u7oQ1w/CA6BRYa2daGCy SWnlHAFwH2du1aUTctlRPiFn2guLVnUIkIpVFOrahoLnizE7ndKW3KZVeDADlGF0PZC9 /5xD1fjoxdMtUi+ULQnmAn+G0yXR1RsWPfLVmMDx4DvBiKnnFh4CmhD4Ky7lpBQ5NNOP wcZkYG60YylOmBbQnA6/t4I1IO5qTKn4OAG1ROpA8ouOMWrwrZkikQFVHKaZ+lOpEHI3 JsfwrYkIbVU9PM7IqDUwl51EgNpsdfQXDkIMQISFrCM6UwAR20NwXeYB3F5eR0QFFgBH 8B5g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=G36qwIvB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id mp28-20020a1709071b1c00b0078e27f2ef4bsi27011634ejc.956.2022.10.24.05.32.45; Mon, 24 Oct 2022 05:33:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=G36qwIvB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233728AbiJXM2F (ORCPT + 99 others); Mon, 24 Oct 2022 08:28:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60536 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233200AbiJXM1F (ORCPT ); Mon, 24 Oct 2022 08:27:05 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D5B087C308; Mon, 24 Oct 2022 05:01:33 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 759B7B811DA; Mon, 24 Oct 2022 11:56:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CD01DC433D6; Mon, 24 Oct 2022 11:56:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612569; bh=Z3gWvSE3fw+Ff54MumYb9CCVjoFOZxUJC1XFP/tVtqs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=G36qwIvBX2a18myutdbA8J0fsC2lgryl8RQylS5jvy5g0zbLD92rvssWcZo+JjKZM 5P/5P9jEJidVCOSyanlaIY1d20DOOVZEXI8cjp+33GG3xBmMvXyvlXXso99XIVYoUG jsScRMN+BndTQYYEj1hX648V4FZqeUcxELIjf14c= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Callum Osmotherly , Takashi Iwai Subject: [PATCH 4.19 036/229] ALSA: hda/realtek: remove ALC289_FIXUP_DUAL_SPK for Dell 5530 Date: Mon, 24 Oct 2022 13:29:15 +0200 Message-Id: <20221024113000.275548420@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747572281491524878?= X-GMAIL-MSGID: =?utf-8?q?1747572281491524878?= From: Callum Osmotherly commit 417b9c51f59734d852e47252476fadc293ad994a upstream. After some feedback from users with Dell Precision 5530 machines, this patch reverts the previous change to add ALC289_FIXUP_DUAL_SPK. While it improved the speaker output quality, it caused the headphone jack to have an audible "pop" sound when power saving was toggled. Fixes: 1885ff13d4c4 ("ALSA: hda/realtek: Enable 4-speaker output Dell Precision 5530 laptop") Signed-off-by: Callum Osmotherly Cc: Link: https://lore.kernel.org/r/Yz0uyN1zwZhnyRD6@piranha Signed-off-by: Takashi Iwai Signed-off-by: Greg Kroah-Hartman --- sound/pci/hda/patch_realtek.c | 1 - 1 file changed, 1 deletion(-) --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c @@ -7081,7 +7081,6 @@ static const struct snd_pci_quirk alc269 SND_PCI_QUIRK(0x1028, 0x0871, "Dell Precision 3630", ALC255_FIXUP_DELL_HEADSET_MIC), SND_PCI_QUIRK(0x1028, 0x0872, "Dell Precision 3630", ALC255_FIXUP_DELL_HEADSET_MIC), SND_PCI_QUIRK(0x1028, 0x0873, "Dell Precision 3930", ALC255_FIXUP_DUMMY_LINEOUT_VERB), - SND_PCI_QUIRK(0x1028, 0x087d, "Dell Precision 5530", ALC289_FIXUP_DUAL_SPK), SND_PCI_QUIRK(0x1028, 0x08ad, "Dell WYSE AIO", ALC225_FIXUP_DELL_WYSE_AIO_MIC_NO_PRESENCE), SND_PCI_QUIRK(0x1028, 0x08ae, "Dell WYSE NB", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE), SND_PCI_QUIRK(0x1028, 0x0935, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB), From patchwork Mon Oct 24 11:29:16 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8739 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp424046wru; Mon, 24 Oct 2022 05:26:31 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4sRpmfCC8oAX0BMZyvZLZr5kNW9IafDO+AxAI/KbIixOa1Mx5xjRASSwAlJo8IU0xgzSiE X-Received: by 2002:a17:902:8642:b0:186:6740:dfd4 with SMTP id y2-20020a170902864200b001866740dfd4mr21416627plt.18.1666614391339; Mon, 24 Oct 2022 05:26:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666614391; cv=none; d=google.com; s=arc-20160816; b=aiD965g5kuSuSCq3xB3SOFZZaTm1LD81d8w8r9lU7/5KH4PYbgx8KvxbIpSznmIuMk LEufA1b2V9m3TovugItU/JnKAS2IAkfeYcP0XtQ2hA3L3aJ3vjwq/uoa1e1v9vuTfKjC e0NBM99lrvVipN4ZOyjzza7ymWUPJy0J8uJhpWZNRslqi7OdwCYA8UHuLMN6rHpUQ1Jr vfcS3E7Vjkc71kLzF8JIiWgiQPLU84f71g0JBryrZvOygbEBBoEWwbyRnVrc2asxx259 oZSU3oHVxjxaiIvKVINxPKkEbGg4QkCnSNily1Ch+WreddwT9kszlXXQRRtVUAFOzCVn DZyw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=d9+VQVnfw/LLAzgWElOjsZ5JayxdB2p/rzl1QjzdOdM=; b=HVfQpFUU8rL8JcCR0oIqCXq8sPlMQLwu8ENIoWwfwjJXtMwBRwZHbW+SAVqVi0ONxd L7Lpu8CQhW5cjf3sUrHwi4qPQLQ6sOTXJ0QKphyrimxakoKew3Hl52BHvNH6qw0LMsDG UP/Oi2UmHIW0YPcpPKAZWd1gRfiGamKNqM16rLeajoJPiS75brKK6WYsocX2eZ77pNtc sNdaVHf1jFQ1KE+gR76DItflC9e0CoXGyIRhxoQYDuvkeF7nUf7ZjQfRqxh2+6BowIbO +nbcxfyj5+0K/r2P9RyTOJeJkRPyisvBpimQ/UVSN2m328K6Yp99ZfpjOQRh8PC03cGz fi4Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=sz6U8loa; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k3-20020a170902ce0300b0017492fb90b0si34907485plg.182.2022.10.24.05.26.15; Mon, 24 Oct 2022 05:26:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=sz6U8loa; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233619AbiJXMZw (ORCPT + 99 others); Mon, 24 Oct 2022 08:25:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56996 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233786AbiJXMYS (ORCPT ); Mon, 24 Oct 2022 08:24:18 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6A2F85FA8; Mon, 24 Oct 2022 05:00:24 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 1A048B811E6; Mon, 24 Oct 2022 11:56:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6B084C433B5; Mon, 24 Oct 2022 11:56:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612571; bh=MPx8MYZaOpRhJircYdIbMtxUIK98qNQOL2IsJCYo8Pk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sz6U8loaYMgwSKHqpZ71LGpQcWIP+nMdiOXq1Oh7amVNN/XtX8Smpx3c/dXlB/TIk 8MfxGBMxfnm241msD4iiE9w54yPoG6UNCZ8ptDjDS6DZwP6BO8HlmynWa1NzHUJVpo EoPLInAtPDH1Ki4yxmR+YD62Eh0iJu8MOsciyb60= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Tudor Ambarus , Alexander Dahl , Peter Rosin , Boris Brezillon , Miquel Raynal Subject: [PATCH 4.19 037/229] mtd: rawnand: atmel: Unmap streaming DMA mappings Date: Mon, 24 Oct 2022 13:29:16 +0200 Message-Id: <20221024113000.304537542@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747571852172056470?= X-GMAIL-MSGID: =?utf-8?q?1747571852172056470?= From: Tudor Ambarus commit 1161703c9bd664da5e3b2eb1a3bb40c210e026ea upstream. Every dma_map_single() call should have its dma_unmap_single() counterpart, because the DMA address space is a shared resource and one could render the machine unusable by consuming all DMA addresses. Link: https://lore.kernel.org/lkml/13c6c9a2-6db5-c3bf-349b-4c127ad3496a@axentia.se/ Cc: stable@vger.kernel.org Fixes: f88fc122cc34 ("mtd: nand: Cleanup/rework the atmel_nand driver") Signed-off-by: Tudor Ambarus Acked-by: Alexander Dahl Reported-by: Peter Rosin Tested-by: Alexander Dahl Reviewed-by: Boris Brezillon Tested-by: Peter Rosin Signed-off-by: Miquel Raynal Link: https://lore.kernel.org/linux-mtd/20220728074014.145406-1-tudor.ambarus@microchip.com Signed-off-by: Greg Kroah-Hartman --- drivers/mtd/nand/raw/atmel/nand-controller.c | 1 + 1 file changed, 1 insertion(+) --- a/drivers/mtd/nand/raw/atmel/nand-controller.c +++ b/drivers/mtd/nand/raw/atmel/nand-controller.c @@ -398,6 +398,7 @@ static int atmel_nand_dma_transfer(struc dma_async_issue_pending(nc->dmac); wait_for_completion(&finished); + dma_unmap_single(nc->dev, buf_dma, len, dir); return 0; From patchwork Mon Oct 24 11:29:17 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 10035 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp622514wru; Mon, 24 Oct 2022 12:45:39 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7P5IL4gZ8oqlBE6pUlnu5eo7grhMeZcJEwnwUYwyo5UpHUopD7P2ICPjze7yJiUQFChIkI X-Received: by 2002:a17:907:94c3:b0:78e:2866:f89f with SMTP id dn3-20020a17090794c300b0078e2866f89fmr28489029ejc.617.1666640727971; Mon, 24 Oct 2022 12:45:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666640727; cv=none; d=google.com; s=arc-20160816; b=sd/9sAju8LWOgnDIFv08kdtCjFtT/vemU1ZF2KPte+soOYy/dpUup47+Op2dyUgupl Guc39SBH92nstX/xU3b1euxY/Yq0jcT59YgduKWX8aFz9SfUI0ncb2rZNzAfu60eONb8 iBQ1DKgUjWH3GOUf2qpSzHfFx8ncFZuoNCIQbEFBetF1g1Vac6pondVPsT8TUOZWXPgH /73/2cElqYG8zx+oZP1KGTg36+Ac08M1HP4RMN/ThCENnOjszcQ+wEc4KXf/LgPwP5es R0lTxAW6lnRFZpk4VwzNlORGqJ34ZP2zNUhlGYXpPcjqJU3pwo9Q6K9rxpvFTq6swKIq fOaw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=pn/M2dHQCKD27/ud0g5rdI8WzQmq4JR12MCp/6XST1w=; b=Eu4tYp3wRof8OEQdqhxfaCCrO/0eVF8MgoJApMhCU6mDnlJg8/xFOpF0ON0DDoYlkJ Gp0z+H9ug7lA1Gs8lLjqNFguyWgxXKwixfac3rwB18vVqwyMbRi+xoxelxtkEPfYErT5 crudngwmVHTVYY43HvQrX/w0rpkiJkjznH6SzEWm69eCvIpzVIpQzCLTVoLs0JOFx+2H FgGbSarX3cLJuuWQe/X4ZZBkVgGdY1q4gf0YReV9/BjWGCVPu9DKrH7eziC94DKSTjgz WO9w4qnpzKKljaNTCyiYDqHn+ALxGpisNbGUS6OFaS6dKuML//NBdsQEAhsrpX/ksWwL Ijwg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=jzqRBVDp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x19-20020a05640226d300b0043dfc949d31si771455edd.25.2022.10.24.12.44.58; Mon, 24 Oct 2022 12:45:27 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=jzqRBVDp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233400AbiJXTmJ (ORCPT + 99 others); Mon, 24 Oct 2022 15:42:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36834 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232772AbiJXTlS (ORCPT ); Mon, 24 Oct 2022 15:41:18 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EA83C25ED2E; Mon, 24 Oct 2022 11:11:00 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id C21D8B811E3; Mon, 24 Oct 2022 11:56:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1B85EC433D6; Mon, 24 Oct 2022 11:56:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612574; bh=oPcGZNPOVZFp9ic2M+WBGGfeOaLqyr96TvPpJbQRVoo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jzqRBVDpilwy1GlvHyKHqfuD5wVVWezGWNItVf3GbMAqiWy/3ii+3NmQgLujWXC0k 29XScArLczgdYaf5/g9aKkSrFmsPSJkxXeznZaBZpZb6dUu6Z/R0Q/O6k+IVXFK7zb PjYj133+9e5fvPri9e2Qz5fe29lSNZJ1I6Dpo95E= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Michael Hennerich , =?utf-8?q?Nuno_S=C3=A1?= , Stable@vger.kernel.org, Jonathan Cameron Subject: [PATCH 4.19 038/229] iio: dac: ad5593r: Fix i2c read protocol requirements Date: Mon, 24 Oct 2022 13:29:17 +0200 Message-Id: <20221024113000.334009591@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747599468002159306?= X-GMAIL-MSGID: =?utf-8?q?1747599468002159306?= From: Michael Hennerich commit 558a25f903b4af6361b7fbeea08a6446a0745653 upstream. For reliable operation across the full range of supported interface rates, the AD5593R needs a STOP condition between address write, and data read (like show in the datasheet Figure 40) so in turn i2c_smbus_read_word_swapped cannot be used. While at it, a simple helper was added to make the code simpler. Fixes: 56ca9db862bf ("iio: dac: Add support for the AD5592R/AD5593R ADCs/DACs") Signed-off-by: Michael Hennerich Signed-off-by: Nuno Sá Cc: Link: https://lore.kernel.org/r/20220913073413.140475-2-nuno.sa@analog.com Signed-off-by: Jonathan Cameron Signed-off-by: Greg Kroah-Hartman --- drivers/iio/dac/ad5593r.c | 46 +++++++++++++++++++++++++++------------------- 1 file changed, 27 insertions(+), 19 deletions(-) --- a/drivers/iio/dac/ad5593r.c +++ b/drivers/iio/dac/ad5593r.c @@ -15,6 +15,8 @@ #include #include +#include + #define AD5593R_MODE_CONF (0 << 4) #define AD5593R_MODE_DAC_WRITE (1 << 4) #define AD5593R_MODE_ADC_READBACK (4 << 4) @@ -22,6 +24,24 @@ #define AD5593R_MODE_GPIO_READBACK (6 << 4) #define AD5593R_MODE_REG_READBACK (7 << 4) +static int ad5593r_read_word(struct i2c_client *i2c, u8 reg, u16 *value) +{ + int ret; + u8 buf[2]; + + ret = i2c_smbus_write_byte(i2c, reg); + if (ret < 0) + return ret; + + ret = i2c_master_recv(i2c, buf, sizeof(buf)); + if (ret < 0) + return ret; + + *value = get_unaligned_be16(buf); + + return 0; +} + static int ad5593r_write_dac(struct ad5592r_state *st, unsigned chan, u16 value) { struct i2c_client *i2c = to_i2c_client(st->dev); @@ -40,13 +60,7 @@ static int ad5593r_read_adc(struct ad559 if (val < 0) return (int) val; - val = i2c_smbus_read_word_swapped(i2c, AD5593R_MODE_ADC_READBACK); - if (val < 0) - return (int) val; - - *value = (u16) val; - - return 0; + return ad5593r_read_word(i2c, AD5593R_MODE_ADC_READBACK, value); } static int ad5593r_reg_write(struct ad5592r_state *st, u8 reg, u16 value) @@ -60,25 +74,19 @@ static int ad5593r_reg_write(struct ad55 static int ad5593r_reg_read(struct ad5592r_state *st, u8 reg, u16 *value) { struct i2c_client *i2c = to_i2c_client(st->dev); - s32 val; - - val = i2c_smbus_read_word_swapped(i2c, AD5593R_MODE_REG_READBACK | reg); - if (val < 0) - return (int) val; - *value = (u16) val; - - return 0; + return ad5593r_read_word(i2c, AD5593R_MODE_REG_READBACK | reg, value); } static int ad5593r_gpio_read(struct ad5592r_state *st, u8 *value) { struct i2c_client *i2c = to_i2c_client(st->dev); - s32 val; + u16 val; + int ret; - val = i2c_smbus_read_word_swapped(i2c, AD5593R_MODE_GPIO_READBACK); - if (val < 0) - return (int) val; + ret = ad5593r_read_word(i2c, AD5593R_MODE_GPIO_READBACK, &val); + if (ret) + return ret; *value = (u8) val; From patchwork Mon Oct 24 11:29:18 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8802 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp430899wru; Mon, 24 Oct 2022 05:42:30 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5rhx9QPuzgF1v8wNz0I/ULsW/pP3+oKvblMW+0r+milcRRfHwgnAhZnknWGtJVicFcIsma X-Received: by 2002:a17:90b:1e0c:b0:20f:bcbf:ab5 with SMTP id pg12-20020a17090b1e0c00b0020fbcbf0ab5mr36732813pjb.187.1666615349766; Mon, 24 Oct 2022 05:42:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666615349; cv=none; d=google.com; s=arc-20160816; b=Pyn47L0eleZuxIKTwgYaLiNoMUROG2sldezoDQell9bOFJRR4v72C7oQ+AsPFUBcvH nRcqkwM/a8iaqBCV80+Ok69d09kg9NXj4hcVwEOgcZLSnWFL00+WFJlc7wfIEx+qn7Yz noICQSeGFNpMt7edC8XiaItFqdHXeG4yXX0k4d2mNYitI1W6c4hHImT04SL9LkLMs0rh Xi3QI0M4WWXXbojyborsdYaEbH5lbaLnffpqVNzsy0vSrlyOD8t6hQqmK7Vz4ZwL3gsi 3vBa+7vwuJ/XGAkQmo9/B53tlmwcs1rXLpPlZkwESp9ljWJQnI5D/IawVxYsO4bGbyld jSKg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=X2Y7k+O/EHqEPGcV39P9ML5DluktjlZRpO6VdstOmEA=; b=CEORZTM3bzjA1NPNiUUk0TG/X6agdRclCGN5xHlmavR3JTdSPiUGCCNF52eDED+JI/ lTLL8yUekEld6e1JXOJf3bIE8cFcPzRaoiyuBMv1FbnB3cY2lHTeUBp4SppvNFDSkt5K FIJiK1zJ7VKsyJQQvNuaqnYgOH5YDN2OCm0FF58z3jUBB2slliyYqhjICoHEmubdjcqE qP1WIlad883NQALEd2pvUZ7nzjM2PxBhkjL97zubHVprg5zkADqF42EpEhrMKq+y00Pk r3k9WxMSfoceRB8HQbyjj//Y5AnlBXde+VQZYUiJc2cyAy6Q+X3H81zShGFXzu3ivo37 JtSQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=kvyo8utk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id on6-20020a17090b1d0600b0020d309db154si9964918pjb.187.2022.10.24.05.42.16; Mon, 24 Oct 2022 05:42:29 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=kvyo8utk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234237AbiJXMef (ORCPT + 99 others); Mon, 24 Oct 2022 08:34:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44218 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234194AbiJXM3g (ORCPT ); Mon, 24 Oct 2022 08:29:36 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 74E81876A6; Mon, 24 Oct 2022 05:03:23 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id A22F16126B; Mon, 24 Oct 2022 11:56:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B67AFC433C1; Mon, 24 Oct 2022 11:56:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612577; bh=yQyto2Ce9b73hWIW5ToDONrZ7wExoMDHWAq3LWLzMCw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kvyo8utknicJeSyczKAhvruuSe+qyfhaaWnjyFOq9dpPeG5lY5xRbFKEIfcic9X24 UEa8u+4aw4GtRETNxSn6Ytp8x8n30Plj3XXq8VEuKRaajx9fsTTD3LWBIte8+4v4Ra RIwbg8ZpbXe2mDbkaNd+zTZXYi3oHLWDN0gERDZY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jean-Francois Le Fillatre , stable Subject: [PATCH 4.19 039/229] usb: add quirks for Lenovo OneLink+ Dock Date: Mon, 24 Oct 2022 13:29:18 +0200 Message-Id: <20221024113000.364453553@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747572856651937235?= X-GMAIL-MSGID: =?utf-8?q?1747572856651937235?= From: Jean-Francois Le Fillatre commit 37d49519b41405b08748392c6a7f193d9f77ecd2 upstream. The Lenovo OneLink+ Dock contains two VL812 USB3.0 controllers: 17ef:1018 upstream 17ef:1019 downstream These hubs suffer from two separate problems: 1) After the host system was suspended and woken up, the hubs appear to be in a random state. Some downstream ports (both internal to the built-in audio and network controllers, and external to USB sockets) may no longer be functional. The exact list of disabled ports (if any) changes from wakeup to wakeup. Ports remain in that state until the dock is power-cycled, or until the laptop is rebooted. Wakeup sources connected to the hubs (keyboard, WoL on the integrated gigabit controller) will wake the system up from suspend, but they may no longer work after wakeup (and in that case will no longer work as wakeup source in a subsequent suspend-wakeup cycle). This issue appears in the logs with messages such as: usb 1-6.1-port4: cannot disable (err = -71) usb 1-6-port2: cannot disable (err = -71) usb 1-6.1: clear tt 1 (80c0) error -71 usb 1-6-port4: cannot disable (err = -71) usb 1-6.4: PM: dpm_run_callback(): usb_dev_resume+0x0/0x10 [usbcore] returns -71 usb 1-6.4: PM: failed to resume async: error -71 usb 1-7: reset full-speed USB device number 5 using xhci_hcd usb 1-6.1-port1: cannot reset (err = -71) usb 1-6.1-port1: cannot reset (err = -71) usb 1-6.1-port1: cannot reset (err = -71) usb 1-6.1-port1: cannot reset (err = -71) usb 1-6.1-port1: cannot reset (err = -71) usb 1-6.1-port1: Cannot enable. Maybe the USB cable is bad? usb 1-6.1-port1: cannot disable (err = -71) usb 1-6.1-port1: cannot reset (err = -71) usb 1-6.1-port1: cannot reset (err = -71) usb 1-6.1-port1: cannot reset (err = -71) usb 1-6.1-port1: cannot reset (err = -71) usb 1-6.1-port1: cannot reset (err = -71) usb 1-6.1-port1: Cannot enable. Maybe the USB cable is bad? usb 1-6.1-port1: cannot disable (err = -71) 2) Some USB devices cannot be enumerated properly. So far I have only seen the issue with USB 3.0 devices. The same devices work without problem directly connected to the host system, to other systems or to other hubs (even when those hubs are connected to the OneLink+ dock). One very reliable reproducer is this USB 3.0 HDD enclosure: 152d:9561 JMicron Technology Corp. / JMicron USA Technology Corp. Mobius I have seen it happen sporadically with other USB 3.0 enclosures, with controllers from different manufacturers, all self-powered. Typical messages in the logs: xhci_hcd 0000:00:14.0: Timeout while waiting for setup device command xhci_hcd 0000:00:14.0: Timeout while waiting for setup device command usb 2-1.4: device not accepting address 6, error -62 xhci_hcd 0000:00:14.0: Timeout while waiting for setup device command xhci_hcd 0000:00:14.0: Timeout while waiting for setup device command usb 2-1.4: device not accepting address 7, error -62 usb 2-1-port4: attempt power cycle xhci_hcd 0000:00:14.0: Timeout while waiting for setup device command xhci_hcd 0000:00:14.0: Timeout while waiting for setup device command usb 2-1.4: device not accepting address 8, error -62 xhci_hcd 0000:00:14.0: Timeout while waiting for setup device command xhci_hcd 0000:00:14.0: Timeout while waiting for setup device command usb 2-1.4: device not accepting address 9, error -62 usb 2-1-port4: unable to enumerate USB device Through trial and error, I found that the USB_QUIRK_RESET_RESUME solved the second issue. Further testing then uncovered the first issue. Test results are summarized in this table: ======================================================================================= Settings USB2 hotplug USB3 hotplug State after waking up --------------------------------------------------------------------------------------- power/control=auto works fails broken usbcore.autosuspend=-1 works works broken OR power/control=on power/control=auto works (1) works (1) works and USB_QUIRK_RESET_RESUME power/control=on works works works and USB_QUIRK_RESET_RESUME HUB_QUIRK_DISABLE_AUTOSUSPEND works works works and USB_QUIRK_RESET_RESUME ======================================================================================= In those results, the power/control settings are applied to both hubs, both on the USB2 and USB3 side, before each test. >From those results, USB_QUIRK_RESET_RESUME is required to reset the hubs properly after a suspend-wakeup cycle, and the hubs must not autosuspend to work around the USB3 issue. A secondary effect of USB_QUIRK_RESET_RESUME is to prevent the hubs' upstream links from suspending (the downstream ports can still suspend). This secondary effect is used in results (1). It is enough to solve the USB3 problem. Setting USB_QUIRK_RESET_RESUME on those hubs is the smallest patch that solves both issues. Prior to creating this patch, I have used the USB_QUIRK_RESET_RESUME via the kernel command line for over a year without noticing any side effect. Thanks to Oliver Neukum @Suse for explanations of the operations of USB_QUIRK_RESET_RESUME, and requesting more testing. Signed-off-by: Jean-Francois Le Fillatre Cc: stable Link: https://lore.kernel.org/r/20220927073407.5672-1-jflf_kernel@gmx.com Signed-off-by: Greg Kroah-Hartman --- drivers/usb/core/quirks.c | 4 ++++ 1 file changed, 4 insertions(+) --- a/drivers/usb/core/quirks.c +++ b/drivers/usb/core/quirks.c @@ -438,6 +438,10 @@ static const struct usb_device_id usb_qu { USB_DEVICE(0x1532, 0x0116), .driver_info = USB_QUIRK_LINEAR_UFRAME_INTR_BINTERVAL }, + /* Lenovo ThinkPad OneLink+ Dock twin hub controllers (VIA Labs VL812) */ + { USB_DEVICE(0x17ef, 0x1018), .driver_info = USB_QUIRK_RESET_RESUME }, + { USB_DEVICE(0x17ef, 0x1019), .driver_info = USB_QUIRK_RESET_RESUME }, + /* Lenovo USB-C to Ethernet Adapter RTL8153-04 */ { USB_DEVICE(0x17ef, 0x720c), .driver_info = USB_QUIRK_NO_LPM }, From patchwork Mon Oct 24 11:29:19 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8752 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp430105wru; Mon, 24 Oct 2022 05:40:44 -0700 (PDT) X-Google-Smtp-Source: AMsMyM45SGSkfL8UieTBzKsEFSISD6IH4VpmrFwU6BvklRFiOOw5seONc3InOFBDjinN7ondYCTk X-Received: by 2002:a63:5164:0:b0:43b:e57c:a15f with SMTP id r36-20020a635164000000b0043be57ca15fmr27659698pgl.586.1666615244514; Mon, 24 Oct 2022 05:40:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666615244; cv=none; d=google.com; s=arc-20160816; b=YIhi9/vP3ze3Bkp2DHHkvGNSBZ6adJ8pJ+fmynQSsOjCICDix+vS6LvQ5ZZst2QYRU jMaXUQQ90KK/CMBfI00uOvpOd2Ym74yJOKKpNVH5/vEvwmWMY6fq1GJ1O8u7v1xNKS2G 19NGV2hChEpZOlU1LeMc3tBMka9RFlR4CSPI10gJsgXOcsn11rs8D1j8PiIVtBf4QvlM TiY2bkKDVHyfaQUEqn2+pbHY1dgE3ugiMHWGMj641V5yl8KHY/2m6q49/X7STJIvMIWJ aFcHHFDnbzHE9hSJt/5V0lUgC6/MCM0LUlOj+ngkS1yC0XoXNs1U8UOHQylIinBre1jn 26NQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=dp1v7ZEvCmKBZywwfrj43fzqBkac2yD2T/rlMgipFvk=; b=rngsVv/HhF8jZZLqwjvHtD0LcsJTfDv3dYAmI4vSuUlxxk1ClT43FUGTTr94KovrPe Erc1NUqBKFX6714yriLdlUHjqa5Z00WoB2FDTMrsC69Y4cLZlesYk4hdB+L9snBXZxIq u5GzUOf/z+E/NTJx6RsEtuIWvd24V9A5rIrd3gOL9FngqF7KeAoCzS9j3qMG0wjMr0ib tWzKvKv/B1/VusAXBY8rHvXm1szphH6ARLih2j0g55/T9pBR0BnBfWpPbUuImu0Vfq1z VR/IthI0DVWrQPwijAaj/jjKIW0QE0juZIvUqUO8xowp2zCU4cggg2IL6y3MHDrrcTG7 m+4g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=oB+v55Wy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l7-20020a654c47000000b0045af77f7f19si36008183pgr.400.2022.10.24.05.40.31; Mon, 24 Oct 2022 05:40:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=oB+v55Wy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233787AbiJXM2O (ORCPT + 99 others); Mon, 24 Oct 2022 08:28:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60540 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233739AbiJXM1G (ORCPT ); Mon, 24 Oct 2022 08:27:06 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 44672857E3; Mon, 24 Oct 2022 05:01:26 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 00B6FB811C7; Mon, 24 Oct 2022 11:56:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 56448C433D6; Mon, 24 Oct 2022 11:56:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612579; bh=bK95I0MVbjz+H6Bg0timzUZKnQ+EL05ODHzLLISEBds=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oB+v55Wyf3S0/sdE3WrYMNDQktG0d6McZyreKHNOhVLJKie/tVPUjKt2SP1C1X3E1 owc0gP4IdkIrMBbpA670iO0T91/HlPkC4T1zZo9WESeB937pHOyEn8I1knz9Zc5nQC nb7BoICLp7hx1d3bTk5bnVLBLViJxufroZTm4Ci0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jimmy Assarsson , Anssi Hannula , Marc Kleine-Budde Subject: [PATCH 4.19 040/229] can: kvaser_usb: Fix use of uninitialized completion Date: Mon, 24 Oct 2022 13:29:19 +0200 Message-Id: <20221024113000.393741263@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747572746176473958?= X-GMAIL-MSGID: =?utf-8?q?1747572746176473958?= From: Anssi Hannula commit cd7f30e174d09a02ca2afa5ef093fb0f0352e0d8 upstream. flush_comp is initialized when CMD_FLUSH_QUEUE is sent to the device and completed when the device sends CMD_FLUSH_QUEUE_RESP. This causes completion of uninitialized completion if the device sends CMD_FLUSH_QUEUE_RESP before CMD_FLUSH_QUEUE is ever sent (e.g. as a response to a flush by a previously bound driver, or a misbehaving device). Fix that by initializing flush_comp in kvaser_usb_init_one() like the other completions. This issue is only triggerable after RX URBs have been set up, i.e. the interface has been opened at least once. Cc: stable@vger.kernel.org Fixes: aec5fb2268b7 ("can: kvaser_usb: Add support for Kvaser USB hydra family") Tested-by: Jimmy Assarsson Signed-off-by: Anssi Hannula Signed-off-by: Jimmy Assarsson Link: https://lore.kernel.org/all/20221010150829.199676-3-extja@kvaser.com Signed-off-by: Marc Kleine-Budde Signed-off-by: Greg Kroah-Hartman --- drivers/net/can/usb/kvaser_usb/kvaser_usb_core.c | 1 + drivers/net/can/usb/kvaser_usb/kvaser_usb_hydra.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) --- a/drivers/net/can/usb/kvaser_usb/kvaser_usb_core.c +++ b/drivers/net/can/usb/kvaser_usb/kvaser_usb_core.c @@ -691,6 +691,7 @@ static int kvaser_usb_init_one(struct kv init_usb_anchor(&priv->tx_submitted); init_completion(&priv->start_comp); init_completion(&priv->stop_comp); + init_completion(&priv->flush_comp); priv->can.ctrlmode_supported = 0; priv->dev = dev; --- a/drivers/net/can/usb/kvaser_usb/kvaser_usb_hydra.c +++ b/drivers/net/can/usb/kvaser_usb/kvaser_usb_hydra.c @@ -1886,7 +1886,7 @@ static int kvaser_usb_hydra_flush_queue( { int err; - init_completion(&priv->flush_comp); + reinit_completion(&priv->flush_comp); err = kvaser_usb_hydra_send_simple_cmd(priv->dev, CMD_FLUSH_QUEUE, priv->channel); From patchwork Mon Oct 24 11:29:20 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9084 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp445642wru; Mon, 24 Oct 2022 06:12:56 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7SpSqNWyCPd7z8SUEJ8BA4Xpw4yYzmHjOygZp+MyupUb9yRjcC9eSMvImDtf5DsgrYX1IH X-Received: by 2002:a05:6a00:1488:b0:563:9d96:660f with SMTP id v8-20020a056a00148800b005639d96660fmr33648748pfu.0.1666617175936; Mon, 24 Oct 2022 06:12:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666617175; cv=none; d=google.com; s=arc-20160816; b=DuiY6+l+bAzQdWez/k94rRL3L9PlmupgunYcWd7CIFCUZSVjfOeAV29eZfOD+X5wAQ 7UpwK51Yak9yaan/cdLtDYVZoz7p5LfcmNwUzhqegz9qgU4/nnHC6N+UswR7qw3/0nGd Ph6yfnkIasWolnjXvjhHpqXf5dLkTAgKKDgf8EbJcw48Jn++oJ+9i4ggNZnV054mlyTX ZFTndwHCsS9uLYIy46N72u44rrblAAJI6py6xB5g7voRiNn4DhJueh9bXJQiFH9GtZxt dP/W8YuwW34wxOScLhB9D5UtmL8PdbaJb8PgoKOW5VCQs4LMOZm4NTdfid9p20MJC+Vk 8QNw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=G6+hPiKUYlJTdOD7Xzt85ZC8HUsbwqsfPg1fp/KOQNU=; b=iR+7+1Sq9LBbbN4Nuev+nGumtogWGvDeQcObdNiBZ1OXVtdYARi3oE0hy78gkj1E33 UGtLlUAtg8ESfNxFSdOnaZMLPo5jc3jQz1Wgji6HK1TH10wL/mu3BFgjpSri3W0Yat9x C6ibPi01feNrJCJrYAFcq/Pfb/bYi7/bkURmq1sNcg6+TUpNLDS8rcjHFK0l8s08UL3R vEOIiDI0dc/Iecmo8EVL5OAndaWwYLU6AqkagV3CKymy/Z8ish1zsJMHhVra/uk/Upm9 Nwni6lvB2wbTvc+EAlC+Id5DYC6IuIxEmJ5ReDFlDlFlTBZgygk3xrOcCdcQBqz6q4fl e0BA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=oiMB7LtU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r7-20020a635d07000000b0044c634e3051si35717800pgb.274.2022.10.24.06.12.41; Mon, 24 Oct 2022 06:12:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=oiMB7LtU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235695AbiJXNMV (ORCPT + 99 others); Mon, 24 Oct 2022 09:12:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36912 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235931AbiJXNKN (ORCPT ); Mon, 24 Oct 2022 09:10:13 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B92A8A223E; Mon, 24 Oct 2022 05:23:44 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id E2A4D612CE; Mon, 24 Oct 2022 11:56:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F1BA1C433B5; Mon, 24 Oct 2022 11:56:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612582; bh=FfZJQ7cgeQy24SFeoZdkQ03d0JuMApp87TbnvR3NJuY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oiMB7LtUniRe63rJNt2aBAp6EwTS5Q4g2PDmG55rrhTTMePxUhUGEve+Fsjowtb0v S+Rg76UJOyQz6vr5kKzW+0yT8Z23ES80YRuLo4QA8dHbs8Zg6gWsfO9ueWn7bSmGY2 bJgpJlWZu2LeP5oZQGBllF/hnNF8FMdjfSC2snxE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jimmy Assarsson , Anssi Hannula , Marc Kleine-Budde Subject: [PATCH 4.19 041/229] can: kvaser_usb_leaf: Fix overread with an invalid command Date: Mon, 24 Oct 2022 13:29:20 +0200 Message-Id: <20221024113000.423621759@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747574771873845927?= X-GMAIL-MSGID: =?utf-8?q?1747574771873845927?= From: Anssi Hannula commit 1499ecaea9d2ba68d5e18d80573b4561a8dc4ee7 upstream. For command events read from the device, kvaser_usb_leaf_read_bulk_callback() verifies that cmd->len does not exceed the size of the received data, but the actual kvaser_cmd handlers will happily read any kvaser_cmd fields without checking for cmd->len. This can cause an overread if the last cmd in the buffer is shorter than expected for the command type (with cmd->len showing the actual short size). Maximum overread seems to be 22 bytes (CMD_LEAF_LOG_MESSAGE), some of which are delivered to userspace as-is. Fix that by verifying the length of command before handling it. This issue can only occur after RX URBs have been set up, i.e. the interface has been opened at least once. Cc: stable@vger.kernel.org Fixes: 080f40a6fa28 ("can: kvaser_usb: Add support for Kvaser CAN/USB devices") Tested-by: Jimmy Assarsson Signed-off-by: Anssi Hannula Signed-off-by: Jimmy Assarsson Link: https://lore.kernel.org/all/20221010150829.199676-2-extja@kvaser.com Signed-off-by: Marc Kleine-Budde Signed-off-by: Greg Kroah-Hartman --- drivers/net/can/usb/kvaser_usb/kvaser_usb_leaf.c | 75 +++++++++++++++++++++++ 1 file changed, 75 insertions(+) --- a/drivers/net/can/usb/kvaser_usb/kvaser_usb_leaf.c +++ b/drivers/net/can/usb/kvaser_usb/kvaser_usb_leaf.c @@ -309,6 +309,38 @@ struct kvaser_cmd { } u; } __packed; +#define CMD_SIZE_ANY 0xff +#define kvaser_fsize(field) sizeof_field(struct kvaser_cmd, field) + +static const u8 kvaser_usb_leaf_cmd_sizes_leaf[] = { + [CMD_START_CHIP_REPLY] = kvaser_fsize(u.simple), + [CMD_STOP_CHIP_REPLY] = kvaser_fsize(u.simple), + [CMD_GET_CARD_INFO_REPLY] = kvaser_fsize(u.cardinfo), + [CMD_TX_ACKNOWLEDGE] = kvaser_fsize(u.tx_acknowledge_header), + [CMD_GET_SOFTWARE_INFO_REPLY] = kvaser_fsize(u.leaf.softinfo), + [CMD_RX_STD_MESSAGE] = kvaser_fsize(u.leaf.rx_can), + [CMD_RX_EXT_MESSAGE] = kvaser_fsize(u.leaf.rx_can), + [CMD_LEAF_LOG_MESSAGE] = kvaser_fsize(u.leaf.log_message), + [CMD_CHIP_STATE_EVENT] = kvaser_fsize(u.leaf.chip_state_event), + [CMD_CAN_ERROR_EVENT] = kvaser_fsize(u.leaf.error_event), + /* ignored events: */ + [CMD_FLUSH_QUEUE_REPLY] = CMD_SIZE_ANY, +}; + +static const u8 kvaser_usb_leaf_cmd_sizes_usbcan[] = { + [CMD_START_CHIP_REPLY] = kvaser_fsize(u.simple), + [CMD_STOP_CHIP_REPLY] = kvaser_fsize(u.simple), + [CMD_GET_CARD_INFO_REPLY] = kvaser_fsize(u.cardinfo), + [CMD_TX_ACKNOWLEDGE] = kvaser_fsize(u.tx_acknowledge_header), + [CMD_GET_SOFTWARE_INFO_REPLY] = kvaser_fsize(u.usbcan.softinfo), + [CMD_RX_STD_MESSAGE] = kvaser_fsize(u.usbcan.rx_can), + [CMD_RX_EXT_MESSAGE] = kvaser_fsize(u.usbcan.rx_can), + [CMD_CHIP_STATE_EVENT] = kvaser_fsize(u.usbcan.chip_state_event), + [CMD_CAN_ERROR_EVENT] = kvaser_fsize(u.usbcan.error_event), + /* ignored events: */ + [CMD_USBCAN_CLOCK_OVERFLOW_EVENT] = CMD_SIZE_ANY, +}; + /* Summary of a kvaser error event, for a unified Leaf/Usbcan error * handling. Some discrepancies between the two families exist: * @@ -396,6 +428,43 @@ static const struct kvaser_usb_dev_cfg k .bittiming_const = &kvaser_usb_flexc_bittiming_const, }; +static int kvaser_usb_leaf_verify_size(const struct kvaser_usb *dev, + const struct kvaser_cmd *cmd) +{ + /* buffer size >= cmd->len ensured by caller */ + u8 min_size = 0; + + switch (dev->driver_info->family) { + case KVASER_LEAF: + if (cmd->id < ARRAY_SIZE(kvaser_usb_leaf_cmd_sizes_leaf)) + min_size = kvaser_usb_leaf_cmd_sizes_leaf[cmd->id]; + break; + case KVASER_USBCAN: + if (cmd->id < ARRAY_SIZE(kvaser_usb_leaf_cmd_sizes_usbcan)) + min_size = kvaser_usb_leaf_cmd_sizes_usbcan[cmd->id]; + break; + } + + if (min_size == CMD_SIZE_ANY) + return 0; + + if (min_size) { + min_size += CMD_HEADER_LEN; + if (cmd->len >= min_size) + return 0; + + dev_err_ratelimited(&dev->intf->dev, + "Received command %u too short (size %u, needed %u)", + cmd->id, cmd->len, min_size); + return -EIO; + } + + dev_warn_ratelimited(&dev->intf->dev, + "Unhandled command (%d, size %d)\n", + cmd->id, cmd->len); + return -EINVAL; +} + static void * kvaser_usb_leaf_frame_to_cmd(const struct kvaser_usb_net_priv *priv, const struct sk_buff *skb, int *frame_len, @@ -503,6 +572,9 @@ static int kvaser_usb_leaf_wait_cmd(cons end: kfree(buf); + if (err == 0) + err = kvaser_usb_leaf_verify_size(dev, cmd); + return err; } @@ -1137,6 +1209,9 @@ static void kvaser_usb_leaf_stop_chip_re static void kvaser_usb_leaf_handle_command(const struct kvaser_usb *dev, const struct kvaser_cmd *cmd) { + if (kvaser_usb_leaf_verify_size(dev, cmd) < 0) + return; + switch (cmd->id) { case CMD_START_CHIP_REPLY: kvaser_usb_leaf_start_chip_reply(dev, cmd); From patchwork Mon Oct 24 11:29:21 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8825 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp431296wru; Mon, 24 Oct 2022 05:43:26 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4NPhujOG438fYYlXdyCVCISoxq+DMPKfrmwbK2vxb7liXTbUpeRoI4l++thPJN3IFEjDgV X-Received: by 2002:aa7:864a:0:b0:53f:dcdf:4614 with SMTP id a10-20020aa7864a000000b0053fdcdf4614mr33744964pfo.38.1666615406197; Mon, 24 Oct 2022 05:43:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666615406; cv=none; d=google.com; s=arc-20160816; b=IOiojKNe2UyyqqtpKlcJfRWpyCWNW1z3fSemmL5tPLJGjgwKYyw/Oxtu2wxXhyX9fn /bls+xHbVL+TYyM/AbN9FyfgN5j1kcTlDXCLZlL16HnOHxckzZfRAw19ME/LZzPoznMC EAj4bknzcj/ieCmygPO6UlQIpA0zYV6R4wmw2uHbcAIUKiJF+8lI9IvVbYYTuH1SYW4s uDtY61+bDwZMIfFhy/cyzByvCpyBeqwvURww0liAKkgERHYtRMXjzgh1TyakZByxQfNW GZGpWTzL/0978quyseSnutQg3n6sx7j4zPrq6kiDiq+TcOfEOTcp+11y+W7jgKoLq36Y a48A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=FItYcj3d90E13OAXhbQyW+ZGqKFJfAayNRBymu5q/74=; b=qeevdAfBs4K7g485kOF09P/US5hKnWmAYBKZgxqmKM+29fq/Od5k8TVeXH4FgG4FyU kSPEGgZZJke2ZqVYHGQKfzZaxLqGZtgljmOn7QyW6H9wCfnfgLVkEhN+dXaZLy7zoSiD U76KjT+VDQo3lHfL9gtUycQMu4LRKajX2mxYbarQ2ZfzI6AGr11vD/dPEtQmmxlVitsn 4Ag4b7na+XWMq5WaotkBW6SnxmCnXBMxdAy9S3IeKag8Klw9vM5e9G1hVYSXs9i/HKBu ubFdTEIYrUqEdG1BEAN0d28mT89gUlQNB9x8ESVXne9KXID0frZfm3aHx5SEGPvnNmFc 6UVw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=y3RYMttn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id nl3-20020a17090b384300b00203246e4383si20254204pjb.145.2022.10.24.05.43.04; Mon, 24 Oct 2022 05:43:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=y3RYMttn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234215AbiJXMeb (ORCPT + 99 others); Mon, 24 Oct 2022 08:34:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52254 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234198AbiJXM3g (ORCPT ); Mon, 24 Oct 2022 08:29:36 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9482C88DEF; Mon, 24 Oct 2022 05:03:33 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 7D18D612E6; Mon, 24 Oct 2022 11:56:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9416EC43151; Mon, 24 Oct 2022 11:56:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612584; bh=547xsTNwHNS98HazWD5C1d4zRtBg8qNe5JpQzIaOh8U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=y3RYMttnuQ9MevAoGLI6cs+W0CXMeIBy3+SaoBcUrNEYXAC5ZDkanfYo3vQUXAYQL cW+5H6DhdOUX3oVrjZBzyqGbWE3jneB6PurWWMLOe8kUg+vUWgC5uoV8J2TfnomiwC e1EWzM+FtLhSAMrh6QTv93EiRc8yPqHhnvRcp9g0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jimmy Assarsson , Anssi Hannula , Marc Kleine-Budde Subject: [PATCH 4.19 042/229] can: kvaser_usb_leaf: Fix TX queue out of sync after restart Date: Mon, 24 Oct 2022 13:29:21 +0200 Message-Id: <20221024113000.454060700@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747572916470241123?= X-GMAIL-MSGID: =?utf-8?q?1747572916470241123?= From: Anssi Hannula commit 455561fb618fde40558776b5b8435f9420f335db upstream. The TX queue seems to be implicitly flushed by the hardware during bus-off or bus-off recovery, but the driver does not reset the TX bookkeeping. Despite not resetting TX bookkeeping the driver still re-enables TX queue unconditionally, leading to "cannot find free context" / NETDEV_TX_BUSY errors if the TX queue was full at bus-off time. Fix that by resetting TX bookkeeping on CAN restart. Tested with 0bfd:0124 Kvaser Mini PCI Express 2xHS FW 4.18.778. Cc: stable@vger.kernel.org Fixes: 080f40a6fa28 ("can: kvaser_usb: Add support for Kvaser CAN/USB devices") Tested-by: Jimmy Assarsson Signed-off-by: Anssi Hannula Signed-off-by: Jimmy Assarsson Link: https://lore.kernel.org/all/20221010150829.199676-4-extja@kvaser.com Signed-off-by: Marc Kleine-Budde Signed-off-by: Greg Kroah-Hartman --- drivers/net/can/usb/kvaser_usb/kvaser_usb.h | 2 ++ drivers/net/can/usb/kvaser_usb/kvaser_usb_core.c | 2 +- drivers/net/can/usb/kvaser_usb/kvaser_usb_leaf.c | 2 ++ 3 files changed, 5 insertions(+), 1 deletion(-) --- a/drivers/net/can/usb/kvaser_usb/kvaser_usb.h +++ b/drivers/net/can/usb/kvaser_usb/kvaser_usb.h @@ -178,6 +178,8 @@ struct kvaser_usb_dev_cfg { extern const struct kvaser_usb_dev_ops kvaser_usb_hydra_dev_ops; extern const struct kvaser_usb_dev_ops kvaser_usb_leaf_dev_ops; +void kvaser_usb_unlink_tx_urbs(struct kvaser_usb_net_priv *priv); + int kvaser_usb_recv_cmd(const struct kvaser_usb *dev, void *cmd, int len, int *actual_len); --- a/drivers/net/can/usb/kvaser_usb/kvaser_usb_core.c +++ b/drivers/net/can/usb/kvaser_usb/kvaser_usb_core.c @@ -453,7 +453,7 @@ static void kvaser_usb_reset_tx_urb_cont /* This method might sleep. Do not call it in the atomic context * of URB completions. */ -static void kvaser_usb_unlink_tx_urbs(struct kvaser_usb_net_priv *priv) +void kvaser_usb_unlink_tx_urbs(struct kvaser_usb_net_priv *priv) { usb_kill_anchored_urbs(&priv->tx_submitted); kvaser_usb_reset_tx_urb_contexts(priv); --- a/drivers/net/can/usb/kvaser_usb/kvaser_usb_leaf.c +++ b/drivers/net/can/usb/kvaser_usb/kvaser_usb_leaf.c @@ -1430,6 +1430,8 @@ static int kvaser_usb_leaf_set_mode(stru switch (mode) { case CAN_MODE_START: + kvaser_usb_unlink_tx_urbs(priv); + err = kvaser_usb_leaf_simple_cmd_async(priv, CMD_START_CHIP); if (err) return err; From patchwork Mon Oct 24 11:29:22 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 10039 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp622592wru; Mon, 24 Oct 2022 12:45:50 -0700 (PDT) X-Google-Smtp-Source: AMsMyM59n9xT1vmz2yHE1IwEpgd1Dqspb2N6p/6aIIZyKxsvjfsELj3r7NFaQuM3WMLLO7jQMEzD X-Received: by 2002:a17:907:3e95:b0:792:e5b3:5a19 with SMTP id hs21-20020a1709073e9500b00792e5b35a19mr23741544ejc.766.1666640750690; Mon, 24 Oct 2022 12:45:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666640750; cv=none; d=google.com; s=arc-20160816; b=U0K6pvFhknCTPVbcJO9un2vtSmH79x5Go3RmCJxH3Bkp3ChDEr4ZYRpC9GeykO6/4a IjFXLtit0EKGijLHaaY/qeQhV7GNc2MlLRd61pvDPWzxV3PweHANPryuDA0keYQaTRjW 7H8ckH/j1n+S64VHX+jLotmRLV468ekvA+d0c9QW+0sUX1Z2AEHRlc+cAazHLRUxFFrM 0aTB0huu3bg7fkxbROnx1pw5ojtnMwMclUgcTGRtAQ18I4MnZ51AWZtCE4MM5I4m7Ubt G/q2rrvWMNCZGylV82bQyrlGvnPWQ/Oi6ZIWING4Vr08PzYYHoiXNIKLJg05mgTs7ETF QqCA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=vN+CgVtYtcqDm+eDdaDfnVwlg+RuOg1/We6A3w/O6rc=; b=Ob0iSWraQgVkQslJun9OUBsSZHKt7edUQI9w90L7HFHQpl/IElOvowmdp0h0XauxJk o95iiQoc2FHBv+qhfCLkgcuNYBgwg4hAuMm6nTLlIZQDp9GTzAXJX6bH1+fNqQjEeexM QpTlvcbY5FqjdZxIULMqHuKeDFDnN9Kox3of7CJKMB7cqXOC4LGPJLobb7bzSZVe355/ Y9+KLClsdONrpZBikCNT2nllPGc0FTyFOuCRgoHPv83Yaa7zUR5gdecGcyvqqBHBBsoJ IureY3FYN4QTb/9QU0gBnI74j7YJfiUZRWPxxtzUonGxkYm7ZByUnzRGJPFq8P+gQCYf e7QA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=HcnpmHE7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id js5-20020a17090797c500b0078d27c1c8f4si662332ejc.696.2022.10.24.12.45.25; Mon, 24 Oct 2022 12:45:50 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=HcnpmHE7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233319AbiJXTmF (ORCPT + 99 others); Mon, 24 Oct 2022 15:42:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54490 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232114AbiJXTlQ (ORCPT ); Mon, 24 Oct 2022 15:41:16 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 78DDEDD895; Mon, 24 Oct 2022 11:11:07 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id CD739B811CC; Mon, 24 Oct 2022 11:56:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 323A3C433D7; Mon, 24 Oct 2022 11:56:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612587; bh=tuRrGyRDE5pfd9u7YgYcnNL8Vy+H8he/V121FPx+c8w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HcnpmHE7hA7IxIR+AauBtCXPGKgTyiGo6MyDhsDfsRPXS/9AhJiSf6CQEyFmfcxHZ mGnhJUxa+C5hKLhqqdl2y7AQAJDUS32ClCCZ8IB5LzhCvBe5zmcP7Ac60iD/XI7aDv mAi8sBJJxAf0uDg5Wl1ioaeMJMcIx09dbnbj+Y58= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jimmy Assarsson , Anssi Hannula , Marc Kleine-Budde Subject: [PATCH 4.19 043/229] can: kvaser_usb_leaf: Fix CAN state after restart Date: Mon, 24 Oct 2022 13:29:22 +0200 Message-Id: <20221024113000.483163493@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747599492172948185?= X-GMAIL-MSGID: =?utf-8?q?1747599492172948185?= From: Anssi Hannula commit 0be1a655fe68c8e6dcadbcbddb69cf2fb29881f5 upstream. can_restart() expects CMD_START_CHIP to set the error state to ERROR_ACTIVE as it calls netif_carrier_on() immediately afterwards. Otherwise the user may immediately trigger restart again and hit a BUG_ON() in can_restart(). Fix kvaser_usb_leaf set_mode(CMD_START_CHIP) to set the expected state. Cc: stable@vger.kernel.org Fixes: 080f40a6fa28 ("can: kvaser_usb: Add support for Kvaser CAN/USB devices") Tested-by: Jimmy Assarsson Signed-off-by: Anssi Hannula Signed-off-by: Jimmy Assarsson Link: https://lore.kernel.org/all/20221010150829.199676-5-extja@kvaser.com Signed-off-by: Marc Kleine-Budde Signed-off-by: Greg Kroah-Hartman --- drivers/net/can/usb/kvaser_usb/kvaser_usb_leaf.c | 2 ++ 1 file changed, 2 insertions(+) --- a/drivers/net/can/usb/kvaser_usb/kvaser_usb_leaf.c +++ b/drivers/net/can/usb/kvaser_usb/kvaser_usb_leaf.c @@ -1435,6 +1435,8 @@ static int kvaser_usb_leaf_set_mode(stru err = kvaser_usb_leaf_simple_cmd_async(priv, CMD_START_CHIP); if (err) return err; + + priv->can.state = CAN_STATE_ERROR_ACTIVE; break; default: return -EOPNOTSUPP; From patchwork Mon Oct 24 11:29:23 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8669 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp421952wru; Mon, 24 Oct 2022 05:21:33 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4uB0BUr9PkRf1Q6tHyg2UeyhpSEcdwWz+CPJdGQxYIK0SOaJB8ePW5xI8pwrMNwVjRUjZi X-Received: by 2002:a17:906:9b92:b0:791:9355:cb89 with SMTP id dd18-20020a1709069b9200b007919355cb89mr26694593ejc.498.1666614093121; Mon, 24 Oct 2022 05:21:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666614093; cv=none; d=google.com; s=arc-20160816; b=Dhgkk1QKJlk3Tr4J1JvOkPU2y+hCBHVu65ZkspqRuZi81+r9WnnZFVsE+jwRrhvwon +EB12S8UF68YaIgqwkazoGvcCYxZeiWKwp5+6pJEmV2NPdvO2l7Vt5VDgEmx8NRHTF6r OuBKDTRiYcYBQ4fy74JXE2L7fWL6oMihIKRSpJZsVrzi6z1uiKyAlMR6Yrm0iPTPA1ll dVmAbrRjZuabPWXuI0HTDFikemteUWW0jbFvXH8zojyLAf3Uk+w/jaMuujWRHypAX7+M yS45j7DxzIS6GBOH/XQ/N+iw1AeD1eqJ93pyIrjXrPwm/RhLEmVrHWcVbUA8B6Big78l 4J/Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=4ozSGrHq2HexpDjX+TcJUPeuPXRXEDV+ZvAEWFSK+Yc=; b=OPY2vTnXf+8oCsEOXlWv892ur3jaZq89TiZ5So3yguIsQTrDMB38fo52WZIKJOjq3U kp62gKO73enRBRDbk9aBOTpgERmmGa7ebG71LBJUGymx0p/5numiq82vOIPDwtMTKofV Y5i/RksMEruj4v4CPEaKtOCkG9epUfnJjncNbJ34lLTTKq3oUtnJ+AGI/50/Vy7RoteL GRP1pAI9Bd2oyC0O+VwYh5VBBDZ46p5xfVULxNcCmxY3qEaWs+tgJa6j5Uw8es7pUyqz ZeuE0Q7/qU2GP3uflRkx4HJQr4LXAQmMYNsCRlOuEs+CODiDtkjl/Yx3BWLGE/gcz5+7 +kfw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=sr0v2DSN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id qh3-20020a170906eca300b007763cc7093csi22703157ejb.884.2022.10.24.05.21.08; Mon, 24 Oct 2022 05:21:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=sr0v2DSN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233221AbiJXMSX (ORCPT + 99 others); Mon, 24 Oct 2022 08:18:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48436 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233129AbiJXMQ2 (ORCPT ); Mon, 24 Oct 2022 08:16:28 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 02F238111F; Mon, 24 Oct 2022 04:56:30 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id BA9AB61257; Mon, 24 Oct 2022 11:56:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CCEF1C433C1; Mon, 24 Oct 2022 11:56:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612590; bh=XvMEixgT9BGjJ6ja9ttKqMsTyosvpjjoTnATBzIPtLI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sr0v2DSNSuxlRxTLOlpgk/J2JaZ9qHC/KlC4qrXAUsZpo8RCUTbPwBMWtvbORqCob mLu7pnJjPX8jy4hm4I0tawz2JsBcn6v0DtF73WfrgQQt8D7TIXcAq/5rbX02ZQyE0/ 9sx4wsqVX2ItyQVEfk1nHA0xGHVi1oZoEzKsnRSA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alexander Aring , David Teigland Subject: [PATCH 4.19 044/229] fs: dlm: fix race between test_bit() and queue_work() Date: Mon, 24 Oct 2022 13:29:23 +0200 Message-Id: <20221024113000.523018503@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747571539457162833?= X-GMAIL-MSGID: =?utf-8?q?1747571539457162833?= From: Alexander Aring commit eef6ec9bf390e836a6c4029f3620fe49528aa1fe upstream. This patch fixes a race by using ls_cb_mutex around the bit operations and conditional code blocks for LSFL_CB_DELAY. The function dlm_callback_stop() expects to stop all callbacks and flush all currently queued onces. The set_bit() is not enough because there can still be queue_work() after the workqueue was flushed. To avoid queue_work() after set_bit(), surround both by ls_cb_mutex. Cc: stable@vger.kernel.org Signed-off-by: Alexander Aring Signed-off-by: David Teigland Signed-off-by: Greg Kroah-Hartman --- fs/dlm/ast.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) --- a/fs/dlm/ast.c +++ b/fs/dlm/ast.c @@ -200,13 +200,13 @@ void dlm_add_cb(struct dlm_lkb *lkb, uin if (!prev_seq) { kref_get(&lkb->lkb_ref); + mutex_lock(&ls->ls_cb_mutex); if (test_bit(LSFL_CB_DELAY, &ls->ls_flags)) { - mutex_lock(&ls->ls_cb_mutex); list_add(&lkb->lkb_cb_list, &ls->ls_cb_delay); - mutex_unlock(&ls->ls_cb_mutex); } else { queue_work(ls->ls_callback_wq, &lkb->lkb_cb_work); } + mutex_unlock(&ls->ls_cb_mutex); } out: mutex_unlock(&lkb->lkb_cb_mutex); @@ -286,7 +286,9 @@ void dlm_callback_stop(struct dlm_ls *ls void dlm_callback_suspend(struct dlm_ls *ls) { + mutex_lock(&ls->ls_cb_mutex); set_bit(LSFL_CB_DELAY, &ls->ls_flags); + mutex_unlock(&ls->ls_cb_mutex); if (ls->ls_callback_wq) flush_workqueue(ls->ls_callback_wq); From patchwork Mon Oct 24 11:29:24 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8709 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp423069wru; Mon, 24 Oct 2022 05:24:01 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6E6Dkclm9Rl1ojWNXIkr1sPA8hduXnur+vn4kI89Eu+mUJbY3825LnkM3I+F+W0KRYP7D8 X-Received: by 2002:a62:1490:0:b0:563:51e7:693b with SMTP id 138-20020a621490000000b0056351e7693bmr33462954pfu.39.1666614240845; Mon, 24 Oct 2022 05:24:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666614240; cv=none; d=google.com; s=arc-20160816; b=v9WXwIxBzGFEwm/k1RCh2rWyKa4ORR9NoRCMyeHDWno5GwcVYnAWfZvFJBeeIAoOBp 89ErFMtDK025OsRWuPmuMaCHEEsCHx308hW2fGpqeu/lzpbxckTcGKcP+oQ56cwyJiqH po/RcVAVd5VFTRTz2kch7yLkTQMiqSi2W7ihIIkBUf9oRfkTnRvIDRa5dP6JWDbbWKie sD/ESvQ8BqVfq3HSi07m2I6M8uFmuYq86tKcAVlBOQIpK96Fs6zelAtoOGYiQr0zDy5D oxREYjuVpxp/1SGt4bjPmTajlovxGnJ+5X7p9tKptkaA4SFjJt2aONyxgAXDePVL08oD gVXg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=/qr1XI5x/ssc6R3+K1MrePoDoqC3vNojA/TpgfvAm3g=; b=aPbWBqO+ZHCA5eFw7sJsFmG5XsHoNL1Gm7xCeb5VYJrgX7jbcoEnwClR6ga75CxhND 5qGSJlgjgwrIGpNzuDlpzWikkSLMOeIEdmeg2ZaPO9Xza/CRZ2VG0veNsBj86nJYAgk6 dS4rPBMj8xL2KxzN4akYA/0O7dGLhz4kdQje5qajwppakB6rR9NopqN3IA0HVXSxV4LP ss2Bfwpp/i+GmMimKjghDL/qzn27unSqDyJa0XXDf8BDn9kqiIycdOkJ6OL5w07tMr0m EjHFR3oFhjNU0THc7a3QxWbdvndmuYkOjYls44861McfLvCm4wC5gZ72fG6vfXDqlrpO vnlw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=LFz0445F; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y23-20020a056a00181700b0056bcfbc75casi4208379pfa.177.2022.10.24.05.23.46; Mon, 24 Oct 2022 05:24:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=LFz0445F; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233533AbiJXMWs (ORCPT + 99 others); Mon, 24 Oct 2022 08:22:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41220 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233301AbiJXMUh (ORCPT ); Mon, 24 Oct 2022 08:20:37 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C136583236; Mon, 24 Oct 2022 04:58:50 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 683FE612BB; Mon, 24 Oct 2022 11:56:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7A895C433C1; Mon, 24 Oct 2022 11:56:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612592; bh=7zRqFiuFdqs1g1fTMewFg4NAJ0rlLykQuJxkC+KCfFY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LFz0445FVYz7U9AzR/vpK7so8OjXaqNUjSW3m8Vc18gCnvWjRbMFC4wEa9dd/6FUO PFJrvxF/1UeWGo1IzIIiOgFDfujYMjcbjd3Ui27jQuteg+Fl5ufW8ehBmCHNm/ijKp zmww03ZhSftMBIBucEf/QoIOHDILKgDM9Ic1C2uI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alexander Aring , David Teigland Subject: [PATCH 4.19 045/229] fs: dlm: handle -EBUSY first in lock arg validation Date: Mon, 24 Oct 2022 13:29:24 +0200 Message-Id: <20221024113000.552249834@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747571694568710207?= X-GMAIL-MSGID: =?utf-8?q?1747571694568710207?= From: Alexander Aring commit 44637ca41d551d409a481117b07fa209b330fca9 upstream. During lock arg validation, first check for -EBUSY cases, then for -EINVAL cases. The -EINVAL checks look at lkb state variables which are not stable when an lkb is busy and would cause an -EBUSY result, e.g. lkb->lkb_grmode. Cc: stable@vger.kernel.org Signed-off-by: Alexander Aring Signed-off-by: David Teigland Signed-off-by: Greg Kroah-Hartman --- fs/dlm/lock.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) --- a/fs/dlm/lock.c +++ b/fs/dlm/lock.c @@ -2890,24 +2890,24 @@ static int set_unlock_args(uint32_t flag static int validate_lock_args(struct dlm_ls *ls, struct dlm_lkb *lkb, struct dlm_args *args) { - int rv = -EINVAL; + int rv = -EBUSY; if (args->flags & DLM_LKF_CONVERT) { - if (lkb->lkb_flags & DLM_IFL_MSTCPY) + if (lkb->lkb_status != DLM_LKSTS_GRANTED) goto out; - if (args->flags & DLM_LKF_QUECVT && - !__quecvt_compat_matrix[lkb->lkb_grmode+1][args->mode+1]) + if (lkb->lkb_wait_type) goto out; - rv = -EBUSY; - if (lkb->lkb_status != DLM_LKSTS_GRANTED) + if (is_overlap(lkb)) goto out; - if (lkb->lkb_wait_type) + rv = -EINVAL; + if (lkb->lkb_flags & DLM_IFL_MSTCPY) goto out; - if (is_overlap(lkb)) + if (args->flags & DLM_LKF_QUECVT && + !__quecvt_compat_matrix[lkb->lkb_grmode+1][args->mode+1]) goto out; } From patchwork Mon Oct 24 11:29:25 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8675 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp422125wru; Mon, 24 Oct 2022 05:21:56 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6Crr7VO+SoC2qoiMnuDkbkFj6Ilf0fWOpNDnJYOrfp+ZFEcWqQznbAw9/FfttVaJZBr2Fs X-Received: by 2002:a17:907:9493:b0:796:1166:70c4 with SMTP id dm19-20020a170907949300b00796116670c4mr20813421ejc.59.1666614116174; Mon, 24 Oct 2022 05:21:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666614116; cv=none; d=google.com; s=arc-20160816; b=ufQMq1NvhjkToL/yZARiBmKUCFO0hejGNcFp92FiuIrb6Z0mm7Vr4Fw2H12bkSFGVh uR8oGL+3vUt4FVessI6FY7+hem/4yB+8aZtsxIACYN2i1EZVMddKzpRwkRhdN45N6lqX WWW2Jg5j/w9eWe37m1aOYYsDGbAACVg9nFFZZczUzeyZmyf8XqguHGxIMqe8x7SGN43o vqU4zRd7L1R6/rlpC/XRGRpuVY2CWjYnFGpOTyD/l+U/32vj+21ZiG2Kj2IYE2WIfFzb iUrxINIuPN3hoM6G96jJlCIE8vS+cOgEW916cZ54ew9VNw9Sz0q/uO/VFH5RPk76sIXJ Epuw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=oj9+aChjkZ+xk+1I2xUyqkhyvyuTGQKOcYgAOs/C35U=; b=j4a7SnI0iozpCDG08bxekbGfld4t6xpTq/RKqdB8NmY2DE9zEjkCGzQ/g99ZpdcuL4 zUCW2TdMSwo+LnfwmoXEjQdcWNlZ5NR9r4BYNa30gOfYWDEK5bjqgyFMIS8MIMzNJwjk shB6o4a5D6NLaKvTXqt9IDDAtXAheE4Ny4MbJrscxF1fVg6QGrXaiyWK9+IPcRK+xBDj MqBt5KlCSuugUQ7N3Vz+hIwmXn+je+PG+YTmDID6VYGeMgy55WBymWeCIbc+lFaCLzhd 1lltmTeLCVNySQXA0odsaxiuC1V/WtWaxcjTuzsjs3D8gLteCmlDLucKmHlYSfmCEjz6 TrAg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=QGdnJzN2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hs41-20020a1709073ea900b0077b6ecac099si28348777ejc.287.2022.10.24.05.21.32; Mon, 24 Oct 2022 05:21:56 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=QGdnJzN2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231294AbiJXMSO (ORCPT + 99 others); Mon, 24 Oct 2022 08:18:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50458 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233108AbiJXMQS (ORCPT ); Mon, 24 Oct 2022 08:16:18 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 51F6A7AC36; Mon, 24 Oct 2022 04:56:38 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id A802C612D3; Mon, 24 Oct 2022 11:56:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B9254C433D6; Mon, 24 Oct 2022 11:56:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612598; bh=t+BBSIhts49B2P3FN9Z48QUqlQMj20aVsD3IeoAmpEQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QGdnJzN2VxvAPRXu+cc8W7PUebo+W5L3mvQTtjvJn7qHp5a/2XiRoukl7hGmaWxEx iZQfCZ3ovOdCjC6z7dy5FrPjWaPkhPhMOGTvULvz6RWJuyNlc7e7a5zTcYs6Bo+gom TOLmDcLZwgeqfyNFQmNOfAMY4VxCBXfQxlI6c7AU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Andri Yngvason , Benjamin Tissoires Subject: [PATCH 4.19 046/229] HID: multitouch: Add memory barriers Date: Mon, 24 Oct 2022 13:29:25 +0200 Message-Id: <20221024113000.581586783@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747571563216668951?= X-GMAIL-MSGID: =?utf-8?q?1747571563216668951?= From: Andri Yngvason commit be6e2b5734a425941fcdcdbd2a9337be498ce2cf upstream. This fixes broken atomic checks which cause a race between the release-timer and processing of hid input. I noticed that contacts were sometimes sticking, even with the "sticky fingers" quirk enabled. This fixes that problem. Cc: stable@vger.kernel.org Fixes: 9609827458c3 ("HID: multitouch: optimize the sticky fingers timer") Signed-off-by: Andri Yngvason Signed-off-by: Benjamin Tissoires Link: https://lore.kernel.org/r/20220907150159.2285460-1-andri@yngvason.is Signed-off-by: Greg Kroah-Hartman --- drivers/hid/hid-multitouch.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) --- a/drivers/hid/hid-multitouch.c +++ b/drivers/hid/hid-multitouch.c @@ -1154,7 +1154,7 @@ static void mt_touch_report(struct hid_d int contact_count = -1; /* sticky fingers release in progress, abort */ - if (test_and_set_bit(MT_IO_FLAGS_RUNNING, &td->mt_io_flags)) + if (test_and_set_bit_lock(MT_IO_FLAGS_RUNNING, &td->mt_io_flags)) return; scantime = *app->scantime; @@ -1235,7 +1235,7 @@ static void mt_touch_report(struct hid_d del_timer(&td->release_timer); } - clear_bit(MT_IO_FLAGS_RUNNING, &td->mt_io_flags); + clear_bit_unlock(MT_IO_FLAGS_RUNNING, &td->mt_io_flags); } static int mt_touch_input_configured(struct hid_device *hdev, @@ -1672,11 +1672,11 @@ static void mt_expired_timeout(struct ti * An input report came in just before we release the sticky fingers, * it will take care of the sticky fingers. */ - if (test_and_set_bit(MT_IO_FLAGS_RUNNING, &td->mt_io_flags)) + if (test_and_set_bit_lock(MT_IO_FLAGS_RUNNING, &td->mt_io_flags)) return; if (test_bit(MT_IO_FLAGS_PENDING_SLOTS, &td->mt_io_flags)) mt_release_contacts(hdev); - clear_bit(MT_IO_FLAGS_RUNNING, &td->mt_io_flags); + clear_bit_unlock(MT_IO_FLAGS_RUNNING, &td->mt_io_flags); } static int mt_probe(struct hid_device *hdev, const struct hid_device_id *id) From patchwork Mon Oct 24 11:29:26 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 10019 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp622180wru; Mon, 24 Oct 2022 12:44:54 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4hUejHR9FbFpRYP1bp3VVnJivtSyB/uaPqDNfQVwUHZZH2MxqYLsejjhwFui+PSTx6MUwO X-Received: by 2002:a17:907:7e9a:b0:796:7a21:1520 with SMTP id qb26-20020a1709077e9a00b007967a211520mr23268671ejc.236.1666640694222; Mon, 24 Oct 2022 12:44:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666640694; cv=none; d=google.com; s=arc-20160816; b=tcpFK7JMDqD5wgN+IP+1Qcm/CRL7x3dKxRPmhUGUU1GrfevXSqmE4cjDU/9xLkkvC7 CqoMF6RT7j+6ImLmKeYDMYWQUR7qB8uJbFcqhIYKwn08wKWsJbTskO2oq585n9+1p3ps oqpTHlRz2a0bPjgYxLUsKTy9h/T/jD21eJy+X5mlOtxIGdUOppd1vPO4pqCOS1p/yM7Q BcvgD/TF4d5xs4vCCRAxt044iY+7G31MjhVGqbc6MYQGLhcCQMtBE/y+54yhQQief1OO P+eTov26V9fjfT4J/H0bam8KydWnf9qo5wm0/1BFRU8MvgyeVNpGJwwMlTm9QdMafnAu IhFA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=VVBrQWbjmKjB6+vC7B+FnDMJY7RUKPKAlCEY0OGIoXc=; b=G4C9n/iWOCkr9RaeWmg1mcvKM2FeFrSYao5QJ9RB5l0yUdYgHBtd/gE6BZZ9f4jUet 7AEBauv9ckBQvmju8/iWwLNaaRyuLGplHLlTDmk90eb9CpD9T/LUUEjB8bvcN0YYbNLe iaplwD67yswg9hLRlIv5nk5RQTYoy0PBCXovRyKQeMj+SN9T3VN2a4FOhPc4tQ0Cg3rF YTl6NZYPeQ6j7TBO5e7KjSNqwYAYPXRGL1H4O0G5nVl9qKjiUdv/x6e+pWseX76JXdgC Q4A5LuJvQg40RVO4WPEs+SgIjTofyYd4k7UeOX/H6CJf9nk1ip7v9cExPCz7VDmSnM04 y6KA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=fLThtsvY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q2-20020a170906b28200b007a087cce094si509655ejz.512.2022.10.24.12.44.28; Mon, 24 Oct 2022 12:44:54 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=fLThtsvY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230149AbiJXTjk (ORCPT + 99 others); Mon, 24 Oct 2022 15:39:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54946 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233302AbiJXTir (ORCPT ); Mon, 24 Oct 2022 15:38:47 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3A2E655AC; Mon, 24 Oct 2022 11:09:24 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 7F5D1B811B8; Mon, 24 Oct 2022 11:56:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D3EE9C433D6; Mon, 24 Oct 2022 11:56:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612601; bh=iy6+dzbMrtUn8z3Bzy2JPrniPwMyWDR81wptzzfv+ZE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fLThtsvYdIAk/MYuBEIo7+ck5yt+/NEoec+PrO1caDKpIUJZuUJ2Y0XgmUkYNPvIl cJ7MVr62vfvEicsvD7c7kd5K/8K5Pd7mFdcz6X3uTheSio0V1/d6yLOcguhVAsZdg5 fUjt5tnFBeb1TN/ox3G4i2U4XYYguMH0i6do39Vo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zhihao Cheng , Jan Kara Subject: [PATCH 4.19 047/229] quota: Check next/prev free block number after reading from quota file Date: Mon, 24 Oct 2022 13:29:26 +0200 Message-Id: <20221024113000.611388471@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747599432359787070?= X-GMAIL-MSGID: =?utf-8?q?1747599432359787070?= From: Zhihao Cheng commit 6c8ea8b8cd4722efd419f91ca46a2dc81b7d89a3 upstream. Following process: Init: v2_read_file_info: <3> dqi_free_blk 0 dqi_free_entry 5 dqi_blks 6 Step 1. chown bin f_a -> dquot_acquire -> v2_write_dquot: qtree_write_dquot do_insert_tree find_free_dqentry get_free_dqblk write_blk(info->dqi_blocks) // info->dqi_blocks = 6, failure. The content in physical block (corresponding to blk 6) is random. Step 2. chown root f_a -> dquot_transfer -> dqput_all -> dqput -> ext4_release_dquot -> v2_release_dquot -> qtree_delete_dquot: dquot_release remove_tree free_dqentry put_free_dqblk(6) info->dqi_free_blk = blk // info->dqi_free_blk = 6 Step 3. drop cache (buffer head for block 6 is released) Step 4. chown bin f_b -> dquot_acquire -> commit_dqblk -> v2_write_dquot: qtree_write_dquot do_insert_tree find_free_dqentry get_free_dqblk dh = (struct qt_disk_dqdbheader *)buf blk = info->dqi_free_blk // 6 ret = read_blk(info, blk, buf) // The content of buf is random info->dqi_free_blk = le32_to_cpu(dh->dqdh_next_free) // random blk Step 5. chown bin f_c -> notify_change -> ext4_setattr -> dquot_transfer: dquot = dqget -> acquire_dquot -> ext4_acquire_dquot -> dquot_acquire -> commit_dqblk -> v2_write_dquot -> dq_insert_tree: do_insert_tree find_free_dqentry get_free_dqblk blk = info->dqi_free_blk // If blk < 0 and blk is not an error code, it will be returned as dquot transfer_to[USRQUOTA] = dquot // A random negative value __dquot_transfer(transfer_to) dquot_add_inodes(transfer_to[cnt]) spin_lock(&dquot->dq_dqb_lock) // page fault , which will lead to kernel page fault: Quota error (device sda): qtree_write_dquot: Error -8000 occurred while creating quota BUG: unable to handle page fault for address: ffffffffffffe120 #PF: supervisor write access in kernel mode #PF: error_code(0x0002) - not-present page Oops: 0002 [#1] PREEMPT SMP CPU: 0 PID: 5974 Comm: chown Not tainted 6.0.0-rc1-00004 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996) RIP: 0010:_raw_spin_lock+0x3a/0x90 Call Trace: dquot_add_inodes+0x28/0x270 __dquot_transfer+0x377/0x840 dquot_transfer+0xde/0x540 ext4_setattr+0x405/0x14d0 notify_change+0x68e/0x9f0 chown_common+0x300/0x430 __x64_sys_fchownat+0x29/0x40 In order to avoid accessing invalid quota memory address, this patch adds block number checking of next/prev free block read from quota file. Fetch a reproducer in [Link]. Link: https://bugzilla.kernel.org/show_bug.cgi?id=216372 Fixes: 1da177e4c3f4152 ("Linux-2.6.12-rc2") CC: stable@vger.kernel.org Link: https://lore.kernel.org/r/20220923134555.2623931-2-chengzhihao1@huawei.com Signed-off-by: Zhihao Cheng Signed-off-by: Jan Kara Signed-off-by: Greg Kroah-Hartman --- fs/quota/quota_tree.c | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) --- a/fs/quota/quota_tree.c +++ b/fs/quota/quota_tree.c @@ -79,6 +79,35 @@ static ssize_t write_blk(struct qtree_me return ret; } +static inline int do_check_range(struct super_block *sb, const char *val_name, + uint val, uint min_val, uint max_val) +{ + if (val < min_val || val > max_val) { + quota_error(sb, "Getting %s %u out of range %u-%u", + val_name, val, min_val, max_val); + return -EUCLEAN; + } + + return 0; +} + +static int check_dquot_block_header(struct qtree_mem_dqinfo *info, + struct qt_disk_dqdbheader *dh) +{ + int err = 0; + + err = do_check_range(info->dqi_sb, "dqdh_next_free", + le32_to_cpu(dh->dqdh_next_free), 0, + info->dqi_blocks - 1); + if (err) + return err; + err = do_check_range(info->dqi_sb, "dqdh_prev_free", + le32_to_cpu(dh->dqdh_prev_free), 0, + info->dqi_blocks - 1); + + return err; +} + /* Remove empty block from list and return it */ static int get_free_dqblk(struct qtree_mem_dqinfo *info) { @@ -93,6 +122,9 @@ static int get_free_dqblk(struct qtree_m ret = read_blk(info, blk, buf); if (ret < 0) goto out_buf; + ret = check_dquot_block_header(info, dh); + if (ret) + goto out_buf; info->dqi_free_blk = le32_to_cpu(dh->dqdh_next_free); } else { @@ -240,6 +272,9 @@ static uint find_free_dqentry(struct qtr *err = read_blk(info, blk, buf); if (*err < 0) goto out_buf; + *err = check_dquot_block_header(info, dh); + if (*err) + goto out_buf; } else { blk = get_free_dqblk(info); if ((int)blk < 0) { @@ -432,6 +467,9 @@ static int free_dqentry(struct qtree_mem goto out_buf; } dh = (struct qt_disk_dqdbheader *)buf; + ret = check_dquot_block_header(info, dh); + if (ret) + goto out_buf; le16_add_cpu(&dh->dqdh_entries, -1); if (!le16_to_cpu(dh->dqdh_entries)) { /* Block got free? */ ret = remove_free_dqentry(info, buf, blk); From patchwork Mon Oct 24 11:29:27 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8672 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp422060wru; Mon, 24 Oct 2022 05:21:47 -0700 (PDT) X-Google-Smtp-Source: AMsMyM42G17K9Kq+Zf3JiQzGyHWdthP0ygKy2oqq2TeXU1j1prrupJRdYuOB0PIv36zxQDpUKz89 X-Received: by 2002:a17:906:9be9:b0:78d:2f63:10dd with SMTP id de41-20020a1709069be900b0078d2f6310ddmr27127753ejc.479.1666614107615; Mon, 24 Oct 2022 05:21:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666614107; cv=none; d=google.com; s=arc-20160816; b=ReewqdUF6T4yg4F4rhtutYI2BlqAQRAHLKJWQjzsRnbo+IiCsEEgGGfzmx3ihtYi/P eEPrV0SFFbkdCwDKepKLXG8NPVvYD83ga2Xav0C8iJg48GB0XmhR8q9mo7EnQzokv1uT 2zbTLazaPWKKtIL7n6Pnj69mGumU9QIGDi2fGVsZCTc4DCllF1gSuTu2pSr8xUqpcN5W URNeCubAwE8gvUWACWy9ma70R5a34VScCKoILJVCZ8BJg0hx1zDdrrLaVE/wuB8zo31I w14sxT0xaAqqlF3GOejqr58qip3ZC5mHTA3oJwcjBr5cCSSrf00cPpn5TuJWmROxda0r k4XA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=qbrkafSnNO6Fpf+BelohyT6IWkPn804grG0jEImZgjo=; b=Cc8EPU4vuF0CakjVXFispIyC2cQFD+yG4YqmwoavdiM06SFBB/70d+JpSB0Jy9kxaq 0MxsWx8N2ramri8VRCcwvcPMUV/r/KkB9yazd0corWtvkyppPVI5NYv7nn5tyuC5mnv2 b0zX0IEvXVcrycoCpuoBeorfuXDXFGN4I3h9IaRNSdhN5I2d1RjA1lkOGTYey1nTi+Bi mW7wbKnhb8xMPQ/j7Z1PMqKc3VTFMLs3FyZl1xJaw/pecRDQo2jUzpJrwAZdtIbYxHz8 PFvqMDPtf+Pb95kqyHNuGT/uKmA+s6iMnsgQCdrmZSU4yeiVI6+l2xY7ZlV5jDeoyROs smiA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=IONdRgki; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id nb17-20020a1709071c9100b0077979f8d3dbsi27590315ejc.838.2022.10.24.05.21.23; Mon, 24 Oct 2022 05:21:47 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=IONdRgki; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233241AbiJXMSq (ORCPT + 99 others); Mon, 24 Oct 2022 08:18:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51678 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233020AbiJXMRo (ORCPT ); Mon, 24 Oct 2022 08:17:44 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DCBDE79EE4; Mon, 24 Oct 2022 04:56:44 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 865B0612F0; Mon, 24 Oct 2022 11:56:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6F5CAC433D7; Mon, 24 Oct 2022 11:56:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612604; bh=6F0okbPNaJVmpOAkAP8nAQh12Kr7LsC4w3octjhvero=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IONdRgkiCDhCTcH4iLuc1bYrJEvtPmg96NnQzf2zAWOZdxCmzTRmVwaU9jRtPrU1m gQ1XlZkI1NOJAjN15sUxKl0NjEPi5W2fAvfFeHSRHDnFTIDuyQKOfscVj9H63kZfP0 1MSmYnWPHPOyrsrXUY1DvoLXW7npIIj63SCCwFDA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Andy Gross , Bjorn Andersson , Konrad Dybcio , linux-arm-msm@vger.kernel.org, Linus Walleij , Mark Brown Subject: [PATCH 4.19 048/229] regulator: qcom_rpm: Fix circular deferral regression Date: Mon, 24 Oct 2022 13:29:27 +0200 Message-Id: <20221024113000.640012816@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747571554477597928?= X-GMAIL-MSGID: =?utf-8?q?1747571554477597928?= From: Linus Walleij commit 8478ed5844588703a1a4c96a004b1525fbdbdd5e upstream. On recent kernels, the PM8058 L16 (or any other PM8058 LDO-regulator) does not come up if they are supplied by an SMPS-regulator. This is not very strange since the regulators are registered in a long array and the L-regulators are registered before the S-regulators, and if an L-regulator defers, it will never get around to registering the S-regulator that it needs. See arch/arm/boot/dts/qcom-apq8060-dragonboard.dts: pm8058-regulators { (...) vdd_l13_l16-supply = <&pm8058_s4>; (...) Ooops. Fix this by moving the PM8058 S-regulators first in the array. Do the same for the PM8901 S-regulators (though this is currently not causing any problems with out device trees) so that the pattern of registration order is the same on all PMnnnn chips. Fixes: 087a1b5cdd55 ("regulator: qcom: Rework to single platform device") Cc: stable@vger.kernel.org Cc: Andy Gross Cc: Bjorn Andersson Cc: Konrad Dybcio Cc: linux-arm-msm@vger.kernel.org Signed-off-by: Linus Walleij Link: https://lore.kernel.org/r/20220909112529.239143-1-linus.walleij@linaro.org Signed-off-by: Mark Brown Signed-off-by: Greg Kroah-Hartman --- drivers/regulator/qcom_rpm-regulator.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) --- a/drivers/regulator/qcom_rpm-regulator.c +++ b/drivers/regulator/qcom_rpm-regulator.c @@ -820,6 +820,12 @@ static const struct rpm_regulator_data r }; static const struct rpm_regulator_data rpm_pm8058_regulators[] = { + { "s0", QCOM_RPM_PM8058_SMPS0, &pm8058_smps, "vdd_s0" }, + { "s1", QCOM_RPM_PM8058_SMPS1, &pm8058_smps, "vdd_s1" }, + { "s2", QCOM_RPM_PM8058_SMPS2, &pm8058_smps, "vdd_s2" }, + { "s3", QCOM_RPM_PM8058_SMPS3, &pm8058_smps, "vdd_s3" }, + { "s4", QCOM_RPM_PM8058_SMPS4, &pm8058_smps, "vdd_s4" }, + { "l0", QCOM_RPM_PM8058_LDO0, &pm8058_nldo, "vdd_l0_l1_lvs" }, { "l1", QCOM_RPM_PM8058_LDO1, &pm8058_nldo, "vdd_l0_l1_lvs" }, { "l2", QCOM_RPM_PM8058_LDO2, &pm8058_pldo, "vdd_l2_l11_l12" }, @@ -847,12 +853,6 @@ static const struct rpm_regulator_data r { "l24", QCOM_RPM_PM8058_LDO24, &pm8058_nldo, "vdd_l23_l24_l25" }, { "l25", QCOM_RPM_PM8058_LDO25, &pm8058_nldo, "vdd_l23_l24_l25" }, - { "s0", QCOM_RPM_PM8058_SMPS0, &pm8058_smps, "vdd_s0" }, - { "s1", QCOM_RPM_PM8058_SMPS1, &pm8058_smps, "vdd_s1" }, - { "s2", QCOM_RPM_PM8058_SMPS2, &pm8058_smps, "vdd_s2" }, - { "s3", QCOM_RPM_PM8058_SMPS3, &pm8058_smps, "vdd_s3" }, - { "s4", QCOM_RPM_PM8058_SMPS4, &pm8058_smps, "vdd_s4" }, - { "lvs0", QCOM_RPM_PM8058_LVS0, &pm8058_switch, "vdd_l0_l1_lvs" }, { "lvs1", QCOM_RPM_PM8058_LVS1, &pm8058_switch, "vdd_l0_l1_lvs" }, @@ -861,6 +861,12 @@ static const struct rpm_regulator_data r }; static const struct rpm_regulator_data rpm_pm8901_regulators[] = { + { "s0", QCOM_RPM_PM8901_SMPS0, &pm8901_ftsmps, "vdd_s0" }, + { "s1", QCOM_RPM_PM8901_SMPS1, &pm8901_ftsmps, "vdd_s1" }, + { "s2", QCOM_RPM_PM8901_SMPS2, &pm8901_ftsmps, "vdd_s2" }, + { "s3", QCOM_RPM_PM8901_SMPS3, &pm8901_ftsmps, "vdd_s3" }, + { "s4", QCOM_RPM_PM8901_SMPS4, &pm8901_ftsmps, "vdd_s4" }, + { "l0", QCOM_RPM_PM8901_LDO0, &pm8901_nldo, "vdd_l0" }, { "l1", QCOM_RPM_PM8901_LDO1, &pm8901_pldo, "vdd_l1" }, { "l2", QCOM_RPM_PM8901_LDO2, &pm8901_pldo, "vdd_l2" }, @@ -869,12 +875,6 @@ static const struct rpm_regulator_data r { "l5", QCOM_RPM_PM8901_LDO5, &pm8901_pldo, "vdd_l5" }, { "l6", QCOM_RPM_PM8901_LDO6, &pm8901_pldo, "vdd_l6" }, - { "s0", QCOM_RPM_PM8901_SMPS0, &pm8901_ftsmps, "vdd_s0" }, - { "s1", QCOM_RPM_PM8901_SMPS1, &pm8901_ftsmps, "vdd_s1" }, - { "s2", QCOM_RPM_PM8901_SMPS2, &pm8901_ftsmps, "vdd_s2" }, - { "s3", QCOM_RPM_PM8901_SMPS3, &pm8901_ftsmps, "vdd_s3" }, - { "s4", QCOM_RPM_PM8901_SMPS4, &pm8901_ftsmps, "vdd_s4" }, - { "lvs0", QCOM_RPM_PM8901_LVS0, &pm8901_switch, "lvs0_in" }, { "lvs1", QCOM_RPM_PM8901_LVS1, &pm8901_switch, "lvs1_in" }, { "lvs2", QCOM_RPM_PM8901_LVS2, &pm8901_switch, "lvs2_in" }, From patchwork Mon Oct 24 11:29:28 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8760 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp430340wru; Mon, 24 Oct 2022 05:41:16 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4EjHcAugYTMjYaOcWUxYPHKi85ymudziHW31be19h55x0SsA+MXP2r/qj2DIqfMs1YC1x6 X-Received: by 2002:a17:902:d483:b0:182:cb98:26e8 with SMTP id c3-20020a170902d48300b00182cb9826e8mr33321160plg.73.1666615276269; Mon, 24 Oct 2022 05:41:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666615276; cv=none; d=google.com; s=arc-20160816; b=k+9aOOEknU4HpPYd2qi0yo4BzX+gN5NDld7XD+VHewNs1EupCbGfcNLbIQ9m7ry3k5 SBriK12u0eBj5IjlrhW6/zeI2AvqGZQw8E/TGc7/TlgVkOZT8CYL8KpfzgOSdYN5nXOR nsiw/T33Q+cGCQkDubE24zFNwSbVbLhd8SkduZSHq5OXwj6bkodW4JASjvE2XmaZsreP pawdubw9nIM7BSfYuH8lDKLFAOVid+vjJz6dW1gSGy879J+VHz5HYHxF2X5qTTVN3VmW vP173JA9IKW6SCbp4o7NjJaYJr4x7SPXlk0lR16tIj+XzY3pVJX+cBRPsj13kjuTo4sW hFmg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Kx5j+IQ6fsp2rfQvw/ji9pvosxCQFMEkSNPoLR43y2Q=; b=peQXaAqC4XpSrLyyHf71Je7KNbe0B4GnoWDzfp2u7q4g/G3vBnN7h5cEyezhh+IHWc Qm21zspQLeStM40psqVWXUAJfsG//kvvru2xp1oDmIrcmgpNmuPJzJqqbfmrmsJReIUU JvPLbGft0x0ZwQbYvUlCHUDOX+bAqt/IIju30k9VV98Ch899xs48qu5feO32Xc+6bvrn NlfgVHmkpjdkoI6hnHOx5V8zrGbsihlI9Mw5adg9YFDRq1a0d91OFw85+ZIRcCc6hTx3 kl39Gwb7KAZdxpcTQA/yqVPVElzgXxRW5z+q3ePxJRD3QSGIYZb5Jt4FAwerc/n7vHDk Ml1A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=mWuJ3vJA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 64-20020a630243000000b0046ed54becf6si9774563pgc.678.2022.10.24.05.41.02; Mon, 24 Oct 2022 05:41:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=mWuJ3vJA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234111AbiJXM3U (ORCPT + 99 others); Mon, 24 Oct 2022 08:29:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57948 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233840AbiJXM2X (ORCPT ); Mon, 24 Oct 2022 08:28:23 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AC69A86896; Mon, 24 Oct 2022 05:02:14 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id B8E3BB811C5; Mon, 24 Oct 2022 11:58:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 22D74C433D6; Mon, 24 Oct 2022 11:58:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612706; bh=86Bdj7WnZgq0vHTIPVC4gQ4G8vTZJzy4bM/p2YB3db0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mWuJ3vJATPhOA6jpqFVOOXwNcxB3/JokuZY06Josn6pCiHCOCbnLumtVseY++zja0 DciItruDjKNoR5Dr3kvd5f393Fopi5/CSXPeE+dmQ7tGHGNzWQnxbuCZThhPLqAqBI KfdUYxYOPmVdv6JBDsxmyN3vEPXR+rIoSvIJE2d8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Saeed Mirzamohammadi , Sasha Levin Subject: [PATCH 4.19 049/229] Revert "fs: check FMODE_LSEEK to control internal pipe splicing" Date: Mon, 24 Oct 2022 13:29:28 +0200 Message-Id: <20221024113000.669471664@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747572779860325474?= X-GMAIL-MSGID: =?utf-8?q?1747572779860325474?= This reverts commit fd0a6e99b61e6c08fa5cf585d54fd956f70c73a6. Which was upstream commit 97ef77c52b789ec1411d360ed99dca1efe4b2c81. The commit is missing dependencies and breaks NFS tests, remove it for now. Reported-by: Saeed Mirzamohammadi Signed-off-by: Sasha Levin --- fs/splice.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) --- a/fs/splice.c +++ b/fs/splice.c @@ -899,15 +899,17 @@ ssize_t splice_direct_to_actor(struct fi { struct pipe_inode_info *pipe; long ret, bytes; + umode_t i_mode; size_t len; int i, flags, more; /* - * We require the input to be seekable, as we don't want to randomly - * drop data for eg socket -> socket splicing. Use the piped splicing - * for that! + * We require the input being a regular file, as we don't want to + * randomly drop data for eg socket -> socket splicing. Use the + * piped splicing for that! */ - if (unlikely(!(in->f_mode & FMODE_LSEEK))) + i_mode = file_inode(in)->i_mode; + if (unlikely(!S_ISREG(i_mode) && !S_ISBLK(i_mode))) return -EINVAL; /* From patchwork Mon Oct 24 11:29:29 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8896 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp433809wru; Mon, 24 Oct 2022 05:50:32 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5FlV4gIgpwqxldl+IWisQCTPJJyHT7d4B6FKF2JH0AnByphGV2Ap3dtaY5uHZdAdHXf8xA X-Received: by 2002:a05:6402:254f:b0:45d:3044:d679 with SMTP id l15-20020a056402254f00b0045d3044d679mr31427639edb.137.1666615832707; Mon, 24 Oct 2022 05:50:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666615832; cv=none; d=google.com; s=arc-20160816; b=og3ReNgYrHfvcCQpSmoHcY9zbGl8zkzQUATa8W2o4v3QSPB9Hsn1uLCHJvfT6PEQ+j 2hikr938LfYdyIU3ylqLcjVLi3eQhnBEatfXGFX8qfNm4uR1GCkBW+JV1YKUt7Zo+zPU 6PA5YXbVDDdd8slV4Ox94ry39RU9YgSdosCT9HziNEQHyEoIGzD1/Yd/1icun26/FDGt Y/JA0UPbICXADr/0mnFNi4rHFrE2c+7AWGZ++46vZBweauLivbqyGANmMq3Eogp7EWAD LKtBfDc9phpaSkU/S5kF1VKpqafEj3KhN/XNHu+YXoFS+owGXzAS9eBZckExapF6dObX k26g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=0iXjiI1uzDUFY4xmp74E6j77SdFazKA7znoCBQisjxM=; b=IDv+asb7RwA3ZIpQlXwj18zOzKp2PubRJAtL8yqGcSuayM3ZKF9X7ZGALUhVM6Nsrj pqmGwnNyH4omaxBYjYhZ/O+vSY3vsNxvc80K/jm9pQprc5+5gJofhljwvN5PO5xU1+Kc QpYSPrJ7p29AavNpZgkCmKeuB/zi++ojt/K5+i3qzsUtkJSxL+Xi3Y2u7KeAH5bNirS7 unArFAQK4cY7gQDe9wZWc+XH9k3jmtyOzF19OCt76dN6NoG4hUzuqoaGErkOXcpELYFj 1xlgq2d8eymu0xfk/UHHwzOaWPWUzWLcItZLR2SIRFpUMVgkuBJ+5KzATGbu9NJ590M3 eb9A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=OopmayLJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id cw20-20020a170906479400b0078db3ae83d0si26624529ejc.3.2022.10.24.05.50.05; Mon, 24 Oct 2022 05:50:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=OopmayLJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234542AbiJXMtF (ORCPT + 99 others); Mon, 24 Oct 2022 08:49:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56314 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234393AbiJXMon (ORCPT ); Mon, 24 Oct 2022 08:44:43 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3C0397D1C6; Mon, 24 Oct 2022 05:09:16 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 84A3E612EA; Mon, 24 Oct 2022 11:57:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 97771C433D6; Mon, 24 Oct 2022 11:57:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612624; bh=Ys3ka49cccFJzfsTCTuZ+erQPYHY5yRX3BygybRzjkA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OopmayLJxkz1ILjvZWqXTVXqPwuQM7i3VpxceGJhiMyoNqx6A3/I4QwaA/kACqxcd WNTRIBuDdctvG1PK5Q5q/FZtJuTTEf1knngBc+2TXewDlPx+kivu9KTCCdjdOLMse7 3NaHwTCMabz0TrJFzmlanytxc4mDDv5GPdX8GICM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Helge Deller Subject: [PATCH 4.19 050/229] parisc: fbdev/stifb: Align graphics memory size to 4MB Date: Mon, 24 Oct 2022 13:29:29 +0200 Message-Id: <20221024113000.699526719@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747573363347861149?= X-GMAIL-MSGID: =?utf-8?q?1747573363347861149?= From: Helge Deller commit aca7c13d3bee81a968337a5515411409ae9d095d upstream. Independend of the current graphics resolution, adjust the reported graphics card memory size to the next 4MB boundary. This fixes the fbtest program which expects a naturally aligned size. Signed-off-by: Helge Deller Cc: Signed-off-by: Greg Kroah-Hartman --- drivers/video/fbdev/stifb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/video/fbdev/stifb.c +++ b/drivers/video/fbdev/stifb.c @@ -1257,7 +1257,7 @@ static int __init stifb_init_fb(struct s /* limit fbsize to max visible screen size */ if (fix->smem_len > yres*fix->line_length) - fix->smem_len = yres*fix->line_length; + fix->smem_len = ALIGN(yres*fix->line_length, 4*1024*1024); fix->accel = FB_ACCEL_NONE; From patchwork Mon Oct 24 11:29:30 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8756 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp430332wru; Mon, 24 Oct 2022 05:41:15 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5lLGmBio8srreZi7eC2mOD46bNxA/gPEWHng9jwgGZjQU6b0/Mv4MpFcB4YtCcOlB7QHQa X-Received: by 2002:a05:6a02:202:b0:42b:d711:f27c with SMTP id bh2-20020a056a02020200b0042bd711f27cmr27806194pgb.246.1666615275362; Mon, 24 Oct 2022 05:41:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666615275; cv=none; d=google.com; s=arc-20160816; b=WPHh/gf8Ai0+NP9V4pU4K9A1jD/swdAn5+KM/QBnKj3JLGedEKmGzFaTXjkCdUcTRx KOeKOrN2TCn0U5a5QunNRsZUVAfT25MNFFs3hqFnOJ2q7jThu2sXyZSpYIm/9ZTEJJan gW8V0TBcEzXNMj8WVjyVRNC0R9YnS8ltk35u7lMeQBn/GTBlPiEWdqkc8TmOvNcIgWBt 4+cvArL/qK7vNS1+SWQbITeaJ+xDDl2Uy3MZR3Tm0iGxY4SwPt0SRvp+Abi1FgeivYd9 wfHFOOOQ1ura6Wm475Va8faUkCIzdXBcITNK8+O2K30xW2dUyAc4zQyw43AtC7X+LlQU j9ig== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=2AQ7MYtE3QoUFGdmr3gg1JQ4Z6jFVQa8U7HPr+G9wkg=; b=W5IzOmFx2lVW/ThBTIo58NQcBxiikXmpoHWl68ZINDLhUzjlcnFCYZjg3oiVBen2Kh zJNi+fajfjwbLDGmWyhrLwFvoj7+kPsrHtFFwGkgZNxAq6GUucGY7Y/OuIJlMLB7O8e1 5+bSoutOE5qPL5CHoXSaHszVk/9F1nHzbyNav60s0PQrX2FQKHzHfkSxAxwRY/qdZWt1 NwG9GvTQdKjorwNsjN426bf4BbiOvJ+7ZST01yDtbqW5wm5Dlvs/MEXVHnBtOVMOBBId BonHt1kOPmJqY1diXxOo5GalKPbC5I4KCdlauseokROxJOVQZLyP6KXm6dW7RWVMLqyW Rpsw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=BpECCjjV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hk13-20020a17090b224d00b0020adba9ec02si10569397pjb.82.2022.10.24.05.41.01; Mon, 24 Oct 2022 05:41:15 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=BpECCjjV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233980AbiJXM3I (ORCPT + 99 others); Mon, 24 Oct 2022 08:29:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60622 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233803AbiJXM2S (ORCPT ); Mon, 24 Oct 2022 08:28:18 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E62A285A81; Mon, 24 Oct 2022 05:01:53 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 18DBEB811EA; Mon, 24 Oct 2022 11:57:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 66FA2C433C1; Mon, 24 Oct 2022 11:57:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612653; bh=aM3Ys8VR9L5UWxe/PM64/AlbhVXkGSXjpofOLl/w2Ak=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BpECCjjVDEkt3TbJ6aOhLUSqvys/UJsnK0NojcezSShh+iDPGwDwpUSCJP+V3tvWT 4Z3N2x2xGYcPnOFVQ7mWUcBX/MXAcHeD15QQGkkybwG9dGkYR6hn85EI+mi7vnyIjf tr95N1ytGa1yPD3VFYoJQ2CdyS64U1fwmEJ26lZU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Atish Patra , Andrew Bresticker , Palmer Dabbelt Subject: [PATCH 4.19 051/229] riscv: Allow PROT_WRITE-only mmap() Date: Mon, 24 Oct 2022 13:29:30 +0200 Message-Id: <20221024113000.729572803@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747572778794879218?= X-GMAIL-MSGID: =?utf-8?q?1747572778794879218?= From: Andrew Bresticker commit 9e2e6042a7ec6504fe8e366717afa2f40cf16488 upstream. Commit 2139619bcad7 ("riscv: mmap with PROT_WRITE but no PROT_READ is invalid") made mmap() return EINVAL if PROT_WRITE was set wihtout PROT_READ with the justification that a write-only PTE is considered a reserved PTE permission bit pattern in the privileged spec. This check is unnecessary since we let VM_WRITE imply VM_READ on RISC-V, and it is inconsistent with other architectures that don't support write-only PTEs, creating a potential software portability issue. Just remove the check altogether and let PROT_WRITE imply PROT_READ as is the case on other architectures. Note that this also allows PROT_WRITE|PROT_EXEC mappings which were disallowed prior to the aforementioned commit; PROT_READ is implied in such mappings as well. Fixes: 2139619bcad7 ("riscv: mmap with PROT_WRITE but no PROT_READ is invalid") Reviewed-by: Atish Patra Signed-off-by: Andrew Bresticker Cc: stable@vger.kernel.org Link: https://lore.kernel.org/r/20220915193702.2201018-3-abrestic@rivosinc.com/ Signed-off-by: Palmer Dabbelt Signed-off-by: Greg Kroah-Hartman --- arch/riscv/kernel/sys_riscv.c | 3 --- 1 file changed, 3 deletions(-) --- a/arch/riscv/kernel/sys_riscv.c +++ b/arch/riscv/kernel/sys_riscv.c @@ -26,9 +26,6 @@ static long riscv_sys_mmap(unsigned long if (unlikely(offset & (~PAGE_MASK >> page_shift_offset))) return -EINVAL; - if (unlikely((prot & PROT_WRITE) && !(prot & PROT_READ))) - return -EINVAL; - return ksys_mmap_pgoff(addr, len, prot, flags, fd, offset >> (PAGE_SHIFT - page_shift_offset)); } From patchwork Mon Oct 24 11:29:31 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8758 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp430331wru; Mon, 24 Oct 2022 05:41:15 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6RWuJiRxd3fhjCPvTSs/XVl41tT/5qafqVBV00Se3ZOihCQsCzzy8758xkEkv3NwUe4xgs X-Received: by 2002:a17:902:f602:b0:178:9818:48a4 with SMTP id n2-20020a170902f60200b00178981848a4mr32996191plg.148.1666615275368; Mon, 24 Oct 2022 05:41:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666615275; cv=none; d=google.com; s=arc-20160816; b=WlOqR0RSTs7UctA4m00guQ+1hvbAxoZlF//FAJTnqEgwf2QvuKbqOi9gVKE/XlHQJX rzMyzor8SwjJ+u3GKXmUAt8AQdTihHQGf1qlK2DrmM1qAIcFLjHVkNTiZvWLpgHTUkox wIYzzgridVac0VQ5/Ec7CLvl0aRP5igTBu+FAhXug8QgAClwMpnTZvkc1ewmaGKw7Zj3 FNW3nlqgSmFA6XZ+1DnM3casYCR8iXdWbXk67SRRpLyii+cK/THACfxpvQRnqaFNF8l+ uhZg0jVI+M/9peoBnQr6/KTVPqV1HjX8aW969DdrYc7T+2tdLCINYXZN0QSTT4l1SgWd 6G2A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=VwaAX4ijTAW1/JY2XMmcMeTeUWRgXI9gDfuV9600zAQ=; b=aHxcoUx+MNzQpas9M/osFGEgpmwqvYA/XVLlVAZfdJJ3c2baKIepWEcp037kziTDF5 1hkoySxn3qIKP+s1tXCfeShidBFXXTL1KQRJ2RCrwpE1v/hLtpj61tntFYp8OY/CJ+HC Slq6cuXn9VCJyQtMjS9fxVvNhF2vMVXOL8gN/S7iyFKvxcXfjDVF6xEm6pXA9HRmdw4I ZHQWDaSDkiPOVNB/JmnOab5PWfOPs/tfRycznRyioe/6cUzTWVzdaZqA5ABd5ezfKrTO +QUchW6cFAZXGwtH+KLvMTILuL0kyq1A6iO2k5LMABPe0rpejhjFq8CVSaULUOJnIq/d 2DeA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=1egIE6YS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 131-20020a621789000000b00561a2341e81si30300147pfx.125.2022.10.24.05.41.02; Mon, 24 Oct 2022 05:41:15 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=1egIE6YS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234085AbiJXM3S (ORCPT + 99 others); Mon, 24 Oct 2022 08:29:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45258 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233830AbiJXM2W (ORCPT ); Mon, 24 Oct 2022 08:28:22 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 08E9986F99; Mon, 24 Oct 2022 05:02:10 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id AC700B81134; Mon, 24 Oct 2022 11:58:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 162BCC433D6; Mon, 24 Oct 2022 11:58:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612682; bh=uBbLc8QAgT9cQGnph4PMHqBIqShqWIcTjog/nTwhBok=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1egIE6YS/yzthAMtdLE+YYb2oiKMXArlR4yZU1HtaSYdNH1arOITP4qv24F44zjRi ZSpNV9zUb/wL2mQJGjyh9absMwXaLyHT+B1vr7dnka5U4oraeFnmOHX08Eqw7T3YQm lIyOidIUf6C5RccDZ9YX34AoPMdek837kDuQPTtU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Huacai Chen , Richard Weinberger Subject: [PATCH 4.19 052/229] UM: cpuinfo: Fix a warning for CONFIG_CPUMASK_OFFSTACK Date: Mon, 24 Oct 2022 13:29:31 +0200 Message-Id: <20221024113000.762374908@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747572778893609229?= X-GMAIL-MSGID: =?utf-8?q?1747572778893609229?= From: Huacai Chen commit 16c546e148fa6d14a019431436a6f7b4087dbccd upstream. When CONFIG_CPUMASK_OFFSTACK and CONFIG_DEBUG_PER_CPU_MAPS is selected, cpu_max_bits_warn() generates a runtime warning similar as below while we show /proc/cpuinfo. Fix this by using nr_cpu_ids (the runtime limit) instead of NR_CPUS to iterate CPUs. [ 3.052463] ------------[ cut here ]------------ [ 3.059679] WARNING: CPU: 3 PID: 1 at include/linux/cpumask.h:108 show_cpuinfo+0x5e8/0x5f0 [ 3.070072] Modules linked in: efivarfs autofs4 [ 3.076257] CPU: 0 PID: 1 Comm: systemd Not tainted 5.19-rc5+ #1052 [ 3.099465] Stack : 9000000100157b08 9000000000f18530 9000000000cf846c 9000000100154000 [ 3.109127] 9000000100157a50 0000000000000000 9000000100157a58 9000000000ef7430 [ 3.118774] 90000001001578e8 0000000000000040 0000000000000020 ffffffffffffffff [ 3.128412] 0000000000aaaaaa 1ab25f00eec96a37 900000010021de80 900000000101c890 [ 3.138056] 0000000000000000 0000000000000000 0000000000000000 0000000000aaaaaa [ 3.147711] ffff8000339dc220 0000000000000001 0000000006ab4000 0000000000000000 [ 3.157364] 900000000101c998 0000000000000004 9000000000ef7430 0000000000000000 [ 3.167012] 0000000000000009 000000000000006c 0000000000000000 0000000000000000 [ 3.176641] 9000000000d3de08 9000000001639390 90000000002086d8 00007ffff0080286 [ 3.186260] 00000000000000b0 0000000000000004 0000000000000000 0000000000071c1c [ 3.195868] ... [ 3.199917] Call Trace: [ 3.203941] [<90000000002086d8>] show_stack+0x38/0x14c [ 3.210666] [<9000000000cf846c>] dump_stack_lvl+0x60/0x88 [ 3.217625] [<900000000023d268>] __warn+0xd0/0x100 [ 3.223958] [<9000000000cf3c90>] warn_slowpath_fmt+0x7c/0xcc [ 3.231150] [<9000000000210220>] show_cpuinfo+0x5e8/0x5f0 [ 3.238080] [<90000000004f578c>] seq_read_iter+0x354/0x4b4 [ 3.245098] [<90000000004c2e90>] new_sync_read+0x17c/0x1c4 [ 3.252114] [<90000000004c5174>] vfs_read+0x138/0x1d0 [ 3.258694] [<90000000004c55f8>] ksys_read+0x70/0x100 [ 3.265265] [<9000000000cfde9c>] do_syscall+0x7c/0x94 [ 3.271820] [<9000000000202fe4>] handle_syscall+0xc4/0x160 [ 3.281824] ---[ end trace 8b484262b4b8c24c ]--- Cc: stable@vger.kernel.org Signed-off-by: Huacai Chen Signed-off-by: Richard Weinberger Signed-off-by: Greg Kroah-Hartman --- arch/um/kernel/um_arch.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/arch/um/kernel/um_arch.c +++ b/arch/um/kernel/um_arch.c @@ -77,7 +77,7 @@ static int show_cpuinfo(struct seq_file static void *c_start(struct seq_file *m, loff_t *pos) { - return *pos < NR_CPUS ? cpu_data + *pos : NULL; + return *pos < nr_cpu_ids ? cpu_data + *pos : NULL; } static void *c_next(struct seq_file *m, void *v, loff_t *pos) From patchwork Mon Oct 24 11:29:32 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8747 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp428544wru; Mon, 24 Oct 2022 05:36:18 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4evhtbx5G7JnBk4tG54pqCqg/Qjss0YIbwaS0B2H+2oQR4IYci122YOnWMe23cFamhmPHr X-Received: by 2002:a17:906:9b87:b0:733:1795:2855 with SMTP id dd7-20020a1709069b8700b0073317952855mr27479723ejc.156.1666614978135; Mon, 24 Oct 2022 05:36:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666614978; cv=none; d=google.com; s=arc-20160816; b=FYMC+gJCxX5IhDe6Z3+v8yIlhgSn+WgDZ2Tdmv3upatOrGoCAEKgeYfrhZIAsBjfvp Ty5g70CpNPBmc6jfNtPhK5oui++F134L2LNrRdQLLiULeqNLuervWabnF/Lcq/bDkwyE ciemGrE4GZgkYW1sm2o7B9mXhfP+/VnXXxqePXczi9ti8AeumXFz1v0zRZ4sGI1tmzCJ o2NxcXMDOYFLA98GKoyGu3s61lSrU3QtTlS9NRTQzSV6rfEbszqOFxWKsdiGoorqz3Oi cvP4fK/P1uhVasul0a0HyTq0SItvyK6wxowkD0oYbgVngq7f/gM6zpjmsrU14eKvJLw9 BH6g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=gY+XvzL7AtoHdksVNSa0lDj4SD23lcILqtuYgW/a1qk=; b=cvKg8ENlG0D7mhRsJE0KmKVMyeYuSY2QItDbUgGUyS+ScuINKrHwAHHbFubjWLKfiU uqSwjwkYdUOLLKl1R7YHZ+HWjYLjAMWdC2NnZow49tsP23whtB30iTcCnSr/du7QM+R3 g53J9I5lM8dz92p3Whz/y0WvEeDCKaKGVgjCh6BgH3L352bTLSsUY56M+FM/z5ml+r+E Ax2z5sSv05v6bYvqUQU7B2kmVn0L7ILoJlYX6BHrg2jBp0TNcaoCosT7CIHyHk/UkbIQ a/XpTga6Aycm90c87JJqNSAIMnR0KEC+bxY/iYLWHbnd4vgop9ENk6LjPjiXVHkS3Y3C qidQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=wwkxBBdV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f30-20020a170906739e00b007829f6fed9dsi18023806ejl.232.2022.10.24.05.35.51; Mon, 24 Oct 2022 05:36:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=wwkxBBdV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233645AbiJXM1I (ORCPT + 99 others); Mon, 24 Oct 2022 08:27:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60536 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230439AbiJXM0o (ORCPT ); Mon, 24 Oct 2022 08:26:44 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7E9D158EB5; Mon, 24 Oct 2022 05:00:44 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id EA22361291; Mon, 24 Oct 2022 11:58:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 06E55C433D6; Mon, 24 Oct 2022 11:58:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612690; bh=aOvtxZzoxLZvYMnqDsCHT9AR35HDLsRHaZZOOkdNEaQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wwkxBBdVYz6Gen91Jqhbiu0pv7glKyU0m+xuZEUjvhCKq6EYK2+sjt4eb6UsDqsMH DB4wxsteOIXrM1LlsPWL4dhwsUZpXqHAnk8t6ZHvBm5Ym6p7bNE0KY+cULLMkJuG22 KXXCLyd/AGKx/Tu5R71CceEBpS09IiPJPEW4VGGg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Maciej W. Rozycki" , Bjorn Helgaas Subject: [PATCH 4.19 053/229] PCI: Sanitise firmware BAR assignments behind a PCI-PCI bridge Date: Mon, 24 Oct 2022 13:29:32 +0200 Message-Id: <20221024113000.792508891@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747572467257659166?= X-GMAIL-MSGID: =?utf-8?q?1747572467257659166?= From: Maciej W. Rozycki commit 0e32818397426a688f598f35d3bc762eca6d7592 upstream. When pci_assign_resource() is unable to assign resources to a BAR, it uses pci_revert_fw_address() to fall back to a firmware assignment (if any). Previously pci_revert_fw_address() assumed all addresses could reach the device, but this is not true if the device is below a bridge that only forwards addresses within its windows. This problem was observed on a Tyan Tomcat IV S1564D system where the BIOS did not assign valid addresses to several bridges and USB devices: pci 0000:00:11.0: PCI-to-PCIe bridge to [bus 01-ff] pci 0000:00:11.0: bridge window [io 0xe000-0xefff] pci 0000:01:00.0: PCIe Upstream Port to [bus 02-ff] pci 0000:01:00.0: bridge window [io 0x0000-0x0fff] # unreachable pci 0000:02:02.0: PCIe Downstream Port to [bus 05-ff] pci 0000:02:02.0: bridge window [io 0x0000-0x0fff] # unreachable pci 0000:05:00.0: PCIe-to-PCI bridge to [bus 06-ff] pci 0000:05:00.0: bridge window [io 0x0000-0x0fff] # unreachable pci 0000:06:08.0: USB UHCI 1.1 pci 0000:06:08.0: BAR 4: [io 0xfce0-0xfcff] # unreachable pci 0000:06:08.1: USB UHCI 1.1 pci 0000:06:08.1: BAR 4: [io 0xfce0-0xfcff] # unreachable pci 0000:06:08.0: can't claim BAR 4 [io 0xfce0-0xfcff]: no compatible bridge window pci 0000:06:08.1: can't claim BAR 4 [io 0xfce0-0xfcff]: no compatible bridge window During the first pass of assigning unassigned resources, there was not enough I/O space available, so we couldn't assign the 06:08.0 BAR and reverted to the firmware assignment (still unreachable). Reverting the 06:08.1 assignment failed because it conflicted with 06:08.0: pci 0000:00:11.0: bridge window [io 0xe000-0xefff] pci 0000:01:00.0: no space for bridge window [io size 0x2000] pci 0000:02:02.0: no space for bridge window [io size 0x1000] pci 0000:05:00.0: no space for bridge window [io size 0x1000] pci 0000:06:08.0: BAR 4: no space for [io size 0x0020] pci 0000:06:08.0: BAR 4: trying firmware assignment [io 0xfce0-0xfcff] pci 0000:06:08.1: BAR 4: no space for [io size 0x0020] pci 0000:06:08.1: BAR 4: trying firmware assignment [io 0xfce0-0xfcff] pci 0000:06:08.1: BAR 4: [io 0xfce0-0xfcff] conflicts with 0000:06:08.0 [io 0xfce0-0xfcff] A subsequent pass assigned valid bridge windows and a valid 06:08.1 BAR, but left the 06:08.0 BAR alone, so the UHCI device was still unusable: pci 0000:00:11.0: bridge window [io 0xe000-0xefff] released pci 0000:00:11.0: bridge window [io 0x1000-0x2fff] # reassigned pci 0000:01:00.0: bridge window [io 0x1000-0x2fff] # reassigned pci 0000:02:02.0: bridge window [io 0x2000-0x2fff] # reassigned pci 0000:05:00.0: bridge window [io 0x2000-0x2fff] # reassigned pci 0000:06:08.0: BAR 4: assigned [io 0xfce0-0xfcff] # left alone pci 0000:06:08.1: BAR 4: assigned [io 0x2000-0x201f] ... uhci_hcd 0000:06:08.0: host system error, PCI problems? uhci_hcd 0000:06:08.0: host controller process error, something bad happened! uhci_hcd 0000:06:08.0: host controller halted, very bad! uhci_hcd 0000:06:08.0: HCRESET not completed yet! uhci_hcd 0000:06:08.0: HC died; cleaning up If the address assigned by firmware is not reachable because it's not within upstream bridge windows, fail instead of assigning the unusable address from firmware. [bhelgaas: commit log, use pci_upstream_bridge()] Link: https://bugzilla.kernel.org/show_bug.cgi?id=16263 Link: https://lore.kernel.org/r/alpine.DEB.2.21.2203012338460.46819@angie.orcam.me.uk Link: https://lore.kernel.org/r/alpine.DEB.2.21.2209211921250.29493@angie.orcam.me.uk Fixes: 58c84eda0756 ("PCI: fall back to original BIOS BAR addresses") Signed-off-by: Maciej W. Rozycki Signed-off-by: Bjorn Helgaas Cc: stable@vger.kernel.org # v2.6.35+ Signed-off-by: Greg Kroah-Hartman --- drivers/pci/setup-res.c | 11 +++++++++++ 1 file changed, 11 insertions(+) --- a/drivers/pci/setup-res.c +++ b/drivers/pci/setup-res.c @@ -209,6 +209,17 @@ static int pci_revert_fw_address(struct root = pci_find_parent_resource(dev, res); if (!root) { + /* + * If dev is behind a bridge, accesses will only reach it + * if res is inside the relevant bridge window. + */ + if (pci_upstream_bridge(dev)) + return -ENXIO; + + /* + * On the root bus, assume the host bridge will forward + * everything. + */ if (res->flags & IORESOURCE_IO) root = &ioport_resource; else From patchwork Mon Oct 24 11:29:33 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8718 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp423502wru; Mon, 24 Oct 2022 05:25:06 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5UbeXeHdEfZrq2oZ5P+5oQj+6pK4L4uHRP1aKKncGRoBqY1qG8noR4ey7TRKt8R6c9PgdS X-Received: by 2002:a17:90b:33d1:b0:212:f02a:e5c7 with SMTP id lk17-20020a17090b33d100b00212f02ae5c7mr11645400pjb.137.1666614306505; Mon, 24 Oct 2022 05:25:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666614306; cv=none; d=google.com; s=arc-20160816; b=SehWWuIe4ZXFHXIS22vbuIB8t9rzh3GWnW1XkIEWhL9OHmJs+SjSTKucg5EkwICtYE LDmT7UwU23fmWkblXfUwQsZrFch1ItUGUGSRF/XEqc7dh2ZAf5q6q1kHEQ9Wvwn6QDWG PVR47AlZDCLVrXZLWLoQcyG9eVza5JMIpUlDEZ0NBKmUBHY34SnFFs5EDQf0bMA+h2lp cJONP4+VFdJpEaqamTcdxhIgbYUzBYUmDCN/fHuiMtvVNhrF9IIH7CZeXWw1UekCyybr jl/G9oqE8omCnsNHAZYXgR8DLAVqZ5cP+Qv7vlAtCeP2fFQJUuA5NfPqSTg9CSdHwtKH 69YA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=nRHpU740LS9V9UMb0MfjYNqTsPZnci7Mtri2ge1QOws=; b=J5a06GpdHonHqNU/FJzXZ3EIo5GsbF++aB4DQJQD9U1PoLaHZ4El0McAYmiWAW62aZ xg/fFBOQ1Imy46jzGAwNCIFgYI0ecJzTYXpoI03oMdhgFBvga48esRFBWZsIOVNB2R9/ 4d2rzbyLvUH+WXFIyUxZQ0hOWzTGPtvdrEYOuCNSDklOdKigAdCGjwsbqAZ5cw6o1ZbN gMMSte8wGV6nyOCl2uFg5ZwVjrN6ymRiu7e6+2H08uJnmgUy+z/IaoiicDHibiRRwIqt q2ACiAAwvQi5umHpcVe/LjfRL11df8BoIREuPCpsrJbgLK8RRAHgKWuJ0aOgiw4GAkeM FwKw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="d7H/ZAn8"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a3-20020a1709027d8300b0017f7dc60325si20022714plm.555.2022.10.24.05.24.52; Mon, 24 Oct 2022 05:25:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="d7H/ZAn8"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233613AbiJXMXu (ORCPT + 99 others); Mon, 24 Oct 2022 08:23:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47402 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233525AbiJXMWm (ORCPT ); Mon, 24 Oct 2022 08:22:42 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0BEFD8323A; Mon, 24 Oct 2022 04:59:06 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 9798B61297; Mon, 24 Oct 2022 11:58:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A90AAC4347C; Mon, 24 Oct 2022 11:58:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612693; bh=HWA7feJirUMvz4SMFoo8EJ7PDp2OxwPuFBriGn26Axk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=d7H/ZAn8cAl76yLWLD4YBpzEE6dQinFAI/ASPuU6weJ2kXB8bB42hu8aQEzCy0Mpj uEXLVzMew2jo/YeZrbufq27hjfT/Ua8VjTsxKg8vuIVW593+CnGG0ZFGfYgc3cWGLf 40coMLb3WJv1IwStmMGKkFJfJRcBXHhprqPzXt44= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hyunwoo Kim , Helge Deller Subject: [PATCH 4.19 054/229] fbdev: smscufx: Fix use-after-free in ufx_ops_open() Date: Mon, 24 Oct 2022 13:29:33 +0200 Message-Id: <20221024113000.821981870@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747571763029858405?= X-GMAIL-MSGID: =?utf-8?q?1747571763029858405?= From: Hyunwoo Kim commit 5610bcfe8693c02e2e4c8b31427f1bdbdecc839c upstream. A race condition may occur if the user physically removes the USB device while calling open() for this device node. This is a race condition between the ufx_ops_open() function and the ufx_usb_disconnect() function, which may eventually result in UAF. So, add a mutex to the ufx_ops_open() and ufx_usb_disconnect() functions to avoid race contidion of krefs. Signed-off-by: Hyunwoo Kim Cc: stable@vger.kernel.org Signed-off-by: Helge Deller Signed-off-by: Greg Kroah-Hartman --- drivers/video/fbdev/smscufx.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) --- a/drivers/video/fbdev/smscufx.c +++ b/drivers/video/fbdev/smscufx.c @@ -140,6 +140,8 @@ static int ufx_submit_urb(struct ufx_dat static int ufx_alloc_urb_list(struct ufx_data *dev, int count, size_t size); static void ufx_free_urb_list(struct ufx_data *dev); +static DEFINE_MUTEX(disconnect_mutex); + /* reads a control register */ static int ufx_reg_read(struct ufx_data *dev, u32 index, u32 *data) { @@ -1073,9 +1075,13 @@ static int ufx_ops_open(struct fb_info * if (user == 0 && !console) return -EBUSY; + mutex_lock(&disconnect_mutex); + /* If the USB device is gone, we don't accept new opens */ - if (dev->virtualized) + if (dev->virtualized) { + mutex_unlock(&disconnect_mutex); return -ENODEV; + } dev->fb_count++; @@ -1099,6 +1105,8 @@ static int ufx_ops_open(struct fb_info * pr_debug("open /dev/fb%d user=%d fb_info=%p count=%d", info->node, user, info, dev->fb_count); + mutex_unlock(&disconnect_mutex); + return 0; } @@ -1746,6 +1754,8 @@ static void ufx_usb_disconnect(struct us { struct ufx_data *dev; + mutex_lock(&disconnect_mutex); + dev = usb_get_intfdata(interface); pr_debug("USB disconnect starting\n"); @@ -1766,6 +1776,8 @@ static void ufx_usb_disconnect(struct us kref_put(&dev->kref, ufx_free); /* consider ufx_data freed */ + + mutex_unlock(&disconnect_mutex); } static struct usb_driver ufx_driver = { From patchwork Mon Oct 24 11:29:34 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8767 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp430426wru; Mon, 24 Oct 2022 05:41:31 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5dSiGaSJLGP7rapQzGaciU6pz2Iy0k2/J4QXWIsQB61m7aGHqZzhE9aWBJrYty4pe6jzs8 X-Received: by 2002:a05:6a00:a04:b0:534:d8a6:40ce with SMTP id p4-20020a056a000a0400b00534d8a640cemr34070671pfh.15.1666615291068; Mon, 24 Oct 2022 05:41:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666615291; cv=none; d=google.com; s=arc-20160816; b=Rae2Hs4t1j6/xjEnJ7hX9zX/Pl5vpc8nMG4p6euuNxTu/rQIA0tKeB0aonqrVdIghC c3eYJBzhRYRvXmEwZkvurg+tfOOpypNiUVZu3/VnKVb04rzw0lCySdK8j+5IxCrJmlog Mf99QYd/4sstEPi/uAIvYTHgeEktmyzN25HgFkhXOUxvdTyJwzAXwvGSyic40vtUMKDe viHVO4AxkrqyVzq9Wvb5bSYcohTiMS/u5mVdNfpNsMm64378BmTzRIqocDGSIWfKCdmD tj8oHHUy3HpjkAwSsBr43ZNKFPRmF/F0IxkCJQ0NtJ3jIpztOAPn8H1vstj1nRfgWSDy DUzA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=dg3OVFmefhE2BQKGAvYjIK8In1f5D+1pCIM+9/3lUMU=; b=vs0VoKNN4TG4g9e4D8JdTbObr4uKAE5yBx+1m98FkziCa/HsBdliyv2Ulw6Ir90b5J jeAkcerx07Qns36kJPnaLexiobXmrM08OFm30pfcgeDl/TKJ0jnE6GDd6o2qmJhPIWXu B8Ua0psL+XY9zF+pdxgIsprswIchfWNw7FBN+5Dly1pZaGtvtfa5vQO4ggqkSCzN2TG7 qD9GXXDurbEUr388ghVqdzZLLFwjZjUew8u7Ta7eJdl86ZmiB/WOWJzjGn0n6ll52UOA Molt56HhbTtRsARPY0Rh7EKGQ7aYWBErGUezVaa7u59Gn0JMnnrUVQV6jR53xcStpnYT kesw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ENtezN+k; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r9-20020a1709028bc900b001768a29b9dfsi8885929plo.68.2022.10.24.05.41.16; Mon, 24 Oct 2022 05:41:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ENtezN+k; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233846AbiJXMa4 (ORCPT + 99 others); Mon, 24 Oct 2022 08:30:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60606 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233874AbiJXM2c (ORCPT ); Mon, 24 Oct 2022 08:28:32 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9626486892; Mon, 24 Oct 2022 05:02:13 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 19677B811BB; Mon, 24 Oct 2022 11:58:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 73049C433D6; Mon, 24 Oct 2022 11:58:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612695; bh=MJMYAYbebJ4eMXZJ9gKN+EzXQUKtgGBJb83mkrtYU5Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ENtezN+kAmXuXxsoEKVxxjuIQrRoYkc4RjEtzaiCGMjMxF3shcErEnTGJeWdSVms1 AHcrtdaTR44T7LShFWqVfDkhGTVafJ2lcFQ+98wer3fU7bxZliuRfNXax7eQfgX/2t bONtFofeybvypByUOz+hWrtTaT7GQoR6wGRwq3n0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ye Bin , Qu Wenruo , Filipe Manana , David Sterba Subject: [PATCH 4.19 055/229] btrfs: fix race between quota enable and quota rescan ioctl Date: Mon, 24 Oct 2022 13:29:34 +0200 Message-Id: <20221024113000.860747439@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747572795587552684?= X-GMAIL-MSGID: =?utf-8?q?1747572795587552684?= From: Filipe Manana commit 331cd9461412e103d07595a10289de90004ac890 upstream. When enabling quotas, at btrfs_quota_enable(), after committing the transaction, we change fs_info->quota_root to point to the quota root we created and set BTRFS_FS_QUOTA_ENABLED at fs_info->flags. Then we try to start the qgroup rescan worker, first by initializing it with a call to qgroup_rescan_init() - however if that fails we end up freeing the quota root but we leave fs_info->quota_root still pointing to it, this can later result in a use-after-free somewhere else. We have previously set the flags BTRFS_FS_QUOTA_ENABLED and BTRFS_QGROUP_STATUS_FLAG_ON, so we can only fail with -EINPROGRESS at btrfs_quota_enable(), which is possible if someone already called the quota rescan ioctl, and therefore started the rescan worker. So fix this by ignoring an -EINPROGRESS and asserting we can't get any other error. Reported-by: Ye Bin Link: https://lore.kernel.org/linux-btrfs/20220823015931.421355-1-yebin10@huawei.com/ CC: stable@vger.kernel.org # 4.19+ Reviewed-by: Qu Wenruo Signed-off-by: Filipe Manana Signed-off-by: David Sterba Signed-off-by: Greg Kroah-Hartman --- fs/btrfs/qgroup.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) --- a/fs/btrfs/qgroup.c +++ b/fs/btrfs/qgroup.c @@ -1035,6 +1035,21 @@ out_add_root: fs_info->qgroup_rescan_running = true; btrfs_queue_work(fs_info->qgroup_rescan_workers, &fs_info->qgroup_rescan_work); + } else { + /* + * We have set both BTRFS_FS_QUOTA_ENABLED and + * BTRFS_QGROUP_STATUS_FLAG_ON, so we can only fail with + * -EINPROGRESS. That can happen because someone started the + * rescan worker by calling quota rescan ioctl before we + * attempted to initialize the rescan worker. Failure due to + * quotas disabled in the meanwhile is not possible, because + * we are holding a write lock on fs_info->subvol_sem, which + * is also acquired when disabling quotas. + * Ignore such error, and any other error would need to undo + * everything we did in the transaction we just committed. + */ + ASSERT(ret == -EINPROGRESS); + ret = 0; } out_free_path: From patchwork Mon Oct 24 11:29:35 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8720 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp423510wru; Mon, 24 Oct 2022 05:25:08 -0700 (PDT) X-Google-Smtp-Source: AMsMyM40fPQAuQUWSs74Xn8SwL1YqrWgo/PfECmEx8zfYYi9rF7T0i8gr+pV4xV3d1hePBrM6SsP X-Received: by 2002:a17:906:fe0b:b0:787:f1d3:2105 with SMTP id wy11-20020a170906fe0b00b00787f1d32105mr27314727ejb.83.1666614308407; Mon, 24 Oct 2022 05:25:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666614308; cv=none; d=google.com; s=arc-20160816; b=K/gWCDj2M2RWFORNA9CIoSvVZ0awDQjcZFOxn6gpXZDM7DKmFicWaUJQWjI++iTfSw KKHInXht+j6aE+wx2S3EqZPcqbXaR6TbwmCyz9FLh9qlDJvkVdEAcMNfAAFlXm2O5zf+ 9FdhCMgzFnprzNEQ2iqteUUJ4Pj/sNkdiVK+aOIA+CHaVAaOYtl1MorNX7UW9tbUXoND i1jdUd/cNktyFDtC8xBD9P+UMFXxAyiB9DQ0mbCjfFNtdadIeEjliuZYu3YCQBnBYi70 a7Z4Nj6XuhmWEHkpsEntsKlO8pVGnAURHwdfAQW+h6hnziJs74i3onjCuOOmjKorZ8BL uDFQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=yayZkZ63CJJ1lumb5nhRqdevCm3NFHt6DlcRGMG+6d0=; b=zqnbZEglxAiGn0uFDm+tkPr6AB1z3ZA9Bg5jm/XbNcPiM4mKghF9Qqk9niXK0qHrkp wggI5HuVxEj+B2qP9Uay+g/Yo7HTJyjMA1Tcd4pSq32IH/xhoUotLG3zant14uSNa22y CIwkW2l+jmWH6ETOE3ofqaSAlLhJBJjgOOOEbhkeOFoBIxw0GG2LQ3z8oDyWDSxnVybR EbM4FFgAoq5OnrCpJxdRO3T/mjKqtKzxfmnzk037p51aHs5AdMaTXTEx8uL8toJeltkV Au5a6rHaPMznbqqVez7dXYp0gu6VLqnQSa4LRe/mrJ5TCeJsLT4SJs3lQnjOGE/zxz+Z PfCQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=tg6pVeBZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id xa8-20020a170906fd8800b0079dccbbf0c0si9330003ejb.146.2022.10.24.05.24.43; Mon, 24 Oct 2022 05:25:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=tg6pVeBZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233436AbiJXMXT (ORCPT + 99 others); Mon, 24 Oct 2022 08:23:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40684 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233397AbiJXMVd (ORCPT ); Mon, 24 Oct 2022 08:21:33 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1366A7C1B8; Mon, 24 Oct 2022 04:59:09 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id F132B612F0; Mon, 24 Oct 2022 11:58:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 10B6AC433D7; Mon, 24 Oct 2022 11:58:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612698; bh=TLs3SwpJp5/ZQA5gaztA1mbGtWqcY3sdRIs2FWng1VI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tg6pVeBZ4O/wQPFhs+oZKKfR1PPmiueyahwLXWO4deDOeCYdTPneAjQsu12YjnaZi CHNTP62DCnqs2qyPBOGxPZTBeVSIlZQESZvm7zKpJDjbGLN1RtKVVq5qDfa3vjjFZ3 8VnzhtHPcu4Yj+xDoXnhGj6EIz9foUBYReFmrF/A= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Aurelien Jarno , Alexandre Ghiti , Palmer Dabbelt , Conor Dooley Subject: [PATCH 4.19 056/229] riscv: fix build with binutils 2.38 Date: Mon, 24 Oct 2022 13:29:35 +0200 Message-Id: <20221024113000.891820486@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747571765209578467?= X-GMAIL-MSGID: =?utf-8?q?1747571765209578467?= From: Aurelien Jarno commit 6df2a016c0c8a3d0933ef33dd192ea6606b115e3 upstream. >From version 2.38, binutils default to ISA spec version 20191213. This means that the csr read/write (csrr*/csrw*) instructions and fence.i instruction has separated from the `I` extension, become two standalone extensions: Zicsr and Zifencei. As the kernel uses those instruction, this causes the following build failure: CC arch/riscv/kernel/vdso/vgettimeofday.o <>/arch/riscv/include/asm/vdso/gettimeofday.h: Assembler messages: <>/arch/riscv/include/asm/vdso/gettimeofday.h:71: Error: unrecognized opcode `csrr a5,0xc01' <>/arch/riscv/include/asm/vdso/gettimeofday.h:71: Error: unrecognized opcode `csrr a5,0xc01' <>/arch/riscv/include/asm/vdso/gettimeofday.h:71: Error: unrecognized opcode `csrr a5,0xc01' <>/arch/riscv/include/asm/vdso/gettimeofday.h:71: Error: unrecognized opcode `csrr a5,0xc01' The fix is to specify those extensions explicitely in -march. However as older binutils version do not support this, we first need to detect that. Signed-off-by: Aurelien Jarno Tested-by: Alexandre Ghiti Cc: stable@vger.kernel.org Signed-off-by: Palmer Dabbelt Signed-off-by: Greg Kroah-Hartman [Conor: converted to the 4.19 style of march string generation] Signed-off-by: Conor Dooley --- arch/riscv/Makefile | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) --- a/arch/riscv/Makefile +++ b/arch/riscv/Makefile @@ -49,9 +49,16 @@ ifeq ($(CONFIG_RISCV_ISA_C),y) KBUILD_ARCH_C = c endif -KBUILD_AFLAGS += -march=$(KBUILD_MARCH)$(KBUILD_ARCH_A)fd$(KBUILD_ARCH_C) +# Newer binutils versions default to ISA spec version 20191213 which moves some +# instructions from the I extension to the Zicsr and Zifencei extensions. +toolchain-need-zicsr-zifencei := $(call cc-option-yn, -march=$(riscv-march-y)_zicsr_zifencei) +ifeq ($(toolchain-need-zicsr-zifencei),y) + KBUILD_ARCH_ZISCR_ZIFENCEI = _zicsr_zifencei +endif + +KBUILD_AFLAGS += -march=$(KBUILD_MARCH)$(KBUILD_ARCH_A)fd$(KBUILD_ARCH_C)$(KBUILD_ARCH_ZISCR_ZIFENCEI) -KBUILD_CFLAGS += -march=$(KBUILD_MARCH)$(KBUILD_ARCH_A)$(KBUILD_ARCH_C) +KBUILD_CFLAGS += -march=$(KBUILD_MARCH)$(KBUILD_ARCH_A)$(KBUILD_ARCH_C)$(KBUILD_ARCH_ZISCR_ZIFENCEI) KBUILD_CFLAGS += -mno-save-restore KBUILD_CFLAGS += -DCONFIG_PAGE_OFFSET=$(CONFIG_PAGE_OFFSET) From patchwork Mon Oct 24 11:29:36 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8713 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp423130wru; Mon, 24 Oct 2022 05:24:10 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4HTKzUm9n4jd2YO9kz2g0TcieWjsRpRcwxoluQtihxm7PpkofGm1y1I1f16lcSwxt4Aazb X-Received: by 2002:a05:6a00:450d:b0:562:51ad:7cdf with SMTP id cw13-20020a056a00450d00b0056251ad7cdfmr32944936pfb.54.1666614250133; Mon, 24 Oct 2022 05:24:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666614250; cv=none; d=google.com; s=arc-20160816; b=XN7eSgldJDvU7EZ7ikAFB4tVbFwa7Eu7e5BZmxHoodFcWWrQfT+VFlv65jy7rakol1 0Qrzl1xbRBuMm+QPMozBb1KcZv3p7RMF60TALWG9j0fYAGe5I1sAkX0IRcUbq/Zbos3+ jOfHVzKwhb9efJLrniuZsCbT6XlrZ5Z7v9bKdG+S7epltVfIWdOx9+0BdvfVx31i4gMK 9PA7ucYHctHqMSaJJyC3z/0gvQ5nLsvVuQ6qDMEKcuvUcITS/coLwqo4YwhPWs+vhHaF iYSPpjxc+6zX4+NpBtu22ev130BAzuoLPFXuPEoqivf9URhJZ5V5R++2XfGrZrVUwEII wAjw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=kpYHaUuqvI2YUJGcHswZBPY+osAcTf9K2CkjYsg6TQM=; b=b3uKVwU/S4f0HRPT9SCPY7q0bNCJWE/Laz9yTg2p0XwKzSHXikRwwoSxr/HFFdH1AJ IW2u0vA12SlkOEZyCd0KzuThUWZ9KbEIuGv3xD7BUp46/m5QBhHd71r3iu/8N3iQCenA kgOpfKl1sR1VhSiIPtXtBQ1KS8Rga/QiWtbx3f2dHh6JDSDSLryQQY5ivW99nrwDMaB2 P5njlvWyt8d2SF96ciEONv1fqe/ufJ80FtSrTkevepmwtcc2gAhWfGUWt9aaklgIWii0 PuGhx9DL2Hz5JfQ+8hu0G+1k5uYrwtISiLwZdhDHeHzzmZJ4GgPxi/yrq8mG7sN37F1P 54Dw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=0BXq945c; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n5-20020a170902e54500b00186a397324asi4897953plf.373.2022.10.24.05.23.56; Mon, 24 Oct 2022 05:24:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=0BXq945c; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233300AbiJXMXG (ORCPT + 99 others); Mon, 24 Oct 2022 08:23:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40658 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233360AbiJXMVD (ORCPT ); Mon, 24 Oct 2022 08:21:03 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 430C776444; Mon, 24 Oct 2022 04:59:11 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 902C0612E3; Mon, 24 Oct 2022 11:58:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A5A99C433C1; Mon, 24 Oct 2022 11:58:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612701; bh=nThvYlMCokv6gXc3/lKR2WMS3hubHiyAx5INGUND/qw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0BXq945cxcZO5UNQZAwFUe//L1At9wNF5iuHsie45G0MijMa9A2MFLfXGDXN7kvbp a2WqIMaDvNdTPtFxXx3+dv1ch7PkTzkaL7MLa/ep9sNJG9xi55YfEIS8JBZBUgjQZE 35D8WwlWlfY2WQY5tKCFmDMeQeF7v33CEVaJSWDI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ryusuke Konishi , syzbot+b8c672b0e22615c80fe0@syzkaller.appspotmail.com, Khalid Masum , Andrew Morton Subject: [PATCH 4.19 057/229] nilfs2: fix use-after-free bug of struct nilfs_root Date: Mon, 24 Oct 2022 13:29:36 +0200 Message-Id: <20221024113000.930887573@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747571704013447573?= X-GMAIL-MSGID: =?utf-8?q?1747571704013447573?= From: Ryusuke Konishi commit d325dc6eb763c10f591c239550b8c7e5466a5d09 upstream. If the beginning of the inode bitmap area is corrupted on disk, an inode with the same inode number as the root inode can be allocated and fail soon after. In this case, the subsequent call to nilfs_clear_inode() on that bogus root inode will wrongly decrement the reference counter of struct nilfs_root, and this will erroneously free struct nilfs_root, causing kernel oopses. This fixes the problem by changing nilfs_new_inode() to skip reserved inode numbers while repairing the inode bitmap. Link: https://lkml.kernel.org/r/20221003150519.39789-1-konishi.ryusuke@gmail.com Signed-off-by: Ryusuke Konishi Reported-by: syzbot+b8c672b0e22615c80fe0@syzkaller.appspotmail.com Reported-by: Khalid Masum Tested-by: Ryusuke Konishi Cc: Signed-off-by: Andrew Morton Signed-off-by: Greg Kroah-Hartman --- fs/nilfs2/inode.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) --- a/fs/nilfs2/inode.c +++ b/fs/nilfs2/inode.c @@ -340,6 +340,7 @@ struct inode *nilfs_new_inode(struct ino struct inode *inode; struct nilfs_inode_info *ii; struct nilfs_root *root; + struct buffer_head *bh; int err = -ENOMEM; ino_t ino; @@ -355,11 +356,26 @@ struct inode *nilfs_new_inode(struct ino ii->i_state = BIT(NILFS_I_NEW); ii->i_root = root; - err = nilfs_ifile_create_inode(root->ifile, &ino, &ii->i_bh); + err = nilfs_ifile_create_inode(root->ifile, &ino, &bh); if (unlikely(err)) goto failed_ifile_create_inode; /* reference count of i_bh inherits from nilfs_mdt_read_block() */ + if (unlikely(ino < NILFS_USER_INO)) { + nilfs_msg(sb, KERN_WARNING, + "inode bitmap is inconsistent for reserved inodes"); + do { + brelse(bh); + err = nilfs_ifile_create_inode(root->ifile, &ino, &bh); + if (unlikely(err)) + goto failed_ifile_create_inode; + } while (ino < NILFS_USER_INO); + + nilfs_msg(sb, KERN_INFO, + "repaired inode bitmap for reserved inodes"); + } + ii->i_bh = bh; + atomic64_inc(&root->inodes_count); inode_init_owner(inode, dir, mode); inode->i_ino = ino; From patchwork Mon Oct 24 11:29:37 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8719 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp423506wru; Mon, 24 Oct 2022 05:25:08 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4ksmSSsCM4Fs6XvWV5+Ux+tmDxWWzPmvTSfpwtnQFGDVIKTRZXWZRZITzvcXF1YW01CERa X-Received: by 2002:a17:906:58c5:b0:7a1:8e13:c071 with SMTP id e5-20020a17090658c500b007a18e13c071mr9208758ejs.671.1666614307827; Mon, 24 Oct 2022 05:25:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666614307; cv=none; d=google.com; s=arc-20160816; b=lHAvcJlF0utFrZDJB9MD8HdXe9MtccVFwXtf5vc5pZQ8sz/NoX7r+iS9OgYnqwXFoD cwsrGfvH5+MFjV2MmPS5jj7rlnLYAUn0ITDKEUbD9MKx3DL2uyP5xkOt7YCxQ7UZyGUo qscSuhl1/MI0m3fP4hO8uuEnCfVXvPjbxCVvsDU2x7tj5pZ/rP1RmjvFZB/mu6ZA2ul1 iIruWdFuWdFsCN++3xteRZNc7cAqOkbDs442l7yp7CeaS60yojo/pTq3Rf9JFBaOGbzZ gj4KrBkoDEUx5o7QwTTiUnaVcw5JI3ezYwqQk9+WPSeof0mdUrJ8V+julxdGBG2BhDOR nKWw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=WIcfHKIOn3mmTDNuqgTM4/6EDMwCpcXFoaJOSe8Tr44=; b=DhpjnIv5ZbY9A1DGmAwgWjvNGMomDd+1GBvypWfFo/bONoN9ly8wD9Fqhi0c8pnB46 w9n8mR1hpKTY6SUb0tHC8V/3VLjY9noRi5DW0De3xyIoUM77HFkghicbsqlI+RicTTZb n0Kaj+CBjDF4tEG5BGWXRE2NIhZ67a5R5OqS2lrlk6+mfEK4rBiWAVV4aNeXPmLxpdmZ F59vAHY0hVXbA8pvk2vGgIWJnbEuld/LmSusOPyikrsTXtONQ5xwEXw6GT6aWlm85dwi UBRjMYUAgIQL/5ZHLd1a2hIqhk87XPIG3dAKvZa8u77ePf3ogJqtDflWY/g7lxl0ERRQ X5Nw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=GgslSI61; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u8-20020a056402064800b00458cdba7a90si23441472edx.471.2022.10.24.05.24.43; Mon, 24 Oct 2022 05:25:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=GgslSI61; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233408AbiJXMXP (ORCPT + 99 others); Mon, 24 Oct 2022 08:23:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40674 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233379AbiJXMVX (ORCPT ); Mon, 24 Oct 2022 08:21:23 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 752DD7C1C2; Mon, 24 Oct 2022 04:59:14 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 4805C6129D; Mon, 24 Oct 2022 11:58:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 56FDBC433C1; Mon, 24 Oct 2022 11:58:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612703; bh=SHrIBPADbDxNOqMn8ECyzs/m+km99o1nTQ+oA5ePm1w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GgslSI61mt35a2ma8ieACoSuMQjaYBrlriFw4Fj6/IBQ9JiGrua7MLgqeBwALo+vV j40Okkeugx5HFZp6kBHapsIUE8uflb/VEf1CDqQKVB2KliFxmfowuLOMkk5Ihr+ZWD LeTHJqtIBmCRWqit7NGURiEdMtqDliuC7aBNmYx8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, stable@kernel.org, Tadeusz Struk , syzbot+bd13648a53ed6933ca49@syzkaller.appspotmail.com, Jan Kara , Lukas Czerner , Theodore Tso Subject: [PATCH 4.19 058/229] ext4: avoid crash when inline data creation follows DIO write Date: Mon, 24 Oct 2022 13:29:37 +0200 Message-Id: <20221024113000.959206511@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747571764405307679?= X-GMAIL-MSGID: =?utf-8?q?1747571764405307679?= From: Jan Kara commit 4bb26f2885ac6930984ee451b952c5a6042f2c0e upstream. When inode is created and written to using direct IO, there is nothing to clear the EXT4_STATE_MAY_INLINE_DATA flag. Thus when inode gets truncated later to say 1 byte and written using normal write, we will try to store the data as inline data. This confuses the code later because the inode now has both normal block and inline data allocated and the confusion manifests for example as: kernel BUG at fs/ext4/inode.c:2721! invalid opcode: 0000 [#1] PREEMPT SMP KASAN CPU: 0 PID: 359 Comm: repro Not tainted 5.19.0-rc8-00001-g31ba1e3b8305-dirty #15 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.16.0-1.fc36 04/01/2014 RIP: 0010:ext4_writepages+0x363d/0x3660 RSP: 0018:ffffc90000ccf260 EFLAGS: 00010293 RAX: ffffffff81e1abcd RBX: 0000008000000000 RCX: ffff88810842a180 RDX: 0000000000000000 RSI: 0000008000000000 RDI: 0000000000000000 RBP: ffffc90000ccf650 R08: ffffffff81e17d58 R09: ffffed10222c680b R10: dfffe910222c680c R11: 1ffff110222c680a R12: ffff888111634128 R13: ffffc90000ccf880 R14: 0000008410000000 R15: 0000000000000001 FS: 00007f72635d2640(0000) GS:ffff88811b000000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 0000565243379180 CR3: 000000010aa74000 CR4: 0000000000150eb0 Call Trace: do_writepages+0x397/0x640 filemap_fdatawrite_wbc+0x151/0x1b0 file_write_and_wait_range+0x1c9/0x2b0 ext4_sync_file+0x19e/0xa00 vfs_fsync_range+0x17b/0x190 ext4_buffered_write_iter+0x488/0x530 ext4_file_write_iter+0x449/0x1b90 vfs_write+0xbcd/0xf40 ksys_write+0x198/0x2c0 __x64_sys_write+0x7b/0x90 do_syscall_64+0x3d/0x90 entry_SYSCALL_64_after_hwframe+0x63/0xcd Fix the problem by clearing EXT4_STATE_MAY_INLINE_DATA when we are doing direct IO write to a file. Cc: stable@kernel.org Reported-by: Tadeusz Struk Reported-by: syzbot+bd13648a53ed6933ca49@syzkaller.appspotmail.com Link: https://syzkaller.appspot.com/bug?id=a1e89d09bbbcbd5c4cb45db230ee28c822953984 Signed-off-by: Jan Kara Reviewed-by: Lukas Czerner Tested-by: Tadeusz Struk Link: https://lore.kernel.org/r/20220727155753.13969-1-jack@suse.cz Signed-off-by: Theodore Ts'o Signed-off-by: Greg Kroah-Hartman --- fs/ext4/file.c | 6 ++++++ 1 file changed, 6 insertions(+) --- a/fs/ext4/file.c +++ b/fs/ext4/file.c @@ -501,6 +501,12 @@ loff_t ext4_llseek(struct file *file, lo inode_unlock_shared(inode); break; } + /* + * Make sure inline data cannot be created anymore since we are going + * to allocate blocks for DIO. We know the inode does not have any + * inline data now because ext4_dio_supported() checked for that. + */ + ext4_clear_inode_state(inode, EXT4_STATE_MAY_INLINE_DATA); if (offset < 0) return offset; From patchwork Mon Oct 24 11:29:38 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8679 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp422292wru; Mon, 24 Oct 2022 05:22:18 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4tb+ku/39WtiiKJY4GrE3X42Vsqt/u47aH8wlTOKlcS55R4xF4qzYYUQD78Kywqe7B314j X-Received: by 2002:a17:907:dac:b0:78e:17a0:d1cb with SMTP id go44-20020a1709070dac00b0078e17a0d1cbmr27631042ejc.618.1666614138386; Mon, 24 Oct 2022 05:22:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666614138; cv=none; d=google.com; s=arc-20160816; b=f5HXQa+jSs+/SaS1DtyCyh3cotmXYthEVHi6+QwBDCvn6p1ljM21nLW1JmlUqdOVUd fm3CIj6bcICJ3Lbooi/Bqog3d1ZhpY+7oLHWBq2ws+ekbZZMSu54dEHg4WqXp0xc+TQT 2N0nVBL0Rzk+UfEqwY7Q7XQakldaFIkedRAjSLudsNPsLLfqLL2eGZY1m6kXFx9W7MVx C3r8GwuSCClFHiT+A4DLpB5eWl4uBcBNZ2spikKXp69969wF8c+EXF/YoXW5aoVk7fSh 0U7gWPZu5ohxOvHwzlDANYShWcrnPdfnhP/qVNKoCpeSjd+CLBqHbs4ftuthQ2D7vvr1 Lqqw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=EURmE7Jt8EFxoL5a72GyLyPsGn9krOzI85LjGPzJs8M=; b=GsYkCx/byP9GFDQLvtZPnWPjz9vh5hTnm8ifzzV4dn/2o6bxL4u7WBhteUrVuVIOSr U8SNC2HfDA6LwtZB0b8IRoYKWfQ4csQxS/mMYL3VdgaJ+AVlfO2rYMKWKjLilRZ/4CFT bJYZQ//LUDaKJ+7Dlhc04Kk4A7gtc/7SSvZ0xXVq2pFcTVKDI8NxEghPeJb/qMIXYSU9 98Pe9Sbz89nqn/20Z6QzcgPibUuLmtNoygHhkYfRRohQc4C/9LLjLRXKoRZV9wd1i+q2 NuyPDjOxIjquwygwUTdBCi40jTCatM3WSwmNvIlw9jrLMsvbeAGNmzMoQed2aetNUZgk Rj8Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=YMQHgf8C; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id mp36-20020a1709071b2400b0078e2828052asi28908833ejc.638.2022.10.24.05.21.53; Mon, 24 Oct 2022 05:22:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=YMQHgf8C; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233195AbiJXMUN (ORCPT + 99 others); Mon, 24 Oct 2022 08:20:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50692 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233277AbiJXMTF (ORCPT ); Mon, 24 Oct 2022 08:19:05 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6CF80816B8; Mon, 24 Oct 2022 04:57:33 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 219B0612D2; Mon, 24 Oct 2022 11:57:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 34518C433D6; Mon, 24 Oct 2022 11:57:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612627; bh=anviEcYHuKsLQZfCwdgo3hZTRU8BjjWQ5XXrx9ZPAn8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YMQHgf8C/Qupb4xXVdiRdV2QDx6GXF2OQyBEJmpXgfqjfQPHtVU+hkvDwkD92o1t4 gjw3T3EoTEWUmrV6bUQaLJU03+q3/+hyMRXmumZqoTxH8bp1ghvYrD3NYB/DFZTTu0 X643Sahl119KA6QQGEQXO8seO/2hsYkZ/WchCFBo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, stable@kernel.org, Baokun Li , Jan Kara , Theodore Tso Subject: [PATCH 4.19 059/229] ext4: fix null-ptr-deref in ext4_write_info Date: Mon, 24 Oct 2022 13:29:38 +0200 Message-Id: <20221024113000.998337697@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747571587266999398?= X-GMAIL-MSGID: =?utf-8?q?1747571587266999398?= From: Baokun Li commit f9c1f248607d5546075d3f731e7607d5571f2b60 upstream. I caught a null-ptr-deref bug as follows: ================================================================== KASAN: null-ptr-deref in range [0x0000000000000068-0x000000000000006f] CPU: 1 PID: 1589 Comm: umount Not tainted 5.10.0-02219-dirty #339 RIP: 0010:ext4_write_info+0x53/0x1b0 [...] Call Trace: dquot_writeback_dquots+0x341/0x9a0 ext4_sync_fs+0x19e/0x800 __sync_filesystem+0x83/0x100 sync_filesystem+0x89/0xf0 generic_shutdown_super+0x79/0x3e0 kill_block_super+0xa1/0x110 deactivate_locked_super+0xac/0x130 deactivate_super+0xb6/0xd0 cleanup_mnt+0x289/0x400 __cleanup_mnt+0x16/0x20 task_work_run+0x11c/0x1c0 exit_to_user_mode_prepare+0x203/0x210 syscall_exit_to_user_mode+0x5b/0x3a0 do_syscall_64+0x59/0x70 entry_SYSCALL_64_after_hwframe+0x44/0xa9 ================================================================== Above issue may happen as follows: ------------------------------------- exit_to_user_mode_prepare task_work_run __cleanup_mnt cleanup_mnt deactivate_super deactivate_locked_super kill_block_super generic_shutdown_super shrink_dcache_for_umount dentry = sb->s_root sb->s_root = NULL <--- Here set NULL sync_filesystem __sync_filesystem sb->s_op->sync_fs > ext4_sync_fs dquot_writeback_dquots sb->dq_op->write_info > ext4_write_info ext4_journal_start(d_inode(sb->s_root), EXT4_HT_QUOTA, 2) d_inode(sb->s_root) s_root->d_inode <--- Null pointer dereference To solve this problem, we use ext4_journal_start_sb directly to avoid s_root being used. Cc: stable@kernel.org Signed-off-by: Baokun Li Reviewed-by: Jan Kara Link: https://lore.kernel.org/r/20220805123947.565152-1-libaokun1@huawei.com Signed-off-by: Theodore Ts'o Signed-off-by: Greg Kroah-Hartman --- fs/ext4/super.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/fs/ext4/super.c +++ b/fs/ext4/super.c @@ -5721,7 +5721,7 @@ static int ext4_write_info(struct super_ handle_t *handle; /* Data block + inode block */ - handle = ext4_journal_start(d_inode(sb->s_root), EXT4_HT_QUOTA, 2); + handle = ext4_journal_start_sb(sb, EXT4_HT_QUOTA, 2); if (IS_ERR(handle)) return PTR_ERR(handle); ret = dquot_commit_info(sb, type); From patchwork Mon Oct 24 11:29:39 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8762 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp430354wru; Mon, 24 Oct 2022 05:41:18 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5SP96dJWc7FgTTNq3Fyg/QMnJioVZT0T6wFbHn+s2dDgDZRiEVQvWLRA38+nOGOfwLt/kH X-Received: by 2002:a17:90a:ab90:b0:210:27cb:e337 with SMTP id n16-20020a17090aab9000b0021027cbe337mr30247798pjq.139.1666615278490; Mon, 24 Oct 2022 05:41:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666615278; cv=none; d=google.com; s=arc-20160816; b=JF/SqKkNK+AQYHZ4EQ5kaW+lzcTVEoOwxYSDgmtgH9HNC/acrk3spatsRIYSUC9fpp 8YJR8h1uBPZylWJlH0Zp07BU1F/7eLAG7Lk0MtUjKFiA1Iqu6xxLoT5P5aQY/KmLmRqU xtxnv2HSzvCn8R0BUO8/5cjuoc/kVAj3haau5ONM7tqPN1gXIf9cDUQe8aUd1rUSL98s uG1Fs4hLr3z34h2iRlrrUS9ZO8L5UCnzBrf0xfteMtpDqn51eCUurBLfGKVbenGMu6m5 BTeZOJMnG37Od5IJSQvVPPlMvwWQ1f3AhFs+3yqR6mTLCzix5dhwzy5jFJBbGwJsE/4f UIYw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=WuzPbOZyd4kyCiaHkunfX0Lz4u+bRwvrBg7fKSHuL6A=; b=qdZ1GPA3YaBEIG3rTnxTJ+/P/XF1B2PzjhHIl06wl0KAIFR60iH5CH7mhUad5ZFu+d e4okOTCzYgW95+GjuWAF8UT8Zg4dFOJUgAJXg3HQY/RBMTEEPz1QP0tCSMm0FflktNX6 uAm3FCGUbbIlnRE6+6VScbbCVoo8UI9T1LbtFHpr6VkLQzcsuQnLkw8g8Kc6FC002e/z 2Gr7u0PXMr6sp7Cobio5HUjON0PS3OcwstX8pNxCKu8oGabie4ymaoksi/PbKuLSItMi /7Wvm2WLaJSrcQbSYrXygPd3kjakif2HE8ZdZ8z/h5sS1GPu+ZuAT4vMNZgoiZ5xkaxw P/VQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=n1iVg+5S; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c3-20020a056a00248300b00536bbfa4994si34165949pfv.345.2022.10.24.05.41.04; Mon, 24 Oct 2022 05:41:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=n1iVg+5S; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231611AbiJXM2n (ORCPT + 99 others); Mon, 24 Oct 2022 08:28:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60588 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233668AbiJXM1N (ORCPT ); Mon, 24 Oct 2022 08:27:13 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E316386809; Mon, 24 Oct 2022 05:01:38 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 74EE6B81186; Mon, 24 Oct 2022 11:57:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D1AD0C433D6; Mon, 24 Oct 2022 11:57:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612630; bh=vu9eNoLHiHjtM5lf+Zi1lWs4QGZZCvb2o0ZwjBsrQh4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=n1iVg+5SxRa4jPT9KVHB9AXw7Ae8nUYv0lO8bh71kZOA8qzKiNSHJaEbxwb297ywI t1tYSZiDGiGlmN6NbPs1UW370T8NoSBeEj9g338KJ97Ghlz+ZKGqo+IYMXo6Ka9QMy 9h4AMFhiH/S4qUbOCIMCdOJ4jiO4d9241fU/44iY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, stable@kernel.org, Lalith Rajendran , Theodore Tso Subject: [PATCH 4.19 060/229] ext4: make ext4_lazyinit_thread freezable Date: Mon, 24 Oct 2022 13:29:39 +0200 Message-Id: <20221024113001.027446839@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747572782129371097?= X-GMAIL-MSGID: =?utf-8?q?1747572782129371097?= From: Lalith Rajendran commit 3b575495ab8dbb4dbe85b4ac7f991693c3668ff5 upstream. ext4_lazyinit_thread is not set freezable. Hence when the thread calls try_to_freeze it doesn't freeze during suspend and continues to send requests to the storage during suspend, resulting in suspend failures. Cc: stable@kernel.org Signed-off-by: Lalith Rajendran Link: https://lore.kernel.org/r/20220818214049.1519544-1-lalithkraj@google.com Signed-off-by: Theodore Ts'o Signed-off-by: Greg Kroah-Hartman --- fs/ext4/super.c | 1 + 1 file changed, 1 insertion(+) --- a/fs/ext4/super.c +++ b/fs/ext4/super.c @@ -3112,6 +3112,7 @@ static int ext4_lazyinit_thread(void *ar unsigned long next_wakeup, cur; BUG_ON(NULL == eli); + set_freezable(); cont_thread: while (true) { From patchwork Mon Oct 24 11:29:40 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9986 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp615372wru; Mon, 24 Oct 2022 12:26:11 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7qBcmqnEc/OqUbnGzBUtnMjent3YGVDV/sAs/GaRSjhCb9qrVWwIklLgycyIqwHZ3E+bzv X-Received: by 2002:a17:907:1c8a:b0:782:1a0d:3373 with SMTP id nb10-20020a1709071c8a00b007821a0d3373mr28037000ejc.135.1666639571478; Mon, 24 Oct 2022 12:26:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666639571; cv=none; d=google.com; s=arc-20160816; b=pkZ6ywP4XvpEoIwbS4+ph0+6GI/4ILFoXYQ/huxns5YjzOs1pUg2FuP3qqzWveRfe0 MzokYDGCz7Vhig0CCEhgeslDyWthhzSns/9/dKJ4s0IXo23WZcgRPzs2eAyJnB0lx4zt UvJD8GrFkWWg0hdrxzWPgG9KEKwgRtuibZtNjXqbWm/IT465kj3VWDoDS9MZagx76NsS 8tKrZsxskoLSkkr6Xa7Diztzo2EH2IR8PWymyYTo2sdAachYGwQbktws9UHe7fNq64vf LBYH9MJhl1a68T8Qd2KBoQunra+Axzk73HT1MmVwLXOwAS46GHt02Jey4miDbDyeVGMm IMNg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=ukZAfBERIKz4ShL7Y82aqkeal6obOiarLWqtirSqIR4=; b=oOcAytVnFdtkiTM81VFODaR+SnKSWov8NlI5faG63sTBIN2FEAc9S4mFsjB5Z3kKTP MsuR4Y4EKBnhgCsJVMd7R2br5NEhuhHZ25cPTy29o7gCli2xzCU2T8sR9+Zz7RBkoGJu MKgRZ1rDi0T3PXQr+UbsQTo510rJ9bm86TBIvdOgzq+bxfN+oMB7/IIjICKLqPuuzbXW ssCmS0IUlDn2o7iYdiLk4XIyPqwEF9m2/vTQYa7oq/roA727855ssWItFaRO5eSjPNSd TQtPFrSnTj0R4knzyOWa+5FAKrxE/yxbY17u9bcW7DtgboYiIxWZ+3URf9yxE6X7DdVp WcaA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Jxy90stt; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id qo14-20020a170907874e00b007aa5e6c4b5asi644690ejc.128.2022.10.24.12.25.45; Mon, 24 Oct 2022 12:26:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Jxy90stt; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232646AbiJXTXp (ORCPT + 99 others); Mon, 24 Oct 2022 15:23:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45326 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230455AbiJXTV6 (ORCPT ); Mon, 24 Oct 2022 15:21:58 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9A5D88B2C9; Mon, 24 Oct 2022 10:57:31 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 19689B811ED; Mon, 24 Oct 2022 11:57:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 70C24C433D6; Mon, 24 Oct 2022 11:57:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612632; bh=EDhmVUVppYFRsGfyqQAfN/KBj1aMj8UYArzRWZSF73E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Jxy90sttFJfv4lksn8gFsrqz2+CEKnZN1v6Cl5VklklnArvn87hDU5TJckuXjHhV9 I/4GfsjXq7U72dFiKkCZzbxczCkMSbYZPO11LRF2x4W1eEHXCVQNh+s9RBhbSAtko9 ocSmTttTYYRFwCLKtwmuWeoUHF53+yIEEDm3wY/w= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, stable@kernel.org, Jinke Han , Theodore Tso Subject: [PATCH 4.19 061/229] ext4: place buffer head allocation before handle start Date: Mon, 24 Oct 2022 13:29:40 +0200 Message-Id: <20221024113001.057389294@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747598255746885335?= X-GMAIL-MSGID: =?utf-8?q?1747598255746885335?= From: Jinke Han commit d1052d236eddf6aa851434db1897b942e8db9921 upstream. In our product environment, we encounter some jbd hung waiting handles to stop while several writters were doing memory reclaim for buffer head allocation in delay alloc write path. Ext4 do buffer head allocation with holding transaction handle which may be blocked too long if the reclaim works not so smooth. According to our bcc trace, the reclaim time in buffer head allocation can reach 258s and the jbd transaction commit also take almost the same time meanwhile. Except for these extreme cases, we often see several seconds delays for cgroup memory reclaim on our servers. This is more likely to happen considering docker environment. One thing to note, the allocation of buffer heads is as often as page allocation or more often when blocksize less than page size. Just like page cache allocation, we should also place the buffer head allocation before startting the handle. Cc: stable@kernel.org Signed-off-by: Jinke Han Link: https://lore.kernel.org/r/20220903012429.22555-1-hanjinke.666@bytedance.com Signed-off-by: Theodore Ts'o Signed-off-by: Greg Kroah-Hartman --- fs/ext4/inode.c | 7 +++++++ 1 file changed, 7 insertions(+) --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c @@ -1310,6 +1310,13 @@ retry_grab: page = grab_cache_page_write_begin(mapping, index, flags); if (!page) return -ENOMEM; + /* + * The same as page allocation, we prealloc buffer heads before + * starting the handle. + */ + if (!page_has_buffers(page)) + create_empty_buffers(page, inode->i_sb->s_blocksize, 0); + unlock_page(page); retry_journal: From patchwork Mon Oct 24 11:29:41 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8765 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp430398wru; Mon, 24 Oct 2022 05:41:26 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6g19euwsbsdhG1CGk+gYLlU9FEYANIu+i/S96gRX2PoxV9fsiSrmxXJh8zK0lb5pJVuPwE X-Received: by 2002:a17:907:a042:b0:7a0:3323:2883 with SMTP id gz2-20020a170907a04200b007a033232883mr11182712ejc.37.1666615286158; Mon, 24 Oct 2022 05:41:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666615286; cv=none; d=google.com; s=arc-20160816; b=A80KiJuQ02uHyngh076WuNRDwlAz4fx1fzpWQbXvoyG6/VDBdxjIcKWfjk9oUmrhKe bsacjOM6YoR2QKHEbzV8aHpItkYSLQE+eazQwle3VEXj8AfVAqyqxCxa52WNKmHb/5Cq M37bcooFT0zFEba8l7V/jaztAS9Ab3NFQBsPU1hgd3bhvRj9JsPplabLkswqHXhWBUL6 Ab4U/Q9dmviDvwDGjkaE6T/jOmc7kjFQ0DuS88KvJ+cGNFgbLlefTrgESos51z8kL2wA MgtrJf6Dn04vnXy5cWJtxmxtBVX1YwnqnpuwktMfBapVPGXylqkV99RQWMj8L3Bgm7Ej VXDQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=WjYu/qj3SHo5TEhVA6nx3g98ala4gKfbtrsFROwNt1o=; b=gJqRnIxiJQY6yXW+PyiAtODXrnFNYGDGSFCXebuEzd1M3PPz6XpG8Qtw6y/BjwPxqf gI0CE65igRKOHhKRJnxEGxsBzX/5mDmFEyAgg/1OF2o2X1ZgUvNG/KBTNIy8MusOapQD +RPDwoBVCUPHiAhz+J98T6G9VHPHx+xozeo3VEVA4y5FHHO9137tFiH+hMdzZ85lNBOB AGWtQb00tCNOCh3RNN4md06RzE0ibR6Y+ZFK9ZAavISph4qUEfKgiMYJ+hVzJrm/4q1N zaNFczveDi7iPLB0TV2145FP+sBvFUJgN7CIzbLV23QGrLz1ewWercwxHdfTjcp/3ZB+ v5RQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="Evv2zQ/k"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y26-20020aa7d51a000000b00461a7962c26si3483209edq.527.2022.10.24.05.41.00; Mon, 24 Oct 2022 05:41:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="Evv2zQ/k"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233741AbiJXM2y (ORCPT + 99 others); Mon, 24 Oct 2022 08:28:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57948 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233719AbiJXM1t (ORCPT ); Mon, 24 Oct 2022 08:27:49 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C2C3886803; Mon, 24 Oct 2022 05:01:40 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id B81E1B811EF; Mon, 24 Oct 2022 11:57:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 12EA7C433C1; Mon, 24 Oct 2022 11:57:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612635; bh=Krt+Xlxa8gyzGMZVPSaqFF395LKyxhWwJdymKAbkvjA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Evv2zQ/knYl47KuNTrqnJ44UiLUQjTGUtEhjJfDcEV/5D2mHFDMOw+xcLKxfjKSkS qYF/3Bdk88cWpiTmNeCjJrdBNMzWWEZOFvBlNyD+rLVdRBJvpax+6jNTVAMnMbDX1w hfM36JsuzCXUKxTgvcAsPqjq82bSOn1oLJKSZ6s4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Rik van Riel , Breno Leitao , Petr Mladek , Josh Poimboeuf , stable@kernel.org Subject: [PATCH 4.19 062/229] livepatch: fix race between fork and KLP transition Date: Mon, 24 Oct 2022 13:29:41 +0200 Message-Id: <20221024113001.087187890@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747572789959710723?= X-GMAIL-MSGID: =?utf-8?q?1747572789959710723?= From: Rik van Riel commit 747f7a2901174c9afa805dddfb7b24db6f65e985 upstream. The KLP transition code depends on the TIF_PATCH_PENDING and the task->patch_state to stay in sync. On a normal (forward) transition, TIF_PATCH_PENDING will be set on every task in the system, while on a reverse transition (after a failed forward one) first TIF_PATCH_PENDING will be cleared from every task, followed by it being set on tasks that need to be transitioned back to the original code. However, the fork code copies over the TIF_PATCH_PENDING flag from the parent to the child early on, in dup_task_struct and setup_thread_stack. Much later, klp_copy_process will set child->patch_state to match that of the parent. However, the parent's patch_state may have been changed by KLP loading or unloading since it was initially copied over into the child. This results in the KLP code occasionally hitting this warning in klp_complete_transition: for_each_process_thread(g, task) { WARN_ON_ONCE(test_tsk_thread_flag(task, TIF_PATCH_PENDING)); task->patch_state = KLP_UNDEFINED; } Set, or clear, the TIF_PATCH_PENDING flag in the child task depending on whether or not it is needed at the time klp_copy_process is called, at a point in copy_process where the tasklist_lock is held exclusively, preventing races with the KLP code. The KLP code does have a few places where the state is changed without the tasklist_lock held, but those should not cause problems because klp_update_patch_state(current) cannot be called while the current task is in the middle of fork, klp_check_and_switch_task() which is called under the pi_lock, which prevents rescheduling, and manipulation of the patch state of idle tasks, which do not fork. This should prevent this warning from triggering again in the future, and close the race for both normal and reverse transitions. Signed-off-by: Rik van Riel Reported-by: Breno Leitao Reviewed-by: Petr Mladek Acked-by: Josh Poimboeuf Fixes: d83a7cb375ee ("livepatch: change to a per-task consistency model") Cc: stable@kernel.org Signed-off-by: Petr Mladek Link: https://lore.kernel.org/r/20220808150019.03d6a67b@imladris.surriel.com Signed-off-by: Greg Kroah-Hartman --- kernel/livepatch/transition.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) --- a/kernel/livepatch/transition.c +++ b/kernel/livepatch/transition.c @@ -563,9 +563,23 @@ void klp_reverse_transition(void) /* Called from copy_process() during fork */ void klp_copy_process(struct task_struct *child) { - child->patch_state = current->patch_state; - /* TIF_PATCH_PENDING gets copied in setup_thread_stack() */ + /* + * The parent process may have gone through a KLP transition since + * the thread flag was copied in setup_thread_stack earlier. Bring + * the task flag up to date with the parent here. + * + * The operation is serialized against all klp_*_transition() + * operations by the tasklist_lock. The only exception is + * klp_update_patch_state(current), but we cannot race with + * that because we are current. + */ + if (test_tsk_thread_flag(current, TIF_PATCH_PENDING)) + set_tsk_thread_flag(child, TIF_PATCH_PENDING); + else + clear_tsk_thread_flag(child, TIF_PATCH_PENDING); + + child->patch_state = current->patch_state; } /* From patchwork Mon Oct 24 11:29:42 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8886 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp433629wru; Mon, 24 Oct 2022 05:50:04 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6tkZ56Ui9IjSpu2DYFhcSj4vxkPpS0lbUUNLIriqE7tAySUM7qK/Jl4bC4rv6mYDmJCG4l X-Received: by 2002:a17:90b:2803:b0:210:3b5e:62eb with SMTP id qb3-20020a17090b280300b002103b5e62ebmr30069167pjb.95.1666615793318; Mon, 24 Oct 2022 05:49:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666615793; cv=none; d=google.com; s=arc-20160816; b=OqtAv+Hwrf+R9RP3R3ltm3sek9eCC43j0nVp4ItUPqyf13DyYWI0f48fZFtrzEWubs YnoplkJhFliMZSs8tl+tWVUckW4PxqOv9cqs00NE2NFmw/8YDmL0qo4erPm26hLwFD7W zvi9ob5uTy+SssqA7YoaImD1ocoQKGGDGx0miamsNn4+aC5TktUY/vUjTM0rajHYosmr d0swVfUw2JN/UTk0+eQgvLYv4uELxR6vYdzFNfzIcJ6h56+qEWglGCxHqiMw9C1K6dd0 v33gNTGMq+5LIw/z83G+vpMZoie0mpngZgy2AQtpiWQVHfFTwSkh95ODpnGkMRTjVneC 9qCw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=aZO250IL3GugcFCOwt4U++tedHsS1gXCyMr/wJvHSsQ=; b=aomNuzR18emCqqnQhB2TjODQHVxXrupk+fKc1OIuO5V2SKGDjHLt4bbQoQo5ijHRx/ hRNHC1k/ukyFpA7B0wRHYXTazf2JaXx89Q4AAJ1gbR+oEyfWcDkefWvSFBau7YYlqSd/ YFFDPNlL4BGFJAQy+RAXW+cSc9vv5Yur7jpXmqUAt8dcl4u1zhtwqgMC22kZqPVsZr/A H2+hPbFi06I//dfbjcV6NsQGj2cDPTmHJFdllw2sMA2boMV+ygMwRaLLzIQoJytFQ3gx coEBfZpYhqprHiHzwMZvSjx3/IZXw1E7KmNQUMn6Uax2MVKnRBN/3usOvB/R7JXuIjoH PHJw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=OYvpH4X9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u5-20020a170903124500b0018542a1b588si38767672plh.196.2022.10.24.05.49.39; Mon, 24 Oct 2022 05:49:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=OYvpH4X9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232069AbiJXMrn (ORCPT + 99 others); Mon, 24 Oct 2022 08:47:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37762 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234166AbiJXMmH (ORCPT ); Mon, 24 Oct 2022 08:42:07 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5312C7EFEF; Mon, 24 Oct 2022 05:08:49 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 9B7E9612DF; Mon, 24 Oct 2022 11:57:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id ADB27C433D6; Mon, 24 Oct 2022 11:57:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612638; bh=y84t/6twxt/53nKBnvLQ90QZ4BX1GUJC2DR1Vtf5ue8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OYvpH4X91tOUhl8c9MrHCryG1jczpVNbTrJRD9OT8QCY+B6d9WfIKRV4wYm4nWtqC IQDQUtxGaJtsyK/fq4n6JrAjHMUprNHMUqSwfAp0NQaAsOjbhufVulzQ8tLwwoXEwy zWD4DaAucHoqQa4Ln6xdHivZ7csO7rZUqOo5aMss= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, mingo@redhat.com, Zheng Yejian , "Steven Rostedt (Google)" Subject: [PATCH 4.19 063/229] ftrace: Properly unset FTRACE_HASH_FL_MOD Date: Mon, 24 Oct 2022 13:29:42 +0200 Message-Id: <20221024113001.116446241@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747573322186180056?= X-GMAIL-MSGID: =?utf-8?q?1747573322186180056?= From: Zheng Yejian commit 0ce0638edf5ec83343302b884fa208179580700a upstream. When executing following commands like what document said, but the log "#### all functions enabled ####" was not shown as expect: 1. Set a 'mod' filter: $ echo 'write*:mod:ext3' > /sys/kernel/tracing/set_ftrace_filter 2. Invert above filter: $ echo '!write*:mod:ext3' >> /sys/kernel/tracing/set_ftrace_filter 3. Read the file: $ cat /sys/kernel/tracing/set_ftrace_filter By some debugging, I found that flag FTRACE_HASH_FL_MOD was not unset after inversion like above step 2 and then result of ftrace_hash_empty() is incorrect. Link: https://lkml.kernel.org/r/20220926152008.2239274-1-zhengyejian1@huawei.com Cc: Cc: stable@vger.kernel.org Fixes: 8c08f0d5c6fb ("ftrace: Have cached module filters be an active filter") Signed-off-by: Zheng Yejian Signed-off-by: Steven Rostedt (Google) Signed-off-by: Greg Kroah-Hartman --- kernel/trace/ftrace.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) --- a/kernel/trace/ftrace.c +++ b/kernel/trace/ftrace.c @@ -5054,8 +5054,12 @@ int ftrace_regex_release(struct inode *i if (filter_hash) { orig_hash = &iter->ops->func_hash->filter_hash; - if (iter->tr && !list_empty(&iter->tr->mod_trace)) - iter->hash->flags |= FTRACE_HASH_FL_MOD; + if (iter->tr) { + if (list_empty(&iter->tr->mod_trace)) + iter->hash->flags &= ~FTRACE_HASH_FL_MOD; + else + iter->hash->flags |= FTRACE_HASH_FL_MOD; + } } else orig_hash = &iter->ops->func_hash->notrace_hash; From patchwork Mon Oct 24 11:29:43 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8692 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp422585wru; Mon, 24 Oct 2022 05:23:00 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5jmbGim9XNkgVZPedqBlGKnErJnTlvdQAQDcctP8/HfpKZyirhQwGiTzEdusFB7rz8R5Eu X-Received: by 2002:a17:907:8a1c:b0:78d:ef44:7759 with SMTP id sc28-20020a1709078a1c00b0078def447759mr28033080ejc.441.1666614180715; Mon, 24 Oct 2022 05:23:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666614180; cv=none; d=google.com; s=arc-20160816; b=sc2Gm/3Mrej1VZPVAlg8+PB9gG6Ki4TRpUBt7AAsQtg1H8op3Wu3WxD7SJONvdwShK q9MVdnfEZ1Z9/jiAXE6AEYenojBXReu3vx/XjVLkf01eyNEUaDub0eMWQTuHMsmgsPTg 2yBbcXx91Y10o6fFVh2a9mphLhngRVqM4yZdWfx0lXyicVUmtjRhuzLJyXkXyn/eKGIh NHXkSngXJK4Aegkac0wwpBrGinhAN14uW7jOp5JPnr2emdd+ilppFRPa7n/l2JBaU1cc rqRgGg0Mgcl9O2C2SlrkAZmNDDfJQC5o5+zXY9E8+cW6Wui4/fv5zSDtSJTfssUkM07x mjkg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=YA1xH+DNW3Tx/vKzPnnKl8KBaa1N5U9TgUfWxAJWids=; b=kdWBPOuHdulOPgroPuApF0uOiHUKME2gMTAAk4AkJcHpBXZSQdx1mKiTn8Z+bAJ5i1 64/Yz5pWkvFNO03ejR/KLtZf6Xo4PijIjXHtJwSq8eAx4Iq9t8w52Pgj/ybKAcMavK9x rx8GaIR9RpNQxjCvW0qIsUMD+YJKZ3QilKuO3ISyJmvKf2gq98AJ9GgO6RRVsN3ACRmq oearDXgJ0VbRVzwfNm9IiO0FGWSc1JzIVdn2By0OzF0WH83n35g7o2d+8YMyRL18GcU3 rFIDQkf+HYyyePR7nXWWeVWFwUjriv+KIg9qaZD9x0BVIQGil2JSX8f3YJQ2L4mzMh4j sZyg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=0VXhOjOF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id du9-20020a17090772c900b0078df185078esi19206129ejc.663.2022.10.24.05.22.35; Mon, 24 Oct 2022 05:23:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=0VXhOjOF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233297AbiJXMUh (ORCPT + 99 others); Mon, 24 Oct 2022 08:20:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54774 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233330AbiJXMTL (ORCPT ); Mon, 24 Oct 2022 08:19:11 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0FA507B1C8; Mon, 24 Oct 2022 04:57:45 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 42B32612C5; Mon, 24 Oct 2022 11:57:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 50591C433D6; Mon, 24 Oct 2022 11:57:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612640; bh=rXUczMZfXkDFr9soqB73mBsjMgHKD7tfG7kUhKLKykI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0VXhOjOFcEFgewQmf/9eSXPWdQMjQE2jr9ghVhEVbX0mHRxT2+zSJIJ07G5RlKbrB SMVP4maNf3696VF3kTdfyFl4Fc1h57C+TkJxOyED6urn00VzZh49F84e1lCv3ovu0c 1/KxnxZzHJsmC1HDe1dWfclVv5mPb+3OmIiStM7I= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Steven Rostedt (Google)" Subject: [PATCH 4.19 064/229] ring-buffer: Allow splice to read previous partially read pages Date: Mon, 24 Oct 2022 13:29:43 +0200 Message-Id: <20221024113001.154006209@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747571631197721711?= X-GMAIL-MSGID: =?utf-8?q?1747571631197721711?= From: Steven Rostedt (Google) commit fa8f4a89736b654125fb254b0db753ac68a5fced upstream. If a page is partially read, and then the splice system call is run against the ring buffer, it will always fail to read, no matter how much is in the ring buffer. That's because the code path for a partial read of the page does will fail if the "full" flag is set. The splice system call wants full pages, so if the read of the ring buffer is not yet full, it should return zero, and the splice will block. But if a previous read was done, where the beginning has been consumed, it should still be given to the splice caller if the rest of the page has been written to. This caused the splice command to never consume data in this scenario, and let the ring buffer just fill up and lose events. Link: https://lkml.kernel.org/r/20220927144317.46be6b80@gandalf.local.home Cc: stable@vger.kernel.org Fixes: 8789a9e7df6bf ("ring-buffer: read page interface") Signed-off-by: Steven Rostedt (Google) Signed-off-by: Greg Kroah-Hartman --- kernel/trace/ring_buffer.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) --- a/kernel/trace/ring_buffer.c +++ b/kernel/trace/ring_buffer.c @@ -4770,7 +4770,15 @@ int ring_buffer_read_page(struct ring_bu unsigned int pos = 0; unsigned int size; - if (full) + /* + * If a full page is expected, this can still be returned + * if there's been a previous partial read and the + * rest of the page can be read and the commit page is off + * the reader page. + */ + if (full && + (!read || (len < (commit - read)) || + cpu_buffer->reader_page == cpu_buffer->commit_page)) goto out_unlock; if (len > (commit - read)) From patchwork Mon Oct 24 11:29:44 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8774 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp430577wru; Mon, 24 Oct 2022 05:41:54 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7v4k5LhRDpfTDAxb6ir6smvvmkLgsJnhT4Wfxvnpa9n5Zq/UXjAK5z78Dko6UdSeMNkk6s X-Received: by 2002:a17:907:a073:b0:78d:51c4:5b8c with SMTP id ia19-20020a170907a07300b0078d51c45b8cmr26766063ejc.355.1666615314512; Mon, 24 Oct 2022 05:41:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666615314; cv=none; d=google.com; s=arc-20160816; b=wMl7SLwzp3+XNRLWTevLWuEHevXOKn7x+0cPQ2KHGBVPg2V2coqUOkSkwr6XufX4Wd Plvp0Zw9NVC0bi3gMCGH+uspWL51dbha5PUmAJccnJmYPXrWAzQ4zB6x0eKrpHNyB04k a+sbGp3jYccCOJ3wyQmrmmcGsxlo0gdxW2g327IRZcD2OzW5RxD4/Ug5kzjJyKReiY4F dwsfYpnc/leNQj5wt6wDvaCDpNeSxc2oi5uP3KMnpDJtLa6thZfsZ/FgsTiTafCv1D8L MFJ46hbpj3192GYxZZ6dVNHhc51lGZScvGsGiXsB5rvf8R5Ay6hM06D3Ims1vGCSE5Nw czOg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=NT3irz/8I7dofF0nS4BlmgOWusc/AZmdR70fYfGaofo=; b=SXUz/2nH+Bh7Tgx+B+DI0b7W8XIfDlG/D6+MI8BfgdixQXe6gMa9SdJzf1dfNpCBuj IYshOmeBjNrvV1EGpZn2GfV4Yhkj35gbahAMUVD6tinQYKVqwi7C7GRMXluLqBaFv0bG ezWm82X+ko8u50jsnkSRkG+vZxlyoCTwu+VvZwfNqRkmgIQqaFW6vd/8ANhr4uG+3sCG 7YT02o9OAFCFnx5iNF6H+i4+K87Yzj6zsxbDfrrUAT7y33b9R4Y+MkaFogm/KXoYuLSQ Yx1OJyTdn9aA22OE3TWqRRhTRRv9BgzMKy3eqVnGL7mUD4F4Ci/sUaa3aiZpbxgidw01 +tQw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=jRYTy8li; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t8-20020a056402524800b00461f0d84ee1si674544edd.228.2022.10.24.05.41.24; Mon, 24 Oct 2022 05:41:54 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=jRYTy8li; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233690AbiJXM2t (ORCPT + 99 others); Mon, 24 Oct 2022 08:28:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45304 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233711AbiJXM1s (ORCPT ); Mon, 24 Oct 2022 08:27:48 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0F45B844C1; Mon, 24 Oct 2022 05:01:41 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 8EA24B8117E; Mon, 24 Oct 2022 11:57:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id ED70CC433D6; Mon, 24 Oct 2022 11:57:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612643; bh=+a+45iTcgmJaN1eXRX6U24G2mAi3/f9sIfWs6mR2zE0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jRYTy8liFQ9MfygCRJUEvvR0yr6DRx7413ygGV60SLXXJiD8evsSlxR61K5SALCvY zEHNCrp/2e16iua5BK3Tk3GVcVFG8FUtlkCHkW/9eYGgGcOGw55Bza1agx6MkQ3U1x He3aD0TVx5R+L4Uv3NsLjwYdbyRY0Y25nkcCoyuE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ingo Molnar , Andrew Morton , "Steven Rostedt (Google)" Subject: [PATCH 4.19 065/229] ring-buffer: Check pending waiters when doing wake ups as well Date: Mon, 24 Oct 2022 13:29:44 +0200 Message-Id: <20221024113001.192948457@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747572820237578032?= X-GMAIL-MSGID: =?utf-8?q?1747572820237578032?= From: Steven Rostedt (Google) commit ec0bbc5ec5664dcee344f79373852117dc672c86 upstream. The wake up waiters only checks the "wakeup_full" variable and not the "full_waiters_pending". The full_waiters_pending is set when a waiter is added to the wait queue. The wakeup_full is only set when an event is triggered, and it clears the full_waiters_pending to avoid multiple calls to irq_work_queue(). The irq_work callback really needs to check both wakeup_full as well as full_waiters_pending such that this code can be used to wake up waiters when a file is closed that represents the ring buffer and the waiters need to be woken up. Link: https://lkml.kernel.org/r/20220927231824.209460321@goodmis.org Cc: stable@vger.kernel.org Cc: Ingo Molnar Cc: Andrew Morton Fixes: 15693458c4bc0 ("tracing/ring-buffer: Move poll wake ups into ring buffer code") Signed-off-by: Steven Rostedt (Google) Signed-off-by: Greg Kroah-Hartman --- kernel/trace/ring_buffer.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/kernel/trace/ring_buffer.c +++ b/kernel/trace/ring_buffer.c @@ -542,8 +542,9 @@ static void rb_wake_up_waiters(struct ir struct rb_irq_work *rbwork = container_of(work, struct rb_irq_work, work); wake_up_all(&rbwork->waiters); - if (rbwork->wakeup_full) { + if (rbwork->full_waiters_pending || rbwork->wakeup_full) { rbwork->wakeup_full = false; + rbwork->full_waiters_pending = false; wake_up_all(&rbwork->full_waiters); } } From patchwork Mon Oct 24 11:29:45 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8811 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp431002wru; Mon, 24 Oct 2022 05:42:43 -0700 (PDT) X-Google-Smtp-Source: AMsMyM403wtMjqDj5W921Ec8E+mv3BGmd78QLJj6GzmCO/avjBhOVsdkaTPsfZU6cJJcODBviUS3 X-Received: by 2002:a63:87c2:0:b0:46e:9bab:3064 with SMTP id i185-20020a6387c2000000b0046e9bab3064mr19586903pge.255.1666615363250; Mon, 24 Oct 2022 05:42:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666615363; cv=none; d=google.com; s=arc-20160816; b=glO0fY/IDSn/dozyt+4GtVBl3aluXzAuPH9n10zM24ZYMGRkbOeBOnlXPeyBOZa/dl AxcWxeLO7knOp0z/eSM18mcPtH6JwxNtKYVh3g0LwsBQhKO7Gir4FXpA1aijw64i0Jn5 vwIrnQvbDaFMQnOEqL8D2UzS1/67Tvq2jmqkznKQV4p+b0+YLPtCvxAmsAS+noXQ1T1C KqncvdPm/e0dUAvDTm5Y3HwN0VVVH4APUFI9UnqaQdC1A5dv28mUfs6QGxQNnaqNCb1u ipcp69SkRNCTBrnLukgNbM1V0NlmGaw3Op7uAkXJkPnH6jhWZYVpzffQr96EOmOISO6L 8xog== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=2sgMbE0PaMfKMFOwqXg1WrN14gMGjLAERw9363h/3Pc=; b=E6igaPkW5rgAtj39Md4D2FdFTxVcD2MjrtSPb7bFHuhIqOCFyNDlt1XX1hX+JPtUt/ U7/DY6b7rNecmXZ9sCRlbbmTNxfjjsPh6OKBKP32Mz1hofll5+iS+bx22lUrMhaoId0Z Mfyrtnezsv5GSU1LxEOi+pTPkyILDcyQVhXIO0/CaDoPCNEZWJzB+fuZ29ERnZi/hU9R TL9dENCdR6k2qZUxRwoj7JmCy2DP6mKASBjJeWBBJAdXkc3vgThq8kg0V9fYF+1t8/I4 NnM0FCN7okmbsw8+BvMTF0Kh33NYNQr79YTmB4/pxhjAGk3XBie2oqGIpoYyaYnOwxiq GNqg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="sagbom/J"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id lw12-20020a17090b180c00b002036aa03b94si17911952pjb.89.2022.10.24.05.42.29; Mon, 24 Oct 2022 05:42:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="sagbom/J"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234038AbiJXM3O (ORCPT + 99 others); Mon, 24 Oct 2022 08:29:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45120 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233825AbiJXM2V (ORCPT ); Mon, 24 Oct 2022 08:28:21 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4C4758683B; Mon, 24 Oct 2022 05:01:45 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 333A7B8113A; Mon, 24 Oct 2022 11:57:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 91BF2C433C1; Mon, 24 Oct 2022 11:57:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612645; bh=ERuRrojDwen+iWX+plN8aFO3wikfxW2NXBJaoV+waAs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sagbom/JOGhx++yjEBMmWot/x/nK1xDxblHuosNKdnY6vhuCpLiUhAaMgytuUcgsb iYVtloJRa+7+Svn0XSxhXvNoOlXjGArNOy8zf2IKi/tX+hfoVZuVnsR7Cb6LKli7Xe BovlCBd3UewQA/XUEp18ucbxevEryLitjdnpsFJw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ingo Molnar , Andrew Morton , "Jiazi.Li" , "Steven Rostedt (Google)" Subject: [PATCH 4.19 066/229] ring-buffer: Fix race between reset page and reading page Date: Mon, 24 Oct 2022 13:29:45 +0200 Message-Id: <20221024113001.223130740@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747572871013173425?= X-GMAIL-MSGID: =?utf-8?q?1747572871013173425?= From: Steven Rostedt (Google) commit a0fcaaed0c46cf9399d3a2d6e0c87ddb3df0e044 upstream. The ring buffer is broken up into sub buffers (currently of page size). Each sub buffer has a pointer to its "tail" (the last event written to the sub buffer). When a new event is requested, the tail is locally incremented to cover the size of the new event. This is done in a way that there is no need for locking. If the tail goes past the end of the sub buffer, the process of moving to the next sub buffer takes place. After setting the current sub buffer to the next one, the previous one that had the tail go passed the end of the sub buffer needs to be reset back to the original tail location (before the new event was requested) and the rest of the sub buffer needs to be "padded". The race happens when a reader takes control of the sub buffer. As readers do a "swap" of sub buffers from the ring buffer to get exclusive access to the sub buffer, it replaces the "head" sub buffer with an empty sub buffer that goes back into the writable portion of the ring buffer. This swap can happen as soon as the writer moves to the next sub buffer and before it updates the last sub buffer with padding. Because the sub buffer can be released to the reader while the writer is still updating the padding, it is possible for the reader to see the event that goes past the end of the sub buffer. This can cause obvious issues. To fix this, add a few memory barriers so that the reader definitely sees the updates to the sub buffer, and also waits until the writer has put back the "tail" of the sub buffer back to the last event that was written on it. To be paranoid, it will only spin for 1 second, otherwise it will warn and shutdown the ring buffer code. 1 second should be enough as the writer does have preemption disabled. If the writer doesn't move within 1 second (with preemption disabled) something is horribly wrong. No interrupt should last 1 second! Link: https://lore.kernel.org/all/20220830120854.7545-1-jiazi.li@transsion.com/ Link: https://bugzilla.kernel.org/show_bug.cgi?id=216369 Link: https://lkml.kernel.org/r/20220929104909.0650a36c@gandalf.local.home Cc: Ingo Molnar Cc: Andrew Morton Cc: stable@vger.kernel.org Fixes: c7b0930857e22 ("ring-buffer: prevent adding write in discarded area") Reported-by: Jiazi.Li Signed-off-by: Steven Rostedt (Google) Signed-off-by: Greg Kroah-Hartman --- kernel/trace/ring_buffer.c | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) --- a/kernel/trace/ring_buffer.c +++ b/kernel/trace/ring_buffer.c @@ -2157,6 +2157,9 @@ rb_reset_tail(struct ring_buffer_per_cpu /* Mark the rest of the page with padding */ rb_event_set_padding(event); + /* Make sure the padding is visible before the write update */ + smp_wmb(); + /* Set the write back to the previous setting */ local_sub(length, &tail_page->write); return; @@ -2168,6 +2171,9 @@ rb_reset_tail(struct ring_buffer_per_cpu /* time delta must be non zero */ event->time_delta = 1; + /* Make sure the padding is visible before the tail_page->write update */ + smp_wmb(); + /* Set write to end of buffer */ length = (tail + length) - BUF_PAGE_SIZE; local_sub(length, &tail_page->write); @@ -3813,6 +3819,33 @@ rb_get_reader_page(struct ring_buffer_pe arch_spin_unlock(&cpu_buffer->lock); local_irq_restore(flags); + /* + * The writer has preempt disable, wait for it. But not forever + * Although, 1 second is pretty much "forever" + */ +#define USECS_WAIT 1000000 + for (nr_loops = 0; nr_loops < USECS_WAIT; nr_loops++) { + /* If the write is past the end of page, a writer is still updating it */ + if (likely(!reader || rb_page_write(reader) <= BUF_PAGE_SIZE)) + break; + + udelay(1); + + /* Get the latest version of the reader write value */ + smp_rmb(); + } + + /* The writer is not moving forward? Something is wrong */ + if (RB_WARN_ON(cpu_buffer, nr_loops == USECS_WAIT)) + reader = NULL; + + /* + * Make sure we see any padding after the write update + * (see rb_reset_tail()) + */ + smp_rmb(); + + return reader; } From patchwork Mon Oct 24 11:29:46 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8682 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp422348wru; Mon, 24 Oct 2022 05:22:28 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5VgqogsUwHzzOLdUSo2zRVSaVWEj8Jc3mhFl8AKdPrrOiWEIfOP+nRfyeh/doaVL/qz6fq X-Received: by 2002:a17:907:7638:b0:7aa:987f:4e91 with SMTP id jy24-20020a170907763800b007aa987f4e91mr1262219ejc.442.1666614148175; Mon, 24 Oct 2022 05:22:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666614148; cv=none; d=google.com; s=arc-20160816; b=E3yrmUWnMSjPBOcCro1uo6HWmUqCJ5V2IBqLeYqifCePCx15LMdhdXmGISgbaR/cKS vjYZHgbwcdQRKQFKDJBD+WsNkGHhCmZiQ+f+gkOFzSygXfC8M7nPsUsn/6LUiRXqHgjF eWbkMh7XZjLvXcbplLy879dI0wG76AAQfgnsUjCJmqR55szE7GBGfsDMndjidBr5XuS4 vbxVVHieIIw9LWorgtnUFemmqUIY+AIaizHb54VgpyFjBGq4PBH85GoxmdzUOzUBNIgH LAL3Y8bCAndfgTmWFETJ4/ZMYDHztt/60+/LUYnFCKeY4EKU7KFssJyualcij0rMHUTo j0Aw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=GQZ18HCUkkyUQtW/NcevGJr9+GsTwtLNZRho6eXQAJ0=; b=o8P8wcw+l/j0eRNEyZaXGSc2XG0J03SYrbuj/VrLc/jzM4f4UfJQ82FKQQgtFF7Osz WMCHIfSi5YKO+wksKLKlgJwlnsfkWfAPlywnjs9fZUk9+oOzt9WwCM0065c9LGp3X+et QOAEOBDSjov/XDdJjfHXqYmxkdtfTrlwVEL71PxU68OOvtHLx8Fx8rn69/Vc0gxXrKZZ 1Pw0yrc+g+nYdCFcBo+TDHEoxiTVQZOrO1UeiVjTWRG/y3LA+DtR42T3E4J1hgf+vh0Q oFoAouVJj4AuZJcVy9VFFzfXEfq9OOFoCT4gryd9bHW/VRfp5x5HNzilFl6LM8fHIUUL 5D9w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=bDsBFMNf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id dn16-20020a17090794d000b00730870cb4b6si23031862ejc.621.2022.10.24.05.22.04; Mon, 24 Oct 2022 05:22:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=bDsBFMNf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233277AbiJXMU2 (ORCPT + 99 others); Mon, 24 Oct 2022 08:20:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51016 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233299AbiJXMTI (ORCPT ); Mon, 24 Oct 2022 08:19:08 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CF5087B29B; Mon, 24 Oct 2022 04:57:46 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 1A26F61300; Mon, 24 Oct 2022 11:57:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2D26BC433C1; Mon, 24 Oct 2022 11:57:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612648; bh=jUROC4zzUDnOqA3R2EJJIUBUUCj8PuAErpT09V3rKDk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bDsBFMNf5nfDP8KIxRmsB7cvRYQVnPabDPN/+6IbL0k/SCFR1EB6KPMrg1NgNuRhB 58iLy30bEwNbXavpZ0z/4aq/i1xp/r2mzKWtGen62WAZ3sGux6qx84CP1V5iJFz8Mq t2cIQnyBi/j8laYW5LoQuvkZ84m3eUxW7EIG16oA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Michal Luczaj , Sean Christopherson Subject: [PATCH 4.19 067/229] KVM: x86/emulator: Fix handing of POP SS to correctly set interruptibility Date: Mon, 24 Oct 2022 13:29:46 +0200 Message-Id: <20221024113001.252481650@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747571596967957149?= X-GMAIL-MSGID: =?utf-8?q?1747571596967957149?= From: Michal Luczaj commit 6aa5c47c351b22c21205c87977c84809cd015fcf upstream. The emulator checks the wrong variable while setting the CPU interruptibility state, the target segment is embedded in the instruction opcode, not the ModR/M register. Fix the condition. Signed-off-by: Michal Luczaj Fixes: a5457e7bcf9a ("KVM: emulate: POP SS triggers a MOV SS shadow too") Cc: stable@vger.kernel.org Link: https://lore.kernel.org/all/20220821215900.1419215-1-mhal@rbox.co Signed-off-by: Sean Christopherson Signed-off-by: Greg Kroah-Hartman --- arch/x86/kvm/emulate.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/arch/x86/kvm/emulate.c +++ b/arch/x86/kvm/emulate.c @@ -1975,7 +1975,7 @@ static int em_pop_sreg(struct x86_emulat if (rc != X86EMUL_CONTINUE) return rc; - if (ctxt->modrm_reg == VCPU_SREG_SS) + if (seg == VCPU_SREG_SS) ctxt->interruptibility = KVM_X86_SHADOW_INT_MOV_SS; if (ctxt->op_bytes > 2) rsp_increment(ctxt, ctxt->op_bytes - 2); From patchwork Mon Oct 24 11:29:47 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8755 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp430319wru; Mon, 24 Oct 2022 05:41:15 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6NhpdCTDocT5O3oyWRu17lAK061zhG0JzsoqKM2WTAZcSmk+woqorWq8nPWtDOVGzN3DAL X-Received: by 2002:a17:902:ce0d:b0:178:bd1e:e8da with SMTP id k13-20020a170902ce0d00b00178bd1ee8damr33459019plg.103.1666615274750; Mon, 24 Oct 2022 05:41:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666615274; cv=none; d=google.com; s=arc-20160816; b=yUJgD5hfh/VA5lALID19GhqfsgM9oAAkovCfP5A3vgTTYncOl11uZ4gV2F6u9+15n7 lYG0R9GL7MvCpxd2X4vPdkr+SHl6l8orzMu/UuMN013mD8w1rXxRe0MrgFF//T/kGuGd 7L/1drkDmLo6id8QdKcGjNz3dq/pjQnqVT0wJKo4mJqDeRbwp4OmZXX0AIsPLwvKdx7A BqGkHrHZQlWwHGZaSMgrQehMdiT6Fg0RHSGT9j+iQOp+0E7BVUfMmAp2//oxdnT3g8Bo PHldsV5Iud/qa2PWYJ1n756hksCxGMoI36RZCV+Qb/vLyFCQ9IuJK2r9IVCjYj6W4Sno pKCw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=8DOapSa6Bmabv8m4KHQ/vGrKcB0Fd5E1blnSIG7XtoE=; b=kFHUBTY0UkOyUHF0tU6TEWUY6g2aR9JZm6ZrVPTJUAM6SjDpTHkT8FhQ0pJcVfO8yP AIuUDOYe58vJu8vMEK01RuhGjtIiMafxAyX4DKj98lhBROeHeK9wpzcHApzhC6OO0vCj D2mE7RGIkU9hxuwdYQ6GYBXDUhW90AV3Jyna28icnD/4SDVU9Ek462qHT1GqPsvo/4nN 5l8SnSD0bGeq0AaZhwN2NzUOq0UJ76Qy8KFSMHgQNe5tW7i5942hbqtP2n6c/vTWaSy3 dlbf/qiLRIJzsB1+a+KeLYbIiWTF89jPfVmm0ZUjug9uofDZrnVFaeWI8WRO4LI9nHkH 25RQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=KIJdgzgr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a8-20020a170902900800b001869de4a7d2si4644421plp.187.2022.10.24.05.41.01; Mon, 24 Oct 2022 05:41:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=KIJdgzgr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233819AbiJXM27 (ORCPT + 99 others); Mon, 24 Oct 2022 08:28:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60602 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231841AbiJXM2F (ORCPT ); Mon, 24 Oct 2022 08:28:05 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 225A78688F; Mon, 24 Oct 2022 05:01:50 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 68AE1B811F6; Mon, 24 Oct 2022 11:57:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BF180C433C1; Mon, 24 Oct 2022 11:57:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612651; bh=BCCn0LzKAA0L8tPJ4QGrCcI4njaPWJAQpa8ni/MkR1I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KIJdgzgr6FSx1KlKIWSnGP4cFiYolRq3b1MOA83crz1SVI4VYIq8WCXcopzAAVM7f sPXh8CQ5aHJ8uTjvOgo56JzUTimixn6p8ODk0daDRcbWaWXKacfulbeLdmYCkY72CC zq9SVcKjWaqKxl7UOJZRjgZ6vlZZaXpsUEHbGnus= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sean Christopherson , Jim Mattson , Maxim Levitsky , Paolo Bonzini Subject: [PATCH 4.19 068/229] KVM: nVMX: Unconditionally purge queued/injected events on nested "exit" Date: Mon, 24 Oct 2022 13:29:47 +0200 Message-Id: <20221024113001.281767160@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747572778161675709?= X-GMAIL-MSGID: =?utf-8?q?1747572778161675709?= From: Sean Christopherson commit d953540430c5af57f5de97ea9e36253908204027 upstream. Drop pending exceptions and events queued for re-injection when leaving nested guest mode, even if the "exit" is due to VM-Fail, SMI, or forced by host userspace. Failure to purge events could result in an event belonging to L2 being injected into L1. This _should_ never happen for VM-Fail as all events should be blocked by nested_run_pending, but it's possible if KVM, not the L1 hypervisor, is the source of VM-Fail when running vmcs02. SMI is a nop (barring unknown bugs) as recognition of SMI and thus entry to SMM is blocked by pending exceptions and re-injected events. Forced exit is definitely buggy, but has likely gone unnoticed because userspace probably follows the forced exit with KVM_SET_VCPU_EVENTS (or some other ioctl() that purges the queue). Fixes: 4f350c6dbcb9 ("kvm: nVMX: Handle deferred early VMLAUNCH/VMRESUME failure properly") Cc: stable@vger.kernel.org Signed-off-by: Sean Christopherson Reviewed-by: Jim Mattson Reviewed-by: Maxim Levitsky Link: https://lore.kernel.org/r/20220830231614.3580124-2-seanjc@google.com Signed-off-by: Paolo Bonzini Signed-off-by: Greg Kroah-Hartman --- arch/x86/kvm/vmx.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) --- a/arch/x86/kvm/vmx.c +++ b/arch/x86/kvm/vmx.c @@ -13276,14 +13276,6 @@ static void prepare_vmcs12(struct kvm_vc */ vmcs12_save_pending_event(vcpu, vmcs12); } - - /* - * Drop what we picked up for L2 via vmx_complete_interrupts. It is - * preserved above and would only end up incorrectly in L1. - */ - vcpu->arch.nmi_injected = false; - kvm_clear_exception_queue(vcpu); - kvm_clear_interrupt_queue(vcpu); } /* @@ -13617,6 +13609,17 @@ static void nested_vmx_vmexit(struct kvm nested_vmx_abort(vcpu, VMX_ABORT_SAVE_GUEST_MSR_FAIL); } + /* + * Drop events/exceptions that were queued for re-injection to L2 + * (picked up via vmx_complete_interrupts()), as well as exceptions + * that were pending for L2. Note, this must NOT be hoisted above + * prepare_vmcs12(), events/exceptions queued for re-injection need to + * be captured in vmcs12 (see vmcs12_save_pending_event()). + */ + vcpu->arch.nmi_injected = false; + kvm_clear_exception_queue(vcpu); + kvm_clear_interrupt_queue(vcpu); + vmx_switch_vmcs(vcpu, &vmx->vmcs01); vm_entry_controls_reset_shadow(vmx); vm_exit_controls_reset_shadow(vmx); From patchwork Mon Oct 24 11:29:48 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8761 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp430338wru; Mon, 24 Oct 2022 05:41:16 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5AlEzuo1sifenkhDM/PYtw2gz3S7GN602yLcZaUuZIuZ5FRy4VynYFFgS4GfuQTXR8TsRc X-Received: by 2002:a17:90b:2248:b0:210:10dc:a314 with SMTP id hk8-20020a17090b224800b0021010dca314mr30037989pjb.15.1666615275823; Mon, 24 Oct 2022 05:41:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666615275; cv=none; d=google.com; s=arc-20160816; b=QAAT4OwX21uCHYflx06VLFM8lVzlI3ncksobmPwa92oLRPMHWffXm2kLwiCt4o3JWe w6Z16dlxPET71jLHhz6bnHgvtNY+QoUgYwj/E/Km0n2cqPz8pSJO5FxXX+aIxIVyVerL PPdy5tM3r+rE268+CvjQtaabXRiT6m9wisvvVowWby5iLz7671FrruZk5stTnEP+T2m3 d4CE+jui5pfHWWHN6liQF694SRU1xMkY4tKh+P8PESYJIc0jJBtdC8Du7k0Cv9Hrwf5w VK190wkT3WEJXGiJHvtUXN20MGAvFY3AaAx6c5c12//8ycDeNHFb7Ffie7bgFWg3MTeX k7tA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=SV20j36YBtmCMBO6hyVOtbbyAhX+h+AVVBda30RRb8g=; b=aMKFs/ZRlimc6LI4z87hs32gTDlXAqTnC1CIvaYDirBI0igK6D8Ylb40YVwydzJbNp Ue6jZdZQuR5J01Mc5Shj+gEe4Xaj1HvUsVcNCMws3ll5zf4kfHeTClc3Oy6qecWkY+o/ NovDrT8k1d6WjNdbobMWwokNGD/6nNuJwo55UlthQT4k8KmerDqW0tIJfnl6SVCkvX7m JlzCJbtlz+aNPNQHtFSW8LXaJnchFhV5ZHRgUDlps7KCryrGVjy+s1IFlmD2dTSXsSJR D4StjCSXevXDskZ5iyrlhhYR+H1sxKZBaubVprg41pTZjNNarICoKS8d82QctipoVgKs 7Wug== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=sVyYn3ga; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i17-20020a170902c95100b0017a0c197f3fsi7256326pla.335.2022.10.24.05.41.01; Mon, 24 Oct 2022 05:41:15 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=sVyYn3ga; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233959AbiJXM3F (ORCPT + 99 others); Mon, 24 Oct 2022 08:29:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45036 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233814AbiJXM2T (ORCPT ); Mon, 24 Oct 2022 08:28:19 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 37DD513EBA; Mon, 24 Oct 2022 05:01:54 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id A6243B811A5; Mon, 24 Oct 2022 11:57:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 03728C433D6; Mon, 24 Oct 2022 11:57:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612656; bh=TaOMZ641qK5g+ToI/uLs8Ny1TZ131P0sMACZ7/5HZuc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sVyYn3gabMWebxyhSToh6n4xjm3vcq00/nmsI+gw2jghGDs/tcu7n/klRXis+jc7Y W3oNVMO3qhBqPlD+AfGoNnOitALfas3sS/PZSfoYz4/IZaGS4xOPj7xlM2yFSioR6x HmkWsgeNTGuMh90G/A/7tOWVnr0we55KvXxVNUEQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Paul Moore , Stephen Smalley , Eric Paris , selinux@vger.kernel.org Subject: [PATCH 4.19 069/229] selinux: use "grep -E" instead of "egrep" Date: Mon, 24 Oct 2022 13:29:48 +0200 Message-Id: <20221024113001.309912679@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747572779625317156?= X-GMAIL-MSGID: =?utf-8?q?1747572779625317156?= From: Greg Kroah-Hartman commit c969bb8dbaf2f3628927eae73e7c579a74cf1b6e upstream. The latest version of grep claims that egrep is now obsolete so the build now contains warnings that look like: egrep: warning: egrep is obsolescent; using grep -E fix this by using "grep -E" instead. Cc: Paul Moore Cc: Stephen Smalley Cc: Eric Paris Cc: selinux@vger.kernel.org Signed-off-by: Greg Kroah-Hartman [PM: tweak to remove vdso reference, cleanup subj line] Signed-off-by: Paul Moore Signed-off-by: Greg Kroah-Hartman --- scripts/selinux/install_policy.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/scripts/selinux/install_policy.sh +++ b/scripts/selinux/install_policy.sh @@ -57,7 +57,7 @@ fi cd /etc/selinux/dummy/contexts/files $SF file_contexts / -mounts=`cat /proc/$$/mounts | egrep "ext2|ext3|xfs|jfs|ext4|ext4dev|gfs2" | awk '{ print $2 '}` +mounts=`cat /proc/$$/mounts | grep -E "ext2|ext3|xfs|jfs|ext4|ext4dev|gfs2" | awk '{ print $2 '}` $SF file_contexts $mounts From patchwork Mon Oct 24 11:29:49 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8684 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp422408wru; Mon, 24 Oct 2022 05:22:37 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4wvZcc18GEcotlffdLKTNFgTRl2sehlRjqKZQM0DH9n8GSoKN/aCoj4S5CGU7RI5W+pyAH X-Received: by 2002:a17:907:1c28:b0:7a6:e338:fa08 with SMTP id nc40-20020a1709071c2800b007a6e338fa08mr5036672ejc.518.1666614157029; Mon, 24 Oct 2022 05:22:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666614157; cv=none; d=google.com; s=arc-20160816; b=iFwwZEI7Qeuf7slyXYwqLPTccFrPABAWGBseXblO6ZOGijBRQCDMIkemw9DN7v4xxB srlMExGPIkynALW5ExnH5qrTRwajyP+5BiNLOcagN9bqUvKYFfmSgs7FqRQkb4jB1IB9 yyJ9toBc7mIH4b63+0fSvOrOCAZJ6jZ06zGEufiPVfFq42HlvRpaKV662So0LD1wv2mn pJxi8SiRZ75qbX3jAVy3MX9MaLjPPJIYNzgpFxz4dk4Vf+POr5kghl4wsB6ixMSFUe37 wn/eHnkZnHvVd7egJySXm884HQ+wEe7sYJyatFFUKcpda0pTpFGFTHK8gzN8D9JhSTGs jkUw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=7yQYpIc1Abw9/JFLTKaHE9tT7FXjE8gCWTJBHzbDwYw=; b=d6Lnds+sTsdMC3e6z4GNpIc7Mia2+0lcn6OG2h9Zcm6xL/yPH39ZkdWslIlZz0NH2z oe1qgnG3vRC+cyeekURFHep0NxqOu0evEAP1s9jDi9A8j5bj2JY3fojOZkW6ChFwKg5F 9OUTnKWzk/0mV1Zo/1LfErU07BD54W6vsMC2NpD7rV36dhqWOPaaYPtsXXHzSQdvAEh6 yqEuq63Qm5bh8Emj9ME31pEN24JhtoQO03lUhcHCRL5GmB8QoFz1xampRXyEYm0AribI /VqOGGijKF4XGOSe0e01EcYiJ/U5OzeQmgXlSepTa8NhljDsNY6vfvhxNESuznEtZRrf rFfw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=X4hUI9Gg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z3-20020a1709067e4300b0078e19e971b2si20187363ejr.915.2022.10.24.05.22.12; Mon, 24 Oct 2022 05:22:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=X4hUI9Gg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233296AbiJXMUr (ORCPT + 99 others); Mon, 24 Oct 2022 08:20:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47544 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233353AbiJXMTP (ORCPT ); Mon, 24 Oct 2022 08:19:15 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9E33574E38; Mon, 24 Oct 2022 04:57:49 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 8D355612D5; Mon, 24 Oct 2022 11:57:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9EDCFC433C1; Mon, 24 Oct 2022 11:57:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612659; bh=zyn4n4h+hCJZVFeLUjY46IkKRhJ1R1o5FUAeIwX4jUQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=X4hUI9Gg4hG6pEmlE/jVqIrcMQqB6sOc75jwzeizsd8ErAFoUTJ9DOaSpIoeLaqQb NQtJjo1wFCBAzxwtr3iWbTsLZQeq6rQhp1yZhGYF22yfSem2sqkz86GV0UeUQwT+0X /9XCcqblwYNSzUXC8ZxMQ/wmbIkHF5TEengadnvs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Yoshinori Sato , Rich Felker , linux-sh@vger.kernel.org, Geert Uytterhoeven , Geert Uytterhoeven , "Gustavo A. R. Silva" , Kees Cook , Sasha Levin Subject: [PATCH 4.19 070/229] sh: machvec: Use char[] for section boundaries Date: Mon, 24 Oct 2022 13:29:49 +0200 Message-Id: <20221024113001.345205044@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747571606288595847?= X-GMAIL-MSGID: =?utf-8?q?1747571606288595847?= From: Kees Cook [ Upstream commit c5783af354688b24abd359f7086c282ec74de993 ] As done for other sections, define the extern as a character array, which relaxes many of the compiler-time object size checks, which would otherwise assume it's a single long. Solves the following build error: arch/sh/kernel/machvec.c: error: array subscript 'struct sh_machine_vector[0]' is partly outside array bounds of 'long int[1]' [-Werror=array-bounds]: => 105:33 Cc: Yoshinori Sato Cc: Rich Felker Cc: linux-sh@vger.kernel.org Reported-by: Geert Uytterhoeven Link: https://lore.kernel.org/lkml/alpine.DEB.2.22.394.2209050944290.964530@ramsan.of.borg/ Fixes: 9655ad03af2d ("sh: Fixup machvec support.") Reviewed-by: Geert Uytterhoeven Reviewed-by: Gustavo A. R. Silva Acked-by: Rich Felker Signed-off-by: Kees Cook Signed-off-by: Sasha Levin --- arch/sh/include/asm/sections.h | 2 +- arch/sh/kernel/machvec.c | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/arch/sh/include/asm/sections.h b/arch/sh/include/asm/sections.h index 8edb824049b9..0cb0ca149ac3 100644 --- a/arch/sh/include/asm/sections.h +++ b/arch/sh/include/asm/sections.h @@ -4,7 +4,7 @@ #include -extern long __machvec_start, __machvec_end; +extern char __machvec_start[], __machvec_end[]; extern char __uncached_start, __uncached_end; extern char __start_eh_frame[], __stop_eh_frame[]; diff --git a/arch/sh/kernel/machvec.c b/arch/sh/kernel/machvec.c index ec05f491c347..a9f797a76e7c 100644 --- a/arch/sh/kernel/machvec.c +++ b/arch/sh/kernel/machvec.c @@ -22,8 +22,8 @@ #define MV_NAME_SIZE 32 #define for_each_mv(mv) \ - for ((mv) = (struct sh_machine_vector *)&__machvec_start; \ - (mv) && (unsigned long)(mv) < (unsigned long)&__machvec_end; \ + for ((mv) = (struct sh_machine_vector *)__machvec_start; \ + (mv) && (unsigned long)(mv) < (unsigned long)__machvec_end; \ (mv)++) static struct sh_machine_vector * __init get_mv_byname(const char *name) @@ -89,8 +89,8 @@ void __init sh_mv_setup(void) if (!machvec_selected) { unsigned long machvec_size; - machvec_size = ((unsigned long)&__machvec_end - - (unsigned long)&__machvec_start); + machvec_size = ((unsigned long)__machvec_end - + (unsigned long)__machvec_start); /* * Sanity check for machvec section alignment. Ensure @@ -104,7 +104,7 @@ void __init sh_mv_setup(void) * vector (usually the only one) from .machvec.init. */ if (machvec_size >= sizeof(struct sh_machine_vector)) - sh_mv = *(struct sh_machine_vector *)&__machvec_start; + sh_mv = *(struct sh_machine_vector *)__machvec_start; } printk(KERN_NOTICE "Booting machvec: %s\n", get_system_type()); From patchwork Mon Oct 24 11:29:50 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8895 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp433749wru; Mon, 24 Oct 2022 05:50:24 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5DH1tr3bZo9z2eoSkgPBA5EEvItDn1WwZGK9gg/+o772TXyt+luLbjTMdMs56/vio4vJzV X-Received: by 2002:a17:906:9746:b0:78e:11cc:3bb3 with SMTP id o6-20020a170906974600b0078e11cc3bb3mr27473838ejy.379.1666615824167; Mon, 24 Oct 2022 05:50:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666615824; cv=none; d=google.com; s=arc-20160816; b=nB6B7aCReRhBFnaIFkRf1/hqzgjwUAhcVcT87Hugmjy6TXNpwzF2ieoUI67hI16oJX uwWXnT45bA66JUmEWDZ/QUXJ4bwOFFy5eoCPJMkDDcPys8E7fHx4B0Ae86jwkc7Gir+z NxzQlfHbNxSD3Jv3ADbiAAu67rNMu59Vt5qYLCcs1J6/7wMV3qcdNe9wQgP/3cBe7MgR 1t5QgU0KcWTCfupYKLpTHf9dkalc9OUpFVqY0Kpu/iKkKFINK2pDS0SG4/E6ck2GRXRB QNPxvNie7M2iD1jwAA2iRTUfbtLx3ZacB2rq+wgygQPQGOsFaGaCusBzDRSYRlx7sf5A PKnQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Xp082QGx5Eqar6YDLH9f3yPre0Gpz3wQ1OPHZKmm1o0=; b=0tIwdGAcYPsdLpDLrgV8MUTwoqaYhQNzqF8iQ70bnqtAsstLQN5kmNChDuw6ZU4Hwv 3xLEe0MzYZwoXODle8cr88WAnWjA40VNZx+ZC8n3UklisFJL8v7LJ0fvJSFwvu3ardYt X9ftDeTgX99khpCpWXMOUOTp2fozER2HVp3p5AjXOySbycBvIogyZ5KkO2IkO9CP791e owGtv35cQhUtVJzfFSUYbG0+lYFoTJCnv87jlD3PB6e9IvF+sjKinsIMNtK1OAHFCu0w hKupgG7RItAMmwhCY1WiWG/h0ZPOwUmgAIur4ElgMv6DaTzUZSTu2ibgMnI05fUugT/Q 6umQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=tLBCu1If; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n14-20020aa7c78e000000b00458ee128628si23638722eds.470.2022.10.24.05.49.59; Mon, 24 Oct 2022 05:50:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=tLBCu1If; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234440AbiJXMsq (ORCPT + 99 others); Mon, 24 Oct 2022 08:48:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38808 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234336AbiJXMoX (ORCPT ); Mon, 24 Oct 2022 08:44:23 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8FE0D7F0AF; Mon, 24 Oct 2022 05:09:18 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 34C9F612E4; Mon, 24 Oct 2022 11:57:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 42179C433D7; Mon, 24 Oct 2022 11:57:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612661; bh=S2Q5qZKUiKaXsQ1Ru97nEhxuCcdchoWz39rCU2vxwAc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tLBCu1IfUSjfK5NulsyDa5XCJSSArLjpMYOEAUKIXtaAGsC94EDfFX0Vbc8JMwWEd IffYQ7X7txiV1DA1KbD86ZhcAxWHzOn772doUw90oFE9ZBhZLPCGvRy4nvMapvaDun ChFQdSyrusYl0XPYWIoQdL3jFi0DE24aNl7xcfgY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Wen Gong , Kalle Valo , Sasha Levin Subject: [PATCH 4.19 071/229] wifi: ath10k: add peer map clean up for peer delete in ath10k_sta_state() Date: Mon, 24 Oct 2022 13:29:50 +0200 Message-Id: <20221024113001.375934663@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747573354531178897?= X-GMAIL-MSGID: =?utf-8?q?1747573354531178897?= From: Wen Gong [ Upstream commit f020d9570a04df0762a2ac5c50cf1d8c511c9164 ] When peer delete failed in a disconnect operation, use-after-free detected by KFENCE in below log. It is because for each vdev_id and address, it has only one struct ath10k_peer, it is allocated in ath10k_peer_map_event(). When connected to an AP, it has more than one HTT_T2H_MSG_TYPE_PEER_MAP reported from firmware, then the array peer_map of struct ath10k will be set muti-elements to the same ath10k_peer in ath10k_peer_map_event(). When peer delete failed in ath10k_sta_state(), the ath10k_peer will be free for the 1st peer id in array peer_map of struct ath10k, and then use-after-free happened for the 2nd peer id because they map to the same ath10k_peer. And clean up all peers in array peer_map for the ath10k_peer, then user-after-free disappeared peer map event log: [ 306.911021] wlan0: authenticate with b0:2a:43:e6:75:0e [ 306.957187] ath10k_pci 0000:01:00.0: mac vdev 0 peer create b0:2a:43:e6:75:0e (new sta) sta 1 / 32 peer 1 / 33 [ 306.957395] ath10k_pci 0000:01:00.0: htt peer map vdev 0 peer b0:2a:43:e6:75:0e id 246 [ 306.957404] ath10k_pci 0000:01:00.0: htt peer map vdev 0 peer b0:2a:43:e6:75:0e id 198 [ 306.986924] ath10k_pci 0000:01:00.0: htt peer map vdev 0 peer b0:2a:43:e6:75:0e id 166 peer unmap event log: [ 435.715691] wlan0: deauthenticating from b0:2a:43:e6:75:0e by local choice (Reason: 3=DEAUTH_LEAVING) [ 435.716802] ath10k_pci 0000:01:00.0: mac vdev 0 peer delete b0:2a:43:e6:75:0e sta ffff990e0e9c2b50 (sta gone) [ 435.717177] ath10k_pci 0000:01:00.0: htt peer unmap vdev 0 peer b0:2a:43:e6:75:0e id 246 [ 435.717186] ath10k_pci 0000:01:00.0: htt peer unmap vdev 0 peer b0:2a:43:e6:75:0e id 198 [ 435.717193] ath10k_pci 0000:01:00.0: htt peer unmap vdev 0 peer b0:2a:43:e6:75:0e id 166 use-after-free log: [21705.888627] wlan0: deauthenticating from d0:76:8f:82:be:75 by local choice (Reason: 3=DEAUTH_LEAVING) [21713.799910] ath10k_pci 0000:01:00.0: failed to delete peer d0:76:8f:82:be:75 for vdev 0: -110 [21713.799925] ath10k_pci 0000:01:00.0: found sta peer d0:76:8f:82:be:75 (ptr 0000000000000000 id 102) entry on vdev 0 after it was supposedly removed [21713.799968] ================================================================== [21713.799991] BUG: KFENCE: use-after-free read in ath10k_sta_state+0x265/0xb8a [ath10k_core] [21713.799991] [21713.799997] Use-after-free read at 0x00000000abe1c75e (in kfence-#69): [21713.800010] ath10k_sta_state+0x265/0xb8a [ath10k_core] [21713.800041] drv_sta_state+0x115/0x677 [mac80211] [21713.800059] __sta_info_destroy_part2+0xb1/0x133 [mac80211] [21713.800076] __sta_info_flush+0x11d/0x162 [mac80211] [21713.800093] ieee80211_set_disassoc+0x12d/0x2f4 [mac80211] [21713.800110] ieee80211_mgd_deauth+0x26c/0x29b [mac80211] [21713.800137] cfg80211_mlme_deauth+0x13f/0x1bb [cfg80211] [21713.800153] nl80211_deauthenticate+0xf8/0x121 [cfg80211] [21713.800161] genl_rcv_msg+0x38e/0x3be [21713.800166] netlink_rcv_skb+0x89/0xf7 [21713.800171] genl_rcv+0x28/0x36 [21713.800176] netlink_unicast+0x179/0x24b [21713.800181] netlink_sendmsg+0x3a0/0x40e [21713.800187] sock_sendmsg+0x72/0x76 [21713.800192] ____sys_sendmsg+0x16d/0x1e3 [21713.800196] ___sys_sendmsg+0x95/0xd1 [21713.800200] __sys_sendmsg+0x85/0xbf [21713.800205] do_syscall_64+0x43/0x55 [21713.800210] entry_SYSCALL_64_after_hwframe+0x44/0xa9 [21713.800213] [21713.800219] kfence-#69: 0x000000009149b0d5-0x000000004c0697fb, size=1064, cache=kmalloc-2k [21713.800219] [21713.800224] allocated by task 13 on cpu 0 at 21705.501373s: [21713.800241] ath10k_peer_map_event+0x7e/0x154 [ath10k_core] [21713.800254] ath10k_htt_t2h_msg_handler+0x586/0x1039 [ath10k_core] [21713.800265] ath10k_htt_htc_t2h_msg_handler+0x12/0x28 [ath10k_core] [21713.800277] ath10k_htc_rx_completion_handler+0x14c/0x1b5 [ath10k_core] [21713.800283] ath10k_pci_process_rx_cb+0x195/0x1df [ath10k_pci] [21713.800294] ath10k_ce_per_engine_service+0x55/0x74 [ath10k_core] [21713.800305] ath10k_ce_per_engine_service_any+0x76/0x84 [ath10k_core] [21713.800310] ath10k_pci_napi_poll+0x49/0x144 [ath10k_pci] [21713.800316] net_rx_action+0xdc/0x361 [21713.800320] __do_softirq+0x163/0x29a [21713.800325] asm_call_irq_on_stack+0x12/0x20 [21713.800331] do_softirq_own_stack+0x3c/0x48 [21713.800337] __irq_exit_rcu+0x9b/0x9d [21713.800342] common_interrupt+0xc9/0x14d [21713.800346] asm_common_interrupt+0x1e/0x40 [21713.800351] ksoftirqd_should_run+0x5/0x16 [21713.800357] smpboot_thread_fn+0x148/0x211 [21713.800362] kthread+0x150/0x15f [21713.800367] ret_from_fork+0x22/0x30 [21713.800370] [21713.800374] freed by task 708 on cpu 1 at 21713.799953s: [21713.800498] ath10k_sta_state+0x2c6/0xb8a [ath10k_core] [21713.800515] drv_sta_state+0x115/0x677 [mac80211] [21713.800532] __sta_info_destroy_part2+0xb1/0x133 [mac80211] [21713.800548] __sta_info_flush+0x11d/0x162 [mac80211] [21713.800565] ieee80211_set_disassoc+0x12d/0x2f4 [mac80211] [21713.800581] ieee80211_mgd_deauth+0x26c/0x29b [mac80211] [21713.800598] cfg80211_mlme_deauth+0x13f/0x1bb [cfg80211] [21713.800614] nl80211_deauthenticate+0xf8/0x121 [cfg80211] [21713.800619] genl_rcv_msg+0x38e/0x3be [21713.800623] netlink_rcv_skb+0x89/0xf7 [21713.800628] genl_rcv+0x28/0x36 [21713.800632] netlink_unicast+0x179/0x24b [21713.800637] netlink_sendmsg+0x3a0/0x40e [21713.800642] sock_sendmsg+0x72/0x76 [21713.800646] ____sys_sendmsg+0x16d/0x1e3 [21713.800651] ___sys_sendmsg+0x95/0xd1 [21713.800655] __sys_sendmsg+0x85/0xbf [21713.800659] do_syscall_64+0x43/0x55 [21713.800663] entry_SYSCALL_64_after_hwframe+0x44/0xa9 Tested-on: QCA6174 hw3.2 PCI WLAN.RM.4.4.1-00288-QCARMSWPZ-1 Fixes: d0eeafad1189 ("ath10k: Clean up peer when sta goes away.") Signed-off-by: Wen Gong Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/20220801141930.16794-1-quic_wgong@quicinc.com Signed-off-by: Sasha Levin --- drivers/net/wireless/ath/ath10k/mac.c | 54 ++++++++++++++------------- 1 file changed, 29 insertions(+), 25 deletions(-) diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c index 6e4096fd6633..07308571665c 100644 --- a/drivers/net/wireless/ath/ath10k/mac.c +++ b/drivers/net/wireless/ath/ath10k/mac.c @@ -819,11 +819,36 @@ static int ath10k_peer_delete(struct ath10k *ar, u32 vdev_id, const u8 *addr) return 0; } +static void ath10k_peer_map_cleanup(struct ath10k *ar, struct ath10k_peer *peer) +{ + int peer_id, i; + + lockdep_assert_held(&ar->conf_mutex); + + for_each_set_bit(peer_id, peer->peer_ids, + ATH10K_MAX_NUM_PEER_IDS) { + ar->peer_map[peer_id] = NULL; + } + + /* Double check that peer is properly un-referenced from + * the peer_map + */ + for (i = 0; i < ARRAY_SIZE(ar->peer_map); i++) { + if (ar->peer_map[i] == peer) { + ath10k_warn(ar, "removing stale peer_map entry for %pM (ptr %pK idx %d)\n", + peer->addr, peer, i); + ar->peer_map[i] = NULL; + } + } + + list_del(&peer->list); + kfree(peer); + ar->num_peers--; +} + static void ath10k_peer_cleanup(struct ath10k *ar, u32 vdev_id) { struct ath10k_peer *peer, *tmp; - int peer_id; - int i; lockdep_assert_held(&ar->conf_mutex); @@ -835,25 +860,7 @@ static void ath10k_peer_cleanup(struct ath10k *ar, u32 vdev_id) ath10k_warn(ar, "removing stale peer %pM from vdev_id %d\n", peer->addr, vdev_id); - for_each_set_bit(peer_id, peer->peer_ids, - ATH10K_MAX_NUM_PEER_IDS) { - ar->peer_map[peer_id] = NULL; - } - - /* Double check that peer is properly un-referenced from - * the peer_map - */ - for (i = 0; i < ARRAY_SIZE(ar->peer_map); i++) { - if (ar->peer_map[i] == peer) { - ath10k_warn(ar, "removing stale peer_map entry for %pM (ptr %pK idx %d)\n", - peer->addr, peer, i); - ar->peer_map[i] = NULL; - } - } - - list_del(&peer->list); - kfree(peer); - ar->num_peers--; + ath10k_peer_map_cleanup(ar, peer); } spin_unlock_bh(&ar->data_lock); } @@ -6371,10 +6378,7 @@ static int ath10k_sta_state(struct ieee80211_hw *hw, /* Clean up the peer object as well since we * must have failed to do this above. */ - list_del(&peer->list); - ar->peer_map[i] = NULL; - kfree(peer); - ar->num_peers--; + ath10k_peer_map_cleanup(ar, peer); } } spin_unlock_bh(&ar->data_lock); From patchwork Mon Oct 24 11:29:51 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 10017 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp622177wru; Mon, 24 Oct 2022 12:44:54 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7vgS+4x6cdCrIsDHzTr66Wz8fyuDW5HFjTlF5mW677c78Q0aNuBg9ooXmQFOhbm/+0Kebx X-Received: by 2002:a17:907:6d18:b0:78e:259d:c391 with SMTP id sa24-20020a1709076d1800b0078e259dc391mr29229286ejc.615.1666640693908; Mon, 24 Oct 2022 12:44:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666640693; cv=none; d=google.com; s=arc-20160816; b=j8R+WFIV1kTHXx+72Imv4hAqt0yHbXoPQYhDQgCkPTOxhh0sJaONj1e3+r6ErFjJf0 6TVm+hxfRY/0DqDyYehjdlG8WcMQsJnjuOPQP+Oc1PimGQn1O5mCbW6DZLJbpO2o2CM8 K/aEeQdw6LvcK5MJTmxDQXv0gKqVCwMduhybpszzNo+uNg7E3HV03SsnzPF5RCN/fm81 FJHQhvxta5lJZjTbClvRTuKAYh6QhPaWVc4haJOoOXKbZiWzRD2TrV4hUFDwrM110HWr AJM1Y9uBhDaxB8wev7IQkVE3ysLW+6LTswM+joG95p9Kx2jBB2Q9LS1/x+X14doQDAk5 UCDA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Bl9h3Ayx0vlpoZHSWMlJwxNPMPnDfrrsj+W1i5MNqYE=; b=uohFu3I+gUqu8yZAHJVQAv7zkjsPk7H6+gJDjH8G7YuQUrO1/ZB/J6bjHsfR/FDPNN LQsvK0GzFEEqPidXcz2TmUrVjNn3/KykAkWgal3o5Y/Z8ijVrKaFtO2qILWfZneUnfql awMFCHuCelL9C8bBXJ2/CjN9xai8PwZ3kYYXbkgDne6+cNytx3hq7zO730GrL8b3+xPN i1eKhUdB1ha8HqjSjeRZ321Z+ht/CbhS/xdcwALAZ9K74ZxH0GhjTWgwSlwIC/UYruI6 508S3/0/V1YTevgDemMQgizvDLVbH8FkU4tjLfdmX3ZNwMkjpIrTneH3fAMz7XQ74zeQ xC1A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=CiHEjh55; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id dm21-20020a05640222d500b00461c9edc3a5si575203edb.77.2022.10.24.12.44.25; Mon, 24 Oct 2022 12:44:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=CiHEjh55; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232855AbiJXTho (ORCPT + 99 others); Mon, 24 Oct 2022 15:37:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44644 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229571AbiJXThU (ORCPT ); Mon, 24 Oct 2022 15:37:20 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B07231A1B2B; Mon, 24 Oct 2022 11:07:45 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 807F3B811F0; Mon, 24 Oct 2022 11:57:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D81E0C433D6; Mon, 24 Oct 2022 11:57:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612664; bh=505urnuajDADdjKpJXCrkWDj0DTk+ko2H4lq40J9GpU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CiHEjh55BtlAJAXf9bQgxStEx5HhAOhgoKlDt5mmZi7mtMRjXb097gy7tEGGNpZKl DPs7pkezovEUa6lgqZASNSQkOTwZuJd1+WRjj5uN5kmMaqCeAZU/KJGEWEQAdpJc5w IVqbFFZfEfnVdNqcBY3gsYhUgtdY2vd5tXmhgiVE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hari Chandrakanthan , Johannes Berg , Sasha Levin Subject: [PATCH 4.19 072/229] wifi: mac80211: allow bw change during channel switch in mesh Date: Mon, 24 Oct 2022 13:29:51 +0200 Message-Id: <20221024113001.410601924@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747599432475654791?= X-GMAIL-MSGID: =?utf-8?q?1747599432475654791?= From: Hari Chandrakanthan [ Upstream commit 6b75f133fe05c36c52d691ff21545d5757fff721 ] >From 'IEEE Std 802.11-2020 section 11.8.8.4.1': The mesh channel switch may be triggered by the need to avoid interference to a detected radar signal, or to reassign mesh STA channels to ensure the MBSS connectivity. A 20/40 MHz MBSS may be changed to a 20 MHz MBSS and a 20 MHz MBSS may be changed to a 20/40 MHz MBSS. Since the standard allows the change of bandwidth during the channel switch in mesh, remove the bandwidth check present in ieee80211_set_csa_beacon. Fixes: c6da674aff94 ("{nl,cfg,mac}80211: enable the triggering of CSA frame in mesh") Signed-off-by: Hari Chandrakanthan Link: https://lore.kernel.org/r/1658903549-21218-1-git-send-email-quic_haric@quicinc.com Signed-off-by: Johannes Berg Signed-off-by: Sasha Levin --- net/mac80211/cfg.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c index 9348caf1c611..5659af1bec17 100644 --- a/net/mac80211/cfg.c +++ b/net/mac80211/cfg.c @@ -3136,9 +3136,6 @@ static int ieee80211_set_csa_beacon(struct ieee80211_sub_if_data *sdata, case NL80211_IFTYPE_MESH_POINT: { struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh; - if (params->chandef.width != sdata->vif.bss_conf.chandef.width) - return -EINVAL; - /* changes into another band are not supported */ if (sdata->vif.bss_conf.chandef.chan->band != params->chandef.chan->band) From patchwork Mon Oct 24 11:29:52 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8764 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp430394wru; Mon, 24 Oct 2022 05:41:26 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5utlO49FbBw/kLlhULifZzH6AVO7zspoNO3YP1QSFzVjCGntYHEKvE97m9NwzI+9TpMKlD X-Received: by 2002:a17:902:e952:b0:17c:7aaa:c679 with SMTP id b18-20020a170902e95200b0017c7aaac679mr33498749pll.74.1666615275396; Mon, 24 Oct 2022 05:41:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666615275; cv=none; d=google.com; s=arc-20160816; b=t8PJQIjdYZ+ak4h7VuSDsrgywHpaNExstHvorYvkTYYP1A2B0lZh524HBgmNbyXWyW trKCh/FTCZXPik+NTWJ1H6k3DHM8abOQ+LjmDUzUZ5SM37QS6mM2p1c2mHmclwKjuXgH WGxQCFuafHeEakAlSe6WpWOcaHKCGdQFIW/SpXj85KlMoNCQH2moXnuMwzgWgf5RrDLg oNz5s6sTEi5ndX8fNVUWHsAA51z2AAYYxlmnAuK6XtAjTeri52g1K/zcvfGhkQE4K6Ny 9OW0TOEF0Lee+K1dfJ+jzMIC01CKOKX9TBAQj6F0q75m9j1T2mpaHFQFNpgqHuRrLvUm BLiA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=ybSxrX7hcAt3drMvU0n+pdIUNlht54SS59SFNWC2epU=; b=iH0gUY7jbsVaLXymVeOWNYMdxzBpoSaOx5wAxQgHzRZfgllFEEKo1WsGHx+36Cmamh EGfpy6gVDp73v1wmsoRhhlDUPApNZdob8DnvIfKNHBcwY4vb1iP4tfC1uieXzTpmcHAf KCg/J6DiegyP2+U1pzfZ/hbP3E4cYcHmsNgZRGgVM0HjOnVqPtXJPvrLKj1C2+spR6eo FQ4xpo62dwKo/+dVdmnRnQ/aFmNgVwcNDergbWoXZTJpz7bgMCdi+hwioRoa3e6cRY/L HbhZGFFhElZExinrCaJjJyH+Pr3YVuYFkrOOnzvH/A3fq5mpfTNTK4st3XDc8Yn9ydzg u+aw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=SDHwTNwC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a187-20020a6390c4000000b0046b172c5c54si33592792pge.561.2022.10.24.05.41.01; Mon, 24 Oct 2022 05:41:15 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=SDHwTNwC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233926AbiJXM3C (ORCPT + 99 others); Mon, 24 Oct 2022 08:29:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57336 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233793AbiJXM2P (ORCPT ); Mon, 24 Oct 2022 08:28:15 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 696CB86F91; Mon, 24 Oct 2022 05:02:04 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 13944B811A1; Mon, 24 Oct 2022 11:57:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6FF22C433D6; Mon, 24 Oct 2022 11:57:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612666; bh=5jtB3YGE+UAWdXBMYTNVATKere32q+gsH1tPZl6hWoM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SDHwTNwCSY0/Ws6vMTU5gUXHHlWzeHW/LLXx6op88He78KLdQa3dMKWBLJj8xBdgb lWuowtxMxjl+viFuFSPRA/1qwjQoCckouMj8aqhTJok4JjqvKL748SiaVziYv2U+rs o39YoL+S2Few9VlKvsvbBJk132E+FStbfqV9aQW0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Lam Thai , Andrii Nakryiko , Quentin Monnet , John Fastabend , Sasha Levin Subject: [PATCH 4.19 073/229] bpftool: Fix a wrong type cast in btf_dumper_int Date: Mon, 24 Oct 2022 13:29:52 +0200 Message-Id: <20221024113001.440029793@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747572779081133057?= X-GMAIL-MSGID: =?utf-8?q?1747572779081133057?= From: Lam Thai [ Upstream commit 7184aef9c0f7a81db8fd18d183ee42481d89bf35 ] When `data` points to a boolean value, casting it to `int *` is problematic and could lead to a wrong value being passed to `jsonw_bool`. Change the cast to `bool *` instead. Fixes: b12d6ec09730 ("bpf: btf: add btf print functionality") Signed-off-by: Lam Thai Signed-off-by: Andrii Nakryiko Reviewed-by: Quentin Monnet Acked-by: John Fastabend Link: https://lore.kernel.org/bpf/20220824225859.9038-1-lamthai@arista.com Signed-off-by: Sasha Levin --- tools/bpf/bpftool/btf_dumper.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/bpf/bpftool/btf_dumper.c b/tools/bpf/bpftool/btf_dumper.c index 1e7c619228a2..2da43d930ed3 100644 --- a/tools/bpf/bpftool/btf_dumper.c +++ b/tools/bpf/bpftool/btf_dumper.c @@ -164,7 +164,7 @@ static int btf_dumper_int(const struct btf_type *t, __u8 bit_offset, *(char *)data); break; case BTF_INT_BOOL: - jsonw_bool(jw, *(int *)data); + jsonw_bool(jw, *(bool *)data); break; default: /* shouldn't happen */ From patchwork Mon Oct 24 11:29:53 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8888 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp433648wru; Mon, 24 Oct 2022 05:50:06 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7uFlEOWHD3K9WkWpuC71lipBxJ8WVC78fqcskSE7hBDDHYxTAPEg5Yun0gaKsLJaUyhOUC X-Received: by 2002:a17:907:2e01:b0:78d:f24b:7330 with SMTP id ig1-20020a1709072e0100b0078df24b7330mr27072311ejc.604.1666615806339; Mon, 24 Oct 2022 05:50:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666615806; cv=none; d=google.com; s=arc-20160816; b=RAuuP3AbSA6z7Lg8PWuN995FN3/DwSMuW3OQd9cDscIWyLcJbXbkHqh7T4Ahi7lyRM 1LujJ9pyORjycasF4jyqmc2LiyJzEEMxKkFlOQS90Qq7zwCFuaU2FqUiSOtMymW4GaZM WnsIy+Y09Mo24KdNy8IUlyThcEQNvaFgDo22T1IhBfu5ROi0QxKla2amaz/1BF0XvyYV IsttsOnseqtbt4BQDamgFy6e7PNaNdLBGZdxxuswgZBzKniMOw0OpTVlVMiEfFRgCg+8 7xfDuDvFYJ0GF2njDbVagXsqROppw06p4Hg0t9lwGYcolQh30kKNCVp016Quhdjg7Jsi 6nYw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=l/Tfg7KbD+6wEL0iyDMk9UVQk6X39Y4YbL2BaHhBCa4=; b=GJgJH/J+QZWLkMSkUlc+YbTgKmTCnBjddyxnTGa7hO4DEiW9OcD+67M8mxDyhr7uzW CMmUlOJ3w4WJh0CPMDoiT/WjzqBf00xrzy5VbeHmtcQTTrNwn3WmT+nVyMAePzAgNPUG 8fBcGxUYcEZj5mbUsTO2oZ3FtQRqYFUMp5e/hEVqfR6eoU51xpGJ/iPLUvJ6440KbvpL XtUKxjI7iszTaLilwF/CijuZxXV+cc0jmQ8LWrFDN16wkm/hqC/eszkuDdT+fZzRbk5h 4YE3miXxHwWq6MfEDbX7wodyreWNsVPvRsKUxsGIU5xqPRpUvtlYwb7DA4xER+SIf7Qn CQUg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="L/HhGeQR"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m15-20020a056402430f00b0043d54ba0a4dsi33530349edc.327.2022.10.24.05.49.42; Mon, 24 Oct 2022 05:50:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="L/HhGeQR"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234362AbiJXMs0 (ORCPT + 99 others); Mon, 24 Oct 2022 08:48:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38270 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234284AbiJXMoH (ORCPT ); Mon, 24 Oct 2022 08:44:07 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BA03A7EFCF; Mon, 24 Oct 2022 05:09:05 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 0373461259; Mon, 24 Oct 2022 11:57:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 191F8C433D6; Mon, 24 Oct 2022 11:57:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612669; bh=brYtHU42pdCzx+EVdOKsAMZy1gp+KJ7GwY6PpsFheis=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=L/HhGeQR/5Lajsc4pQjxpeM4uCE5eGpzWpMpIdmDYUKy69M5Rn1+LgLVNyywu1j5u r8iWWd4nS5kjF4YirfFi/Rs4flqFaUgYZVVvoHDW6LV/LkH4MbqgY1dqt65/eP5+Zd bjojZ3pK8Kkk3EoxgeZcB/SlQFOE72PLvzSGdi8o= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Christophe JAILLET , Matthias Brugger , Mark Brown , Sasha Levin Subject: [PATCH 4.19 074/229] spi: mt7621: Fix an error message in mt7621_spi_probe() Date: Mon, 24 Oct 2022 13:29:53 +0200 Message-Id: <20221024113001.469797349@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747573335876956520?= X-GMAIL-MSGID: =?utf-8?q?1747573335876956520?= From: Christophe JAILLET [ Upstream commit 2b2bf6b7faa9010fae10dc7de76627a3fdb525b3 ] 'status' is known to be 0 at this point. The expected error code is PTR_ERR(clk). Switch to dev_err_probe() in order to display the expected error code (in a human readable way). This also filters -EPROBE_DEFER cases, should it happen. Fixes: 1ab7f2a43558 ("staging: mt7621-spi: add mt7621 support") Signed-off-by: Christophe JAILLET Reviewed-by: Matthias Brugger Link: https://lore.kernel.org/r/928f3fb507d53ba0774df27cea0bbba4b055993b.1661599671.git.christophe.jaillet@wanadoo.fr Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- drivers/staging/mt7621-spi/spi-mt7621.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/staging/mt7621-spi/spi-mt7621.c b/drivers/staging/mt7621-spi/spi-mt7621.c index 75ed48f60c8c..b73823830e3a 100644 --- a/drivers/staging/mt7621-spi/spi-mt7621.c +++ b/drivers/staging/mt7621-spi/spi-mt7621.c @@ -442,11 +442,9 @@ static int mt7621_spi_probe(struct platform_device *pdev) return PTR_ERR(base); clk = devm_clk_get(&pdev->dev, NULL); - if (IS_ERR(clk)) { - dev_err(&pdev->dev, "unable to get SYS clock, err=%d\n", - status); - return PTR_ERR(clk); - } + if (IS_ERR(clk)) + return dev_err_probe(&pdev->dev, PTR_ERR(clk), + "unable to get SYS clock\n"); status = clk_prepare_enable(clk); if (status) From patchwork Mon Oct 24 11:29:54 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8968 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp437078wru; Mon, 24 Oct 2022 05:58:51 -0700 (PDT) X-Google-Smtp-Source: AMsMyM493uB2Vzn8R+ZMhHZaftY9XC7TmRWtxXdP8eH/wIWmwGHjBko9scLNI6RnT10It/2wTQ3e X-Received: by 2002:a17:903:1211:b0:178:a692:b1e3 with SMTP id l17-20020a170903121100b00178a692b1e3mr34431838plh.48.1666616331075; Mon, 24 Oct 2022 05:58:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666616331; cv=none; d=google.com; s=arc-20160816; b=R5Stqx0llzf+FUX2PECfvWBsc14j+1UhnGkfzszKueo+e2LEy9DVWBs1nja7dHYszi nywrK1WoPYhoxIgTSVcJPUbNO3a1LXJvpCGOxjvYupbSLKeuydEc13HlRlcGua367vOo kE8AVE1kGKOdihfWCP8W1T/i8iw8cITf+hDWHYU52nBlVpPdSGyPcS2FXCh0hymp2kv9 CZLAvvQ3uU3KosxWOcAR+CF21/esjbtMHnhequGxQmIP9mUuZaloRpVBDHigy2BAEpkp +CNpB9h99DyBwfGTQukkqq7i+GcJl5dQsnO42a1Cdc19g/fo+9yu/azNyN69jlBkquXp j1zg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Qj0lAfOHOZ+/lqqF0a54WBy1Klx/sYbjtdwHo0GO9I4=; b=pM0ttyAmDbyFcH2RS3p5vlfbi8Qfr/KqqpkEMev6iiWoe3P43y9bPNqPaNmo0dsAVP /A82yGNQWEMdd5RR5hmgMJE9XfyVqecC5Sx2POFUrJ3fLOllPPi3xYkBbTWKo67whJVj I/AOMqVnTtYU5fR5EQI9r2/IuYRF/5s+00b5w+zDCGaIjnahb2HH9Vvp1maXUcc1kZw8 zZEWn60cpYwqj2jnjVawyhW5rwKbcfp+7ixCMNVhIpvqXdmC/XlGzo0TOQ4UduL2Yvii asItlC/2mmZ69RcQm2EExLCqBa66vax51GfWqs4PmGMhpfxid51wxjbDskmYEl2OcADn Xojg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="Qu8mdS//"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h4-20020a056a00230400b0056bc14f1cd2si4352237pfh.10.2022.10.24.05.58.36; Mon, 24 Oct 2022 05:58:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="Qu8mdS//"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234883AbiJXM6U (ORCPT + 99 others); Mon, 24 Oct 2022 08:58:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41064 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234855AbiJXM53 (ORCPT ); Mon, 24 Oct 2022 08:57:29 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 65AEA97D4D; Mon, 24 Oct 2022 05:16:54 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 9EF0E612B2; Mon, 24 Oct 2022 11:57:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B371BC433D6; Mon, 24 Oct 2022 11:57:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612672; bh=z6WHpchUL7v1QNUs+Lx3TStTDhBohf0Lipf4W3Q1V8s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Qu8mdS//86KlM4pK8BT8KoF5XXS6+TB2UBnaVpdTTzuKrlkvJ2XDR929Y+fNVcgNs bmcsDDRTLaNkPSnSR6G2JYjPrrvr0o4zKkHxTZVopxw3zp2KY/3vzbZzfLLXyxY0A2 ogPRZR5ZJCnRDN37WJ4S7Aq3W7uQbzCYEz7wExXc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dan Carpenter , Jes Sorensen , Kalle Valo , Sasha Levin Subject: [PATCH 4.19 075/229] wifi: rtl8xxxu: tighten bounds checking in rtl8xxxu_read_efuse() Date: Mon, 24 Oct 2022 13:29:54 +0200 Message-Id: <20221024113001.502996260@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747573885649953066?= X-GMAIL-MSGID: =?utf-8?q?1747573885649953066?= From: Dan Carpenter [ Upstream commit 620d5eaeb9059636864bda83ca1c68c20ede34a5 ] There some bounds checking to ensure that "map_addr" is not out of bounds before the start of the loop. But the checking needs to be done as we iterate through the loop because "map_addr" gets larger as we iterate. Fixes: 26f1fad29ad9 ("New driver: rtl8xxxu (mac80211)") Signed-off-by: Dan Carpenter Acked-by: Jes Sorensen Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/Yv8eGLdBslLAk3Ct@kili Signed-off-by: Sasha Levin --- .../net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c index b80cff96dea1..dd345ed1a717 100644 --- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c +++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c @@ -1879,13 +1879,6 @@ static int rtl8xxxu_read_efuse(struct rtl8xxxu_priv *priv) /* We have 8 bits to indicate validity */ map_addr = offset * 8; - if (map_addr >= EFUSE_MAP_LEN) { - dev_warn(dev, "%s: Illegal map_addr (%04x), " - "efuse corrupt!\n", - __func__, map_addr); - ret = -EINVAL; - goto exit; - } for (i = 0; i < EFUSE_MAX_WORD_UNIT; i++) { /* Check word enable condition in the section */ if (word_mask & BIT(i)) { @@ -1896,6 +1889,13 @@ static int rtl8xxxu_read_efuse(struct rtl8xxxu_priv *priv) ret = rtl8xxxu_read_efuse8(priv, efuse_addr++, &val8); if (ret) goto exit; + if (map_addr >= EFUSE_MAP_LEN - 1) { + dev_warn(dev, "%s: Illegal map_addr (%04x), " + "efuse corrupt!\n", + __func__, map_addr); + ret = -EINVAL; + goto exit; + } priv->efuse_wifi.raw[map_addr++] = val8; ret = rtl8xxxu_read_efuse8(priv, efuse_addr++, &val8); From patchwork Mon Oct 24 11:29:55 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8766 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp430419wru; Mon, 24 Oct 2022 05:41:29 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4hpEW+TEYI+BHLUpIr+0K48l7cvEmEI/BW0bxz0BcAtb3e4O2SYQyut8nOY6nOpcQWgJN0 X-Received: by 2002:a05:6402:50d3:b0:461:ba8a:8779 with SMTP id h19-20020a05640250d300b00461ba8a8779mr5658081edb.411.1666615289461; Mon, 24 Oct 2022 05:41:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666615289; cv=none; d=google.com; s=arc-20160816; b=F8+Rc2q3UhSMxk4kUsTA7ZYpwS7aoBlCXm3PcGt9DC3mV7Hn3H52NPjvnlXSwtUIes RFIyhjO2n7TwX9rcwUai4l4j0N2oWHNEUmN7EEgB89tPgjNOI9aUebwja35iHrBzIN8z mwij0LR5bg7Ak8aVtWaadsK36JenE32+74VPVaAnlistK2Sh5rYTeMjtEn3tlWhVwLYF H6sgJsUY945FkozNKZ6HhSLguJDbfd1xfqdGzLoy0b0oPby17aCMXJvIjrveK7uIh2ET J1LlPEyElbeoU5elH+IjyWKZmxuL9p0Yj1pg/WXRfd8n3T9jCriybdYjjZs+02IwQxaI 8JeQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Ltioo1cUxSjO/ajzzZRy7JIKD/bLDfSkewSjDzNolrg=; b=RzrcHfvx0R2Ml1yubb+2iBHlQnmT8RnpTLEfRu3tv07gWFO9WewlSZd0g6POu8tgvL Ul/MGPF/ZWvyRnJDsGyNf1C2Q/AY6HzAsmZvw7Ti+teHDs2r31QWafxdZ0lYeLwvDUUY iIzXyiIz9B4ev1w7BJNF2v2njeTGbYTRxaZ+7Ji7xRaA0Nb6jmv8LA2kiwKoe4rtPSVH vQRoqwWhW0jry2Bs/Ag2GR/cuFz/v6MPE1sdDRu4oN3o75ULrSSYU+vV4W6SW/WGC6wA LF/PM2orsNtl2m2Y2PXoAOxqPnoQxSAdhjvuvwuuaSoHiYegy9BhqHSIc+aZITT2aLoH Pp/Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=tdlsy5qf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x6-20020a05640226c600b00461c5846e1asi3263980edd.371.2022.10.24.05.41.04; Mon, 24 Oct 2022 05:41:29 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=tdlsy5qf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231403AbiJXMah (ORCPT + 99 others); Mon, 24 Oct 2022 08:30:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48924 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233846AbiJXM2Z (ORCPT ); Mon, 24 Oct 2022 08:28:25 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 157617656B; Mon, 24 Oct 2022 05:02:07 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id ECD45B810DB; Mon, 24 Oct 2022 11:57:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4C8EDC433C1; Mon, 24 Oct 2022 11:57:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612674; bh=yXMCTS8eONU++mGlDljHj3JlkYoORL7wIFX0W3Arlcs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tdlsy5qfHfI8Wgiw77L9rac5tL7dCUaOGgpbdL8naoYhfdqeUJcZG0NpCAndzeE+p wXgD6Xks30kCfW2LRe5P7uqDL8n8fYSJxWLv2V9RJERJZ5X2V2GCuyzpUHsV5YRwVV xuG4I/N83L1rxIv8uQ7dTlSgfcUz0Jn9nu4nYN0A= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Xu Qiang , Mark Brown , Sasha Levin Subject: [PATCH 4.19 076/229] spi: qup: add missing clk_disable_unprepare on error in spi_qup_resume() Date: Mon, 24 Oct 2022 13:29:55 +0200 Message-Id: <20221024113001.532215271@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747572793796977739?= X-GMAIL-MSGID: =?utf-8?q?1747572793796977739?= From: Xu Qiang [ Upstream commit 70034320fdc597b8f58b4a43bb547f17c4c5557a ] Add the missing clk_disable_unprepare() before return from spi_qup_resume() in the error handling case. Fixes: 64ff247a978f (“spi: Add Qualcomm QUP SPI controller support”) Signed-off-by: Xu Qiang Link: https://lore.kernel.org/r/20220825065324.68446-1-xuqiang36@huawei.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- drivers/spi/spi-qup.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/drivers/spi/spi-qup.c b/drivers/spi/spi-qup.c index cb74fd1af205..c5c727274814 100644 --- a/drivers/spi/spi-qup.c +++ b/drivers/spi/spi-qup.c @@ -1219,14 +1219,25 @@ static int spi_qup_resume(struct device *device) return ret; ret = clk_prepare_enable(controller->cclk); - if (ret) + if (ret) { + clk_disable_unprepare(controller->iclk); return ret; + } ret = spi_qup_set_state(controller, QUP_STATE_RESET); if (ret) - return ret; + goto disable_clk; + + ret = spi_master_resume(master); + if (ret) + goto disable_clk; - return spi_master_resume(master); + return 0; + +disable_clk: + clk_disable_unprepare(controller->cclk); + clk_disable_unprepare(controller->iclk); + return ret; } #endif /* CONFIG_PM_SLEEP */ From patchwork Mon Oct 24 11:29:56 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8704 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp422918wru; Mon, 24 Oct 2022 05:23:38 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6fGzTH/1HbNt5MVh+DJ+RfGRt71u/W8Qf2DwEtfuZ27NApjEJiz0Y1ofBH+/UY3OUEXNJ1 X-Received: by 2002:a17:907:3da2:b0:78d:45df:b4f with SMTP id he34-20020a1709073da200b0078d45df0b4fmr26700979ejc.651.1666614218527; Mon, 24 Oct 2022 05:23:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666614218; cv=none; d=google.com; s=arc-20160816; b=elMeGkM8IRrXkTAc1Zwc3h4mRuR5me1+Gkp9vZMAOSg69PyfQL0cn7Y84qJm7z2h67 3KY9bkXBzgRI5zLd2VystNubAoB2zU1ubYt+25MLgRj4ODBACbglkM1yMX5B+bpUaJT9 IEIqFbEsvAtAr3h9IEEZCJFKtOEMX+3edxMfPAvhJVne7vilJwreEtPvN2OS+oxoFyEX 2z3SMtwqf4c5nIEhUmWhS1QTChaqOWgzSBJrOXIo5A/1D1Jjt+cBfJ0vr7X+jFejo1va F3liLLYPvKRBneybzXQ699Sk32MfrumYFie3MEFMTpIDEL1r/4+oo3kzOyO1XemgAzLK UpgQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=5k5F37oYNEmCHEgQoezfMItExK0RqaWxSVY7Rl77OuQ=; b=h3dTzTtRT8SobKRVCoZOGPq5i58YDcZNMA47aT3jPor4/liosJNUJCpWqk0pF9rtL+ MRIx3nE8jZFV0+ix2Rr/edajVuioqM5efcy3n0Mlw42Duuoo7eR4SBpbMO/eEZW4Imb7 YDAd04ChV2w88RAGrRjlNIUsNojaywZ29JLwIRqaecFjzzybzK9Hfeajm8yNymt3lV6/ EuaYIuf+Aci5cvpmIOD5iYdCRZB6CTMVUufNL+GAY9YGqITCe9iNA9gvjeONwhLKPFZS oCkMcWATkQ0KQVerb9SBopgB14pqlgpqYzLZe21itaP7Lf4PPfeaaiX4cUa9HB+uuClk WibQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=bJ3yL4Rz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id oz12-20020a1709077d8c00b00781e17d3699si10658976ejc.203.2022.10.24.05.23.13; Mon, 24 Oct 2022 05:23:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=bJ3yL4Rz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231392AbiJXMWX (ORCPT + 99 others); Mon, 24 Oct 2022 08:22:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40684 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233598AbiJXMTz (ORCPT ); Mon, 24 Oct 2022 08:19:55 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 567FA836C1; Mon, 24 Oct 2022 04:59:00 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id C714B612D2; Mon, 24 Oct 2022 11:57:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DCB30C433C1; Mon, 24 Oct 2022 11:57:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612677; bh=1dNVR3X2IySjniVZceBtGxiJ2W3mMOjlJ9Z7yNLlviY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bJ3yL4Rz36fXRYrfEoC7gdEP6IMpuBqiF65LBoeui5XSgLsvaNXdl2Rbd8W2LGJWS P9dITkQrO1JwtOmLUkgGFX+3MrNrJtZGj8uKoKI+8V4EhoepNOhJeIdF670eQs9ZHl SFxvRybudfY1fWS1fHWYpBO+802c/1Ob0moqZbhw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Xu Qiang , Mark Brown , Sasha Levin Subject: [PATCH 4.19 077/229] spi: qup: add missing clk_disable_unprepare on error in spi_qup_pm_resume_runtime() Date: Mon, 24 Oct 2022 13:29:56 +0200 Message-Id: <20221024113001.561231833@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747571670869139009?= X-GMAIL-MSGID: =?utf-8?q?1747571670869139009?= From: Xu Qiang [ Upstream commit 494a22765ce479c9f8ad181c5d24cffda9f534bb ] Add the missing clk_disable_unprepare() before return from spi_qup_pm_resume_runtime() in the error handling case. Fixes: dae1a7700b34 (“spi: qup: Handle clocks in pm_runtime suspend and resume”) Signed-off-by: Xu Qiang Link: https://lore.kernel.org/r/20220825065324.68446-2-xuqiang36@huawei.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- drivers/spi/spi-qup.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/spi/spi-qup.c b/drivers/spi/spi-qup.c index c5c727274814..1ca678bcb527 100644 --- a/drivers/spi/spi-qup.c +++ b/drivers/spi/spi-qup.c @@ -1172,8 +1172,10 @@ static int spi_qup_pm_resume_runtime(struct device *device) return ret; ret = clk_prepare_enable(controller->cclk); - if (ret) + if (ret) { + clk_disable_unprepare(controller->iclk); return ret; + } /* Disable clocks auto gaiting */ config = readl_relaxed(controller->base + QUP_CONFIG); From patchwork Mon Oct 24 11:29:57 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8768 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp430434wru; Mon, 24 Oct 2022 05:41:32 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6shHQrPOPIwmaYqzUyqSSZXIEKmLY6+w3C49ZDmZfQuiMzpS7SPDKzQYVwg98A2B4zQG0T X-Received: by 2002:a17:903:509:b0:179:ffcf:d275 with SMTP id jn9-20020a170903050900b00179ffcfd275mr33334573plb.150.1666615292071; Mon, 24 Oct 2022 05:41:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666615292; cv=none; d=google.com; s=arc-20160816; b=VKSdAQ+WpiEkM18OgHIPo/6Eu/aDg9SG5grU4INiJaVu/jcurVcFFz8n5id4ZCRWI7 KZPsEmbIcB+B0WU5eu7XLJK7ks/XkShViVQohEpblwp6d9DjZ72CKW7qK8Pm9YmlGitW Sxq1Q+yGHYA8yom7nzs+SgnwLxrK7sOWB0sEF4fN/EmPhKvxIS04ta2FRHPykTlhYkRZ fRPUuEk70QE/qAlzdkYA5DWPVimz3Boa3J654qCG6uxGg4dxulQS8HSssT0vv+ZqTPve 8b6o0v8Z2d2PVuRgMYVeQNJAtoX1MAs1dn37T01rkiwFCsyT2BO3CE2HBhcag4B+n4sm LpWA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=HGiYgE9Q4NvFlOnIQDgo8kc9zDmr6VUfKUUtUod5tts=; b=kobJxMBzlnSiz3yVyi9ZkSvXpzd8N2Fo4a7EawMBG4pHo5db8isG3geiTYGOfuyjUy U78Ve/CBl3/rd48XcnS5+4RKB1XnHKvxjttdPqzdECtJumdS0ZvP5xcrGmcezGQg28g8 XLYC2eFm3tOX+8+KDvRnlUKcvuNQ/K/lmWFbUc8N1RaWs2d9QOgH/8fBW507wP2oHUUG ORkg8yg0Tk0mpI4oH2V+Wt82KW55S2F6uLQ9newzOcCR4pduCd3Yvbd6C8joUNmhycPk aHG5d0wuMxy2pwsfiaAf7RwhBxkBQvBKbFMUWPd42SvIpXOvbkWzavtvSmkqYsr5FxEd y6XQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=g6O01pwL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f62-20020a623841000000b0056bf15d0cbfsi1687571pfa.308.2022.10.24.05.41.19; Mon, 24 Oct 2022 05:41:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=g6O01pwL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233781AbiJXMas (ORCPT + 99 others); Mon, 24 Oct 2022 08:30:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60560 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233853AbiJXM20 (ORCPT ); Mon, 24 Oct 2022 08:28:26 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3304F84E49; Mon, 24 Oct 2022 05:02:07 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 2A81AB811EC; Mon, 24 Oct 2022 11:58:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 76EF2C433D6; Mon, 24 Oct 2022 11:57:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612679; bh=uFYB0cMrlpLGVch5KrvwzaqTPsuapCqPShLgRKBJC3Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=g6O01pwLlDLiFgkcFQ9R+Sg8R2HCKZhk7yvJgH/93f0pLEMosLGBsHlopUqXL+6IN iJqdTu0YXeQZBmYPv3Lohx/FPWBQdEzP93+uUj+SpXPk5hxu3clBddJ+GtrWEzqkn0 6L8CyS8497GXiRtr/G8QlOhb2tgJiaVfPwfmfQFU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Bitterblue Smith , Kalle Valo , Sasha Levin Subject: [PATCH 4.19 078/229] wifi: rtl8xxxu: Fix skb misuse in TX queue selection Date: Mon, 24 Oct 2022 13:29:57 +0200 Message-Id: <20221024113001.589827008@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747572796480898185?= X-GMAIL-MSGID: =?utf-8?q?1747572796480898185?= From: Bitterblue Smith [ Upstream commit edd5747aa12ed61a5ecbfa58d3908623fddbf1e8 ] rtl8xxxu_queue_select() selects the wrong TX queues because it's reading memory from the wrong address. It expects to find ieee80211_hdr at skb->data, but that's not the case after skb_push(). Move the call to rtl8xxxu_queue_select() before the call to skb_push(). Fixes: 26f1fad29ad9 ("New driver: rtl8xxxu (mac80211)") Signed-off-by: Bitterblue Smith Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/7fa4819a-4f20-b2af-b7a6-8ee01ac49295@gmail.com Signed-off-by: Sasha Levin --- drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c index dd345ed1a717..ccd76c1da40c 100644 --- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c +++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c @@ -4955,6 +4955,8 @@ static void rtl8xxxu_tx(struct ieee80211_hw *hw, if (control && control->sta) sta = control->sta; + queue = rtl8xxxu_queue_select(hw, skb); + tx_desc = skb_push(skb, tx_desc_size); memset(tx_desc, 0, tx_desc_size); @@ -4967,7 +4969,6 @@ static void rtl8xxxu_tx(struct ieee80211_hw *hw, is_broadcast_ether_addr(ieee80211_get_DA(hdr))) tx_desc->txdw0 |= TXDESC_BROADMULTICAST; - queue = rtl8xxxu_queue_select(hw, skb); tx_desc->txdw1 = cpu_to_le32(queue << TXDESC_QUEUE_SHIFT); if (tx_info->control.hw_key) { From patchwork Mon Oct 24 11:29:58 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8712 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp423128wru; Mon, 24 Oct 2022 05:24:10 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5QcL8oI7kKq7QLnSvbKq9ESlK2GaBXHXS2L6eW3LEMBtQ53B5wgJS75vfpyQnCAGoCaVJp X-Received: by 2002:a05:6402:380a:b0:451:ae08:7a6c with SMTP id es10-20020a056402380a00b00451ae087a6cmr29664421edb.161.1666614250111; Mon, 24 Oct 2022 05:24:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666614250; cv=none; d=google.com; s=arc-20160816; b=MKCMuLuL7serY/CtIMPH6PcNf67m5FenkVCpprqs+ZwKZXG51iB1RiB7lgoQUj7H8c PqZJU5RjAZBPSawEkRzma6ReBJi9C52/oFY9mSTCSQL+L9wJWL/pHj727VNv8LNnXic2 Dlz+keHsT6njaBa0tm7AIYZGnwJj4SJt6sgLN0K6UzborvjpEBWMLgmJPkuoCPS3WMuJ gTvWkVXVWrINrkIJKYOj/0tpjSQW1aEpOBB43MojMNVtferklD8fMnZIDyZubRYInMJD 5BIsy7bCcuLhKbTPpcPEzUVWXPSVSwncVL+NQ512ca1XcDla15ZeM2W7Gn/Jy3qB8fBO bkAQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=GuY8afL5pN2SYI0faU62yLXnulX5b35r9uAlsCLvo0s=; b=MnKGiwj7dwMpUH05gECssQalErZXNt+dWA4iBCnIdFj9A7C+AKelETV6fjeAEd9YoC lE6lmm7tHM4+MpJG9IO236Z9BzXeIleMFvfxP2xQvbInzrxB3mEu1P2cW2qI2fpah7ZZ stKQz3NAzMwjBbMxkxUagtFKltl/d9XRBYuwWWrQROoEzfS/v9e4wF84/D7+QhA/Vd7z 2i4yyaUCldk5ojfiW5fXlEQPDL7pN35sPQabL06D6x1v/A5JlPT61Q3ozYZLmPfVaRfL IcC8HQsvXiUKJ67ldZeGYnn82RkWuNeR3ID73LdcEWjtw4ip8dz3szDwBoOj+jINIoVE S0bA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=PXVcrBkg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e22-20020a1709067e1600b0073da5c8de1asi25730282ejr.178.2022.10.24.05.23.44; Mon, 24 Oct 2022 05:24:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=PXVcrBkg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233527AbiJXMWo (ORCPT + 99 others); Mon, 24 Oct 2022 08:22:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44404 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233242AbiJXMUT (ORCPT ); Mon, 24 Oct 2022 08:20:19 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5C91E7C1AD; Mon, 24 Oct 2022 04:59:02 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id A468A612C5; Mon, 24 Oct 2022 11:58:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B5CAAC433D6; Mon, 24 Oct 2022 11:58:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612685; bh=mjCwChMoj0gYfMSKB/1bs/M2Mqi6HjkqAeGsiTHVQ1k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PXVcrBkg3n+V3dfWIyv7JHmlwjjuKH37UFD9s9DuulHuqay6Zdn73E3b3eX8BG/8U XtJ0YE+Wi8QIXdLx1Gah1k2CU9Ek53YAxMIRE/o8t7R8q6EvbSFMOE2VtIp0RhlYSM sM0D1f/SmTLnSHqJ+DGXvTbGlujEQOhWuRmxxpQE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Stanislav Fomichev , Lorenz Bauer , Alexei Starovoitov , Sasha Levin Subject: [PATCH 4.19 079/229] bpf: btf: fix truncated last_member_type_id in btf_struct_resolve Date: Mon, 24 Oct 2022 13:29:58 +0200 Message-Id: <20221024113001.628698887@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747571704246651247?= X-GMAIL-MSGID: =?utf-8?q?1747571704246651247?= From: Lorenz Bauer [ Upstream commit a37a32583e282d8d815e22add29bc1e91e19951a ] When trying to finish resolving a struct member, btf_struct_resolve saves the member type id in a u16 temporary variable. This truncates the 32 bit type id value if it exceeds UINT16_MAX. As a result, structs that have members with type ids > UINT16_MAX and which need resolution will fail with a message like this: [67414] STRUCT ff_device size=120 vlen=12 effect_owners type_id=67434 bits_offset=960 Member exceeds struct_size Fix this by changing the type of last_member_type_id to u32. Fixes: a0791f0df7d2 ("bpf: fix BTF limits") Reviewed-by: Stanislav Fomichev Signed-off-by: Lorenz Bauer Link: https://lore.kernel.org/r/20220910110120.339242-1-oss@lmb.io Signed-off-by: Alexei Starovoitov Signed-off-by: Sasha Levin --- kernel/bpf/btf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/bpf/btf.c b/kernel/bpf/btf.c index 471cc5c117a5..62e05b6283c0 100644 --- a/kernel/bpf/btf.c +++ b/kernel/bpf/btf.c @@ -1660,7 +1660,7 @@ static int btf_struct_resolve(struct btf_verifier_env *env, if (v->next_member) { const struct btf_type *last_member_type; const struct btf_member *last_member; - u16 last_member_type_id; + u32 last_member_type_id; last_member = btf_type_member(v->t) + v->next_member - 1; last_member_type_id = last_member->type; From patchwork Mon Oct 24 11:29:59 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8714 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp423151wru; Mon, 24 Oct 2022 05:24:12 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6J0Pk+Y/gInRTxU1F85CnZrYc+YxAmegyNAWKFpPMPpS3ntLHWc+62cY7Z+SCub/rlJe7/ X-Received: by 2002:a05:6402:410:b0:451:ea13:4ed7 with SMTP id q16-20020a056402041000b00451ea134ed7mr31778695edv.262.1666614251940; Mon, 24 Oct 2022 05:24:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666614251; cv=none; d=google.com; s=arc-20160816; b=XdWQVTI6WM2Lb2HzA8Bi/C23ozjCLVgTJ5VK5DlYaJDZy3mfmLGdhy/bf3DSsrk+y8 bqo7beckcdaK9NjB7UpCEq8mxd7hXVWq6ZAGWjUVIR6by7YIO6N5Ihxa4+jxV7o9W7TO zgqtQwcj2ZxK1vtkSIelgZQbKNOCEaXGcDC79MF8ZZcdG56PrfcYn0cINhb9tgdPWj1K gzifZK0d4YqDOfxhsYYBdoUdvuRdwu+tmR42p/JqT8wmEg6FXInboiZJ67xGwy2Miuv6 nDjzAvndny2AXSbwN9uLjS9EnmZQwAVEjq5dBFOFkfd83p6n2GXeX8cF3tIKPgv3o4bs 45fw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=X9t+8q4cfCbn3lydR8dQMNGHMbrU1j4hCkeMhmRMZ/E=; b=nQcqj6Su1S0pgv01Sar9Q7SQIyHqrQbytmDq6H6MVeRnGsFBT8Hi3eENWy7Z6URbnI Rn7B0Lmp+Ci5ujTmnNbiW37lKEElsVzDIwjIvuMw2Ehe4mOqflQk9/wCuLeJQBzGu8ce PSWM8FOgNw/EUDWBKXrHxnKjOVL2eNSrFKePoB7KRsCrYtlm6ZSbeDQ2lnswHR8BzCZY cXetetoR/2nbIHjQSDy0lZILyX7OuRFt3dl3qGlp42DaHCC+BLkyVQBeYp/mdf3T6kJe /RmXijpSkNfLfvMiEzpM/pWxMQ8yjgUL2wvKRWGmi3BQxc+LCxjHp3efr4rrdTHfbs3z KaQQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=2tZVmwz6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m15-20020a1709060d8f00b0073db9474d06si24148006eji.325.2022.10.24.05.23.47; Mon, 24 Oct 2022 05:24:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=2tZVmwz6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233537AbiJXMWv (ORCPT + 99 others); Mon, 24 Oct 2022 08:22:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41256 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233305AbiJXMUi (ORCPT ); Mon, 24 Oct 2022 08:20:38 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DC18B7C19F; Mon, 24 Oct 2022 04:59:03 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 4325C612CC; Mon, 24 Oct 2022 11:58:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 57FA3C433D6; Mon, 24 Oct 2022 11:58:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612687; bh=Enjz/4GrQEe05c4RvFIjHeawUyag1ck9dA7+R5QI1io=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=2tZVmwz6v4Y05JqjJrUTkFIgqe4lYwMsvyhVoFmfTOimEqZRsQMnB3xdGWwl86lkA nLRYv4iIuqWYG5qIGIG8fRXASF438l/jDcvNhp3/mNvtFuNRfR85S8x+dUxrngnDH6 vb2AxxODEfU0u+YrWv4wqDE7IcXWcZ8xzeMVBLzk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Bitterblue Smith , Kalle Valo , Sasha Levin Subject: [PATCH 4.19 080/229] wifi: rtl8xxxu: gen2: Fix mistake in path B IQ calibration Date: Mon, 24 Oct 2022 13:29:59 +0200 Message-Id: <20221024113001.658750801@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747571705600828258?= X-GMAIL-MSGID: =?utf-8?q?1747571705600828258?= From: Bitterblue Smith [ Upstream commit e963a19c64ac0d2f8785d36a27391abd91ac77aa ] Found by comparing with the vendor driver. Currently this affects only the RTL8192EU, which is the only gen2 chip with 2 TX paths supported by this driver. It's unclear what kind of effect the mistake had in practice, since I don't have any RTL8192EU devices to test it. Fixes: e1547c535ede ("rtl8xxxu: First stab at adding IQK calibration for 8723bu parts") Signed-off-by: Bitterblue Smith Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/30a59f3a-cfa9-8379-7af0-78a8f4c77cfd@gmail.com Signed-off-by: Sasha Levin --- drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c index ccd76c1da40c..38f06ee98b35 100644 --- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c +++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c @@ -2930,12 +2930,12 @@ bool rtl8xxxu_gen2_simularity_compare(struct rtl8xxxu_priv *priv, } if (!(simubitmap & 0x30) && priv->tx_paths > 1) { - /* path B RX OK */ + /* path B TX OK */ for (i = 4; i < 6; i++) result[3][i] = result[c1][i]; } - if (!(simubitmap & 0x30) && priv->tx_paths > 1) { + if (!(simubitmap & 0xc0) && priv->tx_paths > 1) { /* path B RX OK */ for (i = 6; i < 8; i++) result[3][i] = result[c1][i]; From patchwork Mon Oct 24 11:30:00 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8778 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp430645wru; Mon, 24 Oct 2022 05:42:03 -0700 (PDT) X-Google-Smtp-Source: AMsMyM61oUF2hkGqNIffVGY0bxNDdGh6MSYBJgKUHSlof63SvWQb1Z3coldfwN3DHUWZFIux7ChK X-Received: by 2002:a17:902:6bc8:b0:179:fef9:b2fa with SMTP id m8-20020a1709026bc800b00179fef9b2famr33924583plt.96.1666615322673; Mon, 24 Oct 2022 05:42:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666615322; cv=none; d=google.com; s=arc-20160816; b=FJjkm6E00/pam+MJefbRuDwa8FxRjYEivhR548QHg7ZweEWVgMNRgbO5OAIBrySTmC CiNnI5M+m7XP74fxMmzP+/5eU20nDaQrCpyB7T+bo9MR4F/Jb1BPjZ2aEiVZzEtTAAcg DTVm+AtMHUfi0vmDTmKbneg4dlpV3MrixZ5cfTcnupsj03Ns0wY7uoxSbT9nf0JnV9Lm rt8TbThkHnGDGzLdBYJcGEdR/6R70mXjw5G4Yd1ZlNX6p81ma2l3LBdTRzIRBeCM+tOZ cbdqpT2mGGQILWgPsF52kU8GTwbrGXzQOp0r9yRU56lDQqAjC6/zrbEcxmNy9dWFpY5f kf9w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=2faJEEOkcg0BFFaPon09pTeCWDOh8zjLxsdn9OWF0Hw=; b=GBwRYIauJsRYaseoIHEsptHUEDQyOluazgaOjAW+kPxd5/sxf6uu10k9EP+DioSr7M HGIDE1ulcZuqhn4uFjv1qz5CYvxKJvXsKKZmoy87W0GCG2Ewv+W6IcVTNNAJ21UA/AHX N7VA2j9r16v0BX5Hggk3XxQCABUrvuFekmYapgEDBvQkUC00yXP7f9x6JUU/N7rhKLCH Fu7V8OsANtfGebSQHhdeYw7Ep1LQxGtMDIimyrp+4rtVUwsDCKEzy+heSioJRzpC2/c6 XDXg6KrCuz3PBEwhZAic2T/oT0E5TqE9N7IZpz7wf75qK89l0aCjqTPjVOV1F1gYuOvP pDwQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=TgigPlLQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 69-20020a17090a0fcb00b00213193e7047si2330126pjz.185.2022.10.24.05.41.44; Mon, 24 Oct 2022 05:42:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=TgigPlLQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231648AbiJXMcZ (ORCPT + 99 others); Mon, 24 Oct 2022 08:32:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45258 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233948AbiJXM3E (ORCPT ); Mon, 24 Oct 2022 08:29:04 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 843962677; Mon, 24 Oct 2022 05:02:51 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 516BBB81201; Mon, 24 Oct 2022 11:59:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A9975C433D6; Mon, 24 Oct 2022 11:59:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612796; bh=deb/+f+bTm4Ytyvf8OL7N3yZQGGpLOBi7QxH7ZECr8U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TgigPlLQVbYgO5449soBZfXp8F3lTBQy6MRK8yMjJaUegaMsWoTSJW3JNBP4RZT5S z9UuM/TqaozYETVO4KqY+Sxih1BOLTu2ISUYJvrxEinJkg2luEilETnAdcyrSAcgFQ b5V5ewqcXf00X1f0tSNZqL6ps5hkCuOvQnvpVSKk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zheng Yongjun , Christophe Leroy , "David S. Miller" , Sasha Levin Subject: [PATCH 4.19 081/229] net: fs_enet: Fix wrong check in do_pd_setup Date: Mon, 24 Oct 2022 13:30:00 +0200 Message-Id: <20221024113001.693575220@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747572828648107777?= X-GMAIL-MSGID: =?utf-8?q?1747572828648107777?= From: Zheng Yongjun [ Upstream commit ec3f06b542a960806a81345042e4eee3f8c5dec4 ] Should check of_iomap return value 'fep->fec.fecp' instead of 'fep->fcc.fccp' Fixes: 976de6a8c304 ("fs_enet: Be an of_platform device when CONFIG_PPC_CPM_NEW_BINDING is set.") Signed-off-by: Zheng Yongjun Reviewed-by: Christophe Leroy Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/net/ethernet/freescale/fs_enet/mac-fec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/freescale/fs_enet/mac-fec.c b/drivers/net/ethernet/freescale/fs_enet/mac-fec.c index 99fe2c210d0f..61f4b6e50d29 100644 --- a/drivers/net/ethernet/freescale/fs_enet/mac-fec.c +++ b/drivers/net/ethernet/freescale/fs_enet/mac-fec.c @@ -98,7 +98,7 @@ static int do_pd_setup(struct fs_enet_private *fep) return -EINVAL; fep->fec.fecp = of_iomap(ofdev->dev.of_node, 0); - if (!fep->fcc.fccp) + if (!fep->fec.fecp) return -EINVAL; return 0; From patchwork Mon Oct 24 11:30:01 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8846 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp432926wru; Mon, 24 Oct 2022 05:48:06 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6TWxuC+dbfrdBJ4lLXx1dBlSE6pC5JWbvMzES1pYZsJH5nUd/ZpuQZj4RhJU/CxCESvWf7 X-Received: by 2002:a17:90a:2cc7:b0:212:f074:cf4d with SMTP id n65-20020a17090a2cc700b00212f074cf4dmr11445486pjd.70.1666615686291; Mon, 24 Oct 2022 05:48:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666615686; cv=none; d=google.com; s=arc-20160816; b=iZ1SQ/OnLcGZgOuwWdfPJGV2M9hHe6bWFo8ZPBvKdqheFocSOuTGHzJRjbvxw9sUJg ZRUvjuAryDrOKkBJG1J5uVfRs8FTnVSrXGGe6gglCmbRNB+WlSlhPbsXhn/1bbHu/wm2 fwmRrDRvezAAbd+5kx660RqtIVaf8c2z2G/v2Cp6j2U1+KWeltmrVq+QyMpsD75vRyzn DoyGddj6mhp6K5fCIqYoY4cQVqBaIYpKK6XQSahPoqAKiCsyRbfSd6RPTREpyi5jx6CO X85uEqxpbbJifQ5rAwBlVWeYoS0n/ub4UgJerX4KMnPPSjGrTeEfyHcZpHRFQPVxqxws 4IdQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=W7zlw4081QrFjukqTmJhn52l7eozjl+3YuIqSz1vBSQ=; b=eMgg89GWmCthqJFZz7Zy5VAuK1AljSocwZXTf7OFghfYxPPL9PPCHh/vf/v1VNmfPa JSK1f6+OOQCmaMXzkCnuRi6QHbTgDz8Bi4/61SLYh8Lmfz+tmvXqqWTeYbknc1O8da1Z fQlD6ZwVFRn+2Uu8ZVmN3OU3RV39Z6ycSxP6KVwwHnJp7vKgO9t946sc5bSRiWLKNzOq NhVdNcih4YYwsxTw48/mVUqI5Iwc+3A4HYUKft7RWrGKzTb+gHyrU45X/4wYzko7H904 ZpXOARFL3s6uB/GK0MSzEZsSqZ3geHywWdZDi7EOapUqSgSK4nqolUsY2RqMvxVIdjIl idsg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=sOMUvPi7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a11-20020a056a000c8b00b0053e1d872a91si37362941pfv.83.2022.10.24.05.47.49; Mon, 24 Oct 2022 05:48:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=sOMUvPi7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234027AbiJXMig (ORCPT + 99 others); Mon, 24 Oct 2022 08:38:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43920 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233888AbiJXM2e (ORCPT ); Mon, 24 Oct 2022 08:28:34 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2E93386FBB; Mon, 24 Oct 2022 05:02:18 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 64C12B81150; Mon, 24 Oct 2022 11:58:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BAF06C433D6; Mon, 24 Oct 2022 11:58:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612709; bh=KXBQ6MdwJlojy74YROK74a4S4l8XmysUHJstxMTskFQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sOMUvPi7gmYmooroz3cYA+glwU2WBlIVqGb5BM2bdUbdIyEWTkw5T8hJXOebmrHPr 4a5kWokoGWJKP9zChRZNuou0aMjigxDgWTRUVHe+Ev5fyBn/3dtZmrvTTD0Jl7b368 QI2zItdFX31ytmr7rgF1gN6rbjAkdTLbwSCwXTsI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Lee Jones , Daniel Borkmann , Yonghong Song , Sasha Levin Subject: [PATCH 4.19 082/229] bpf: Ensure correct locking around vulnerable function find_vpid() Date: Mon, 24 Oct 2022 13:30:01 +0200 Message-Id: <20221024113001.724483738@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747573210042252706?= X-GMAIL-MSGID: =?utf-8?q?1747573210042252706?= From: Lee Jones [ Upstream commit 83c10cc362d91c0d8d25e60779ee52fdbbf3894d ] The documentation for find_vpid() clearly states: "Must be called with the tasklist_lock or rcu_read_lock() held." Presently we do neither for find_vpid() instance in bpf_task_fd_query(). Add proper rcu_read_lock/unlock() to fix the issue. Fixes: 41bdc4b40ed6f ("bpf: introduce bpf subcommand BPF_TASK_FD_QUERY") Signed-off-by: Lee Jones Signed-off-by: Daniel Borkmann Acked-by: Yonghong Song Link: https://lore.kernel.org/bpf/20220912133855.1218900-1-lee@kernel.org Signed-off-by: Sasha Levin --- kernel/bpf/syscall.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/kernel/bpf/syscall.c b/kernel/bpf/syscall.c index e940c1f65938..02e5bdb82a9a 100644 --- a/kernel/bpf/syscall.c +++ b/kernel/bpf/syscall.c @@ -2325,7 +2325,9 @@ static int bpf_task_fd_query(const union bpf_attr *attr, if (attr->task_fd_query.flags != 0) return -EINVAL; + rcu_read_lock(); task = get_pid_task(find_vpid(pid), PIDTYPE_PID); + rcu_read_unlock(); if (!task) return -ENOENT; From patchwork Mon Oct 24 11:30:02 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9849 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp557690wru; Mon, 24 Oct 2022 10:03:45 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4ykjEVYbkWmpV8a6mZ5PUKlyQyTcqlUJuDO1etfguk5gOmTlAgXMZ0EL7F+Julb6sb+G/6 X-Received: by 2002:a17:90b:3e8d:b0:20d:2ab9:517f with SMTP id rj13-20020a17090b3e8d00b0020d2ab9517fmr38623314pjb.88.1666631025580; Mon, 24 Oct 2022 10:03:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666631025; cv=none; d=google.com; s=arc-20160816; b=0SUrq6/LHYn3RULcs8j0jluGYZMJJ78XMeNGYR+UJCtXvy1iUhmg6aBXJvyWVwaJu7 XUwm+XYB3RVllJbWf7O3pYwMbsuM8Rghatm2v+7NgTZQYliZgGjarudvepJfOfdHU7lR pIcJCJICy26hGCxjps9asP7iULRS/dQxSoWBtwi2dbSh1fCQi1gk1bBoB+7DYUBVMy+S HT+4pRjbC3Xen98+Yj6vIHIw/An0RlHT+AbgswdefJ6OxIUsITlXzcQh5sFqwM5WLqE1 7lGC7u1WlAuoMk11mtm7KNZXc0Pyrw1qK29lhPvRyzP9EMQ3u5T7707YJ15wFNdNRHT7 kpXA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=cTaKOMTpgM4IMkGXR8tm7Ux2EjWsBdh6cOYuQmE+bs8=; b=nX1+onp0nF+01k/XZ8P1PN7wu39NWi8/PnXPWGN8OYrlswQyQgyfnE950Hd5pooJUW sOXzeU+8E1wngZjTTzYCP+k5aW4IsCxIZrDwEkCX77CRurEU+6bc0p5gXZhjS7WhFXnt owjhkWgX6X0JRBOMFtnZ+UMD2j+pXZt0Mxc+1Mgjk9WnoaNHuoBAe+nv4+bZeqwdtyUw r2gfX0VRv6O27O7iNTgd5Z2syBN8GecC13PWiKV8SRouu/20T9mgIfaWVTaxQoOWwLFU CZqJ0wvv2Xk5xhX3wuaZURrmSzL6PwsOcZzeA3szCpdQjkNNho+igB9yV9XaaOBrBfaC Vg5Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=DJfT7d8C; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f23-20020a63dc57000000b004197e33daf5si33107415pgj.863.2022.10.24.10.03.30; Mon, 24 Oct 2022 10:03:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=DJfT7d8C; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233326AbiJXRBa (ORCPT + 99 others); Mon, 24 Oct 2022 13:01:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37022 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235261AbiJXRAU (ORCPT ); Mon, 24 Oct 2022 13:00:20 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 090249C238; Mon, 24 Oct 2022 08:37:47 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 57542B811C2; Mon, 24 Oct 2022 11:58:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B1425C433C1; Mon, 24 Oct 2022 11:58:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612738; bh=HCgnyLFXNJ666+RLJs53imFRVFNh+zNwO7IvWGDTFNk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DJfT7d8CxXjgpoNLfAt4HBata9PV9gCCMOqWYb3ex8cEm6Dkk1xHNDtuMWEg+qkzE JldkHZnfLsGffLeP8ZwwK3e1c22j4bjUKJ/6p45HRhxGPJtsXQjcGEsdABpvY4gYtq PlziHNc8nJz6B8O4ZpM5BlFxZ2VYkCSdK53T+OH0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zhang Qilong , Mark Brown , Sasha Levin Subject: [PATCH 4.19 083/229] spi/omap100k:Fix PM disable depth imbalance in omap1_spi100k_probe Date: Mon, 24 Oct 2022 13:30:02 +0200 Message-Id: <20221024113001.753343782@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747589294333331373?= X-GMAIL-MSGID: =?utf-8?q?1747589294333331373?= From: Zhang Qilong [ Upstream commit 29f65f2171c85a9633daa380df14009a365f42f2 ] The pm_runtime_enable will increase power disable depth. Thus a pairing decrement is needed on the error handling path to keep it balanced according to context. Fixes:db91841b58f9a ("spi/omap100k: Convert to runtime PM") Signed-off-by: Zhang Qilong Link: https://lore.kernel.org/r/20220924121310.78331-4-zhangqilong3@huawei.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- drivers/spi/spi-omap-100k.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/spi/spi-omap-100k.c b/drivers/spi/spi-omap-100k.c index 2eeb0fe2eed2..022f5bccef81 100644 --- a/drivers/spi/spi-omap-100k.c +++ b/drivers/spi/spi-omap-100k.c @@ -425,6 +425,7 @@ static int omap1_spi100k_probe(struct platform_device *pdev) return status; err_fck: + pm_runtime_disable(&pdev->dev); clk_disable_unprepare(spi100k->fck); err_ick: clk_disable_unprepare(spi100k->ick); From patchwork Mon Oct 24 11:30:03 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9847 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp557368wru; Mon, 24 Oct 2022 10:03:12 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7S/mOZE1gGOZJmCiVuSEPkLSP/vVN7kSrMjKTH7At8KcZ/ugGT3tVTmhkhSlWQ7jfhmfA7 X-Received: by 2002:a05:6402:2947:b0:451:32a:2222 with SMTP id ed7-20020a056402294700b00451032a2222mr31281384edb.376.1666630992143; Mon, 24 Oct 2022 10:03:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666630992; cv=none; d=google.com; s=arc-20160816; b=jBcIIB4BG1iOmT0A6yZFaVRvtEp7EXRhXJALbFlR5K6MUYEVgivnc1QbScYbFLo5mi oCcxfmeuj+dMW0wysOO8aK2RXRK8d3p31ofRYtcYoPAUT+SrkTvQUO2mP4n9310ccnpX 8rTFHroVDTduyp+5FtC5RiXeVTlG+2O/x/cfqe9vtthRV+b3+X+H5TqqC4Fnn9aXn4xh 8cVSC9OZohKKRNZFmKVWilnT5HSJjSz5d7kOz4igACr0uBsm9luYv0kmIdzKRZkdHDp9 cHFhYaXLfJZ/SsXJBs/s+81Zxa6wKG3lUANgBrR87RN4+ubjEAoBvNThYyj8sL2HnXyx qYIg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=iatDN1IBJcPRXwqvoftvcJncg5RYrCSHHP7XuKJA9ow=; b=oC+ZBrr6dRgvSWNrVuuGr1BooHx/6sbKwVn0wUxqXroS+szyXgtx8MbpJvcbjBIIRJ Y4p+Bkh3JO0F9payiua/Hf4NhrboxMDgD6fJIMCsHqscb+pcgn0+K9M1RFwpoeXeX68I j5ca4AN3ICMfGHM8S5y/cSj3rfRMlU1AhxK4to707vpwP79BcyYzzdPz1eZ70E0BKpok BJfWjSWrL3gn+w8UKPd00TJG3tN7NCiKxZ6Am2/c+mbrYPiOUALpKL9F/J440wLnK0FE m11DVIR1qcMs3nPMnpGVMPHtrVpWjVn/WVhPNziyLunJUUsOmFLuAjB8hP6VmKdJQ5Q/ TvuQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=yhOx63Xo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ne36-20020a1709077ba400b007abafd4d7d8si50151ejc.706.2022.10.24.10.02.31; Mon, 24 Oct 2022 10:03:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=yhOx63Xo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230417AbiJXRAg (ORCPT + 99 others); Mon, 24 Oct 2022 13:00:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56914 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232000AbiJXQ5x (ORCPT ); Mon, 24 Oct 2022 12:57:53 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4279946238; Mon, 24 Oct 2022 08:37:07 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 422EBB811DD; Mon, 24 Oct 2022 11:59:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9FFE9C433D6; Mon, 24 Oct 2022 11:59:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612767; bh=YmD/sxiRNcUAS4pk6CrV8Ul3dzvDsIvTgC6QwATOJDs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=yhOx63Xo+789rG3Tsg24k5TH8lrTjhRtaBSLE964phXBNpuHT/hyc/VB6FiPyFEN8 f3DRVViF4VnxlYWw1KN0mpqzarxUJ2OpmMd3MsGNTJwtP+3mbzP27L+ldPOCRF67oX 0X5UmXxLLA49nFwCTLfBnRilFJ2NMZIPsBtH/xBQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Phil Sutter , Florian Westphal , Sasha Levin Subject: [PATCH 4.19 084/229] netfilter: nft_fib: Fix for rpath check with VRF devices Date: Mon, 24 Oct 2022 13:30:03 +0200 Message-Id: <20221024113001.783335287@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747589259334604922?= X-GMAIL-MSGID: =?utf-8?q?1747589259334604922?= From: Phil Sutter [ Upstream commit 2a8a7c0eaa8747c16aa4a48d573aa920d5c00a5c ] Analogous to commit b575b24b8eee3 ("netfilter: Fix rpfilter dropping vrf packets by mistake") but for nftables fib expression: Add special treatment of VRF devices so that typical reverse path filtering via 'fib saddr . iif oif' expression works as expected. Fixes: f6d0cbcf09c50 ("netfilter: nf_tables: add fib expression") Signed-off-by: Phil Sutter Signed-off-by: Florian Westphal Signed-off-by: Sasha Levin --- net/ipv4/netfilter/nft_fib_ipv4.c | 3 +++ net/ipv6/netfilter/nft_fib_ipv6.c | 6 +++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/net/ipv4/netfilter/nft_fib_ipv4.c b/net/ipv4/netfilter/nft_fib_ipv4.c index e50976e3c213..3b2e8ac45d4e 100644 --- a/net/ipv4/netfilter/nft_fib_ipv4.c +++ b/net/ipv4/netfilter/nft_fib_ipv4.c @@ -95,6 +95,9 @@ void nft_fib4_eval(const struct nft_expr *expr, struct nft_regs *regs, else oif = NULL; + if (priv->flags & NFTA_FIB_F_IIF) + fl4.flowi4_oif = l3mdev_master_ifindex_rcu(oif); + if (nft_hook(pkt) == NF_INET_PRE_ROUTING && nft_fib_is_loopback(pkt->skb, nft_in(pkt))) { nft_fib_store_result(dest, priv, pkt, diff --git a/net/ipv6/netfilter/nft_fib_ipv6.c b/net/ipv6/netfilter/nft_fib_ipv6.c index 36be3cf0adef..fa71e40789ed 100644 --- a/net/ipv6/netfilter/nft_fib_ipv6.c +++ b/net/ipv6/netfilter/nft_fib_ipv6.c @@ -41,6 +41,9 @@ static int nft_fib6_flowi_init(struct flowi6 *fl6, const struct nft_fib *priv, if (ipv6_addr_type(&fl6->daddr) & IPV6_ADDR_LINKLOCAL) { lookup_flags |= RT6_LOOKUP_F_IFACE; fl6->flowi6_oif = get_ifindex(dev ? dev : pkt->skb->dev); + } else if ((priv->flags & NFTA_FIB_F_IIF) && + (netif_is_l3_master(dev) || netif_is_l3_slave(dev))) { + fl6->flowi6_oif = dev->ifindex; } if (ipv6_addr_type(&fl6->saddr) & IPV6_ADDR_UNICAST) @@ -189,7 +192,8 @@ void nft_fib6_eval(const struct nft_expr *expr, struct nft_regs *regs, if (rt->rt6i_flags & (RTF_REJECT | RTF_ANYCAST | RTF_LOCAL)) goto put_rt_err; - if (oif && oif != rt->rt6i_idev->dev) + if (oif && oif != rt->rt6i_idev->dev && + l3mdev_master_ifindex_rcu(rt->rt6i_idev->dev) != oif->ifindex) goto put_rt_err; switch (priv->result) { From patchwork Mon Oct 24 11:30:04 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8730 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp423784wru; Mon, 24 Oct 2022 05:25:45 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5hyTXhibYwXIurQUidb6WClHMZrsmblWLXlOq4AsHwvomXieEDskSl2RY3wroM3oEoaKqF X-Received: by 2002:a17:90b:4c86:b0:20d:402d:6155 with SMTP id my6-20020a17090b4c8600b0020d402d6155mr71779721pjb.229.1666614345450; Mon, 24 Oct 2022 05:25:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666614345; cv=none; d=google.com; s=arc-20160816; b=CqQHlYqAg7p2DeibSPonAwVSLSsuT6Vogkj0wd5Ado3EEsCcF71Zizddv4tfWret+M Zs6gcQm3pXGsgDjOTQGKOhed5ubpsWzrVUwct+kkJhsv5Ik+GxErvjVrKnlMFyqcXCch CKsUSlSadiVN1Fe2J7z2Xg8/67kr02rQ3RRiim5P6W1+r1+JM09ymnMC/lGYz+8ec8J/ e5M/9vXobrLemeUQKf2BFaz5Zz+//FiKcbhl7+eKjcnpJ516Z5f7ksFiKioeg4bRsLmj 3+7sr2tTJSrldYMQjOktk17GlOistGGyAK2C8pbdlYKvE7FvzG26ZO5vvHAHaxDThCGg PsHQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=NCajvmPzlLtTQEuxTL2OzG5eHDyTQ+NLd7FwXLOsMOI=; b=Dh3gi16GTF4jinXCBRxvSsiWTOjWo08LpSfgQe3Jg2vnVNhX/Y4ml1M5nCllcsWHDK KgZQAHpzsbmqUbUXmE4gluAPQpThhE89qwrUJHCDlclVRnraDCTmhFdEK2I6x7nIxgz3 jiFeXMGxtipBpNAF35OIrsppagcB2KSNud6m/xGcMEY/HKNG2GewYIsssK09y+186QTm d+8/fF+QwNmnMKkqj0bcCTBCk54bcWoDg4uyBZygmRHgR+N4nje2xF4EzqsEo+7cQLMP NBKiFHsH7SVy3akGrCYhn15IT7eydstHCRKu5zbYv8U+hr0GCAL+QDK6A+uLG9ZLPVsA aI2A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=uYKAOoPx; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t3-20020a637803000000b0046ec38975f7si10908098pgc.49.2022.10.24.05.25.32; Mon, 24 Oct 2022 05:25:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=uYKAOoPx; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233559AbiJXMZD (ORCPT + 99 others); Mon, 24 Oct 2022 08:25:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40712 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233565AbiJXMXO (ORCPT ); Mon, 24 Oct 2022 08:23:14 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 84BB51C428; Mon, 24 Oct 2022 04:59:44 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id D6422612BC; Mon, 24 Oct 2022 11:59:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EFDB9C433D7; Mon, 24 Oct 2022 11:59:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612780; bh=OdCrpPWWG4nWQffHV/hJadngSemBaAi8ZG/iIGDQHl4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uYKAOoPxIqvimA2pNvJRIenD9Yx0Z8rTKbkf9lsN8S/U/eYViS03OHIXKnE0z0kj1 LCMmEC2plGwPU1JpBOSA3P8Pa1PXq2wffkbcpm1wy51mDJRKqxDkBJEWwDNVCHhy/R 7yb92ztKFlQQCfpiXB8AhkFkbHg4Eu/HN2lM4Xho= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Vincent Whitchurch , Mark Brown , Sasha Levin Subject: [PATCH 4.19 085/229] spi: s3c64xx: Fix large transfers with DMA Date: Mon, 24 Oct 2022 13:30:04 +0200 Message-Id: <20221024113001.813525650@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747571804086031803?= X-GMAIL-MSGID: =?utf-8?q?1747571804086031803?= From: Vincent Whitchurch [ Upstream commit 1224e29572f655facfcd850cf0f0a4784f36a903 ] The COUNT_VALUE in the PACKET_CNT register is 16-bit so the maximum value is 65535. Asking the driver to transfer a larger size currently leads to the DMA transfer timing out. Implement ->max_transfer_size() and have the core split the transfer as needed. Fixes: 230d42d422e7 ("spi: Add s3c64xx SPI Controller driver") Signed-off-by: Vincent Whitchurch Link: https://lore.kernel.org/r/20220927112117.77599-5-vincent.whitchurch@axis.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- drivers/spi/spi-s3c64xx.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/spi/spi-s3c64xx.c b/drivers/spi/spi-s3c64xx.c index 1d948fee1a03..d9420561236c 100644 --- a/drivers/spi/spi-s3c64xx.c +++ b/drivers/spi/spi-s3c64xx.c @@ -84,6 +84,7 @@ #define S3C64XX_SPI_ST_TX_FIFORDY (1<<0) #define S3C64XX_SPI_PACKET_CNT_EN (1<<16) +#define S3C64XX_SPI_PACKET_CNT_MASK GENMASK(15, 0) #define S3C64XX_SPI_PND_TX_UNDERRUN_CLR (1<<4) #define S3C64XX_SPI_PND_TX_OVERRUN_CLR (1<<3) @@ -654,6 +655,13 @@ static int s3c64xx_spi_prepare_message(struct spi_master *master, return 0; } +static size_t s3c64xx_spi_max_transfer_size(struct spi_device *spi) +{ + struct spi_controller *ctlr = spi->controller; + + return ctlr->can_dma ? S3C64XX_SPI_PACKET_CNT_MASK : SIZE_MAX; +} + static int s3c64xx_spi_transfer_one(struct spi_master *master, struct spi_device *spi, struct spi_transfer *xfer) @@ -1118,6 +1126,7 @@ static int s3c64xx_spi_probe(struct platform_device *pdev) master->prepare_transfer_hardware = s3c64xx_spi_prepare_transfer; master->prepare_message = s3c64xx_spi_prepare_message; master->transfer_one = s3c64xx_spi_transfer_one; + master->max_transfer_size = s3c64xx_spi_max_transfer_size; master->num_chipselect = sci->num_cs; master->dma_alignment = 8; master->bits_per_word_mask = SPI_BPW_MASK(32) | SPI_BPW_MASK(16) | From patchwork Mon Oct 24 11:30:05 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8777 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp430613wru; Mon, 24 Oct 2022 05:41:57 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6HKlTZc0bx+CdC1e2w/9m40XTbL8+1vrU9MExLf0PB84pPQCWc5d1i1joe+aKuQ1vYyZFK X-Received: by 2002:a63:2f82:0:b0:460:8786:5b91 with SMTP id v124-20020a632f82000000b0046087865b91mr27671387pgv.422.1666615317546; Mon, 24 Oct 2022 05:41:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666615317; cv=none; d=google.com; s=arc-20160816; b=l9dRwDudXUtM8kKcrgRE+/hkmt82T8clqJdyPoemFcZU+BTOqDCUjNnLyFdiF11Mlg eu9MCTwOBDmMxiVD84Wyk40Qb5KqiM2VnMXkKlpK8QLMcI0j4a/HwKwBP/qQqqnBoyHC eoTLEF1Dgva3vrS77ynxorBqr+fWDUoHADbwNKLewn76SgvuI6SbWYJ8GZEiT3CkEDcg V0bOkJaqUhqnViyRMY1Q0yfryV3aJfBOkzk1mn6IfnVlNg9JFLJ6IjaieL8sHR1WHbNt 5Ja7Yq6ti4UT5dt320+oRBso4QT7rB0qUt/cfaH4tc9UAs0oMmdqy38MOWoaVC6IM58L E1EQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=HXAZ3+lRfchpx3fM+XqkvrXFoNmJJyHJpqDNoDukkec=; b=FdfYTMgtOWibwK1V+SLJRowYI4KFe8RhywomGnZRlEX6AlGA/IbWYmZrDLWyhO7Ij6 OYN1OMMuUQUbeBma+t7y+x3E7QrWbxdQWkju2gl6odx7/xKXrxeBnfyM7aEQDc/T/uqn iKFLHdjqW5FdU7nUt33LO6xllw7cxXzOXUxoYk25naFVuRe8Aj3gt31l66mVJi77oMm0 moSXIoP6VdGgDbhZnI+EOIWxgwoGnKwrJlcriS0eV88WmQh8rRlalLjFJWhuq3GNyiDW Vk8VfoLPjE8EffR4InsfEydNIKDu+z+JrAY1M3YAy5Qz980GBs6erg1TKEziziibBJ/3 IMcg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ZIfE7ngq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k16-20020a170902c41000b00175449cf6f8si42959024plk.606.2022.10.24.05.41.38; Mon, 24 Oct 2022 05:41:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ZIfE7ngq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233939AbiJXMcH (ORCPT + 99 others); Mon, 24 Oct 2022 08:32:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60606 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233813AbiJXM27 (ORCPT ); Mon, 24 Oct 2022 08:28:59 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D6E98876AF; Mon, 24 Oct 2022 05:02:50 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 3A3CAB811C0; Mon, 24 Oct 2022 11:59:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8FD87C433D6; Mon, 24 Oct 2022 11:59:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612782; bh=irIg9TWHMKH0K5bKYHLrIkzN3v9Q+kmJJ856slhHmH4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZIfE7ngqmwUxr8qu1+yvyfSy5uofIieCYPADCysCt2WB9Kbiz61gcE865/nAecZ64 Y2Af7CoRT8gY0/k9DwOI3/J+1+4MGVFCP2huEQni7IJqoS0jlAnTjQzNjCrsRsSWr9 0J6YrE94Od5+9XvMH0J644+nT74b08fIririS9IE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Junichi Uekawa , Stefano Garzarella , "Michael S. Tsirkin" , Jakub Kicinski , Sasha Levin Subject: [PATCH 4.19 086/229] vhost/vsock: Use kvmalloc/kvfree for larger packets. Date: Mon, 24 Oct 2022 13:30:05 +0200 Message-Id: <20221024113001.843034329@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747572823381461048?= X-GMAIL-MSGID: =?utf-8?q?1747572823381461048?= From: Junichi Uekawa [ Upstream commit 0e3f72931fc47bb81686020cc643cde5d9cd0bb8 ] When copying a large file over sftp over vsock, data size is usually 32kB, and kmalloc seems to fail to try to allocate 32 32kB regions. vhost-5837: page allocation failure: order:4, mode:0x24040c0 Call Trace: [] dump_stack+0x97/0xdb [] warn_alloc_failed+0x10f/0x138 [] ? __alloc_pages_direct_compact+0x38/0xc8 [] __alloc_pages_nodemask+0x84c/0x90d [] alloc_kmem_pages+0x17/0x19 [] kmalloc_order_trace+0x2b/0xdb [] __kmalloc+0x177/0x1f7 [] ? copy_from_iter+0x8d/0x31d [] vhost_vsock_handle_tx_kick+0x1fa/0x301 [vhost_vsock] [] vhost_worker+0xf7/0x157 [vhost] [] kthread+0xfd/0x105 [] ? vhost_dev_set_owner+0x22e/0x22e [vhost] [] ? flush_kthread_worker+0xf3/0xf3 [] ret_from_fork+0x4e/0x80 [] ? flush_kthread_worker+0xf3/0xf3 Work around by doing kvmalloc instead. Fixes: 433fc58e6bf2 ("VSOCK: Introduce vhost_vsock.ko") Signed-off-by: Junichi Uekawa Reviewed-by: Stefano Garzarella Acked-by: Michael S. Tsirkin Link: https://lore.kernel.org/r/20220928064538.667678-1-uekawa@chromium.org Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin --- drivers/vhost/vsock.c | 2 +- net/vmw_vsock/virtio_transport_common.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/vhost/vsock.c b/drivers/vhost/vsock.c index 9f67717eaf45..08d49f34c785 100644 --- a/drivers/vhost/vsock.c +++ b/drivers/vhost/vsock.c @@ -354,7 +354,7 @@ vhost_vsock_alloc_pkt(struct vhost_virtqueue *vq, return NULL; } - pkt->buf = kmalloc(pkt->len, GFP_KERNEL); + pkt->buf = kvmalloc(pkt->len, GFP_KERNEL); if (!pkt->buf) { kfree(pkt); return NULL; diff --git a/net/vmw_vsock/virtio_transport_common.c b/net/vmw_vsock/virtio_transport_common.c index cbb336f01cf2..449b5261e661 100644 --- a/net/vmw_vsock/virtio_transport_common.c +++ b/net/vmw_vsock/virtio_transport_common.c @@ -1079,7 +1079,7 @@ EXPORT_SYMBOL_GPL(virtio_transport_recv_pkt); void virtio_transport_free_pkt(struct virtio_vsock_pkt *pkt) { - kfree(pkt->buf); + kvfree(pkt->buf); kfree(pkt); } EXPORT_SYMBOL_GPL(virtio_transport_free_pkt); From patchwork Mon Oct 24 11:30:06 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 10018 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp622179wru; Mon, 24 Oct 2022 12:44:54 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5w0goi/s2DjBc+kFPNq8d39uKaqPVbJM9/KICN4BGNy1DP28TALVKEyc6aP/AhZcP4pMkh X-Received: by 2002:a17:906:fc6:b0:72f:d080:416 with SMTP id c6-20020a1709060fc600b0072fd0800416mr29561148ejk.1.1666640694069; Mon, 24 Oct 2022 12:44:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666640694; cv=none; d=google.com; s=arc-20160816; b=OqidKn5EdQ5MuH9n3yPOT0c9PcFytz3I566kFPYWx/Q1TvhjkZFa8RTOhLiHh8DIMK cgIWUULhSI5ojmJJGGlPXQMwSaw+YTka4R2y35dw76IfPHo883W/dea53CMVFHnAnZxf Q4S0YMy1PAyr8g7PzTvc5uHbsHNvXV3nNf/rtu83mdPLZvNJ7Y3it+8dZG+ylsuEdrMD 4/mywKedGVKI2hfKLe0pQEWCVTf81y4EfPJdA8Ga3Zt7qkI7YvW9gQ/4NhxL5OeUHMvR NH175KG186+zu7aQ70KWtDyW71iwBgR7GI/C/TuEtHpDXv3A0I/HQcVcNlF3opa29/2B zn8w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=fs3bnj3ks9AaKmuK0JZGV/N+fGBL5AnEqWMtgtKQVYg=; b=mGvkrO1rzy3h3v0T2pZrC13/2kEdWgOA8bjcgw7cgIyljFD60gpRab6ltTPtsmXnzf lgq7++PrFN2rgHeuKQUHfJyKYNm2JR+SxhTc2O9GqIpqoGdGxn/SHxMdpmoIqcx4czNF fwUfqaLqGj5iZOibXU9WE/HDog0Z6tPi/fFUP98ssEsBayUt6wLHP2GuvxOWSgpG6ZIS QS1XwoQeAU87OroN40OIdPYIJ7I2god4a/lhJSUJuhcqQPwuf//CjBTUH+FFrDM2mtD8 X7SQGsZQC/p4T+D4EuNUs0ygU1Kz12aLb/o8x3FgB5omBYjrlcpRqMjFd0swajFjSIqs 8Niw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=RvTWGtI4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l16-20020a056402125000b00447a8836a56si501286edw.208.2022.10.24.12.44.27; Mon, 24 Oct 2022 12:44:54 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=RvTWGtI4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231599AbiJXThs (ORCPT + 99 others); Mon, 24 Oct 2022 15:37:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52310 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230149AbiJXThV (ORCPT ); Mon, 24 Oct 2022 15:37:21 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 426831A6534; Mon, 24 Oct 2022 11:07:46 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id DDEF0B811F2; Mon, 24 Oct 2022 11:59:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3B0FEC433D6; Mon, 24 Oct 2022 11:59:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612785; bh=22tKZb6ogmwAkA0feXsO1REwhO/9rMsCiR31WD0fk6k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RvTWGtI4gxtVHtCxDJuPh6VmlfhJak3tmqTrHBzH9yTX3nOTZ7Oua98neDhsFvSMd JW6CpAIqti8D6JdwNYnwv2PNo3kna4smmYY/8p+exMuMMc4HelwuNHiYKd8kczXueF XOcbvs+b35u+3cPQcp/FIGiWDnOxsz/Ki0m19u/w= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Duoming Zhou , Leon Romanovsky , "David S. Miller" , Sasha Levin Subject: [PATCH 4.19 087/229] mISDN: fix use-after-free bugs in l1oip timer handlers Date: Mon, 24 Oct 2022 13:30:06 +0200 Message-Id: <20221024113001.873325181@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747599432246862383?= X-GMAIL-MSGID: =?utf-8?q?1747599432246862383?= From: Duoming Zhou [ Upstream commit 2568a7e0832ee30b0a351016d03062ab4e0e0a3f ] The l1oip_cleanup() traverses the l1oip_ilist and calls release_card() to cleanup module and stack. However, release_card() calls del_timer() to delete the timers such as keep_tl and timeout_tl. If the timer handler is running, the del_timer() will not stop it and result in UAF bugs. One of the processes is shown below: (cleanup routine) | (timer handler) release_card() | l1oip_timeout() ... | del_timer() | ... ... | kfree(hc) //FREE | | hc->timeout_on = 0 //USE Fix by calling del_timer_sync() in release_card(), which makes sure the timer handlers have finished before the resources, such as l1oip and so on, have been deallocated. What's more, the hc->workq and hc->socket_thread can kick those timers right back in. We add a bool flag to show if card is released. Then, check this flag in hc->workq and hc->socket_thread. Fixes: 3712b42d4b1b ("Add layer1 over IP support") Signed-off-by: Duoming Zhou Reviewed-by: Leon Romanovsky Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/isdn/mISDN/l1oip.h | 1 + drivers/isdn/mISDN/l1oip_core.c | 13 +++++++------ 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/drivers/isdn/mISDN/l1oip.h b/drivers/isdn/mISDN/l1oip.h index 7ea10db20e3a..48133d022812 100644 --- a/drivers/isdn/mISDN/l1oip.h +++ b/drivers/isdn/mISDN/l1oip.h @@ -59,6 +59,7 @@ struct l1oip { int bundle; /* bundle channels in one frm */ int codec; /* codec to use for transmis. */ int limit; /* limit number of bchannels */ + bool shutdown; /* if card is released */ /* timer */ struct timer_list keep_tl; diff --git a/drivers/isdn/mISDN/l1oip_core.c b/drivers/isdn/mISDN/l1oip_core.c index b05022f94f18..2f4a01ab25e8 100644 --- a/drivers/isdn/mISDN/l1oip_core.c +++ b/drivers/isdn/mISDN/l1oip_core.c @@ -289,7 +289,7 @@ l1oip_socket_send(struct l1oip *hc, u8 localcodec, u8 channel, u32 chanmask, p = frame; /* restart timer */ - if (time_before(hc->keep_tl.expires, jiffies + 5 * HZ)) + if (time_before(hc->keep_tl.expires, jiffies + 5 * HZ) && !hc->shutdown) mod_timer(&hc->keep_tl, jiffies + L1OIP_KEEPALIVE * HZ); else hc->keep_tl.expires = jiffies + L1OIP_KEEPALIVE * HZ; @@ -615,7 +615,9 @@ l1oip_socket_parse(struct l1oip *hc, struct sockaddr_in *sin, u8 *buf, int len) goto multiframe; /* restart timer */ - if (time_before(hc->timeout_tl.expires, jiffies + 5 * HZ) || !hc->timeout_on) { + if ((time_before(hc->timeout_tl.expires, jiffies + 5 * HZ) || + !hc->timeout_on) && + !hc->shutdown) { hc->timeout_on = 1; mod_timer(&hc->timeout_tl, jiffies + L1OIP_TIMEOUT * HZ); } else /* only adjust timer */ @@ -1247,11 +1249,10 @@ release_card(struct l1oip *hc) { int ch; - if (timer_pending(&hc->keep_tl)) - del_timer(&hc->keep_tl); + hc->shutdown = true; - if (timer_pending(&hc->timeout_tl)) - del_timer(&hc->timeout_tl); + del_timer_sync(&hc->keep_tl); + del_timer_sync(&hc->timeout_tl); cancel_work_sync(&hc->workq); From patchwork Mon Oct 24 11:30:07 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8736 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp423947wru; Mon, 24 Oct 2022 05:26:14 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6DiJRP3/HyQWkuHwgHSHLtCsf97q09377oMjD3rB4iNNf08Neq3iNTytFtk+jSYBgHW4M4 X-Received: by 2002:a17:90b:384f:b0:20d:4761:3394 with SMTP id nl15-20020a17090b384f00b0020d47613394mr38821865pjb.144.1666614363499; Mon, 24 Oct 2022 05:26:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666614363; cv=none; d=google.com; s=arc-20160816; b=VMe4Gk3wSsaQ7ZGd2/819rrOrKURn3vwisJLE2w35PrH63ssx5Li2gkOavULSNJmGl bBDD2KVL+UaluLGH6iMv7W25+4JlheWjZv7F/znzePHT0yj/XWpUjEAVB90oip4Xthts rAsqLsqmmGyS6GPIWwUbt4A/tuusSwB9pTJO+D8zjmk2Jcp2nh14T+4IxNO1T/awbVHm 8SEeDqSQNrm9VHdzIuIgsxDE3CgeIOFU9+PtqNGV2d5nEBqPXHaTk60aOdOOSkkAc87M +5x/wzfonKz6XuGEy4j2PayQMq2ZCdnl5ub7BaSnb90bdkvzbNmWTNboNFslPOGYKgCJ ziFA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Dwgs+791h4gx7U0GaiJvswbpC0uSa6D7p3UILa5leJY=; b=khe8ttoI59tJ8AYgYhmoqFE6/BAC3xOIt3NmvU3nAz75HnW2Hqaib7XFpjC8piwCKD VSYUZRYIjk/3SwfxKiPJonfjJ+zmctlimYa6wrKkCHizO30BMd7oKA1ogIk7R5n8xmGY PYndAcmragADY9J76q/TEAxnhliuQkmC223LEtZFLbQD/gYYEf6Mdzlekwi/NvlU5IFj lBmkxDFRA+eE0d46ps5fSwIHH/WRtghNJ9BNWlJc4DUhG2hsP3vB0LAsUJSejhRhTNpt lbG6oTYtM5AwlWn2bSFV1qS3VvTaabq4i/C94YdKpK+3ZEIh+XG0TWXcpDe8LZEqT+aH yEtw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=e+GGKs9Y; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b67-20020a636746000000b0046a1ae37df5si34216075pgc.147.2022.10.24.05.25.50; Mon, 24 Oct 2022 05:26:03 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=e+GGKs9Y; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233608AbiJXMZW (ORCPT + 99 others); Mon, 24 Oct 2022 08:25:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40658 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233549AbiJXMXs (ORCPT ); Mon, 24 Oct 2022 08:23:48 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 887C6237ED; Mon, 24 Oct 2022 04:59:48 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id BC43D61252; Mon, 24 Oct 2022 11:59:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CE7DBC433D6; Mon, 24 Oct 2022 11:59:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612788; bh=OYkkBGYFwO3XqTSXEnulGFuXbO6MZt4+eTDcMl83zT4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=e+GGKs9YeUZRtEMf8DLY5nmad7yt+S6SMTyierEy/FJYDk+wd8gpN4Mc8RXuv11Gz a0dOQh6XvSaB2ZhvKqmUnUrvCwfORInSF51nBCpMFO5rW4a6AGqM9ppn681njlNiwy Ag8I6MFC1jd205J72pgjRkuP6xyMCO66rK7dfvTs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, syzbot+a236dd8e9622ed8954a3@syzkaller.appspotmail.com, Xin Long , "David S. Miller" , Sasha Levin Subject: [PATCH 4.19 088/229] sctp: handle the error returned from sctp_auth_asoc_init_active_key Date: Mon, 24 Oct 2022 13:30:07 +0200 Message-Id: <20221024113001.902489012@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747571822508428141?= X-GMAIL-MSGID: =?utf-8?q?1747571822508428141?= From: Xin Long [ Upstream commit 022152aaebe116a25c39818a07e175a8cd3c1e11 ] When it returns an error from sctp_auth_asoc_init_active_key(), the active_key is actually not updated. The old sh_key will be freeed while it's still used as active key in asoc. Then an use-after-free will be triggered when sending patckets, as found by syzbot: sctp_auth_shkey_hold+0x22/0xa0 net/sctp/auth.c:112 sctp_set_owner_w net/sctp/socket.c:132 [inline] sctp_sendmsg_to_asoc+0xbd5/0x1a20 net/sctp/socket.c:1863 sctp_sendmsg+0x1053/0x1d50 net/sctp/socket.c:2025 inet_sendmsg+0x99/0xe0 net/ipv4/af_inet.c:819 sock_sendmsg_nosec net/socket.c:714 [inline] sock_sendmsg+0xcf/0x120 net/socket.c:734 This patch is to fix it by not replacing the sh_key when it returns errors from sctp_auth_asoc_init_active_key() in sctp_auth_set_key(). For sctp_auth_set_active_key(), old active_key_id will be set back to asoc->active_key_id when the same thing happens. Fixes: 58acd1009226 ("sctp: update active_key for asoc when old key is being replaced") Reported-by: syzbot+a236dd8e9622ed8954a3@syzkaller.appspotmail.com Signed-off-by: Xin Long Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- net/sctp/auth.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/net/sctp/auth.c b/net/sctp/auth.c index 9e0c98df20da..9cf61a18098a 100644 --- a/net/sctp/auth.c +++ b/net/sctp/auth.c @@ -886,12 +886,17 @@ int sctp_auth_set_key(struct sctp_endpoint *ep, } list_del_init(&shkey->key_list); - sctp_auth_shkey_release(shkey); list_add(&cur_key->key_list, sh_keys); - if (asoc && asoc->active_key_id == auth_key->sca_keynumber) - sctp_auth_asoc_init_active_key(asoc, GFP_KERNEL); + if (asoc && asoc->active_key_id == auth_key->sca_keynumber && + sctp_auth_asoc_init_active_key(asoc, GFP_KERNEL)) { + list_del_init(&cur_key->key_list); + sctp_auth_shkey_release(cur_key); + list_add(&shkey->key_list, sh_keys); + return -ENOMEM; + } + sctp_auth_shkey_release(shkey); return 0; } @@ -920,8 +925,13 @@ int sctp_auth_set_active_key(struct sctp_endpoint *ep, return -EINVAL; if (asoc) { + __u16 active_key_id = asoc->active_key_id; + asoc->active_key_id = key_id; - sctp_auth_asoc_init_active_key(asoc, GFP_KERNEL); + if (sctp_auth_asoc_init_active_key(asoc, GFP_KERNEL)) { + asoc->active_key_id = active_key_id; + return -ENOMEM; + } } else ep->active_key_id = key_id; From patchwork Mon Oct 24 11:30:08 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8734 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp423902wru; Mon, 24 Oct 2022 05:26:07 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6NcRs1M3mDMEm0NW/TFgbcLrpxjNgs/hWMOjELo1tPjfVXVpgJzmiIer9s49aaGa1gi6tT X-Received: by 2002:a17:90a:ca87:b0:212:d2bd:82f5 with SMTP id y7-20020a17090aca8700b00212d2bd82f5mr19161649pjt.203.1666614366859; Mon, 24 Oct 2022 05:26:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666614366; cv=none; d=google.com; s=arc-20160816; b=08kgFQ/EEE1pmtTguG8CEJKRtC5oCucALjW5s22wdO40PgrDI3/7lG3I5+5X0JzdqR MFcZQYdab7cXAqtyrasr01tK61plBvgK1IwHyG7+NMuBArbfVfxr0BL6nWFH4pd2FNoi 0qjJcvSZ8GNnB0SJUv0vAgNbOgP/yDqp6Ll1mo7TSdlIUQV21LaQj68Y/OrG+fYKcxtO 6G5Ai5pvbwjBuYUY5UoDcV4TLYxT8tFPJ+meHger8Fm8ccWcSDxcna6V9TG/pLmCyziG 9Nz5D+6PHpeIqrT2iK5bHCNJiZYdBN3PFiKEZvneEtr1uTeU/U0TpF8CF+1ap+7f8USg G66w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=GMKTB1EcXLe0EHqVVUDDMS1g2hl63xKTi2SECAhRRFE=; b=Q9wUGjCd8jCLf00Yoh5HfTqP7scx5I8TRMJMjLLiQqUtFzx7+0rfgqivd+c87dHg+6 5g+TSgJwcVqmlGXB2A4sCI3PeS2SezFdWjMaD21eAXlGFmgGJkHgTC944cvYT4zJ/SDM /hfXAaq4sjTANIhDb5W4toq4zszKYitrF2CHFSHIqNfhz1YBLUj6zrery/jDWSAsCHDX kBU9YemRwhrIQ6zgfkNIS6vnHVAB5g0xj1oKY8xZfSrRKf3BEoeq7q24SlPxKNEzNo68 FECnEZNoEKsomj0zkc3TYv3+QeylrajJyzGLdwJdAVLn/XUE5Q1OYPiS9TBqmfrkErE9 ZNiw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=GWyj6WX0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d5-20020a17090ac24500b001fb35ed6fdesi9914644pjx.53.2022.10.24.05.25.53; Mon, 24 Oct 2022 05:26:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=GWyj6WX0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229674AbiJXMZb (ORCPT + 99 others); Mon, 24 Oct 2022 08:25:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40684 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233646AbiJXMYA (ORCPT ); Mon, 24 Oct 2022 08:24:00 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C1F9922527; Mon, 24 Oct 2022 04:59:51 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 5AADC6125A; Mon, 24 Oct 2022 11:59:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6A20CC433C1; Mon, 24 Oct 2022 11:59:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612790; bh=5wL0QoNrXMlEsAfTy5b5VyxN3qju+5tl2qxEh+5ViiU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GWyj6WX0Qa/VEfbtcb/weLhdvI6mfxkdN6anv9tJdua9eJ2J/8MNYv1PVIbY2HlsO 1d3I3nGhhyyKd/pzFHUrBv7ENOo5y/VVaKz84Q1gDRh6u25c029DGyXl/zEnI2z3tm tF5vs8gUwTe7/k8XsXdxfCf2mnyrvxSG9NRRr1ho= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Neal Cardwell , "Kevin(Yudong) Yang" , Yuchung Cheng , Eric Dumazet , "David S. Miller" , Sasha Levin Subject: [PATCH 4.19 089/229] tcp: fix tcp_cwnd_validate() to not forget is_cwnd_limited Date: Mon, 24 Oct 2022 13:30:08 +0200 Message-Id: <20221024113001.932234349@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747571826386224436?= X-GMAIL-MSGID: =?utf-8?q?1747571826386224436?= From: Neal Cardwell [ Upstream commit f4ce91ce12a7c6ead19b128ffa8cff6e3ded2a14 ] This commit fixes a bug in the tracking of max_packets_out and is_cwnd_limited. This bug can cause the connection to fail to remember that is_cwnd_limited is true, causing the connection to fail to grow cwnd when it should, causing throughput to be lower than it should be. The following event sequence is an example that triggers the bug: (a) The connection is cwnd_limited, but packets_out is not at its peak due to TSO deferral deciding not to send another skb yet. In such cases the connection can advance max_packets_seq and set tp->is_cwnd_limited to true and max_packets_out to a small number. (b) Then later in the round trip the connection is pacing-limited (not cwnd-limited), and packets_out is larger. In such cases the connection would raise max_packets_out to a bigger number but (unexpectedly) flip tp->is_cwnd_limited from true to false. This commit fixes that bug. One straightforward fix would be to separately track (a) the next window after max_packets_out reaches a maximum, and (b) the next window after tp->is_cwnd_limited is set to true. But this would require consuming an extra u32 sequence number. Instead, to save space we track only the most important information. Specifically, we track the strongest available signal of the degree to which the cwnd is fully utilized: (1) If the connection is cwnd-limited then we remember that fact for the current window. (2) If the connection not cwnd-limited then we track the maximum number of outstanding packets in the current window. In particular, note that the new logic cannot trigger the buggy (a)/(b) sequence above because with the new logic a condition where tp->packets_out > tp->max_packets_out can only trigger an update of tp->is_cwnd_limited if tp->is_cwnd_limited is false. This first showed up in a testing of a BBRv2 dev branch, but this buggy behavior highlighted a general issue with the tcp_cwnd_validate() logic that can cause cwnd to fail to increase at the proper rate for any TCP congestion control, including Reno or CUBIC. Fixes: ca8a22634381 ("tcp: make cwnd-limited checks measurement-based, and gentler") Signed-off-by: Neal Cardwell Signed-off-by: Kevin(Yudong) Yang Signed-off-by: Yuchung Cheng Signed-off-by: Eric Dumazet Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- include/linux/tcp.h | 2 +- include/net/tcp.h | 5 ++++- net/ipv4/tcp.c | 2 ++ net/ipv4/tcp_output.c | 19 ++++++++++++------- 4 files changed, 19 insertions(+), 9 deletions(-) diff --git a/include/linux/tcp.h b/include/linux/tcp.h index 1192f1e76015..621ab5a7fb8f 100644 --- a/include/linux/tcp.h +++ b/include/linux/tcp.h @@ -263,7 +263,7 @@ struct tcp_sock { u32 packets_out; /* Packets which are "in flight" */ u32 retrans_out; /* Retransmitted packets out */ u32 max_packets_out; /* max packets_out in last window */ - u32 max_packets_seq; /* right edge of max_packets_out flight */ + u32 cwnd_usage_seq; /* right edge of cwnd usage tracking flight */ u16 urg_data; /* Saved octet of OOB data and control flags */ u8 ecn_flags; /* ECN status bits. */ diff --git a/include/net/tcp.h b/include/net/tcp.h index 436ad4bc9d4c..487b6c5f53f4 100644 --- a/include/net/tcp.h +++ b/include/net/tcp.h @@ -1231,11 +1231,14 @@ static inline bool tcp_is_cwnd_limited(const struct sock *sk) { const struct tcp_sock *tp = tcp_sk(sk); + if (tp->is_cwnd_limited) + return true; + /* If in slow start, ensure cwnd grows to twice what was ACKed. */ if (tcp_in_slow_start(tp)) return tp->snd_cwnd < 2 * tp->max_packets_out; - return tp->is_cwnd_limited; + return false; } /* BBR congestion control needs pacing. diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c index 768a7daab559..e25130812cc8 100644 --- a/net/ipv4/tcp.c +++ b/net/ipv4/tcp.c @@ -2607,6 +2607,8 @@ int tcp_disconnect(struct sock *sk, int flags) icsk->icsk_probes_out = 0; tp->snd_ssthresh = TCP_INFINITE_SSTHRESH; tp->snd_cwnd_cnt = 0; + tp->is_cwnd_limited = 0; + tp->max_packets_out = 0; tp->window_clamp = 0; tp->delivered = 0; tp->delivered_ce = 0; diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c index 35bf58599223..8962864223b4 100644 --- a/net/ipv4/tcp_output.c +++ b/net/ipv4/tcp_output.c @@ -1638,15 +1638,20 @@ static void tcp_cwnd_validate(struct sock *sk, bool is_cwnd_limited) const struct tcp_congestion_ops *ca_ops = inet_csk(sk)->icsk_ca_ops; struct tcp_sock *tp = tcp_sk(sk); - /* Track the maximum number of outstanding packets in each - * window, and remember whether we were cwnd-limited then. + /* Track the strongest available signal of the degree to which the cwnd + * is fully utilized. If cwnd-limited then remember that fact for the + * current window. If not cwnd-limited then track the maximum number of + * outstanding packets in the current window. (If cwnd-limited then we + * chose to not update tp->max_packets_out to avoid an extra else + * clause with no functional impact.) */ - if (!before(tp->snd_una, tp->max_packets_seq) || - tp->packets_out > tp->max_packets_out || - is_cwnd_limited) { - tp->max_packets_out = tp->packets_out; - tp->max_packets_seq = tp->snd_nxt; + if (!before(tp->snd_una, tp->cwnd_usage_seq) || + is_cwnd_limited || + (!tp->is_cwnd_limited && + tp->packets_out > tp->max_packets_out)) { tp->is_cwnd_limited = is_cwnd_limited; + tp->max_packets_out = tp->packets_out; + tp->cwnd_usage_seq = tp->snd_nxt; } if (tcp_is_cwnd_limited(sk)) { From patchwork Mon Oct 24 11:30:09 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8733 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp423856wru; Mon, 24 Oct 2022 05:26:00 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6r9GPSBdniMnzCOt9wkharJM50SoWbScLU1qYQD6hf9r47jJZfAOZQUgB972C+5SmmyBLd X-Received: by 2002:a17:902:b718:b0:17a:d64:de09 with SMTP id d24-20020a170902b71800b0017a0d64de09mr34118503pls.106.1666614360427; Mon, 24 Oct 2022 05:26:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666614360; cv=none; d=google.com; s=arc-20160816; b=D6p1MuGJt8WHKBzWXMgX1cXXMdkDTcurGc3wovSMqP3qqfkD0fRHQckZHvpFR1EAVz NINzVfGs7oUcKmBCkK+8dimi0yBdm+Jit19ZCf6yRX1qXvZz5vHEpTRDchI7h4mrZ2Co FmsM/Es7VbvyppCYRgPh+gR6kq/N/v3PKm5MekjtoJdKAN7MJ3xFiISfXG9oULM+1Qw+ lYzvaZhtxvyMroOZceBtNeTiLFCILJtMFfEehN2BGjxDwNAmo0cFQSx0UJUqYP+glVsi DFpkLNagN9NnZIDq6dzo+EcgSUmA8N/Bt+G5cP3VxLVtiD2LzVYPKWgraTx7jUWMnsk4 ri0Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=t/iIHtrV2Jg2jqrfGzEYZXaab1jahY8/hi8MnxizqUQ=; b=cNQD+FSKKOVVNsQAZ9is26ZeNj0qv8qj8K0ZgAb29i7iccs6XjLrNUG0h9nCE+o7l6 cTAIQnyGlP2lxSPM5AsuF8jV0C6xyKhfZDob32IQwtGts4GTgQKl59w01Vo6mOR/Lnlh iQREmknMUfkaQNOdMK2NCS74fIkEJ/9UJvNRd60i6tEBbOmHeNPZB9ziwoiNyLhbHS9i 5+MoSHzh4qkaojLzYMkc32Qy7Iq/QeLBBQkRNiB3BkY7HoolzNG+IbTw4HAz5khoJdYa +hp0SckR3zr4tJGt2jxFeoGRXC48tup4E4h6puwDSEFCtrl2EBO85eBGp/Jya4jK7Hz3 f2hg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=b2lvme8P; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q29-20020a635c1d000000b0045f83f1eb56si35996942pgb.234.2022.10.24.05.25.47; Mon, 24 Oct 2022 05:26:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=b2lvme8P; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233591AbiJXMZR (ORCPT + 99 others); Mon, 24 Oct 2022 08:25:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41626 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233543AbiJXMXp (ORCPT ); Mon, 24 Oct 2022 08:23:45 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4F605275F3; Mon, 24 Oct 2022 04:59:54 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id EDEB461257; Mon, 24 Oct 2022 11:59:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0C0C1C433D6; Mon, 24 Oct 2022 11:59:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612793; bh=7JSOKnN3EJHVsIrkcfYIdDr89HElem67G5x8SxQh7dA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=b2lvme8Pg1gThCv+SinYO8YoZlHJ3qKuDzbjJVJKGxqwLBoiaJS5v8ZOq284ugXqf m1/vpHPFMl4z5NNh3z13pn3mZgBlYR/1FTK3/aDn56kXmrcz/qGBo8nKii9Pco1ucQ iEH3qwgNHKSfjJ2NmpDujjZ64mjXvpR2YBGoHpJk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, syzbot , Hillf Danton , Tetsuo Handa , "David S. Miller" , Sasha Levin Subject: [PATCH 4.19 090/229] net: rds: dont hold sock lock when cancelling work from rds_tcp_reset_callbacks() Date: Mon, 24 Oct 2022 13:30:09 +0200 Message-Id: <20221024113001.961587129@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747571819220430775?= X-GMAIL-MSGID: =?utf-8?q?1747571819220430775?= From: Tetsuo Handa [ Upstream commit a91b750fd6629354460282bbf5146c01b05c4859 ] syzbot is reporting lockdep warning at rds_tcp_reset_callbacks() [1], for commit ac3615e7f3cffe2a ("RDS: TCP: Reduce code duplication in rds_tcp_reset_callbacks()") added cancel_delayed_work_sync() into a section protected by lock_sock() without realizing that rds_send_xmit() might call lock_sock(). We don't need to protect cancel_delayed_work_sync() using lock_sock(), for even if rds_{send,recv}_worker() re-queued this work while __flush_work() from cancel_delayed_work_sync() was waiting for this work to complete, retried rds_{send,recv}_worker() is no-op due to the absence of RDS_CONN_UP bit. Link: https://syzkaller.appspot.com/bug?extid=78c55c7bc6f66e53dce2 [1] Reported-by: syzbot Co-developed-by: Hillf Danton Signed-off-by: Hillf Danton Signed-off-by: Tetsuo Handa Tested-by: syzbot Fixes: ac3615e7f3cffe2a ("RDS: TCP: Reduce code duplication in rds_tcp_reset_callbacks()") Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- net/rds/tcp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/rds/tcp.c b/net/rds/tcp.c index d4e6466d3989..645cbb17c13a 100644 --- a/net/rds/tcp.c +++ b/net/rds/tcp.c @@ -176,10 +176,10 @@ void rds_tcp_reset_callbacks(struct socket *sock, */ atomic_set(&cp->cp_state, RDS_CONN_RESETTING); wait_event(cp->cp_waitq, !test_bit(RDS_IN_XMIT, &cp->cp_flags)); - lock_sock(osock->sk); /* reset receive side state for rds_tcp_data_recv() for osock */ cancel_delayed_work_sync(&cp->cp_send_w); cancel_delayed_work_sync(&cp->cp_recv_w); + lock_sock(osock->sk); if (tc->t_tinc) { rds_inc_put(&tc->t_tinc->ti_inc); tc->t_tinc = NULL; From patchwork Mon Oct 24 11:30:10 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8914 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp434356wru; Mon, 24 Oct 2022 05:52:02 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6nZcRO7akJFUKWK5cXrHFeMo7NmKyHEGe8aAA9Qcq0wIENogU4w3pQCsxt46tJ8EFbU4Qt X-Received: by 2002:a17:907:7fa9:b0:791:a5c2:e25 with SMTP id qk41-20020a1709077fa900b00791a5c20e25mr24573828ejc.444.1666615922025; Mon, 24 Oct 2022 05:52:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666615922; cv=none; d=google.com; s=arc-20160816; b=SwdscZxprwUet+xvUhum3KIA9ScNoXk7eAwRMTy5HTRV8E8Xjxp/+vfoOTtvrHGUkn 9KfKTefoQkaiI78ISvnJZ495eHn0onz/5MTaHN6sPoZnQaHgYxb/YME+Md+RO7RiNjST lELgMKIk+RmR4wOBOY6VwAVQVTTjvm3I8xbaHc+s0F+yNUXm7RAThy5DEumTFxX5YICA zi4hBt6N+DPjC+fYgFukbhPBcWvF3zk7z3kNvMGasSJxRqh6rvJJfHEEN56fsey2uaMY KIuvkr48Xz27kD/Pe6XnD3qL6VAYoD1OfZd0/KQZmbvd1HOT8OFoJOmCY06tBzA+nLaV bSrg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=IqxG8sXS6MuGk93/tZyoLfgJ35VTG9M/+t4GrLueqr4=; b=wP+qM9qfMKpsnmwdQ/HNXA5NMW7MRtgkWIZum6uBbKnK2Ubj0bQO2GA9U19+azqwq3 vCBTebczth7oOD1qgEyda4o9gjxUyBwEZBJjDjz06P9e/NHe8wtseNbjlH0q0OMu+2IN F3hGH0eywFf2Nv/9jaEy/0xlGdvN7M+SflNfQiaTvhwR7Edy8t2/FUCRIJXlaOFLHSMA LjOTrnjtYGXCo9cz/fLD/38nPbm0qlTUujMT+xNC/Q9XuNTTKOGNaBj6v1/U8uPyV1jo wqREi7IZmNNv4fUBtDhuaq2sThKzSA31k2gBPxjGfsp2U1sE5dNaAVJRf78e4mbMWGKC 9AdQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ZYeMa8Cj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id dn20-20020a17090794d400b007123952b00dsi27856152ejc.100.2022.10.24.05.51.37; Mon, 24 Oct 2022 05:52:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ZYeMa8Cj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234288AbiJXMsJ (ORCPT + 99 others); Mon, 24 Oct 2022 08:48:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37518 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232313AbiJXMnm (ORCPT ); Mon, 24 Oct 2022 08:43:42 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E1B2F6F26C; Mon, 24 Oct 2022 05:08:59 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 5069C612E9; Mon, 24 Oct 2022 11:58:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6208CC433C1; Mon, 24 Oct 2022 11:58:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612711; bh=2DLMFDvTjxIF3yJGEqdfltqyhOlUkWuzddtXO9fj3Yo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZYeMa8CjquGVjIVXX4f+hZxB7jewBJ98xpUwAlLXIpwHftXOwmt3hYFR7V7xlPcoR US2zBzY/u1sxPbil1NJg4O5mgqpAoR43ZYPbDKRI+xGQ8SKVIPIDoCZVZxnQ4xJDjF 106w+gjSfVcXxGMAW21WF7ZlYA4T7xAUV8iBRPkI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jianglei Nie , "David S. Miller" , Sasha Levin Subject: [PATCH 4.19 091/229] bnx2x: fix potential memory leak in bnx2x_tpa_stop() Date: Mon, 24 Oct 2022 13:30:10 +0200 Message-Id: <20221024113001.996309598@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747573456701725266?= X-GMAIL-MSGID: =?utf-8?q?1747573456701725266?= From: Jianglei Nie [ Upstream commit b43f9acbb8942b05252be83ac25a81cec70cc192 ] bnx2x_tpa_stop() allocates a memory chunk from new_data with bnx2x_frag_alloc(). The new_data should be freed when gets some error. But when "pad + len > fp->rx_buf_size" is true, bnx2x_tpa_stop() returns without releasing the new_data, which will lead to a memory leak. We should free the new_data with bnx2x_frag_free() when "pad + len > fp->rx_buf_size" is true. Fixes: 07b0f00964def8af9321cfd6c4a7e84f6362f728 ("bnx2x: fix possible panic under memory stress") Signed-off-by: Jianglei Nie Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c index 2610acf9ac36..53b1b05f905e 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c @@ -788,6 +788,7 @@ static void bnx2x_tpa_stop(struct bnx2x *bp, struct bnx2x_fastpath *fp, BNX2X_ERR("skb_put is about to fail... pad %d len %d rx_buf_size %d\n", pad, len, fp->rx_buf_size); bnx2x_panic(); + bnx2x_frag_free(fp, new_data); return; } #endif From patchwork Mon Oct 24 11:30:11 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8721 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp423523wru; Mon, 24 Oct 2022 05:25:11 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6rR5Ogfr49wsnCNsf/09FS4bdjld/C29hwJBrBTRiknPoTuOd+HMOoZk1ESpXVDVu/jANK X-Received: by 2002:a17:902:eccc:b0:186:5f09:f9 with SMTP id a12-20020a170902eccc00b001865f0900f9mr24139752plh.6.1666614310733; Mon, 24 Oct 2022 05:25:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666614310; cv=none; d=google.com; s=arc-20160816; b=T/gIN5GQq9s81ybByYQZpz5KTG1WNh8HdKR+zWcUt7n4SotX1luQytj/lSDalptkS1 t96zfkVKvkpNe14kjhVTuzUAmX9qmR91z2NViTDjV5HtcwSkLnMP4hbJltWgMT6/evws g+WDcioO6sSZuQtwT2MYBlpbHFIOB3lhu9bHDhJnuWZL2/XAhPTtGJ2wN6EWM7eMIXFU P1XPeABRLacbXGTvC7MC+CWBgMFwBWTdqGKzK17CBTWGdZBurtLYCHob4arKQ0v0Pp95 TPgE1T/rPYH5s0FCn24XTVBNWYRH67jCubDE4Sq+2i0IbApGfr/0QPZd9Rje+7ifwK2z tvTw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=VtgWNNu7gYtkNbNUU93VZfTTmIhcjV38OS5AdFip1zY=; b=V1WyvGmehTBDmrjIbCwhcx2GfCHaaRONdyfbXFuoMaPeDqjer5gXo+yAWtIjW/3S0I zbYVZVZ/reCfUMq6rRELC5O3UAT0M972wsZbzVUk8J6yC74gh+zuUVESwiUyIz7vDp8j omuEPHnEv99GtkjDYdx6OkUfuPydm/G3Eakh8KIB+Aw3cX5DNQ28/HjnzMqme9AtDogj /e//10/ees/b/Axk53Wp7p3kERtlmjwbUYprA3d+AvRIJ06vX6L5Q9kfkd3mlF9YO0Hr FAUMsubHYg2dDUg4ab8TOZ6EQqzkV4JUHYVf02KKrQ9lvx67BZfZoIUFSiP6XzBGe09G Kaog== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=jBB9Ov2s; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s33-20020a63ff61000000b0042be0a584cfsi10844151pgk.698.2022.10.24.05.24.57; Mon, 24 Oct 2022 05:25:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=jBB9Ov2s; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233575AbiJXMXW (ORCPT + 99 others); Mon, 24 Oct 2022 08:23:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40712 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233410AbiJXMVk (ORCPT ); Mon, 24 Oct 2022 08:21:40 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6A62D7C1EA; Mon, 24 Oct 2022 04:59:16 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id EDD8F612A4; Mon, 24 Oct 2022 11:58:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0A428C433C1; Mon, 24 Oct 2022 11:58:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612714; bh=/11Bn+/w1g2+97iqpB5rxj+jzSQ00chxTdkDUSp8RO0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jBB9Ov2sq6oBnmzRTiHBf99SlXGClNsrtwm1O9jjfQDxnPc7B/99lMtZVhdziRy5N w3jC7UJXAoutGM3g1xzFcCdvBdti0FueP4c4wl9B7MzSCiu5NGne6yDrA+yHnmvhPh sTPsGaiXKwgyjNGvvTlrsbDQNqkjELn29+a8VIS8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Christophe Leroy , Eric Dumazet , Willy Tarreau , "David S. Miller" , Sasha Levin Subject: [PATCH 4.19 092/229] once: add DO_ONCE_SLOW() for sleepable contexts Date: Mon, 24 Oct 2022 13:30:11 +0200 Message-Id: <20221024113002.025977656@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747571767453265969?= X-GMAIL-MSGID: =?utf-8?q?1747571767453265969?= From: Eric Dumazet [ Upstream commit 62c07983bef9d3e78e71189441e1a470f0d1e653 ] Christophe Leroy reported a ~80ms latency spike happening at first TCP connect() time. This is because __inet_hash_connect() uses get_random_once() to populate a perturbation table which became quite big after commit 4c2c8f03a5ab ("tcp: increase source port perturb table to 2^16") get_random_once() uses DO_ONCE(), which block hard irqs for the duration of the operation. This patch adds DO_ONCE_SLOW() which uses a mutex instead of a spinlock for operations where we prefer to stay in process context. Then __inet_hash_connect() can use get_random_slow_once() to populate its perturbation table. Fixes: 4c2c8f03a5ab ("tcp: increase source port perturb table to 2^16") Fixes: 190cc82489f4 ("tcp: change source port randomizarion at connect() time") Reported-by: Christophe Leroy Link: https://lore.kernel.org/netdev/CANn89iLAEYBaoYajy0Y9UmGFff5GPxDUoG-ErVB2jDdRNQ5Tug@mail.gmail.com/T/#t Signed-off-by: Eric Dumazet Cc: Willy Tarreau Tested-by: Christophe Leroy Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- include/linux/once.h | 28 ++++++++++++++++++++++++++++ lib/once.c | 30 ++++++++++++++++++++++++++++++ net/ipv4/inet_hashtables.c | 4 ++-- 3 files changed, 60 insertions(+), 2 deletions(-) diff --git a/include/linux/once.h b/include/linux/once.h index ae6f4eb41cbe..bb58e1c3aa03 100644 --- a/include/linux/once.h +++ b/include/linux/once.h @@ -5,10 +5,18 @@ #include #include +/* Helpers used from arbitrary contexts. + * Hard irqs are blocked, be cautious. + */ bool __do_once_start(bool *done, unsigned long *flags); void __do_once_done(bool *done, struct static_key_true *once_key, unsigned long *flags, struct module *mod); +/* Variant for process contexts only. */ +bool __do_once_slow_start(bool *done); +void __do_once_slow_done(bool *done, struct static_key_true *once_key, + struct module *mod); + /* Call a function exactly once. The idea of DO_ONCE() is to perform * a function call such as initialization of random seeds, etc, only * once, where DO_ONCE() can live in the fast-path. After @func has @@ -52,9 +60,29 @@ void __do_once_done(bool *done, struct static_key_true *once_key, ___ret; \ }) +/* Variant of DO_ONCE() for process/sleepable contexts. */ +#define DO_ONCE_SLOW(func, ...) \ + ({ \ + bool ___ret = false; \ + static bool __section(".data.once") ___done = false; \ + static DEFINE_STATIC_KEY_TRUE(___once_key); \ + if (static_branch_unlikely(&___once_key)) { \ + ___ret = __do_once_slow_start(&___done); \ + if (unlikely(___ret)) { \ + func(__VA_ARGS__); \ + __do_once_slow_done(&___done, &___once_key, \ + THIS_MODULE); \ + } \ + } \ + ___ret; \ + }) + #define get_random_once(buf, nbytes) \ DO_ONCE(get_random_bytes, (buf), (nbytes)) #define get_random_once_wait(buf, nbytes) \ DO_ONCE(get_random_bytes_wait, (buf), (nbytes)) \ +#define get_random_slow_once(buf, nbytes) \ + DO_ONCE_SLOW(get_random_bytes, (buf), (nbytes)) + #endif /* _LINUX_ONCE_H */ diff --git a/lib/once.c b/lib/once.c index 59149bf3bfb4..351f66aad310 100644 --- a/lib/once.c +++ b/lib/once.c @@ -66,3 +66,33 @@ void __do_once_done(bool *done, struct static_key_true *once_key, once_disable_jump(once_key, mod); } EXPORT_SYMBOL(__do_once_done); + +static DEFINE_MUTEX(once_mutex); + +bool __do_once_slow_start(bool *done) + __acquires(once_mutex) +{ + mutex_lock(&once_mutex); + if (*done) { + mutex_unlock(&once_mutex); + /* Keep sparse happy by restoring an even lock count on + * this mutex. In case we return here, we don't call into + * __do_once_done but return early in the DO_ONCE_SLOW() macro. + */ + __acquire(once_mutex); + return false; + } + + return true; +} +EXPORT_SYMBOL(__do_once_slow_start); + +void __do_once_slow_done(bool *done, struct static_key_true *once_key, + struct module *mod) + __releases(once_mutex) +{ + *done = true; + mutex_unlock(&once_mutex); + once_disable_jump(once_key, mod); +} +EXPORT_SYMBOL(__do_once_slow_done); diff --git a/net/ipv4/inet_hashtables.c b/net/ipv4/inet_hashtables.c index 5295a579ec82..70070f1003a0 100644 --- a/net/ipv4/inet_hashtables.c +++ b/net/ipv4/inet_hashtables.c @@ -765,8 +765,8 @@ int __inet_hash_connect(struct inet_timewait_death_row *death_row, if (likely(remaining > 1)) remaining &= ~1U; - net_get_random_once(table_perturb, - INET_TABLE_PERTURB_SIZE * sizeof(*table_perturb)); + get_random_slow_once(table_perturb, + INET_TABLE_PERTURB_SIZE * sizeof(*table_perturb)); index = port_offset & (INET_TABLE_PERTURB_SIZE - 1); offset = READ_ONCE(table_perturb[index]) + (port_offset >> 32); From patchwork Mon Oct 24 11:30:12 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8717 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp423480wru; Mon, 24 Oct 2022 05:25:03 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4aAzCq8Tg9Yqkm/CKXLfZYPRApU4QIaFGg6ZKTWV3hiKxk0Uggb9t5xyFoK8/t+Ee3bNTX X-Received: by 2002:a05:6a00:1390:b0:562:e518:9920 with SMTP id t16-20020a056a00139000b00562e5189920mr33657567pfg.54.1666614303284; Mon, 24 Oct 2022 05:25:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666614303; cv=none; d=google.com; s=arc-20160816; b=jPcM0a1+pRC+QsKQCgLznc5m7En4Vb0WKROy5HPKdl0zRoWycN0/B09+wFqh3fJJ2P +wYPeJrkpF1DQODx6Op8T9GRP/gPrG/m2NgLSdxMVSchfD016GGlwLkE0GVusuWVLXm/ CVFaQXcEek9MeG9FQb02h7UDtY+kibuvEs1DghC+K6bp4FGbBT9YfXNrmWMOu7oYPY7y CABZrw+zpDmX66HU0v5KENgUXcba3HZ4aLoXa0DngqEpChw1IRflq1FGfKw19Vk0k8qy LBTyMjXbUwliW+qTOj2Gg/ElxZX7dIurrRxlXbwespio0j07o48YMC2KoD2MzvkHcaFz Zksw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=dpIwQMSUlKf52h3AxRFuwPWPuBbyO2ic6gDif+ACFxk=; b=bT5j2oXScQNKyOGPLGoPaZlbLxsA5uFmnLDV+tCy/CJPo72Z91GX8bKNFfCBzz5xJ2 z8wAc6ja46Uku8C3e1HFt/yefvDH1+RC8EsnI/7jjPzsJN4YQBJPo2/o9Bq2gNf67pLs tEIlTAAKhKnIHjbmd0GILpva8x7Hq8HI0h/LWd3LBNvQeF4Aj2/4ccsDwzm8opKuH5Rj fwaqTzzCFbT5yBYVNV9FLIRUClVXfLwuIkJT/ITC7mHwuSqw2rpOlXcRIx03tPzdK5OE 0Y+tfq9K93+RATR7ZKPCTYsjyVptLaoa/1WTao2b30h3as0eyT4mawoJIMUxlgnq54np aH4A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="vWL0S/Zg"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u9-20020a17090282c900b00186b3cb9b80si1187672plz.354.2022.10.24.05.24.49; Mon, 24 Oct 2022 05:25:03 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="vWL0S/Zg"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233602AbiJXMXq (ORCPT + 99 others); Mon, 24 Oct 2022 08:23:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47374 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233518AbiJXMWh (ORCPT ); Mon, 24 Oct 2022 08:22:37 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 047AB2E6B5; Mon, 24 Oct 2022 04:59:17 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 92041612E8; Mon, 24 Oct 2022 11:58:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A3E5BC433D6; Mon, 24 Oct 2022 11:58:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612717; bh=dwYvbXJVWzetlCsNi7yucSsFrcK5alNlEyvytNaqAD8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vWL0S/ZgBBo/tA55e9BPZlevVRiEY0gA/UTbJegviHhwB0p0HXERwx4Wvw63N0DmR bUiMnrTo/KAOIBt4X3G/06SLpAcdx3yEP1S02CE3vq3B6l+qniZugpxeLUpn+4QD2T TBB6aG23COuSw1svp3VTF+pqeGQe+TXkG8xxOP00= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Russell King (Oracle)" , Marcin Wojtas , Jakub Kicinski , Sasha Levin Subject: [PATCH 4.19 093/229] net: mvpp2: fix mvpp2 debugfs leak Date: Mon, 24 Oct 2022 13:30:12 +0200 Message-Id: <20221024113002.058382203@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747571759834495879?= X-GMAIL-MSGID: =?utf-8?q?1747571759834495879?= From: Russell King (Oracle) [ Upstream commit 0152dfee235e87660f52a117fc9f70dc55956bb4 ] When mvpp2 is unloaded, the driver specific debugfs directory is not removed, which technically leads to a memory leak. However, this directory is only created when the first device is probed, so the hardware is present. Removing the module is only something a developer would to when e.g. testing out changes, so the module would be reloaded. So this memory leak is minor. The original attempt in commit fe2c9c61f668 ("net: mvpp2: debugfs: fix memory leak when using debugfs_lookup()") that was labelled as a memory leak fix was not, it fixed a refcount leak, but in doing so created a problem when the module is reloaded - the directory already exists, but mvpp2_root is NULL, so we lose all debugfs entries. This fix has been reverted. This is the alternative fix, where we remove the offending directory whenever the driver is unloaded. Fixes: 21da57a23125 ("net: mvpp2: add a debugfs interface for the Header Parser") Signed-off-by: Russell King (Oracle) Reviewed-by: Greg Kroah-Hartman Reviewed-by: Marcin Wojtas Link: https://lore.kernel.org/r/E1ofOAB-00CzkG-UO@rmk-PC.armlinux.org.uk Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin --- drivers/net/ethernet/marvell/mvpp2/mvpp2.h | 1 + drivers/net/ethernet/marvell/mvpp2/mvpp2_debugfs.c | 10 ++++++++-- drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c | 13 ++++++++++++- 3 files changed, 21 insertions(+), 3 deletions(-) diff --git a/drivers/net/ethernet/marvell/mvpp2/mvpp2.h b/drivers/net/ethernet/marvell/mvpp2/mvpp2.h index 46911b67b039..23f60bc5d48f 100644 --- a/drivers/net/ethernet/marvell/mvpp2/mvpp2.h +++ b/drivers/net/ethernet/marvell/mvpp2/mvpp2.h @@ -1107,5 +1107,6 @@ void mvpp2_percpu_write_relaxed(struct mvpp2 *priv, int cpu, u32 offset, void mvpp2_dbgfs_init(struct mvpp2 *priv, const char *name); void mvpp2_dbgfs_cleanup(struct mvpp2 *priv); +void mvpp2_dbgfs_exit(void); #endif diff --git a/drivers/net/ethernet/marvell/mvpp2/mvpp2_debugfs.c b/drivers/net/ethernet/marvell/mvpp2/mvpp2_debugfs.c index 87d9cbe10cec..004e0fac5455 100644 --- a/drivers/net/ethernet/marvell/mvpp2/mvpp2_debugfs.c +++ b/drivers/net/ethernet/marvell/mvpp2/mvpp2_debugfs.c @@ -648,6 +648,13 @@ static int mvpp2_dbgfs_port_init(struct dentry *parent, return 0; } +static struct dentry *mvpp2_root; + +void mvpp2_dbgfs_exit(void) +{ + debugfs_remove(mvpp2_root); +} + void mvpp2_dbgfs_cleanup(struct mvpp2 *priv) { debugfs_remove_recursive(priv->dbgfs_dir); @@ -655,10 +662,9 @@ void mvpp2_dbgfs_cleanup(struct mvpp2 *priv) void mvpp2_dbgfs_init(struct mvpp2 *priv, const char *name) { - struct dentry *mvpp2_dir, *mvpp2_root; + struct dentry *mvpp2_dir; int ret, i; - mvpp2_root = debugfs_lookup(MVPP2_DRIVER_NAME, NULL); if (!mvpp2_root) mvpp2_root = debugfs_create_dir(MVPP2_DRIVER_NAME, NULL); diff --git a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c index 52fdb200a0c7..788fe627e78a 100644 --- a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c +++ b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c @@ -5417,7 +5417,18 @@ static struct platform_driver mvpp2_driver = { }, }; -module_platform_driver(mvpp2_driver); +static int __init mvpp2_driver_init(void) +{ + return platform_driver_register(&mvpp2_driver); +} +module_init(mvpp2_driver_init); + +static void __exit mvpp2_driver_exit(void) +{ + platform_driver_unregister(&mvpp2_driver); + mvpp2_dbgfs_exit(); +} +module_exit(mvpp2_driver_exit); MODULE_DESCRIPTION("Marvell PPv2 Ethernet Driver - www.marvell.com"); MODULE_AUTHOR("Marcin Wojtas "); From patchwork Mon Oct 24 11:30:13 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8722 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp423524wru; Mon, 24 Oct 2022 05:25:11 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4UIMS5Ijc4JQ3bWhDNSevcwjUMKCVc+tQWMWtTZsB73/asJbdMoD2epPKr3ut6xDY/Sm4Y X-Received: by 2002:a63:3c7:0:b0:46e:acf4:6265 with SMTP id 190-20020a6303c7000000b0046eacf46265mr16774835pgd.369.1666614310832; Mon, 24 Oct 2022 05:25:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666614310; cv=none; d=google.com; s=arc-20160816; b=vSZYAznqILEMpporUXSXvbOI7ePKPv4wJzloONCgGXG/W1wDp3AmbK6+Bhx87saEQV 5l3cGZ5hCAAR6SZ2NHp7MIqQ6+pXN0OmzU3H8uofooG3jChg4QHC7cv80DVWy3jnyZbq 7QdDI2DYoIa/MJ193Dkj89V4yBVvu1oVElSbO1QU0boeEgOYMfAplzgy+MIMPxltrESs zD6eCFAK0hkAFoay5Vxbeun9HZmCSQTfqk3aF4cNYmZEGkxFDVeP03PLUd94GKf2lBsJ wx3PKSpJW1mp/CaPjaOSLRcJNpZBCuZLoEd9EzT61Ijfc9VK0AgdV5+bK3anDXUJQAxF 3UOA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=eIqCf5oOXBYHe0iETpFkvzVJ1/L15vLKeJnLv5Jj0T8=; b=FbkeXQzywE2LMP6Y+V4hYPVje03FTZzwl2hwIURaCP/a/Iu68dAq8Icq9xze8Zji+v bHdCg6TAs7xmYaWd/87BeQ/KS/lDrE/xsaR+Fgk7EFm1XmsnoQlg0aRasLlRr8jwQfgC yq/+cOZmPr3GYtrjtVy5aq4BGNs0c455n5K3nseLx4m0fQESAwSSXI5PqfuS04kf7Yf1 cYXs/OXklByCvwD16VebSzcgVvo529tn3OjwFwctFG2uwHPfeIJ8BIFYbDHoDVz37Was 8UxoygzSUszLXjBohEM0H0C6X8CJr4vH3o4kNq68vUN2a5qd02xiHzFodeRqMBzRrKRr Ybxw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=rCHAcMRH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z10-20020a63c04a000000b0044ed36e4c57si35181327pgi.217.2022.10.24.05.24.57; Mon, 24 Oct 2022 05:25:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=rCHAcMRH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233628AbiJXMX6 (ORCPT + 99 others); Mon, 24 Oct 2022 08:23:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55846 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233233AbiJXMWn (ORCPT ); Mon, 24 Oct 2022 08:22:43 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9DACA63E7; Mon, 24 Oct 2022 04:59:23 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 3D8FA61280; Mon, 24 Oct 2022 11:58:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4F296C433D7; Mon, 24 Oct 2022 11:58:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612719; bh=KqhLPw44/U/3UiBEYNT1QjNxtDA8eRK5sbZocUnIHaw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rCHAcMRHctbUPZQgVpIlNhrRvQATvyIZ3ubqyD47m2vaNfLJ+cScZIMYFqVj9q3Jg I/45KplujBZIcJbS07n0TSd3PVrafZc2mPUzZVSsoC3pDirbZEOTCm3YCrUsi6GEVH VionEYxRL9zM4+4k9JHE+8c7O/2xfe4TDAhHxJZ4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?utf-8?q?Alvin_=C5=A0ipraga?= , Robert Foss , Sasha Levin Subject: [PATCH 4.19 094/229] drm: bridge: adv7511: fix CEC power down control register offset Date: Mon, 24 Oct 2022 13:30:13 +0200 Message-Id: <20221024113002.087392095@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747571767657112206?= X-GMAIL-MSGID: =?utf-8?q?1747571767657112206?= From: Alvin Šipraga [ Upstream commit 1d22b6033ea113a4c3850dfa2c0770885c81aec8 ] The ADV7511_REG_CEC_CTRL = 0xE2 register is part of the main register map - not the CEC register map. As such, we shouldn't apply an offset to the register address. Doing so will cause us to address a bogus register for chips with a CEC register map offset (e.g. ADV7533). Fixes: 3b1b975003e4 ("drm: adv7511/33: add HDMI CEC support") Signed-off-by: Alvin Šipraga Reviewed-by: Robert Foss Signed-off-by: Robert Foss Link: https://patchwork.freedesktop.org/patch/msgid/20220612144854.2223873-2-alvin@pqrs.dk Signed-off-by: Sasha Levin --- drivers/gpu/drm/bridge/adv7511/adv7511.h | 5 +---- drivers/gpu/drm/bridge/adv7511/adv7511_cec.c | 4 ++-- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/bridge/adv7511/adv7511.h b/drivers/gpu/drm/bridge/adv7511/adv7511.h index 73d8ccb97742..d214865c2459 100644 --- a/drivers/gpu/drm/bridge/adv7511/adv7511.h +++ b/drivers/gpu/drm/bridge/adv7511/adv7511.h @@ -383,10 +383,7 @@ void adv7511_cec_irq_process(struct adv7511 *adv7511, unsigned int irq1); #else static inline int adv7511_cec_init(struct device *dev, struct adv7511 *adv7511) { - unsigned int offset = adv7511->type == ADV7533 ? - ADV7533_REG_CEC_OFFSET : 0; - - regmap_write(adv7511->regmap, ADV7511_REG_CEC_CTRL + offset, + regmap_write(adv7511->regmap, ADV7511_REG_CEC_CTRL, ADV7511_CEC_CTRL_POWER_DOWN); return 0; } diff --git a/drivers/gpu/drm/bridge/adv7511/adv7511_cec.c b/drivers/gpu/drm/bridge/adv7511/adv7511_cec.c index a20a45c0b353..ddd1305b82b2 100644 --- a/drivers/gpu/drm/bridge/adv7511/adv7511_cec.c +++ b/drivers/gpu/drm/bridge/adv7511/adv7511_cec.c @@ -316,7 +316,7 @@ int adv7511_cec_init(struct device *dev, struct adv7511 *adv7511) goto err_cec_alloc; } - regmap_write(adv7511->regmap, ADV7511_REG_CEC_CTRL + offset, 0); + regmap_write(adv7511->regmap, ADV7511_REG_CEC_CTRL, 0); /* cec soft reset */ regmap_write(adv7511->regmap_cec, ADV7511_REG_CEC_SOFT_RESET + offset, 0x01); @@ -343,7 +343,7 @@ int adv7511_cec_init(struct device *dev, struct adv7511 *adv7511) dev_info(dev, "Initializing CEC failed with error %d, disabling CEC\n", ret); err_cec_parse_dt: - regmap_write(adv7511->regmap, ADV7511_REG_CEC_CTRL + offset, + regmap_write(adv7511->regmap, ADV7511_REG_CEC_CTRL, ADV7511_CEC_CTRL_POWER_DOWN); return ret == -EPROBE_DEFER ? ret : 0; } From patchwork Mon Oct 24 11:30:14 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 10302 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp654941wru; Mon, 24 Oct 2022 14:13:46 -0700 (PDT) X-Google-Smtp-Source: AMsMyM66hxpUihiK90Xax5T7WMPv12VBvhTZMjOpUru2lsPgfJY+QaraHwiVH/vyl4r38/cHyhiD X-Received: by 2002:aa7:9a09:0:b0:562:64cc:94e0 with SMTP id w9-20020aa79a09000000b0056264cc94e0mr35188102pfj.60.1666646026622; Mon, 24 Oct 2022 14:13:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666646026; cv=none; d=google.com; s=arc-20160816; b=U5S4W195UN9R2wby4yS+UxbW0CLNE5iH/j0zJa4gw6i3shNuHxr2aS+JMemxijXRTH 06l1uFrA6qnXMkgvi8HlTih/abZAY+vKZlM+lvQitVtsbLOeUPsVM1t5i9+XuIbR78y1 Yf+PGzuzQtgYMQQoUrX9U0vqHU3aaLDh9d5Fh3H/Q8SWQfqPs0YHcE6YIEHzkorKLRnm NjxL+jpqRrhQoFxs+eypWdnB4b1GcTH5ndjO3SN0trMwX9lvkulQGB6/TLwzQjvYOSVs 1kdVVm83KB90ihw72nqa4WqEm9nNvhvx22l0jpgLFbFahA0sVwMKKHteFFmdgZKU2S7l vt+A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=5A8WTLps5TI7lgV5aftwzc+9Sy4LidjYAS8v5d0BpGU=; b=oK0JqFoYsW0lpJzN2IZFWtAts8XiUUzhaCCeC7f4gF8XGoydctPk7Ky+91FbtnlsX8 YFlDF5YfSQS9+LIiNam/lcvOF3qHXxjMzlTzvpVhxE5Nnwb5L7mNR9EjGGW31fXQ27rf fHC2GrQfFCCM5zd6s0J+slRuCw2enTZxHERc5HDHq9hlxbTP1TEPtYfE4JQJ8OmE78zH 3EMPmU8DT2DyQZdTd38JFajl7QrObN+YA6s2ic+CeCE29VYA1rlqMaum4p28hvOIy4Yi Ci7c+x158eqJORmj/TvQ2oq4Eld05UlFEpVhlCPVjz87CJCKdcbtwdeayVFPtOnKaZAp lJzw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=rRlbPLl3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 190-20020a6300c7000000b0045fad1c30e6si558376pga.602.2022.10.24.14.13.32; Mon, 24 Oct 2022 14:13:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=rRlbPLl3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231510AbiJXVMO (ORCPT + 99 others); Mon, 24 Oct 2022 17:12:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60454 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233406AbiJXVLe (ORCPT ); Mon, 24 Oct 2022 17:11:34 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1D98315FCA; Mon, 24 Oct 2022 12:17:54 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 8D502B811FB; Mon, 24 Oct 2022 11:58:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DBEE8C433D6; Mon, 24 Oct 2022 11:58:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612722; bh=XfMKacPpJHtPyrtK6XCrrjpMb+UmbtczHbISfWsQXXM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rRlbPLl3mzKxwDFbzDqCBi++Wy/p0g8+gzzUzZvUxu7X2yDldGgMYL8PVdImdoPw1 FlDTCZIJEfiUYadXbiQes6BEEjriGkgWq0w4Rrex6vRcN6yeicJ9pI5P5i6GSkmEnY 3DgkI634OezbhmRo2U+74hALAmVuPOx7NWd3BZqA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Thomas Zimmermann , Maxime Ripard , Sasha Levin Subject: [PATCH 4.19 095/229] drm/mipi-dsi: Detach devices when removing the host Date: Mon, 24 Oct 2022 13:30:14 +0200 Message-Id: <20221024113002.116718205@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747605024139832282?= X-GMAIL-MSGID: =?utf-8?q?1747605024139832282?= From: Maxime Ripard [ Upstream commit 668a8f17b5290d04ef7343636a5588a0692731a1 ] Whenever the MIPI-DSI host is unregistered, the code of mipi_dsi_host_unregister() loops over every device currently found on that bus and will unregister it. However, it doesn't detach it from the bus first, which leads to all kind of resource leaks if the host wants to perform some clean up whenever a device is detached. Fixes: 068a00233969 ("drm: Add MIPI DSI bus support") Acked-by: Thomas Zimmermann Signed-off-by: Maxime Ripard Link: https://lore.kernel.org/r/20220711173939.1132294-2-maxime@cerno.tech Signed-off-by: Sasha Levin --- drivers/gpu/drm/drm_mipi_dsi.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/gpu/drm/drm_mipi_dsi.c b/drivers/gpu/drm/drm_mipi_dsi.c index 7ed8e510565e..c8c9daecd00d 100644 --- a/drivers/gpu/drm/drm_mipi_dsi.c +++ b/drivers/gpu/drm/drm_mipi_dsi.c @@ -305,6 +305,7 @@ static int mipi_dsi_remove_device_fn(struct device *dev, void *priv) { struct mipi_dsi_device *dsi = to_mipi_dsi_device(dev); + mipi_dsi_detach(dsi); mipi_dsi_device_unregister(dsi); return 0; From patchwork Mon Oct 24 11:30:15 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8788 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp430787wru; Mon, 24 Oct 2022 05:42:17 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6eRJXL/8enThersG+4hpqaqkEOm7RPsygyfIzGVQNQ+o3bqMdbq23/6fBWgDoOefrnc6Ej X-Received: by 2002:a05:6a00:2303:b0:56b:cd7e:6cb with SMTP id h3-20020a056a00230300b0056bcd7e06cbmr5300405pfh.77.1666615337342; Mon, 24 Oct 2022 05:42:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666615337; cv=none; d=google.com; s=arc-20160816; b=HrJJ55JuhYt/okskEc48s5heCFB6v2qs6PfhDpnpOQralLlzv+iRMtXMGBDlCH0y0e Yy28X2BBD7z6wkySVwTxd7ACeI3wiucy4yeP6n1aprE3IGS75l5tXr3WKWbjeIY23Qpp x7Xp2fVRMX7DA6TF6QHTDWicFppbgvK30sCLj4/7/RE12f1ch3mIHrzMTO7ROPxf2+LC bNZxykAQQCL2FSguSaWs6etbx6BGdjA+92ysFf8pT0Uyk6Q4RnEukTLUnyXNWtdFosTj pIuYFTpGgbbCNBXIQHoPSFqiJp7FPh4C8JFbS95/AIVcQ/AYDa0vag0dB4UwYkJ7FTSV lPzA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=7uYPatAW9SteJkyqvwO1+D+mBwdWFGZ5tusNPrMZny0=; b=ffsaq61+zUkBU1KZaBzGyBvDiCW7f3YBazScuWKzNrYgB/1NmEAaa/sEA6otwYJuqG 9RtkA7U1XbpS2pIllGbiT8aP0Dj242owepQ/VyLsymixEmDDcj5XvtM1pybxt0hBmGR7 YF4KjMQxftjQm8rKWK5EmfCTxqCDKjIN3W0NIw953yaRT22X9VRj9Bi1CDZQEPLaJqkU 4p70yJVvyj/8jQ/6p2E8c+SI1HZ2EvCTv1Kbu39ro03+ubkUIBnd+CqqENkG4Lk0KGAH 71D0q/1MgG6jFMxddun7y5EHG6xbVk9sjhq9RDimqDszsB9A1INRMSQ/ItYbBuGCCDNj jSjg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="s/Xkn4gW"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id oj4-20020a17090b4d8400b001fde53d5d79si10750615pjb.5.2022.10.24.05.42.03; Mon, 24 Oct 2022 05:42:17 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="s/Xkn4gW"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233861AbiJXMbK (ORCPT + 99 others); Mon, 24 Oct 2022 08:31:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45038 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233892AbiJXM2f (ORCPT ); Mon, 24 Oct 2022 08:28:35 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7E39C87084; Mon, 24 Oct 2022 05:02:21 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 31361B811F3; Mon, 24 Oct 2022 11:58:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 83541C433D7; Mon, 24 Oct 2022 11:58:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612724; bh=jaNEfKMGPQ1cfaDS8CZOXepZ1pbex2yIiOQ5Fxk2vwc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=s/Xkn4gWDxWZurV5O5p3vz41t4kGaEG2RP/2lbXr9TGwkoPNpQyywPl4edHQqvWP+ 81eIv/fbqJCG44DuB0TDXPbyBi3XdzwCDvMqBrlZ55ofsPPlR8Sa5NvbI8C/ceZ7NT rsH3WnoOI1KDJLm0DJJc0KUgaddUlgJhGHHJ0WZ8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Rustam Subkhankulov , Dmitry Torokhov , Tzung-Bi Shih , Sasha Levin Subject: [PATCH 4.19 096/229] platform/chrome: fix double-free in chromeos_laptop_prepare() Date: Mon, 24 Oct 2022 13:30:15 +0200 Message-Id: <20221024113002.146835479@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747572843870661155?= X-GMAIL-MSGID: =?utf-8?q?1747572843870661155?= From: Rustam Subkhankulov [ Upstream commit 6ad4194d6a1e1d11b285989cd648ef695b4a93c0 ] If chromeos_laptop_prepare_i2c_peripherals() fails after allocating memory for 'cros_laptop->i2c_peripherals', this memory is freed at 'err_out' label and nonzero value is returned. Then chromeos_laptop_destroy() is called, resulting in double-free error. Found by Linux Verification Center (linuxtesting.org) with SVACE. Signed-off-by: Rustam Subkhankulov Fixes: 5020cd29d8bf ("platform/chrome: chromeos_laptop - supply properties for ACPI devices") Reviewed-by: Dmitry Torokhov Signed-off-by: Tzung-Bi Shih Link: https://lore.kernel.org/r/20220813220843.2373004-1-subkhankulov@ispras.ru Signed-off-by: Sasha Levin --- drivers/platform/chrome/chromeos_laptop.c | 24 ++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/drivers/platform/chrome/chromeos_laptop.c b/drivers/platform/chrome/chromeos_laptop.c index 24326eecd787..096e8e5b2cde 100644 --- a/drivers/platform/chrome/chromeos_laptop.c +++ b/drivers/platform/chrome/chromeos_laptop.c @@ -716,6 +716,7 @@ static int __init chromeos_laptop_prepare_i2c_peripherals(struct chromeos_laptop *cros_laptop, const struct chromeos_laptop *src) { + struct i2c_peripheral *i2c_peripherals; struct i2c_peripheral *i2c_dev; struct i2c_board_info *info; int i; @@ -724,17 +725,15 @@ chromeos_laptop_prepare_i2c_peripherals(struct chromeos_laptop *cros_laptop, if (!src->num_i2c_peripherals) return 0; - cros_laptop->i2c_peripherals = kmemdup(src->i2c_peripherals, - src->num_i2c_peripherals * - sizeof(*src->i2c_peripherals), - GFP_KERNEL); - if (!cros_laptop->i2c_peripherals) + i2c_peripherals = kmemdup(src->i2c_peripherals, + src->num_i2c_peripherals * + sizeof(*src->i2c_peripherals), + GFP_KERNEL); + if (!i2c_peripherals) return -ENOMEM; - cros_laptop->num_i2c_peripherals = src->num_i2c_peripherals; - - for (i = 0; i < cros_laptop->num_i2c_peripherals; i++) { - i2c_dev = &cros_laptop->i2c_peripherals[i]; + for (i = 0; i < src->num_i2c_peripherals; i++) { + i2c_dev = &i2c_peripherals[i]; info = &i2c_dev->board_info; error = chromeos_laptop_setup_irq(i2c_dev); @@ -752,16 +751,19 @@ chromeos_laptop_prepare_i2c_peripherals(struct chromeos_laptop *cros_laptop, } } + cros_laptop->i2c_peripherals = i2c_peripherals; + cros_laptop->num_i2c_peripherals = src->num_i2c_peripherals; + return 0; err_out: while (--i >= 0) { - i2c_dev = &cros_laptop->i2c_peripherals[i]; + i2c_dev = &i2c_peripherals[i]; info = &i2c_dev->board_info; if (info->properties) property_entries_free(info->properties); } - kfree(cros_laptop->i2c_peripherals); + kfree(i2c_peripherals); return error; } From patchwork Mon Oct 24 11:30:16 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8775 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp430584wru; Mon, 24 Oct 2022 05:41:55 -0700 (PDT) X-Google-Smtp-Source: AMsMyM79MLhkkoDcAWn26Pdnon3yYmtIKRPvhkdjhIGn0ZwjvAbu64cOtUuNX+d0QU5Ru4cbqHeu X-Received: by 2002:a17:902:ec83:b0:185:581a:1c with SMTP id x3-20020a170902ec8300b00185581a001cmr32523557plg.78.1666615304601; Mon, 24 Oct 2022 05:41:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666615304; cv=none; d=google.com; s=arc-20160816; b=KeaMtsDb+ZHII4JJ7+aiNsQ/vtEYJs2OnB7Fhn3NcxP+rNFAjY+ZBWzaHz/D+LpQRc 8vxhkwszIfze3bi7AJG+QHI6HnaywT1eYpCrl96MDkQsV9iQkgbJ5qr2X6lk19z2/xCQ z2xeTYxy/Vqx4vKIQt/NqdPUvcu9sA+2d8tEhLDmHToX3LkJdn1pboXEu+sqbJUBF1dx y0mWZF4IZsr5+dUYGS6dVBVkU6rzU9uuqti48GznT/icUed+6FrUEwhstXPad/3RCVHI DTMmxDdcw/BlSXJ3DwUJiaWS/wvDSJwIO12+lSJEdVp515a59M/0r9W8DWfCNn2AcUdU Rhcw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=W5TlCFZqPFVZMvd7vZxFCTmLiY4J76n86xvQCe2pJEo=; b=ClZlkk5YusS3unNpF1EniWt/moyCtBDvk83j3kf8yLjZWbx8zHHRqcrqc+AeZwHrSr ppI69cfeamvrp7woASwy0JwOOiwaOY7AWUG8WBIYHLQplYUWUBfoX6jv2Iu+wDO4/5ZF wYXQfRuCHvgp2mB3rd/I9CkbnWpJKbGAooAZ3BGGjI9TQyjGjZbCNUa53Y3oh8mu86+d 5YoibDGD7d4fQjBo7uURRJ5G2snnTC3Mij42SYOgItkRSvmUe4o0fy/uGmXXG8X1qp+w pnxiWO+5e/HmtFdMWryhUq+S+J9sLhrTqPtoyjNIZO3ypwiYWDCnMiuKVr0MG/y5HAsU DRhA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=o3ddocst; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k12-20020a170902ba8c00b00179f9521d08si29924117pls.149.2022.10.24.05.41.30; Mon, 24 Oct 2022 05:41:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=o3ddocst; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233907AbiJXMbk (ORCPT + 99 others); Mon, 24 Oct 2022 08:31:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60548 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233731AbiJXM2w (ORCPT ); Mon, 24 Oct 2022 08:28:52 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E832C87088; Mon, 24 Oct 2022 05:02:21 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id C59F1B811C1; Mon, 24 Oct 2022 11:58:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 25911C433C1; Mon, 24 Oct 2022 11:58:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612727; bh=8veHvggDsF0H695N4ZaRHLld1XJTkiSOIyJfY6Uu+i8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=o3ddocst3sv+7EjJg2w9vwbkBB2e6JoMl+P3iKslEPvV/G5jai9wS5zsn5qpir9ub X0KwTjoylkTkYaCvJFUy3MPNds2+E5TP52w/YiOThOYcE0OgBnjDFeCBh9CBOxXF9U vxTlBNlXD0ohlb/jua89yK1ivYBVe46+SaZydNF8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hans de Goede , Sasha Levin Subject: [PATCH 4.19 097/229] platform/x86: msi-laptop: Fix old-ec check for backlight registering Date: Mon, 24 Oct 2022 13:30:16 +0200 Message-Id: <20221024113002.176828433@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747572809741722507?= X-GMAIL-MSGID: =?utf-8?q?1747572809741722507?= From: Hans de Goede [ Upstream commit 83ac7a1c2ed5f17caa07cbbc84bad3c05dc3bf22 ] Commit 2cc6c717799f ("msi-laptop: Port to new backlight interface selection API") replaced this check: if (!quirks->old_ec_model || acpi_video_backlight_support()) pr_info("Brightness ignored, ..."); else do_register(); With: if (quirks->old_ec_model || acpi_video_get_backlight_type() == acpi_backlight_vendor) do_register(); But since the do_register() part was part of the else branch, the entire condition should be inverted. So not only the 2 statements on either side of the || should be inverted, but the || itself should be replaced with a &&. In practice this has likely not been an issue because the new-ec models (old_ec_model==false) likely all support ACPI video backlight control, making acpi_video_get_backlight_type() return acpi_backlight_video turning the second part of the || also false when old_ec_model == false. Fixes: 2cc6c717799f ("msi-laptop: Port to new backlight interface selection API") Signed-off-by: Hans de Goede Link: https://lore.kernel.org/r/20220825141336.208597-1-hdegoede@redhat.com Signed-off-by: Sasha Levin --- drivers/platform/x86/msi-laptop.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/platform/x86/msi-laptop.c b/drivers/platform/x86/msi-laptop.c index d5bfcc602090..7279390a2d54 100644 --- a/drivers/platform/x86/msi-laptop.c +++ b/drivers/platform/x86/msi-laptop.c @@ -1061,8 +1061,7 @@ static int __init msi_init(void) return -EINVAL; /* Register backlight stuff */ - - if (quirks->old_ec_model || + if (quirks->old_ec_model && acpi_video_get_backlight_type() == acpi_backlight_vendor) { struct backlight_properties props; memset(&props, 0, sizeof(struct backlight_properties)); From patchwork Mon Oct 24 11:30:17 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8716 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp423458wru; Mon, 24 Oct 2022 05:25:00 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6dzzhgXm3KhS1ujMdT9YMGj+7cPs6J1iLPAyP6xzTeCbQL3Q1Twb6bTNmcbLB9Sx4TXErv X-Received: by 2002:a17:90b:1d08:b0:212:de5d:e9e5 with SMTP id on8-20020a17090b1d0800b00212de5de9e5mr14914764pjb.239.1666614300320; Mon, 24 Oct 2022 05:25:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666614300; cv=none; d=google.com; s=arc-20160816; b=KCWCCLOuBDWiBAA7pUhNcy/uI/pLzlwU4c3PGHlOVl3aM02JNaTx1lbeago3yQ4vAb m+M+auqqNI8Hfh5wjZtJVlyKpC/aGgEFm5Wp8+IPZ4TnxzpOsz75jz3DZy09/bDUDq3b TixLi/Ov377MG0YhxEommiD8F+FQT/xSBqafpxNFXrRrpqSutqB0sLEaEb/hMvMAEg3F B8s9mMJu2x5cveNyOQ9VUIaZaKMwcWU16Xkt2iZNueoJV9rter/RaMeYCMG4netE9OjQ XoaBn3vBqeUK1HI0ph6o01kwYHdw577bfwC6L0BEyvhCGBPiNp0b2V0y8298dcaa+HRX 8rlA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=ReqmkBiLT9nj1/NEl8rl8sQNmaUIGHG6NWhdHtHMQIE=; b=ECGN9TMdip3pXRXq4jNaI0C4ZORDw3mXsX86uYJfJAD8W08EREnfaB6cfZFNW1lCN2 5lKyQIVmggh50/yqDi2LBjqDmvPpPmXIJgVsCjrRN2A1qGYxghoa9z8cxf1lsFw9MQYA R1oIQ9SHbqDHSTzWsYYHEpMjJs1FwqbeAVKSzTMIGNbW8YoUn+HcksXrSMkbonUt1Ll/ j0HrR/bFi8ez47ZomYoV80jeZYu2XXOl2TekXwQcPMSRf5vxwn6V5PZrc6U18/+QgWUf uM2ZuVYUzTIUYqHLKHIvj5QUWor+bZEI+//ryPEaBzGogk4r263bunxzJyTqN/B3X9dR EPyA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=RibFMv8Q; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h13-20020a170902f54d00b00179f3da346bsi39628801plf.39.2022.10.24.05.24.46; Mon, 24 Oct 2022 05:25:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=RibFMv8Q; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233539AbiJXMXl (ORCPT + 99 others); Mon, 24 Oct 2022 08:23:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41370 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233517AbiJXMWh (ORCPT ); Mon, 24 Oct 2022 08:22:37 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 28ACAA447; Mon, 24 Oct 2022 04:59:24 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id AC7686127C; Mon, 24 Oct 2022 11:58:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BFA70C433C1; Mon, 24 Oct 2022 11:58:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612730; bh=xK4TJAnvmIYn/27eY3hx0LNJJauXMyCiuXPB+sk2Bhk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RibFMv8QUds1gkZNQv+NqisbKHgSqIrQC6zNNpEiOmNQD7zOylUaw7tMmNLCdcQxh mt3GmMNw35caGhP0xgFEa3ESaemwR/ED9vEfVALCLPKfkDOyznTmIPKpwbvlr6Mn+o CKzu+ywk1AhJTyTdaSDUE3P/0R3A9L8Chyj+m2+Q= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hans de Goede , Sasha Levin Subject: [PATCH 4.19 098/229] platform/x86: msi-laptop: Fix resource cleanup Date: Mon, 24 Oct 2022 13:30:17 +0200 Message-Id: <20221024113002.205914876@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747571756540904134?= X-GMAIL-MSGID: =?utf-8?q?1747571756540904134?= From: Hans de Goede [ Upstream commit 5523632aa10f906dfe2eb714ee748590dc7fc6b1 ] Fix the input-device not getting free-ed on probe-errors and fix the msi_touchpad_dwork not getting cancelled on neither probe-errors nor on remove. Fixes: 143a4c0284dc ("msi-laptop: send out touchpad on/off key") Signed-off-by: Hans de Goede Link: https://lore.kernel.org/r/20220825141336.208597-3-hdegoede@redhat.com Signed-off-by: Sasha Levin --- drivers/platform/x86/msi-laptop.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/platform/x86/msi-laptop.c b/drivers/platform/x86/msi-laptop.c index 7279390a2d54..1ba5f4689df4 100644 --- a/drivers/platform/x86/msi-laptop.c +++ b/drivers/platform/x86/msi-laptop.c @@ -1129,6 +1129,8 @@ static int __init msi_init(void) fail_create_group: if (quirks->load_scm_model) { i8042_remove_filter(msi_laptop_i8042_filter); + cancel_delayed_work_sync(&msi_touchpad_dwork); + input_unregister_device(msi_laptop_input_dev); cancel_delayed_work_sync(&msi_rfkill_dwork); cancel_work_sync(&msi_rfkill_work); rfkill_cleanup(); @@ -1149,6 +1151,7 @@ static void __exit msi_cleanup(void) { if (quirks->load_scm_model) { i8042_remove_filter(msi_laptop_i8042_filter); + cancel_delayed_work_sync(&msi_touchpad_dwork); input_unregister_device(msi_laptop_input_dev); cancel_delayed_work_sync(&msi_rfkill_dwork); cancel_work_sync(&msi_rfkill_work); From patchwork Mon Oct 24 11:30:18 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8724 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp423578wru; Mon, 24 Oct 2022 05:25:20 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6QDNOJWeoomtavTjsUgqdRX1jRcHuNxbdY3WE4p41MASXaCHYhenKl0PF5Ko3egMEPaSKw X-Received: by 2002:a05:6402:24a0:b0:454:d197:6238 with SMTP id q32-20020a05640224a000b00454d1976238mr29831782eda.274.1666614320385; Mon, 24 Oct 2022 05:25:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666614320; cv=none; d=google.com; s=arc-20160816; b=jPQHlDPtPNXZh7ks41xNoxAUbEeWPLfYupRahqwciBo4Iv79TD6OTjfy69nU1QRjWP g+LLsJti4YZ6Jw/y/WDzvmlV5N3ME9iUfD582AauGCyrP3dHWv2s8GXw61ynlRpQtjIk RdbH6BuM5p0cth8QXXzZiLufyf5kAq+qLOTeE0qLkLH7TAsUmDGF1eVWS+oU617h5j0d gR1YvSKS2tDfb09j++FFT/IUtO1yYXT/5DOjhH52e6ipEBzQpO+OaqjVXag+LOiiT8Ri bydCD1LC1WgNEAd9Aszs37BHg3DjHBrAU6DhfSF7mV27mbzbs69NP6nWLbFtv3kf8+XF hxPQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Pkqvgejxg5VVprw4Xrj/kzoXnGTOj9c1aM4fmwXTSQk=; b=YeFwfNtHXDDbBYdYUxJD82t1jGqJdcdyBkv+/KptLWjotXoKDz3wzpQVFmpdD3OQjo fIVs6zTcuJ6jip08MgBUvSIuRIl3DlSowbPkvxwpzvzdQW6Mf8rPiUv0WBX7yzmjagKL IMR0lSlUMqKZ1nQvWn1/fb+C+MZ+8EAOp3feKbGQFs8bTdQtUMtXxJF1/sAqRNsANqf3 UOsNqLG2Ih12cfgXQDxVzpu2MYGcjQiU4+lafYiGrAbimUXQYsBcxi6m4sUrdeLMxHN2 Fwi+iNdPiyrLEHS85/tAzYkwnAtdK6+ckNJzsLWAyzgDWJWnwfzMaqezUQkPlfSuWRea 72QQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=cp+iRDid; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id wz8-20020a170906fe4800b007aa493b067asi1085523ejb.396.2022.10.24.05.24.55; Mon, 24 Oct 2022 05:25:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=cp+iRDid; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233615AbiJXMXz (ORCPT + 99 others); Mon, 24 Oct 2022 08:23:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47380 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233526AbiJXMWm (ORCPT ); Mon, 24 Oct 2022 08:22:42 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CCB2CBE21; Mon, 24 Oct 2022 04:59:27 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 733D961254; Mon, 24 Oct 2022 11:58:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 600FDC433C1; Mon, 24 Oct 2022 11:58:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612732; bh=4ml/Nor2Q9RjHra/6MNu/PCwtzXeRuoO3McV+6kBME8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cp+iRDidWQPL/ORTqy8U4gr2Y9nKl1Lt+sr0I0nxPNDlm7d10Qep6l5ieErK+H5xX lL9DYhjXzc9hWh1XRyIUulT2wwSEaH8VOT3nngZ3jt5pbYPfbjJAAUlpAcf1HRQLUO eXHnm2v5Ps3rhHLeN93+Y5fMkYyeCMiwY29f58A8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zheyu Ma , Robert Foss , Sasha Levin Subject: [PATCH 4.19 099/229] drm/bridge: megachips: Fix a null pointer dereference bug Date: Mon, 24 Oct 2022 13:30:18 +0200 Message-Id: <20221024113002.235458834@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747571777787383883?= X-GMAIL-MSGID: =?utf-8?q?1747571777787383883?= From: Zheyu Ma [ Upstream commit 1ff673333d46d2c1b053ebd0c1c7c7c79e36943e ] When removing the module we will get the following warning: [ 31.911505] i2c-core: driver [stdp2690-ge-b850v3-fw] unregistered [ 31.912484] general protection fault, probably for non-canonical address 0xdffffc0000000001: 0000 [#1] PREEMPT SMP KASAN PTI [ 31.913338] KASAN: null-ptr-deref in range [0x0000000000000008-0x000000000000000f] [ 31.915280] RIP: 0010:drm_bridge_remove+0x97/0x130 [ 31.921825] Call Trace: [ 31.922533] stdp4028_ge_b850v3_fw_remove+0x34/0x60 [megachips_stdpxxxx_ge_b850v3_fw] [ 31.923139] i2c_device_remove+0x181/0x1f0 The two bridges (stdp2690, stdp4028) do not probe at the same time, so the driver does not call ge_b850v3_resgiter() when probing, causing the driver to try to remove the object that has not been initialized. Fix this by checking whether both the bridges are probed. Fixes: 11632d4aa2b3 ("drm/bridge: megachips: Ensure both bridges are probed before registration") Signed-off-by: Zheyu Ma Signed-off-by: Robert Foss Link: https://patchwork.freedesktop.org/patch/msgid/20220830073450.1897020-1-zheyuma97@gmail.com Signed-off-by: Sasha Levin --- drivers/gpu/drm/bridge/megachips-stdpxxxx-ge-b850v3-fw.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/bridge/megachips-stdpxxxx-ge-b850v3-fw.c b/drivers/gpu/drm/bridge/megachips-stdpxxxx-ge-b850v3-fw.c index a8d776edccc1..07e3a8aaa0e4 100644 --- a/drivers/gpu/drm/bridge/megachips-stdpxxxx-ge-b850v3-fw.c +++ b/drivers/gpu/drm/bridge/megachips-stdpxxxx-ge-b850v3-fw.c @@ -290,7 +290,9 @@ static void ge_b850v3_lvds_remove(void) * This check is to avoid both the drivers * removing the bridge in their remove() function */ - if (!ge_b850v3_lvds_ptr) + if (!ge_b850v3_lvds_ptr || + !ge_b850v3_lvds_ptr->stdp2690_i2c || + !ge_b850v3_lvds_ptr->stdp4028_i2c) goto out; drm_bridge_remove(&ge_b850v3_lvds_ptr->bridge); From patchwork Mon Oct 24 11:30:19 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8723 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp423570wru; Mon, 24 Oct 2022 05:25:18 -0700 (PDT) X-Google-Smtp-Source: AMsMyM580HN35QUSPBPIF+2NOw3YO6qGM3FiY4FG6/UNcRkHYJAwd+VGy9MPS1Yf/eUUvm/vwuv1 X-Received: by 2002:a63:87c7:0:b0:434:883:ea21 with SMTP id i190-20020a6387c7000000b004340883ea21mr29078114pge.152.1666614318175; Mon, 24 Oct 2022 05:25:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666614318; cv=none; d=google.com; s=arc-20160816; b=ZYZ9oTVuoCXWthjwpx1yKpEZUkMkNkIq20sjm4bBEM4knCQcbBO0+Scrz+MRIZtIyP gEdMSC2Em6w/OoJL5eRaFeg3qJYvPEo/zT8UUuRJBatK8TFc1vGRInVSDayQYNS/nrYR UvnZFxziFjB5w0JOLvntNFdo9AbaiStNXeyDtqQdFgs5CvnIcDZWhdESlyoaSFwV+soG Hr8FZwgXBV9s8EJkPi4kuXbISG5pCwrwbHleQBPCminbMEa7N1b5cWovESaXUqwxGEQu A+QHGAziyfrB6m9GLNu9IgLl1mg73isa9PAkB4BFUNgLJPF0MW8l+FMCm6cFFcoWQGa6 1dCg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=+RNesLNXRbgmskFIticWAXqVdCjKgko0r1B1h6YMwcE=; b=L7OaD8URcN48l42FNuUmxiTXuaDgbvs3CeZ7ikPt2RH+RLGAOPZ5Qf0Kz29SMF75xa NVOaF77xSHH1qM84T+slbEm6J1p4eBWWq0hu/QVUVJzjn78WjBcq8cqxcXsZ+vBpHnv5 C6y3g9BumtKFjVWtioln55P3Xja5XrMcI8BEwuvKvY6kXHGWTJb54XzV6eDo/iSbZHTz SI2Wku5Y3aJ7+VVNuNQgHqwn4aQUwLNhXigz8p33i4bg3oHmn4no307WjV8OoDCEla3k GzYRg8gXFe2D5Y8jCgx6ZrsE+wlxmp2ShSD0I4SJsVoHbR4mtpPen/7rnVJPXplFmqtt WgDw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=bPNULyzw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i2-20020a17090332c200b0017ef8bf8a91si5925392plr.439.2022.10.24.05.25.04; Mon, 24 Oct 2022 05:25:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=bPNULyzw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231732AbiJXMYo (ORCPT + 99 others); Mon, 24 Oct 2022 08:24:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41626 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233545AbiJXMW4 (ORCPT ); Mon, 24 Oct 2022 08:22:56 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 25EE610FE0; Mon, 24 Oct 2022 04:59:27 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 0ED7461218; Mon, 24 Oct 2022 11:58:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1FDB8C433D6; Mon, 24 Oct 2022 11:58:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612735; bh=a0S/cn9APxnABm6M14xkKN16ST3BLbmCrmr8rksBOQ8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bPNULyzwpgWaqWyN0g160SAiXkKagCfQZRmYNN0kWgASHkTS4z0OHV20r0QI6ZajG Eh1t3SljyfM6ANJUu7eA4smXH3SIkLIM4Mh3nUVqA3OdrBvhcjIPf7qAZ+dpsfL5U2 o+d7f3wjACHf2HbqCf1f/rYz/lmvPecI5Ax+pyKY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Christophe JAILLET , Ulf Hansson , Sasha Levin Subject: [PATCH 4.19 100/229] mmc: au1xmmc: Fix an error handling path in au1xmmc_probe() Date: Mon, 24 Oct 2022 13:30:19 +0200 Message-Id: <20221024113002.264867674@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747571775722034054?= X-GMAIL-MSGID: =?utf-8?q?1747571775722034054?= From: Christophe JAILLET [ Upstream commit 5cbedf52608cc3cbc1c2a9a861fb671620427a20 ] If clk_prepare_enable() fails, there is no point in calling clk_disable_unprepare() in the error handling path. Move the out_clk label at the right place. Fixes: b6507596dfd6 ("MIPS: Alchemy: au1xmmc: use clk framework") Signed-off-by: Christophe JAILLET Link: https://lore.kernel.org/r/21d99886d07fa7fcbec74992657dabad98c935c4.1661412818.git.christophe.jaillet@wanadoo.fr Signed-off-by: Ulf Hansson Signed-off-by: Sasha Levin --- drivers/mmc/host/au1xmmc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/mmc/host/au1xmmc.c b/drivers/mmc/host/au1xmmc.c index 9b4be67330dd..7cd0551aec78 100644 --- a/drivers/mmc/host/au1xmmc.c +++ b/drivers/mmc/host/au1xmmc.c @@ -1118,8 +1118,9 @@ static int au1xmmc_probe(struct platform_device *pdev) if (host->platdata && host->platdata->cd_setup && !(mmc->caps & MMC_CAP_NEEDS_POLL)) host->platdata->cd_setup(mmc, 0); -out_clk: + clk_disable_unprepare(host->clk); +out_clk: clk_put(host->clk); out_irq: free_irq(host->irq, host); From patchwork Mon Oct 24 11:30:20 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8772 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp430495wru; Mon, 24 Oct 2022 05:41:43 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7OjZSVy5XZn2RVW/xgMw9W9MjOpNMGjjIFS7LyowhA0o3wZQE1RbAExVt8eFrA9luvG0i+ X-Received: by 2002:a65:5a0b:0:b0:46b:158e:ad7c with SMTP id y11-20020a655a0b000000b0046b158ead7cmr28654342pgs.272.1666615303407; Mon, 24 Oct 2022 05:41:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666615303; cv=none; d=google.com; s=arc-20160816; b=YiZ3oEvc19Dm2Ji8rCyHIxqKreHXtCA3qmvOjwr6j4L0KvgD035LAs+OudbPBxqXYt bneO6yhrx0JWGr4Zfa4kt/+pBkRNd0PERjSTwsc4pIDPBWpF5B4rOEqWzd7B36+oNlTm 2BeZ14SNoBjWBnEgLcJ2GIKkOiy+yntged3JFN6avtngCPvFEGVS2g5mlAje5UQbBtLw lfSfBHEpZFxCLEE/2n3EXkbzzOnTNkzdxda9JbsVdGKeXa2rIq7rFBWDi16e20AHS8ak KaGXa++MJGGq6BEyNrcvUREsfs7m3NleKlIhd0M7pme7DL4xlWth8lTLNQSWVA3f+8Mx MEJg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=wjzlERHExLo8u5FgN7U/iK5AxEJxcG3cpH/SEfPQayM=; b=SCk7J9yiByXGlKRnBvlc53vwjoI0iIahwyBhHwH/v2J8LcdhpvQp7TrfY2ydateD70 9VSKPeQx+ogII12nNYAXOOyr4IzVSBkcqrvrYf57vklYmsMliCvfz9l3pmEYArBT6MYR Orw7GrPjdzIybmY3H32b/760dAFmY4JYbWTJ8BR9GzYoegDd6D00U/ExtulNzwBGPArq TWEnGCHYGaCI2Vb9RmvrZejAIxuhlLfZSCveaAr45C46wQHJ5D866Pa1BGwKR5SzeHRZ 8S7dQMFUSKNUrqNJTe5ALj6okX8I72mKFs7jLthPBpkxvkKU4GMTQ/pdIQuWCdKqyH3U dFRw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Kn6PlV6S; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u4-20020a170902e80400b0017a7506e0dcsi37848173plg.231.2022.10.24.05.41.29; Mon, 24 Oct 2022 05:41:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Kn6PlV6S; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231132AbiJXMbh (ORCPT + 99 others); Mon, 24 Oct 2022 08:31:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60536 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233715AbiJXM2w (ORCPT ); Mon, 24 Oct 2022 08:28:52 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C819585ABF; Mon, 24 Oct 2022 05:02:28 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 060B3B811C9; Mon, 24 Oct 2022 11:59:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 64BE6C433C1; Mon, 24 Oct 2022 11:59:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612740; bh=lRwAxn9o2pouRDfUnd3VBJnNd7BIGUUk0OlswBK4tO8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Kn6PlV6Sk1jgTukx/3CyPY3sZitX7wPAc7PUwfIuY0AGFwZjHPVdkkfUm1yohmqaN jWIzcmt2eA6I/G/IKi1S4hBHEM/mj+mqD271onSILKEpGFp18AEILKT8PsJ08ahZaL S2ilF68SelJOjO+g2YNcehg9//9s9RxcMkbdtPx8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Liang He , Mark Brown , Sasha Levin , Kelin Wang Subject: [PATCH 4.19 101/229] ASoC: eureka-tlv320: Hold reference returned from of_find_xxx API Date: Mon, 24 Oct 2022 13:30:20 +0200 Message-Id: <20221024113002.294662750@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747572808406142567?= X-GMAIL-MSGID: =?utf-8?q?1747572808406142567?= From: Liang He [ Upstream commit bfb735a3ceff0bab6473bac275da96f9b2a06dec ] In eukrea_tlv320_probe(), we need to hold the reference returned from of_find_compatible_node() which has increased the refcount and then call of_node_put() with it when done. Fixes: 66f232908de2 ("ASoC: eukrea-tlv320: Add DT support.") Co-authored-by: Kelin Wang Signed-off-by: Liang He Link: https://lore.kernel.org/r/20220914134354.3995587-1-windhl@126.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- sound/soc/fsl/eukrea-tlv320.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/sound/soc/fsl/eukrea-tlv320.c b/sound/soc/fsl/eukrea-tlv320.c index 30a3d68b5c03..3705b003f528 100644 --- a/sound/soc/fsl/eukrea-tlv320.c +++ b/sound/soc/fsl/eukrea-tlv320.c @@ -87,7 +87,7 @@ static int eukrea_tlv320_probe(struct platform_device *pdev) int ret; int int_port = 0, ext_port; struct device_node *np = pdev->dev.of_node; - struct device_node *ssi_np = NULL, *codec_np = NULL; + struct device_node *ssi_np = NULL, *codec_np = NULL, *tmp_np = NULL; eukrea_tlv320.dev = &pdev->dev; if (np) { @@ -144,7 +144,7 @@ static int eukrea_tlv320_probe(struct platform_device *pdev) } if (machine_is_eukrea_cpuimx27() || - of_find_compatible_node(NULL, NULL, "fsl,imx21-audmux")) { + (tmp_np = of_find_compatible_node(NULL, NULL, "fsl,imx21-audmux"))) { imx_audmux_v1_configure_port(MX27_AUDMUX_HPCR1_SSI0, IMX_AUDMUX_V1_PCR_SYN | IMX_AUDMUX_V1_PCR_TFSDIR | @@ -159,10 +159,11 @@ static int eukrea_tlv320_probe(struct platform_device *pdev) IMX_AUDMUX_V1_PCR_SYN | IMX_AUDMUX_V1_PCR_RXDSEL(MX27_AUDMUX_HPCR1_SSI0) ); + of_node_put(tmp_np); } else if (machine_is_eukrea_cpuimx25sd() || machine_is_eukrea_cpuimx35sd() || machine_is_eukrea_cpuimx51sd() || - of_find_compatible_node(NULL, NULL, "fsl,imx31-audmux")) { + (tmp_np = of_find_compatible_node(NULL, NULL, "fsl,imx31-audmux"))) { if (!np) ext_port = machine_is_eukrea_cpuimx25sd() ? 4 : 3; @@ -179,6 +180,7 @@ static int eukrea_tlv320_probe(struct platform_device *pdev) IMX_AUDMUX_V2_PTCR_SYN, IMX_AUDMUX_V2_PDCR_RXDSEL(int_port) ); + of_node_put(tmp_np); } else { if (np) { /* The eukrea,asoc-tlv320 driver was explicitly From patchwork Mon Oct 24 11:30:21 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8725 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp423577wru; Mon, 24 Oct 2022 05:25:20 -0700 (PDT) X-Google-Smtp-Source: AMsMyM73qxksK+QwwM3DWCyQqYmbxJKFKa+/C5F6Sxql7xyZYLlYRoUwKto5beU360IUt2VomMU2 X-Received: by 2002:a65:6bc4:0:b0:439:8ff8:e2e1 with SMTP id e4-20020a656bc4000000b004398ff8e2e1mr28212390pgw.91.1666614319792; Mon, 24 Oct 2022 05:25:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666614319; cv=none; d=google.com; s=arc-20160816; b=L2J0yMwEI/rWinj1yzole3+xA8SskA08RFH4t9iZUZCNdoqba0LSA1AezJ8hDki3HO yTE2wAUXJQ70Vx6SE/8M+aEfdpvqe7e37GwUvW92WPip5AtyvkEEPt3CXL0uz0+2T0mF ueYzPdroLoTKgR+vsiFG/vZ5/NTnEm1lFwF5jfnb4MVtPlYQggzAYIiS0u7vvvDbFNWu DMwWqdAM3vOOgLZ8smwnDhzPlrb9nP/F+zIM2xOpr9GWzBiqPvEfNxJYosuHkBBOwzcz UyjL8RfO5r9IAgZFjQ/Sm02ScvjiyFb62DFKoGPmGESZ7VwroAkXfHNvIQa4NVfFALv7 jjpg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=HMoAo1kmQUEugaKgtelDRSBZW3orlCQsKwzvG3szi00=; b=ubKnH6jFsx7eVih4Ib2slfKlwXWHqaal4pKCizwm/Guh+2FyaSgG1nL0DcJEgDMg5t MZw/iKf/rlF4No2f71o2rYDSsVUhJOC/O5ot3I8hnZwGz6P3cpDPr7XEsfqlRpjp/NQt Y2ExgcWkLLRXDSRclv1fUHHttQbUNxRfDMgmoJt2hL6t9W33W+HWy36+PU3drCsMC/MN 3oswx2p7O0vGyzITaVLfsZBOVwsOTdeikPG+4Z3Kgav+RdcI8v4wVTtTpNSrBGCkariH ggyZC2tbkiKxxIyEZrSa8gOiV7D4BAE5U4m8us9f+0j1HmfecmtIzcAlT3z+hECRidgr 3J7g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=qD48x7WX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l65-20020a639144000000b0046086f8f5cfsi32373877pge.383.2022.10.24.05.25.06; Mon, 24 Oct 2022 05:25:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=qD48x7WX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231768AbiJXMYr (ORCPT + 99 others); Mon, 24 Oct 2022 08:24:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41676 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233339AbiJXMXD (ORCPT ); Mon, 24 Oct 2022 08:23:03 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3CBA1186D3; Mon, 24 Oct 2022 04:59:33 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id EBA266127D; Mon, 24 Oct 2022 11:59:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0E4A0C433C1; Mon, 24 Oct 2022 11:59:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612743; bh=I3iB7eG7p6Aumshgpeip5/KbFYNtV6JUN8XdboMeUQ8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qD48x7WXUk5Xxuq9Eo5aHueDprtv/4G6O8+pcnKU7wDL3tQuMCE+pMm8AS1FK9w7x 2tUtRHkyp1FpARdIOYDeYIauoDlva+oVZ03mfEJk8Ba8/kn6h+auWeRKHHaqUbN76P 8SNigZoAWSbUS/mR3XqB8PyLMJcl68lV51ejdJys= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dmitry Baryshkov , Abhinav Kumar , Rob Clark , Sasha Levin Subject: [PATCH 4.19 102/229] drm/msm/dpu: index dpu_kms->hw_vbif using vbif_idx Date: Mon, 24 Oct 2022 13:30:21 +0200 Message-Id: <20221024113002.324389317@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747571777068022362?= X-GMAIL-MSGID: =?utf-8?q?1747571777068022362?= From: Dmitry Baryshkov [ Upstream commit 7538f80ae0d98bf51eb89eee5344aec219902d42 ] Remove loops over hw_vbif. Instead always VBIF's idx as an index in the array. This fixes an error in dpu_kms_hw_init(), where we fill dpu_kms->hw_vbif[i], but check for an error pointer at dpu_kms->hw_vbif[vbif_idx]. Fixes: 25fdd5933e4c ("drm/msm: Add SDM845 DPU support") Signed-off-by: Dmitry Baryshkov Reviewed-by: Abhinav Kumar Patchwork: https://patchwork.freedesktop.org/patch/489569/ Link: https://lore.kernel.org/r/20220615125703.24647-1-dmitry.baryshkov@linaro.org Signed-off-by: Dmitry Baryshkov Signed-off-by: Rob Clark Signed-off-by: Sasha Levin --- drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c | 12 ++++------ drivers/gpu/drm/msm/disp/dpu1/dpu_vbif.c | 29 +++++++++++------------- 2 files changed, 18 insertions(+), 23 deletions(-) diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c index c88bb92282df..57b40cf0f199 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c @@ -654,12 +654,10 @@ static void _dpu_kms_hw_destroy(struct dpu_kms *dpu_kms) _dpu_kms_mmu_destroy(dpu_kms); if (dpu_kms->catalog) { - for (i = 0; i < dpu_kms->catalog->vbif_count; i++) { - u32 vbif_idx = dpu_kms->catalog->vbif[i].id; - - if ((vbif_idx < VBIF_MAX) && dpu_kms->hw_vbif[vbif_idx]) { - dpu_hw_vbif_destroy(dpu_kms->hw_vbif[vbif_idx]); - dpu_kms->hw_vbif[vbif_idx] = NULL; + for (i = 0; i < ARRAY_SIZE(dpu_kms->hw_vbif); i++) { + if (dpu_kms->hw_vbif[i]) { + dpu_hw_vbif_destroy(dpu_kms->hw_vbif[i]); + dpu_kms->hw_vbif[i] = NULL; } } } @@ -1094,7 +1092,7 @@ static int dpu_kms_hw_init(struct msm_kms *kms) for (i = 0; i < dpu_kms->catalog->vbif_count; i++) { u32 vbif_idx = dpu_kms->catalog->vbif[i].id; - dpu_kms->hw_vbif[i] = dpu_hw_vbif_init(vbif_idx, + dpu_kms->hw_vbif[vbif_idx] = dpu_hw_vbif_init(vbif_idx, dpu_kms->vbif[vbif_idx], dpu_kms->catalog); if (IS_ERR_OR_NULL(dpu_kms->hw_vbif[vbif_idx])) { rc = PTR_ERR(dpu_kms->hw_vbif[vbif_idx]); diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_vbif.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_vbif.c index 295528292296..24d009e066ab 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_vbif.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_vbif.c @@ -18,6 +18,14 @@ #include "dpu_hw_vbif.h" #include "dpu_trace.h" +static struct dpu_hw_vbif *dpu_get_vbif(struct dpu_kms *dpu_kms, enum dpu_vbif vbif_idx) +{ + if (vbif_idx < ARRAY_SIZE(dpu_kms->hw_vbif)) + return dpu_kms->hw_vbif[vbif_idx]; + + return NULL; +} + /** * _dpu_vbif_wait_for_xin_halt - wait for the xin to halt * @vbif: Pointer to hardware vbif driver @@ -155,11 +163,11 @@ static u32 _dpu_vbif_get_ot_limit(struct dpu_hw_vbif *vbif, void dpu_vbif_set_ot_limit(struct dpu_kms *dpu_kms, struct dpu_vbif_set_ot_params *params) { - struct dpu_hw_vbif *vbif = NULL; + struct dpu_hw_vbif *vbif; struct dpu_hw_mdp *mdp; bool forced_on = false; u32 ot_lim; - int ret, i; + int ret; if (!dpu_kms) { DPU_ERROR("invalid arguments\n"); @@ -167,12 +175,7 @@ void dpu_vbif_set_ot_limit(struct dpu_kms *dpu_kms, } mdp = dpu_kms->hw_mdp; - for (i = 0; i < ARRAY_SIZE(dpu_kms->hw_vbif); i++) { - if (dpu_kms->hw_vbif[i] && - dpu_kms->hw_vbif[i]->idx == params->vbif_idx) - vbif = dpu_kms->hw_vbif[i]; - } - + vbif = dpu_get_vbif(dpu_kms, params->vbif_idx); if (!vbif || !mdp) { DPU_DEBUG("invalid arguments vbif %d mdp %d\n", vbif != 0, mdp != 0); @@ -217,7 +220,7 @@ void dpu_vbif_set_ot_limit(struct dpu_kms *dpu_kms, void dpu_vbif_set_qos_remap(struct dpu_kms *dpu_kms, struct dpu_vbif_set_qos_params *params) { - struct dpu_hw_vbif *vbif = NULL; + struct dpu_hw_vbif *vbif; struct dpu_hw_mdp *mdp; bool forced_on = false; const struct dpu_vbif_qos_tbl *qos_tbl; @@ -229,13 +232,7 @@ void dpu_vbif_set_qos_remap(struct dpu_kms *dpu_kms, } mdp = dpu_kms->hw_mdp; - for (i = 0; i < ARRAY_SIZE(dpu_kms->hw_vbif); i++) { - if (dpu_kms->hw_vbif[i] && - dpu_kms->hw_vbif[i]->idx == params->vbif_idx) { - vbif = dpu_kms->hw_vbif[i]; - break; - } - } + vbif = dpu_get_vbif(dpu_kms, params->vbif_idx); if (!vbif || !vbif->cap) { DPU_ERROR("invalid vbif %d\n", params->vbif_idx); From patchwork Mon Oct 24 11:30:22 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9874 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp568845wru; Mon, 24 Oct 2022 10:26:48 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7Z0nvQyW335HlvHzzaqLckVi6mtMWH1pJHSq1kE7CY16J7z7278jG/lwR8+nGkMrAHFsNC X-Received: by 2002:a17:903:1c3:b0:185:46d3:8cde with SMTP id e3-20020a17090301c300b0018546d38cdemr34764504plh.141.1666632397071; Mon, 24 Oct 2022 10:26:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666632397; cv=none; d=google.com; s=arc-20160816; b=YkCqDyT55zWloXEuSJ+fxPDgLqXByWYLlMe8SkBxZ57V1waanseNlnY8Q+R0Cf1uvZ XxVS9CwmRainusaojyNNKcuOvd2kM0+ud+5p+/CqBftecMnQkWzZP4uQXPgbPyOq+eri 2vsocg2MmnH5pk3VIbU+VV8R7GrnadOUEevo2KiC6L4MXGG4iWAjJ0qCEl3HY8SXQTxy pZkvd/ZEMV5+yya8bKCgwjTjHf3Ngfv055MZe1m0OvKDSs3sEAsJCt02iKficyboahKe /oGcCRcjXrobxlmM2/tjHUdzPBndkPSOmN8bqn4sEVTIZ8fiha/iG2Kd8PchEOYQ4OiR NI8w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=jhClmv/4OFgRakic9tvTLB6c0xJfsOQdZuerEksrzJw=; b=NmbLWCstrOwbmHgpMnpZZalDRtSGBUFuqOzxjcIrorJdkI1AK7TeZ+0Gbdzzj1LEos 2LB1lPqO5vTXbgGx8hPR0TpCG3jWVqEvJ8skyQqz2V8RPDCOH4D6Ty7Dya2serpOM0QM W2G7TxOcf8tLSS+mf80EXaxXiUn/Q2c5lp6qBfpEvjuLu9LJf7HqJnRa2OWTSblQ8HUG VBi8qV6OB2eoQKiRmDSlHN+UrOjdPDA3j+vXhXRvdub/XnDR6ozXlVSJMBcTOFIX+NSH 7Yj/r1RRsBvHoalL/N63s0AM2+jYoXecJZbWJbFqHwjMWp9qalMpamWYQfLYEvYlTg2X 44RQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=TH8i8gCU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id pj11-20020a17090b4f4b00b0020d542eb5f0si11812892pjb.110.2022.10.24.10.26.23; Mon, 24 Oct 2022 10:26:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=TH8i8gCU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233813AbiJXROm (ORCPT + 99 others); Mon, 24 Oct 2022 13:14:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51760 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231697AbiJXRNa (ORCPT ); Mon, 24 Oct 2022 13:13:30 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E88405A8C8; Mon, 24 Oct 2022 08:49:05 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 9578D6129A; Mon, 24 Oct 2022 11:59:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A479BC433C1; Mon, 24 Oct 2022 11:59:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612746; bh=bZwGPZDTogpLUxzxQ5yHMwfGBVlcNdR2myoMTG7FLZA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TH8i8gCU3hrYEcz6rEEgo865pgk7d1YaUVyJ5TvXUFMcwzOjWLkvTNVJauDLlGC79 cGUGjcb2mcs83nPB8fVmOXouRnWUB2RYRjzNOCdBUplqqbHUlSunwkmm0CBg8z+w5P KyxFiXcOSlZhoR1EvKA+nlALyImmBJhkIkBLNgXQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Andreas Pape , Eugeniu Rosca , Takashi Iwai , Sasha Levin Subject: [PATCH 4.19 103/229] ALSA: dmaengine: increment buffer pointer atomically Date: Mon, 24 Oct 2022 13:30:22 +0200 Message-Id: <20221024113002.353044201@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747590732498578521?= X-GMAIL-MSGID: =?utf-8?q?1747590732498578521?= From: Andreas Pape [ Upstream commit d1c442019594692c64a70a86ad88eb5b6db92216 ] Setting pointer and afterwards checking for wraparound leads to the possibility of returning the inconsistent pointer position. This patch increments buffer pointer atomically to avoid this issue. Fixes: e7f73a1613567a ("ASoC: Add dmaengine PCM helper functions") Signed-off-by: Andreas Pape Signed-off-by: Eugeniu Rosca Link: https://lore.kernel.org/r/1664211493-11789-1-git-send-email-erosca@de.adit-jv.com Signed-off-by: Takashi Iwai Signed-off-by: Sasha Levin --- sound/core/pcm_dmaengine.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/sound/core/pcm_dmaengine.c b/sound/core/pcm_dmaengine.c index 8eb58c709b14..6f6da1128edc 100644 --- a/sound/core/pcm_dmaengine.c +++ b/sound/core/pcm_dmaengine.c @@ -139,12 +139,14 @@ EXPORT_SYMBOL_GPL(snd_dmaengine_pcm_set_config_from_dai_data); static void dmaengine_pcm_dma_complete(void *arg) { + unsigned int new_pos; struct snd_pcm_substream *substream = arg; struct dmaengine_pcm_runtime_data *prtd = substream_to_prtd(substream); - prtd->pos += snd_pcm_lib_period_bytes(substream); - if (prtd->pos >= snd_pcm_lib_buffer_bytes(substream)) - prtd->pos = 0; + new_pos = prtd->pos + snd_pcm_lib_period_bytes(substream); + if (new_pos >= snd_pcm_lib_buffer_bytes(substream)) + new_pos = 0; + prtd->pos = new_pos; snd_pcm_period_elapsed(substream); } From patchwork Mon Oct 24 11:30:23 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8770 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp430462wru; Mon, 24 Oct 2022 05:41:37 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6OVc9qTEHzqq7GcU2SH1cnZAJTnd3AM5zyzJDLOF4clZiRYj98UDwJKFSuktuewfdE2QWi X-Received: by 2002:a05:6a00:230d:b0:53d:c198:6ad7 with SMTP id h13-20020a056a00230d00b0053dc1986ad7mr34037911pfh.67.1666615296718; Mon, 24 Oct 2022 05:41:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666615296; cv=none; d=google.com; s=arc-20160816; b=KodePqWVH4m6UGjPcUrLdTunaN88DnIEXpHLw1NZbvsb4cI+e72yE72eLJ5Pjgwpqq fX0Hg3rWKCWcdB5uY7uV4TYf3sn7IvCrn9wBzFpjqyzS/3kFfGlZ/7VMV5yEorYrolwz SJ6et/ajFXIgtoHqwfWy7jDn3k4rBDpsyYvRaFOEEfqnMBALqJHNqWVqLwuZJ8f+ZjpX sH3PEduR2f9nc8TODV9R7Kh3T9uDvkS4kzo8sg/4Ga0yjA6QW/76qO4bPWDzKGxtzHem ah8Po8SFufwP8h//qhnHL0bRjkUMpkPxK5sbwsRY71BXi7FXtARWAphXDSGXgcycVSac CkXA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=85z7WzhthObm3CdCzfnxN7PSrcianPB12xz91lMo878=; b=Ji1l3WAM11Z6sSpxr0VdDrmk18YjEYsvk01Lni6iZR4ZMKNxuEcI26JKYBHrgPjXUb qTfoangX4N9kjU2AFf+ZHOxfxoy0vZJzWd9VfqIBwyXdsNQSAnWF2kNBi+0PfWhH3Etr bJdV/gf8Rf78JVSCoUwJOvQ2IwbSdbAaRzjIPZfwmTo1xxgjEJshz8FNRQMztzRh2Bbq qvDoM7VN8pKxCyy8Z/ctFkGH5W4sY474HKzo2llhFxF7n78Z7KBQBDKXOCoDRYn6rE43 OnLV8/7d8KEjEyrWx2Lk5MHKzvnuKKNiWPp+G7PE0Qi6UGzptIgzPI1nweTOjyg19yGD Y7Gg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=iVWT1Ja0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s9-20020a170902b18900b0017f8d9b7e5fsi32404278plr.133.2022.10.24.05.41.23; Mon, 24 Oct 2022 05:41:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=iVWT1Ja0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231787AbiJXMbR (ORCPT + 99 others); Mon, 24 Oct 2022 08:31:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45118 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233898AbiJXM2g (ORCPT ); Mon, 24 Oct 2022 08:28:36 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DFF6A86FB6; Mon, 24 Oct 2022 05:02:33 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id E8B69B811F9; Mon, 24 Oct 2022 11:59:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 51B85C433C1; Mon, 24 Oct 2022 11:59:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612748; bh=/Q6pzcrZjDpFolWBJ1EYpKlo1jaPwZnnnU4E+ObCcyk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iVWT1Ja01s3mP/O0VjBUjiEQ6ddoskRzJ051ziBcGSxWlBcI8+BU8v+wNQBPopK7g o+68xzEEWI+Ix5peVX6OS4t4U6bZxIGMlu72NprpwOzLC6c3GboWVz7cOemyhNha/9 DVFv6F2NaD3rMOOxTdpdcPZK7qxryDW8R6IUi/gE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Christophe JAILLET , Dan Carpenter , Ulf Hansson , Sasha Levin Subject: [PATCH 4.19 104/229] mmc: wmt-sdmmc: Fix an error handling path in wmt_mci_probe() Date: Mon, 24 Oct 2022 13:30:23 +0200 Message-Id: <20221024113002.382124113@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747572801231064410?= X-GMAIL-MSGID: =?utf-8?q?1747572801231064410?= From: Christophe JAILLET [ Upstream commit cb58188ad90a61784a56a64f5107faaf2ad323e7 ] A dma_free_coherent() call is missing in the error handling path of the probe, as already done in the remove function. Fixes: 3a96dff0f828 ("mmc: SD/MMC Host Controller for Wondermedia WM8505/WM8650") Signed-off-by: Christophe JAILLET Reviewed-by: Dan Carpenter Link: https://lore.kernel.org/r/53fc6ffa5d1c428fefeae7d313cf4a669c3a1e98.1663873255.git.christophe.jaillet@wanadoo.fr Signed-off-by: Ulf Hansson Signed-off-by: Sasha Levin --- drivers/mmc/host/wmt-sdmmc.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/mmc/host/wmt-sdmmc.c b/drivers/mmc/host/wmt-sdmmc.c index 3ba42f508014..f8b169684693 100644 --- a/drivers/mmc/host/wmt-sdmmc.c +++ b/drivers/mmc/host/wmt-sdmmc.c @@ -853,7 +853,7 @@ static int wmt_mci_probe(struct platform_device *pdev) if (IS_ERR(priv->clk_sdmmc)) { dev_err(&pdev->dev, "Error getting clock\n"); ret = PTR_ERR(priv->clk_sdmmc); - goto fail5; + goto fail5_and_a_half; } ret = clk_prepare_enable(priv->clk_sdmmc); @@ -870,6 +870,9 @@ static int wmt_mci_probe(struct platform_device *pdev) return 0; fail6: clk_put(priv->clk_sdmmc); +fail5_and_a_half: + dma_free_coherent(&pdev->dev, mmc->max_blk_count * 16, + priv->dma_desc_buffer, priv->dma_desc_device_addr); fail5: free_irq(dma_irq, priv); fail4: From patchwork Mon Oct 24 11:30:24 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8821 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp431243wru; Mon, 24 Oct 2022 05:43:18 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4SmJXu/NJoCaJPbrsYPNsPKYqAAHq9Pu+/CNnu01FHWtqBRfi5Fd8uqEo1z4HIAbiF0sx+ X-Received: by 2002:a17:903:447:b0:186:b945:c0b2 with SMTP id iw7-20020a170903044700b00186b945c0b2mr720346plb.25.1666615398610; Mon, 24 Oct 2022 05:43:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666615398; cv=none; d=google.com; s=arc-20160816; b=voXG27E6Scf+r4Zli/0ZYQhBP8aIWOZCW39K2beZufVzID9IdwKNA4ldFIWEdic035 oQBgqVw4MYDtP4vYde4hAFjeHuqk0jNASdI26+gFu/RbCBM0ixrEYLppBVUGTaNlIMcg XfVyxsBdqnxnDdsRcU7i+Oi+PdMDRTbMMkid1onEVX3ouH28kNwzTl7FXX1BOEN43nUN DuKypblcUcUt9VKVLNLamOM6EZKSZxyNblqv4dzdAwW7ofH7JX71JmvwhCmneXDXV5Ln p2XpLprsPBIYI0VxSgDe0BROHYEdv4CtR2eiKyQbIYB8AVR9H34UBV3FrhA4RRhvsGvC KE0Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=LdP1pX7Q4RS/G6DYavAQ0CodG1oBCTnAB1NudNalROo=; b=K9RuwQgsenKPaMY/zpdJzAZmnbEVLQzqB1dv2u53OW2iS4SQNzIUqZdS+IyKvNCs4t AtUJO4+nIBB0SMiMT2tm+YBEjJsIL7GR2jpOY6s7va0YplCupya+YKbIQja6osthEVAT is9yjV4dtZzFhXvuhQgQuNIBCI5bsDLyFipGDm59AB2l7tyHG0vPpjaxQ13oy1qE8srv 0egAc7xnMTdwLZ3xTx4iqg/0wBVLtZWJR471BfJy5Osi0q96dLPSiz/KqY0Kf+wa9XId kRvRumsnJ4FcCFKIe4ys9FCXireYycAE5HrbPomATaUx9T2M0qmLzJ+9LCBtixv4KXY2 kIRw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=b++DrnSx; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ot1-20020a17090b3b4100b00200acd39846si21043656pjb.63.2022.10.24.05.42.58; Mon, 24 Oct 2022 05:43:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=b++DrnSx; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230242AbiJXMcO (ORCPT + 99 others); Mon, 24 Oct 2022 08:32:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45116 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233931AbiJXM3D (ORCPT ); Mon, 24 Oct 2022 08:29:03 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6AB7B87080; Mon, 24 Oct 2022 05:02:35 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 92941B811B9; Mon, 24 Oct 2022 11:59:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EDF58C433C1; Mon, 24 Oct 2022 11:59:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612751; bh=wr6A67nBo76UCUyXA2Jm2lacyvdaLQ+4zs5bCcZUDIk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=b++DrnSx88yKl479TLQqDNsZsGP8lHXSG8etW3agxYb5bC+vbtZtNhiXLTbhDsdMP hH28LsI3CXyxzlpp17DvRN/RWZgeAlUZcZuYIpv1IVxlePskfUDPcevIzd/noM2cA1 xoN8kzfWyrHqKaX7MIRCSDKT0e8zlh76bLfxq5nQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zhang Qilong , Mark Brown , Sasha Levin Subject: [PATCH 4.19 105/229] ASoC: wm8997: Fix PM disable depth imbalance in wm8997_probe Date: Mon, 24 Oct 2022 13:30:24 +0200 Message-Id: <20221024113002.415388124@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747572908096118455?= X-GMAIL-MSGID: =?utf-8?q?1747572908096118455?= From: Zhang Qilong [ Upstream commit 41a736ac20602f64773e80f0f5b32cde1830a44a ] The pm_runtime_enable will increase power disable depth. Thus a pairing decrement is needed on the error handling path to keep it balanced according to context. We fix it by moving pm_runtime_enable to the endding of wm8997_probe Fixes:40843aea5a9bd ("ASoC: wm8997: Initial CODEC driver") Signed-off-by: Zhang Qilong Link: https://lore.kernel.org/r/20220928160116.125020-2-zhangqilong3@huawei.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- sound/soc/codecs/wm8997.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sound/soc/codecs/wm8997.c b/sound/soc/codecs/wm8997.c index bb6a95be8726..9f819113af1e 100644 --- a/sound/soc/codecs/wm8997.c +++ b/sound/soc/codecs/wm8997.c @@ -1159,9 +1159,6 @@ static int wm8997_probe(struct platform_device *pdev) regmap_update_bits(arizona->regmap, wm8997_digital_vu[i], WM8997_DIG_VU, WM8997_DIG_VU); - pm_runtime_enable(&pdev->dev); - pm_runtime_idle(&pdev->dev); - arizona_init_common(arizona); ret = arizona_init_vol_limit(arizona); @@ -1180,6 +1177,9 @@ static int wm8997_probe(struct platform_device *pdev) goto err_spk_irqs; } + pm_runtime_enable(&pdev->dev); + pm_runtime_idle(&pdev->dev); + return ret; err_spk_irqs: From patchwork Mon Oct 24 11:30:25 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9922 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp587046wru; Mon, 24 Oct 2022 11:11:55 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5tQ+3IUDOHOw/ECJL8izYfKYgmTTbqTCXdhyRvpenvo8QSTleWxI98Mt40KuoUQ3u3kZ9x X-Received: by 2002:a17:906:5dae:b0:78e:3109:36d1 with SMTP id n14-20020a1709065dae00b0078e310936d1mr28951412ejv.470.1666635115046; Mon, 24 Oct 2022 11:11:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666635115; cv=none; d=google.com; s=arc-20160816; b=V7DDWDlYgk5Vvk64gJW6mqdeBDIceazyRxOyTG47YhF0pxA+OdZMjztY6XKIxwV8V9 Taa6aMf7uzVel2F9kEavg6W7WeasiQ7oC4rXC6fAlI0/CFm8XXyttKQtl+q+YnIDn0Wx AYdEKop6gI9gZPVWX1q3EyLmwq3YBJ12QoyALiJ16cjn41iu4ukeOhiUdIy8PZj5Hm9T u2KAocLTH9iOltL9PhbS5m1B72RUweXUifNpsnaqLlnL1qkslo4/l0r4R+mfW/QaM4TN iMlWBOCI18Kua0yTRpwoL5CakcoPGkTnwU4Rj6lQLe7n2r5hgENTk84OgaKouyvaS9jR 0Zsw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=iG9D86IzfQKqJrrKs9UJ8S3f3vzMVAjL/lh8h80fEA4=; b=0adLj41YG1RCALoBSkLFbAdkGBDw340uX5Ce2N/zhQSYU0Gh8JBpBv6H9FIOnxGUJT gnSkjFlnHUKxc/BaHffF0LHYxImh4JgPyBwxpwz1HfjsS0a1YgNHln3JZ1Z7hYXjCGS7 XO7d2VA/C50/bwxmspAhL+jKboKGIATuNw0u287btlw8Pc77qh7q9eQ8bjRhAO50jKBD mePvOoB8pTFxHRp0EJPNDGGROMI5hc/l8TjyuCT45oyKODwm3KSUP1QiwRnbnjLmme1j TFH9LI7Bq/E2bkS9NWsAKvKYnIsjtUsBSTXWD+NW9PEHPf0O0CgJC8QFzbynvHt0dJ6e 9MJg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=lVmKLZ4U; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id br13-20020a170906d14d00b0078dce2b1985si330428ejb.134.2022.10.24.11.11.30; Mon, 24 Oct 2022 11:11:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=lVmKLZ4U; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232397AbiJXSIP (ORCPT + 99 others); Mon, 24 Oct 2022 14:08:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54336 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231962AbiJXSH5 (ORCPT ); Mon, 24 Oct 2022 14:07:57 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9ED90202727; Mon, 24 Oct 2022 09:49:07 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 34C6CB811D3; Mon, 24 Oct 2022 11:59:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8B7C4C433C1; Mon, 24 Oct 2022 11:59:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612753; bh=tstd9ZdpUq6Dk1Sy6I/iF27IlR0OnBZfBh7L2kweZLA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lVmKLZ4UJqLhOu5WQfeMWED1jtf3IX8xuvflJfy/GV3ERsy3VdyqK2kffUN2wuSuD XH4CWlNOLzBUGvQM9VGNsoC19iNaBjDRXozBOfMu5sXZdnulszwxJWNVFf+MwBT472 PHyxYX4YipJ6i2r/AwhHF/i/z4upvz5ecep0ENEI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zhang Qilong , Mark Brown , Sasha Levin Subject: [PATCH 4.19 106/229] ASoC: wm5110: Fix PM disable depth imbalance in wm5110_probe Date: Mon, 24 Oct 2022 13:30:25 +0200 Message-Id: <20221024113002.445463248@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747593582422540402?= X-GMAIL-MSGID: =?utf-8?q?1747593582422540402?= From: Zhang Qilong [ Upstream commit 86b46bf1feb83898d89a2b4a8d08d21e9ea277a7 ] The pm_runtime_enable will increase power disable depth. Thus a pairing decrement is needed on the error handling path to keep it balanced according to context. We fix it by moving pm_runtime_enable to the endding of wm5110_probe. Fixes:5c6af635fd772 ("ASoC: wm5110: Add audio CODEC driver") Signed-off-by: Zhang Qilong Link: https://lore.kernel.org/r/20220928160116.125020-3-zhangqilong3@huawei.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- sound/soc/codecs/wm5110.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sound/soc/codecs/wm5110.c b/sound/soc/codecs/wm5110.c index e510aca55163..43a47312d71b 100644 --- a/sound/soc/codecs/wm5110.c +++ b/sound/soc/codecs/wm5110.c @@ -2453,9 +2453,6 @@ static int wm5110_probe(struct platform_device *pdev) regmap_update_bits(arizona->regmap, wm5110_digital_vu[i], WM5110_DIG_VU, WM5110_DIG_VU); - pm_runtime_enable(&pdev->dev); - pm_runtime_idle(&pdev->dev); - ret = arizona_request_irq(arizona, ARIZONA_IRQ_DSP_IRQ1, "ADSP2 Compressed IRQ", wm5110_adsp2_irq, wm5110); @@ -2488,6 +2485,9 @@ static int wm5110_probe(struct platform_device *pdev) goto err_spk_irqs; } + pm_runtime_enable(&pdev->dev); + pm_runtime_idle(&pdev->dev); + return ret; err_spk_irqs: From patchwork Mon Oct 24 11:30:26 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8729 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp423774wru; Mon, 24 Oct 2022 05:25:43 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4YTjzsnG5+IX4uSXJFnF8lns+wrHhtvpemjA/GAYKtjjDaliwGOOSZkzr7gGcE/ERHh0H6 X-Received: by 2002:a17:90b:3e82:b0:20d:2fa1:d08d with SMTP id rj2-20020a17090b3e8200b0020d2fa1d08dmr75269039pjb.162.1666614343519; Mon, 24 Oct 2022 05:25:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666614343; cv=none; d=google.com; s=arc-20160816; b=i8dclspLDn8KMt1Z2ipDP3kLzGamuFFqopda6Fkz9BkADzuS3CqFIcb872kr3iomIW auCT2KyzB+LPACyX40aPiApFF1gCd4+63ZvPIFJhXm/uxOMaGeV+1c3Egvsqm5rJ4X6z IW2gq/CGsuEJsNt3Brrf26GDLVive/EUCEP7VKD1HKRHtNRUoOJOClej76gw01xXh2Sn 7PBkJ2FMb4jFPmhsJPf34nNEUG3hqoC4eIA/ozg2f23Z5xOsE6uVIL18SCjjMiQhqzvM ckctehDEWCnpimuPvxhspyqZKLwaM4ZeP+FaJnSa/+1qGstisBzwJJrKk4cV0HMoUni9 bNlg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=JMJZ1lbOktFCaNNdU+Mzi7ZcIW28ncyAy8DfB8FGs+E=; b=0b3yt1nRVeIqnUENZZP26yq9cPOA2nQLNsptNrkPP8xG21d5WuXNM39mUUGVrtZgAe aBzOqDW7cQVzh3ukkcXIva8gjsODAy0126DPzMn24lujdWXq8/UQXc0M2KchgoWDqSUC SYLzejP3XGSoxnZ3yQEAChpZk/TSAP2/c8CQkPD08i7C3Y2eNCDazGDwYtq6rUWq68pp Uh+gYJpgP5lXUyhp9Hk33N9BwcIh7jXsHF0atey+LHFkisHw3uMlBl/8pALHiSbF/uEH V9ARVl7HQBrLmrMxCZNYMf0EI8isr27peWSkJL/q2AQpV4yUF41faazD3eSQaJyvmWbA pdAA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=o3OSMN3L; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u70-20020a638549000000b00457dd1b8165si11378861pgd.690.2022.10.24.05.25.30; Mon, 24 Oct 2022 05:25:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=o3OSMN3L; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233548AbiJXMZB (ORCPT + 99 others); Mon, 24 Oct 2022 08:25:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40696 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233376AbiJXMXM (ORCPT ); Mon, 24 Oct 2022 08:23:12 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C93F511148; Mon, 24 Oct 2022 04:59:42 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 1E1436125A; Mon, 24 Oct 2022 11:59:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 313FDC433C1; Mon, 24 Oct 2022 11:59:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612756; bh=CZ7TxE+NMJnDnxO9IUXVaIiVtgKrEN7pRINPzURS98Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=o3OSMN3LED6GZ6XXo1ZLYH10mouu3sh4jC849pws4D2TytQ4zcyVDEdQOQ/AKg/JR RNUFcdEl5avcoVqmoguscBWuEnFpUyLWP54c7OeH8i8WUnrjMxlMEiIA7lWb1dOql7 nTTp1+gs0zKjI9acjP66XI5YN3rxNjNXlTnu+gsE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zhang Qilong , Mark Brown , Sasha Levin Subject: [PATCH 4.19 107/229] ASoC: wm5102: Fix PM disable depth imbalance in wm5102_probe Date: Mon, 24 Oct 2022 13:30:26 +0200 Message-Id: <20221024113002.475044346@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747571801604299217?= X-GMAIL-MSGID: =?utf-8?q?1747571801604299217?= From: Zhang Qilong [ Upstream commit fcbb60820cd3008bb44334a0395e5e57ccb77329 ] The pm_runtime_enable will increase power disable depth. Thus a pairing decrement is needed on the error handling path to keep it balanced according to context. We fix it by moving pm_runtime_enable to the endding of wm5102_probe. Fixes:93e8791dd34ca ("ASoC: wm5102: Initial driver") Signed-off-by: Zhang Qilong Link: https://lore.kernel.org/r/20220928160116.125020-4-zhangqilong3@huawei.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- sound/soc/codecs/wm5102.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sound/soc/codecs/wm5102.c b/sound/soc/codecs/wm5102.c index 7e817e1877c2..9b33c87c2fe4 100644 --- a/sound/soc/codecs/wm5102.c +++ b/sound/soc/codecs/wm5102.c @@ -2085,9 +2085,6 @@ static int wm5102_probe(struct platform_device *pdev) regmap_update_bits(arizona->regmap, wm5102_digital_vu[i], WM5102_DIG_VU, WM5102_DIG_VU); - pm_runtime_enable(&pdev->dev); - pm_runtime_idle(&pdev->dev); - ret = arizona_request_irq(arizona, ARIZONA_IRQ_DSP_IRQ1, "ADSP2 Compressed IRQ", wm5102_adsp2_irq, wm5102); @@ -2120,6 +2117,9 @@ static int wm5102_probe(struct platform_device *pdev) goto err_spk_irqs; } + pm_runtime_enable(&pdev->dev); + pm_runtime_idle(&pdev->dev); + return ret; err_spk_irqs: From patchwork Mon Oct 24 11:30:27 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8845 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp432929wru; Mon, 24 Oct 2022 05:48:06 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7+Sr2Xh1ZJEfUfoIEK/1VTh7tConJuQp+F9RKI2HguKug0RgBApJn3MpanjW5VhEO0sjfz X-Received: by 2002:a17:902:ce88:b0:186:b345:97c0 with SMTP id f8-20020a170902ce8800b00186b34597c0mr2225806plg.13.1666615686280; Mon, 24 Oct 2022 05:48:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666615686; cv=none; d=google.com; s=arc-20160816; b=uakH4a1Nie6PdNtEA55/WKbWouC2KUC2t2ARuN5/cIeWUS7HoVw0X+lBJfHCvifGvb KlIlmLqkpBFx9EmCrTjpvpPNWuxAQnpFdhKnZ6GVgb/vWYK4aIeoHkl9SLvC4Fzk27up JtSjiBtTdb/PxFb5i7tRoCgk8QHuS9rjILF2ZycDDjH38m/PTlwkaOmtZwLyP3FCWz4D D8LmDCshhq+zMYuF1+72iZzn1jWRygc6JHX+Fmv+2EXzTxaQH37iGcSRN845qWFAhKZU 1l4VAwG7CMEVJuEHRv0tzPcbFra+iYkD0SM5I8Y6FRP1OYSMWuVFlN9E/QnN2OKYxg34 igbw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=557J+U5osaCPSamV+bNYK5PYTu0x/7nmFLhM+wi8hp0=; b=gHl/LiAyiKweFQIHOT61LoM5bFmePomVadg6XNAqHD4pj582yEAxzwr1Sy7rBF9/QJ RBOO9mLuD7fVMrdHTcdqGARGGxvtR5m4D3Ct3b7Czcb+H/lNX+NEa5mrqorgjLHWxA4p gNZhAlYSvRnX6itPAy50rUod3HHKHI0zvO/nFnhUvXzyK+wItz9yjakBle0V1IjYKXle V1/LBASNVq5YUeRk+QzSMlblQ3Vcgf4tz6ke66FZShS3rYsfRoKDjV/+gECtMMaENGG2 DzhxRo6PoGYJRE3xuiYqzvMGjtiayPBN5mYZgwpFcRp1mpVsCiXcah/bS0Bd8zpnNpV8 Q1wA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=NeMXGrQN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j69-20020a638048000000b0046ebb32e9d4si12012338pgd.737.2022.10.24.05.47.49; Mon, 24 Oct 2022 05:48:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=NeMXGrQN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232037AbiJXMij (ORCPT + 99 others); Mon, 24 Oct 2022 08:38:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60584 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233790AbiJXM25 (ORCPT ); Mon, 24 Oct 2022 08:28:57 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E7C7D87083; Mon, 24 Oct 2022 05:02:36 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 7EBFFB811FC; Mon, 24 Oct 2022 11:59:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D38C3C433D6; Mon, 24 Oct 2022 11:59:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612759; bh=Iw5s5+UETe+i7xnW+mymxqU2oYJy+wu29Y/1V9grvvk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NeMXGrQNLbri5DWF5kTEaRtcdr0onxS+qV/F+S1gir2RyPoiTOANjetfqX/vXnJyg Cb5BlGNZPZgZVPQ8AspRnCkgSTpK30xf6bDtxtLKzNj0e2alOWVEMW4FrDpltXQ7xV 69b/pLrxUh6No3vmrUGn2rU8aYGoKPugQFIErNYQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Liang He , Krzysztof Kozlowski , Sasha Levin Subject: [PATCH 4.19 108/229] memory: of: Fix refcount leak bug in of_get_ddr_timings() Date: Mon, 24 Oct 2022 13:30:27 +0200 Message-Id: <20221024113002.504147137@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747573210249780191?= X-GMAIL-MSGID: =?utf-8?q?1747573210249780191?= From: Liang He [ Upstream commit 05215fb32010d4afb68fbdbb4d237df6e2d4567b ] We should add the of_node_put() when breaking out of for_each_child_of_node() as it will automatically increase and decrease the refcount. Fixes: e6b42eb6a66c ("memory: emif: add device tree support to emif driver") Signed-off-by: Liang He Signed-off-by: Krzysztof Kozlowski Link: https://lore.kernel.org/r/20220719085640.1210583-1-windhl@126.com Signed-off-by: Sasha Levin --- drivers/memory/of_memory.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/memory/of_memory.c b/drivers/memory/of_memory.c index 2f5ed7366eec..83a559d48f93 100644 --- a/drivers/memory/of_memory.c +++ b/drivers/memory/of_memory.c @@ -135,6 +135,7 @@ const struct lpddr2_timings *of_get_ddr_timings(struct device_node *np_ddr, for_each_child_of_node(np_ddr, np_tim) { if (of_device_is_compatible(np_tim, tim_compat)) { if (of_do_get_timings(np_tim, &timings[i])) { + of_node_put(np_tim); devm_kfree(dev, timings); goto default_timings; } From patchwork Mon Oct 24 11:30:28 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8791 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp430807wru; Mon, 24 Oct 2022 05:42:19 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5wuEJQC1e1sqqiCOXFgiM+ISi6gfvUTOXAPQGMzxrAREEvPNX8yIGxYS6OTM69dG4T4J1R X-Received: by 2002:a17:907:1c14:b0:7a6:38d7:5993 with SMTP id nc20-20020a1709071c1400b007a638d75993mr5928084ejc.3.1666615339477; Mon, 24 Oct 2022 05:42:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666615339; cv=none; d=google.com; s=arc-20160816; b=Xenv7973g7ueqg9njYymlY5k/0I6Hy03xGYUDavFyNc1f1RgMV7GBabxMq53XGjBUY 6RG615aI6iOuK5d4GJiS8CzrE6Hg3ddGkou9+faSIKybfq7V/xWv5t+PH++dAkxgf86L sBaP2CwkyRWNqZaUAQuISSBPH3hb69Tvg07ZZvLS2epwnk4vnz7imH5+1C0Tp+AfOmg+ K6ACxb8oFxfIohYdp3DPQxAJJbt1Z/kf1doUL4N9mOx8g6jEsNCSk9Ozj7KNe1Xzc6pk 0srpy4Irt3ltMFprYXheOjwkdBfbXE/azLt3kMnOGnnRBGn6dkXrp1HsJyJHPx8yH9aN f7mw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=0l1UCfchiAOYZ9txbsQM9R2PKLiaKHIkWJKFIVeVXIU=; b=W63YbG18P0LRTjErzGxRYxrRblbKkguMgJtqCXA9JqbO51EmIkIlEnSdBHQqAlfke4 Zk7Z1QndDEAYUkxXKCLL2YcZCA9ItAHTMMdlqJNmeCfqRFEjHXhuEC9CZOuEcoMKjwyy LMHDRh9ZzvFg2lYx+XPJneJQf7DhlebMyfWxnbF3bTDi84qo0IvSGO2c2IF/ogrDUN4j AMVTdkoUgOya2gn9C63Rhik9syYGYWN5NOOSbfGanuYPAjNClnU2iV8EegqBxKueoAyX fUUI7eduzbn506o0rKjJoqLv+J9d3/+JW9JBW6xFLT/cxDFT7jI5M4/rzB1ChZ6zbccx n4Ww== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=PrbGetl6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g17-20020a1709065d1100b007316ac034acsi26566365ejt.834.2022.10.24.05.41.50; Mon, 24 Oct 2022 05:42:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=PrbGetl6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234031AbiJXMcp (ORCPT + 99 others); Mon, 24 Oct 2022 08:32:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48924 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233982AbiJXM3I (ORCPT ); Mon, 24 Oct 2022 08:29:08 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4EFEE8769B; Mon, 24 Oct 2022 05:02:44 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 1D718B811FF; Mon, 24 Oct 2022 11:59:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 71D0DC433C1; Mon, 24 Oct 2022 11:59:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612761; bh=qKvP4bmsphMKHgqIDzfbkKxyiFWTwXsEYkyhH5HCDMQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PrbGetl6iYUWxzcOo5cXAXOieKQOwHYJ3ALqSQFL4+aq0xh2pB3TdBftCzTFB9IsX LaP+6rPjlAriHUTRe19t6rrkPueMTDlrK2zB6A/x92w5EJNfQYCWhcpjNXCaf0SgJG Jl2nErhZlkeZ7dHx9SAj8421nPZ64mhS3ESg8vpw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Liang He , Bjorn Andersson , Sasha Levin Subject: [PATCH 4.19 109/229] soc: qcom: smsm: Fix refcount leak bugs in qcom_smsm_probe() Date: Mon, 24 Oct 2022 13:30:28 +0200 Message-Id: <20221024113002.533227679@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747572846137438516?= X-GMAIL-MSGID: =?utf-8?q?1747572846137438516?= From: Liang He [ Upstream commit af8f6f39b8afd772fda4f8e61823ef8c021bf382 ] There are two refcount leak bugs in qcom_smsm_probe(): (1) The 'local_node' is escaped out from for_each_child_of_node() as the break of iteration, we should call of_node_put() for it in error path or when it is not used anymore. (2) The 'node' is escaped out from for_each_available_child_of_node() as the 'goto', we should call of_node_put() for it in goto target. Fixes: c97c4090ff72 ("soc: qcom: smsm: Add driver for Qualcomm SMSM") Signed-off-by: Liang He Signed-off-by: Bjorn Andersson Link: https://lore.kernel.org/r/20220721135217.1301039-1-windhl@126.com Signed-off-by: Sasha Levin --- drivers/soc/qcom/smsm.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/drivers/soc/qcom/smsm.c b/drivers/soc/qcom/smsm.c index 5304529b41c9..a8a1dc49519e 100644 --- a/drivers/soc/qcom/smsm.c +++ b/drivers/soc/qcom/smsm.c @@ -519,7 +519,7 @@ static int qcom_smsm_probe(struct platform_device *pdev) for (id = 0; id < smsm->num_hosts; id++) { ret = smsm_parse_ipc(smsm, id); if (ret < 0) - return ret; + goto out_put; } /* Acquire the main SMSM state vector */ @@ -527,13 +527,14 @@ static int qcom_smsm_probe(struct platform_device *pdev) smsm->num_entries * sizeof(u32)); if (ret < 0 && ret != -EEXIST) { dev_err(&pdev->dev, "unable to allocate shared state entry\n"); - return ret; + goto out_put; } states = qcom_smem_get(QCOM_SMEM_HOST_ANY, SMEM_SMSM_SHARED_STATE, NULL); if (IS_ERR(states)) { dev_err(&pdev->dev, "Unable to acquire shared state entry\n"); - return PTR_ERR(states); + ret = PTR_ERR(states); + goto out_put; } /* Acquire the list of interrupt mask vectors */ @@ -541,13 +542,14 @@ static int qcom_smsm_probe(struct platform_device *pdev) ret = qcom_smem_alloc(QCOM_SMEM_HOST_ANY, SMEM_SMSM_CPU_INTR_MASK, size); if (ret < 0 && ret != -EEXIST) { dev_err(&pdev->dev, "unable to allocate smsm interrupt mask\n"); - return ret; + goto out_put; } intr_mask = qcom_smem_get(QCOM_SMEM_HOST_ANY, SMEM_SMSM_CPU_INTR_MASK, NULL); if (IS_ERR(intr_mask)) { dev_err(&pdev->dev, "unable to acquire shared memory interrupt mask\n"); - return PTR_ERR(intr_mask); + ret = PTR_ERR(intr_mask); + goto out_put; } /* Setup the reference to the local state bits */ @@ -558,7 +560,8 @@ static int qcom_smsm_probe(struct platform_device *pdev) smsm->state = qcom_smem_state_register(local_node, &smsm_state_ops, smsm); if (IS_ERR(smsm->state)) { dev_err(smsm->dev, "failed to register qcom_smem_state\n"); - return PTR_ERR(smsm->state); + ret = PTR_ERR(smsm->state); + goto out_put; } /* Register handlers for remote processor entries of interest. */ @@ -588,16 +591,19 @@ static int qcom_smsm_probe(struct platform_device *pdev) } platform_set_drvdata(pdev, smsm); + of_node_put(local_node); return 0; unwind_interfaces: + of_node_put(node); for (id = 0; id < smsm->num_entries; id++) if (smsm->entries[id].domain) irq_domain_remove(smsm->entries[id].domain); qcom_smem_state_unregister(smsm->state); - +out_put: + of_node_put(local_node); return ret; } From patchwork Mon Oct 24 11:30:29 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8731 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp423812wru; Mon, 24 Oct 2022 05:25:51 -0700 (PDT) X-Google-Smtp-Source: AMsMyM68AN1TXduV73ra/+IKRSZuDPH5S0Fa2Bb6QayKP/cvaipSV4Dkyy/LvpAAd1natE8A6lAa X-Received: by 2002:a17:902:9a8b:b0:17a:455:d967 with SMTP id w11-20020a1709029a8b00b0017a0455d967mr33035660plp.52.1666614351569; Mon, 24 Oct 2022 05:25:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666614351; cv=none; d=google.com; s=arc-20160816; b=vcsF5OoZQ0TiJPkFEQsqu7QFfMfCUmVMEC0qWEOYJOhS1jJHxtYFbIiov8MYvGpMg7 A4eackCnTTYnrwOAxBgOv5jv7f0CZuHNXPjZhbYNlR+voTXLmbMwiTrhJZo/RpIf4cZq 3vgIym+713T1AaWk4uCjtMNo8F+PrGepGCiyPPDNSEK5AXWjUKaP/IKvCBh5WQekNvlD LnExlNd6Nx+kHS98f+uUMLOd9ON4CKPRY/kjW3+jKAivCTRo0snGWTcjkyRnRNzW7VWK k/FAnbzzE6u9tRlJF1p8pzakkcR6yJLUwpb5ZybEH/R+w44ooHFm05Hm+XaIU3BXJ2qr H20Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=O44ViJKWLmVupMYvausLl0Nj8EZAFPZgc8VBRdZRPuQ=; b=oJ7bmOUHMtMa8PAMELf26Z75DQTdsweAmhytUuZDmD/QOrGXoyU6pkZ4XCsJIhBmIu FduJxM0hT3Zx368VAaJt6eQjJIVyU8AK01g6X1ThbhE1YtDhouaq/lF1awwMgBaIAF+z GwC/leTLlIJHltYNfS2rBiVOUHreFtgNc1eQBqJ8RyYwxxfjBEGMDk3AhxNK8s+rZalo j1HW52FLAK/ceXeXHYeoOOwu5epXBOV+2UrrnEoj+1eflwE1NEhPjBjJzWqRSGQggdcx xKcbXg2WdxKK8VatcWmAeAaX5UjpN5/qCOVBuR3LHqbIdg8y4YQT2TzXM1PMIJ1z8JWg pzYw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=UgulYvEc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l10-20020a170902f68a00b001869c035f20si6471246plg.381.2022.10.24.05.25.38; Mon, 24 Oct 2022 05:25:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=UgulYvEc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233583AbiJXMZJ (ORCPT + 99 others); Mon, 24 Oct 2022 08:25:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41254 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233238AbiJXMXf (ORCPT ); Mon, 24 Oct 2022 08:23:35 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CE4E413CCC; Mon, 24 Oct 2022 04:59:42 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id EE5EB6129E; Mon, 24 Oct 2022 11:59:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 09C8EC433D6; Mon, 24 Oct 2022 11:59:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612764; bh=E6nMjH9elQkFPPehNJVGitkxW67b30EoBEbRIBxoJYw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UgulYvEc533CIu836IRc5LjGl4+pjTti3XUF44cfnGQTHOGC+kzGB3NqwN1lM1adn mdCAagw4ONQ/xNy6K/Uit/JdxLknDttgO+JAUhisbZWNThsI95fHaN5bOxQjU9tlxL tWKgbhIdctBU3qqP0AcCDR7Oe5RlfIoj3jyY8XP4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Liang He , Bjorn Andersson , Sasha Levin Subject: [PATCH 4.19 110/229] soc: qcom: smem_state: Add refcounting for the state->of_node Date: Mon, 24 Oct 2022 13:30:29 +0200 Message-Id: <20221024113002.566943406@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747571810095452349?= X-GMAIL-MSGID: =?utf-8?q?1747571810095452349?= From: Liang He [ Upstream commit 90681f53b9381c23ff7762a3b13826d620c272de ] In qcom_smem_state_register() and qcom_smem_state_release(), we should better use of_node_get() and of_node_put() for the reference creation and destruction of 'device_node'. Fixes: 9460ae2ff308 ("soc: qcom: Introduce common SMEM state machine code") Signed-off-by: Liang He Signed-off-by: Bjorn Andersson Link: https://lore.kernel.org/r/20220721135217.1301039-2-windhl@126.com Signed-off-by: Sasha Levin --- drivers/soc/qcom/smem_state.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/soc/qcom/smem_state.c b/drivers/soc/qcom/smem_state.c index d5437ca76ed9..1502cf037a6b 100644 --- a/drivers/soc/qcom/smem_state.c +++ b/drivers/soc/qcom/smem_state.c @@ -144,6 +144,7 @@ static void qcom_smem_state_release(struct kref *ref) struct qcom_smem_state *state = container_of(ref, struct qcom_smem_state, refcount); list_del(&state->list); + of_node_put(state->of_node); kfree(state); } @@ -177,7 +178,7 @@ struct qcom_smem_state *qcom_smem_state_register(struct device_node *of_node, kref_init(&state->refcount); - state->of_node = of_node; + state->of_node = of_node_get(of_node); state->ops = *ops; state->priv = priv; From patchwork Mon Oct 24 11:30:30 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8728 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp423770wru; Mon, 24 Oct 2022 05:25:43 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7Oa+xH8hpUFnXlBJMBgCwYhCuGdFLUR91OnzhcnYyXrKbJjM7zu7eW9B9Pap6u7g2Q7Wo0 X-Received: by 2002:a17:902:ced1:b0:186:b18a:d0d5 with SMTP id d17-20020a170902ced100b00186b18ad0d5mr2532626plg.60.1666614342800; Mon, 24 Oct 2022 05:25:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666614342; cv=none; d=google.com; s=arc-20160816; b=JDxkoSJFQAIb+pNjuDDZm5zZ7RrdEjgo9KWqbbSj479die5qUTnXZ1NbpXGk6y9uHV 3vapVeF5zFP/IKPSZlLRCxqXxB3QtwsMRDVgH3x4xbwwBsehsifCe9S4JZbSvk8UJE/o ritVrzpc/e6AlChh/KYkw3CbZC7OtFHW6Q7IR0ou805DqtirGe0yhHtIL5mmhaV4M3PV Bk10cUnmEht9oBwIQY5Ho82uY3BHbCK6+hv8YKsaq8NrjlasjyeVxvxwQu31x/zXnZQq mBplCa9LcY4iBJ84Bxi7zM/c1bbbyUQGBUiY3SdvMvcUC0o+pMHOnfLkxzkfljLkUZvc jQDw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=GyJzWI/3K+eYCuoLWmEQ/RUEr2IgU15DA+HH+EwjSks=; b=aITBBMs9zBq1NLCX5zPwohXays3s6T4yYVVyajy1Kqq1MCiWHrSVCjwV+3UAuhWE5A poXRGevIrQjAybWMMBgNL7kS+RhINikP5JTgAIDF8WtuuB2gQQ4pZQyTT+6fIdaOpH0m LcFVLCJ5ZFMzmHLHBt8gK3y9nrTL1j6YVS2cTtTWl9BANZWpiaAONRlwnQRcpv0ys6Av aIeYUaFx0mabV42Uqcl2fFcAUy3GrAUNMc2NG0Wad9TYc1LR3hXaAj9an4CdsjHn6opx ykuc4+JCXUkX9+woNL7kLHCBUosJCCiNjefL8AZK1qDgjyAUWcVaKSfWKO5H+VQC7mhr 2ajA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=GPMJrVkw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h16-20020a170902f55000b0017edeec4716si41557732plf.34.2022.10.24.05.25.28; Mon, 24 Oct 2022 05:25:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=GPMJrVkw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233465AbiJXMYv (ORCPT + 99 others); Mon, 24 Oct 2022 08:24:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40686 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233559AbiJXMXL (ORCPT ); Mon, 24 Oct 2022 08:23:11 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1F42D1C119; Mon, 24 Oct 2022 04:59:43 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 58C0F61252; Mon, 24 Oct 2022 11:59:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6AE14C433C1; Mon, 24 Oct 2022 11:59:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612769; bh=cHT/tctzQJbGiXiQn4s+uUUWvv1Z72ev5clpduBCXxw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GPMJrVkwjJB/Tto61ezoEEuMcyRorrGSKq3t+SmwdENP6pjN/nLfLNVC4Am22kg5/ 4y7RKc83HWpn8qyqVivu7J76UgCdFwBkwNBumj3r/iygAr26z0xroODp3kQ/HkotAS 1BhDqcMclNt46zX6U+f7YPw6vkpSb5NGmahTnXFA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?utf-8?q?Marek_Beh=C3=BAn?= , Gregory CLEMENT , Sasha Levin Subject: [PATCH 4.19 111/229] ARM: dts: turris-omnia: Fix mpp26 pin name and comment Date: Mon, 24 Oct 2022 13:30:30 +0200 Message-Id: <20221024113002.595984668@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747571801105044414?= X-GMAIL-MSGID: =?utf-8?q?1747571801105044414?= From: Marek Behún [ Upstream commit 49e93898f0dc177e645c22d0664813567fd9ec00 ] There is a bug in Turris Omnia's schematics, whereupon the MPP[26] pin, which is routed to CN11 pin header, is documented as SPI CS1, but MPP[26] pin does not support this function. Instead it controls chip select 2 if in "spi0" mode. Fix the name of the pin node in pinctrl node and fix the comment in SPI node. Fixes: 26ca8b52d6e1 ("ARM: dts: add support for Turris Omnia") Signed-off-by: Marek Behún Signed-off-by: Gregory CLEMENT Signed-off-by: Sasha Levin --- arch/arm/boot/dts/armada-385-turris-omnia.dts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/arm/boot/dts/armada-385-turris-omnia.dts b/arch/arm/boot/dts/armada-385-turris-omnia.dts index fde4c302f08e..92e08486ec81 100644 --- a/arch/arm/boot/dts/armada-385-turris-omnia.dts +++ b/arch/arm/boot/dts/armada-385-turris-omnia.dts @@ -307,7 +307,7 @@ marvell,function = "spi0"; }; - spi0cs1_pins: spi0cs1-pins { + spi0cs2_pins: spi0cs2-pins { marvell,pins = "mpp26"; marvell,function = "spi0"; }; @@ -342,7 +342,7 @@ }; }; - /* MISO, MOSI, SCLK and CS1 are routed to pin header CN11 */ + /* MISO, MOSI, SCLK and CS2 are routed to pin header CN11 */ }; &uart0 { From patchwork Mon Oct 24 11:30:31 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8780 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp430719wru; Mon, 24 Oct 2022 05:42:09 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5oYIwEGetQEUAyVR79OrQ+y2J6zPQwCTaLWukHMNZQcJiyvou9qWzQWhMLkftCuQVeLcR1 X-Received: by 2002:a17:902:d2d2:b0:182:a32f:5ba1 with SMTP id n18-20020a170902d2d200b00182a32f5ba1mr33441586plc.88.1666615329416; Mon, 24 Oct 2022 05:42:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666615329; cv=none; d=google.com; s=arc-20160816; b=L1gMmYChYrnFXlrPfRvyyw7pA5KQdDULpO+wTFzfNorHPFqL6ycRhv92DX+TVvQXDn OPFsTJv8x/dGzkSduhSPuvmhj/XtxnjfiJTNhlPY+OaMkUH/GYQC5MFerdG8O5C6WLwx 9Glh/3gWCkVw/WgUxChBfoTMvhZLz+1mgFF10k676hvALwFdOv7n4Q18LIadZSymJgOQ 4o5Y6Ckw/xHe6QpLBbu/y9kMZzYrVOKQJW9+pTjN/oDmyRvcDRQrGoSjnBYVkO0ifnen /manxlze/2t9M/yL1WsblSrnZMWRbUzQzVnSaVFcSdpOkniEcjAn+OllvvQfjtrZJjPH wMGg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=RHN2Ske92yvWhsHoCz4tAmIpOnu73nVOxi2Cc3hoDoI=; b=eVdqb2R2TdPBBX5ap/wPEJ/2qjgYjC3Va0aegdZDNnAEhoO9EgNhm5xdldLxmcpMDR 67+Zh8CJI+sUBkc/b8yldyOq92nHHTfs58DA1B7CwljckK3eCy3tj+DEuaJ+XQT92cMV 6+k1/OPeYp6YkmldwUEqZJx6RERRGsC4cWX/vaaWIVd7gf+iBu98fQ4h+QNX2K53wuBe BEnLja5Kg8a2o2h3Xr8Uh6KB5PBbAImr8eWSkrXFA73BD7XEvevg1UerE1yUe4Uipwn7 tm7WL8zsSFhOVIb/y//DZxZPxbDjRFJR7zVrBMn0mcPlZLe0Sh/3tDStSlR6Phr2QSAm Ze1Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Cha0JQR8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id nv8-20020a17090b1b4800b0020d3424d919si10671661pjb.97.2022.10.24.05.41.54; Mon, 24 Oct 2022 05:42:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Cha0JQR8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231765AbiJXMby (ORCPT + 99 others); Mon, 24 Oct 2022 08:31:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60576 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233780AbiJXM25 (ORCPT ); Mon, 24 Oct 2022 08:28:57 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A5D8A870A8; Mon, 24 Oct 2022 05:02:47 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id B405EB811F5; Mon, 24 Oct 2022 11:59:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1544EC433D6; Mon, 24 Oct 2022 11:59:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612772; bh=BBEZSL/kEaLKT0nn3CDJDaoaCe8MaFX+1kU7JZ+z9Ck=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Cha0JQR8eSlxHXQjsOYNiD2ONaTNod9hkwDoi9EIAAXp4MhTtVF4nFZHMUOwWyMNP 139bthBplrAjA5Xy9L8pn5Fl8eaOag9LlvZtPScqrC36TR0ncHVau3eSsw+v1RicZP 4H4Ga0eqq3hB3OI4/gl+e/Toin8YoMx+Wj+tnr3w= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Michael Walle , Andrew Lunn , Gregory CLEMENT , Sasha Levin Subject: [PATCH 4.19 112/229] ARM: dts: kirkwood: lsxl: fix serial line Date: Mon, 24 Oct 2022 13:30:31 +0200 Message-Id: <20221024113002.628237795@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747572835879115977?= X-GMAIL-MSGID: =?utf-8?q?1747572835879115977?= From: Michael Walle [ Upstream commit 04eabc6ac10fda9424606d9a7ab6ab9a5d95350a ] Commit 327e15428977 ("ARM: dts: kirkwood: consolidate common pinctrl settings") unknowingly broke the serial output on this board. Before this commit, the pinmux was still configured by the bootloader and the kernel didn't reconfigured it again. This was an oversight by the initial board support where the pinmux for the serial line was never configured by the kernel. But with this commit, the serial line will be reconfigured to the wrong pins. This is especially confusing, because the output still works, but the input doesn't. Presumingly, the input is reconfigured to MPP10, but the output is connected to both MPP11 and MPP5. Override the pinmux in the board device tree. Fixes: 327e15428977 ("ARM: dts: kirkwood: consolidate common pinctrl settings") Signed-off-by: Michael Walle Reviewed-by: Andrew Lunn Signed-off-by: Gregory CLEMENT Signed-off-by: Sasha Levin --- arch/arm/boot/dts/kirkwood-lsxl.dtsi | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/arch/arm/boot/dts/kirkwood-lsxl.dtsi b/arch/arm/boot/dts/kirkwood-lsxl.dtsi index 7b151acb9984..321a40a98ed2 100644 --- a/arch/arm/boot/dts/kirkwood-lsxl.dtsi +++ b/arch/arm/boot/dts/kirkwood-lsxl.dtsi @@ -10,6 +10,11 @@ ocp@f1000000 { pinctrl: pin-controller@10000 { + /* Non-default UART pins */ + pmx_uart0: pmx-uart0 { + marvell,pins = "mpp4", "mpp5"; + }; + pmx_power_hdd: pmx-power-hdd { marvell,pins = "mpp10"; marvell,function = "gpo"; From patchwork Mon Oct 24 11:30:32 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8741 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp426759wru; Mon, 24 Oct 2022 05:31:56 -0700 (PDT) X-Google-Smtp-Source: AMsMyM78hP3xtq+4yH5gm9zNpK52aie8WE3N3plLMGHPaoOhYdBgDxy4+zUrPajwdKQbeXh3GqUC X-Received: by 2002:a05:6402:2937:b0:461:32aa:32da with SMTP id ee55-20020a056402293700b0046132aa32damr17531133edb.78.1666614716563; Mon, 24 Oct 2022 05:31:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666614716; cv=none; d=google.com; s=arc-20160816; b=tCJRnxKUjiRBDmg3zMrtVILpuNbdOGB0VTkcFEu/vaX46d07kRb6kwaHLclZ6OH676 djlK+HUKvni1vyJx7jzrMn7NmqQzce8zvDjz3J0mjw8SMSbz/dt0pDTbNH2AkLFJ31mA H77H1rxyTv3f6G5r3mt4NaIATQpiALGvPFc/WfrPvd8KGSmy8XfkI3ohgjJuXeKnapuU A7cRwv0GdpkOqm0jRLXXZOfwqMcdOe+6sYoYdit/GHReKkURAVK3ZYqgXBL0JsWJpmym Omsug+xbTWNsj9/oz/tLIg3O5cenzi23LDqC2vZYXxCQFCZVgjkiE7eAqS0RaFmXl3Mg b5ag== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=bZCjyF/awsLX2FZMnkU85emi6uW8YxgWuqdmAKdv8W8=; b=q9rY1cqRcG9Pk8bVlJtpKzYVP2vgp2x7NLAtopv0UmcbOv9zBwNRYtL+OUevIF6T/N 9sh3ptTro133xaIvvNfwexjvH+IACmWEfrdM2NTji9BxSEMOGjAbsyPNG+Pux345Sw18 2RHjJPjsrDNdM8K2a8DbIng+y3oe79zTQFckUMiyF/d+CUButLaUOeVUock6snKW8kko 7ZnWrbDMwGHmfnzNrSxwx5/cOjuweWCm+q19LBEK2hiah88yaOdy+CcCh4lhpvTBBvb7 CsLPMkycOOkb+luTvfIzPGySl+j0+TptH/L91Dm7mCh5Ey2BxpVuS2gqCfekJcoWzZXq +LhQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=lsmr1yYG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ds3-20020a170907724300b0078e11a20640si212604ejc.2.2022.10.24.05.31.25; Mon, 24 Oct 2022 05:31:56 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=lsmr1yYG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233672AbiJXM0E (ORCPT + 99 others); Mon, 24 Oct 2022 08:26:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40918 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233442AbiJXMX0 (ORCPT ); Mon, 24 Oct 2022 08:23:26 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E91201B9C7; Mon, 24 Oct 2022 04:59:43 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 9D51F6129D; Mon, 24 Oct 2022 11:59:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AC3E9C433D6; Mon, 24 Oct 2022 11:59:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612775; bh=RLkQdPDMRCOU/IECOAC2hHaLhoeqjEyfi9vzRWGTaUE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lsmr1yYGpl6Op8WcFhTiG6k9bCteAw+l0wy3R0EA1EoqEpFOFrI8sIeklZYtO+l8g zP2SVYMfuxnDtelQJMaEviF5i6KbCoQr6wxfGs0cES85ZFfvvayq5YGabBF4U/bpfM SFTuIsQUQXPJv6JuBsGewieV/rJ3H7uhndJ+PMVQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Michael Walle , Andrew Lunn , Gregory CLEMENT , Sasha Levin Subject: [PATCH 4.19 113/229] ARM: dts: kirkwood: lsxl: remove first ethernet port Date: Mon, 24 Oct 2022 13:30:32 +0200 Message-Id: <20221024113002.657892483@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747572192884392264?= X-GMAIL-MSGID: =?utf-8?q?1747572192884392264?= From: Michael Walle [ Upstream commit 2d528eda7c96ce5c70f895854ecd5684bd5d80b9 ] Both the Linkstation LS-CHLv2 and the LS-XHL have only one ethernet port. This has always been wrong, i.e. the board code used to set up both ports, but the driver will play nice and return -ENODEV if the assiciated PHY is not found. Nevertheless, it is wrong. Remove it. Fixes: 876e23333511 ("ARM: kirkwood: add gigabit ethernet and mvmdio device tree nodes") Signed-off-by: Michael Walle Reviewed-by: Andrew Lunn Signed-off-by: Gregory CLEMENT Signed-off-by: Sasha Levin --- arch/arm/boot/dts/kirkwood-lsxl.dtsi | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/arch/arm/boot/dts/kirkwood-lsxl.dtsi b/arch/arm/boot/dts/kirkwood-lsxl.dtsi index 321a40a98ed2..88b70ba1c8fe 100644 --- a/arch/arm/boot/dts/kirkwood-lsxl.dtsi +++ b/arch/arm/boot/dts/kirkwood-lsxl.dtsi @@ -218,22 +218,11 @@ &mdio { status = "okay"; - ethphy0: ethernet-phy@0 { - reg = <0>; - }; - ethphy1: ethernet-phy@8 { reg = <8>; }; }; -ð0 { - status = "okay"; - ethernet0-port@0 { - phy-handle = <ðphy0>; - }; -}; - ð1 { status = "okay"; ethernet1-port@0 { From patchwork Mon Oct 24 11:30:33 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8732 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp423846wru; Mon, 24 Oct 2022 05:25:57 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5JJwj8P1DZxecA4grK0WYeehXCDNDTY0lMXqunSqXLaZmrLK9rKX13hmx7Dv68gqqOqRIq X-Received: by 2002:a17:90b:4a03:b0:213:1b8b:dcfc with SMTP id kk3-20020a17090b4a0300b002131b8bdcfcmr3852946pjb.173.1666614357680; Mon, 24 Oct 2022 05:25:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666614357; cv=none; d=google.com; s=arc-20160816; b=n9NvtxY3oQu4pI7F7EAElTevVM/Dz3u/fGZ/g/5rIm2gqt7PYDZPDOf1pyATWcDTeY bWXcLBgFfy5PkxmLha7+ToJBj1K/0452rLc/qCVDrTVLv+mKWgL+gBIENRETB35i6gMj hEf3IJ62PkxaJqBbPhGR6QpwbN6BeIzmk/hZYs5Kg61YbJHySWcgJZAr8jfa+BX/a8XY XO34ao1zhMbo6vemKX5pqjb08nMlpZmyv5zKLkGXN0//yv1GKxFMqL7XgIUBsTtpHMKR uSbktDeJUH6IfVTloFYVokvpGLvtzwzQ5zxh97EZEMAUbu0/3DxQrcnoxiK+2gGJfwxO JHtA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=BpRUSAtz3YpLN/zjsZfa733+2uiTwoBsQ0hFZ4m0+cU=; b=XxRZC1t4BN5neibl/CtJi0wJMxudVi9Znt5qPYoPY32isSs45J6mF5bWamnb9aZWfU 8AQcLWTN26mXsK8edbX5XDgmt/unKL2YwRZrA8GnfyYWUwSzx8OMISiSQ5DfDMNY5WhC jHhevmhYoeu2v+FJEy9J6u+cZOKQvHsvaEN900jJZ9JgbvqciWMx1VhjHh1/2ok4yGlJ yf7OGd2xEYWEqsJjxyON+K3y8UwcpBH206rh/I4myCidqIObrLba5yZ7yTcq8IYNwGUR 7bywwUs7Xp2vM/Ns+xl1T2gJWX5GF9x2Ts3jIxZcGCLaE58TYMxLpJFcJ2knm2en3r8T sCiw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=E738jcCP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p2-20020a170902b08200b00180556e1b6bsi32266394plr.609.2022.10.24.05.25.44; Mon, 24 Oct 2022 05:25:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=E738jcCP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233570AbiJXMZG (ORCPT + 99 others); Mon, 24 Oct 2022 08:25:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53764 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233572AbiJXMXP (ORCPT ); Mon, 24 Oct 2022 08:23:15 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 716F71AF15; Mon, 24 Oct 2022 04:59:43 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 3B59F6129B; Mon, 24 Oct 2022 11:59:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 50818C433C1; Mon, 24 Oct 2022 11:59:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612777; bh=PjdSAhHFsEcQmApOu7TJ6TUEWQhU3Y739C1c8IFEpF8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=E738jcCP2MUsQ2ew8BI6HWfUbvcv18FV4JLcKyZPo7Ucryv6nmUx4HSrTnH1q6IHC 9SxOWGI0KJM/wad2Xv++pV4nWV9MFvf7zXnv7iBNfmuyvugmiSuPeAz/upGYXccn0I 4Pb0QYtUyQMOUAInAhFsLh2P8mPUvqdMUk1vPiig= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dmitry Torokhov , Krzysztof Kozlowski , Linus Walleij , Arnd Bergmann , Sasha Levin Subject: [PATCH 4.19 114/229] ARM: dts: exynos: correct s5k6a3 reset polarity on Midas family Date: Mon, 24 Oct 2022 13:30:33 +0200 Message-Id: <20221024113002.689910603@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747571816673756097?= X-GMAIL-MSGID: =?utf-8?q?1747571816673756097?= From: Dmitry Torokhov [ Upstream commit 3ba2d4bb9592bf7a6a3fe3dbe711ecfc3d004bab ] According to s5k6a3 driver code, the reset line for the chip appears to be active low. This also matches the typical polarity of reset lines in general. Let's fix it up as having correct polarity in DTS is important when the driver will be switched over to gpiod API. Fixes: b4fec64758ab ("ARM: dts: Add camera device nodes for Exynos4412 TRATS2 board") Signed-off-by: Dmitry Torokhov Signed-off-by: Krzysztof Kozlowski Reviewed-by: Linus Walleij Link: https://lore.kernel.org/r/20220913164104.203957-1-dmitry.torokhov@gmail.com Link: https://lore.kernel.org/r/20220926104354.118578-2-krzysztof.kozlowski@linaro.org' Signed-off-by: Arnd Bergmann Signed-off-by: Sasha Levin --- arch/arm/boot/dts/exynos4412-midas.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm/boot/dts/exynos4412-midas.dtsi b/arch/arm/boot/dts/exynos4412-midas.dtsi index 60fbad25b5f2..93c8918e599b 100644 --- a/arch/arm/boot/dts/exynos4412-midas.dtsi +++ b/arch/arm/boot/dts/exynos4412-midas.dtsi @@ -525,7 +525,7 @@ clocks = <&camera 1>; clock-names = "extclk"; samsung,camclk-out = <1>; - gpios = <&gpm1 6 GPIO_ACTIVE_HIGH>; + gpios = <&gpm1 6 GPIO_ACTIVE_LOW>; port { is_s5k6a3_ep: endpoint { From patchwork Mon Oct 24 11:30:34 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9001 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp440041wru; Mon, 24 Oct 2022 06:03:41 -0700 (PDT) X-Google-Smtp-Source: AMsMyM74ywI3xNRNSjsR8muShtwGECMJCdhdqJZwiLJ1szXzjfS+NKbFZTsQBbm8PQ+Zya420+QQ X-Received: by 2002:a05:6a00:1991:b0:565:9912:cbf7 with SMTP id d17-20020a056a00199100b005659912cbf7mr34090702pfl.59.1666616621201; Mon, 24 Oct 2022 06:03:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666616621; cv=none; d=google.com; s=arc-20160816; b=EPzbenj1M7Z153YnUfXObsT+wXuxeuuFNyNlTXM/DCNjDPAsgN+y6DDgHlqQUJMmUx HuuhDavSAUMFuVFtno2jlJfR4eDDacaoDBUW0V2bojqaV8700CMt1uJsYHVvbM0MTj87 UzAIdrFk07RLdiwTO+Vbw87i/Ln/2L439Hi0IkrbFqKAFJTYVivygN4RQZ4x7wR8s3te 8i4GoYVzbMt2oKYs8ght6IRYYkLsMCA34Fxb45pW6OJ0xVbvQL6SzKuQJrvrA9apBPpR W1iy2UHa8+gQHwqfDCDVZpozil85V66dxgL+S1kNlNVqO1NP2TycaqvpIctUXhkHlZT9 5ooA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=jyKIGqVCpTMXngJyehl8+pam4p5+Z2n1cFhSkxcdpUo=; b=uYyhSjbDdx8oEnj+fpyGBDjT1WSCwQzkiX4uG+MNfLRpGPYvwcPU4Cq+EKREHuxCrc AZZNfD+X0iWI/MVrryM+ux/Cr4weW/NsDIwSHLyu4tMZrzoSVrW1ed4RctAT5e1gzRZY wePB3xr0nhBD2w59DYpe3BV6Wv5B3uSqAZgYFyWUxPz2tSj+svU53iEC9vtdqugUHrRS wiO5kE3f2flhbovifEo1Hqa7gBDh/sRxWnwjPOZZ0QDB+ZDj8lO6e/axyJOlCFbiDGCm nUo07t7P58oRZcXjTc7J+wWFrEypvVN3xV7hGVGS+rOVT1UkL7UCcpECsYCjmBXM8k41 kQuA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=LhjYbH4k; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u2-20020a170902e80200b00186a7d84c25si3800614plg.348.2022.10.24.06.03.00; Mon, 24 Oct 2022 06:03:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=LhjYbH4k; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235094AbiJXNCW (ORCPT + 99 others); Mon, 24 Oct 2022 09:02:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42892 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235157AbiJXM72 (ORCPT ); Mon, 24 Oct 2022 08:59:28 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5228A9AFA8; Mon, 24 Oct 2022 05:19:00 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 6DD55612D1; Mon, 24 Oct 2022 12:01:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 80299C433D6; Mon, 24 Oct 2022 12:01:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612885; bh=7IObXmTSTozYNo0nq8weVn+Qu4CRgbsAkxKHYjFBcOM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LhjYbH4krzg+PefQ0d1mu9HQFAKrfi53oM0+n3Ka/2i1R1mOz3sd//8wee8F209Zn IWDGRsVkLWfT48/f4IhNAXYBE86ghblVJobmUQHFeUdBl9Hi2rWtOm6cQsgaEIKdrX IwM4fi68Z+u4rEuLSXsUJvEGfaUpFNYShUoZii2o= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Geert Uytterhoeven , Ard Biesheuvel , Arnd Bergmann , Sasha Levin Subject: [PATCH 4.19 115/229] ARM: Drop CMDLINE_* dependency on ATAGS Date: Mon, 24 Oct 2022 13:30:34 +0200 Message-Id: <20221024113002.719052094@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747574190508822370?= X-GMAIL-MSGID: =?utf-8?q?1747574190508822370?= From: Geert Uytterhoeven [ Upstream commit 136f4b1ec7c962ee37a787e095fd37b058d72bd3 ] On arm32, the configuration options to specify the kernel command line type depend on ATAGS. However, the actual CMDLINE cofiguration option does not depend on ATAGS, and the code that handles this is not specific to ATAGS (see drivers/of/fdt.c:early_init_dt_scan_chosen()). Hence users who desire to override the kernel command line on arm32 must enable support for ATAGS, even on a pure-DT system. Other architectures (arm64, loongarch, microblaze, nios2, powerpc, and riscv) do not impose such a restriction. Hence drop the dependency on ATAGS. Fixes: bd51e2f595580fb6 ("ARM: 7506/1: allow for ATAGS to be configured out when DT support is selected") Signed-off-by: Geert Uytterhoeven Acked-by: Ard Biesheuvel Signed-off-by: Arnd Bergmann Signed-off-by: Sasha Levin --- arch/arm/Kconfig | 1 - 1 file changed, 1 deletion(-) diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index fce7e85f3ef5..41bde0e62e90 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -1943,7 +1943,6 @@ config CMDLINE choice prompt "Kernel command line type" if CMDLINE != "" default CMDLINE_FROM_BOOTLOADER - depends on ATAGS config CMDLINE_FROM_BOOTLOADER bool "Use bootloader kernel arguments if available" From patchwork Mon Oct 24 11:30:35 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9850 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp558941wru; Mon, 24 Oct 2022 10:05:36 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5mKaW2AEEDrjzJ7eDsG7XweLF/BoMWArCnzPZdNnehNDyr4uwK8TiX0VZB2JvHdqTfLzyU X-Received: by 2002:a17:903:50e:b0:182:631b:df6f with SMTP id jn14-20020a170903050e00b00182631bdf6fmr34602570plb.66.1666631136239; Mon, 24 Oct 2022 10:05:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666631136; cv=none; d=google.com; s=arc-20160816; b=tM9s2QZgppjXnHfSB6RY8DzQwvsgOYjrHtRvrjqVQLbzw5n4V9whULiTHd74N1qOO7 xfNKPmyABKlUItbaC1p9oLEWnEuss2vDk0dA6ae23KR3WkO9nOaG3qaT9qwiAd1G+47c oo1Uled/LP3uhCmyi13PhscvUWY2JcaE+ckH4g5Wmu1YCfc0gCfHy1TKPfBfaumVefhJ kHD93PdUtDygYRP3A4TCWN23QvtV/Cg7o7UxsZx+9nCwlBBrpuAD8R5HDbveeXTh/HL7 GHiywxDUivcEebf5mlB/ivvQMJxMjDzjW2tucrYB4fm/StfG8yIRn8ZqRMZKzFcH+k67 AMlA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=nnNIp07k2d9CXbno9Ll0DNz1QelfgJdxmnDD4z1UBzQ=; b=Se+l3zrxcZcFjtPuC/kjNsCM/2qWi1vvVfoUTtBdGRYKwJ9r7yQ46oAZ35dW0zZxHt oK8/ksMEjjQp9mh1F8MxntEExLXzZPmHqMdCcqLJ5NnlsUOHHP68SmsuckbK89PSIbbI nuOqrNtKFEeza3IfKUqLT+bubyjSrr9JEn4SISk2RDTmebE2Sj9hx6+2yyXMh9MRukm4 grXrPF0ZXkmQX5G2LI1kzzwV1K19rpPIHICGmoR0fyfa2elwoKOxWlmpJNOfMFie+FSs MdviSpssLdrPiJPV8Z2iu4JTupq2+1QRkKwJc1gV0ex7j46VYjowvRnwCOo2Hbct2NVb rKFQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=qqEbLNyA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y5-20020a170902864500b00186748fe8e8si34650plt.188.2022.10.24.10.05.21; Mon, 24 Oct 2022 10:05:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=qqEbLNyA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231901AbiJXRAo (ORCPT + 99 others); Mon, 24 Oct 2022 13:00:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49070 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229959AbiJXQ62 (ORCPT ); Mon, 24 Oct 2022 12:58:28 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 770373E777; Mon, 24 Oct 2022 08:37:20 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id E2DF9B811E7; Mon, 24 Oct 2022 11:59:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4613AC433C1; Mon, 24 Oct 2022 11:59:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612798; bh=m13IFTUaEZZ3IJYKl4KRUETJ2GzfudCnvdR4i1l9oaI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qqEbLNyAPCTEwuAFuaX3eekFLcL0S1oIz+RLtdlcknsqZgvAt/AavZudW850fudZF ooVuuwcQOHABYyC5jKdcLMJWuhPmN/dphp+/q8fiRhE49A0HI2zXoRjX93YmFZCtSb RjhziRO5E2nvCsXgmxi+4UYgvaVYAeiQFE7743ks= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dmitry Torokhov , Krzysztof Kozlowski , Sasha Levin Subject: [PATCH 4.19 116/229] ARM: dts: exynos: fix polarity of VBUS GPIO of Origen Date: Mon, 24 Oct 2022 13:30:35 +0200 Message-Id: <20221024113002.753802574@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747589410310893807?= X-GMAIL-MSGID: =?utf-8?q?1747589410310893807?= From: Dmitry Torokhov [ Upstream commit a08137bd1e0a7ce951dce9ce4a83e39d379b6e1b ] EHCI Oxynos (drivers/usb/host/ehci-exynos.c) drives VBUS GPIO high when trying to power up the bus, therefore the GPIO in DTS must be marked as "active high". This will be important when EHCI driver is converted to gpiod API that respects declared polarities. Fixes: 4e8991def565 ("ARM: dts: exynos: Enable AX88760 USB hub on Origen board") Signed-off-by: Dmitry Torokhov Link: https://lore.kernel.org/r/20220927220504.3744878-1-dmitry.torokhov@gmail.com Signed-off-by: Krzysztof Kozlowski Signed-off-by: Sasha Levin --- arch/arm/boot/dts/exynos4412-origen.dts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm/boot/dts/exynos4412-origen.dts b/arch/arm/boot/dts/exynos4412-origen.dts index 346f71932457..e5bfa76185a2 100644 --- a/arch/arm/boot/dts/exynos4412-origen.dts +++ b/arch/arm/boot/dts/exynos4412-origen.dts @@ -87,7 +87,7 @@ }; &ehci { - samsung,vbus-gpio = <&gpx3 5 1>; + samsung,vbus-gpio = <&gpx3 5 GPIO_ACTIVE_HIGH>; status = "okay"; port@1 { From patchwork Mon Oct 24 11:30:36 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8786 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp430733wru; Mon, 24 Oct 2022 05:42:11 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4MMIS8PaKtrQZgXWIIwG3aEN5sng8EyG9K4I6BLxiuR7PRnAmGAYPQiR12Af8HIiQqtv7F X-Received: by 2002:a63:5c5a:0:b0:46e:be05:a79a with SMTP id n26-20020a635c5a000000b0046ebe05a79amr14056799pgm.138.1666615331283; Mon, 24 Oct 2022 05:42:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666615331; cv=none; d=google.com; s=arc-20160816; b=MsgXUSZAN5tXsOHH1kg8T4TVmZjxPk0ASbVzlOxMGgj26Ploq2Tkb+MjCsPhatUvcw vK9gZFWnlZFB7Uc+W8ALJqQr5/Lj1WdRi6w78EMlWmGe+ORrtUEpL6dngyg+YIdz2wXl wqdXe/gH2ujXY3/p4VP2zhemwFAqZeeHK8CysFfUhqyYNMN1nsPe+iQ90WPaOMqNasvH JGeNixSpy95MFqRGDQyJcIdqhG2PSxdUvh8bNmCZaKal0TXkVjJV7nNT1NcCjgCiqOOV ptwI7kbIkzpkV9cXGh+LYcyDXvWYrbKbScf94pflWe1Exih2rWrBNhGOHlYW0Dq8ZECW EF4Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=u0ksgovez3O+Vf4NJJcvQq815CVTgJ/ZDIalVgy8cho=; b=fbIo3FfY9UxEsqrUzKvSLIY43JfwmtuRqr+1n6qgpeVRBMqICdcG+lnHu4v1X3TvN3 p1RKV+CeDi7IQ31+dkXouWoZlWW9ndBzS64aqPmoA2ZnwBhHbKeDwoq1lDPP4U5BRIrz Bj0QsQ5zgt1iZdYas5J8C/5VTi68NmvILggEdsAcKXfPtKSeXwalFZQ9FU65snGYgDhW PkUeELL8Uw8b1NNxcGm2jldahAGUYDzA9K3HmogTuABc2GDkaK63j3xyqTraJzbj36jH 6UPQSkabegWWKobEiM+HR0i6Ybb5KzIfcoWeoNi097MpNeAOF+E3ysOOAFDBkqDPAnwU FEyQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="tCZqH/jb"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x14-20020a63170e000000b0046b42fe6766si27106086pgl.861.2022.10.24.05.41.57; Mon, 24 Oct 2022 05:42:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="tCZqH/jb"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234061AbiJXMdQ (ORCPT + 99 others); Mon, 24 Oct 2022 08:33:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45124 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234074AbiJXM3R (ORCPT ); Mon, 24 Oct 2022 08:29:17 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7E9E7165A4; Mon, 24 Oct 2022 05:03:13 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 2BCAFB81211; Mon, 24 Oct 2022 12:00:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 817AFC4314C; Mon, 24 Oct 2022 12:00:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612827; bh=cX7muafZA+6IXcnJmeJJuaf5i1SDb/EPnsgDONjK2lI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tCZqH/jbW83hOoF+uBj5fCh/RjLd2N9/KAC8fEjA2D62Q5/3KP+ccGzIt7gq4bXY5 dgZFCvHFCUfLNXmjAsoYV9mtIbJWQEopDM8n86W0GIosMd2M7sP5jrXAubaIxfrB5k UznCfAmumCDM1SCVhT6Aj7qFfgxDdlYFefC+bz4o= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Claudiu Beznea , Jonathan Cameron , Sasha Levin Subject: [PATCH 4.19 117/229] iio: adc: at91-sama5d2_adc: fix AT91_SAMA5D2_MR_TRACKTIM_MAX Date: Mon, 24 Oct 2022 13:30:36 +0200 Message-Id: <20221024113002.783265313@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747572837143553444?= X-GMAIL-MSGID: =?utf-8?q?1747572837143553444?= From: Claudiu Beznea [ Upstream commit bb73d5d9164c57c4bb916739a98e5cd8e0a5ed8c ] All ADC HW versions handled by this driver (SAMA5D2, SAM9X60, SAMA7G5) have MR.TRACKTIM on 4 bits. Fix AT91_SAMA5D2_MR_TRACKTIM_MAX to reflect this. Fixes: 27e177190891 ("iio:adc:at91_adc8xx: introduce new atmel adc driver") Signed-off-by: Claudiu Beznea Link: https://lore.kernel.org/r/20220803102855.2191070-2-claudiu.beznea@microchip.com Signed-off-by: Jonathan Cameron Signed-off-by: Sasha Levin --- drivers/iio/adc/at91-sama5d2_adc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/iio/adc/at91-sama5d2_adc.c b/drivers/iio/adc/at91-sama5d2_adc.c index 129c3adad4c0..141badb8707e 100644 --- a/drivers/iio/adc/at91-sama5d2_adc.c +++ b/drivers/iio/adc/at91-sama5d2_adc.c @@ -81,7 +81,7 @@ #define AT91_SAMA5D2_MR_ANACH BIT(23) /* Tracking Time */ #define AT91_SAMA5D2_MR_TRACKTIM(v) ((v) << 24) -#define AT91_SAMA5D2_MR_TRACKTIM_MAX 0xff +#define AT91_SAMA5D2_MR_TRACKTIM_MAX 0xf /* Transfer Time */ #define AT91_SAMA5D2_MR_TRANSFER(v) ((v) << 28) #define AT91_SAMA5D2_MR_TRANSFER_MAX 0x3 From patchwork Mon Oct 24 11:30:37 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9851 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp558944wru; Mon, 24 Oct 2022 10:05:36 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7MPv9UrQvEQQ3WUHlv/UbKrqtbI5ZrSBvDelRApgnAqN6patqNe3Eq0yNVEfrsFXeeklR9 X-Received: by 2002:a17:90b:4a43:b0:212:fd76:be5d with SMTP id lb3-20020a17090b4a4300b00212fd76be5dmr10276007pjb.152.1666631136388; Mon, 24 Oct 2022 10:05:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666631136; cv=none; d=google.com; s=arc-20160816; b=m1M0PDDGFrQwU3X/tr+ynT4T/NXXxoiOHdKGQ7rvGoXK9+1AKGxAiri+KqlN9loRhA 8W9XmcrQUq9NZ9jRm+7JXuZe9hf92IZ567wHKHAXlskAjanZN/14hybsOKnmwMznrK5T fRa+g9FS+9zhd2cbcVW4Wv/Ej/DuQpr5MllWng2kqitL/vfx/+38mwIL2RdC6/UEY42A VGwGghNWuBUeQtX6jQgH2xgVYdFEJJHFrYfZOYGimAPW3wU+u/u1gDZk1EUw/ntAW6Ob j8sxQyIVolPLiVyZmlgM9Azdvu4eUB6BeSr80HtVwLzN1D+VHKZ5499frDWtrwQSbqo6 e9DA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=yV3pkWfv6OMNCV4c6KKrqIEi5usPp890RI/pkRvyeJM=; b=lGAO7fPnBJK1RuMAXr7TpIuxkCakNClXU8OGAVtQrURXEM1ePOTmj1vtjXolTTRNQS ldXbDj/3cHVFAwr0RLYWlhue2TTd98kP/DvElBHc9W4jV+y8IttFAX3XKKUri0FVZaef /k9rB48lw+X8lpIgfmSRRhDqUJkKoEhkF1FeXvQsVw/ByKLBJWvaVYIKNFHykdutDgKA +Yg5UxQrGJ3GA9Dw7zj11XQ1JUQDEE2JMhquPe1TZwrHUYqAPbZXgBy56zp4XQhB/dZR ddf8tKMp4HtCiiFtDEx5KOrB5qjvBRodmfuY/COFwnJp8GuSsoAeMlgx4YI843JGSD3X 0PqA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=JOuH62u1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 79-20020a630452000000b0045160a30fcasi1852pge.388.2022.10.24.10.05.21; Mon, 24 Oct 2022 10:05:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=JOuH62u1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231693AbiJXRAj (ORCPT + 99 others); Mon, 24 Oct 2022 13:00:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57926 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232254AbiJXQ6Z (ORCPT ); Mon, 24 Oct 2022 12:58:25 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 15D4B43600; Mon, 24 Oct 2022 08:37:17 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 18594B81217; Mon, 24 Oct 2022 12:00:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6EF7FC433D6; Mon, 24 Oct 2022 12:00:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612856; bh=HG44hPgTBmWsbYCtnrIvirEw6ej6b3jB0V16siZzCW0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JOuH62u1icqRJpcRqs+gf9R41VRDXQ8Yf49RUmdpY7jhgpMoiUqaV8uXQw5Jb3SHb rxGg6krjoNi62fW+c30b/uhzsqHFWF+U598wNz86EAd0eLBmxpmYIWxmLgIVUMlsQv AVZpDCjN9nbivPyn09Ok6wc8au863MjUutyGzrQ4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Claudiu Beznea , Jonathan Cameron , Sasha Levin Subject: [PATCH 4.19 118/229] iio: adc: at91-sama5d2_adc: check return status for pressure and touch Date: Mon, 24 Oct 2022 13:30:37 +0200 Message-Id: <20221024113002.811943227@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747589410419329210?= X-GMAIL-MSGID: =?utf-8?q?1747589410419329210?= From: Claudiu Beznea [ Upstream commit d84ace944a3b24529798dbae1340dea098473155 ] Check return status of at91_adc_read_position() and at91_adc_read_pressure() in at91_adc_read_info_raw(). Fixes: 6794e23fa3fe ("iio: adc: at91-sama5d2_adc: add support for oversampling resolution") Signed-off-by: Claudiu Beznea Link: https://lore.kernel.org/r/20220803102855.2191070-3-claudiu.beznea@microchip.com Signed-off-by: Jonathan Cameron Signed-off-by: Sasha Levin --- drivers/iio/adc/at91-sama5d2_adc.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/iio/adc/at91-sama5d2_adc.c b/drivers/iio/adc/at91-sama5d2_adc.c index 141badb8707e..b355899f54cc 100644 --- a/drivers/iio/adc/at91-sama5d2_adc.c +++ b/drivers/iio/adc/at91-sama5d2_adc.c @@ -1329,8 +1329,10 @@ static int at91_adc_read_info_raw(struct iio_dev *indio_dev, *val = tmp_val; mutex_unlock(&st->lock); iio_device_release_direct_mode(indio_dev); + if (ret > 0) + ret = at91_adc_adjust_val_osr(st, val); - return at91_adc_adjust_val_osr(st, val); + return ret; } if (chan->type == IIO_PRESSURE) { ret = iio_device_claim_direct_mode(indio_dev); @@ -1343,8 +1345,10 @@ static int at91_adc_read_info_raw(struct iio_dev *indio_dev, *val = tmp_val; mutex_unlock(&st->lock); iio_device_release_direct_mode(indio_dev); + if (ret > 0) + ret = at91_adc_adjust_val_osr(st, val); - return at91_adc_adjust_val_osr(st, val); + return ret; } /* in this case we have a voltage channel */ From patchwork Mon Oct 24 11:30:38 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8839 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp431567wru; Mon, 24 Oct 2022 05:44:12 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4KACxD/ETlXEFdM4Xj3LzVm5xVGadw62Kxm+r/193fgkbWpDEOrrSYw0IBgUDDSxAqQxOe X-Received: by 2002:a17:907:7251:b0:7a5:a8f5:b86e with SMTP id ds17-20020a170907725100b007a5a8f5b86emr6239069ejc.761.1666615452372; Mon, 24 Oct 2022 05:44:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666615452; cv=none; d=google.com; s=arc-20160816; b=WGNEmb6Wz4WdPeA4pyNbcfb6SCoyimRCp4GoPdn3i+hnOucB/at0Y3tdRTH3BG/bs3 ofP/FuFVVZ/42xxh469qIQltYT6v1TgDMYCyLDL31es7wQSlJ0oxN5R1Oo34TTgcf+Xx v+LG3P9vjmeKvhg0UQHEF5q9jdTlYPUfjTWqsB/CjqXDWTTYzv2TsG5Sx9lo53a3g6oX Cb5QkWg3ZhW3gxmWE0G5LzplCGUMQNBJUkvXq5YQOD0WeuaBjEzmOFOWakRIDKekDal+ ExNic8KGS+hyMxpkWzew18RHMKW3ZDRqov27fQqNKCs91QxNznkJgoAWCtoPZi7ZqNnj SkCQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=jRQqcoJ/abor/HzKWzFeCx+0YUB34os0T5TJVweUyyA=; b=sNFHQkshz9eyQhxQuvEXzMJqCiFSK6rBp/64YwQQ8kezxw7NiHEZb7vm/nXWSCo5kO 2JNdUgfdnJHo1jxkWZQpzCGNPsNlK9qrifhfZ/OVR5hgQa05QtdU8RBK2+cPD5palN59 qJeiDmDytTAJyjHDZrjSMpqaKiLWboAOIphDe+bhgUv6jOKpDnque6RP8TPlglgei8k8 bPtXJUaz9JcxiMRTAcN0zaQgztsF8XUZHv1fFBF7pJ4V7HJk56ajciPhAo/7KVALdiDk 7DcGTdWrJ4UH9vaSAnjVRyRrHIksEpnpKKpd5t8yKtY8+R9UjfCaNIXuETCUfdyA1i+b niiQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="qLFw5H/g"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id mc10-20020a170906eb4a00b00767e24156dbsi24237812ejb.256.2022.10.24.05.43.46; Mon, 24 Oct 2022 05:44:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="qLFw5H/g"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234711AbiJXMfq (ORCPT + 99 others); Mon, 24 Oct 2022 08:35:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53824 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234269AbiJXM3y (ORCPT ); Mon, 24 Oct 2022 08:29:54 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 524B7CE16; Mon, 24 Oct 2022 05:03:51 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 6CA10B8118A; Mon, 24 Oct 2022 12:01:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BB52DC433C1; Mon, 24 Oct 2022 12:01:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612870; bh=pMoeHjQy/ObZ8+wueUd63+e+HB70jsgojMHn/4MTjLQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qLFw5H/gNC8HsFyt409AxqOunqP7Vj7NI2YnHCxyqOEDxui1+qw2tLohJ906PSZse PodRr9x/wfrvu1OZPIMvNqs89Y6oK0t3lmriFbWI+rQ1vi4e7aaRjpJJNbWCDmeJoF T4BHOKGAJ6jPxklOIr3sln2y8+QAb/ZbSgWt2eoI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?utf-8?q?Nuno_S=C3=A1?= , Jonathan Cameron , Sasha Levin Subject: [PATCH 4.19 119/229] iio: inkern: only release the device node when done with it Date: Mon, 24 Oct 2022 13:30:38 +0200 Message-Id: <20221024113002.840760071@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747572964594506269?= X-GMAIL-MSGID: =?utf-8?q?1747572964594506269?= From: Nuno Sá [ Upstream commit 79c3e84874c7d14f04ad58313b64955a0d2e9437 ] 'of_node_put()' can potentially release the memory pointed to by 'iiospec.np' which would leave us with an invalid pointer (and we would still pass it in 'of_xlate()'). Note that it is not guaranteed for the of_node lifespan to be attached to the device (to which is attached) lifespan so that there is (even though very unlikely) the possibility for the node to be freed while the device is still around. Thus, as there are indeed some of_xlate users which do access the node, a race is indeed possible. As such, we can only release the node after we are done with it. Fixes: 17d82b47a215d ("iio: Add OF support") Signed-off-by: Nuno Sá Link: https://lore.kernel.org/r/20220715122903.332535-2-nuno.sa@analog.com Signed-off-by: Jonathan Cameron Signed-off-by: Sasha Levin --- drivers/iio/inkern.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/iio/inkern.c b/drivers/iio/inkern.c index a8ccc6e5a773..5108b0504616 100644 --- a/drivers/iio/inkern.c +++ b/drivers/iio/inkern.c @@ -139,9 +139,10 @@ static int __of_iio_channel_get(struct iio_channel *channel, idev = bus_find_device(&iio_bus_type, NULL, iiospec.np, iio_dev_node_match); - of_node_put(iiospec.np); - if (idev == NULL) + if (idev == NULL) { + of_node_put(iiospec.np); return -EPROBE_DEFER; + } indio_dev = dev_to_iio_dev(idev); channel->indio_dev = indio_dev; @@ -149,6 +150,7 @@ static int __of_iio_channel_get(struct iio_channel *channel, index = indio_dev->info->of_xlate(indio_dev, &iiospec); else index = __of_iio_simple_xlate(indio_dev, &iiospec); + of_node_put(iiospec.np); if (index < 0) goto err_put; channel->channel = &indio_dev->channels[index]; From patchwork Mon Oct 24 11:30:39 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8746 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp428498wru; Mon, 24 Oct 2022 05:36:09 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5/ZGVzP+KARSlpi/nYVEdDbv9fTY+Dva7LMryxzjq1C+y5157qd+lhlGrvDbHkWddShvmM X-Received: by 2002:a63:231a:0:b0:46b:208f:1e57 with SMTP id j26-20020a63231a000000b0046b208f1e57mr28758195pgj.57.1666614969416; Mon, 24 Oct 2022 05:36:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666614969; cv=none; d=google.com; s=arc-20160816; b=JlJUl0fRn/0udO4WQglMzbXdoS3ajAQGhZ2+IcS88E9bqOsj7VBjLdJk0WMpmcFAx3 MbupKo0VNIT6/VuEKlOLe4xRzs/VyLGf8sB4F189BUfwgdG2NxW1hi9VDXebiTLZ5Lr6 jSFhJt5xZT/spJtaWNo6MVkcRpzOUtNeNqA0rQu3ymejETVvOT4F6Y+8vUNm1vLM+8Zs mv660Rt/0op57nt7nGgUpSVkogHUbB90FhJrmafKTPpnLYBqZpvheb0O7JR4ZCHNoa1C juYUr0jm4scG6fR3Cfjp8cifYhA49uLXOjesmaskGYguhx7zpkmbQJ/U8cwUb+KHoGXP 52kQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=ER7BHITvJYSt+AyDrY9NvVv9dukPpEAUMVk7g7r9V9c=; b=cvrsINAoYV3CwUUem4B/bzwLPEGGMbTrhGPBmD8xeuau+Rz8+4g0cYLKfv+kc8B/wk qkXYPu76cQjIvzn+payJQH1gbEasoKLHsQbrO22THwD2VIwkDSD2JaycIU6qCQBuxIyo UrslvrSyYbgcS68mvK1jeyvh0T89kb9o4h66zPElW+Na7lD56UsnxKcf00rInnSrI8fY PfkTZNjwwN7reJfLGBybruMXqsVuXqI6L12TBU8E+abx0qaK8nnmA2/QNSRpGhAV3yv+ ZdBiCXhUQP+yA/pCwjZuEnAttzNkgYlEgFMQw0xvQxrsn0PhEIYxoC5Q1otCheUlUY7g WAjA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ei4AtaPP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s3-20020a170902ea0300b001853a1fddecsi38591710plg.403.2022.10.24.05.35.52; Mon, 24 Oct 2022 05:36:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ei4AtaPP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232217AbiJXM1Q (ORCPT + 99 others); Mon, 24 Oct 2022 08:27:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60582 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233646AbiJXM0x (ORCPT ); Mon, 24 Oct 2022 08:26:53 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8AD3E84E4C; Mon, 24 Oct 2022 05:01:13 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 4AFF5612BF; Mon, 24 Oct 2022 12:01:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5E226C433C1; Mon, 24 Oct 2022 12:01:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612872; bh=C7+Ev6SgoiFy8ajpdhEamzJUDUVnvFaY7VWBk0LSXQU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ei4AtaPPdjJhZChkt54jCqFwm+x26jF4QyouIgTuDRlWe9OmFJymR63tC3Adt3cwo cXvR4RadhLoifqlCx1thGVi28Vo+onG51jeWzdKay/owGxEynx7Wcu22TtATw9Ctkb Idv9m6fh8MK6VAQTNvxGFBkzbpCA5yeKhPqXOOl4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jonathan Cameron , Andy Shevchenko , Sasha Levin Subject: [PATCH 4.19 120/229] iio: ABI: Fix wrong format of differential capacitance channel ABI. Date: Mon, 24 Oct 2022 13:30:39 +0200 Message-Id: <20221024113002.874732586@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747572458514037519?= X-GMAIL-MSGID: =?utf-8?q?1747572458514037519?= From: Jonathan Cameron [ Upstream commit 1efc41035f1841acf0af2bab153158e27ce94f10 ] in_ only occurs once in these attributes. Fixes: 0baf29d658c7 ("staging:iio:documentation Add abi docs for capacitance adcs.") Signed-off-by: Jonathan Cameron Reviewed-by: Andy Shevchenko Link: https://lore.kernel.org/r/20220626122938.582107-3-jic23@kernel.org Signed-off-by: Sasha Levin --- Documentation/ABI/testing/sysfs-bus-iio | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Documentation/ABI/testing/sysfs-bus-iio b/Documentation/ABI/testing/sysfs-bus-iio index d10bcca6c3fb..b3adbb33a868 100644 --- a/Documentation/ABI/testing/sysfs-bus-iio +++ b/Documentation/ABI/testing/sysfs-bus-iio @@ -135,7 +135,7 @@ Description: Raw capacitance measurement from channel Y. Units after application of scale and offset are nanofarads. -What: /sys/.../iio:deviceX/in_capacitanceY-in_capacitanceZ_raw +What: /sys/.../iio:deviceX/in_capacitanceY-capacitanceZ_raw KernelVersion: 3.2 Contact: linux-iio@vger.kernel.org Description: From patchwork Mon Oct 24 11:30:40 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 10284 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp653248wru; Mon, 24 Oct 2022 14:09:24 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7u7q/mCyf3Pclv8qQ8EfehDkt6TfOlGCduayMRNOLzkfkis8AgJsptDGnngKi0KkjZV9hx X-Received: by 2002:a05:6402:2686:b0:45d:82c0:c2b6 with SMTP id w6-20020a056402268600b0045d82c0c2b6mr31643429edd.390.1666645764018; Mon, 24 Oct 2022 14:09:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666645764; cv=none; d=google.com; s=arc-20160816; b=Iz/dgqxss9cQfGtdmDAd2oTScDcmU/GxOQnhTnm3Sp1qmy34LwBVRmzslZ4jYgSrMl iRkVeBViuId8qPAeatCi3xKe+IDBCUiuR7OUwDZrmjC0Py8P25Q7a1yLZ+YEsDXufTgS 1eZn/RNoj8GWeEwUtsxrd0I8Ix8MPnp2GzplIu2J5JK7Ou/9Nu1wWzdnorukNbuo1CjZ wz/So04sTrMGPLLtgZHgNdBB1JzLpJESMryQJG2vYqbL0nGIzbWny7Adl5XMknQ/0LGo SE04/XzKfvp630qK6vPmA3sq82brF1lalkZjNEuI5YBxU9ev2bFuqzNlFYIXu8McFfPn 04ZA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=HMAPptS1OVr021ziaCM9TJZAbL1YlJYFQPeaByQn3g8=; b=Un1p+oinXTHB+mEc0I3By659HXmT1ImoFk91PX0VvPMBLWbBvcolh/h1VEnvGbnHmY 5p1TA2+YLseyKDWI67SmD0t3l/v4r1RTFDdzes6Ub8avEKd7arAmO8dMG11KQrt/Y3gM j0v2/kOg+Z77GmFuoNiEnCs6o7G921+JPDqHl9ndUSnOff7+Qg+oCSjAMcg5781wpphz kaWCZt8SNfQlhpznYkF+qqze7wmscH3PHRrNpA//PTQ2aWsKXNrMHmzO0BMGtpCt+E1F peEcMFt5/IjcbjPlatHPjoVkqaBE9V/2aaZbBT78GUCH9vZ+MLY0rO6GbYBy7IlVBnv8 p/Tw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=FW2icNry; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id tl25-20020a170907c31900b007309eb6dcbfsi716496ejc.372.2022.10.24.14.08.59; Mon, 24 Oct 2022 14:09:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=FW2icNry; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235161AbiJXUwf (ORCPT + 99 others); Mon, 24 Oct 2022 16:52:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44554 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235158AbiJXUv7 (ORCPT ); Mon, 24 Oct 2022 16:51:59 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 30E806D84C; Mon, 24 Oct 2022 11:58:45 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id D8F7D6125A; Mon, 24 Oct 2022 12:01:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F0537C433D6; Mon, 24 Oct 2022 12:01:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612875; bh=JQ1YhggFy28azsY8urVLO5ERLFM3p0+gWjXW8vwNE0I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FW2icNrybvPuk32RgZfs9DiGAGy4skpoIxkyGC94whg/EGAImrtFycTUH9KrU7BZE r9Gggxubsjiq2gNBOGUb6ik38qa2sPjeqmNhSoK+623TMFe2+epkYuipET2ppApaw4 EREr3onGw71vGhFirub+oWtIkWBa+rqXhi1gTESA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Liang He , Stephen Boyd , Sasha Levin Subject: [PATCH 4.19 121/229] clk: oxnas: Hold reference returned by of_get_parent() Date: Mon, 24 Oct 2022 13:30:40 +0200 Message-Id: <20221024113002.910201690@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747604748305083034?= X-GMAIL-MSGID: =?utf-8?q?1747604748305083034?= From: Liang He [ Upstream commit 1d6aa08c54cd0e005210ab8e3b1e92ede70f8a4f ] In oxnas_stdclk_probe(), we need to hold the reference returned by of_get_parent() and use it to call of_node_put() for refcount balance. Fixes: 0bbd72b4c64f ("clk: Add Oxford Semiconductor OXNAS Standard Clocks") Signed-off-by: Liang He Link: https://lore.kernel.org/r/20220628143155.170550-1-windhl@126.com Signed-off-by: Stephen Boyd Signed-off-by: Sasha Levin --- drivers/clk/clk-oxnas.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/clk/clk-oxnas.c b/drivers/clk/clk-oxnas.c index e51e0023fc6e..a92bf71f03ac 100644 --- a/drivers/clk/clk-oxnas.c +++ b/drivers/clk/clk-oxnas.c @@ -218,7 +218,7 @@ static const struct of_device_id oxnas_stdclk_dt_ids[] = { static int oxnas_stdclk_probe(struct platform_device *pdev) { - struct device_node *np = pdev->dev.of_node; + struct device_node *np = pdev->dev.of_node, *parent_np; const struct oxnas_stdclk_data *data; const struct of_device_id *id; struct regmap *regmap; @@ -230,7 +230,9 @@ static int oxnas_stdclk_probe(struct platform_device *pdev) return -ENODEV; data = id->data; - regmap = syscon_node_to_regmap(of_get_parent(np)); + parent_np = of_get_parent(np); + regmap = syscon_node_to_regmap(parent_np); + of_node_put(parent_np); if (IS_ERR(regmap)) { dev_err(&pdev->dev, "failed to have parent regmap\n"); return PTR_ERR(regmap); From patchwork Mon Oct 24 11:30:41 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8753 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp430314wru; Mon, 24 Oct 2022 05:41:14 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5jOj9nLm4jd99GT1CzshMf5koIf3Dz0MNWx2wx62HCJrj9FMuxmvFyk0UV7FbR1ks/VKp5 X-Received: by 2002:a17:907:3d91:b0:78e:11cc:3bc7 with SMTP id he17-20020a1709073d9100b0078e11cc3bc7mr27557097ejc.655.1666615273866; Mon, 24 Oct 2022 05:41:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666615273; cv=none; d=google.com; s=arc-20160816; b=JETfIqdzAoLI/looODLyjDG74xRsg6Yc6+9G8HFM0cfFQ+GrItJLVhvao8G0fkJY/D d2dqDhp5S6Sjk4BA4hAS3Y4KG0XfIHhaA2I5vN5q3g6dgYFrSQD88K1b3jCDQnE8qm4N ByflnWSGiQHH9rYDs0lesx+Lz3bYLX5AteLjnT5CNaLYp5MD9RTPTjvEKKqXedkx1LTa 92J3LHxqa6qt1e9NtDekJ23DR1bDTycLKTonyp32Hi8AeKAvR3L92N+suwNU5kwDtrpM xUqtDtIjMUm89H18FYVW8+Vg3EwWtr0Zsj+amiA/fk9zR3bJdoGBHc/YgyWvj1CeT9lO ZdIg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=bnS6BiI5il66Xexz0jy8Zd0CildFeJq+jLa/TMhcsSg=; b=CPDWIGt7NHyHc3shsB5vVDU7Fy2TVk1beHGnrKoQN9Hnqk08kpdty3bL8ZHESPAkqI o4DxIrZPx1ktfKBMGL6s8Z8qxCzfe6A7X3exqMO4EhPqkHO2fNIzNEO983agrFBjNYX7 lb1K4KYufEg2GX9YXap2KYMioyKHayC2ShfXvU9JuU3tSjqEJo6x1T5sc4xan7KDIfIz mZNHN9It8Vm9dFTwJNJORWkzv+yLtCZR+dosB8DuwTRKDLkidUXUSunE2JbWIpvVWEdl PiDpkf1EihwNQgdGpQx35tf6yRUKPTqpY7PC+AtEsLX4OfLvgDeEh2/jORanqOwRkZlQ OlDQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=bMTjAO+n; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q26-20020a056402249a00b00461dfe5f99bsi1582662eda.298.2022.10.24.05.40.41; Mon, 24 Oct 2022 05:41:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=bMTjAO+n; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233817AbiJXM2U (ORCPT + 99 others); Mon, 24 Oct 2022 08:28:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60592 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230472AbiJXM1J (ORCPT ); Mon, 24 Oct 2022 08:27:09 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 16470237E2; Mon, 24 Oct 2022 05:01:18 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 8415C612D2; Mon, 24 Oct 2022 12:01:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 94550C433D6; Mon, 24 Oct 2022 12:01:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612877; bh=2JKLRDy2+cZZ2o+s2K3b+kNs0R+1VkWPx5B+2IXlEkM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bMTjAO+nKBxeUEfypVxXfBsY9FpipfFhHx+F/85afysRH9kmloGeywmvQEHWQOqKw PCW18vUUCwUDm31y27R4408DiSVCVRWJSzuLqKAGfRk6e5T9sb6bwoqh3lvvoElNny D5wxeeEe2dJZaMnst3Qmu5ty6YnDnTDdm2BsEyYE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Liang He , Stephen Boyd , Sasha Levin Subject: [PATCH 4.19 122/229] clk: berlin: Add of_node_put() for of_get_parent() Date: Mon, 24 Oct 2022 13:30:41 +0200 Message-Id: <20221024113002.943563849@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747572777355056227?= X-GMAIL-MSGID: =?utf-8?q?1747572777355056227?= From: Liang He [ Upstream commit 37c381b812dcbfde9c3f1f3d3e75fdfc1b40d5bc ] In berlin2_clock_setup() and berlin2q_clock_setup(), we need to call of_node_put() for the reference returned by of_get_parent() which has increased the refcount. We should call *_put() in fail path or when it is not used anymore. Fixes: 26b3b6b959b2 ("clk: berlin: prepare simple-mfd conversion") Signed-off-by: Liang He Link: https://lore.kernel.org/r/20220708084900.311684-1-windhl@126.com Signed-off-by: Stephen Boyd Signed-off-by: Sasha Levin --- drivers/clk/berlin/bg2.c | 5 ++++- drivers/clk/berlin/bg2q.c | 6 +++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/drivers/clk/berlin/bg2.c b/drivers/clk/berlin/bg2.c index 0b4b44a2579e..6efc3e02da47 100644 --- a/drivers/clk/berlin/bg2.c +++ b/drivers/clk/berlin/bg2.c @@ -499,12 +499,15 @@ static void __init berlin2_clock_setup(struct device_node *np) int n, ret; clk_data = kzalloc(struct_size(clk_data, hws, MAX_CLKS), GFP_KERNEL); - if (!clk_data) + if (!clk_data) { + of_node_put(parent_np); return; + } clk_data->num = MAX_CLKS; hws = clk_data->hws; gbase = of_iomap(parent_np, 0); + of_node_put(parent_np); if (!gbase) return; diff --git a/drivers/clk/berlin/bg2q.c b/drivers/clk/berlin/bg2q.c index 9b9db743df25..5bcd8406ac93 100644 --- a/drivers/clk/berlin/bg2q.c +++ b/drivers/clk/berlin/bg2q.c @@ -285,19 +285,23 @@ static void __init berlin2q_clock_setup(struct device_node *np) int n, ret; clk_data = kzalloc(struct_size(clk_data, hws, MAX_CLKS), GFP_KERNEL); - if (!clk_data) + if (!clk_data) { + of_node_put(parent_np); return; + } clk_data->num = MAX_CLKS; hws = clk_data->hws; gbase = of_iomap(parent_np, 0); if (!gbase) { + of_node_put(parent_np); pr_err("%pOF: Unable to map global base\n", np); return; } /* BG2Q CPU PLL is not part of global registers */ cpupll_base = of_iomap(parent_np, 1); + of_node_put(parent_np); if (!cpupll_base) { pr_err("%pOF: Unable to map cpupll base\n", np); iounmap(gbase); From patchwork Mon Oct 24 11:30:42 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9853 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp559084wru; Mon, 24 Oct 2022 10:05:51 -0700 (PDT) X-Google-Smtp-Source: AMsMyM42lEiHx9iJp0gHd+A3/MMz0cd0ISnQIt2+RX9E6a4HeR0QHYOoaPQ/BZUmdGt9g5xzpS8g X-Received: by 2002:a17:902:ab5d:b0:186:bb2e:85a4 with SMTP id ij29-20020a170902ab5d00b00186bb2e85a4mr1491100plb.135.1666631151616; Mon, 24 Oct 2022 10:05:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666631151; cv=none; d=google.com; s=arc-20160816; b=U8YjQHI+r4fRdFurng6ZfaqQ5cI/Yo24JtjVuEmF2iItKvNdEOva9t7/40C4fajREM A76LJSMg3AabgYuLUfaoP8PgU1Zx+dvDpdAJG23pgD9oNfbreLo1k9UzJlucPQcfYL6E v46ATdqdx3gqHHI1qyGyxyl7IwssEJ+yGqQ06NBCx3BXG1C8hnerTs5tRG+oFWPxGEs2 7okNMDj+wvSwk4hJWgSU9/XHXE2H62zM9XUAd5oad/VlBDiQmaHnGDCOdYlavEsvvwzU E5Y/IHzlKNn8dpa3CmeHXFAzyvxTh0+uSUyPCd3UyuQTIwg2o0YvNJfi6TYkbwnti1uI LE9Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=2NsVfEzlhvEzi5aHh+iOiinL2WVjERVE94ktO/Gz9TQ=; b=KpXWuYXSVAq7HFWSLENEHbQU8WBk2QNXn/lN0Wkl1mPwTzuxx3+cBuwM5Ucv2kEbGR j+M0vdHdUjDK7W2gZidjdbncADne2QEU4BIR0vkeT30/7t9r3Xhcne2cDDNS/244rB7x BXXzuJGyuFw9WL8ii43Y81UKhtEhLIuk1ht94oloNmn/Ek9ZLIxZq1OhXv0W8w43AN2p d610yDc4nFZhzD/EuoGPxNaL4924fA2Zl/Wf3F5mg0rqd5RdtXmFXs5Bzfyn+9TH9hez 8RSzELDmba0c3wxRcngApv090uN4wEG4Fpk/EP9CRlCrEvaFrkBRAkGAMd8uiH4EC3lK RYkw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=jnbsbeeW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id pm9-20020a17090b3c4900b00213353d1107si348967pjb.172.2022.10.24.10.05.37; Mon, 24 Oct 2022 10:05:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=jnbsbeeW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233038AbiJXRBK (ORCPT + 99 others); Mon, 24 Oct 2022 13:01:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44392 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235108AbiJXQ76 (ORCPT ); Mon, 24 Oct 2022 12:59:58 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5D0BD27CF2; Mon, 24 Oct 2022 08:37:42 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id DA212B8120F; Mon, 24 Oct 2022 12:01:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 370F3C433C1; Mon, 24 Oct 2022 12:01:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612880; bh=cDvYVHixIoAOQLcS7OGG4/vpzoLWK1qd2faZwAFtgv0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jnbsbeeWODvJ4BpxzPUDluBUnm71LTbDkncohmD2HmJynDBrAbMvUVHeRFLgBKdKq 8MT/YExm/hS3OXj2KHUwkWW4J4ZXXQGhXAZi6AGUzigmQ9eaxD8qtO7dvm585I12T3 13JyLTn895JgAPntexl+3pshgZOgxjSTdGnbnqXc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Miaoqian Lin , Stephen Boyd , Sasha Levin Subject: [PATCH 4.19 123/229] clk: tegra: Fix refcount leak in tegra210_clock_init Date: Mon, 24 Oct 2022 13:30:42 +0200 Message-Id: <20221024113002.982592246@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747589426052704254?= X-GMAIL-MSGID: =?utf-8?q?1747589426052704254?= From: Miaoqian Lin [ Upstream commit 56c78cb1f00a9dde8cd762131ce8f4c5eb046fbb ] of_find_matching_node() returns a node pointer with refcount incremented, we should use of_node_put() on it when not need anymore. Add missing of_node_put() to avoid refcount leak. Fixes: 6b301a059eb2 ("clk: tegra: Add support for Tegra210 clocks") Signed-off-by: Miaoqian Lin Link: https://lore.kernel.org/r/20220523142608.65074-1-linmq006@gmail.com Signed-off-by: Stephen Boyd Signed-off-by: Sasha Levin --- drivers/clk/tegra/clk-tegra210.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/clk/tegra/clk-tegra210.c b/drivers/clk/tegra/clk-tegra210.c index 7264e9731034..f97c4b0a9164 100644 --- a/drivers/clk/tegra/clk-tegra210.c +++ b/drivers/clk/tegra/clk-tegra210.c @@ -3529,6 +3529,7 @@ static void __init tegra210_clock_init(struct device_node *np) } pmc_base = of_iomap(node, 0); + of_node_put(node); if (!pmc_base) { pr_err("Can't map pmc registers\n"); WARN_ON(1); From patchwork Mon Oct 24 11:30:43 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 10285 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp653718wru; Mon, 24 Oct 2022 14:10:40 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6V2whKbitRVC7PhgdYPQSToAHYSN1fJHXxp3+1tQjMjauua4GDkdK6suaDEpL/4btN3MKs X-Received: by 2002:aa7:864a:0:b0:53f:dcdf:4614 with SMTP id a10-20020aa7864a000000b0053fdcdf4614mr35781948pfo.38.1666645840140; Mon, 24 Oct 2022 14:10:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666645840; cv=none; d=google.com; s=arc-20160816; b=ETIIdOZEKGByS4rlpecsBkJ8x6UPEcKTquNQcdfU8WASnyUXJwiyWEZ9VFeT37CB/G Wljy1bFxkPzGbqxk+Z3euJiCtl5JJqG8hn0BSadSiToErnIfHDxClFbLw/hl1MkvWs3V JPplVUFNzL1BaYjRGFdwZTW2PYTU8YQMqw4c34fdpH+FYx0YmqCGTSI1KmEA+ux1qICR h0lVTWarexkYvfZbchCOZ90/bhaHhIzV9dCI0tBDM/L64D3Gk2SDvg/FkG/8oVMNPkSZ egCq2nSwtVzLhIz8K/eAIYtVsHDbYLAdM4BpnELfZ8CqcwecxEr00xaFg/MqQJ6weDUy 0ZVA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=ANtJE1VSNF7gSaxBl5fyv7LHdfs3Zw14u9lLMnqOeXU=; b=A7uCVBKXvRptUJH30GBGbAVOZKbbN+xLLJ6QtDUuOGl6LTPie4xNdDB9id60Q4pFFZ v/lu+KVZJ3MmJGyJEmSz1wYPMuqPMywIkKAHrsuMw1e+zi5COpZWDWElGMKuN/x2bCzw W+xeEpWsXXG4lDnXXIf1Gi9Kv+k4VYw9SuxjiJe9tmNAEko6gQphlZ8CLnF7CWOe2bw7 TGQpuDyqmRgnsNgVJomjva6sWh/xAiWmLPpBKXxZa7LnHlRG3aGmO9m2aU/CoREiFUOw OOrkHU0d2rJzyFuqG/c2AvRFuxOb7BJbU53bJEzDkbS8sx7bnifbfHVawtf06NW6TnCC bQIw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=AV8cy3V1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y20-20020a170902ed5400b001729146e418si493551plb.388.2022.10.24.14.10.26; Mon, 24 Oct 2022 14:10:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=AV8cy3V1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235124AbiJXUyx (ORCPT + 99 others); Mon, 24 Oct 2022 16:54:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50196 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235272AbiJXUxw (ORCPT ); Mon, 24 Oct 2022 16:53:52 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B6D8E168E56; Mon, 24 Oct 2022 12:00:31 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id C8BD4612C5; Mon, 24 Oct 2022 12:01:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D9F5EC433C1; Mon, 24 Oct 2022 12:01:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612883; bh=8ggShBhGOJwKpgRbOmOgbcjHdyJf4iISNtbQntcg8Nk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AV8cy3V1Hs9cGE1JEJGidht2aydcztQ4VlriWhXA0Cf86PFJlUJ+JRqyyYvL+cYCs WrJE4KA/ewg88X3KSan6jdIxhTB5QJuCsWeH72mPb4ZkxJFR9KsPUsXPqELjf4vhnz fMJ30HMmjQXlW0Hxsl5epxiBKAwM9yOJYi8geLKE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Miaoqian Lin , Stephen Boyd , Sasha Levin Subject: [PATCH 4.19 124/229] clk: tegra: Fix refcount leak in tegra114_clock_init Date: Mon, 24 Oct 2022 13:30:43 +0200 Message-Id: <20221024113003.018607937@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747604828226001874?= X-GMAIL-MSGID: =?utf-8?q?1747604828226001874?= From: Miaoqian Lin [ Upstream commit db16a80c76ea395766913082b1e3f939dde29b2c ] of_find_matching_node() returns a node pointer with refcount incremented, we should use of_node_put() on it when not need anymore. Add missing of_node_put() to avoid refcount leak. Fixes: 2cb5efefd6f7 ("clk: tegra: Implement clocks for Tegra114") Signed-off-by: Miaoqian Lin Link: https://lore.kernel.org/r/20220523143834.7587-1-linmq006@gmail.com Signed-off-by: Stephen Boyd Signed-off-by: Sasha Levin --- drivers/clk/tegra/clk-tegra114.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/clk/tegra/clk-tegra114.c b/drivers/clk/tegra/clk-tegra114.c index 625d11091330..1e5025c127bd 100644 --- a/drivers/clk/tegra/clk-tegra114.c +++ b/drivers/clk/tegra/clk-tegra114.c @@ -1348,6 +1348,7 @@ static void __init tegra114_clock_init(struct device_node *np) } pmc_base = of_iomap(node, 0); + of_node_put(node); if (!pmc_base) { pr_err("Can't map pmc registers\n"); WARN_ON(1); From patchwork Mon Oct 24 11:30:44 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8745 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp427904wru; Mon, 24 Oct 2022 05:34:55 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7Iivt3t19MEedGGKFCI6G6MUNZ+k2tRMOA37830eR2IGBTW0ZU7YQdWDYhF2RPJ6BwuGRE X-Received: by 2002:a17:907:720e:b0:78e:2b59:fdf1 with SMTP id dr14-20020a170907720e00b0078e2b59fdf1mr28265095ejc.659.1666614806569; Mon, 24 Oct 2022 05:33:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666614806; cv=none; d=google.com; s=arc-20160816; b=IvBVc9l36JNVyFxtigpLg4Jk3GH+cI+w9V2E0Li66dG5a6WmEjUXmLZvG9Z/qBHLL4 K+/cP2jXPPcpN95LYogQhFB5WK+AXzYGrF0H4y0Xe9IWbLZ0I9xph+TKDp5MA2PkRCg1 zwYKMP15yAArkB+l62m8GwniwIIBNfu9QQkNiJf9+P9WG9Qf2SGdxIplxFgTkYF4hKp4 XFXpR8spBMn+xJ3N5ZPNaGw7ndn2NeH3zt3iN6ECBoFbre3ZbEXxg06j/W0pYMbiuLQ5 qeSKtcxC3Vt2us1ozq7hfEFsLuCAYB3vQOVSU2o9tveQNny2Qg36Am+Kjquv2PJZd88P rJGQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=9ZADA7LVhi99Pr0ZXgZLe1Zj1L6K0RecMf1X90kma1Y=; b=bJjtyRglLS6PthjS5IBPJDB+boSntIWCoOl3Fpq56f/I4Fm+YdHQr+m+noSTW+v+va lS5nzMjov5Mlp2KhVQ8fWX841rkM2iSrFa8v6c53cS233WJOEdDm5fhuRufknMT1wQgH s5Ym9WAbwpKfCZm6kFpTYERymnfQxTpKiZdvueVX4uBI0LRZ+lPw27QgEnOGJyVUGFVk Eeof7wdVvuj4WF6w2mt6Fxsj6Cjq/opnyMSF0u+3w7nQfWJX6xkqp6Or0XPPzS6fYR26 EfpoIJ3Vn4AlyE4XIgaMjqrQWxbj3vqv4+SEoOWr2g+3q8oJKw+qzTX58SiTPF6lwwE9 uyIg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=LuEH9Tiz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m22-20020a170906259600b0073ced0e9bb1si25430361ejb.189.2022.10.24.05.32.56; Mon, 24 Oct 2022 05:33:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=LuEH9Tiz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233679AbiJXM1W (ORCPT + 99 others); Mon, 24 Oct 2022 08:27:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60562 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233735AbiJXM0y (ORCPT ); Mon, 24 Oct 2022 08:26:54 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 06BF38558A; Mon, 24 Oct 2022 05:01:15 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id C106961254; Mon, 24 Oct 2022 12:00:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D4497C433C1; Mon, 24 Oct 2022 12:00:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612801; bh=jGqOotVL1qkAVg5bb58qeCDE4j9sfDYzqT21ZmSUues=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LuEH9TizCIAz57LFEi0xaButqh4jV92FDDt8NQ9k/mK1taWmeVwfHhMj/oLlL/YVQ G6sW5FSoLB7kZLdMEursGAJZn9xldyuubRigpzpAraD/IynY4pEd/4/aBdUte3xTMj l98ySm5dMAeRbdA0mSFAl1N1JZtutz9dDvsclHzo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Miaoqian Lin , Stephen Boyd , Sasha Levin Subject: [PATCH 4.19 125/229] clk: tegra20: Fix refcount leak in tegra20_clock_init Date: Mon, 24 Oct 2022 13:30:44 +0200 Message-Id: <20221024113003.050579336@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747572287643216563?= X-GMAIL-MSGID: =?utf-8?q?1747572287643216563?= From: Miaoqian Lin [ Upstream commit 4e343bafe03ff68a62f48f8235cf98f2c685468b ] of_find_matching_node() returns a node pointer with refcount incremented, we should use of_node_put() on it when not need anymore. Add missing of_node_put() to avoid refcount leak. Fixes: 37c26a906527 ("clk: tegra: add clock support for Tegra20") Signed-off-by: Miaoqian Lin Link: https://lore.kernel.org/r/20220523152811.19692-1-linmq006@gmail.com Signed-off-by: Stephen Boyd Signed-off-by: Sasha Levin --- drivers/clk/tegra/clk-tegra20.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/clk/tegra/clk-tegra20.c b/drivers/clk/tegra/clk-tegra20.c index 68551effb5ca..5859b8ee1478 100644 --- a/drivers/clk/tegra/clk-tegra20.c +++ b/drivers/clk/tegra/clk-tegra20.c @@ -1152,6 +1152,7 @@ static void __init tegra20_clock_init(struct device_node *np) } pmc_base = of_iomap(node, 0); + of_node_put(node); if (!pmc_base) { pr_err("Can't map pmc registers\n"); BUG(); From patchwork Mon Oct 24 11:30:45 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9856 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp559170wru; Mon, 24 Oct 2022 10:06:02 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5BY9WEZeziZIH+f+WDorify4Hzij/tOG65dxeOvGMYysMccDDq0kySlycC2vNVSDlcmh6g X-Received: by 2002:a63:80c7:0:b0:46e:c7be:b56f with SMTP id j190-20020a6380c7000000b0046ec7beb56fmr13384743pgd.382.1666631161820; Mon, 24 Oct 2022 10:06:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666631161; cv=none; d=google.com; s=arc-20160816; b=xHzEDpPykMrrjUA1lbGKmqfERkWaMiTRtZ3fF7qSlFBPR0ZMe6ax/FwDo+ql9yF1dr v3EkMypkqgZ/ikBmGah86xttU8vAwo9NWsjqNfIDzyjvEv66pMEYiA/Jy8lZpB5RalVM YGWmfxFQfGGFPHaDgBNvDpqMPpKKKWH+WdWuzilVskeqkYNPZ0bvINNz2yJlQPOaTXUz u1k+zrUdRpcfljciOIf9RJC5fvTqn2IV1OlhDRavxXJQIdAb+rfa23LX6oVI+42xavbA nkZvt2qqhgbRHtyy13lpccx7IEnZg3K5/ZtCJgoLutUUYNfHK3BFwDy6Zm8kINTdPEdw LczQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=MygECGpZxrjTPFOXjY3DcVfhnAFDCTsr1lJBGOWmg7o=; b=WfN3gVtiLJUmIGyXKcIz8jjAV2gb+To/s/Gn5YIv5k6YIHPCVC4VBuIf2wSQ81BuKW iG7mFfE3S+/NLhtbjX29vXfaPmJ8XJErzTArqyaoakVqm2Z4joCmV+HQlCzUcpfAIuTv QL9TR8AH4hwrp/2IOd4D5mak6yYkPO6OyXHmfNFMLV+UrOm6agd+vNXkFj7jM9t3WZ2L UzwpiY4mHfOE6icF0xHgNchU6y7r1jnHYBFd6rXr2FX9o5kKvWyvul5MokohRQfT+1vU yVzGKiof71J5chjms7z66Fomoo25b84swo2DRHXDtO8MFHpY4OYTNSF8JaRFGwhvBwBU /dmA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=B4ZFXv4l; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id qe5-20020a17090b4f8500b00212e24a499csi535130pjb.26.2022.10.24.10.05.47; Mon, 24 Oct 2022 10:06:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=B4ZFXv4l; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233227AbiJXRCx (ORCPT + 99 others); Mon, 24 Oct 2022 13:02:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47046 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233538AbiJXRCX (ORCPT ); Mon, 24 Oct 2022 13:02:23 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E4E38160852; Mon, 24 Oct 2022 08:38:57 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 1B905B81204; Mon, 24 Oct 2022 12:00:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 78D25C433C1; Mon, 24 Oct 2022 12:00:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612803; bh=p9732RSsGgZuE0sVRNVEJIAFnxTmYtgxzpoRqKThgks=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=B4ZFXv4l6qP/CqSXW0KWC1Lp4Dtk7/1A24vWMCay2ybyQg4bS6k8rItTt7vzeVMGQ w6HXwr218B1O20XRN3fB0/DVwRIB9SZHSq0+2w+BlVsX9jAuCK23T4QZIWyhFC/01H 3La/j/WzdcNir0mCIFMduPUW0RPb4qk3wk/clAiQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Miaoqian Lin , Sebastian Reichel , Sasha Levin Subject: [PATCH 4.19 126/229] HSI: omap_ssi: Fix refcount leak in ssi_probe Date: Mon, 24 Oct 2022 13:30:45 +0200 Message-Id: <20221024113003.079294681@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747589436800642892?= X-GMAIL-MSGID: =?utf-8?q?1747589436800642892?= From: Miaoqian Lin [ Upstream commit 9a2ea132df860177b33c9fd421b26c4e9a0a9396 ] When returning or breaking early from a for_each_available_child_of_node() loop, we need to explicitly call of_node_put() on the child node to possibly release the node. Fixes: b209e047bc74 ("HSI: Introduce OMAP SSI driver") Signed-off-by: Miaoqian Lin Signed-off-by: Sebastian Reichel Signed-off-by: Sasha Levin --- drivers/hsi/controllers/omap_ssi_core.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/hsi/controllers/omap_ssi_core.c b/drivers/hsi/controllers/omap_ssi_core.c index 129c5e6bc654..15ecc4bc8de6 100644 --- a/drivers/hsi/controllers/omap_ssi_core.c +++ b/drivers/hsi/controllers/omap_ssi_core.c @@ -560,6 +560,7 @@ static int ssi_probe(struct platform_device *pd) if (!childpdev) { err = -ENODEV; dev_err(&pd->dev, "failed to create ssi controller port\n"); + of_node_put(child); goto out3; } } From patchwork Mon Oct 24 11:30:46 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8794 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp430841wru; Mon, 24 Oct 2022 05:42:22 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6cebCX/HlvlPYIBLyWuY/0p1HymSu+7tVXQVw/Kb6hhHZj48olYxVYdbRJ3ny0rCsyBQt6 X-Received: by 2002:a05:6402:b99:b0:461:afc3:9a02 with SMTP id cf25-20020a0564020b9900b00461afc39a02mr6610727edb.175.1666615341920; Mon, 24 Oct 2022 05:42:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666615341; cv=none; d=google.com; s=arc-20160816; b=fp2UJ5YxwwLMD4HXPjPpwjoTeGdj/cAMV997/lbe1LBQY3/6XNg8Kc3HSMwrXVfGd0 SgCwVI4MH7WwBNR2aWUn+dQXcMwrg4zvD6Y0WqTG1T7O1rbAr5Iv+WwoI5UsGKgrG3CW uZpPOHgDGXa7sothyyE51BPPd1h44BIueh9jne66GCfReQV/YaXJW4D8fMO+Qi4W8dUm UScIAj4raFGp0wBBp4LJnK6TxcYFCTNORGKOfexG4WPBjGzvdNScYo+mi2eroVPJ4Hnc yv6j3tDw3vkmmGl9FoE/TkYTuQRvJGVgkHhv8yEq0QBrigmuXoJ45qCvPGX9qvwKjJJm SuNQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Ff1oMQ7KcOOLNThuh2l38zYh6wPTXaQMaqYEYxdDKoI=; b=dQE1Ckt3flNsmAzNq2PQE8nSJ4jlrXTZEjo+4ohfLF4biOycCDNj1kFVHjFEqlIcar z8TMjmDxLJrWZTBEzwgoutkz1Zt4nsYUGawjbj18XWWvU3srePh66m0JeMern9BmD+aU IxPwVdVuosk8jCZ0SH2m5/X0j36y3e/61oz6YQMFcw4NN9/hrEbt2cmD/a4gWyMl7hwv 643ZgFZqq71ILXf+egCLH56dVEELHWvOJ7NAb04I745Rj9FCp3EmuXHKGDQYB+MWFzSs DrI4ZmRRjhS0/HSsMjRylbuffGYp8KpGZAkT0YFXaFdm3DI6lX2g2po+98RAAXrEVh+C yo0A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=DiSsIok9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m24-20020a50ef18000000b004615b657cbcsi7448731eds.190.2022.10.24.05.41.55; Mon, 24 Oct 2022 05:42:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=DiSsIok9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234043AbiJXMc5 (ORCPT + 99 others); Mon, 24 Oct 2022 08:32:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60540 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234003AbiJXM3K (ORCPT ); Mon, 24 Oct 2022 08:29:10 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7BDA5876A0; Mon, 24 Oct 2022 05:03:01 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id C1F2DB811F8; Mon, 24 Oct 2022 12:00:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 203EFC433C1; Mon, 24 Oct 2022 12:00:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612806; bh=GehjbJHBXOzgVNA6DOTPtzJcRKMuOSCjvnVq1+rQcqM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DiSsIok9fjKn1EeXgu9sn5L/Nv3dZlfIIk/nEwr2CGB1d10s/Zv24qm5Cnqd25JAq YbD/jy6RzTySqFlWroEmzIK8lgjFRXZCGeYrxsHw/6UZD1z1hDjhlmAxg0+gIWIa25 vDkxawgExfxUndKFz1Ix1lVudxWrsVthd6XTl6ic= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sebastian Reichel , Jack Wang , Sebastian Reichel , Sasha Levin Subject: [PATCH 4.19 127/229] HSI: omap_ssi_port: Fix dma_map_sg error check Date: Mon, 24 Oct 2022 13:30:46 +0200 Message-Id: <20221024113003.109588084@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747572848864801213?= X-GMAIL-MSGID: =?utf-8?q?1747572848864801213?= From: Jack Wang [ Upstream commit 551e325bbd3fb8b5a686ac1e6cf76e5641461cf2 ] dma_map_sg return 0 on error, in case of error return -EIO to caller. Cc: Sebastian Reichel Cc: linux-kernel@vger.kernel.org (open list) Fixes: b209e047bc74 ("HSI: Introduce OMAP SSI driver") Signed-off-by: Jack Wang Signed-off-by: Sebastian Reichel Signed-off-by: Sasha Levin --- drivers/hsi/controllers/omap_ssi_port.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/hsi/controllers/omap_ssi_port.c b/drivers/hsi/controllers/omap_ssi_port.c index 2ada82d2ec8c..e6149fd43b62 100644 --- a/drivers/hsi/controllers/omap_ssi_port.c +++ b/drivers/hsi/controllers/omap_ssi_port.c @@ -253,10 +253,10 @@ static int ssi_start_dma(struct hsi_msg *msg, int lch) if (msg->ttype == HSI_MSG_READ) { err = dma_map_sg(&ssi->device, msg->sgt.sgl, msg->sgt.nents, DMA_FROM_DEVICE); - if (err < 0) { + if (!err) { dev_dbg(&ssi->device, "DMA map SG failed !\n"); pm_runtime_put_autosuspend(omap_port->pdev); - return err; + return -EIO; } csdp = SSI_DST_BURST_4x32_BIT | SSI_DST_MEMORY_PORT | SSI_SRC_SINGLE_ACCESS0 | SSI_SRC_PERIPHERAL_PORT | @@ -270,10 +270,10 @@ static int ssi_start_dma(struct hsi_msg *msg, int lch) } else { err = dma_map_sg(&ssi->device, msg->sgt.sgl, msg->sgt.nents, DMA_TO_DEVICE); - if (err < 0) { + if (!err) { dev_dbg(&ssi->device, "DMA map SG failed !\n"); pm_runtime_put_autosuspend(omap_port->pdev); - return err; + return -EIO; } csdp = SSI_SRC_BURST_4x32_BIT | SSI_SRC_MEMORY_PORT | SSI_DST_SINGLE_ACCESS0 | SSI_DST_PERIPHERAL_PORT | From patchwork Mon Oct 24 11:30:47 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8800 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp430901wru; Mon, 24 Oct 2022 05:42:30 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6jcSucWXZffQeo0BRmIjkDr5YBvmcTNqsGWHRALtxx+Y5kHzS4PaYPiWfWZmVMqmIiaEg+ X-Received: by 2002:a17:906:4fcb:b0:791:9a26:376f with SMTP id i11-20020a1709064fcb00b007919a26376fmr27492296ejw.431.1666615339639; Mon, 24 Oct 2022 05:42:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666615339; cv=none; d=google.com; s=arc-20160816; b=hrZd1NHtv4k6tor9FXs51QCQ3r74sgzy3JkURA8f9pQPLx7DW65CGQrAdDn4XwWdyP QUannFKZ2q4yeuf+wGvu01edc5+ihSvxPaOfFA49VZFkgpRIBXOpEE9Z1bUegtQMsDN3 pKnQ+QJIvrZKWhodM+hcieGbzcVja07gmxlB/DykYr9o0FoYAIQ4LXsTvB3B79iBO0Qt n9K3rI26TILIvWF6DV1oDxoEtUWtxUZYaeXZRMPto6L0YT5ci6Fn6AFL/9plU0OEzfKu O5/mR8Tgs+b0ulUAVq2HHdboshXjHkJqxfz9hQPcWZprgpGwxG+2ftWw0XGVLkZ/jP6N Bqwg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Lc9ofEiR9m3b8fsinSHyN+EfZUaecut0dTHXtVdUmFg=; b=GhsATi+cJGVmke/gcQSyFHXaclmyg3Xhy9R0RFV4maGVtgQumWyAMYOY+kXPD+YPF2 5OL+2v2bzLDnsErDW9sFnHgcOFiKCxyB1bxzH61DcuB3OhQEw6ASW6Kct9tfAXgSXDZt nfqnI+AUdeYzk9ZnVAgDTRTB3l6mgP2efe/de6AurfT+OaPW3FDjoa+4cghj6Biv1M6V qmqfq3aM7ENYDQNtLm2BNBYaZyf9vhkL32B5AXwxOK+Tr6/ehGWQthCacIwOS9WQ1thn f2L/tQIy0jiDpU+7rAP4nFWVC1E/m4RyCz/Rlbw+Bh8YIaTWEUlu8gNW9Osa02IUq7g2 DeJw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=WVqE6JYZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n14-20020aa7c78e000000b00458ee128628si23638722eds.470.2022.10.24.05.41.54; Mon, 24 Oct 2022 05:42:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=WVqE6JYZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233776AbiJXMba (ORCPT + 99 others); Mon, 24 Oct 2022 08:31:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34836 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233913AbiJXM2j (ORCPT ); Mon, 24 Oct 2022 08:28:39 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0D6F586833; Mon, 24 Oct 2022 05:02:15 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id A966961252; Mon, 24 Oct 2022 12:00:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BD10EC433C1; Mon, 24 Oct 2022 12:00:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612809; bh=YqqfBLDCHIre+JSjFqMR5fczi5ijx+iG1FyyUcTV2kg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WVqE6JYZYPPIuk9mUKlyFomUtVMjtR+rmUaZFUlWW5/XJM296uDYLNfwCN9UKQeR9 PTptuqLZU6xmzWfYUGfiOV/qAG6+MUb+SAPT1ABczbhEQQbFHhdcA/+Ld3pPVAAsCc QSx53sl2qifZ+0w0Lk7mrDKRz7tcttaV3ljiIW/M= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Liang He , Hans Verkuil , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 4.19 128/229] media: exynos4-is: fimc-is: Add of_node_put() when breaking out of loop Date: Mon, 24 Oct 2022 13:30:47 +0200 Message-Id: <20221024113003.147757617@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747572846731295389?= X-GMAIL-MSGID: =?utf-8?q?1747572846731295389?= From: Liang He [ Upstream commit 211f8304fa21aaedc2c247f0c9d6c7f1aaa61ad7 ] In fimc_is_register_subdevs(), we need to call of_node_put() for the reference 'i2c_bus' when breaking out of the for_each_compatible_node() which has increased the refcount. Fixes: 9a761e436843 ("[media] exynos4-is: Add Exynos4x12 FIMC-IS driver") Signed-off-by: Liang He Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin --- drivers/media/platform/exynos4-is/fimc-is.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/media/platform/exynos4-is/fimc-is.c b/drivers/media/platform/exynos4-is/fimc-is.c index 0f3f82bd4d20..6f59fe02c727 100644 --- a/drivers/media/platform/exynos4-is/fimc-is.c +++ b/drivers/media/platform/exynos4-is/fimc-is.c @@ -217,6 +217,7 @@ static int fimc_is_register_subdevs(struct fimc_is *is) if (ret < 0 || index >= FIMC_IS_SENSORS_NUM) { of_node_put(child); + of_node_put(i2c_bus); return ret; } index++; From patchwork Mon Oct 24 11:30:48 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8850 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp432932wru; Mon, 24 Oct 2022 05:48:06 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7lkumREUE1bopTJKfJr9ay2zcKB5OUAqM9dwkmzirSypxBXIVRAZMVQV7GTeih29QW9xnk X-Received: by 2002:a63:f921:0:b0:46b:18b:fe4d with SMTP id h33-20020a63f921000000b0046b018bfe4dmr28624777pgi.573.1666615686366; Mon, 24 Oct 2022 05:48:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666615686; cv=none; d=google.com; s=arc-20160816; b=fmFFhlsROo3+S4IXSs2du8G3G0XkEYOahs0KBg26auMEL0qs72bMsE4Ho05SwaYJ0s +9oggsvMPZFG8VnnVQsoeXq0n+CZ15JxGUfylG6ochWfY5RaxqIU251qK01iSWGktZX6 kjQpqc0vvLkdEeDQBco6QdHDWtuIXqvnUG/rgS3y00Ua3okKiDUXI8aO/Sn2O31qV5aK 3ARRC2KdSogcZYwGjFsUyUYxHPIR/qgl0JEhNKNaYfSjsKNPDvWNPg1slzxBoqUrYjXk 1LQ4JjzG8C1uARjYz+uyz/x5GTzV4r0lw62Tgfx1ScpJOzQ+MRCn3UkY281pbvzrSK5d 1LPg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=+CciKDv6JKY+01zt7+ltKwp8SwfWo0VDF5P02kTmE5c=; b=mElZ1m8mkUdraPUrp6Oy6nkB7HthKJybh4sgThdHmD3+7mEfTA3mC+wEA+v2ug7T8s 4ZLejrb3JYs5lGC9XR8nmTZ8BwpFVcK5mlAP4NhAkrlbA97aKQ3ATwKUGw1+/7ZA59qs DSygV5PhtofwCjqVuUQdKFUhzQ4u8EvxKtAadeGXaOIQCMwu3wwydkBSjM1e+hglgwSH xnQ01oiv7o6YJjpDUKULBFof0OHPhL9R5I7ohuSZ2tyLfIFJUlP6aW6WsTPlnep6UlNK 1eDqTRMalymB/IE9oXy5Uae8TordnB1HurOr/HBInMfbfxe9N68sfFq8N+LE7rCpKDMl 4Ubg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=UFes2JN2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s7-20020a17090302c700b0017532e01e57si32182697plk.200.2022.10.24.05.47.52; Mon, 24 Oct 2022 05:48:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=UFes2JN2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232131AbiJXMis (ORCPT + 99 others); Mon, 24 Oct 2022 08:38:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60538 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233979AbiJXM3I (ORCPT ); Mon, 24 Oct 2022 08:29:08 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8AB0387FAD; Mon, 24 Oct 2022 05:03:05 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 2033BB81205; Mon, 24 Oct 2022 12:00:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 52CC8C433D6; Mon, 24 Oct 2022 12:00:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612811; bh=Ws77N57CxyF8R2lCt0Q+LCWWOIs7ZrRkFT0j9x5vLi0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UFes2JN2qSRIY2dvj/LoqHhybzj9GYtl5cZYIxYLX3o6F84d+sDmHiAR4RPHe708L HjrATpUJvU1CYOWQIExEqXqrJSXOqTa6DE2ss2Sur7UDdXm1i92KK/+2VDE7msin+P 79c7VWqDaDIxdm9WztWO6ofULO0FoPFFnsfflfSw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Shubhrajyoti Datta , Sasha Levin Subject: [PATCH 4.19 129/229] tty: xilinx_uartps: Fix the ignore_status Date: Mon, 24 Oct 2022 13:30:48 +0200 Message-Id: <20221024113003.181254735@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747573209743711000?= X-GMAIL-MSGID: =?utf-8?q?1747573209743711000?= From: Shubhrajyoti Datta [ Upstream commit b8a6c3b3d4654fba19881cc77da61eac29f57cae ] Currently the ignore_status is not considered in the isr. Add a check to add the ignore_status. Fixes: 61ec9016988f ("tty/serial: add support for Xilinx PS UART") Signed-off-by: Shubhrajyoti Datta Link: https://lore.kernel.org/r/20220729114748.18332-5-shubhrajyoti.datta@xilinx.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/tty/serial/xilinx_uartps.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/tty/serial/xilinx_uartps.c b/drivers/tty/serial/xilinx_uartps.c index c22bd40fc6f0..ded9f16d08eb 100644 --- a/drivers/tty/serial/xilinx_uartps.c +++ b/drivers/tty/serial/xilinx_uartps.c @@ -365,6 +365,8 @@ static irqreturn_t cdns_uart_isr(int irq, void *dev_id) isrstatus &= ~CDNS_UART_IXR_TXEMPTY; } + isrstatus &= port->read_status_mask; + isrstatus &= ~port->ignore_status_mask; /* * Skip RX processing if RX is disabled as RXEMPTY will never be set * as read bytes will not be removed from the FIFO. From patchwork Mon Oct 24 11:30:49 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8757 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp430334wru; Mon, 24 Oct 2022 05:41:15 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4jYy7kBgo1Z8AujaeQWA1qDKLCsymeVJboPJtcCLPUCgOVj79JV5mx6j80Khe93ijFzh9b X-Received: by 2002:a63:5b53:0:b0:462:7149:2c54 with SMTP id l19-20020a635b53000000b0046271492c54mr27522174pgm.527.1666615275575; Mon, 24 Oct 2022 05:41:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666615275; cv=none; d=google.com; s=arc-20160816; b=SzP8w9pdVv9IXj8xWvDv+dTP2oisquKoIDrohe6/9oiPJHfiLKYg/amnKhtSMyP3d0 a+n/X6FqKlHbi7PvLOFx3MYUVii6qgZvs4LeiOwhGxGlVGcHXLdrCqW5Y3AseQMUu9pn n0FIus6BYrn8biww7neIxCWH6YuPAiMy7NeTKnFDDPiRyRylMawpGnZD6TDfNf9XkjnJ 30x1QasrL24ttFaYXL7VQ1YGHD+4PUq1Swq6X5TxZfvp+xIIaHTZVmgjxkfIvCC55/bI nhhopIyczcNVXRyvbW+FjbqSYtXXRamrqWJBruJcL76gsy0PaTwZK3p5w9/FgSbe/Zth 9v4Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=TQ5MctYJvG9FFzJbfOy2QumdHa1ZDUrExA0o/pdf2+U=; b=wLJnALtRYtDqJyutcSIUquVg9Sqni2KY5rVHww8A+ieQEE7oYjpP8asZTfxr14XUYE Uxh3fGScTEeX1wPfFViEbmgHSDCDu8NkBsC25c4f8RM06EauP+uOa33TrTznouQ+wlcj jDTX4ljIRhlhaTRtSKBnaQ/XIgyy1hnoylWT1iyWoa5rcnOI+hcp/WVZRRNAgf3QAMdN wXPeTY7uhw11wwxkAZ1/7hRqdLRe7ZmzCM2XECPIAtRLTgB5vXXTRr1CG20/jlL5tSF+ 8BcOQ71L1Ok0mTq3do5t4EPd9Yj/hGcrcNELPAVTN3+6fyaocPexIBmsMY7PwgiofE1z 8nCw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=tRIQGIRB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w6-20020a170902d3c600b001783af487d1si31270154plb.533.2022.10.24.05.41.01; Mon, 24 Oct 2022 05:41:15 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=tRIQGIRB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234014AbiJXM3L (ORCPT + 99 others); Mon, 24 Oct 2022 08:29:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45256 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233828AbiJXM2V (ORCPT ); Mon, 24 Oct 2022 08:28:21 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C2A3786801; Mon, 24 Oct 2022 05:01:40 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id F371A6127D; Mon, 24 Oct 2022 12:00:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 175CCC433C1; Mon, 24 Oct 2022 12:00:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612814; bh=py1Zph9NUQ/OJNirFXbkvul6N/qlUoss8U2ugj+VCtU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tRIQGIRBZthN8AeZx2X77+0HVeCvFbSplqpdMJqPiSsLSvhsT6BWkqZAAT4y/aR32 F888jRoKAX457Fvd8Z2oT623zdY91F03xVZjY0t7v+sb4DJGIqq8PCI42C0v4qt+K5 t5ZIxAGW5iiK6SH+5wlrHDlZkq0RPoL4ZAFQC1YI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Miaoqian Lin , Laurent Pinchart , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 4.19 130/229] media: xilinx: vipp: Fix refcount leak in xvip_graph_dma_init Date: Mon, 24 Oct 2022 13:30:49 +0200 Message-Id: <20221024113003.210505896@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747572779327656197?= X-GMAIL-MSGID: =?utf-8?q?1747572779327656197?= From: Miaoqian Lin [ Upstream commit 1c78f19c3a0ea312a8178a6bfd8934eb93e9b10a ] of_get_child_by_name() returns a node pointer with refcount incremented, we should use of_node_put() on it when not need anymore. Add missing of_node_put() to avoid refcount leak. Fixes: df3305156f98 ("[media] v4l: xilinx: Add Xilinx Video IP core") Signed-off-by: Miaoqian Lin Signed-off-by: Laurent Pinchart Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin --- drivers/media/platform/xilinx/xilinx-vipp.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/media/platform/xilinx/xilinx-vipp.c b/drivers/media/platform/xilinx/xilinx-vipp.c index 6d95ec1e9a6b..9177db789b07 100644 --- a/drivers/media/platform/xilinx/xilinx-vipp.c +++ b/drivers/media/platform/xilinx/xilinx-vipp.c @@ -464,7 +464,7 @@ static int xvip_graph_dma_init(struct xvip_composite_device *xdev) { struct device_node *ports; struct device_node *port; - int ret; + int ret = 0; ports = of_get_child_by_name(xdev->dev->of_node, "ports"); if (ports == NULL) { @@ -474,13 +474,14 @@ static int xvip_graph_dma_init(struct xvip_composite_device *xdev) for_each_child_of_node(ports, port) { ret = xvip_graph_dma_init_one(xdev, port); - if (ret < 0) { + if (ret) { of_node_put(port); - return ret; + break; } } - return 0; + of_node_put(ports); + return ret; } static void xvip_graph_cleanup(struct xvip_composite_device *xdev) From patchwork Mon Oct 24 11:30:50 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8785 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp430729wru; Mon, 24 Oct 2022 05:42:11 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6rGvXZ7HzE+FbrMmdN6xdcQhiuLPvrLIPlUr2bmsuEngbyaDcTzWJTGQYyeDzOF1xNWjjF X-Received: by 2002:a63:5b05:0:b0:460:a6a:ec38 with SMTP id p5-20020a635b05000000b004600a6aec38mr27468000pgb.485.1666615330832; Mon, 24 Oct 2022 05:42:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666615330; cv=none; d=google.com; s=arc-20160816; b=XmKyLw7RQ8Fl/HA2NlYGEBh39BLcxxkUrfytUO2RNFSIbbBdEh2Nss+EaC4bBuciIx xhaUM2fMd5270NYEwGmS9rAT1iL1tr+kSekUhoFuCjz01ZAfaCyLl1mr8F1LZECTtK1W I7GhATIvFkdYbX613wZ4dma/+DfnLbir2kTdQtWbej7B7iLTV407EhruHv0wjw1lqAJT Zs6ujR84P0AvKJmnIsrPHSav5qtBIeCS0UY6ObuUwsEPRSDD8uZnd14R/XfNEcaApqJ+ qA7q4glbK7gBmhqe9dZo0jR5Ar7sr154vDhtI/tNDkq6aLFOCkw22kN5EilhzkQkk0Qm 5zyA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=ulWHEYPdNAwn/dIrelnomw6rVfo+liDEnScvzVGC7AU=; b=NZ+tz74R+ufY7NhbgXx3oR0NkYg+wDzVHAw5CkWHOP2hv/R/ITF2BPaSnge2QYVFdy dK/TkoLkne031MDEYEjmsVi1C+Sj3BGYH7pTCICJI0kxDkbG/4UtdLzhsu7G2rCj8u83 CSI+PdgUpFBdFTuAoY1WhEC2w6g41bBepnPFvIGnVDRbes7w2sa9zc+V+JE1vkquVk0r YdrsaEo8rCjIUElx0j01jt4RFjMa21W6UcV+RBcmZRXylCRRWsoYOqOmM91psNoL9pfA 3ZA0vyIn6Jg0AQJ5wXdnnfY4GZI+5/e5wXmymdilJXr9R7cA4w1ZmeJPrbqC84YvPqdQ J55A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Hkht0Y9S; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e12-20020a63ee0c000000b0042b16d0cbf9si35441460pgi.638.2022.10.24.05.41.56; Mon, 24 Oct 2022 05:42:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Hkht0Y9S; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230156AbiJXMdF (ORCPT + 99 others); Mon, 24 Oct 2022 08:33:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60614 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234037AbiJXM3N (ORCPT ); Mon, 24 Oct 2022 08:29:13 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0CAB386FA1; Mon, 24 Oct 2022 05:03:06 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 59E5DB8120C; Mon, 24 Oct 2022 12:00:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AB8B6C433D6; Mon, 24 Oct 2022 12:00:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612817; bh=oW7cK+FgFeRGM8uvw9N6ZCn4rBD7IY418OcUHQF2Ln4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Hkht0Y9ST+iEJk0Z1cuNJ9KhYf/9kcHxQfVLRbwvVMzsOLr5HiGqPSQ6R384PaIcm vG9me0VGO8FlK4ORTutPiuFbrr8cWypdUiVdMhPRQ+YbUT103tMRUGPIWWFrZhoMKj AkQj8zz3ncTYAUz0GMOJ2HF+XhJq6cL+tDIDResc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, syzbot+ab99dc4c6e961eed8b8e@syzkaller.appspotmail.com, Zhu Yanjun , Li Zhijian , Bob Pearson , Leon Romanovsky , Sasha Levin Subject: [PATCH 4.19 131/229] RDMA/rxe: Fix "kernel NULL pointer dereference" error Date: Mon, 24 Oct 2022 13:30:50 +0200 Message-Id: <20221024113003.240809208@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747572837318913381?= X-GMAIL-MSGID: =?utf-8?q?1747572837318913381?= From: Zhu Yanjun [ Upstream commit a625ca30eff806395175ebad3ac1399014bdb280 ] When rxe_queue_init in the function rxe_qp_init_req fails, both qp->req.task.func and qp->req.task.arg are not initialized. Because of creation of qp fails, the function rxe_create_qp will call rxe_qp_do_cleanup to handle allocated resource. Before calling __rxe_do_task, both qp->req.task.func and qp->req.task.arg should be checked. Fixes: 8700e3e7c485 ("Soft RoCE driver") Link: https://lore.kernel.org/r/20220822011615.805603-2-yanjun.zhu@linux.dev Reported-by: syzbot+ab99dc4c6e961eed8b8e@syzkaller.appspotmail.com Signed-off-by: Zhu Yanjun Reviewed-by: Li Zhijian Reviewed-by: Bob Pearson Signed-off-by: Leon Romanovsky Signed-off-by: Sasha Levin --- drivers/infiniband/sw/rxe/rxe_qp.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/infiniband/sw/rxe/rxe_qp.c b/drivers/infiniband/sw/rxe/rxe_qp.c index a4b5374deac8..476871c8ae44 100644 --- a/drivers/infiniband/sw/rxe/rxe_qp.c +++ b/drivers/infiniband/sw/rxe/rxe_qp.c @@ -799,7 +799,9 @@ void rxe_qp_destroy(struct rxe_qp *qp) rxe_cleanup_task(&qp->comp.task); /* flush out any receive wr's or pending requests */ - __rxe_do_task(&qp->req.task); + if (qp->req.task.func) + __rxe_do_task(&qp->req.task); + if (qp->sq.queue) { __rxe_do_task(&qp->comp.task); __rxe_do_task(&qp->req.task); From patchwork Mon Oct 24 11:30:51 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8784 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp430724wru; Mon, 24 Oct 2022 05:42:10 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5qKpT+gOYJF+WlRJ+cYaczdBw3A8OAL+nHaoGgkFVTj10YoQ0tqUGXbUDYpHQvhI0b0cmX X-Received: by 2002:a65:4bcf:0:b0:460:c57f:9dad with SMTP id p15-20020a654bcf000000b00460c57f9dadmr28233174pgr.18.1666615329888; Mon, 24 Oct 2022 05:42:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666615329; cv=none; d=google.com; s=arc-20160816; b=YPfQ2fc46Po/yvyMiAedFkfaIM3QFE7uHYRtBvzqSPYfezrFqb/WMEk2imuHWlsA+C x2azN+G3iB6jR573aV+XcT3SyHc4B4MI4OSmmTkiG4D90et1brcXwqw9gxVt0St1mSBz Jm2Mt4nzEFJzxUq8JgFInuaHHeivsyLi7iMgOT2ULOxp4deqgVkHYKIX89VO8VpNGV0F oGHUTW/NTk/+bCg1/AOY4qG9qNuGwizfVlDqIehambDXUexrWpGvUJsFuIGs1bmsfA3F Yj7O9ek8KBWEAqZ7i7gvH81bDBB9l9FvOHzq6/12bpl0qQbPiLJlLSIZnTXm1YFQPhfP kubA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=K0S0JXE2wXMMkn8Pe3of5LAlfgh3NxHiNp0tdJegV3g=; b=ZZyhJ1gZWtchzxjzh3knoyFsRG3qiS4t0O7Pozkj6DVa3mymvk0ZyLVAAR4nuTv7Tu g4jJMmDBy8DnpeZF33Hf2eAMfCItxbKHj7G+ma4j8eQs3ac3r9n+p+OdhT/LyfwwWv3t b0Yp4+ArY2y8RAJ3H0OO9kPCLGUtUygdN/z/qpZCXV7YBtN7J3YWHHhlU87lMGGALF9U ljlY9gJDUkQMn9oTLWpitm6MyRNM/zPXs3SAu5jfs/dCF3eL8kjddE7vuhZMMiD2Ctug YzXIkjU425Ki2tk28xQdUsG98gsrLWB9RNBjN/wlpFr1KHQVxNiadoeIQoH5M3xU9pCZ ilEQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=BacPQApB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l8-20020a170903120800b001727a15dbf8si40442694plh.345.2022.10.24.05.41.54; Mon, 24 Oct 2022 05:42:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=BacPQApB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230355AbiJXMcs (ORCPT + 99 others); Mon, 24 Oct 2022 08:32:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60568 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234000AbiJXM3K (ORCPT ); Mon, 24 Oct 2022 08:29:10 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 010E987FBE; Mon, 24 Oct 2022 05:03:09 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 65C0DB81210; Mon, 24 Oct 2022 12:00:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 47631C433C1; Mon, 24 Oct 2022 12:00:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612820; bh=3PV82GHpC9WdupZAWkWeg7H6UZNAeWVZotKsrI4jYoE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BacPQApB5PtmwaHaSF3DcBDwyfvCmuBtqG5pQvXnuVIGnbp4z1d+pkJzS2MkTxH9Q /q2K6XVhC7CK3gQHp9qicZhiaPoec6SkbPISS3ti/Q78ObZyYH/TbKN2x2pMjFwqmW DV3LcGSFFEwfFUrPM/WQImZjcFrsrTtZ5s0ev9uM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zhu Yanjun , Li Zhijian , Bob Pearson , Leon Romanovsky , Sasha Levin Subject: [PATCH 4.19 132/229] RDMA/rxe: Fix the error caused by qp->sk Date: Mon, 24 Oct 2022 13:30:51 +0200 Message-Id: <20221024113003.270299057@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747572836555650139?= X-GMAIL-MSGID: =?utf-8?q?1747572836555650139?= From: Zhu Yanjun [ Upstream commit 548ce2e66725dcba4e27d1e8ac468d5dd17fd509 ] When sock_create_kern in the function rxe_qp_init_req fails, qp->sk is set to NULL. Then the function rxe_create_qp will call rxe_qp_do_cleanup to handle allocated resource. Before handling qp->sk, this variable should be checked. Fixes: 8700e3e7c485 ("Soft RoCE driver") Link: https://lore.kernel.org/r/20220822011615.805603-3-yanjun.zhu@linux.dev Signed-off-by: Zhu Yanjun Reviewed-by: Li Zhijian Reviewed-by: Bob Pearson Signed-off-by: Leon Romanovsky Signed-off-by: Sasha Levin --- drivers/infiniband/sw/rxe/rxe_qp.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/infiniband/sw/rxe/rxe_qp.c b/drivers/infiniband/sw/rxe/rxe_qp.c index 476871c8ae44..6320390f531c 100644 --- a/drivers/infiniband/sw/rxe/rxe_qp.c +++ b/drivers/infiniband/sw/rxe/rxe_qp.c @@ -841,8 +841,10 @@ static void rxe_qp_do_cleanup(struct work_struct *work) free_rd_atomic_resources(qp); - kernel_sock_shutdown(qp->sk, SHUT_RDWR); - sock_release(qp->sk); + if (qp->sk) { + kernel_sock_shutdown(qp->sk, SHUT_RDWR); + sock_release(qp->sk); + } } /* called when the last reference to the qp is dropped */ From patchwork Mon Oct 24 11:30:52 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8805 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp430917wru; Mon, 24 Oct 2022 05:42:32 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5H0MBCLKajFaqbLGqdaPUL7UeXW+IvpFLoGHngSfEBxbUvt61+VlmBJ456brTWAk8utkLw X-Received: by 2002:a63:5b5c:0:b0:440:8531:d3f6 with SMTP id l28-20020a635b5c000000b004408531d3f6mr28760217pgm.114.1666615351729; Mon, 24 Oct 2022 05:42:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666615351; cv=none; d=google.com; s=arc-20160816; b=o0MWyLQMorY//a2M3zvvTN0y1xApI1j18fzeTLmgUIeJE52IWT50IDkf/vv3bbANpv 0QXf/HDpGaKuRSqm+pYe8UupVCJmW4lEjHjIwaDTG1s+ezDdsqSE6KybkgFqn445fmxf GHEgGn5DKMcTZ965wRbkqNg6vT4TNi9VJ2DtTPD4KskCUPJR4dcD9FvER6erW22zgoeB bytE14apwXywdPy5SfPALjbjUp+zU56j9ON21HoiQ7Az/xKMphvQRCe+5K7ftz9qNgkL rNnCL6B7/Ee4p37ZI5AcNmMP1TjwCvv5B3mDnyh/3neGPxZMH1TF1FT6dnTKKQV32ovc ooCA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=bkH6yJOgxrk1DHmD1HHkVAffvLJ628gFumv6oo74OSA=; b=B4bnikImLuZDsmw8LK+PAwyRfLd+l7VrZoIfGOONv2CYxeovBWzXarUMaibLhvkRS4 U/01Tlq1Kak4I3J9d6uQMUS6Fe7avOG66KwK1axAyYSGBo00rkMg+SxZ4xucG41il1kY cPYYsG4SeUmav9UggFHKnCwQJykR0AM26XZahc3G8BlkaSP5fzU9tNato1R6oa0nJGGR ng3QJj7JN0EXG9FtOBtF98bi7WfYgBMN0pFXgVPAjt79btGUKXd3eTRGqdWeWk+PIB/1 +aOiFMr0KG74u/ab2WwA6vulw5k0fk0cpnwnvaYhLbXBdrymIoF9mU7oN4zMwm9DQSfu 6uvQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=sDeFgPvZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n15-20020a6546cf000000b0046b2ec0de65si34522887pgr.789.2022.10.24.05.42.18; Mon, 24 Oct 2022 05:42:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=sDeFgPvZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232740AbiJXMdm (ORCPT + 99 others); Mon, 24 Oct 2022 08:33:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60546 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234128AbiJXM3Y (ORCPT ); Mon, 24 Oct 2022 08:29:24 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 229E388A00; Mon, 24 Oct 2022 05:03:09 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 01E7EB81203; Mon, 24 Oct 2022 12:00:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5B782C433B5; Mon, 24 Oct 2022 12:00:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612822; bh=7S74saqVx1Z5JOwQfwfMYXqdxLHiFdAxBPFGunevnug=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sDeFgPvZ6jJiu+dLYLb0vaGxGpAXtlmcShaCxfTc9HJYsE6CIVjXQ+tCZN8pRAce/ ZBIy+R2GbykN54oFA3L1/fD3HsU54yyvuWE8UD42fLCo3l6FJUhSijfpWZlnyY2hcP 8pbGu/IJcapl9RDpavO7oVNq9euuAmeajwd0CD+A= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Rasmus Villemoes , Jason Baron , Daniel Vetter , Jim Cromie , Sasha Levin Subject: [PATCH 4.19 133/229] dyndbg: fix module.dyndbg handling Date: Mon, 24 Oct 2022 13:30:52 +0200 Message-Id: <20221024113003.300400201@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747572859031292976?= X-GMAIL-MSGID: =?utf-8?q?1747572859031292976?= From: Jim Cromie [ Upstream commit 85d6b66d31c35158364058ee98fb69ab5bb6a6b1 ] For CONFIG_DYNAMIC_DEBUG=N, the ddebug_dyndbg_module_param_cb() stub-fn is too permissive: bash-5.1# modprobe drm JUNKdyndbg bash-5.1# modprobe drm dyndbgJUNK [ 42.933220] dyndbg param is supported only in CONFIG_DYNAMIC_DEBUG builds [ 42.937484] ACPI: bus type drm_connector registered This caused no ill effects, because unknown parameters are either ignored by default with an "unknown parameter" warning, or ignored because dyndbg allows its no-effect use on non-dyndbg builds. But since the code has an explicit feedback message, it should be issued accurately. Fix with strcmp for exact param-name match. Fixes: b48420c1d301 dynamic_debug: make dynamic-debug work for module initialization Reported-by: Rasmus Villemoes Acked-by: Jason Baron Acked-by: Daniel Vetter Signed-off-by: Jim Cromie Link: https://lore.kernel.org/r/20220904214134.408619-3-jim.cromie@gmail.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- include/linux/dynamic_debug.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/linux/dynamic_debug.h b/include/linux/dynamic_debug.h index b3419da1a776..77a16b2eb42f 100644 --- a/include/linux/dynamic_debug.h +++ b/include/linux/dynamic_debug.h @@ -168,7 +168,7 @@ static inline int ddebug_remove_module(const char *mod) static inline int ddebug_dyndbg_module_param_cb(char *param, char *val, const char *modname) { - if (strstr(param, "dyndbg")) { + if (!strcmp(param, "dyndbg")) { /* avoid pr_warn(), which wants pr_fmt() fully defined */ printk(KERN_WARNING "dyndbg param is supported only in " "CONFIG_DYNAMIC_DEBUG builds\n"); From patchwork Mon Oct 24 11:30:53 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8783 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp430723wru; Mon, 24 Oct 2022 05:42:10 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4YZvqCRMXY/4bQZT/Vl/9F/1YS6OYBhbtmRWR3U/HlofRxh94z6qD0YeEZhhrp3Iu8Usck X-Received: by 2002:a17:902:7c04:b0:186:abd0:9401 with SMTP id x4-20020a1709027c0400b00186abd09401mr4425034pll.64.1666615329828; Mon, 24 Oct 2022 05:42:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666615329; cv=none; d=google.com; s=arc-20160816; b=l0xKHomraFdKw366M/CdMh6DlNFkFvY6KpuSDu7tkL4UxmcP+DVWImzmCB6xA5itGE UQzxn2QEUWyiZIBWlLdLlunHqgseT1f5rWhrHCi34fdSZibvmS5x1s5g31+AUODkpySz tsBnp6jqarxumz46ZJ7QN8FfNi26fzRcaACPNAmNlYsRGSZe1yvxr8XoNQ+uBEZR38pM 6HWd69HZsKOC+zznCspapSfEBSHytyOMwDUwXpPnr8KxuIP7tSG6ia8oGIPRXWPVC769 PzWzMjkcrO9m0ZsfjbFlxLtig5DgQPoSf5Pvct1kSl5TRhCwp5UZ/SvaWYNr5b1UTA5N Vi2g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=nkUmu3dtCzAIfoUlVSKpoaz3v4R8I8vNcEhMgse84A8=; b=ycv/RWwHdqlqmoIB0HS1cGEIkRdpgh0DNTBhb54uE6pXs5EM3KgevrpoUzFCC0jOBW FAMgzBQQoVCESY7NfiuQM+/SuyE/gRXHtpIkoXpCAU0V4bd0YWhA+Kc5EefM+NiaoLXE JvPU2UWRqsQ6FpQUkcTd4abjL6KHrYv1HPnjy6dHWJmhec2ESJBUUriQB1Hqoa+ygcrd chHdudK/Fog9Xx1AkDpAIhIgO7+UjPmaaB+XyRbjzPMlppbefL0xFAlduVefKEzF+e96 PmrXEq4qeakVe14XtvU0pZqMVIuQkprW2gxd0sTgBo1lb6LqxPgb33I5ZaAVgDhGiNWk YNgw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=JLwaiBPU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t2-20020a056a0021c200b0054d5253e7d7si15022402pfj.190.2022.10.24.05.41.56; Mon, 24 Oct 2022 05:42:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=JLwaiBPU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229974AbiJXMdA (ORCPT + 99 others); Mon, 24 Oct 2022 08:33:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60576 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234009AbiJXM3L (ORCPT ); Mon, 24 Oct 2022 08:29:11 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B6C0E87F9B; Mon, 24 Oct 2022 05:03:01 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id D38EC6121A; Mon, 24 Oct 2022 12:00:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E779EC433C1; Mon, 24 Oct 2022 12:00:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612825; bh=Tv1qlyGz+W4DAit23WsKH3GA9/Z/UUoihIb9T67RTpM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JLwaiBPUxgbCt+ynrWvqE+ze4FJgc7EDkKWdSUSv9DKefwQcuSH7jRwGtV09mLRwa Dcu9UdgRL8ZHyFLTD+gM0sKPZcQuUPbGaqh35c1WPBiL2DQs16oRZCUJJFEl6/qT8L r5KZ5iZxNZGkcDPisRvzC2oHRPvX60IXpxXvP68o= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jason Baron , Daniel Vetter , Jim Cromie , Sasha Levin Subject: [PATCH 4.19 134/229] dyndbg: let query-modname override actual module name Date: Mon, 24 Oct 2022 13:30:53 +0200 Message-Id: <20221024113003.343691236@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747572836412655824?= X-GMAIL-MSGID: =?utf-8?q?1747572836412655824?= From: Jim Cromie [ Upstream commit e75ef56f74965f426dd819a41336b640ffdd8fbc ] dyndbg's control-parser: ddebug_parse_query(), requires that search terms: module, func, file, lineno, are used only once in a query; a thing cannot be named both foo and bar. The cited commit added an overriding module modname, taken from the module loader, which is authoritative. So it set query.module 1st, which disallowed its use in the query-string. But now, its useful to allow a module-load to enable classes across a whole (or part of) a subsystem at once. # enable (dynamic-debug in) drm only modprobe drm dyndbg="class DRM_UT_CORE +p" # get drm_helper too modprobe drm dyndbg="class DRM_UT_CORE module drm* +p" # get everything that knows DRM_UT_CORE modprobe drm dyndbg="class DRM_UT_CORE module * +p" # also for boot-args: drm.dyndbg="class DRM_UT_CORE module * +p" So convert the override into a default, by filling it only when/after the query-string omitted the module. NB: the query class FOO handling is forthcoming. Fixes: 8e59b5cfb9a6 dynamic_debug: add modname arg to exec_query callchain Acked-by: Jason Baron Acked-by: Daniel Vetter Signed-off-by: Jim Cromie Link: https://lore.kernel.org/r/20220904214134.408619-8-jim.cromie@gmail.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- lib/dynamic_debug.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c index 9305ff43fc15..fec610703095 100644 --- a/lib/dynamic_debug.c +++ b/lib/dynamic_debug.c @@ -327,10 +327,6 @@ static int ddebug_parse_query(char *words[], int nwords, } memset(query, 0, sizeof(*query)); - if (modname) - /* support $modname.dyndbg= */ - query->module = modname; - for (i = 0; i < nwords; i += 2) { if (!strcmp(words[i], "func")) { rc = check_set(&query->function, words[i+1], "func"); @@ -379,6 +375,13 @@ static int ddebug_parse_query(char *words[], int nwords, if (rc) return rc; } + if (!query->module && modname) + /* + * support $modname.dyndbg=, when + * not given in the query itself + */ + query->module = modname; + vpr_info_dq(query, "parsed"); return 0; } From patchwork Mon Oct 24 11:30:54 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8796 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp430846wru; Mon, 24 Oct 2022 05:42:22 -0700 (PDT) X-Google-Smtp-Source: AMsMyM42MDiJvFoQ1KTTlI6izI1DFTzuHfq1flKSa3t81jrsc5uq1+70jvSBhZuyJhhUxGjSG9BV X-Received: by 2002:a05:6a00:2384:b0:566:813c:ae24 with SMTP id f4-20020a056a00238400b00566813cae24mr33479424pfc.17.1666615341903; Mon, 24 Oct 2022 05:42:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666615341; cv=none; d=google.com; s=arc-20160816; b=hW09caENw+gPfR/rnj9G7ErbDOoZnOYwHrAH1Psx3Zl3u2/KQt/vvnvo+acij2BbrD 4TplO7Z+HnaMG9yg/pZ8URuorjr3O/+8AjXC7htN6r/C0bJWUwSso+9uA84PeVbypkBa Q1ErB+rl8cKxuLpR9S0DvGsd80fGhLzNNv2/cdROGg4wPMRR8xPXOd/80gOdllhwg8cy 1oFGwQo8Kz4oOtYmyu+igxatzkAjiVSHx9drMOPehn9LwRVB5KeS4akqQAfJOFa7NOGT 3ZjDMutGNL7b4FkcISeb/Up06vimaH8LGQWVc+uUWseazGYzmJNze2Yt8aK37cd74lqH jjAA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=m8CdF+PSqne2g0vOr1XeYxn5qAZpb6QvwlFGHmjXf6E=; b=Us55htioi7WkBNdQcY0heDq6IQSyR5p03XtnD7cG2RUDSbtLdtrQrKjZJhTR07Fr4Z k6WJ1Y8Ds/Ynysaa2EQSkJwvX+aeS/EZv7amLmB2lKSEo9qnfnd+zgSyKAH+TDZdUCXU u6/pSDC+mvu1NfnRdHfYB3zwdpzLDTutUZ9Y9/NsacrnfvIBZxqVNFg+F5uJ3MoFHApg fiKfqdtuDnSmpAGiC/B8rwgW4dqxbP6NrXfJyMfqYwb79VqNuKXWP35UypsH7NSdS0NN pp1g2a+dtVt3LGiJq9zRhi2tVT7C9Ailk/+iXbCObFttaEKZI5YaUs7aVLlWs/sqZXdU KiPQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=dBUqyZfS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h15-20020a056a00218f00b005698856bb2bsi15771144pfi.330.2022.10.24.05.42.07; Mon, 24 Oct 2022 05:42:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=dBUqyZfS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234104AbiJXMd5 (ORCPT + 99 others); Mon, 24 Oct 2022 08:33:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51190 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234142AbiJXM3Y (ORCPT ); Mon, 24 Oct 2022 08:29:24 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A9E1C88A0D; Mon, 24 Oct 2022 05:03:14 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id E4AB3B81200; Mon, 24 Oct 2022 12:00:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 42895C433C1; Mon, 24 Oct 2022 12:00:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612830; bh=4/5oQa4SXwqMtAcGf0F3+o2IZAhzz6PX17NqEpDjG/M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dBUqyZfSgKekWNwR+0O0nbePo7jjdY6hsCxUVurVHoB78roTA9xrKKHp4X+0Zugeg e8V0nIs0M+oILFC/0aSsyXpGTb4/f/5b7OG/2Ty/Ahzwe22cl3g/AwAPoTfSQZgGBF HWo1YFNJv7tMPiSVxXmsY/ny8urEuHhtqoJPmdZY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hacash Robot , William Dean , Miquel Raynal , Sasha Levin Subject: [PATCH 4.19 135/229] mtd: devices: docg3: check the return value of devm_ioremap() in the probe Date: Mon, 24 Oct 2022 13:30:54 +0200 Message-Id: <20221024113003.372004673@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747572848563384472?= X-GMAIL-MSGID: =?utf-8?q?1747572848563384472?= From: William Dean [ Upstream commit 26e784433e6c65735cd6d93a8db52531970d9a60 ] The function devm_ioremap() in docg3_probe() can fail, so its return value should be checked. Fixes: 82402aeb8c81e ("mtd: docg3: Use devm_*() functions") Reported-by: Hacash Robot Signed-off-by: William Dean Signed-off-by: Miquel Raynal Link: https://lore.kernel.org/linux-mtd/20220722091644.2937953-1-williamsukatube@163.com Signed-off-by: Sasha Levin --- drivers/mtd/devices/docg3.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/mtd/devices/docg3.c b/drivers/mtd/devices/docg3.c index 512bd4c2eec0..740a09c9f67a 100644 --- a/drivers/mtd/devices/docg3.c +++ b/drivers/mtd/devices/docg3.c @@ -1990,9 +1990,14 @@ static int __init docg3_probe(struct platform_device *pdev) dev_err(dev, "No I/O memory resource defined\n"); return ret; } - base = devm_ioremap(dev, ress->start, DOC_IOSPACE_SIZE); ret = -ENOMEM; + base = devm_ioremap(dev, ress->start, DOC_IOSPACE_SIZE); + if (!base) { + dev_err(dev, "devm_ioremap dev failed\n"); + return ret; + } + cascade = devm_kcalloc(dev, DOC_MAX_NBFLOORS, sizeof(*cascade), GFP_KERNEL); if (!cascade) From patchwork Mon Oct 24 11:30:55 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8799 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp430870wru; Mon, 24 Oct 2022 05:42:26 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7Yin/aRbZM7Um22wlWLtFxXYaeyblQpgFXiZNJweMy6N90zB1fb9ERrN463V5C3Yo4Yx+F X-Received: by 2002:a17:902:ea10:b0:185:3d64:8d3f with SMTP id s16-20020a170902ea1000b001853d648d3fmr34681619plg.53.1666615346493; Mon, 24 Oct 2022 05:42:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666615346; cv=none; d=google.com; s=arc-20160816; b=ar0RIEXSXPsd6I6GwceFYpTNY7o/x1SyW00XfzCvNmhzLUIeyc/lP45Ok9bB8U92YV Zc0pzyej1VOslkBdffn2ianrvfgmL60Za7cXAlpTOFnOLodIbnvYBANha+lyHDeyuMRC 6kh1wAi/SMYKNn9qiVnhde4Enjiq3WGHuhFWxntHjXjLrDcN4R2HQlhSy8OI25JrX7+h o6nrzmR6+ly5eLTMAfBSwCJEiDmX9F7BxjloHvMSjAt9Kg4sOE1dcEIA/pwxj/QckFDC +ezIvQ4BKaMg7tBKC2Zi3oouGdm4R/MFs8wZ9iQOLvjmqx9EDUND+PaTyTt5aBZ4hZCs /q2A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=odzRtK+PDaUvaib3VAVZptEJyjjDI4Pu6/cNAJJJEf0=; b=vOIesOb1g2fIJJHZq/Jn+nkYwaas0VLrVLXMvSmqxvXXNEl04sO63gz4hUUav6axrf 3iV5BfdodmzMQfG4Ir9ToOAUOvLPI8UuQzmiZQB4TxgpdKWmrO1PqNFSvAnIiPTlJhr6 CxPgASCk5ammWxHD+1zCNOR0deM7OeNjMNQUBb6b2Rv14affHqGItyDggo/XPYKP9k5s dZxT2Kuulk+KvywBGa2/LvSj2L9r5QO43nKy4aRzfhhfEcsjmhTM8U31HYcYCMGseTYY Toh6z02aElr3S+uQ2yhPmeQuZni/3PuJAJvxt2HJRzpKfUqzKs6MgE+FU5bAvmUx5wxV 6qIQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=pGQemGjm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b9-20020a170902b60900b001868375410dsi8506497pls.64.2022.10.24.05.42.11; Mon, 24 Oct 2022 05:42:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=pGQemGjm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234168AbiJXMeX (ORCPT + 99 others); Mon, 24 Oct 2022 08:34:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60620 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234180AbiJXM3d (ORCPT ); Mon, 24 Oct 2022 08:29:33 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 25E3688A2B; Mon, 24 Oct 2022 05:03:20 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 83B0BB81212; Mon, 24 Oct 2022 12:00:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DA5CBC4314D; Mon, 24 Oct 2022 12:00:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612833; bh=mT8ZRVYxjrruZWUmwxV+YGPFhC0ZsyPOFU+ocTtLHQc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pGQemGjmp5UmjuitKDqemdIjo6rtLMB5pSVmThu/fvwuzj5te6wzbacCmZ9AD/Egv 3NsZTyB4XSiRDOyKuAJAbleyw2uAvJqbgoZ6I9jtlSL75K77NiqMCun4GN38qQcvov 06wGoWnn6HU325eW2BY+tXygjrxzGprgS1yz+TG4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Niklas Cassel , Damien Le Moal , Sasha Levin Subject: [PATCH 4.19 136/229] ata: fix ata_id_sense_reporting_enabled() and ata_id_has_sense_reporting() Date: Mon, 24 Oct 2022 13:30:55 +0200 Message-Id: <20221024113003.410828422@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747572853426754905?= X-GMAIL-MSGID: =?utf-8?q?1747572853426754905?= From: Niklas Cassel [ Upstream commit 690aa8c3ae308bc696ec8b1b357b995193927083 ] ACS-5 section 7.13.6.41 Words 85..87, 120: Commands and feature sets supported or enabled states that: If bit 15 of word 86 is set to one, bit 14 of word 119 is set to one, and bit 15 of word 119 is cleared to zero, then word 119 is valid. If bit 15 of word 86 is set to one, bit 14 of word 120 is set to one, and bit 15 of word 120 is cleared to zero, then word 120 is valid. (This text also exists in really old ACS standards, e.g. ACS-3.) Currently, ata_id_sense_reporting_enabled() and ata_id_has_sense_reporting() both check bit 15 of word 86, but neither of them check that bit 14 of word 119 is set to one, or that bit 15 of word 119 is cleared to zero. Additionally, make ata_id_sense_reporting_enabled() return false if !ata_id_has_sense_reporting(), similar to how e.g. ata_id_flush_ext_enabled() returns false if !ata_id_has_flush_ext(). Fixes: e87fd28cf9a2 ("libata: Implement support for sense data reporting") Signed-off-by: Niklas Cassel Signed-off-by: Damien Le Moal Signed-off-by: Sasha Levin --- include/linux/ata.h | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/include/linux/ata.h b/include/linux/ata.h index 40d150ad7e07..351e58312e7d 100644 --- a/include/linux/ata.h +++ b/include/linux/ata.h @@ -786,16 +786,21 @@ static inline bool ata_id_has_read_log_dma_ext(const u16 *id) static inline bool ata_id_has_sense_reporting(const u16 *id) { - if (!(id[ATA_ID_CFS_ENABLE_2] & (1 << 15))) + if (!(id[ATA_ID_CFS_ENABLE_2] & BIT(15))) + return false; + if ((id[ATA_ID_COMMAND_SET_3] & (BIT(15) | BIT(14))) != BIT(14)) return false; - return id[ATA_ID_COMMAND_SET_3] & (1 << 6); + return id[ATA_ID_COMMAND_SET_3] & BIT(6); } static inline bool ata_id_sense_reporting_enabled(const u16 *id) { - if (!(id[ATA_ID_CFS_ENABLE_2] & (1 << 15))) + if (!ata_id_has_sense_reporting(id)) + return false; + /* ata_id_has_sense_reporting() == true, word 86 must have bit 15 set */ + if ((id[ATA_ID_COMMAND_SET_4] & (BIT(15) | BIT(14))) != BIT(14)) return false; - return id[ATA_ID_COMMAND_SET_4] & (1 << 6); + return id[ATA_ID_COMMAND_SET_4] & BIT(6); } /** From patchwork Mon Oct 24 11:30:56 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8953 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp436038wru; Mon, 24 Oct 2022 05:56:13 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4w9PqYJumh4p1r3Ph925uuiZQCFJDMa64h9WODgs+DtEGxNTZsw+ffVqhASNCFluAem9zQ X-Received: by 2002:a63:2c0b:0:b0:434:ebb6:7594 with SMTP id s11-20020a632c0b000000b00434ebb67594mr27570151pgs.245.1666616172930; Mon, 24 Oct 2022 05:56:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666616172; cv=none; d=google.com; s=arc-20160816; b=kBpoAOMP78e95x4l9BqsKpIXYx+35LpNA7AjZaX2XAEl3j8Sdkmhjb6CWeTliJVQX1 QFMHPdpKDE+CPmEySO8v844j/I94957Wg/0qURRq53vu4m//omIMgBN9TgMUTSXo1/uW GMv58KzjZSVcErun3Yrq5mBDGbXbDpYcTZNEDF80cwlYF8Y03COmtNeqWtr90RuWwyrL PPVr0L3nB4/2YKR6NQUsqAXmKHqlIG5dYzTt2sJx0j3cEAm4aEk2dTTZJKxsguj3EoX8 M+x6Ci7qNsVfTXrLFtUnZ1Vui31ClTXC3YCHYQRf/B+8FTFHRB9FDlfSnuNIFUKIT3z1 vDwg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=EisKrlAqyhqX3dhC2b/CF+PptlWYgIH9AnH4fRFuwBI=; b=wwRHBQWwfk6gUp5KmVYhnRRGepPH69+2E51yTbCfNErGilMBRjLtbBnLmGq3jBGEPP DTtohiIsyNgEgLh8y+kidJkMgumqCgNM9H0pIW8HwU7fsmmgGv8D2ugrsLmc8g8IKdKA IAVZtVPV3Gdm+MmRxjOAgcGFs13vW+IUdlUaEfCv1JVLWruLMHWtVmIVpyTIRqH4IBGg 1cWZJ+aL/tnOJDo4LExjFMc+8s3BbLymA7lmxngM9MhWcGW/fJYzgF9uqG5C9P7dwKXx 7ACHuwZ/NsAQ9j79FFYwLiSJdfjhsaSvGAUNLg5kK/25zSxyRw27MgGzRbtpSPS2x9/U 47DA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=n+HzZk5A; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y6-20020a17090a2b4600b00212f0d1bf7csi5545998pjc.158.2022.10.24.05.55.59; Mon, 24 Oct 2022 05:56:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=n+HzZk5A; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234708AbiJXMyi (ORCPT + 99 others); Mon, 24 Oct 2022 08:54:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33374 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234875AbiJXMyM (ORCPT ); Mon, 24 Oct 2022 08:54:12 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CA2E62F000; Mon, 24 Oct 2022 05:14:31 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 631076129B; Mon, 24 Oct 2022 12:00:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7691AC433C1; Mon, 24 Oct 2022 12:00:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612835; bh=ThUNefmVX7EPWeUHan2db69m+nsFLLtPDI0WYoWFkvU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=n+HzZk5A6t+K+8n7NBjyas9Hd+1HWVrXrvAcseAef5F0x9/0dF+AscZEe0TiZkZun KMgZwNvGTytktizga0C33gEt3tLPwYdzajGZMWVZe+D+J86fzv1qrkSZ+TFiFSS5yN 1WNeLMR4htrpmsQXQo9TroeGIVBPRZRZhFki7dFk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Niklas Cassel , Damien Le Moal , Sasha Levin Subject: [PATCH 4.19 137/229] ata: fix ata_id_has_devslp() Date: Mon, 24 Oct 2022 13:30:56 +0200 Message-Id: <20221024113003.443723005@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747573719871506651?= X-GMAIL-MSGID: =?utf-8?q?1747573719871506651?= From: Niklas Cassel [ Upstream commit 9c6e09a434e1317e09b78b3b69cd384022ec9a03 ] ACS-5 section 7.13.6.36 Word 78: Serial ATA features supported states that: If word 76 is not 0000h or FFFFh, word 78 reports the features supported by the device. If this word is not supported, the word shall be cleared to zero. (This text also exists in really old ACS standards, e.g. ACS-3.) Additionally, move the macro to the other ATA_ID_FEATURE_SUPP macros (which already have this check), thus making it more likely that the next ATA_ID_FEATURE_SUPP macro that is added will include this check. Fixes: 65fe1f0f66a5 ("ahci: implement aggressive SATA device sleep support") Signed-off-by: Niklas Cassel Signed-off-by: Damien Le Moal Signed-off-by: Sasha Levin --- include/linux/ata.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/include/linux/ata.h b/include/linux/ata.h index 351e58312e7d..e9d24a23c0aa 100644 --- a/include/linux/ata.h +++ b/include/linux/ata.h @@ -581,6 +581,10 @@ struct ata_bmdma_prd { ((((id)[ATA_ID_SATA_CAPABILITY] != 0x0000) && \ ((id)[ATA_ID_SATA_CAPABILITY] != 0xffff)) && \ ((id)[ATA_ID_FEATURE_SUPP] & (1 << 2))) +#define ata_id_has_devslp(id) \ + ((((id)[ATA_ID_SATA_CAPABILITY] != 0x0000) && \ + ((id)[ATA_ID_SATA_CAPABILITY] != 0xffff)) && \ + ((id)[ATA_ID_FEATURE_SUPP] & (1 << 8))) #define ata_id_iordy_disable(id) ((id)[ATA_ID_CAPABILITY] & (1 << 10)) #define ata_id_has_iordy(id) ((id)[ATA_ID_CAPABILITY] & (1 << 11)) #define ata_id_u32(id,n) \ @@ -593,7 +597,6 @@ struct ata_bmdma_prd { #define ata_id_cdb_intr(id) (((id)[ATA_ID_CONFIG] & 0x60) == 0x20) #define ata_id_has_da(id) ((id)[ATA_ID_SATA_CAPABILITY_2] & (1 << 4)) -#define ata_id_has_devslp(id) ((id)[ATA_ID_FEATURE_SUPP] & (1 << 8)) #define ata_id_has_ncq_autosense(id) \ ((id)[ATA_ID_FEATURE_SUPP] & (1 << 7)) From patchwork Mon Oct 24 11:30:57 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8790 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp430795wru; Mon, 24 Oct 2022 05:42:18 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4pGaYbgdb36NJP/qr9s4rs04xmX5qbT4s4IvK+X16PS9TlmeJRquhSKraxudwEdM6jQfPZ X-Received: by 2002:a63:6905:0:b0:43c:d4:eef4 with SMTP id e5-20020a636905000000b0043c00d4eef4mr27459564pgc.126.1666615338015; Mon, 24 Oct 2022 05:42:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666615338; cv=none; d=google.com; s=arc-20160816; b=dBfg4y6sCbzCLprcEOBY4dDAJu3m9baKWHvzcEG7EMpNjO7FgYEEqaG93ISh/WjtoK PknLieSvq47NyPhnrNR6fnCAVg39DKqmP22cOaO2iU7ooDaYZEzsejdEM6t1s+nAGaZR aNrWknrqr8JU0JXX35i4eR/vL5wwYkJpG5nwiGMk54pjXq1Lle9FEH1a8uElFk1wPPVm h2VfbfslhaNnv/ix1Z/zpep+xmNlvnpIAuVYclFRP+Eywzdz4PwEs00lp9hqnkJlhMgR YxAZbKF1QdCvP83sWyPabyEOdCVPS7HF+/ngD4/ONwViQXVg6Np1w4q/6lURptugurcP f9RA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=lsToZmSSmxrrFoFRgZa6HF1gkBKBpkryyzz73loL2lY=; b=iMm9olpZCjN9e5tHqwoSmJAMnrKY/7Gx1Io2dPM3rSp4bN7HGbkU0kQ13ZjdLRlV3A TLCV6D8mjoRgjaURYCcplFp73fTO9zIvCVwpmFnrPLDv1/F9yUwIIP8IFB3wOQhLfc/y c2a1ZTlfIrOW7371zvquLOb6jupsJ0tqsMSo9H/4PJ490QlkRhMUIsh+hDthWhE3ot24 jAOqy85reK3xE6bqs0Y8cp57qQK4Dg2xriW+1RgGr+XBcHd/wAALensSrceoVaMLW2ke YwFrOirzwDJUoAsfCGnYyK/NIQtV917Ry30hQEwfeCoh3UsTTXnetG9JSk1Mc045lpnB AFKQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=qyYDQn2w; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 184-20020a6301c1000000b00430b25c0134si35412849pgb.670.2022.10.24.05.42.03; Mon, 24 Oct 2022 05:42:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=qyYDQn2w; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234071AbiJXMde (ORCPT + 99 others); Mon, 24 Oct 2022 08:33:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50798 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234101AbiJXM3T (ORCPT ); Mon, 24 Oct 2022 08:29:19 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3EE9E87FA3; Mon, 24 Oct 2022 05:03:08 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 0A1F261218; Mon, 24 Oct 2022 12:00:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 14DF8C433D6; Mon, 24 Oct 2022 12:00:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612838; bh=CeT01rwLGLjkl4e/fWPUskf9NHJHNfiQIznTZ/SXcKg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qyYDQn2wqkdg5eoMmEn5tukil0Ubr2J5/livMDNVGYCf1CdKLnmYwRY6KPNrzisL/ mNM1PjItz0G234+7Sf7tFoeh1dSEOhp9IeTCk4b6V8GXabpimbbk1AePe3ttyNit2X MnXASXffj/vfatmnkGHYsOwWigINubkT8fvRIQvI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Niklas Cassel , Damien Le Moal , Sasha Levin Subject: [PATCH 4.19 138/229] ata: fix ata_id_has_ncq_autosense() Date: Mon, 24 Oct 2022 13:30:57 +0200 Message-Id: <20221024113003.482595323@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747572844777912133?= X-GMAIL-MSGID: =?utf-8?q?1747572844777912133?= From: Niklas Cassel [ Upstream commit a5fb6bf853148974dbde092ec1bde553bea5e49f ] ACS-5 section 7.13.6.36 Word 78: Serial ATA features supported states that: If word 76 is not 0000h or FFFFh, word 78 reports the features supported by the device. If this word is not supported, the word shall be cleared to zero. (This text also exists in really old ACS standards, e.g. ACS-3.) Additionally, move the macro to the other ATA_ID_FEATURE_SUPP macros (which already have this check), thus making it more likely that the next ATA_ID_FEATURE_SUPP macro that is added will include this check. Fixes: 5b01e4b9efa0 ("libata: Implement NCQ autosense") Signed-off-by: Niklas Cassel Signed-off-by: Damien Le Moal Signed-off-by: Sasha Levin --- include/linux/ata.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/include/linux/ata.h b/include/linux/ata.h index e9d24a23c0aa..cfdaa08c45c9 100644 --- a/include/linux/ata.h +++ b/include/linux/ata.h @@ -585,6 +585,10 @@ struct ata_bmdma_prd { ((((id)[ATA_ID_SATA_CAPABILITY] != 0x0000) && \ ((id)[ATA_ID_SATA_CAPABILITY] != 0xffff)) && \ ((id)[ATA_ID_FEATURE_SUPP] & (1 << 8))) +#define ata_id_has_ncq_autosense(id) \ + ((((id)[ATA_ID_SATA_CAPABILITY] != 0x0000) && \ + ((id)[ATA_ID_SATA_CAPABILITY] != 0xffff)) && \ + ((id)[ATA_ID_FEATURE_SUPP] & (1 << 7))) #define ata_id_iordy_disable(id) ((id)[ATA_ID_CAPABILITY] & (1 << 10)) #define ata_id_has_iordy(id) ((id)[ATA_ID_CAPABILITY] & (1 << 11)) #define ata_id_u32(id,n) \ @@ -597,8 +601,6 @@ struct ata_bmdma_prd { #define ata_id_cdb_intr(id) (((id)[ATA_ID_CONFIG] & 0x60) == 0x20) #define ata_id_has_da(id) ((id)[ATA_ID_SATA_CAPABILITY_2] & (1 << 4)) -#define ata_id_has_ncq_autosense(id) \ - ((id)[ATA_ID_FEATURE_SUPP] & (1 << 7)) static inline bool ata_id_has_hipm(const u16 *id) { From patchwork Mon Oct 24 11:30:58 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8958 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp436352wru; Mon, 24 Oct 2022 05:57:02 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7opJfEyNa2V6dwOiYY3u+AfnX4qt9yRsRf6b3t+aZRVgix+oG3PUefESrq3r8QMBzKiRRm X-Received: by 2002:a17:902:b788:b0:186:a810:4072 with SMTP id e8-20020a170902b78800b00186a8104072mr5378454pls.86.1666616222484; Mon, 24 Oct 2022 05:57:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666616222; cv=none; d=google.com; s=arc-20160816; b=0XQd23uP2+Nx4VZT6+6XkxCEyIVkgoJ3LAUCMUQtHy0LU+Kn4qhj/pPsidG9xSWQHX hPJ5DRLZF1UQN6fEWM7rtWAZmZzhFblQnrBNyIVOk4UWOyERf57aAJOERIhsFFax7Ega 0UHPMj3O6MU4QOUVFbx/6TA2+X8Ed6Zb4lXIH0Amg+WziJX70d3CctZNRKcUxZkDe8Rd ywpB+ZDb7MoY0ms+GNm8oyukxtON1BvI2yA9YF9Rf4EnkNnV6AAQL8AStE/Kp+lYyCZ6 4sq6JK4EJ2he5fJYZ0hRLHqbSkE5Rpw45MRwAKhYz7n+iQP+54J1i+Q5+q947zf7koPh lGiA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=r5fOzcx2v2u8TuCA7PyHBrcAQKd8+oyKGcCuiEQ6n4g=; b=Nq5uC/StR0GOI0ts4kHV0KrtXWfXGv3kHGSSP71gmu/XNp+AdrUpuHVhSCJocRC8Y1 4FFEV6mgLKI6Ip98+ri2LER12u/h8MESpy4iRQ8JdoZsyviaAFi2taknya0UlLDpx0C6 FoNyqZJANrVScxZbzAllyPDB4Eh8AkzCOk8xqjlv7PE/rq29muonUD54PVrx5Bh6+6Pr pXV7wRA0CpTXZtfc72xJz4u+vGiIm0uTGrLjplnvrMpymo6XXTj0q5fLzj6ct6d1gi5N v5jE9M4IqqWUh+0i2f04eDhormIyIHxBoAZdhxGya2GE33xOlhTCS6TjS5zuGHUHkLhT n+mQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=uECIHQfm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l19-20020a635713000000b0046b208f6affsi30558949pgb.621.2022.10.24.05.56.47; Mon, 24 Oct 2022 05:57:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=uECIHQfm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234793AbiJXMzw (ORCPT + 99 others); Mon, 24 Oct 2022 08:55:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42990 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234788AbiJXMzK (ORCPT ); Mon, 24 Oct 2022 08:55:10 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BE0622DA88; Mon, 24 Oct 2022 05:15:13 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 9EB92612A0; Mon, 24 Oct 2022 12:00:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B472BC433C1; Mon, 24 Oct 2022 12:00:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612841; bh=0p4oaz3Q4XCXQAKF7VEiqqlMGv8Mr3Qg+CRmh0XHpks=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uECIHQfmZDA09uL7oxOugupt1tK3T2d/w+L/77/FPJkNJ8QNXtLLMP7EUJGDGv1hv GUW2AOTWYx+6dx7R1Cm14nlQzR+77+vEf0DcckxR22mf1o3rwMnpddcb4dgoPlynNu Se6M2UlM9ZHb99x23FmaniV8/h9cmTzpX6Jqlf3Y= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Niklas Cassel , Damien Le Moal , Sasha Levin Subject: [PATCH 4.19 139/229] ata: fix ata_id_has_dipm() Date: Mon, 24 Oct 2022 13:30:58 +0200 Message-Id: <20221024113003.511671935@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747573772250626039?= X-GMAIL-MSGID: =?utf-8?q?1747573772250626039?= From: Niklas Cassel [ Upstream commit 630624cb1b5826d753ac8e01a0e42de43d66dedf ] ACS-5 section 7.13.6.36 Word 78: Serial ATA features supported states that: If word 76 is not 0000h or FFFFh, word 78 reports the features supported by the device. If this word is not supported, the word shall be cleared to zero. (This text also exists in really old ACS standards, e.g. ACS-3.) The problem with ata_id_has_dipm() is that the while it performs a check against 0 and 0xffff, it performs the check against ATA_ID_FEATURE_SUPP (word 78), the same word where the feature bit is stored. Fix this by performing the check against ATA_ID_SATA_CAPABILITY (word 76), like required by the spec. The feature bit check itself is of course still performed against ATA_ID_FEATURE_SUPP (word 78). Additionally, move the macro to the other ATA_ID_FEATURE_SUPP macros (which already have this check), thus making it more likely that the next ATA_ID_FEATURE_SUPP macro that is added will include this check. Fixes: ca77329fb713 ("[libata] Link power management infrastructure") Signed-off-by: Niklas Cassel Signed-off-by: Damien Le Moal Signed-off-by: Sasha Levin --- include/linux/ata.h | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/include/linux/ata.h b/include/linux/ata.h index cfdaa08c45c9..981eb1cb7e49 100644 --- a/include/linux/ata.h +++ b/include/linux/ata.h @@ -589,6 +589,10 @@ struct ata_bmdma_prd { ((((id)[ATA_ID_SATA_CAPABILITY] != 0x0000) && \ ((id)[ATA_ID_SATA_CAPABILITY] != 0xffff)) && \ ((id)[ATA_ID_FEATURE_SUPP] & (1 << 7))) +#define ata_id_has_dipm(id) \ + ((((id)[ATA_ID_SATA_CAPABILITY] != 0x0000) && \ + ((id)[ATA_ID_SATA_CAPABILITY] != 0xffff)) && \ + ((id)[ATA_ID_FEATURE_SUPP] & (1 << 3))) #define ata_id_iordy_disable(id) ((id)[ATA_ID_CAPABILITY] & (1 << 10)) #define ata_id_has_iordy(id) ((id)[ATA_ID_CAPABILITY] & (1 << 11)) #define ata_id_u32(id,n) \ @@ -612,17 +616,6 @@ static inline bool ata_id_has_hipm(const u16 *id) return val & (1 << 9); } -static inline bool ata_id_has_dipm(const u16 *id) -{ - u16 val = id[ATA_ID_FEATURE_SUPP]; - - if (val == 0 || val == 0xffff) - return false; - - return val & (1 << 3); -} - - static inline bool ata_id_has_fua(const u16 *id) { if ((id[ATA_ID_CFSSE] & 0xC000) != 0x4000) From patchwork Mon Oct 24 11:30:59 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8797 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp430853wru; Mon, 24 Oct 2022 05:42:23 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6lSTxNM4Yg4n4iRQZpOf5xQ+4QPSxoTMReX1DylXZCXGTmRl0taf4vt8AyxMnx8MU15+72 X-Received: by 2002:a17:903:509:b0:179:ffcf:d275 with SMTP id jn9-20020a170903050900b00179ffcfd275mr33338057plb.150.1666615343420; Mon, 24 Oct 2022 05:42:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666615343; cv=none; d=google.com; s=arc-20160816; b=dF9KE/GwwbwoX7uFMARR/opSuHUSZoTjq8Z2mOIuLcwfEwzpN6rKiDog3fdHsar6Ro erAWUDztqTqnV5SDl6PAACSmXU+KtOHULwR8V6tQgc7WuIy/o3bk1bvWOLFv9JwByH/S PF7ow8ZAM0nWsICyRAorVji1eRIO5EndFDe+YHscEHgsulkNJMQHsJAqgBe2I0qkeuGQ n9vrxj3v3TiCySiiHt+zNOsAiY99xPcbquAAtSrdtUDGl0QAlZ9YJJqaBXkFe9mcD/Tk 4cEaSdsMkO9LSk0ifTzYiN/wvPZp+36MjrQ2ldzrAG/y8/hZd/9V/y4R1zKv7uUbFSAW Vxmg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=NedJ22pXIoACFm4/7PLNMzOlpUI8VUifasZ57Z1/hqY=; b=m8UBZD/GdBWpadWtb/lFN2TxofgQ3Bfw0PQTPBdf3e0JnqD1HBcsBBMxiwWL8RT05J enL4Fnzn8m+xhCrj/pptMYZAiL5MnLWTuRdNXoVJnDzhekbDD5zH3PZNEJVnJdiXaDs5 h5t6upB5/r9g5fUdAIE54Dd6hSrf0r8efiVSVQz55OUcJGFvnGY6xrGJv9gIey4uZndu uROqfDhviGJwAFm2nk5cn8WpXTLgeDKnuaiI8KNG1w3R3TblZwEX/HozZ+QIuDGe736T ok8sfNZw/yDL/ccM4oG+p7bnyC+s49VK46efTCS0v0SdhpdnPus6rNUaqIOtf6W/Za1B e36w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=DHTm01rK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v10-20020a63b64a000000b00438e839828bsi35161970pgt.72.2022.10.24.05.42.07; Mon, 24 Oct 2022 05:42:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=DHTm01rK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234122AbiJXMeD (ORCPT + 99 others); Mon, 24 Oct 2022 08:34:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60580 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234152AbiJXM32 (ORCPT ); Mon, 24 Oct 2022 08:29:28 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6EB1788DCA; Mon, 24 Oct 2022 05:03:27 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id EDB91B811E0; Mon, 24 Oct 2022 12:00:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 51F3CC433D7; Mon, 24 Oct 2022 12:00:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612843; bh=chCnK0CTUE8MKF84sALHRdUDz6uWT3Lh249NPivG9qI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DHTm01rKIgI+yuO48s4aeQxaqpMO+hCwxRos3uJDAxrxsiuh3RHFdThKzgZlmQmxW As6p3ten/adgPboEhRM0IMjhvOLuW/nrl+kWcC1+55MleUxnaqycsbOm/kjAMV+bO6 QllOi8Xu9XOjeJupbv48lx63dHABgqiSk2eirRzM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Song Liu , Logan Gunthorpe , Sasha Levin Subject: [PATCH 4.19 140/229] md/raid5: Ensure stripe_fill happens on non-read IO with journal Date: Mon, 24 Oct 2022 13:30:59 +0200 Message-Id: <20221024113003.540404190@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747572850428401975?= X-GMAIL-MSGID: =?utf-8?q?1747572850428401975?= From: Logan Gunthorpe [ Upstream commit e2eed85bc75138a9eeb63863d20f8904ac42a577 ] When doing degrade/recover tests using the journal a kernel BUG is hit at drivers/md/raid5.c:4381 in handle_parity_checks5(): BUG_ON(!test_bit(R5_UPTODATE, &dev->flags)); This was found to occur because handle_stripe_fill() was skipped for stripes in the journal due to a condition in that function. Thus blocks were not fetched and R5_UPTODATE was not set when the code reached handle_parity_checks5(). To fix this, don't skip handle_stripe_fill() unless the stripe is for read. Fixes: 07e83364845e ("md/r5cache: shift complex rmw from read path to write path") Link: https://lore.kernel.org/linux-raid/e05c4239-41a9-d2f7-3cfa-4aa9d2cea8c1@deltatee.com/ Suggested-by: Song Liu Signed-off-by: Logan Gunthorpe Signed-off-by: Song Liu Signed-off-by: Sasha Levin --- drivers/md/raid5.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c index 6f04473f0838..3310f670a4ab 100644 --- a/drivers/md/raid5.c +++ b/drivers/md/raid5.c @@ -3723,7 +3723,7 @@ static void handle_stripe_fill(struct stripe_head *sh, * back cache (prexor with orig_page, and then xor with * page) in the read path */ - if (s->injournal && s->failed) { + if (s->to_read && s->injournal && s->failed) { if (test_bit(STRIPE_R5C_CACHING, &sh->state)) r5c_make_stripe_write_out(sh); goto out; From patchwork Mon Oct 24 11:31:00 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8832 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp431416wru; Mon, 24 Oct 2022 05:43:42 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4DciGBqt7hVOpri0rIdmfX9J16zzRThKJ7jLLUX+IzvxvHNiRaXOaC1KNAshjeElF3lCY3 X-Received: by 2002:a17:902:e94f:b0:17f:6df3:1a99 with SMTP id b15-20020a170902e94f00b0017f6df31a99mr33389304pll.20.1666615422064; Mon, 24 Oct 2022 05:43:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666615422; cv=none; d=google.com; s=arc-20160816; b=wTZtRZSMyd0oJEGP2DfXNyM+qREwPuUGLeA2+prsbumYzagNJmFHS+VhzedgEqqS2e kkJxCY+ftxRUuIWhnBMs7Lj99XleP4XSBhGvCCfze7m4etdtEz304D2Dr4QNo1Z/+Icf UvdCcg52qdvQWEzxb3tPM8O3nK9DEUGncDAcsTG6s2hLG8b7ueZtJ7l3vzIuyMaf0yLC piv9Jl1s6Z6p2rNoYH++XioD5WCsnifEipZY6ya8Cx/W/aIhFKdl5ttdgRF2oEiLr78i Y7pyAtCm2EFIXPOYRhn8OYJCWZhK+eHrTamxk5D+ei+2eA+wqvf5d3q3gF1pyCaVjr+7 HThQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=sXwx4JCDitQMNL5FzXXu06ummDcAMqODUk6jDvFqhUQ=; b=R8umuOAqWpWNMwvrIDgB4Ee54yD2jQS2c59WgMD9Z1f2ZQUJGZVsoyYgQ49sWPagOA Hyfv3G8Mw1/sW3rxuQ4IFj0KEIJlUFl8RefsunnlvNAMXKysds5KvBsI2OyHdA6XBwYq l9emmffB1rusZWYofsTqC28c5JAYyNfdRPkklWPDWxT9BRXIJT6FEN3S8pdE+vWz+SOQ HLGfV9cY0bYdTGfI3bXGFuLwAkq1kS93U6DT4LNDIG4p3TQkG4ty8W5BnD+nvDW+rtiD m+MDAladRkKplqt9AMMoBlJ3kdyTNOVPPAJQxTanaYhbkpLED+SJCfFIGEMuDe9cUBXa gubw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=oNKFBLLp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p30-20020a056a000a1e00b00565adc8a5f7si39585757pfh.1.2022.10.24.05.43.27; Mon, 24 Oct 2022 05:43:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=oNKFBLLp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234262AbiJXMei (ORCPT + 99 others); Mon, 24 Oct 2022 08:34:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52356 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234205AbiJXM3i (ORCPT ); Mon, 24 Oct 2022 08:29:38 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6225088DCE; Mon, 24 Oct 2022 05:03:36 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 8F92AB811D2; Mon, 24 Oct 2022 12:00:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E9FF7C433C1; Mon, 24 Oct 2022 12:00:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612846; bh=OP7fMCUKSjv6X/69OGF5nMzei0b9Q801AjD8wWBtoHU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oNKFBLLp/OwXH7+EsaS43/N2eFIogjX4PoJg+FjyP9GUhn9CUcRq3TDExV01TCJ6D u3nURUGJ/013TjgVmJQ+Dcbz3NDFP5A8uMjOlCkumE9FgoFqYHSBm+MPMQ2tGTWtU/ VAoPG1Hq/mbLS6pTdZSRkAdkzXP5fwml86eNP4HQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Artem S. Tashkinov" , Mario Limonciello , Mathias Nyman , Sasha Levin Subject: [PATCH 4.19 141/229] xhci: Dont show warning for reinit on known broken suspend Date: Mon, 24 Oct 2022 13:31:00 +0200 Message-Id: <20221024113003.579666945@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747572932992481293?= X-GMAIL-MSGID: =?utf-8?q?1747572932992481293?= From: Mario Limonciello [ Upstream commit 484d6f7aa3283d082c87654b7fe7a7f725423dfb ] commit 8b328f8002bc ("xhci: re-initialize the HC during resume if HCE was set") introduced a new warning message when the host controller error was set and re-initializing. This is expected behavior on some designs which already set `xhci->broken_suspend` so the new warning is alarming to some users. Modify the code to only show the warning if this was a surprising behavior to the XHCI driver. Link: https://bugzilla.kernel.org/show_bug.cgi?id=216470 Fixes: 8b328f8002bc ("xhci: re-initialize the HC during resume if HCE was set") Reported-by: Artem S. Tashkinov Signed-off-by: Mario Limonciello Signed-off-by: Mathias Nyman Link: https://lore.kernel.org/r/20220921123450.671459-4-mathias.nyman@linux.intel.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/usb/host/xhci.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c index 7fef6d9ed04f..3a1ed63d7334 100644 --- a/drivers/usb/host/xhci.c +++ b/drivers/usb/host/xhci.c @@ -1155,7 +1155,8 @@ int xhci_resume(struct xhci_hcd *xhci, bool hibernated) /* re-initialize the HC on Restore Error, or Host Controller Error */ if (temp & (STS_SRE | STS_HCE)) { reinit_xhc = true; - xhci_warn(xhci, "xHC error in resume, USBSTS 0x%x, Reinit\n", temp); + if (!xhci->broken_suspend) + xhci_warn(xhci, "xHC error in resume, USBSTS 0x%x, Reinit\n", temp); } if (reinit_xhc) { From patchwork Mon Oct 24 11:31:01 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9087 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp445831wru; Mon, 24 Oct 2022 06:13:14 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6r+3NyIMpunyQBzQgGskj8qyAta35F+yPDpBnjUQhOiD9ajzHqyF/QYFvbNXLBZFAA7278 X-Received: by 2002:a63:c117:0:b0:46b:208e:fd76 with SMTP id w23-20020a63c117000000b0046b208efd76mr28600600pgf.577.1666617194280; Mon, 24 Oct 2022 06:13:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666617194; cv=none; d=google.com; s=arc-20160816; b=BI8mEVdXeY9abowJDkzPG1uq0jRjnme5kXM2pzWBOJLYkWy93p13Uw1W4/IA/1X5DJ NVi20xE5/J+9SRwdQehvdkmOlandPXUw3AKNz7xLif/f/VWlZ0CgOWNu2DjKRAmZtFd6 /Vn/K53zIdeous0HhjrwIA5vTM0d7S7OuIjulT7ra9ho3WlaeXvaqny01WOREalmSdvD 3M/cQciMxWFcFqmSseJuFd3myimT9i0TtAY57cHwW55JeQf3uQQkAEbkcXGutNW39hYA 1d2aaiBCGB3FNfG+OtaixF6tNJQ1TXBKmYZSdODBZsR3XhSjQqPiaEmYKfipyIDAziO6 +w2Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=6mvQY2Q8JHJnrTgCD4CXvbtWrnxMW+ygr2dJrEEVEBA=; b=y7WkRgZJm2WLT9txf7rxosOAsXm0Qy+0cSXKMFIVEpxWgXgqmsr0ms6BtnViApbD4m HQ/QuITQ7j8t0EXW4VTgUxY+K2MDaT+avyQpBgxSLa+rhgwuNNllV7+VIzTDKoUltZCX VqY0yLLgsbryETYRXIttMi5IgWMp6d1HqipwbY7xC7XNbtsO72yksWJVCyaJzEreyfsm sXoeMyVYqDHPzrGM9aG2ToPF6aEMOQuG0pHVd13+R4f9Byx/+WjVcyPzQJ2WVDBfgIpI UdZIgPsgzsV+jEBXAlvkSYcCvz1deji2o/WIKJ0i/FKPYGrjmDlOQrqojtmcGWdaH4QZ Wu4g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=LdyxAuEg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 191-20020a6302c8000000b0046ecbfda052si10327628pgc.389.2022.10.24.06.12.59; Mon, 24 Oct 2022 06:13:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=LdyxAuEg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235745AbiJXNMk (ORCPT + 99 others); Mon, 24 Oct 2022 09:12:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39284 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235970AbiJXNKS (ORCPT ); Mon, 24 Oct 2022 09:10:18 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 371231114A; Mon, 24 Oct 2022 05:24:05 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 77EFA61297; Mon, 24 Oct 2022 12:00:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 85C4DC433D6; Mon, 24 Oct 2022 12:00:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612848; bh=ZFD043lCmEwcZ86aV03p+0CQjj0aQci3UHQTAIeDJbo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LdyxAuEg/7jtwKYg2xU/Kkeiz0mmOT/aTBmMxvTRL9NzrJ3pOWth/KDD2kNWELAVc HSepaDqgP9bVEhBDszJke4HfO/uXVPzy8mjyPdZJjw3M79DzvOd5kTT1IDz7AUzfqz CUFqZRKUB55LZLReI0F7HxAuSiZLx1GQ4Ln+kwdU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Albert Briscoe , Sasha Levin Subject: [PATCH 4.19 142/229] usb: gadget: function: fix dangling pnp_string in f_printer.c Date: Mon, 24 Oct 2022 13:31:01 +0200 Message-Id: <20221024113003.609318093@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747574790933479901?= X-GMAIL-MSGID: =?utf-8?q?1747574790933479901?= From: Albert Briscoe [ Upstream commit 24b7ba2f88e04800b54d462f376512e8c41b8a3c ] When opts->pnp_string is changed with configfs, new memory is allocated for the string. It does not, however, update dev->pnp_string, even though the memory is freed. When rquesting the string, the host then gets old or corrupted data rather than the new string. The ieee 1284 id string should be allowed to change while the device is connected. The bug was introduced in commit fdc01cc286be ("usb: gadget: printer: Remove pnp_string static buffer"), which changed opts->pnp_string from a char[] to a char*. This patch changes dev->pnp_string from a char* to a char** pointing to opts->pnp_string. Fixes: fdc01cc286be ("usb: gadget: printer: Remove pnp_string static buffer") Signed-off-by: Albert Briscoe Link: https://lore.kernel.org/r/20220911223753.20417-1-albertsbriscoe@gmail.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/usb/gadget/function/f_printer.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/usb/gadget/function/f_printer.c b/drivers/usb/gadget/function/f_printer.c index 2a1868b2d24c..dd5eb6202fe1 100644 --- a/drivers/usb/gadget/function/f_printer.c +++ b/drivers/usb/gadget/function/f_printer.c @@ -87,7 +87,7 @@ struct printer_dev { u8 printer_cdev_open; wait_queue_head_t wait; unsigned q_len; - char *pnp_string; /* We don't own memory! */ + char **pnp_string; /* We don't own memory! */ struct usb_function function; }; @@ -963,16 +963,16 @@ static int printer_func_setup(struct usb_function *f, if ((wIndex>>8) != dev->interface) break; - if (!dev->pnp_string) { + if (!*dev->pnp_string) { value = 0; break; } - value = strlen(dev->pnp_string); + value = strlen(*dev->pnp_string); buf[0] = (value >> 8) & 0xFF; buf[1] = value & 0xFF; - memcpy(buf + 2, dev->pnp_string, value); + memcpy(buf + 2, *dev->pnp_string, value); DBG(dev, "1284 PNP String: %x %s\n", value, - dev->pnp_string); + *dev->pnp_string); break; case GET_PORT_STATUS: /* Get Port Status */ @@ -1435,7 +1435,7 @@ static struct usb_function *gprinter_alloc(struct usb_function_instance *fi) kref_init(&dev->kref); ++opts->refcnt; dev->minor = opts->minor; - dev->pnp_string = opts->pnp_string; + dev->pnp_string = &opts->pnp_string; dev->q_len = opts->q_len; mutex_unlock(&opts->lock); From patchwork Mon Oct 24 11:31:02 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8841 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp431587wru; Mon, 24 Oct 2022 05:44:15 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6yWeX4FHhokTOSxutsZUsxHah/OhXTHquBbhxp9uLzKQhQPba9FlsWqRgnd6z41A/9GR2Y X-Received: by 2002:a63:1b58:0:b0:45f:e7ba:a223 with SMTP id b24-20020a631b58000000b0045fe7baa223mr27035349pgm.548.1666615454854; Mon, 24 Oct 2022 05:44:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666615454; cv=none; d=google.com; s=arc-20160816; b=UU1aJo8p93FnDb2gZC2TPgRzzHQP00+rIJpCZQ81iGFx1foiLy5qnWKzZOq0ETLa1x evP4tq/NFYiFtDYH8PlVMn0tepLSJR0sQ+IwGD1LGFtRlnPSNg4CG2lMsU+uI0TarPpY sF06/QlF13JmUdsNhb0IuJYxJKOw//4GS3bsSLRE3I6wGLLzx0JQF9+L4Uczoeqk8uDi SugBb6kKrZUNYCXbYGKiDWbjKIF5/7nfdyOk2eQW9zR2H8umQ84BLszb0EiMbPxNjS34 Ed/bqIttjFSjouWsyQEm3qu5hONG6DcZPua73qPJ8qachv2ZfKQMEhMNl1yV494lMjTi 3Ldw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=x7gSp2HSRdjoYghO2cgua/liE+dvyKeoWzhmuAomQwk=; b=N0d7VE4pe4XoQccs/zZMrAI5uTuWlaiLg5i1R4ugxvUBiZYtdtdUHCA9MH8mYzoFVg NnKQNJIVPdgnSntyhhVZhk9jduNlVItabgIRqWn4XWyIBg0WlD6YyqFBKsfUJxlJQFG2 3qwQpc7wEh3YSHtOvAlwtYcCZBKJmxeRBJMEkEdYZLWFalf07M5Jl+2Ivh5lccA2Bg8e r3aAAfA0trBK07SKvpCE3ANcX1Sj2OatmgScF8+yzLNlD4ERrie2cexoki5CuSUw8du9 mUgoiOt48xHy1gmEz+c4f90oEYrKnYSJpEfZjZ/jxXY90orScnmhUpwFOCsithLtX3Tj sNrQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=GpdtwrXu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v7-20020a634647000000b00455db4531c5si35157389pgk.486.2022.10.24.05.43.58; Mon, 24 Oct 2022 05:44:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=GpdtwrXu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234642AbiJXMfi (ORCPT + 99 others); Mon, 24 Oct 2022 08:35:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53744 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234259AbiJXM3w (ORCPT ); Mon, 24 Oct 2022 08:29:52 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 37710895CB; Mon, 24 Oct 2022 05:03:39 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id CCDF7B81188; Mon, 24 Oct 2022 12:00:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2B2D6C433C1; Mon, 24 Oct 2022 12:00:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612851; bh=NwiRgoGNNgwSk51Vc6rEQuhFQM5Y9IwYt/EDlaVrrCg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GpdtwrXu7CUE3Z2O7TYMhuW+TqY3a+XO/I+cpnNQ4DGWt1lxwIoH13B1CrbsnVBMO wXp0KCyib701ioeG6btZZzuY+h6GPq1olat5Jk2QsBQJqHir39m2DRvy+bdCMSGFtI RaZQYtGJr3blDxMG10DvttGYwIyIPj6aJ0Hhk3ns= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dan Carpenter , Sasha Levin Subject: [PATCH 4.19 143/229] drivers: serial: jsm: fix some leaks in probe Date: Mon, 24 Oct 2022 13:31:02 +0200 Message-Id: <20221024113003.637923278@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747572967537148566?= X-GMAIL-MSGID: =?utf-8?q?1747572967537148566?= From: Dan Carpenter [ Upstream commit 1d5859ef229e381f4db38dce8ed58e4bf862006b ] This error path needs to unwind instead of just returning directly. Fixes: 03a8482c17dd ("drivers: serial: jsm: Enable support for Digi Classic adapters") Signed-off-by: Dan Carpenter Link: https://lore.kernel.org/r/YyxFh1+lOeZ9WfKO@kili Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/tty/serial/jsm/jsm_driver.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/tty/serial/jsm/jsm_driver.c b/drivers/tty/serial/jsm/jsm_driver.c index 592e51d8944e..07e9be9865c7 100644 --- a/drivers/tty/serial/jsm/jsm_driver.c +++ b/drivers/tty/serial/jsm/jsm_driver.c @@ -212,7 +212,8 @@ static int jsm_probe_one(struct pci_dev *pdev, const struct pci_device_id *ent) break; default: - return -ENXIO; + rc = -ENXIO; + goto out_kfree_brd; } rc = request_irq(brd->irq, brd->bd_ops->intr, IRQF_SHARED, "JSM", brd); From patchwork Mon Oct 24 11:31:03 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 10014 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp619097wru; Mon, 24 Oct 2022 12:35:40 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7v1DBGs8yHwjN83mJpIfEET9KLC2HSXwiNqvTnxgKifj25vxY7pO+FM22/OOUU4e6ahOVN X-Received: by 2002:a17:903:244d:b0:183:afb6:e7ea with SMTP id l13-20020a170903244d00b00183afb6e7eamr35161704pls.31.1666640140607; Mon, 24 Oct 2022 12:35:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666640140; cv=none; d=google.com; s=arc-20160816; b=Enj9zSW1/KrVqmxMwnB6lgu3F6qmfy2bv1vwN7coh3oGrnBStlQK3Ms4OSHqML87Io kASE+It8DbE5oRolE1JkOemzLcoXcJyouYkNbjnY1uvrOlEvyxIF+gRchZvWP51qjxb7 G0dWOWK/QtBAnn790d8aSauuMkphW+y87v4iqA4lBKXXwMK/cMoRADeBVXDpgQJst4lT 3F54YOgWGMxVG0h/sOFlazGdNnmfUYiRICoi06O7mB8utvv9NtDFsHW3ZjUDWEtwfub1 DWELMVFVtzuoMm8pR+x3922Nxkvog5UeLbctVygAjIFCQFT+MGWqM6EY8iCbQ9Ks/Ysq xdLA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=nqQ4P/J9VtkX4z2cLrkC0D//fkBrc2+EHdZKZ8z03H4=; b=MvQMNPB/x06gx1XNgIYwVMm6p3KANeKUnfYFy3I+4DzKeA6iN4FBV9E3/jaWAPxKqE Jsvl52s+aZwk97oGyKuAyWKa0PYEZnXeuBY+CeINQpEiIkcvYv0mYgTeum9KZIdZSI1j LeVB8I0yF6ekcMueXhpO7c1Zg6eAeTzewrq2lkDdooKK4BFrU5ukNd7HpzD+6ROlf5MO 5wtyKvMuEYsxcYhBGn/bPw88c9B4fue49EGX217Jg14pbAib9TnWf0btZi4p0KSc0eaz OmMUr4tmifrLlz44ffww3GQ6ln8mUYulFcQNSGgzOWFly2acGmcrkPbINg5yxJ6Rwol5 iJ+A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=aa+AskcP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r20-20020a170902c7d400b0018693297257si256437pla.624.2022.10.24.12.35.27; Mon, 24 Oct 2022 12:35:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=aa+AskcP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233197AbiJXTfE (ORCPT + 99 others); Mon, 24 Oct 2022 15:35:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60800 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233507AbiJXTeS (ORCPT ); Mon, 24 Oct 2022 15:34:18 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9151089834; Mon, 24 Oct 2022 11:04:57 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 6DF53B811D5; Mon, 24 Oct 2022 12:00:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C78BDC43141; Mon, 24 Oct 2022 12:00:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612854; bh=se1kNYoyh1c3+l4JRa6OE9QKY6HWsSzNgEKBIgh4c+U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=aa+AskcPi/EVwCI2p6wmB10hxFPCPvuQswVMapXGxGlxoKGBECkDlnK5KRP9zwcYD tNpJ8hUM3RUarXC1NCJp7mKw97gt22j/L5jRT9LkCydyftGLA1uKzdh/5m4eJwFjfa 9XG4OFn/zMAPIxXgJpR4pWyI6SWPHhiW+6xU7c00= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dongliang Mu , Neil Armstrong , Vinod Koul , Sasha Levin Subject: [PATCH 4.19 144/229] phy: qualcomm: call clk_disable_unprepare in the error handling Date: Mon, 24 Oct 2022 13:31:03 +0200 Message-Id: <20221024113003.671920692@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747598851872246861?= X-GMAIL-MSGID: =?utf-8?q?1747598851872246861?= From: Dongliang Mu [ Upstream commit c3966ced8eb8dc53b6c8d7f97d32cc8a2107d83e ] Smatch reports the following error: drivers/phy/qualcomm/phy-qcom-usb-hsic.c:82 qcom_usb_hsic_phy_power_on() warn: 'uphy->cal_clk' from clk_prepare_enable() not released on lines: 58. drivers/phy/qualcomm/phy-qcom-usb-hsic.c:82 qcom_usb_hsic_phy_power_on() warn: 'uphy->cal_sleep_clk' from clk_prepare_enable() not released on lines: 58. drivers/phy/qualcomm/phy-qcom-usb-hsic.c:82 qcom_usb_hsic_phy_power_on() warn: 'uphy->phy_clk' from clk_prepare_enable() not released on lines: 58. Fix this by calling proper clk_disable_unprepare calls. Fixes: 0b56e9a7e835 ("phy: Group vendor specific phy drivers") Signed-off-by: Dongliang Mu Reviewed-by: Neil Armstrong Link: https://lore.kernel.org/r/20220914051334.69282-1-dzm91@hust.edu.cn Signed-off-by: Vinod Koul Signed-off-by: Sasha Levin --- drivers/phy/qualcomm/phy-qcom-usb-hsic.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/phy/qualcomm/phy-qcom-usb-hsic.c b/drivers/phy/qualcomm/phy-qcom-usb-hsic.c index c110563a73cb..00926df4bc5b 100644 --- a/drivers/phy/qualcomm/phy-qcom-usb-hsic.c +++ b/drivers/phy/qualcomm/phy-qcom-usb-hsic.c @@ -57,8 +57,10 @@ static int qcom_usb_hsic_phy_power_on(struct phy *phy) /* Configure pins for HSIC functionality */ pins_default = pinctrl_lookup_state(uphy->pctl, PINCTRL_STATE_DEFAULT); - if (IS_ERR(pins_default)) - return PTR_ERR(pins_default); + if (IS_ERR(pins_default)) { + ret = PTR_ERR(pins_default); + goto err_ulpi; + } ret = pinctrl_select_state(uphy->pctl, pins_default); if (ret) From patchwork Mon Oct 24 11:31:04 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8810 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp431004wru; Mon, 24 Oct 2022 05:42:43 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6lx1ih4dQiVonO4gyec3TMwZsQsGNvmudSgadYwzqppIMb0uO8+6LAk/QPldOsDZAJAZsP X-Received: by 2002:a05:6402:1947:b0:461:a47d:274 with SMTP id f7-20020a056402194700b00461a47d0274mr7350217edz.165.1666615363615; Mon, 24 Oct 2022 05:42:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666615363; cv=none; d=google.com; s=arc-20160816; b=ARE0uapSyNztrGnH3wN5h8Af7zsh4TWnd8AXrycTW8jtz3vcNE92FUeBmEZ5jcVwbQ flM6p0/GAQ9eta3fPZ3c2gUbY/77mmI4RChrC5hh/36/LN/ZiRhie6f9doYTXafoP4Oi 4hRIo8FhOo+Jnz3QEmbKxv63HAVvXLwJ/dA4xWarOykibFcRNIz6nEfOHXgf0werz/0i DIr0Bwv4Q7jPiAffiHPkkKs3fqzzRPlHRwA42m0ciykoYwWB9pV4mUPBrZMxCAMuBR40 FMU+wkxxwC6HsRaE0ZXM4fRYMd0ILvZhUAByqvckaUMvIYPpcpkdPRdiwk6Ckk6SsELq Oqkw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=on2Mg0ifTQsirRnYi4bN2rWD/WLsfEqrb8M2DOT3cKM=; b=l1YyqHh4Q+YxOJdX59WFDlrNN6Xmusi2g67aRVoBzL772ZOdj7UQzU6/hnMTJ0BjOe vvff5+zK0GrqWTusjA+1vcBtyxNBC3ozAiagGCAycFemtUtR7cchS+eFuEU3egvRCv4Q 9jTullDI9tA7rg+QuKl6BrKaWG5AqFLoZHuqLYPlZoLSqknkap7OKHK2R5Si0RofQjUo caXo4i0Z8vivMdve/VI31RIAv73GW6kbS1YnI4tMbnK2TuopXOvpkKTgg19Rgf1fpK2R 7RrsTLGCGrrxyvByzlKfTI4eff1e6fLF30XIWcGsmt+KjToWw4sqkTHbAUXfR59IU3Mh gkGQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=VGPwWUoc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o8-20020a170906974800b0073db512d918si27903135ejy.765.2022.10.24.05.42.18; Mon, 24 Oct 2022 05:42:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=VGPwWUoc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234361AbiJXMey (ORCPT + 99 others); Mon, 24 Oct 2022 08:34:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50796 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234223AbiJXM3k (ORCPT ); Mon, 24 Oct 2022 08:29:40 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 697CE85A8A; Mon, 24 Oct 2022 05:03:41 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id DC718B81202; Mon, 24 Oct 2022 12:01:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3F594C433C1; Mon, 24 Oct 2022 12:00:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612859; bh=X4ILSxOO+PtPkQ3PRZOz5fy7LXio65AbI2CUs50rEmA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VGPwWUoc0/ZCSY6d4c2w2Dux0ctz1BVcD6DJ6BffVT4JPNCu9UIRHl8EfuiZg5PS1 WyvCM81apAvRGvoQveGIAHf2s6kEi4DLbwKzU6XVf2d40Pc8fTkZocIL3Gp5pTlNOP TI7vJS0VLtdIJu2k5A1aaC7llwbRAyXeQ9wZGmcI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dan Carpenter , Philipp Hortmann , Nam Cao , Sasha Levin Subject: [PATCH 4.19 145/229] staging: vt6655: fix some erroneous memory clean-up loops Date: Mon, 24 Oct 2022 13:31:04 +0200 Message-Id: <20221024113003.706003076@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747572871862793041?= X-GMAIL-MSGID: =?utf-8?q?1747572871862793041?= From: Nam Cao [ Upstream commit 2a2db520e3ca5aafba7c211abfd397666c9b5f9d ] In some initialization functions of this driver, memory is allocated with 'i' acting as an index variable and increasing from 0. The commit in "Fixes" introduces some clean-up codes in case of allocation failure, which free memory in reverse order with 'i' decreasing to 0. However, there are some problems: - The case i=0 is left out. Thus memory is leaked. - In case memory allocation fails right from the start, the memory freeing loops will start with i=-1 and invalid memory locations will be accessed. One of these loops has been fixed in commit c8ff91535880 ("staging: vt6655: fix potential memory leak"). Fix the remaining erroneous loops. Link: https://lore.kernel.org/linux-staging/Yx9H1zSpxmNqx6Xc@kadam/ Fixes: 5341ee0adb17 ("staging: vt6655: check for memory allocation failures") Reported-by: Dan Carpenter Tested-by: Philipp Hortmann Signed-off-by: Nam Cao Link: https://lore.kernel.org/r/20220912170429.29852-1-namcaov@gmail.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/staging/vt6655/device_main.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/vt6655/device_main.c b/drivers/staging/vt6655/device_main.c index 76f434c1c088..cf86b1efa821 100644 --- a/drivers/staging/vt6655/device_main.c +++ b/drivers/staging/vt6655/device_main.c @@ -567,7 +567,7 @@ static int device_init_rd0_ring(struct vnt_private *priv) kfree(desc->rd_info); err_free_desc: - while (--i) { + while (i--) { desc = &priv->aRD0Ring[i]; device_free_rx_buf(priv, desc); kfree(desc->rd_info); @@ -613,7 +613,7 @@ static int device_init_rd1_ring(struct vnt_private *priv) kfree(desc->rd_info); err_free_desc: - while (--i) { + while (i--) { desc = &priv->aRD1Ring[i]; device_free_rx_buf(priv, desc); kfree(desc->rd_info); @@ -717,7 +717,7 @@ static int device_init_td1_ring(struct vnt_private *priv) return 0; err_free_desc: - while (--i) { + while (i--) { desc = &priv->apTD1Rings[i]; kfree(desc->td_info); } From patchwork Mon Oct 24 11:31:05 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8806 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp430928wru; Mon, 24 Oct 2022 05:42:33 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6iPjOjw+0wmA/11Ptqiv1Q6GQ/1pePH/ssijF9nMzTTpCqs/WEwayP5Aik2Ts/f+HUupZ1 X-Received: by 2002:a17:90a:b00a:b0:213:623:2c12 with SMTP id x10-20020a17090ab00a00b0021306232c12mr7105418pjq.153.1666615352916; Mon, 24 Oct 2022 05:42:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666615352; cv=none; d=google.com; s=arc-20160816; b=OBlGfSSQT3ZDb9lnOh76guaqE0P3jLoT3xIZb9nw6S5nFNVqOlI7XaeTDsZsVGE9Hi LlE75VSKDFaUyLSsfhIb9kiZwpjb6RFli87gIyWddYLMZXWxRw7g7m1+mr0YqdnqlKpF 28UeyyZjKaUdUWCbxDC8bgtDLqMAOrmAeEfYeExfICVYqJrSuyWaxusWs3Vxcft5Gsi3 8SQvRlvXRBrHFfMa/QeGmOUk0IolEL2hrmzDHRlYP6SOpb4ViJ5BSXTFvZEGtGHLZltN J84UGEyrXA1GNGPsUm49V4MiZgKBQr6NPey+DPqdRRXzpp+mptVKJb9QnhNu8c+Kvggd WEtA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=GnJpkuClr5zuRENPkKpllEHzXugCqzTNJizcrXcdXYc=; b=hhmVZoowEWrJE1Fj5DwWYLkYREG8Aanp1kZVAO4dL1jCkIW8SlKdgoGpfyvsxvpwGh DT7WNGUzHYwuZYQ3d2tAxgfpl9SXvPWTtKQ8S4Wa9m10MBA5sx9WX9elFnZq5KtpOjLq 9U2sbJPzu0afUfiHsk7DcMzXmOgjq7k2O6bgGM2jpGyigPJi5svsvsy4uJK3AjuJIvs3 avEcO0qkgDFZODQ8CtPexPbL49ve4RbUEsnD/KL1IOVEE9hyngOBNefCkupiIu6DEUla tK/HPCcTpL77PUuswdgGu6wmefygTFEtzNSdTdLhNCd3gfPvNecarLlGGs0F23TW7oHz kxlA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=QH+KIpME; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id bj4-20020a170902850400b001865c57b5adsi14898123plb.87.2022.10.24.05.42.19; Mon, 24 Oct 2022 05:42:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=QH+KIpME; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234484AbiJXMfJ (ORCPT + 99 others); Mon, 24 Oct 2022 08:35:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53062 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234238AbiJXM3o (ORCPT ); Mon, 24 Oct 2022 08:29:44 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7449318F; Mon, 24 Oct 2022 05:03:45 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 8A56FB81219; Mon, 24 Oct 2022 12:01:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E0437C433D7; Mon, 24 Oct 2022 12:01:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612862; bh=sqEKswuUxTriNBWzsTySPH303zgQ9wiLoNPZnKShKxM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QH+KIpMER4dTvd6y7DnAiakYLcSUPIDPfGTh2NlZf6AJnaTigTKrIbuR+xp8TwSok hWZc6MCuIz5kH79W2ys5z0nTqfw0aCiq8K2lZ7an9xx/2V+YtA9vL48MNHyFlIr/Mz 7aMLwu9cfpBdweTgYWhKCnQtrmvLjkfyki3rRUsE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Andrew Morton , Ard Biesheuvel , David Gow , Julius Werner , Petr Mladek , Evan Green , "Guilherme G. Piccoli" , Sasha Levin Subject: [PATCH 4.19 146/229] firmware: google: Test spinlock on panic path to avoid lockups Date: Mon, 24 Oct 2022 13:31:05 +0200 Message-Id: <20221024113003.735381166@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747572860259177066?= X-GMAIL-MSGID: =?utf-8?q?1747572860259177066?= From: Guilherme G. Piccoli [ Upstream commit 3e081438b8e639cc76ef1a5ce0c1bd8a154082c7 ] Currently the gsmi driver registers a panic notifier as well as reboot and die notifiers. The callbacks registered are called in atomic and very limited context - for instance, panic disables preemption and local IRQs, also all secondary CPUs (not executing the panic path) are shutdown. With that said, taking a spinlock in this scenario is a dangerous invitation for lockup scenarios. So, fix that by checking if the spinlock is free to acquire in the panic notifier callback - if not, bail-out and avoid a potential hang. Fixes: 74c5b31c6618 ("driver: Google EFI SMI") Cc: Andrew Morton Cc: Ard Biesheuvel Cc: David Gow Cc: Greg Kroah-Hartman Cc: Julius Werner Cc: Petr Mladek Reviewed-by: Evan Green Signed-off-by: Guilherme G. Piccoli Link: https://lore.kernel.org/r/20220909200755.189679-1-gpiccoli@igalia.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/firmware/google/gsmi.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/firmware/google/gsmi.c b/drivers/firmware/google/gsmi.c index 62337be07afc..2e3ef0eb6e82 100644 --- a/drivers/firmware/google/gsmi.c +++ b/drivers/firmware/google/gsmi.c @@ -661,6 +661,15 @@ static struct notifier_block gsmi_die_notifier = { static int gsmi_panic_callback(struct notifier_block *nb, unsigned long reason, void *arg) { + + /* + * Panic callbacks are executed with all other CPUs stopped, + * so we must not attempt to spin waiting for gsmi_dev.lock + * to be released. + */ + if (spin_is_locked(&gsmi_dev.lock)) + return NOTIFY_DONE; + gsmi_shutdown_reason(GSMI_SHUTDOWN_PANIC); return NOTIFY_DONE; } From patchwork Mon Oct 24 11:31:06 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8887 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp433647wru; Mon, 24 Oct 2022 05:50:06 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5cuqFjRudtNlOAIGbdaUhxRtvXrdw6/DsYAPALUlCFNz5eQ+h8I/VSfTVj24A8Zu1mCHs3 X-Received: by 2002:a05:6402:550c:b0:443:7d15:d57f with SMTP id fi12-20020a056402550c00b004437d15d57fmr31013638edb.147.1666615806382; Mon, 24 Oct 2022 05:50:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666615806; cv=none; d=google.com; s=arc-20160816; b=BDhKHxKWYPsaVcPkQ8OJOXFT4Mg1Gwz0IhzpdU2NdV9sU8ImY8M+TWFq7LPm9I0XKf RnvcPaxqVtwUSWOUTQnTQh/Nl9+gv6SMKbkBYSKDE9Kv1fbRzflVKY6n03UmFxPl9Al3 i3WjCr1InPDpao8BZuozQX4i6zt3BCabijS5v3H8XkRLZCFAhHreA82dAUfQWXz67NpX XEabfVOZpgvQRukLL7L/LTIe1J52Mw/PpQpAHB+kUnPmOTo1KDyIKOf8zkpss9kz2qkf 8WauhhFP9xawSLb84SOza4bbKIBZ7lyimtQiiXeXs/O50ngHHWlQjYh3TzhXp1IzsaDi 8viw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=jCSWlhkbykCVG8qwoF05TiE6STgBNAa1/dqxYjgSF4U=; b=x9g7XZJe2E6XlyyZvZWyQ7Jr/gfnbXoJzKcD+2nGF2ks6lyFFFh8QeJn7j6I6XqxNu BLKeKtyU6AfVK1CZ8znnljwlvSOfTS8Qp2EHUWUgV0d3TC8/1PphSiQtV9ucKJg/fRin JSg59/R5HBvGtJpM9FJLtosn8nzquaPGB7T54BlHos/HI9leUvodo1IrQv+o7RRMQij/ RYxJCB/aV5g8U2+m9oVk7CnXmlptPrKkqmGRq88c+SfCDrfAeAOM+htjo/JrCyoDeW/O XOkIalVy1Boov2WXyLIBzjll/B2URg0L8h7Xve7bDtYsDQqr75QQVuPA4Z1BcBHKnd7W aivA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=d+12GOEj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hg4-20020a1709072cc400b0079ddb52369bsi7993056ejc.61.2022.10.24.05.49.42; Mon, 24 Oct 2022 05:50:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=d+12GOEj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234320AbiJXMsO (ORCPT + 99 others); Mon, 24 Oct 2022 08:48:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37680 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234150AbiJXMn7 (ORCPT ); Mon, 24 Oct 2022 08:43:59 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F21688D238; Mon, 24 Oct 2022 05:09:02 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 72D016127C; Mon, 24 Oct 2022 12:01:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 83F04C433C1; Mon, 24 Oct 2022 12:01:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612864; bh=QfbezyjWpztvIn6kmbJZe6R4MYsY5rpGEHS+AHAMDcc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=d+12GOEjAbUiPPgtorRxOzJYXOgw48G24YC8oxJujQQKMv1/IO1RYkk6zT4Fz21OD va4gGect4O0tGg2BqKAbGHNudRjwCUZa+yBFnmTkm5NuxSTXjgXhgdfpTcJtkwj9Fn 0zjWQRrDqA29pW6fVF6UMAYl35WXWTDNRxectdoc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?utf-8?q?Pali_Roh=C3=A1r?= , Sasha Levin Subject: [PATCH 4.19 147/229] serial: 8250: Fix restoring termios speed after suspend Date: Mon, 24 Oct 2022 13:31:06 +0200 Message-Id: <20221024113003.764937284@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747573335758215138?= X-GMAIL-MSGID: =?utf-8?q?1747573335758215138?= From: Pali Rohár [ Upstream commit 379a33786d489ab81885ff0b3935cfeb36137fea ] Since commit edc6afc54968 ("tty: switch to ktermios and new framework") termios speed is no longer stored only in c_cflag member but also in new additional c_ispeed and c_ospeed members. If BOTHER flag is set in c_cflag then termios speed is stored only in these new members. Since commit 027b57170bf8 ("serial: core: Fix initializing and restoring termios speed") termios speed is available also in struct console. So properly restore also c_ispeed and c_ospeed members after suspend to fix restoring termios speed which is not represented by Bnnn constant. Fixes: 4516d50aabed ("serial: 8250: Use canary to restart console after suspend") Signed-off-by: Pali Rohár Link: https://lore.kernel.org/r/20220924104324.4035-1-pali@kernel.org Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/tty/serial/8250/8250_port.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/tty/serial/8250/8250_port.c b/drivers/tty/serial/8250/8250_port.c index f11d1202566e..6fc89888a52e 100644 --- a/drivers/tty/serial/8250/8250_port.c +++ b/drivers/tty/serial/8250/8250_port.c @@ -3269,8 +3269,13 @@ static void serial8250_console_restore(struct uart_8250_port *up) unsigned int baud, quot, frac = 0; termios.c_cflag = port->cons->cflag; - if (port->state->port.tty && termios.c_cflag == 0) + termios.c_ispeed = port->cons->ispeed; + termios.c_ospeed = port->cons->ospeed; + if (port->state->port.tty && termios.c_cflag == 0) { termios.c_cflag = port->state->port.tty->termios.c_cflag; + termios.c_ispeed = port->state->port.tty->termios.c_ispeed; + termios.c_ospeed = port->state->port.tty->termios.c_ospeed; + } baud = serial8250_get_baud_rate(port, &termios, NULL); quot = serial8250_get_divisor(port, baud, &frac); From patchwork Mon Oct 24 11:31:07 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8814 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp431038wru; Mon, 24 Oct 2022 05:42:49 -0700 (PDT) X-Google-Smtp-Source: AMsMyM62tZKCabaJBNmYD10XZRkjH22LAVvqMOyvDYPbiZFHuNuenPSuZoWS7YWZnm1xo/MJnNlB X-Received: by 2002:a63:ed0a:0:b0:442:2514:95f5 with SMTP id d10-20020a63ed0a000000b00442251495f5mr28316773pgi.402.1666615369080; Mon, 24 Oct 2022 05:42:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666615369; cv=none; d=google.com; s=arc-20160816; b=UWEmXqm50nebwzvXMN0+sDxK11SW/GC/zWueaBVOcbpmDW6HOZE1QosPJbDlGM5GZ0 WrT7jSLwHVe3U30S02arbGpaL9+ASNlKwqyMVqOzbfiEHtJ8nDItctka8amWe8IiN0MS A4a2kXYcjaCdhNCAbEpXh2QNdnehrbPcnljLdt0+vYACVhOy7JIyBn+SvFAmFNKb7/51 x5Yd13cWYj8WylbVEDwsrQ0WPi57XGlRksglYuqw7igM1xXY1agJxTzAdzyE/t2HvXxj Q/VMtEFV1kmG+n40BYq9l2OVH73lq1yTltKwhOpNDwr22c96yeAtoCVbuH7Gdfe5IDwb 1LWg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=K0s6mjZCp/PrlHbJmWIyOUVAXbxl/eHpEMYWV0hvlrQ=; b=hWFl2KGmx+36FEATqN18Fo+Vk1yKf2Dn6RiC7KKJ4+4BBzHDosX0TeyBwdujMPWpyx aVhVk23RZvv0pT6Bs0fBcHNIRJaAuVCeQGRZbQZBCMRxnYq6+lrOy57dy4c+DLVQV50A weOtBg5+sTgDZ8EySbOt2t2zCsK3lKYwT+eAi7DBxd+KpRWG8LVHhd2MMM+JAI/3Q8z8 4/Qq9tgWNVWjk6O4Vi8t3Nlb2W7uu7nt6Vi2B3yNgcX8F6HOMPjYjdrnfSPRsUF4D9jG YQmLNcg2YH6penyMbheXSweVnpzZHEmJQqIySIfDz3CUqc8FcF+zSYMgNJM5GFIjVKM8 9rJg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=miRY9EIA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t185-20020a6381c2000000b00437e609414dsi33439450pgd.563.2022.10.24.05.42.34; Mon, 24 Oct 2022 05:42:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=miRY9EIA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230236AbiJXMf7 (ORCPT + 99 others); Mon, 24 Oct 2022 08:35:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52246 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234288AbiJXM3z (ORCPT ); Mon, 24 Oct 2022 08:29:55 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B63ED895E8; Mon, 24 Oct 2022 05:03:47 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 14AF161257; Mon, 24 Oct 2022 12:01:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2A1E4C433C1; Mon, 24 Oct 2022 12:01:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612867; bh=FJTfVOh3xOjX9DDYE/z89CAejeedv3qzSVwkojus+pE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=miRY9EIAF6Pm4Z3VLGUx8ludy03ws7nHzegW3Nz9SakiO3/mgY3boR3e2GpX1Mrb3 5tqwG7jNUs7cA2aQ81JUo5rLEMyht8kpCQaTC2YDJg9hKSMc+BbhcMdV8YGyiis28N YoE9Bk7SZ7CMhnzz4i6pDxZOGlbtErEghSgEoHdo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jiasheng Jiang , Eddie James , Joel Stanley , Sasha Levin Subject: [PATCH 4.19 148/229] fsi: core: Check error number after calling ida_simple_get Date: Mon, 24 Oct 2022 13:31:07 +0200 Message-Id: <20221024113003.802441422@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747572877316265505?= X-GMAIL-MSGID: =?utf-8?q?1747572877316265505?= From: Jiasheng Jiang [ Upstream commit 35af9fb49bc5c6d61ef70b501c3a56fe161cce3e ] If allocation fails, the ida_simple_get() will return error number. So master->idx could be error number and be used in dev_set_name(). Therefore, it should be better to check it and return error if fails, like the ida_simple_get() in __fsi_get_new_minor(). Fixes: 09aecfab93b8 ("drivers/fsi: Add fsi master definition") Signed-off-by: Jiasheng Jiang Reviewed-by: Eddie James Link: https://lore.kernel.org/r/20220111073411.614138-1-jiasheng@iscas.ac.cn Signed-off-by: Joel Stanley Signed-off-by: Sasha Levin --- drivers/fsi/fsi-core.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/fsi/fsi-core.c b/drivers/fsi/fsi-core.c index 5b4ca6142270..5133fe0a0abe 100644 --- a/drivers/fsi/fsi-core.c +++ b/drivers/fsi/fsi-core.c @@ -1279,6 +1279,9 @@ int fsi_master_register(struct fsi_master *master) mutex_init(&master->scan_lock); master->idx = ida_simple_get(&master_ida, 0, INT_MAX, GFP_KERNEL); + if (master->idx < 0) + return master->idx; + dev_set_name(&master->dev, "fsi%d", master->idx); rc = device_register(&master->dev); From patchwork Mon Oct 24 11:31:08 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8898 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp433868wru; Mon, 24 Oct 2022 05:50:43 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7n9Y9Hy+3IJnQnJ6LS0zbjPI/zBbyS7nZoqdNslpjcHqs1fSk6tXhfEqVFqHBiaPcfsISc X-Received: by 2002:a17:907:8a23:b0:78d:b042:eece with SMTP id sc35-20020a1709078a2300b0078db042eecemr26351413ejc.494.1666615843647; Mon, 24 Oct 2022 05:50:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666615843; cv=none; d=google.com; s=arc-20160816; b=isL27mgFj1fVimQhAzT3EpDa0OSiPdb1Ow9EEcMOCPp7dNCMB2ClfLrgFuB+qGuINe K1om0Qnn6oAV6Nel+a+VBQP51x/Um5Nt7J/duaNyfEk4AK2p6wUYfzxGzhhe3zcD1dOQ 4m7fvjahXffcSFBF7ESVXrgBpjOuHYVxxZmUjMkM2QOnoymxZfcgAydRhstG1QFz1bR6 RIHJ41//7qSWM6AgUSm0u+zetvB+n133qds3gRzhBy6SYwoPMqESSYpULNhm82gGBHDR Z0G5sM72uCAadfIMLj3eOYGGR9mk5phQirKmBtd33Ke8a1lS3LuFkPUnurNYtDLkBYxd I0Ow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=uJPkekfWKzbn0H27WryBySo9kxN9UyLkULUU9WeBzRA=; b=gxli20119Xylgmo2kxBMP2DnfcQS4e30EWKNgHonPSDcOXD5jvyl2e0iIbFNSo/cua R3rVSnfeITvLdeJFvV+whg4O/TW9tEXDnEAY8PnVlpPfI1HfpOjfmqZTikpkLwjOfJas qB77fYyyRSIMCoOS2efhHoo2DHahHpoSpVbAn2XyuufkrOmMXpx02z5zB2apvJ3EDFul 7weNeLpT5rKS0VXOBCgOD0pUz9RqN6suke65Iex7hq3yWnmxAVWdWh6iO9Cy6U026RyQ LS39916dhSaqezV3f7X6JbLdiPX2qmCP7ClZTq1ICtuwBz9RujQWssjvLyi34x7t6MhC bnaQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Qbwkoaz8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r18-20020a05640251d200b004593895fb89si1213903edd.390.2022.10.24.05.50.16; Mon, 24 Oct 2022 05:50:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Qbwkoaz8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234015AbiJXMiV (ORCPT + 99 others); Mon, 24 Oct 2022 08:38:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44896 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234452AbiJXMfE (ORCPT ); Mon, 24 Oct 2022 08:35:04 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C263E57BEE; Mon, 24 Oct 2022 05:05:11 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 4D1A7B811F3; Mon, 24 Oct 2022 12:02:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9747DC433C1; Mon, 24 Oct 2022 12:02:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612975; bh=AnpJOvKIYkYcjJKzinlWrtkIErjeO2lFOTxCU7ONgSg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Qbwkoaz8N2BJEvUCIJ13PnwvaaL3+GZYWQ/zXq8v8ipiGxsY3aGYRMKfhrPskAZok gZ9enuX/7rPbkpSGY0nBQMSPS2uLngJFGtHt3jVQ4aDGENyhalDGKOUtHnYaIq8TS6 3owYfwg3Lae+BZ3tknjH1/NfuvHJNqrYn5qMcKxk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Christophe JAILLET , Andy Shevchenko , Hans de Goede , Lee Jones , Sasha Levin Subject: [PATCH 4.19 149/229] mfd: intel_soc_pmic: Fix an error handling path in intel_soc_pmic_i2c_probe() Date: Mon, 24 Oct 2022 13:31:08 +0200 Message-Id: <20221024113003.832209259@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747573374850470836?= X-GMAIL-MSGID: =?utf-8?q?1747573374850470836?= From: Christophe JAILLET [ Upstream commit 48749cabba109397b4e7dd556e85718ec0ec114d ] The commit in Fixes: has added a pwm_add_table() call in the probe() and a pwm_remove_table() call in the remove(), but forget to update the error handling path of the probe. Add the missing pwm_remove_table() call. Fixes: a3aa9a93df9f ("mfd: intel_soc_pmic_core: ADD PWM lookup table for CRC PMIC based PWM") Signed-off-by: Christophe JAILLET Signed-off-by: Andy Shevchenko Reviewed-by: Hans de Goede Signed-off-by: Lee Jones Link: https://lore.kernel.org/r/20220801114211.36267-1-andriy.shevchenko@linux.intel.com Signed-off-by: Sasha Levin --- drivers/mfd/intel_soc_pmic_core.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/mfd/intel_soc_pmic_core.c b/drivers/mfd/intel_soc_pmic_core.c index 274306d98ac1..75a2a793ac14 100644 --- a/drivers/mfd/intel_soc_pmic_core.c +++ b/drivers/mfd/intel_soc_pmic_core.c @@ -118,6 +118,7 @@ static int intel_soc_pmic_i2c_probe(struct i2c_client *i2c, return 0; err_del_irq_chip: + pwm_remove_table(crc_pwm_lookup, ARRAY_SIZE(crc_pwm_lookup)); regmap_del_irq_chip(pmic->irq, pmic->irq_chip_data); return ret; } From patchwork Mon Oct 24 11:31:09 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8830 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp431402wru; Mon, 24 Oct 2022 05:43:40 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4HVoFvBIDifDPcsLLRRvmguy52Kk8G2ztQ5F088rKXbuliWK9y4KLqkRhc/yqb927W5PL7 X-Received: by 2002:a05:6402:528a:b0:454:8613:6560 with SMTP id en10-20020a056402528a00b0045486136560mr31716126edb.252.1666615419956; Mon, 24 Oct 2022 05:43:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666615419; cv=none; d=google.com; s=arc-20160816; b=WXQLZLZmtvNuv4ltOOz83wVbkG2cJEIMukyAbicY5REgZneVWwTrgnuT4CWTPj49LL zWpV0rM3fKVacoj0D7qpV7kqiIsQ1FQZ2hjQZX7JtdPtLc/+Y7OAy+tbtZs2BEAROKi5 QmvUl0PXhkQ9kBjch1tIYP1oxi1TkhYPQa02/Snj95p1BeQ63KN2elYK0Z8+8cen9kuT bSlAz2Ta9SqjqOSrfBdSI/FBzbN+4XIHCOW/84vv+Mc9KN7cmzuFegVFyMbh2nbcGyr8 MrqDhBi0SDa9f2/BzqxHJJNix2TzegjGCD8S1WzhHOEcY3Su7ID4HS53aNA8Ca76D9i8 96GQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Fit0RLNj5f7rs5ZT5x0BcOdXZxV6K9jw8fsGsFavINM=; b=w3Z2VXqIr1PuPh8bHN/Nk8fcvkj2wR0bEHjqMf8Pdc6yeUbVWNIcWBsH2Zj5zlAhAL IV7sG1KDkYz+u1yX3u9JUZv6Ck7Enx4sfPdQbBdjCgG23xnRkNnHF4cSXeZhB62Ib1B0 kMy13q4nxXZY+7gimj+k55+dUJ4ZsblcG+zTKyZajcRFdFCm83UMHjI2Do4IJjt9fnpB QpWMbyuLnD+PxFU5hmhmqJEVKmM5TmOe5DB5m3myVW+i++Gk9IjllYjvMW7XH0L79ccr gIBQnlqOsZhaPr9Hpz7ZXz7Ul4QFCL+7WgT3XdSq8h6lT8cumftApaasjfnQEgUGvB96 qmzw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=v+SlfBvK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h3-20020a0564020e8300b00461c852af19si2571809eda.633.2022.10.24.05.43.06; Mon, 24 Oct 2022 05:43:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=v+SlfBvK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232582AbiJXMhC (ORCPT + 99 others); Mon, 24 Oct 2022 08:37:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53272 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234462AbiJXMaY (ORCPT ); Mon, 24 Oct 2022 08:30:24 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EB145AE73; Mon, 24 Oct 2022 05:04:36 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id CFBCBB81199; Mon, 24 Oct 2022 12:01:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 31718C433D6; Mon, 24 Oct 2022 12:01:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612888; bh=kwySQ/fNngrpXZFgbjUEf/ovc1grJsREpVvSQtKuUJ4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=v+SlfBvKEDx2HQIQjJjyGUDYRe8+/6LzCdlaQC8TFebthnt6KUWaODGRgq9AgBYop 4rLfwWyfzEEbOASGB2py+ea1Y1ETdfQDkoniuoVuYh8tvvAfy+HzWIiMJCraBoi+iT 7Jh2q71l4VpDkeQex6eoUHcxIDZnEsmPh+zvdZ90= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Christophe JAILLET , Lee Jones , Sasha Levin Subject: [PATCH 4.19 150/229] mfd: fsl-imx25: Fix an error handling path in mx25_tsadc_setup_irq() Date: Mon, 24 Oct 2022 13:31:09 +0200 Message-Id: <20221024113003.863134607@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747572930965599037?= X-GMAIL-MSGID: =?utf-8?q?1747572930965599037?= From: Christophe JAILLET [ Upstream commit 3fa9e4cfb55da512ebfd57336fde468830719298 ] If devm_of_platform_populate() fails, some resources need to be released. Introduce a mx25_tsadc_unset_irq() function that undoes mx25_tsadc_setup_irq() and call it both from the new error handling path of the probe and in the remove function. Fixes: a55196eff6d6 ("mfd: fsl-imx25: Use devm_of_platform_populate()") Signed-off-by: Christophe JAILLET Signed-off-by: Lee Jones Link: https://lore.kernel.org/r/d404e04828fc06bcfddf81f9f3e9b4babbe35415.1659269156.git.christophe.jaillet@wanadoo.fr Signed-off-by: Sasha Levin --- drivers/mfd/fsl-imx25-tsadc.c | 32 ++++++++++++++++++++++++-------- 1 file changed, 24 insertions(+), 8 deletions(-) diff --git a/drivers/mfd/fsl-imx25-tsadc.c b/drivers/mfd/fsl-imx25-tsadc.c index dbb85caaafed..2718fcb26786 100644 --- a/drivers/mfd/fsl-imx25-tsadc.c +++ b/drivers/mfd/fsl-imx25-tsadc.c @@ -89,6 +89,19 @@ static int mx25_tsadc_setup_irq(struct platform_device *pdev, return 0; } +static int mx25_tsadc_unset_irq(struct platform_device *pdev) +{ + struct mx25_tsadc *tsadc = platform_get_drvdata(pdev); + int irq = platform_get_irq(pdev, 0); + + if (irq) { + irq_set_chained_handler_and_data(irq, NULL, NULL); + irq_domain_remove(tsadc->domain); + } + + return 0; +} + static void mx25_tsadc_setup_clk(struct platform_device *pdev, struct mx25_tsadc *tsadc) { @@ -176,18 +189,21 @@ static int mx25_tsadc_probe(struct platform_device *pdev) platform_set_drvdata(pdev, tsadc); - return devm_of_platform_populate(dev); + ret = devm_of_platform_populate(dev); + if (ret) + goto err_irq; + + return 0; + +err_irq: + mx25_tsadc_unset_irq(pdev); + + return ret; } static int mx25_tsadc_remove(struct platform_device *pdev) { - struct mx25_tsadc *tsadc = platform_get_drvdata(pdev); - int irq = platform_get_irq(pdev, 0); - - if (irq) { - irq_set_chained_handler_and_data(irq, NULL, NULL); - irq_domain_remove(tsadc->domain); - } + mx25_tsadc_unset_irq(pdev); return 0; } From patchwork Mon Oct 24 11:31:10 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8835 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp431481wru; Mon, 24 Oct 2022 05:43:56 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6ks+/7vqyJisRiOiO69/dPk2M3V2W9PBHB0m72fdUM0ZbqR0A4zQzzv2gdiTjt7ArcjoNH X-Received: by 2002:a17:90a:fa46:b0:20d:5efa:84fc with SMTP id dt6-20020a17090afa4600b0020d5efa84fcmr72311130pjb.20.1666615435952; Mon, 24 Oct 2022 05:43:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666615435; cv=none; d=google.com; s=arc-20160816; b=PSlraFsUKwDqOtVQZFcGlp+Mjz55OfBI3xvdSHsGxeJgCzhLVqlxMdEH2qW/rks93x UB0IEzo6dbHA/9nfwl7GHLd7qnlvYv6Opqp5+hltE+18kIhfd9sGDpxj0BkUVLA9+hJ7 b8q7kMNbS2EyE2vDpwslQf5CNBg64lg4Vr/N4nqRWtsqdtJ6tEQKRCgaNE/rOsXJHgEL 48dWKIxoL5ZMpTi1ZSW3Fj/CwqnvOo5qxVDzAVcs3bNVXOlv0esHVqanCJMbZa8sW/nl 8BUuTRj9CCH1tumR5ur018dc39YmLEI4R8a8f6/xP0GMNFONyIWmtcMCih4yMAUhq0eo yw6Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=L+A/BSR94ma4LpScF9jqZHK9B+avof+oOFBAQ/rcUC8=; b=bGYkcRzXeCAzcqDJnA1rvQdwA+D8NasghsBaqTNRHeYBH6bET9r9IeFjpqBMiNMh3v cbKnliOcHHqIj6jCi4qIa4hGv7yhJx+1IlIpy/V5pTeTKVybwYquL13HQtXscrq1zoGz ektqlQbvVUqn6WVSrLZc/5BUATfuRdXeZp8IVTyMV7erGVwbHt8qSmnrPuH0gm39K6GP qe+TXvmV/MCbalytgFORcP1oCcnJ7BKX9KBXVyFgFvC0do6QySKUwdEiutPS+rlsUTgn /VNRtdJsozy+P75WX6Z/llLwveXutVR09Rza7w5hDtGjMj0aY0idtbh7u0pBbNBivjf/ TvMg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=WH8d2+TD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f6-20020a056a00228600b005352aeae657si3046865pfe.199.2022.10.24.05.43.40; Mon, 24 Oct 2022 05:43:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=WH8d2+TD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229491AbiJXMhj (ORCPT + 99 others); Mon, 24 Oct 2022 08:37:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45142 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233883AbiJXMbc (ORCPT ); Mon, 24 Oct 2022 08:31:32 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CE22B1EC5C; Mon, 24 Oct 2022 05:04:42 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 9FB66B811C4; Mon, 24 Oct 2022 12:01:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0016AC433C1; Mon, 24 Oct 2022 12:01:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612917; bh=7Mf8pAymLKtC4kysmJdpY7SrgzbFoAL52CT2NFcnYPE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WH8d2+TDwLJ5/N564TTn04sLP256U5QxUJCNysYeKiNwFO4VEGLOV7pm5POXvMN6T xcmBgnsS79hij97pem0Xh+J6pJj9liBWWLKOkoNCcYwihaxgP8sph2WqckVAE+RhxB ojeBgEnPl2WXP+VSOGHmLSvsNHXgWo9QUebPwIEk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Christophe JAILLET , Lee Jones , Sasha Levin Subject: [PATCH 4.19 151/229] mfd: lp8788: Fix an error handling path in lp8788_probe() Date: Mon, 24 Oct 2022 13:31:10 +0200 Message-Id: <20221024113003.892784504@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747572947283365002?= X-GMAIL-MSGID: =?utf-8?q?1747572947283365002?= From: Christophe JAILLET [ Upstream commit becfdcd75126b20b8ec10066c5e85b34f8994ad5 ] Should an error occurs in mfd_add_devices(), some resources need to be released, as already done in the .remove() function. Add an error handling path and a lp8788_irq_exit() call to undo a previous lp8788_irq_init(). Fixes: eea6b7cc53aa ("mfd: Add lp8788 mfd driver") Signed-off-by: Christophe JAILLET Signed-off-by: Lee Jones Link: https://lore.kernel.org/r/18398722da9df9490722d853e4797350189ae79b.1659261275.git.christophe.jaillet@wanadoo.fr Signed-off-by: Sasha Levin --- drivers/mfd/lp8788.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/drivers/mfd/lp8788.c b/drivers/mfd/lp8788.c index acf616559512..e47150cdf747 100644 --- a/drivers/mfd/lp8788.c +++ b/drivers/mfd/lp8788.c @@ -199,8 +199,16 @@ static int lp8788_probe(struct i2c_client *cl, const struct i2c_device_id *id) if (ret) return ret; - return mfd_add_devices(lp->dev, -1, lp8788_devs, - ARRAY_SIZE(lp8788_devs), NULL, 0, NULL); + ret = mfd_add_devices(lp->dev, -1, lp8788_devs, + ARRAY_SIZE(lp8788_devs), NULL, 0, NULL); + if (ret) + goto err_exit_irq; + + return 0; + +err_exit_irq: + lp8788_irq_exit(lp); + return ret; } static int lp8788_remove(struct i2c_client *cl) From patchwork Mon Oct 24 11:31:11 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8842 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp431616wru; Mon, 24 Oct 2022 05:44:18 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4G0zKoH+GcrwTCEMi1RMAbI74WZEGh8XzBuaeiZtO0wHNazQlQgAYTH8sbAAeTgbwnNXnA X-Received: by 2002:a17:906:d550:b0:78d:a6d4:c18f with SMTP id cr16-20020a170906d55000b0078da6d4c18fmr27912225ejc.113.1666615458524; Mon, 24 Oct 2022 05:44:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666615458; cv=none; d=google.com; s=arc-20160816; b=aAYMRYyWmd8R8C0ZUOF0oA+qIW5QZO58cHB+eDUDHw61TIGtgiTnU6WbKwYpAd3rje pdvLPC4jSPnYz7kW5RHLgdgHq1EKSXD5+oLPJ9pqyZFn5CuUUQDTBNIgggysOXxXUBPL tWEufXUROq/glg6JWGS3NWl97UI5lFnaeJLJ+BzVIHsURx0iJJERjZYHoQCTA14E0G+J Z7m/QfOvQSm9tnR/ttuhqD83fY38dEvMywRL9tDO0SXWfKYrEPTQFABPeq0pf9Ej+Y6G ZF7siCNPwnwgSUMjbS35MKmpCc0TrhRqfn5eieUhKJS2Lj3TmbLyJH/N92rPwsS3t+qX 5yKw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=ncrh4LKlHVvQtYJT+QR1ULqI34OmJaPmyfVts/ndP88=; b=D361HB3rPkJ76MFjDWlW2Kgs3hQ0UAOAqSLYnuS1c/z1UPyCdoEqpmAr8Hk45GUVaE Hj72/8qd024Z+vceAlfiFICXvAt50Gor9WnUikimdp2aCbFXL8fyDOduV6aARMhF+npM C1WK4gbzIMFheihr/30Sg7zmj9K0XlLxacTorPFXRiAhh7cTeYDiSx3VEXbNalqlvptm mltvAKVyijcfc2TiChV0q8pSM3x2c0tKNRX5MuyOVHvy3nrWYFtJbRok7jE7/qFNoGfR /J+MDgkBwiFnI6ETV1YjV/MnD2SvettSN81zFWHgEXzj6nSSM6Hx4IDe/NpWoxD0O36h vHYQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ljYGIgWJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id dn19-20020a17090794d300b007806964b2fcsi7467419ejc.447.2022.10.24.05.43.52; Mon, 24 Oct 2022 05:44:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ljYGIgWJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230340AbiJXMiA (ORCPT + 99 others); Mon, 24 Oct 2022 08:38:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55018 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234089AbiJXMdk (ORCPT ); Mon, 24 Oct 2022 08:33:40 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7158634DCA; Mon, 24 Oct 2022 05:04:49 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 3EC72B811BE; Mon, 24 Oct 2022 12:02:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 93F8AC433C1; Mon, 24 Oct 2022 12:02:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612945; bh=+IJfdwQZHLdBxmVW+3yGX0T13fs3Qxpi0bql/8osMgE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ljYGIgWJmhnTuHsXGWwtwc3Zh198H1oFulil5+Ev9NqfvTrNcOqbcNZGWI5bw20+4 Ovltbmu3C1wn09me6a7xCSWRi9XyCZhHbzORmFmXaCdIRjrEs5VxBKIQ3NNO3ZgXP1 rX1NaFot6lELeHDd0iZPd1uS6LTnODcvUliFkL/s= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Christophe JAILLET , Lee Jones , Sasha Levin Subject: [PATCH 4.19 152/229] mfd: lp8788: Fix an error handling path in lp8788_irq_init() and lp8788_irq_init() Date: Mon, 24 Oct 2022 13:31:11 +0200 Message-Id: <20221024113003.931698972@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747572971334149780?= X-GMAIL-MSGID: =?utf-8?q?1747572971334149780?= From: Christophe JAILLET [ Upstream commit 557244f6284f30613f2d61f14b579303165876c3 ] In lp8788_irq_init(), if an error occurs after a successful irq_domain_add_linear() call, it must be undone by a corresponding irq_domain_remove() call. irq_domain_remove() should also be called in lp8788_irq_exit() for the same reason. Fixes: eea6b7cc53aa ("mfd: Add lp8788 mfd driver") Signed-off-by: Christophe JAILLET Signed-off-by: Lee Jones Link: https://lore.kernel.org/r/bcd5a72c9c1c383dd6324680116426e32737655a.1659261275.git.christophe.jaillet@wanadoo.fr Signed-off-by: Sasha Levin --- drivers/mfd/lp8788-irq.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/mfd/lp8788-irq.c b/drivers/mfd/lp8788-irq.c index 792d51bae20f..ae65928f35f0 100644 --- a/drivers/mfd/lp8788-irq.c +++ b/drivers/mfd/lp8788-irq.c @@ -179,6 +179,7 @@ int lp8788_irq_init(struct lp8788 *lp, int irq) IRQF_TRIGGER_FALLING | IRQF_ONESHOT, "lp8788-irq", irqd); if (ret) { + irq_domain_remove(lp->irqdm); dev_err(lp->dev, "failed to create a thread for IRQ_N\n"); return ret; } @@ -192,4 +193,6 @@ void lp8788_irq_exit(struct lp8788 *lp) { if (lp->irq) free_irq(lp->irq, lp->irqdm); + if (lp->irqdm) + irq_domain_remove(lp->irqdm); } From patchwork Mon Oct 24 11:31:12 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8793 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp430831wru; Mon, 24 Oct 2022 05:42:21 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6D6my+G/cZoeD1MXHAzfcURwJa3XoRl+nvBDAcfIdajyyriE4rloZModlRHqSyprGSkq78 X-Received: by 2002:a62:7b0f:0:b0:56b:e472:9e81 with SMTP id w15-20020a627b0f000000b0056be4729e81mr3490936pfc.13.1666615340671; Mon, 24 Oct 2022 05:42:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666615340; cv=none; d=google.com; s=arc-20160816; b=nfYW/LSWWZRnkA/x8QdPdQvnOfiTNe+kF+Z0sCd5vBSCAXV6S7QDJ64AZxFVUx/Usx 1f6HKQkeOK81GqMWR5T07rWqjfIR5N13mHxzuFpaIZqufO7khzdhcD816BrE5Lo41P7+ O5vOLNLh4H2sV0zxekjF8gGdGC8+j5ExsEHtL/iCNC2ZsRLkFYzClHUC+lkN4RTrxV5/ mOSMp1GeNGKQcSjj2B30yLlZz7SLlS7BrpHv8OSSBsrm6h65w8LhthrMhiWzi6xz9V55 /XgEPP4cOIBZ5//j8A0IkVgTkrEgKIvq3c21pZ3oYjDyy4jxfFOiLXSa1xxkLTUoD9jd oj/A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=lvrToaEoN1VBHc4fYW6HvbO3Cmqy0O9Rdyj55lsDG7E=; b=h7T5SgcCj/ItQlnB4QD1rtSdGxAG7FTG6qcgb7cs1RUdTHpA9/IhiPeJ+WhSYumYVb JznbXd75uA77DU+hOwm5Tu/6gRXeKYlwkov872xLCo9Pwl2itEPW4W1Ce/K7MkzSMLSO a9rSevvE5xpx+BzkCd4iRaXDXxhdS8KyZ7UjUFy19jHz2NQMbxSBtv/pNeagXNMahbBI /CDqZ8ircz348eukxyJhB/rfeU1C+ghPV2YpjDApFmr6/RFybspq6E6x/ovrxILW/xpP pvh6f2iitgZUDTsYOM526qBS86cEdfolsQMqtN0tQ3ydM5Rl68cN6gbdTzj8JJlS89AW i43A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=fdi34Mex; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d18-20020a170902ced200b001865dfb6774si20128470plg.458.2022.10.24.05.42.05; Mon, 24 Oct 2022 05:42:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=fdi34Mex; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233996AbiJXMc3 (ORCPT + 99 others); Mon, 24 Oct 2022 08:32:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60532 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233977AbiJXM3I (ORCPT ); Mon, 24 Oct 2022 08:29:08 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1FE88876A9; Mon, 24 Oct 2022 05:02:54 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 9F5A3612F0; Mon, 24 Oct 2022 12:02:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B0E5AC433C1; Mon, 24 Oct 2022 12:02:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612959; bh=HBy6+WmctVCFgQnZHbWI3wpfmscQhg4m+1LqT9t11gg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fdi34MexhO9PSH7fYTllHDpXtCgO5tMYpiwkOcI2s0JpVRqJWhh20VbOVQ5otHyub aD8dlcPCTF9ZFabrzWDhiYj0HVrmfbsxsF02aVgZdjp9j0CBjwiySy7MffoocOIHyW xSeaI9uMBRk5hcMJ/7CTBDm6PhtIUgCswabzFDm8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jiasheng Jiang , Lee Jones , Sasha Levin Subject: [PATCH 4.19 153/229] mfd: sm501: Add check for platform_driver_register() Date: Mon, 24 Oct 2022 13:31:12 +0200 Message-Id: <20221024113003.961820486@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747572847741466178?= X-GMAIL-MSGID: =?utf-8?q?1747572847741466178?= From: Jiasheng Jiang [ Upstream commit 8325a6c24ad78b8c1acc3c42b098ee24105d68e5 ] As platform_driver_register() can return error numbers, it should be better to check platform_driver_register() and deal with the exception. Fixes: b6d6454fdb66 ("[PATCH] mfd: SM501 core driver") Signed-off-by: Jiasheng Jiang Signed-off-by: Lee Jones Link: https://lore.kernel.org/r/20220913091112.1739138-1-jiasheng@iscas.ac.cn Signed-off-by: Sasha Levin --- drivers/mfd/sm501.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/mfd/sm501.c b/drivers/mfd/sm501.c index ec1ac61a21ed..6254b4025b5e 100644 --- a/drivers/mfd/sm501.c +++ b/drivers/mfd/sm501.c @@ -1738,7 +1738,12 @@ static struct platform_driver sm501_plat_driver = { static int __init sm501_base_init(void) { - platform_driver_register(&sm501_plat_driver); + int ret; + + ret = platform_driver_register(&sm501_plat_driver); + if (ret < 0) + return ret; + return pci_register_driver(&sm501_pci_driver); } From patchwork Mon Oct 24 11:31:13 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9839 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp556257wru; Mon, 24 Oct 2022 10:01:23 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4kXF7je2IQBmfkpmuqhPrJWDGgDTY7J6y4qDWAFl+iXeFPuiXil9y2qeanvaxhbjKFEUXb X-Received: by 2002:a17:902:e88b:b0:17f:93a4:e31b with SMTP id w11-20020a170902e88b00b0017f93a4e31bmr34856136plg.51.1666630882790; Mon, 24 Oct 2022 10:01:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666630882; cv=none; d=google.com; s=arc-20160816; b=T4jcIKb44+TEPpFgYMCXRH7T4BixqkMA9bj0W19afF3vV/IVDQL9XDDO6VvgSgrUAv XfYIHNJMQnbPye8/l+P7zckjvWEPnfgm57N9s63QJ9pEeFWtczksTPFqLcT2W5Mg7Z0V Ea3bbW3W6BI6j0dpiGCI61UyqPkoP16M3fCXDYkK/ia+zKz/QYByekZuPHl72KkiykC5 Jg9Cz6rLiEfKXRuyxO8acKt7eMP8UUHTe0LHu+rkcoYDqmTFCGqZKXskA/jN2lkdP6cR ft5Ac3KsWZaFD5D2c/P4BOaKz93rRu28e9Ur6T5vAigVZlYCwggHwUUv7WOFAxwO7jCz jKZQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=UBb4QOyFAACNQoGPIirOgnL0m6BWFPRAXoQ+ahaPbuU=; b=08xunSN0IAeO5w7XMCeex/CewZmlCgD5jXI1b5Tj6K90wWruopPNRQS1KBSeUrURaD IRDZExeqIoiHYUakxsbNut9Xpz24pNP4ZtmdovQykj/EWBaDm6H8F9dTzUJLaCsu4iy9 q3CXvkcVgJIe2Q/9RgAIBnR0enQaLgmWqEJjp9VOKEbOihmZT3Dnu7Tr49hir+uXM+W9 qObZXY4qXaclR/oRlGyBHbr3YnryewlQo+NHZx3/IwddJzxP6D3rVaCC4gG/9lghVeQK vGu5MM4SHSrRHxRZFpSn1raEvVgwyjbh7HEPRsXw1C8iRwEINey9/VXpwE4eGPHtgjxo 9Nmg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ChFSYWVF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f36-20020a631f24000000b004644f068aafsi26654pgf.137.2022.10.24.10.01.03; Mon, 24 Oct 2022 10:01:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ChFSYWVF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235464AbiJXQyi (ORCPT + 99 others); Mon, 24 Oct 2022 12:54:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35104 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235493AbiJXQtq (ORCPT ); Mon, 24 Oct 2022 12:49:46 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6CEE220359; Mon, 24 Oct 2022 08:33:09 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 2ABCCB8115E; Mon, 24 Oct 2022 12:02:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5DC4BC433C1; Mon, 24 Oct 2022 12:02:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612961; bh=Hl/cRYdYrCrKZdRnMFgBD3L9OYERVtzqcMFsuTkARQ4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ChFSYWVFen7ezBV21imbM1sKMUV2Kb0zVjMxRwXFAPbXr9dDafla8ff/C5+/ug7dH TOdK5rqVx6o8uhK/T/QzKX2WyQ+xR5FH47z8rAWu/byV8yL7Md5fRpA/7HItdYUcr8 u914KhtOsTPFMUuBYqzBuf8MpKd19QYVt9SsIED4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dave Jiang , Vinod Koul , Sasha Levin Subject: [PATCH 4.19 154/229] dmaengine: ioat: stop mod_timer from resurrecting deleted timer in __cleanup() Date: Mon, 24 Oct 2022 13:31:13 +0200 Message-Id: <20221024113003.995921970@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747589144511512807?= X-GMAIL-MSGID: =?utf-8?q?1747589144511512807?= From: Dave Jiang [ Upstream commit 898ec89dbb55b8294695ad71694a0684e62b2a73 ] User reports observing timer event report channel halted but no error observed in CHANERR register. The driver finished self-test and released channel resources. Debug shows that __cleanup() can call mod_timer() after the timer has been deleted and thus resurrect the timer. While harmless, it causes suprious error message to be emitted. Use mod_timer_pending() call to prevent deleted timer from being resurrected. Fixes: 3372de5813e4 ("dmaengine: ioatdma: removal of dma_v3.c and relevant ioat3 references") Signed-off-by: Dave Jiang Link: https://lore.kernel.org/r/166360672197.3851724.17040290563764838369.stgit@djiang5-desk3.ch.intel.com Signed-off-by: Vinod Koul Signed-off-by: Sasha Levin --- drivers/dma/ioat/dma.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/dma/ioat/dma.c b/drivers/dma/ioat/dma.c index 890cadf3ec5d..e86a3d19b718 100644 --- a/drivers/dma/ioat/dma.c +++ b/drivers/dma/ioat/dma.c @@ -653,7 +653,7 @@ static void __cleanup(struct ioatdma_chan *ioat_chan, dma_addr_t phys_complete) if (active - i == 0) { dev_dbg(to_dev(ioat_chan), "%s: cancel completion timeout\n", __func__); - mod_timer(&ioat_chan->timer, jiffies + IDLE_TIMEOUT); + mod_timer_pending(&ioat_chan->timer, jiffies + IDLE_TIMEOUT); } /* microsecond delay by sysfs variable per pending descriptor */ @@ -679,7 +679,7 @@ static void ioat_cleanup(struct ioatdma_chan *ioat_chan) if (chanerr & (IOAT_CHANERR_HANDLE_MASK | IOAT_CHANERR_RECOVER_MASK)) { - mod_timer(&ioat_chan->timer, jiffies + IDLE_TIMEOUT); + mod_timer_pending(&ioat_chan->timer, jiffies + IDLE_TIMEOUT); ioat_eh(ioat_chan); } } @@ -876,7 +876,7 @@ static void check_active(struct ioatdma_chan *ioat_chan) } if (test_and_clear_bit(IOAT_CHAN_ACTIVE, &ioat_chan->state)) - mod_timer(&ioat_chan->timer, jiffies + IDLE_TIMEOUT); + mod_timer_pending(&ioat_chan->timer, jiffies + IDLE_TIMEOUT); } void ioat_timer_event(struct timer_list *t) From patchwork Mon Oct 24 11:31:14 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8860 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp433070wru; Mon, 24 Oct 2022 05:48:31 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6GvhmXzQiCvd1jzwVZ1xKpDNDYHzbOHzkT9OuhpiC6OlUnrUU1I71WrNsFxMl2cGp00TTj X-Received: by 2002:a17:902:eb8e:b0:17f:637b:9548 with SMTP id q14-20020a170902eb8e00b0017f637b9548mr33944451plg.158.1666615711312; Mon, 24 Oct 2022 05:48:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666615711; cv=none; d=google.com; s=arc-20160816; b=CA8PJsbXLt8L+DmJCK/KHnI9cXAomqUOfS56s+VL7bKVz4kItEj8NDHGkuCnd0GC+V jPrmERZMELFPUd08o8ANNhUfrSONIGbNI/oO+9oTSfxlwNqPTxbo+i26D484Fo4vP0eR OY2RMzzgS5e1M5uzoyGIxIxL/1FOp4NoFHyf3zb9nPQnHSOrTLgCCI6J3Tzc8qt/as2c +ODyY0Gz0l4zrFv5u+WqHweZVSm+CiZi9ecFW8dKKSCHjyoVpaAhn0GKOlfJ9F/Gu5bi gDcZ7Hqk8/WPbQgwS4BfDXpxATO6TGSGSQzwvIeTR4rldB2QWmVwWH75ORsnVyrFSwHs t5Hg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=ZuEVKckTcaCNkTtpL58NJaZGpCNwVdESDVf350rLaAo=; b=YTlPiXXOfyoHHhzMn7eO8xZLf6eY4bq4NMtUCoCX1BvHeJxDnS/sQmS1z/rW3g1PKt DDqrsZJzqwOQftFjGF04Fi9bPNKKJmrvEJTZ591pbLs1FDloAw9FJplWGeHVeW/1J7vO 7cvePsZet2ECs9Fb6Bx1nY5KvCBgJCk4hCGsYqP3L3k/v3ilucS3UJFDFwzAUf8mwQ8a BQy6VQRLcjHTBrbqL+w+Tn0aEk06U1ZA2oIDfOEQQpoUpoeWH+EmE+yr7rO0qhFHKQsr anBuP2wHi31/hAwOqd9GnVXan+C0VMnbdYjz7XkcVhIxXcKbWUUO6aEP34Ou6uOB8p3U DyjA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="KA0/3VGh"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ne12-20020a17090b374c00b00205eafb9fdbsi7935931pjb.37.2022.10.24.05.48.15; Mon, 24 Oct 2022 05:48:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="KA0/3VGh"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232053AbiJXMk7 (ORCPT + 99 others); Mon, 24 Oct 2022 08:40:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38954 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232456AbiJXMhC (ORCPT ); Mon, 24 Oct 2022 08:37:02 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 09C836686E; Mon, 24 Oct 2022 05:06:19 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 12DE261252; Mon, 24 Oct 2022 12:02:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 25D6BC433C1; Mon, 24 Oct 2022 12:02:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612964; bh=OFe+RVcm/duytjcmCEfORAPp9ogoeTNcHx8fd2aVeYI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KA0/3VGhaBv0Yuf4S75XvBM2nu+zgyYU12tLgq3AvsZP7pX6bRd2QNM8meEknK6bd /OnVYDnYxKQsHvr4REZ7bE/jEZo+iM+XDHhEQoIXvSUXU3LqwC64XJmYbowIgHBeH4 l1CEoXNhauWG/KV8Vn76SnLag+fOZ5r6bCUKoKgQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, David Collins , Fenglin Wu , Stephen Boyd , Sasha Levin Subject: [PATCH 4.19 155/229] spmi: pmic-arb: correct duplicate APID to PPID mapping logic Date: Mon, 24 Oct 2022 13:31:14 +0200 Message-Id: <20221024113004.025723586@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747573236447348900?= X-GMAIL-MSGID: =?utf-8?q?1747573236447348900?= From: David Collins [ Upstream commit 1f1693118c2476cb1666ad357edcf3cf48bf9b16 ] Correct the way that duplicate PPID mappings are handled for PMIC arbiter v5. The final APID mapped to a given PPID should be the one which has write owner = APPS EE, if it exists, or if not that, then the first APID mapped to the PPID, if it exists. Fixes: 40f318f0ed67 ("spmi: pmic-arb: add support for HW version 5") Signed-off-by: David Collins Signed-off-by: Fenglin Wu Link: https://lore.kernel.org/r/1655004286-11493-7-git-send-email-quic_fenglinw@quicinc.com Signed-off-by: Stephen Boyd Link: https://lore.kernel.org/r/20220930005019.2663064-8-sboyd@kernel.org Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/spmi/spmi-pmic-arb.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/drivers/spmi/spmi-pmic-arb.c b/drivers/spmi/spmi-pmic-arb.c index 360b8218f322..0eb156aa4975 100644 --- a/drivers/spmi/spmi-pmic-arb.c +++ b/drivers/spmi/spmi-pmic-arb.c @@ -867,7 +867,8 @@ static int pmic_arb_read_apid_map_v5(struct spmi_pmic_arb *pmic_arb) * version 5, there is more than one APID mapped to each PPID. * The owner field for each of these mappings specifies the EE which is * allowed to write to the APID. The owner of the last (highest) APID - * for a given PPID will receive interrupts from the PPID. + * which has the IRQ owner bit set for a given PPID will receive + * interrupts from the PPID. */ for (i = 0; ; i++, apidd++) { offset = pmic_arb->ver_ops->apid_map_offset(i); @@ -890,16 +891,16 @@ static int pmic_arb_read_apid_map_v5(struct spmi_pmic_arb *pmic_arb) apid = pmic_arb->ppid_to_apid[ppid] & ~PMIC_ARB_APID_VALID; prev_apidd = &pmic_arb->apid_data[apid]; - if (valid && is_irq_ee && - prev_apidd->write_ee == pmic_arb->ee) { + if (!valid || apidd->write_ee == pmic_arb->ee) { + /* First PPID mapping or one for this EE */ + pmic_arb->ppid_to_apid[ppid] = i | PMIC_ARB_APID_VALID; + } else if (valid && is_irq_ee && + prev_apidd->write_ee == pmic_arb->ee) { /* * Duplicate PPID mapping after the one for this EE; * override the irq owner */ prev_apidd->irq_ee = apidd->irq_ee; - } else if (!valid || is_irq_ee) { - /* First PPID mapping or duplicate for another EE */ - pmic_arb->ppid_to_apid[ppid] = i | PMIC_ARB_APID_VALID; } apidd->ppid = ppid; From patchwork Mon Oct 24 11:31:15 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8809 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp430930wru; Mon, 24 Oct 2022 05:42:33 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5MRxeaZk9cM6tRMbXY72WpY0360R5U/0llQbxhNyQavKcdAk8a6SR2Y+Fluzep5CTjLn14 X-Received: by 2002:a17:90b:4c0b:b0:20d:8572:ab27 with SMTP id na11-20020a17090b4c0b00b0020d8572ab27mr38036194pjb.193.1666615353071; Mon, 24 Oct 2022 05:42:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666615353; cv=none; d=google.com; s=arc-20160816; b=By1SQTTYeAzyF76jZk3eVJqkJEoQnUDAt9STx7jCGDN9YArPWsjYZMGElWOX0oqIk8 kftHdnIuglvGzZSc5Z+kxilGe7cW9ReYx/wzMOB0naGqnB0+NuvbXpx0jHomMF8fp/jm yNuCDcoOUQBMdNn5+UJuUXo2aQNmtfRfy01NO4M3Zj6qIPQhVcpsoMsJFqjyiEbfw1Vo DA+z9yIE87UJqfK9zetggYM/XJCOtUkWmTssypGiak1lo1jWocu/aTdMpOJpNr0iPMPo FGP42311axKSKtRgmTXKiX1hOopnEmu1+jGd2flhqMta7IHM5jqWVZ+/BjiwhhAa9VaV kY+w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=TtvRVjhRsiJg/lWBy0Eaz8afX8lm8rfZLNKfjSWTsvI=; b=EfdxgdvGJ3cvK3DTR3L9FovDoZNKxYrjwrLOyaIki4baFUxGbE0sc00zt+Z65ZlwFL WyQ+ieAN6d90qnMo7nUi3bFmz19ZVpbu7Mg/QnctO7SmyTOlCMRomSQfn5PKdNPwJZEO 8bXEI6O2D8dT/TEnwijQp6PwcAvx/NKZ8v7hsCxhf8U1njTEQJcVJlgvQjntBt0ixPFW lytF7dcGfgZJTU/21Lwpf0+hSLVCgZoMhrOAEcN5JCvVr4yuMydr5EUZQQFqB7j3bNyC JSDljfY8W19+Y1co7SDp+/0cnkrr0ZKL1O99Sqr7IZGcnP5gOqQz5f0HX3b6TUBYC2uw 7ghA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=spjDvkWr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b6-20020a170903228600b0017f75ce8a2esi38427515plh.575.2022.10.24.05.42.19; Mon, 24 Oct 2022 05:42:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=spjDvkWr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234457AbiJXMfF (ORCPT + 99 others); Mon, 24 Oct 2022 08:35:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51164 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234241AbiJXM3s (ORCPT ); Mon, 24 Oct 2022 08:29:48 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7468A868B4; Mon, 24 Oct 2022 05:03:44 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id A5DF8612BE; Mon, 24 Oct 2022 12:02:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B7EDCC433D6; Mon, 24 Oct 2022 12:02:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612967; bh=J5kxD+IcyiLjueojU6BHKyBWY1G0nIvUI3uXZKpvxz0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=spjDvkWrXYnbEaWe464ksIydaOY6eQ2c4SNmi0YJGLD30VrkSdOULVqIwqOfnk/Zf Hec1APiHN0XyMjYXw6AE2PM9TgxNwbnWG2jLkWXf0lcQltOneunZc1f8TSSfUNdWLP bFea9V2PF9NTeWMSXCkrEAThhpR7tnq7kFPr2d0E= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Stefan Wahren , "Ivan T. Ivanov" , Florian Fainelli , Stephen Boyd , Sasha Levin Subject: [PATCH 4.19 156/229] clk: bcm2835: fix bcm2835_clock_rate_from_divisor declaration Date: Mon, 24 Oct 2022 13:31:15 +0200 Message-Id: <20221024113004.055435333@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747572860400081727?= X-GMAIL-MSGID: =?utf-8?q?1747572860400081727?= From: Stefan Wahren [ Upstream commit 0b919a3728691c172312dee99ba654055ccd8c84 ] The return value of bcm2835_clock_rate_from_divisor is always unsigned and also all caller expect this. So fix the declaration accordingly. Fixes: 41691b8862e2 ("clk: bcm2835: Add support for programming the audio domain clocks") Signed-off-by: Stefan Wahren Link: https://lore.kernel.org/r/20220904141037.38816-1-stefan.wahren@i2se.com Reviewed-by: Ivan T. Ivanov Reviewed-by: Florian Fainelli Signed-off-by: Stephen Boyd Signed-off-by: Sasha Levin --- drivers/clk/bcm/clk-bcm2835.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/clk/bcm/clk-bcm2835.c b/drivers/clk/bcm/clk-bcm2835.c index fd78dd5356ed..5a2f8d5d8d7a 100644 --- a/drivers/clk/bcm/clk-bcm2835.c +++ b/drivers/clk/bcm/clk-bcm2835.c @@ -950,9 +950,9 @@ static u32 bcm2835_clock_choose_div(struct clk_hw *hw, return div; } -static long bcm2835_clock_rate_from_divisor(struct bcm2835_clock *clock, - unsigned long parent_rate, - u32 div) +static unsigned long bcm2835_clock_rate_from_divisor(struct bcm2835_clock *clock, + unsigned long parent_rate, + u32 div) { const struct bcm2835_clock_data *data = clock->data; u64 temp; From patchwork Mon Oct 24 11:31:16 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8882 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp433449wru; Mon, 24 Oct 2022 05:49:32 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6/fozw9n5QLFv99Hfv55ZgTCGNIh/+kma5TGSfGxy2I/FkUQecp+thgkWaKaZ+Y6z8ayFr X-Received: by 2002:a17:907:7fa5:b0:791:9a5f:101a with SMTP id qk37-20020a1709077fa500b007919a5f101amr27333359ejc.453.1666615772829; Mon, 24 Oct 2022 05:49:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666615772; cv=none; d=google.com; s=arc-20160816; b=QSaeSCdDYT5w4UR7TA+4o0M8otjSFvnMD4wBzidO8kHXqHszmEMRinUFVkAvYeHzfz VoKBKzGUdp+SB7wohNNk/gUNpdTIaS3Ceq1aw+2iEcgOY8XLM2wJ1M4M6WnubkJqV2tk AHoTuAJaPel6a3dsCyy54o6YkVDLCM0yeZ4JfoGragZKUCjYZsdt4Gip5gXUc3ousUTn H6prIVy9IEEUk/BuI5yxW/yx1IdTpDKrWdx9YsETUytZMGDl8G2zbEQ6X3ts9tLSpEX/ AKZW1d5KMNk1SNVwIuTO9sJFyLrRZupfYydpneWEWvR7anWLqSEEGkckEcXIQKjuKuB3 e3tw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=zxz2aFx3qD3JbKa/GPaw/tyif26U2V5X9sHZVfTfK/Q=; b=DtY4bjqQ1wiLPfNx4IW7PDap7TvxW5294aOJAyDRSyYN5cuwAwVJ+LKmKOMYe0i3CB 9lJh/rW/MY/mkgBi+x7a26XMocedePyEiVYZtLnoJHisW/6Pzmnx4qHReR5gK9zDJSqB YurNkTaB1W3IUMoc8+TjlNJxx27qxg3peAzB6XNsL7MGM3TUR8qYSI03KQ+oWFGSbniq ENooycBKxDeL23n/X0DZyE/KYKccDtR5zBxlaSggYRhRT2QKHpXcm2eeN1pIRWhQhaDN xicQ4rdofGeh8DLczRnrUhfcz71A6z+nkSkd98zcsfA62wXDLNbHLO7eDNS2x3mjk1lM dxUA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=gSF+UaIh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i10-20020a1709064fca00b0078db1258ae9si32697627ejw.555.2022.10.24.05.49.08; Mon, 24 Oct 2022 05:49:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=gSF+UaIh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231738AbiJXMiF (ORCPT + 99 others); Mon, 24 Oct 2022 08:38:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51200 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233904AbiJXMdp (ORCPT ); Mon, 24 Oct 2022 08:33:45 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7E262476FD; Mon, 24 Oct 2022 05:05:00 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 03310B811F5; Mon, 24 Oct 2022 12:02:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 58533C433C1; Mon, 24 Oct 2022 12:02:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612969; bh=rJmvJX1Yd+VCFEKraff9jIv/6wTZs/svtd+hRJMqLjc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gSF+UaIhCJ4S1+Q66DjdfdWYwK6EU6zTAX+PT9KrKeVuqeRpY2oQmkwJ6M0OtNqKg uewdZISQ032FND2t8qmGCvlVZX8L2BgCQoO/Y/se8S0K1tF460UI8AXA1Ri6LS4Rnt hP7CM5wyMuwxgtea/1f4dPv8Wr/x7Qgbj5owhhxQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Miaoqian Lin , Tony Lindgren , Stephen Boyd , Sasha Levin Subject: [PATCH 4.19 157/229] clk: ti: dra7-atl: Fix reference leak in of_dra7_atl_clk_probe Date: Mon, 24 Oct 2022 13:31:16 +0200 Message-Id: <20221024113004.085012351@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747573300742175916?= X-GMAIL-MSGID: =?utf-8?q?1747573300742175916?= From: Miaoqian Lin [ Upstream commit 9c59a01caba26ec06fefd6ca1f22d5fd1de57d63 ] pm_runtime_get_sync() will increment pm usage counter. Forgetting to putting operation will result in reference leak. Add missing pm_runtime_put_sync in some error paths. Fixes: 9ac33b0ce81f ("CLK: TI: Driver for DRA7 ATL (Audio Tracking Logic)") Signed-off-by: Miaoqian Lin Link: https://lore.kernel.org/r/20220602030838.52057-1-linmq006@gmail.com Reviewed-by: Tony Lindgren Signed-off-by: Stephen Boyd Signed-off-by: Sasha Levin --- drivers/clk/ti/clk-dra7-atl.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/clk/ti/clk-dra7-atl.c b/drivers/clk/ti/clk-dra7-atl.c index beb672a215b6..a4b6f3ac2d34 100644 --- a/drivers/clk/ti/clk-dra7-atl.c +++ b/drivers/clk/ti/clk-dra7-atl.c @@ -252,14 +252,16 @@ static int of_dra7_atl_clk_probe(struct platform_device *pdev) if (rc) { pr_err("%s: failed to lookup atl clock %d\n", __func__, i); - return -EINVAL; + ret = -EINVAL; + goto pm_put; } clk = of_clk_get_from_provider(&clkspec); if (IS_ERR(clk)) { pr_err("%s: failed to get atl clock %d from provider\n", __func__, i); - return PTR_ERR(clk); + ret = PTR_ERR(clk); + goto pm_put; } cdesc = to_atl_desc(__clk_get_hw(clk)); @@ -292,8 +294,9 @@ static int of_dra7_atl_clk_probe(struct platform_device *pdev) if (cdesc->enabled) atl_clk_enable(__clk_get_hw(clk)); } - pm_runtime_put_sync(cinfo->dev); +pm_put: + pm_runtime_put_sync(cinfo->dev); return ret; } From patchwork Mon Oct 24 11:31:17 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8828 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp431349wru; Mon, 24 Oct 2022 05:43:33 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4DI9Bniv7WNfIrNEVrvpMSW73bd3gEOLVQyZot5xfXi+CgMdsZdglI7PsR+0BpU+iaDiVp X-Received: by 2002:a17:902:ced2:b0:186:9803:76bb with SMTP id d18-20020a170902ced200b00186980376bbmr9420460plg.83.1666615413138; Mon, 24 Oct 2022 05:43:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666615413; cv=none; d=google.com; s=arc-20160816; b=piJb2z3JvCzQBOZRJj5FYMkVUTBPPu4mx9h0RHc3U2rP+T3rvHPxKy0Z8l4w12iIMZ 02Bhm8DgZBoVW1k0bwECVAsWniqFPw7cYh/57KvPnW/kaOyHCHCyTsltORBMhvb+nWiM uCKqbIe1pbgT2BOVGAin/erWoIFcc/j5JYyP9Vzc5LpvuJdbhnTCprmiyyMXpRPxuZVQ XEqYDeXxbsiVZek6rBPsAaO8pHwmE+51q1fn54T0HYXuemRkD5mlSPRNnl1EbrNdvZLl 8k/SdRYnDpAB74Kt049zVfldLy304HO8clUtKSnFEZ7oeSq/UtMFcszvyYaWTVoeCrGJ 5Glg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=dKR2KIQ6XAAcEXroS18qrcaqJIIpeK8+drgCLait5kw=; b=rnccaV4f+npKC+sJjwIwfB8Pl9lKSmGaOUaCctiDJVZ1tQKMMvXAFqOYSDZQVmWAEI erWmceiImFGIveTiJ8T25KJtiNMJp0jJTXLv4HuUNAqV6eDWFuLy9LspJcSrDXZBffcU aa4lECKu1NbJzdkPH+X3750ecBrOzalwGoTDcOcMkbd/ZMQqZga18jeL49MMEybYrpBk EJeIMB+g1tGjcPfQyzBPw4AA0Kk0sgRNSCLiPIyvXHiVxWb2fPSSY4frL6pweU8TsBN5 1Itn2SCjrzmjEGfwguTHgA2gPHgAmRFmaj372fN4fkj2Zd3ZPOyxwaaaaglfdpi+1BSQ pOVA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=VmUb94R9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e11-20020a17090301cb00b001787f1922a7si43947718plh.19.2022.10.24.05.43.12; Mon, 24 Oct 2022 05:43:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=VmUb94R9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234501AbiJXMfS (ORCPT + 99 others); Mon, 24 Oct 2022 08:35:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51162 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234243AbiJXM3s (ORCPT ); Mon, 24 Oct 2022 08:29:48 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 05136895DE; Mon, 24 Oct 2022 05:03:44 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id DCC03612D2; Mon, 24 Oct 2022 12:02:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F0894C433D6; Mon, 24 Oct 2022 12:02:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612972; bh=frh3ChJeHGWvclmldQc8G3du3v9eRy5i/YPzCKhzBE4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VmUb94R9hyyfBN01ngbXQwAUIytU+6LshE2HZwnxoJaG+YL/YCt7AM6yzAYPiMXXq GUawSdSiVt7fvIIGSpc6FH2ULr2+lZ098gSRXYul54xpM8KWyG6j35hBn3Im4YzaUG 84QrgHhYK1R5yhZJbR36GG1XpMwLwCp+OSoeMEy8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jack Wang , Jassi Brar , Sasha Levin Subject: [PATCH 4.19 158/229] mailbox: bcm-ferxrm-mailbox: Fix error check for dma_map_sg Date: Mon, 24 Oct 2022 13:31:17 +0200 Message-Id: <20221024113004.114523680@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747572923462993491?= X-GMAIL-MSGID: =?utf-8?q?1747572923462993491?= From: Jack Wang [ Upstream commit 6b207ce8a96a71e966831e3a13c38143ba9a73c1 ] dma_map_sg return 0 on error, fix the error check, and return -EIO to caller. Fixes: dbc049eee730 ("mailbox: Add driver for Broadcom FlexRM ring manager") Signed-off-by: Jack Wang Signed-off-by: Jassi Brar Signed-off-by: Sasha Levin --- drivers/mailbox/bcm-flexrm-mailbox.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/mailbox/bcm-flexrm-mailbox.c b/drivers/mailbox/bcm-flexrm-mailbox.c index 96bcabfebc23..543c4a4a8fca 100644 --- a/drivers/mailbox/bcm-flexrm-mailbox.c +++ b/drivers/mailbox/bcm-flexrm-mailbox.c @@ -634,15 +634,15 @@ static int flexrm_spu_dma_map(struct device *dev, struct brcm_message *msg) rc = dma_map_sg(dev, msg->spu.src, sg_nents(msg->spu.src), DMA_TO_DEVICE); - if (rc < 0) - return rc; + if (!rc) + return -EIO; rc = dma_map_sg(dev, msg->spu.dst, sg_nents(msg->spu.dst), DMA_FROM_DEVICE); - if (rc < 0) { + if (!rc) { dma_unmap_sg(dev, msg->spu.src, sg_nents(msg->spu.src), DMA_TO_DEVICE); - return rc; + return -EIO; } return 0; From patchwork Mon Oct 24 11:31:18 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8881 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp433399wru; Mon, 24 Oct 2022 05:49:23 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5nSHa5rCnEJVQrdi8yEJYTwmpB8hnx/7qHy7FYqOboqsuKOIW1B+Yfmw6QNE72LyT1/cJf X-Received: by 2002:a17:907:72c5:b0:798:1c8f:5bc7 with SMTP id du5-20020a17090772c500b007981c8f5bc7mr19258669ejc.119.1666615762906; Mon, 24 Oct 2022 05:49:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666615762; cv=none; d=google.com; s=arc-20160816; b=WQJJ7TPY6dKGKHc40gzKjG0XDbybjO8dGAQBc2VYd738lblTsv3oJegz8NRl0n0raN a7LH9iTtBvB2zcS0Kxs1lrWvf38416021QjQmlc0GRkjnWj/Z5ofMK+Dn/dvnV29BtRA c48x8iTxu+0l6opwoHukzGear9CcTtLNGRZ7YgyQ8elcympttGHpyDaMlU/4exKOWf+p 3uIUWlSiYvFrVQ3mW9J7wJlL2nPiafF1vfMqhkgqpQkwY6djO3l8Vgu9qqibexk442f1 IJ1AoCriLXrxoevEfZhgLHWhwWjMLD8oaAXajqfCZwXiiMqaB8YibRf9TDhINSJu7Fqq FRIw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=+gofdmkVWc1mrbU+lr1LvAr0n8i1COhujW2Mp619q04=; b=VTcKfVjqnBHsrChXqp7MPjaBYCAUsrL2xRFW/XchwMVC7ZfsfPIAmU2Flj6Yk2HmTf 1kLHcIIRaivEERdRBMZkH0F4qBNxeDLsdIKDDX0YEH2XC3d318ggnWFMEeatSU9ym0Lg av23wQBUnDB66uQcQ6T/RNCpT3DMcq7lsGKiIR20xglY9ijLoZeiMXMFcBd/oUYgvCV6 QikcYdsNXVAOFLFOXZT8RL4icNWnnfc9Y3rhFqO/M8F/Z7Zk+QmnYmke11Jw/rNL38P5 Yy6SLN7uitPNmfezHabKppCBKCDyPgmEr5aa5LGyunewhtIPU05FxTdCrcVvhaJqTSJo bi/g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=k1rhizwg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t8-20020a056402524800b00461f0d84ee1si674544edd.228.2022.10.24.05.48.58; Mon, 24 Oct 2022 05:49:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=k1rhizwg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233731AbiJXMhM (ORCPT + 99 others); Mon, 24 Oct 2022 08:37:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57260 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234465AbiJXMaY (ORCPT ); Mon, 24 Oct 2022 08:30:24 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EB299B1C9; Mon, 24 Oct 2022 05:04:36 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 78287B8119E; Mon, 24 Oct 2022 12:01:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D0AC8C433C1; Mon, 24 Oct 2022 12:01:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612891; bh=erAD5uHFs99vtk9Q9Iu4F3CHrxzngC84yqaARqMsmBg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=k1rhizwgGDKREOOwUNJ8V37zlc6NtyxnWg9Tw0ORfJdvONBnUjcNtLIADVGk9WHYK 1BJ9QwzGJtEXkzb6FfE25GQl2YwGlxYj6oYF8ejV93fr1Eq6+nrqRaJ1G0Q2EQF5di z7j4LzNJwhrBx9cSZlEEgO/Uq17YzT2R8Ge9bBvI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, kernel test robot , Nathan Chancellor , Christophe Leroy , Michael Ellerman , Sasha Levin Subject: [PATCH 4.19 159/229] powerpc/math_emu/efp: Include module.h Date: Mon, 24 Oct 2022 13:31:18 +0200 Message-Id: <20221024113004.144455405@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747573289730294514?= X-GMAIL-MSGID: =?utf-8?q?1747573289730294514?= From: Nathan Chancellor [ Upstream commit cfe0d370e0788625ce0df3239aad07a2506c1796 ] When building with a recent version of clang, there are a couple of errors around the call to module_init(): arch/powerpc/math-emu/math_efp.c:927:1: error: type specifier missing, defaults to 'int'; ISO C99 and later do not support implicit int [-Wimplicit-int] module_init(spe_mathemu_init); ^ int arch/powerpc/math-emu/math_efp.c:927:13: error: a parameter list without types is only allowed in a function definition module_init(spe_mathemu_init); ^ 2 errors generated. module_init() is a macro, which is not getting expanded because module.h is not included in this file. Add the include so that the macro can expand properly, clearing up the build failure. Fixes: ac6f120369ff ("powerpc/85xx: Workaroudn e500 CPU erratum A005") [chleroy: added fixes tag] Reported-by: kernel test robot Signed-off-by: Nathan Chancellor Signed-off-by: Christophe Leroy Signed-off-by: Michael Ellerman Reviewed-by: Christophe Leroy Link: https://lore.kernel.org/r/8403854a4c187459b2f4da3537f51227b70b9223.1662134272.git.christophe.leroy@csgroup.eu Signed-off-by: Sasha Levin --- arch/powerpc/math-emu/math_efp.c | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/powerpc/math-emu/math_efp.c b/arch/powerpc/math-emu/math_efp.c index 581f404caa1d..b9848179dbaa 100644 --- a/arch/powerpc/math-emu/math_efp.c +++ b/arch/powerpc/math-emu/math_efp.c @@ -21,6 +21,7 @@ #include #include +#include #include #include From patchwork Mon Oct 24 11:31:19 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8877 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp433295wru; Mon, 24 Oct 2022 05:49:03 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7S26/hgcLVcIdLYQc1CimLrL13OIIorMKnXpkP5ZxAqE8vLBwphveZYQuhNCw1yGl8qkXQ X-Received: by 2002:a63:4282:0:b0:46e:9bac:6d9e with SMTP id p124-20020a634282000000b0046e9bac6d9emr18889826pga.334.1666615743200; Mon, 24 Oct 2022 05:49:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666615743; cv=none; d=google.com; s=arc-20160816; b=yp2/1qkOjwvhVH7xKoJxq3EaYG4HYGN1aTy6ZhYXUWF5gMeMwF4RtAsZauFWdrIAOg cYyQZzrhERplUtrKn7Z7HNZUnNgNjQwkho9Wjbl+HpnahgR7Msnn5ZXqhdXX9z+Diwyg tGgaGjnhbLwHIDAj8HPh6v7o0RMp+Cm04k1x0YNO+rXqrUjJXdKMFCEql39aVbcPATwy l1bKSnkuZZnRLaWVyCzu2g5qipsKQZQCk7caGHQyi1+KYWKB5ASvmf3GOjKlWvxG1lu+ PQtDNH02T84dlH0UbEekJeXO76BENoI2uzTcAoz2Bz42NVmxI+QaX5L8JtDFUgtD+hbz RGQQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=WDkDKj1O7oO+OvaWK7i6FwljzBGiyQ9jC5kcyFvWEK8=; b=Mb2b7C9vBMc4r4UqVhE2Qy9+5j6WtO0epL0o7GkkrSAOolzi0UYUwKzsROhcaMBCyn 8742P5lvMImH8exYqILFFE6lgfgqx/PN6RafOGT0CUfZns2aMnwajmGdNZ7qrlTUgdOo AE6riy2vbGlWO60xWP++fVk1Pf918gEIehkfA0u0ZGMjcVA1VAnofCQpMf64i9QHF8wy fxwTYQAr8Mex9mCVdjk5jgu/SnNCmKsjbgLO6zZcFoc82QsvixMadheSREELJ0r+uPkt Kmv31DMQZWIqRgi2nJVll4TUvXQsY5FP3Rj6KonK9nEuAqhLwxaAx8LbqVGS5Q37oiK7 +K4g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=pISd+Wqm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e9-20020a170902d38900b0018678dab04asi10122815pld.189.2022.10.24.05.48.48; Mon, 24 Oct 2022 05:49:03 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=pISd+Wqm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234251AbiJXMmm (ORCPT + 99 others); Mon, 24 Oct 2022 08:42:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38712 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234681AbiJXMk2 (ORCPT ); Mon, 24 Oct 2022 08:40:28 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 717CC8C478; Mon, 24 Oct 2022 05:08:19 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 63C2761280; Mon, 24 Oct 2022 12:01:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7886DC433C1; Mon, 24 Oct 2022 12:01:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612893; bh=/1DW5WW1xl+F1DQUELEVGXcIOZpqadrzRHptiXSg1bE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pISd+WqmQlRPKoEAcQkrSMnipOd0pbNnM3QeBE5VBsLMMHl2C8w4hCkE0rLouvh0L 9dwm4vztcMHCNzDk7oCccjPT9oRZCacrkItHvpFsmAfHx3urxVDXMONj6c9b25v2Ln jV+dmjKQb86nJBKCUrFdpKt56leycrSy8KXGigKo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Liang He , Michael Ellerman , Sasha Levin , Miaoqian Lin Subject: [PATCH 4.19 160/229] powerpc/sysdev/fsl_msi: Add missing of_node_put() Date: Mon, 24 Oct 2022 13:31:19 +0200 Message-Id: <20221024113004.174029483@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747573269390949952?= X-GMAIL-MSGID: =?utf-8?q?1747573269390949952?= From: Liang He [ Upstream commit def435c04ee984a5f9ed2711b2bfe946936c6a21 ] In fsl_setup_msi_irqs(), use of_node_put() to drop the reference returned by of_parse_phandle(). Fixes: 895d603f945ba ("powerpc/fsl_msi: add support for the fsl, msi property in PCI nodes") Co-authored-by: Miaoqian Lin Signed-off-by: Liang He Signed-off-by: Michael Ellerman Link: https://lore.kernel.org/r/20220704145233.278539-1-windhl@126.com Signed-off-by: Sasha Levin --- arch/powerpc/sysdev/fsl_msi.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/powerpc/sysdev/fsl_msi.c b/arch/powerpc/sysdev/fsl_msi.c index df95102e732c..44aedb6b9f55 100644 --- a/arch/powerpc/sysdev/fsl_msi.c +++ b/arch/powerpc/sysdev/fsl_msi.c @@ -216,8 +216,10 @@ static int fsl_setup_msi_irqs(struct pci_dev *pdev, int nvec, int type) dev_err(&pdev->dev, "node %pOF has an invalid fsl,msi phandle %u\n", hose->dn, np->phandle); + of_node_put(np); return -EINVAL; } + of_node_put(np); } for_each_pci_msi_entry(entry, pdev) { From patchwork Mon Oct 24 11:31:20 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8913 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp434353wru; Mon, 24 Oct 2022 05:52:01 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5tlVCfyteAkQkMhuXI8vZR+QSZbr5tWJjgyMZ62ZFRA+weA4UEUb0MMJf+KJtWEVtuMYa1 X-Received: by 2002:a17:906:8a4b:b0:7a7:3e17:7f91 with SMTP id gx11-20020a1709068a4b00b007a73e177f91mr5041234ejc.331.1666615921625; Mon, 24 Oct 2022 05:52:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666615921; cv=none; d=google.com; s=arc-20160816; b=CpKRo6VbbfK1ElxwHZ+7+wKNjDks+LxiZb2i19BkRdyzDT4hbiY4Y3eWNXLzzVeSD5 HjjzMryK/6BJXT0tOiUIXc2z1RO2BqQ9TQMiYbpzGk6Hvv+C/dmmXK3GMk61q7HSVVds YPxvoiM2E1+H0BzAxvW1A2dPINvSpBWsraue1LSDnUTQa8dkzHnJXGHeB1hz0PP07SGs OirfkGFN4IRvEhqQIexqmXH447J88fZ88elPtkegcYdCUYmNUuCDvz8VVaVZCtzQkMfQ BF3MefamWBbDWDriV+CxKuOJqQS+RCgTXUeQ4Rou+QeZhP2xtVPOMC3VWrXh1LbJWJPb ofWg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=xPYwQIKXV2kKHhHHARdNSxtrMugLGMCfHihp2/Dvaho=; b=UA9+WhOjhC55gF3IoA1qH/3YtWTUSM+WQvr4EHw+mNdQ49k9/Q91Pi4F0FozpYiGp2 R9tMaKTbxi7vAgeRgkNfZUbNDrcY5GnEfZuduWcDswLsBhltRg6MXfg1YlvTZHZ1WP6L kci5VJ3aMZ/NBEJWUfzsFY8NrDvUpvYi1rKusTuRI5Qy8sGBhtiXunaP6sCK/lApHxra AhLAtF8WH+uGYnCCzWcp/qvpZaA7m57BrR+KvKejR5mjHb7fGFfRSIAvhzTBVQZCZ55N rvPcdu5u0fKxvrZ7U+AuNYtGC31NjJQmeFyCQYz8bzhINzKx/kDnt5XrGAlib2QZXpqr E+dw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=FaTtIkvZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i7-20020a1709064fc700b0078e1b5b5bb8si29545014ejw.120.2022.10.24.05.51.36; Mon, 24 Oct 2022 05:52:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=FaTtIkvZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234695AbiJXMtT (ORCPT + 99 others); Mon, 24 Oct 2022 08:49:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37836 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234445AbiJXMov (ORCPT ); Mon, 24 Oct 2022 08:44:51 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6E4FB7D785; Mon, 24 Oct 2022 05:09:04 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 0658F6129E; Mon, 24 Oct 2022 12:01:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 15166C433C1; Mon, 24 Oct 2022 12:01:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612896; bh=hKQiSeCsgWMSlBAR3PYxI/Z9PtWgM478Tkqef9C7Tr8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FaTtIkvZiHYs8ewjetprNS2ICWQanb1JtbuN0VPWz9jkTlT20tgBDPxOxUxrDfNUp GAjdWXTt44FYrDL+LsYdouZGW12T8W+iahIzaCACVNWdm8BiQ26mvFlIi72CmbK8Tc Gh5vxWl6KrNJkbc//HUMHE3cqGWiwd69dsZIEKaU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Liang He , Michael Ellerman , Tyrel Datwyler , Sasha Levin , Miaoqian Lin Subject: [PATCH 4.19 161/229] powerpc/pci_dn: Add missing of_node_put() Date: Mon, 24 Oct 2022 13:31:20 +0200 Message-Id: <20221024113004.203845169@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747573456427376580?= X-GMAIL-MSGID: =?utf-8?q?1747573456427376580?= From: Liang He [ Upstream commit 110a1fcb6c4d55144d8179983a475f17a1d6f832 ] In pci_add_device_node_info(), use of_node_put() to drop the reference to 'parent' returned by of_get_parent() to keep refcount balance. Fixes: cca87d303c85 ("powerpc/pci: Refactor pci_dn") Co-authored-by: Miaoqian Lin Signed-off-by: Liang He Signed-off-by: Michael Ellerman Reviewed-by: Tyrel Datwyler Link: https://lore.kernel.org/r/20220701131750.240170-1-windhl@126.com Signed-off-by: Sasha Levin --- arch/powerpc/kernel/pci_dn.c | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/powerpc/kernel/pci_dn.c b/arch/powerpc/kernel/pci_dn.c index 7cecc3bd953b..bd68c3259fad 100644 --- a/arch/powerpc/kernel/pci_dn.c +++ b/arch/powerpc/kernel/pci_dn.c @@ -338,6 +338,7 @@ struct pci_dn *pci_add_device_node_info(struct pci_controller *hose, INIT_LIST_HEAD(&pdn->list); parent = of_get_parent(dn); pdn->parent = parent ? PCI_DN(parent) : NULL; + of_node_put(parent); if (pdn->parent) list_add_tail(&pdn->list, &pdn->parent->child_list); From patchwork Mon Oct 24 11:31:21 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8754 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp430321wru; Mon, 24 Oct 2022 05:41:15 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6LfFV7oUxpXJ1UvRICUx7S2qRD+YjBJQgwFbPZWLBupiXVCfWnp1WCDRJSQYPyS1Ikh+kh X-Received: by 2002:a62:4c6:0:b0:55f:c739:51e0 with SMTP id 189-20020a6204c6000000b0055fc73951e0mr33124615pfe.49.1666615274691; Mon, 24 Oct 2022 05:41:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666615274; cv=none; d=google.com; s=arc-20160816; b=aZWA1ztYt+p5WI6bj7+eSgZmZZhqQB6yYjviQFq9stvYhSr/tNuIMNnVqyD2QjbKcU jcabTqHXt8X5D2isK/QvfjBhcFK8qvej1HA0jn0r4/b8R1QYe1J96/HscvKPdmGdIdsx GjhX3djQFgFtIE1PA/HDRG77fa2oezmpbXQ0503f2hRAC4i8J+BmXOr4nvjTG5nViE/1 VQcp6lAPgy7wAnIUtrrbOr6Y9G7kpd5jEa+E0/9YnOHMJqFEu+Qem3gxuqpVMug3Zi77 TGdbaDTkPAkiW2TSLjTyxZLjy8w4QrGmKV2KRgIg++wp+4sK3SRl7E10FCyzrn56gdRJ 6M1w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=/USIhJkX/VxQ0luiqp66HPRV+tWSlvbveNkN9wKBowk=; b=oty11lCof0Bg2KpmbiMxIYyCcm12Ci8XKH/0jYcFsoEtdqNCOiYUNFKR+boS4c28p5 5+Pc9sv6DsXOJl2d/ZsWhFK5BxlSURG033QdYeq+MmG0n/alWcAue3pMGEqe7zbY67PF 4hK7Z6wMNdaTep2vaEYKSSXJPudfH3kfVVugKBPUygeLYJn7MGCc7PQqJMPny1GzjE3E Tq9swMKxFzZxDIs4hFfwwaagNISwYSwlk7A/g06yiiGPqa600woDTyqiKoaVecw0jYw7 TfPd8m6lFUrnLNmPG86LEPxqk1HsZBZtTVt7mRl6vJIkKCwkX/nAPOVu3jCfpy62od+2 Y/Qw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=FgE7c6gT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j30-20020a63231e000000b0043c1481a835si35475236pgj.267.2022.10.24.05.41.01; Mon, 24 Oct 2022 05:41:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=FgE7c6gT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233774AbiJXM25 (ORCPT + 99 others); Mon, 24 Oct 2022 08:28:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60552 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233772AbiJXM1v (ORCPT ); Mon, 24 Oct 2022 08:27:51 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7F6BD86829; Mon, 24 Oct 2022 05:01:43 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 999ED612D5; Mon, 24 Oct 2022 12:01:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id ABB86C433D6; Mon, 24 Oct 2022 12:01:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612899; bh=OPvKQlWY0F2insuCibDJuN0GBxXXp9dptRoxA7EYvbA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FgE7c6gT3fKVaxC2s5O9rIDeYR/khoo4XP+3KxHGz98BPhmpgGX9ysIQAeBhKOuMQ EvxSzLIw7vAzMtOO8jezP/C+SQI07zghMWuaLqdg7BhJXVxPgbcYIgY+PGjbcvm4ff +ObFDzdO3FyGj3diqPeR/THFJW34KouUx8L+0wgk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zheng Yongjun , Michael Ellerman , Sasha Levin Subject: [PATCH 4.19 162/229] powerpc/powernv: add missing of_node_put() in opal_export_attrs() Date: Mon, 24 Oct 2022 13:31:21 +0200 Message-Id: <20221024113004.233050720@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747572778535719474?= X-GMAIL-MSGID: =?utf-8?q?1747572778535719474?= From: Zheng Yongjun [ Upstream commit 71a92e99c47900cc164620948b3863382cec4f1a ] After using 'np' returned by of_find_node_by_path(), of_node_put() need be called to decrease the refcount. Fixes: 11fe909d2362 ("powerpc/powernv: Add OPAL exports attributes to sysfs") Signed-off-by: Zheng Yongjun Signed-off-by: Michael Ellerman Link: https://lore.kernel.org/r/20220906141703.118192-1-zhengyongjun3@huawei.com Signed-off-by: Sasha Levin --- arch/powerpc/platforms/powernv/opal.c | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/powerpc/platforms/powernv/opal.c b/arch/powerpc/platforms/powernv/opal.c index edf9032e2e5c..96a3d23132ba 100644 --- a/arch/powerpc/platforms/powernv/opal.c +++ b/arch/powerpc/platforms/powernv/opal.c @@ -740,6 +740,7 @@ static void opal_export_attrs(void) kobj = kobject_create_and_add("exports", opal_kobj); if (!kobj) { pr_warn("kobject_create_and_add() of exports failed\n"); + of_node_put(np); return; } From patchwork Mon Oct 24 11:31:22 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8883 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp433450wru; Mon, 24 Oct 2022 05:49:33 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6jTzj5wBMNw1y8XFw8/jOddhqXSC77Qzk4rqcW5cgWlYSeOBNJjmzOCeDIvgBWZa9lWTtp X-Received: by 2002:a17:907:724d:b0:78d:acf4:4c57 with SMTP id ds13-20020a170907724d00b0078dacf44c57mr27469770ejc.516.1666615773022; Mon, 24 Oct 2022 05:49:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666615773; cv=none; d=google.com; s=arc-20160816; b=jtK2pEA+mBxNTZ8w1KIrXVnaVZcUkJtijr8hzS/oyI5h4UB6SaP72S2FbZhXExwgZC sjLLCWKJH+SxCL32wMSOGBf+kufeqHcZv48IGC+ADATMZKo5ZKbrAIdS+GVwhbRtI79n v7gyVilp62tuaXLoGlZXPXXmbgBXE3kJQQ8Az3+FgTf6T8qVQ92i1s/ebLtcCjgUbTS9 ZGRLE5cjhn5+xJjM3/4sD+NNXcsyY0qEIp4v94mqcIsgLZdICH+eOwCXMpvXaPsIhmo3 Rn1I95xls/aR6sdAazs/ys3YhzxyYGnzV/q8x43ehAiWioU/nd9xAJ+6RK8QjpMxuq3I /qQw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=8rRmmPRy5vnqeKjgu2GVAIu0qw/osPYHd20kUWrPW04=; b=pw2FWwbNz4saoouaaJbQGaMekLkwpcYk21Ip8Ii0UKXrXNWQvC+yFbbAr3ezf7Vgwr jV/R+V9LH31pCNMncgpCbH9cWTyvj6QTuFMNY15hNaEVFuFj72Ia17CyAND14rE30qdx WicwHW2m4RaBaYOB2qMT+Jg8JirRlI8IMD5C6DPcrEj+RZvSiSqUt2WJVHIZ5eEXH9Jn nlsCZDoCWvMkyjNvez18E18oruO5+1jskO8XFD2TNodCHRf7V7GLxZx1WZ7wX4fQ1nxL zEUZTMrIIo2lP/cd/k0dxTaQelkZhUHxQPDgp10cunzvQv5+3EmxzqykdRnT4bqykSyw Xlgw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=vtL4AwDL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ec33-20020a0564020d6100b004615a57e292si7636946edb.426.2022.10.24.05.49.08; Mon, 24 Oct 2022 05:49:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=vtL4AwDL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233897AbiJXMhn (ORCPT + 99 others); Mon, 24 Oct 2022 08:37:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50796 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233885AbiJXMbc (ORCPT ); Mon, 24 Oct 2022 08:31:32 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6D5071B7B9; Mon, 24 Oct 2022 05:04:41 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id ED2F8B811BD; Mon, 24 Oct 2022 12:01:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 472C3C433D6; Mon, 24 Oct 2022 12:01:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612901; bh=U9hmnfSWoenhvdy2bUmTLhdEgICpln2VqpEzU8ILty0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vtL4AwDLcrrSCDC8i2a+6MAdWPBoqAFuGWzC0l795KKzV0E7W6pYfacwq0xJwlm4j cnWyA3kpkkhq98w4fWqLBxJ4pYyw/pwjFH3PFVhrXUrFcb9oCsP3EcaVZJkpr2eYos Cnx2atOoWelDJq01/qhtIgQWJtUahWOTktCv0zDo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Maxim Levitsky , Michael Kelley , Vitaly Kuznetsov , Sean Christopherson , Paolo Bonzini , Sasha Levin Subject: [PATCH 4.19 163/229] x86/hyperv: Fix struct hv_enlightened_vmcs definition Date: Mon, 24 Oct 2022 13:31:22 +0200 Message-Id: <20221024113004.332368675@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747573300565158693?= X-GMAIL-MSGID: =?utf-8?q?1747573300565158693?= From: Vitaly Kuznetsov [ Upstream commit ea9da788a61e47e7ab9cbad397453e51cd82ac0d ] Section 1.9 of TLFS v6.0b says: "All structures are padded in such a way that fields are aligned naturally (that is, an 8-byte field is aligned to an offset of 8 bytes and so on)". 'struct enlightened_vmcs' has a glitch: ... struct { u32 nested_flush_hypercall:1; /* 836: 0 4 */ u32 msr_bitmap:1; /* 836: 1 4 */ u32 reserved:30; /* 836: 2 4 */ } hv_enlightenments_control; /* 836 4 */ u32 hv_vp_id; /* 840 4 */ u64 hv_vm_id; /* 844 8 */ u64 partition_assist_page; /* 852 8 */ ... And the observed values in 'partition_assist_page' make no sense at all. Fix the layout by padding the structure properly. Fixes: 68d1eb72ee99 ("x86/hyper-v: define struct hv_enlightened_vmcs and clean field bits") Reviewed-by: Maxim Levitsky Reviewed-by: Michael Kelley Signed-off-by: Vitaly Kuznetsov Signed-off-by: Sean Christopherson Link: https://lore.kernel.org/r/20220830133737.1539624-2-vkuznets@redhat.com Signed-off-by: Paolo Bonzini Signed-off-by: Sasha Levin --- arch/x86/include/asm/hyperv-tlfs.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/x86/include/asm/hyperv-tlfs.h b/arch/x86/include/asm/hyperv-tlfs.h index 00e01d215f74..e1bd23641fc6 100644 --- a/arch/x86/include/asm/hyperv-tlfs.h +++ b/arch/x86/include/asm/hyperv-tlfs.h @@ -682,7 +682,7 @@ struct hv_enlightened_vmcs { u64 guest_rip; u32 hv_clean_fields; - u32 hv_padding_32; + u32 padding32_1; u32 hv_synthetic_controls; struct { u32 nested_flush_hypercall:1; @@ -690,7 +690,7 @@ struct hv_enlightened_vmcs { u32 reserved:30; } hv_enlightenments_control; u32 hv_vp_id; - + u32 padding32_2; u64 hv_vm_id; u64 partition_assist_page; u64 padding64_4[4]; From patchwork Mon Oct 24 11:31:23 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8759 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp430337wru; Mon, 24 Oct 2022 05:41:15 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4n2kk2NPBu+Q6Uny+52i5M2YzRRM1zJ/Uo6WID3upimRcDUpfWEnwTvUsuPB30cBkDCz/g X-Received: by 2002:a17:902:9048:b0:17f:93a5:4638 with SMTP id w8-20020a170902904800b0017f93a54638mr33268114plz.108.1666615275653; Mon, 24 Oct 2022 05:41:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666615275; cv=none; d=google.com; s=arc-20160816; b=k0gMGrqJ0mMJj0hJG5VEy+44GJxe5vRDhOC4MYol0/TfC7z/AmeYFMSU2W96nlKNb7 GjU1Tqqst97mIETr+qdFShFjvq/ln7gNisIa3twwPud4wEG9wgu9guyeerDOMzMLJw6q 4bQe3L8n8yRQmhj65w1T7+0/p0qn0eFw8tj9iCeFQEvynmtD3hI8pPuvEGFUOG3G/AcT nD764KAXRmB6trbEyHGoR7XYBh3f9FIA/5au90IGic7irslT1wUCYDhJUpOZKgX70MwU KNy7toeAyRBCNVdbk4YnBUZiRIUS8hnZcheZKL6gJR1i93oRdw5KavLHqRcAaPQNBv7/ PLXg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=jaqCZR1x23lMss5LaRf4xRr30txkPhUXh+lT6MyFJ6A=; b=gr53j7dE+dVBrbOeMj+dfHGDU3XjiTsvFxEqDuowtJJ2ZyGh61kT3jWQhCGteKt5vI 9CcQ3NJO3XvMkD6SGSkkOtM3nTSr5oFGJp001RARyivq0dBs87e6/lmnndMPs1DYnn8b G2a0460V9id+tyCfJp+y021D+N23YxAQA94737lV9rf7PJWlYrnWNpTaq9Kt8mSMibjh gl95rmIJBJkx4RzmnvN6kJH39RaPORsVmw/shATn6zwcs8w8HpfvaRuAoo1phQfMwWIi JK+DTVZpKymWDt7Z+IrtmvzPXkafKK/J9a9dqHWw5c3+8Q0mAB1Xr8Y7RLv8KHjUmYFI aY4w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=eIYHZJex; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v23-20020a634657000000b00455bdca34dcsi36220709pgk.88.2022.10.24.05.41.02; Mon, 24 Oct 2022 05:41:15 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=eIYHZJex; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234062AbiJXM3Q (ORCPT + 99 others); Mon, 24 Oct 2022 08:29:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45142 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233826AbiJXM2V (ORCPT ); Mon, 24 Oct 2022 08:28:21 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B21D486822; Mon, 24 Oct 2022 05:01:57 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id CFD1A612D6; Mon, 24 Oct 2022 12:01:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DE292C433C1; Mon, 24 Oct 2022 12:01:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612904; bh=KVvd0PtzsKmWH3xk/PNjyBKeL2/HnerrXU27sC6DEu8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eIYHZJex0sqHhYMMKI71ohxLVSKjcp5Gw38dQUwDC0PQ3ozpVIG3Wd65Gy99sAvZJ GtXb/I+e3YU1PqDwCTaUbsMpIrjtTKq5F6GLN8by7clJfqifeAn+84foeBTZmFtY8T mqR2Wsuzg+Gu41xnGxXt+3bX5nXq5aEXokdEfXFI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Nicholas Piggin , Segher Boessenkool , Michael Ellerman , Sasha Levin Subject: [PATCH 4.19 164/229] powerpc/64s: Fix GENERIC_CPU build flags for PPC970 / G5 Date: Mon, 24 Oct 2022 13:31:23 +0200 Message-Id: <20221024113004.373416626@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747572779164827981?= X-GMAIL-MSGID: =?utf-8?q?1747572779164827981?= From: Nicholas Piggin [ Upstream commit 58ec7f06b74e0d6e76c4110afce367c8b5f0837d ] Big-endian GENERIC_CPU supports 970, but builds with -mcpu=power5. POWER5 is ISA v2.02 whereas 970 is v2.01 plus Altivec. 2.02 added the popcntb instruction which a compiler might use. Use -mcpu=power4. Fixes: 471d7ff8b51b ("powerpc/64s: Remove POWER4 support") Signed-off-by: Nicholas Piggin Reviewed-by: Segher Boessenkool Signed-off-by: Michael Ellerman Link: https://lore.kernel.org/r/20220921014103.587954-1-npiggin@gmail.com Signed-off-by: Sasha Levin --- arch/powerpc/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile index 26654d0c2af7..5987ae0d8fbb 100644 --- a/arch/powerpc/Makefile +++ b/arch/powerpc/Makefile @@ -165,7 +165,7 @@ CFLAGS-$(CONFIG_GENERIC_CPU) += -mcpu=power8 CFLAGS-$(CONFIG_GENERIC_CPU) += $(call cc-option,-mtune=power9,-mtune=power8) else CFLAGS-$(CONFIG_GENERIC_CPU) += $(call cc-option,-mtune=power7,$(call cc-option,-mtune=power5)) -CFLAGS-$(CONFIG_GENERIC_CPU) += $(call cc-option,-mcpu=power5,-mcpu=power4) +CFLAGS-$(CONFIG_GENERIC_CPU) += -mcpu=power4 endif else ifdef CONFIG_PPC_BOOK3E_64 CFLAGS-$(CONFIG_GENERIC_CPU) += -mcpu=powerpc64 From patchwork Mon Oct 24 11:31:24 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9848 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp557513wru; Mon, 24 Oct 2022 10:03:26 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4vjMD2w+incRoMYVV94Kj3NE79hZHO9Bkrw8dlMVXbMPnETbEmjQw90BV/GNmlqX01dqlw X-Received: by 2002:a17:907:25c9:b0:77b:a343:bd62 with SMTP id ae9-20020a17090725c900b0077ba343bd62mr28902669ejc.660.1666631006299; Mon, 24 Oct 2022 10:03:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666631006; cv=none; d=google.com; s=arc-20160816; b=PqxATXlbZ8Nu6knT53K+IDYmC/8LLGfHqYQEHEY7zifJcd+s5XEj8ZgfGdSfzcY+A6 2RWXfez2O6eDsUp4fQNOtJfu6gOnjbsCiBMZoMZjfl1+oO30KVcy9SyFEvJ+nLb8dJ+r /FXxAY46r6T+TenBOZS1D+fEpTmRyLx008/IQJLe6Ekoa/2TXTVooK/5QR1fDnX3gdSP 9a0jYCd4GhpvoHKhsOovsMw9L3nAwDr/6oMOb1cXMSPsOnsqy4/JAyIJqDom6c4iSJ5k 312swvdVTCDtDs+waleqcmFcT8L7+WONgMg3P+QaRG2q9PzuNIF7EGt4EXcnWmXM5M4Z pJ0g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=xfzsNIZMn1FsTC5NP+HI9wqJ48gCcqvumFHNqaeUphw=; b=acbnASzFW+rgaQCPyvVQO/xgJnLP4dyHrS5eCqoFzdoxC+tvD7MbTKmv480Hv9GAko X/6HXtYZepQyWfzjQ5nS/38OillM+8YM+rblv8OgoopDoY4iEL6fr6C0qzMib9rS9yp5 QUhpF3K9gkCaOztw02B+ZHwKcQ3HOwMJSVrxoE2KLO8RjT6XS9sOxW7LSzRnhzlU8/mx Xa0SAgbu+GfwXQ+6ZTFpVedKKXpTR8+/Kdf4izZVWBOfDFWlv4jmT5+DHVXT5jP5KKYj kG7JdkVqC4T0laLTW6ndaiZQLPDxgZ9yqP5JwxfSbOcWFRs3x7b2vFz4a1WUqlRB1QXV 9k2g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ryHx+0gU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p1-20020a17090628c100b0078dcdbb3e87si203621ejd.530.2022.10.24.10.02.54; Mon, 24 Oct 2022 10:03:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ryHx+0gU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232735AbiJXRBA (ORCPT + 99 others); Mon, 24 Oct 2022 13:01:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56218 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234508AbiJXQ7r (ORCPT ); Mon, 24 Oct 2022 12:59:47 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A8D0EBB1; Mon, 24 Oct 2022 08:37:31 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 21BFDB81031; Mon, 24 Oct 2022 12:01:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 785C3C433C1; Mon, 24 Oct 2022 12:01:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612906; bh=b+dCW2i6SlbVAsvvFo6j2dv3TAz1oQHd4db67WosFHs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ryHx+0gUfMs4kKgYKIWxCOmFiL2shw3nbljgNrzh2hl2b2JpQlTvyNdSPQgvKlXX5 gc0Hb1mUbjAINpIawIPypizGkBCjOnAHowEt/List98aXR2h4qLAbEUbGmlFwqrqxD juGJ4Oujix2/KS82DtRZeQLpDmqTcimy6UT4dLS8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?utf-8?q?Pali_Roh=C3=A1r?= , Michael Ellerman , Sasha Levin Subject: [PATCH 4.19 165/229] powerpc: Fix SPE Power ISA properties for e500v1 platforms Date: Mon, 24 Oct 2022 13:31:24 +0200 Message-Id: <20221024113004.420749631@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747589274001289461?= X-GMAIL-MSGID: =?utf-8?q?1747589274001289461?= From: Pali Rohár [ Upstream commit 37b9345ce7f4ab17538ea62def6f6d430f091355 ] Commit 2eb28006431c ("powerpc/e500v2: Add Power ISA properties to comply with ePAPR 1.1") introduced new include file e500v2_power_isa.dtsi and should have used it for all e500v2 platforms. But apparently it was used also for e500v1 platforms mpc8540, mpc8541, mpc8555 and mpc8560. e500v1 cores compared to e500v2 do not support double precision floating point SPE instructions. Hence power-isa-sp.fd should not be set on e500v1 platforms, which is in e500v2_power_isa.dtsi include file. Fix this issue by introducing a new e500v1_power_isa.dtsi include file and use it in all e500v1 device tree files. Fixes: 2eb28006431c ("powerpc/e500v2: Add Power ISA properties to comply with ePAPR 1.1") Signed-off-by: Pali Rohár Signed-off-by: Michael Ellerman Link: https://lore.kernel.org/r/20220902212103.22534-1-pali@kernel.org Signed-off-by: Sasha Levin --- .../boot/dts/fsl/e500v1_power_isa.dtsi | 51 +++++++++++++++++++ arch/powerpc/boot/dts/fsl/mpc8540ads.dts | 2 +- arch/powerpc/boot/dts/fsl/mpc8541cds.dts | 2 +- arch/powerpc/boot/dts/fsl/mpc8555cds.dts | 2 +- arch/powerpc/boot/dts/fsl/mpc8560ads.dts | 2 +- 5 files changed, 55 insertions(+), 4 deletions(-) create mode 100644 arch/powerpc/boot/dts/fsl/e500v1_power_isa.dtsi diff --git a/arch/powerpc/boot/dts/fsl/e500v1_power_isa.dtsi b/arch/powerpc/boot/dts/fsl/e500v1_power_isa.dtsi new file mode 100644 index 000000000000..7e2a90cde72e --- /dev/null +++ b/arch/powerpc/boot/dts/fsl/e500v1_power_isa.dtsi @@ -0,0 +1,51 @@ +/* + * e500v1 Power ISA Device Tree Source (include) + * + * Copyright 2012 Freescale Semiconductor Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Freescale Semiconductor nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * + * ALTERNATIVELY, this software may be distributed under the terms of the + * GNU General Public License ("GPL") as published by the Free Software + * Foundation, either version 2 of that License or (at your option) any + * later version. + * + * THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL Freescale Semiconductor BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/ { + cpus { + power-isa-version = "2.03"; + power-isa-b; // Base + power-isa-e; // Embedded + power-isa-atb; // Alternate Time Base + power-isa-cs; // Cache Specification + power-isa-e.le; // Embedded.Little-Endian + power-isa-e.pm; // Embedded.Performance Monitor + power-isa-ecl; // Embedded Cache Locking + power-isa-mmc; // Memory Coherence + power-isa-sp; // Signal Processing Engine + power-isa-sp.fs; // SPE.Embedded Float Scalar Single + power-isa-sp.fv; // SPE.Embedded Float Vector + mmu-type = "power-embedded"; + }; +}; diff --git a/arch/powerpc/boot/dts/fsl/mpc8540ads.dts b/arch/powerpc/boot/dts/fsl/mpc8540ads.dts index e6d0b166d68d..b4314aa6769c 100644 --- a/arch/powerpc/boot/dts/fsl/mpc8540ads.dts +++ b/arch/powerpc/boot/dts/fsl/mpc8540ads.dts @@ -11,7 +11,7 @@ /dts-v1/; -/include/ "e500v2_power_isa.dtsi" +/include/ "e500v1_power_isa.dtsi" / { model = "MPC8540ADS"; diff --git a/arch/powerpc/boot/dts/fsl/mpc8541cds.dts b/arch/powerpc/boot/dts/fsl/mpc8541cds.dts index 9fa2c734a988..48492c621edf 100644 --- a/arch/powerpc/boot/dts/fsl/mpc8541cds.dts +++ b/arch/powerpc/boot/dts/fsl/mpc8541cds.dts @@ -11,7 +11,7 @@ /dts-v1/; -/include/ "e500v2_power_isa.dtsi" +/include/ "e500v1_power_isa.dtsi" / { model = "MPC8541CDS"; diff --git a/arch/powerpc/boot/dts/fsl/mpc8555cds.dts b/arch/powerpc/boot/dts/fsl/mpc8555cds.dts index 272f08caea92..325c817dedeb 100644 --- a/arch/powerpc/boot/dts/fsl/mpc8555cds.dts +++ b/arch/powerpc/boot/dts/fsl/mpc8555cds.dts @@ -11,7 +11,7 @@ /dts-v1/; -/include/ "e500v2_power_isa.dtsi" +/include/ "e500v1_power_isa.dtsi" / { model = "MPC8555CDS"; diff --git a/arch/powerpc/boot/dts/fsl/mpc8560ads.dts b/arch/powerpc/boot/dts/fsl/mpc8560ads.dts index 7a822b08aa35..b5fb5ae3ed68 100644 --- a/arch/powerpc/boot/dts/fsl/mpc8560ads.dts +++ b/arch/powerpc/boot/dts/fsl/mpc8560ads.dts @@ -11,7 +11,7 @@ /dts-v1/; -/include/ "e500v2_power_isa.dtsi" +/include/ "e500v1_power_isa.dtsi" / { model = "MPC8560ADS"; From patchwork Mon Oct 24 11:31:25 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8813 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp431030wru; Mon, 24 Oct 2022 05:42:48 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7WVhQhS/vNQDo4g+7+GRqYvdufpbm/lsqqpGPWVmDewtxsIJpmxwgJPDTnhUZwayumMR5Q X-Received: by 2002:a63:5507:0:b0:455:603a:fbd6 with SMTP id j7-20020a635507000000b00455603afbd6mr27831102pgb.360.1666615367935; Mon, 24 Oct 2022 05:42:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666615367; cv=none; d=google.com; s=arc-20160816; b=lxmqKCdyn0874a7erJ135pn6CW/JsGVJRSCWol7uF+F0OJ5Yi2ADCBW7w5DBv0EBhS +cs+5d5e+NiRp57o3+msN2mg3ga6rQfVfVkINvxDufgb73c0r1KREpiX7ersrQ9kOy+t SUN5fv+Ch9vROo2NcK3uSD0A325LeUvmYiZiABdXEZQD7JJ5lkaqolOAP6w4+mObfqaa eKCU/7iXrWVwAvmMoVfXEIpnGwb58SsWO0GpukDoj/78eaHgdkiOoaVJR7nGZzN4Tkto w0MveYNkk61+NI+ggx/vwujHyub88wyr4XWpIO1j9Mhqty4Jv3Oa1w0AZWvcXE97Cyte eaiQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=NX3l1P7H5B1jKMveYRi8pp4KzdtsptVXdy++ScrTD3A=; b=hFM3ZjyzHJ7UpCWuovwTpuGu1QCvxgx3eHhxNiLf1XLdwrunFvfL5glx1pHlZvQgwd RQYaRbP93E3ypjGFHjItYgLwYYffpffh7L3jpP5EEYlxGT/MF1HeVHdeJUVNUifRhzYE SO3kQMiw8aHD+d0sCLCdBmgNNpkpYnkUJO4JSCNqib1KPlnjG98hMZAQxhCCVbae4aMX 0dI6DgKhBDA9bQP+SWL5NEilxGptFO0WPCMpe8FvYYnvw3Ewb3VaEMQGddKXl/zpC99t j2VC71IIxsbHHpna3O8M9NX1BidGdw8ct0fCGlPGIm1uMmCtfBhVSD7zEdi43EC+H1gE dsLg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=wyTZDyH6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id mz21-20020a17090b379500b00200ab48e149si7906230pjb.72.2022.10.24.05.42.33; Mon, 24 Oct 2022 05:42:47 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=wyTZDyH6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233855AbiJXMbB (ORCPT + 99 others); Mon, 24 Oct 2022 08:31:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60610 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233870AbiJXM2b (ORCPT ); Mon, 24 Oct 2022 08:28:31 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D4AF386F9D; Mon, 24 Oct 2022 05:02:12 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 117EA612BF; Mon, 24 Oct 2022 12:01:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1B474C433C1; Mon, 24 Oct 2022 12:01:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612909; bh=ntOrOjNGLafpbrPL0IZcl4RkV1kMjXDeWbs/qhFGiXg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wyTZDyH62gFc1Vda9kVD4hWKSCQy+IroJvSy77meEoAfHNHPGjk72Vqfg2DugOQVq cXbN+z/sl57KXMbcLStkgQj7PE5hloheZ1FKtY9m5t6RNcns9U2OpxHenIwZxSuh+c vv/WOWA39QxVxjeEZLsFW+Zsed3ARxN77K6ILXAM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dan Carpenter , Robin Murphy , Laurent Pinchart , Joerg Roedel , Sasha Levin Subject: [PATCH 4.19 166/229] iommu/omap: Fix buffer overflow in debugfs Date: Mon, 24 Oct 2022 13:31:25 +0200 Message-Id: <20221024113004.450933795@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747572876267332188?= X-GMAIL-MSGID: =?utf-8?q?1747572876267332188?= From: Dan Carpenter [ Upstream commit 184233a5202786b20220acd2d04ddf909ef18f29 ] There are two issues here: 1) The "len" variable needs to be checked before the very first write. Otherwise if omap2_iommu_dump_ctx() with "bytes" less than 32 it is a buffer overflow. 2) The snprintf() function returns the number of bytes that *would* have been copied if there were enough space. But we want to know the number of bytes which were *actually* copied so use scnprintf() instead. Fixes: bd4396f09a4a ("iommu/omap: Consolidate OMAP IOMMU modules") Signed-off-by: Dan Carpenter Reviewed-by: Robin Murphy Reviewed-by: Laurent Pinchart Link: https://lore.kernel.org/r/YuvYh1JbE3v+abd5@kili Signed-off-by: Joerg Roedel Signed-off-by: Sasha Levin --- drivers/iommu/omap-iommu-debug.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/iommu/omap-iommu-debug.c b/drivers/iommu/omap-iommu-debug.c index 5ce55fabc9d8..726702d01522 100644 --- a/drivers/iommu/omap-iommu-debug.c +++ b/drivers/iommu/omap-iommu-debug.c @@ -35,12 +35,12 @@ static inline bool is_omap_iommu_detached(struct omap_iommu *obj) ssize_t bytes; \ const char *str = "%20s: %08x\n"; \ const int maxcol = 32; \ - bytes = snprintf(p, maxcol, str, __stringify(name), \ + if (len < maxcol) \ + goto out; \ + bytes = scnprintf(p, maxcol, str, __stringify(name), \ iommu_read_reg(obj, MMU_##name)); \ p += bytes; \ len -= bytes; \ - if (len < maxcol) \ - goto out; \ } while (0) static ssize_t From patchwork Mon Oct 24 11:31:26 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8769 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp430435wru; Mon, 24 Oct 2022 05:41:32 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4n8jAXZHYgeu10nkkFpW+wMcjhJ7loYp2HwUUapKY9dPkXXGtEwha0NlPMAx5r076xrY/B X-Received: by 2002:a17:902:b718:b0:17a:d64:de09 with SMTP id d24-20020a170902b71800b0017a0d64de09mr34182985pls.106.1666615292120; Mon, 24 Oct 2022 05:41:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666615292; cv=none; d=google.com; s=arc-20160816; b=AkNN/dSx68JU3B1636bkssyuqmUV+dQdbGW3byF5GlIatIqhafZ66ct/k4miXWOL27 61Lh4ZindAePxomsT5AD7kbKGIUiQVbA2gnoCIybPqzgE/YEg995d2a7/HPjuTvUHAU+ 4pARCSJXuYfChtcHmCsRuoedNVbPVuSmTHp3OWLSWapaHUdrwSCogBGmdS4u86kWoaJ6 bNq88hEoUKvUYNf73qWtzG6VCSyK/5cKeqzWF7IzL/DW2x7ACJMMVExp90kOpOoz63jl dfaMvOB27GbQiCC9idhcsgUZacQH5UoYvQt02bzrG6nEigKM880rLKMVrnI4vwFpQPho WgKA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=E+/t8BnEX4mhmoDVaRu8cIqiQK2xg3Cb0/9qus8yrZ8=; b=FWrFtr6TzVrFNdcmoOd3Wri1mRmgstSH51FSW8qsI5tYPuTKKaQq0wJCgNmOjnwMe7 3HkyRXmHVTPJvwMMs1dGkS4vj1DFnnZv8Ft3a+OP9R3113lp2uigmwTMw2CzyjXu/eUx Q7RVq8i9/IiUASACzyZDtvBgW5WShJTuEFerSVK5Bn42V7a236MyyKY6w04LFw7lZLKY 10PMR3O2pcqikmFeYffdiT5PD0NBBRUSe2hUs8wG2lhqo/mw2CydYhEr9/TNXLp/2Jz9 TWuUvjGfk5VmDyrAMquvhF7uVAFyLx7RexlYv2AET0WopKMhZKuAqUYBKIq1jENXlHUI ZCUQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=rlRPA41i; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 192-20020a6301c9000000b0044bf53e335dsi34393151pgb.767.2022.10.24.05.41.19; Mon, 24 Oct 2022 05:41:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=rlRPA41i; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233825AbiJXMav (ORCPT + 99 others); Mon, 24 Oct 2022 08:30:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60576 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233864AbiJXM22 (ORCPT ); Mon, 24 Oct 2022 08:28:28 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D56F986FA4; Mon, 24 Oct 2022 05:02:12 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id AC22E612F0; Mon, 24 Oct 2022 12:01:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BB629C433D6; Mon, 24 Oct 2022 12:01:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612912; bh=54tY2h5Qry2GXNveBLK3B1tcepdEC6wKQ9dOikm8r2Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rlRPA41i86zuCJ9VOKFWhHgb6ZlY5HeHpv40qtbnCgdMMaUnZ2gFQcm23CzYU3kzC 6NEhkZRX52fIqrgbi3blYES5+Ysw0m917aG7RdnOytMt/5FESiV+FeEwp/IP2AzI4B 9ByiQxQU8DXtGkR4zVVeXsTfUHb6HYF8yMTLv0iw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Thierry Reding , John Garry , Robin Murphy , Thierry Reding , Joerg Roedel , Sasha Levin Subject: [PATCH 4.19 167/229] iommu/iova: Fix module config properly Date: Mon, 24 Oct 2022 13:31:26 +0200 Message-Id: <20221024113004.479893418@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747572796845961446?= X-GMAIL-MSGID: =?utf-8?q?1747572796845961446?= From: Robin Murphy [ Upstream commit 4f58330fcc8482aa90674e1f40f601e82f18ed4a ] IOMMU_IOVA is intended to be an optional library for users to select as and when they desire. Since it can be a module now, this means that built-in code which has chosen not to select it should not fail to link if it happens to have selected as a module by someone else. Replace IS_ENABLED() with IS_REACHABLE() to do the right thing. CC: Thierry Reding Reported-by: John Garry Fixes: 15bbdec3931e ("iommu: Make the iova library a module") Signed-off-by: Robin Murphy Reviewed-by: Thierry Reding Link: https://lore.kernel.org/r/548c2f683ca379aface59639a8f0cccc3a1ac050.1663069227.git.robin.murphy@arm.com Signed-off-by: Joerg Roedel Signed-off-by: Sasha Levin --- include/linux/iova.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/linux/iova.h b/include/linux/iova.h index 84fbe73d2ec0..8d4616c532da 100644 --- a/include/linux/iova.h +++ b/include/linux/iova.h @@ -133,7 +133,7 @@ static inline unsigned long iova_pfn(struct iova_domain *iovad, dma_addr_t iova) return iova >> iova_shift(iovad); } -#if IS_ENABLED(CONFIG_IOMMU_IOVA) +#if IS_REACHABLE(CONFIG_IOMMU_IOVA) int iova_cache_get(void); void iova_cache_put(void); From patchwork Mon Oct 24 11:31:27 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8884 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp433466wru; Mon, 24 Oct 2022 05:49:36 -0700 (PDT) X-Google-Smtp-Source: AMsMyM46fgHo1go5u7w4/J1NP8TS3vC9hPnCVGPbpKxK/+KiRdlUSDDi2iZk3Cf++d4Z0A4KvbYv X-Received: by 2002:a17:906:730e:b0:78d:94ab:77c2 with SMTP id di14-20020a170906730e00b0078d94ab77c2mr27414856ejc.639.1666615776173; Mon, 24 Oct 2022 05:49:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666615776; cv=none; d=google.com; s=arc-20160816; b=GjUNRpv9kpEYh85wWi58FyWDbtHQBLQW574KWrWVytmi4lHZeExZkqcAtZh0O0foQb 6yHyoQnHt1N1ylStkKZLYr9YS/WdWDGFBGQ+AarOQxbgZXkZchqV1mneGz9fTGoiFNv2 9uXA36JAhqwr9bv9WlKFGD5F/ML2v5x6QjOwSBLv+t4g8bPMNUxwyTuoF/jhu4TbTbPL z126BxvjpPW0esWWcfMAGXRkjgsMPSn5A8UNq6YVW3QP7+jKI7+QA4slf517lkcHBKLL DLTlog3s6Z2wu1zFpzIdvb7mtOkQZFEpF1v3sQrfgstLdywbe5s/DeReiJ6/kEvgbFQJ B/5g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=pGleTUUwvhvVewvSsY5CE6SHE72io1fdzFxvS87ONxg=; b=w5OjD/eJ00OQHtHb2IvsNF3B0oQquDa3wlqb4JJnowGdb/YjhtAqyrqKwLjB2AUKnb uauBhgvv4LjYSA7ho7ONs6Hh5W0NLh/nig2AaYeSz8C1q2OklQMmdwZdHEahlVWP4rKJ hMjpLrsd7RN6dBRWrdWDz6oRN4+BdvD15sm27opxf+qZkbPy00lfereMdt4Uge1gC9WY ILyO5xVrDutbiXFPT7MH5SLFkoaQOP3mESP3EuHczUlBakY8M5Y2EyAH/0aVapfTge6m n+HVhKZypz/R6xI+du1Atdkd/ibdF4fHEdaVTDr8SOYsDQWLmK/38Aa1fgdDWWPxG7UL egQw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="Zutc/YmS"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id qb26-20020a1709077e9a00b0078db3762061si29424938ejc.439.2022.10.24.05.49.10; Mon, 24 Oct 2022 05:49:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="Zutc/YmS"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230189AbiJXMh4 (ORCPT + 99 others); Mon, 24 Oct 2022 08:37:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38608 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234025AbiJXMcd (ORCPT ); Mon, 24 Oct 2022 08:32:33 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C87CF474C2; Mon, 24 Oct 2022 05:04:57 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 50C706129D; Mon, 24 Oct 2022 12:01:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5FF56C433D7; Mon, 24 Oct 2022 12:01:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612914; bh=7ntdUPCMIhqIzNNSYQ6C+sDToY+GcTkHMTAcv/S2QEE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Zutc/YmSizbNt0liIr48Qd+uERmzsffoT7MGVdxkFmyKFtllVGpnfeUFdpa09m59N v/Mp+zxeY+YbVCpfhcokvmRCeXZQ2kFE9WMOfICQk28R72907eUVaeVx85Tq+zaE9g wQnQRUGGsQ3EYkabnu8EOkOC31U9ThqJJvtI/d9M= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dan Carpenter , Herbert Xu , Sasha Levin Subject: [PATCH 4.19 168/229] crypto: cavium - prevent integer overflow loading firmware Date: Mon, 24 Oct 2022 13:31:27 +0200 Message-Id: <20221024113004.509292196@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747573303795040607?= X-GMAIL-MSGID: =?utf-8?q?1747573303795040607?= From: Dan Carpenter [ Upstream commit 2526d6bf27d15054bb0778b2f7bc6625fd934905 ] The "code_length" value comes from the firmware file. If your firmware is untrusted realistically there is probably very little you can do to protect yourself. Still we try to limit the damage as much as possible. Also Smatch marks any data read from the filesystem as untrusted and prints warnings if it not capped correctly. The "ntohl(ucode->code_length) * 2" multiplication can have an integer overflow. Fixes: 9e2c7d99941d ("crypto: cavium - Add Support for Octeon-tx CPT Engine") Signed-off-by: Dan Carpenter Signed-off-by: Herbert Xu Signed-off-by: Sasha Levin --- drivers/crypto/cavium/cpt/cptpf_main.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/crypto/cavium/cpt/cptpf_main.c b/drivers/crypto/cavium/cpt/cptpf_main.c index 06ad85ab5e86..7416f30ee976 100644 --- a/drivers/crypto/cavium/cpt/cptpf_main.c +++ b/drivers/crypto/cavium/cpt/cptpf_main.c @@ -257,6 +257,7 @@ static int cpt_ucode_load_fw(struct cpt_device *cpt, const u8 *fw, bool is_ae) const struct firmware *fw_entry; struct device *dev = &cpt->pdev->dev; struct ucode_header *ucode; + unsigned int code_length; struct microcode *mcode; int j, ret = 0; @@ -267,11 +268,12 @@ static int cpt_ucode_load_fw(struct cpt_device *cpt, const u8 *fw, bool is_ae) ucode = (struct ucode_header *)fw_entry->data; mcode = &cpt->mcode[cpt->next_mc_idx]; memcpy(mcode->version, (u8 *)fw_entry->data, CPT_UCODE_VERSION_SZ); - mcode->code_size = ntohl(ucode->code_length) * 2; - if (!mcode->code_size) { + code_length = ntohl(ucode->code_length); + if (code_length == 0 || code_length >= INT_MAX / 2) { ret = -EINVAL; goto fw_release; } + mcode->code_size = code_length * 2; mcode->is_ae = is_ae; mcode->core_mask = 0ULL; From patchwork Mon Oct 24 11:31:28 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8801 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp430896wru; Mon, 24 Oct 2022 05:42:29 -0700 (PDT) X-Google-Smtp-Source: AMsMyM55zK1SyoxYkbASxJC2+l1PItgF/6dliP8SUsXZEm3cfgz9P0vw9kfyQV8WGTO0h+GaT1f8 X-Received: by 2002:a17:906:5d04:b0:722:f46c:b891 with SMTP id g4-20020a1709065d0400b00722f46cb891mr27159923ejt.4.1666615339076; Mon, 24 Oct 2022 05:42:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666615339; cv=none; d=google.com; s=arc-20160816; b=C3V3mA6UtsWsHpdtSnpJzAfyKQrBvhYATLIxbXvbF1us8uaGnSUKCbXltbOZG1FMee Y8JUSV1kBDcm+0+BDWhfjAO4+u1B7X68GkuHSF+Ivrizrbldb4HhRAbOtyDdMaMUCV8i 1q1y5UDhQdEKkvDhYFBbaCtgDZ/ajJanzoDKYiP5DaaJKk5tDtAYva8CD9mwRVwqjF77 3y9RZbQ+qQ+j1lS6wP0eUe4YeYGUsB5ZWXL+JOnH+FZkS3RFTUxgadxJDZ9Gy3eiWEhU YJiKDnIx3Rd8pZ4QLGq55Zr1xplY/d7pTnhqEOGLeCkKbsT5zCKKexcaWeugN079F7jl b0nw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=b6tgijmBOdfylRaTgEyt84O9jv+5p4pByTqRckpPwHc=; b=MmRuckPLfu0L0oMTB/3L/dL57XKTIYY93MLlkwur+qNbhXGzHp8jl59ZCOyEx3Ipd1 LrSFYG03G5liOYQj0+i7KHIn4KSqgmYUBqO3KGLTJQRub/0wa1XjCPaq0WhECEoECOE2 i18rDq5uxNWeLY3tAnAy9ELzfZ8PRET22foPp0O3lt8E7pK/TIz/eRu+BAP2dDGblBd2 dZrYyJgq+ZWjA6Yw7wOLwHLbQ6zmgtNZRPkUcvAEJvP2OahERuFwwfrr3m/4tbI9BgCy oDQIpzozyPupPr68YFR0/t/1H8jjr3oNhMWQ/qSJF6xFknKiBE2/RQl9G5Jn6cKF5O39 KGqQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=bz0xO5au; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q6-20020a1709064cc600b0078fcfc5d24esi19436513ejt.618.2022.10.24.05.41.50; Mon, 24 Oct 2022 05:42:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=bz0xO5au; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231631AbiJXMbY (ORCPT + 99 others); Mon, 24 Oct 2022 08:31:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45304 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233909AbiJXM2j (ORCPT ); Mon, 24 Oct 2022 08:28:39 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B763287093; Mon, 24 Oct 2022 05:02:24 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 81137612D5; Mon, 24 Oct 2022 12:02:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 94678C433D7; Mon, 24 Oct 2022 12:01:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612919; bh=jPrX3JYqFBkAlWxjVzRpOOxHlvy7AnOKaq25fXbAEdc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bz0xO5au1ibPFJWZW7KocO1bijNui7cWuWLute0dlg4e5lRV1JSMdOSqyaYzthnzA 66Tu8xCoFNmDmEfPbf0aRoIRiJkwD5OVwBdDNV1n3lBVZkRstSXU++VWKHOKSljRPu fjYK2FHmKNtBOu4VsjAQLojt9k464kIEC4uz9deg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zhang Qilong , Chao Yu , Jaegeuk Kim , Sasha Levin Subject: [PATCH 4.19 169/229] f2fs: fix race condition on setting FI_NO_EXTENT flag Date: Mon, 24 Oct 2022 13:31:28 +0200 Message-Id: <20221024113004.554242119@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747572846180187921?= X-GMAIL-MSGID: =?utf-8?q?1747572846180187921?= From: Zhang Qilong [ Upstream commit 07725adc55c0a414c10acb5c8c86cea34b95ddef ] The following scenarios exist. process A: process B: ->f2fs_drop_extent_tree ->f2fs_update_extent_cache_range ->f2fs_update_extent_tree_range ->write_lock ->set_inode_flag ->is_inode_flag_set ->__free_extent_tree // Shouldn't // have been // cleaned up // here ->write_lock In this case, the "FI_NO_EXTENT" flag is set between f2fs_update_extent_tree_range and is_inode_flag_set by other process. it leads to clearing the whole exten tree which should not have happened. And we fix it by move the setting it to the range of write_lock. Fixes:5f281fab9b9a3 ("f2fs: disable extent_cache for fcollapse/finsert inodes") Signed-off-by: Zhang Qilong Reviewed-by: Chao Yu Signed-off-by: Jaegeuk Kim Signed-off-by: Sasha Levin --- fs/f2fs/extent_cache.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/fs/f2fs/extent_cache.c b/fs/f2fs/extent_cache.c index a70cd2580eae..36d6b561b524 100644 --- a/fs/f2fs/extent_cache.c +++ b/fs/f2fs/extent_cache.c @@ -717,9 +717,8 @@ void f2fs_drop_extent_tree(struct inode *inode) if (!f2fs_may_extent_tree(inode)) return; - set_inode_flag(inode, FI_NO_EXTENT); - write_lock(&et->lock); + set_inode_flag(inode, FI_NO_EXTENT); __free_extent_tree(sbi, et); if (et->largest.len) { et->largest.len = 0; From patchwork Mon Oct 24 11:31:29 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8771 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp430493wru; Mon, 24 Oct 2022 05:41:43 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4XZqAM/HquS1HfSHOoiRmEJ2TMW+gdpq9V/xtO7RL4aX8zwR+8M1p4iwe8Xb1hhEQRFtXb X-Received: by 2002:a50:cc07:0:b0:453:4427:a918 with SMTP id m7-20020a50cc07000000b004534427a918mr30634980edi.121.1666615302778; Mon, 24 Oct 2022 05:41:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666615302; cv=none; d=google.com; s=arc-20160816; b=rYvOlxAiScQ5Kl/iDYtVM9e98U7Uyi00TnjYVR6lFv1T9rARIoZjpbmxQ5YYpZfm9b B2K/bN68Yj+hGESvNxUPJjMEmaiMRk83OWel76KNtRUJusS7Mt6sGh/7IKWKbgwmUTWK BTUTGioXPFZT9uDQ0HaNnVyA+aPSzVwUyEFgugpjjhOHPlc5UykIdDWigXz/iGa39NGX 3YGhVpOa0EtlUjR08frpHebJzrGooIHvPXu6x9/i646Etp0m5L0/4UoKvQWWM6ofx1TK HflXyt1FdOnby7db3owuena4Xc2j/KJfjSjOTVnFt+yVGE1XbYDMn0Gx0fGmXMlJFNy0 y24g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=O+WLTEDG3VIAUvJzzHMygjhoiISXZdDAy/vmRMNpwZA=; b=XSva+Gsb4YNt0EWejz/ltu72uc6kFI9abNyQCfsXecN2aEuPt7rmrQJyMbqu9xYjS2 b2+TV9aNR/5dJolFs8CJIiIqGFjFXH+cA0IWqIvF4Y5KZ14JMKt5V68755jU0BH/LNS1 wnIgmiRrfjx43IJ/3GYfEENlSWEZsljGnV8zi0tOqk1XupwOnznVbyYHiYql7qYso8cH OQ5k1mRopGDjVDGBwXm7gGaeIZhow2DMxcffdXWRWWWIF5Jos8sZFaAe+oerJa9HefiY 3y+qrTg1LhJdW8BSwYFCGBW8MjnsSJwyL8B+++RZZRCm60limbp9VhGZ1m4pWpoeF4A2 Jkrw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=QpsjF7SR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id qb26-20020a1709077e9a00b0078db3762061si29424938ejc.439.2022.10.24.05.41.18; Mon, 24 Oct 2022 05:41:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=QpsjF7SR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232197AbiJXMbH (ORCPT + 99 others); Mon, 24 Oct 2022 08:31:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60616 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233881AbiJXM2e (ORCPT ); Mon, 24 Oct 2022 08:28:34 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4D39A87098; Mon, 24 Oct 2022 05:02:27 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 1E64E612FC; Mon, 24 Oct 2022 12:02:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2D4B2C433D7; Mon, 24 Oct 2022 12:02:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612922; bh=XHcyysHE7tX7QDs1ULU7fgwf6UOTOZ2Xr0MsncCmixE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QpsjF7SRWqjDPVdznNEagbLctOjGlYQIZX0BE8ay4KKFI0ogqtDV+qN1qmhSOZyNZ e2x767TqRh2jYrassNe+I/DfmtFs4rkeUHl6ljJwo0FIbmz10EfgogMZY63CYfi+mU ExYblOOzy6BCwgILf+xQbHqvSNZ6xHGv/79jEk7k= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hans de Goede , Arvid Norlander , "Rafael J. Wysocki" , Sasha Levin Subject: [PATCH 4.19 170/229] ACPI: video: Add Toshiba Satellite/Portege Z830 quirk Date: Mon, 24 Oct 2022 13:31:29 +0200 Message-Id: <20221024113004.584483642@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747572807766548642?= X-GMAIL-MSGID: =?utf-8?q?1747572807766548642?= From: Arvid Norlander [ Upstream commit 574160b8548deff8b80b174f03201e94ab8431e2 ] Toshiba Satellite Z830 needs the quirk video_disable_backlight_sysfs_if for proper backlight control after suspend/resume cycles. Toshiba Portege Z830 is simply the same laptop rebranded for certain markets (I looked through the manual to other language sections to confirm this) and thus also needs this quirk. Thanks to Hans de Goede for suggesting this fix. Link: https://www.spinics.net/lists/platform-driver-x86/msg34394.html Suggested-by: Hans de Goede Signed-off-by: Arvid Norlander Reviewed-by: Hans de Goede Tested-by: Arvid Norlander Signed-off-by: Rafael J. Wysocki Signed-off-by: Sasha Levin --- drivers/acpi/acpi_video.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/drivers/acpi/acpi_video.c b/drivers/acpi/acpi_video.c index ac54fc03cf81..eb7fca6f9444 100644 --- a/drivers/acpi/acpi_video.c +++ b/drivers/acpi/acpi_video.c @@ -511,6 +511,22 @@ static const struct dmi_system_id video_dmi_table[] = { DMI_MATCH(DMI_PRODUCT_NAME, "SATELLITE R830"), }, }, + { + .callback = video_disable_backlight_sysfs_if, + .ident = "Toshiba Satellite Z830", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"), + DMI_MATCH(DMI_PRODUCT_NAME, "SATELLITE Z830"), + }, + }, + { + .callback = video_disable_backlight_sysfs_if, + .ident = "Toshiba Portege Z830", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"), + DMI_MATCH(DMI_PRODUCT_NAME, "PORTEGE Z830"), + }, + }, /* * Some machine's _DOD IDs don't have bit 31(Device ID Scheme) set * but the IDs actually follow the Device ID Scheme. From patchwork Mon Oct 24 11:31:30 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8773 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp430533wru; Mon, 24 Oct 2022 05:41:48 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7X5QaYtkF4fKIx0RDlw5OpKX5Q1CofOeKo7j9SzPKMLsvJy/Jt6Bt/ABSkPyvh0b/FWB5U X-Received: by 2002:a63:d503:0:b0:46e:9bac:6d9f with SMTP id c3-20020a63d503000000b0046e9bac6d9fmr19089487pgg.217.1666615308239; Mon, 24 Oct 2022 05:41:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666615308; cv=none; d=google.com; s=arc-20160816; b=xKKFA9fdadk5WPEsqt+zHibax5JmLnXc6vo9H3IZT3LBlNUtRI8zcGe2ncm5BTXS4R Wp4UOPRnG3bYJ0ncOH4A4QC9oeA5jhWKC2MHhkKE6Euexh4pETBAEUwJb882ZLRPLHAg /D0cfqSCSpfjPU2LM3ZqHVkJ+I+efpnlJk3FcnwfLcKpAngDA6mMbd1W7hpufby8HjJ9 h1Tt6ccEmi/bd/bbKM9jVLcKLOhnZCj7EvhJZ6NO0mHTtdfe6V0yi1PbiKsqhbMRWwPU MSmd7fgyUDi8LKV1o/jKJKCpOXsuJAtnLCmBnmXpSiIZSPfBRKu1MF6+n0yqrmodVnlT Cofg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=HMB8cwFxSZQq5hiwUjnCgLByHbQLvV/Q+JayaXkVQiI=; b=PcQRbd3Svq8oQCrmB+opiDtAL6YcHT+PD4mQuj4nBFCIqFAO2IHAU5wy9/JkVGNsYN 3mL1RCXTMi0Ijhqdk2HSRA6QNDaa+CakZMVFvkB6ffQwtwbktslSAKzrOz8CbwSajNec DY8wBQ5G4xo2UQ8nl0c+ITrQAuqRa64elBlFhCZTvkih1sztRxGyhisd7AgdAdB5jb0B 7rFH0ILcz83h1M1TMoOX12Dg5CIMjqbpwfHdDtwxXETRwIALBBCD8bbyqGoQt0gH1ASN OtbZWg4mPMXv5G8nJokYS4nHMhFVECK+UcUlEXe+aGB1b109buCpjEJTu4/nR+V6a0+K uotQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="ww+TW2Z/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p2-20020a170902b08200b001747ed48ee8si30621508plr.150.2022.10.24.05.41.33; Mon, 24 Oct 2022 05:41:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="ww+TW2Z/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233920AbiJXMbp (ORCPT + 99 others); Mon, 24 Oct 2022 08:31:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60572 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233726AbiJXM2w (ORCPT ); Mon, 24 Oct 2022 08:28:52 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 71DF0868AB; Mon, 24 Oct 2022 05:02:31 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id AF701612BE; Mon, 24 Oct 2022 12:02:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 996DEC433C1; Mon, 24 Oct 2022 12:02:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612925; bh=7Biv/RB4g1yWRQ3Ir7P+DO9H5qF3EuPehLJSXWw6ecI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ww+TW2Z/dWGTAQ3EkzTR3hc5B+ssnbCMnVRmTsxFYpcZKjUDAhN5W6AiMqOu1+ojo ZMdG/iZqKQoZBS3IJVrxPTQIS3D8JcUPfcYpjr/Mgb87yEzSDvYrEZBtfv/y6XhZwT fWnRaOGFP1JrOMQLje79hQBlHy0kuB2XPxbfYBBk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hauke Mehrtens , =?utf-8?b?UmFmYcWCIE1pxYJlY2tp?= , Thomas Bogendoerfer , linux-mips@vger.kernel.org, Nathan Chancellor , Nick Desaulniers , llvm@lists.linux.dev, kernel test robot , Kees Cook , Sasha Levin Subject: [PATCH 4.19 171/229] MIPS: BCM47XX: Cast memcmp() of function to (void *) Date: Mon, 24 Oct 2022 13:31:30 +0200 Message-Id: <20221024113004.623502859@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747572813253815542?= X-GMAIL-MSGID: =?utf-8?q?1747572813253815542?= From: Kees Cook [ Upstream commit 0dedcf6e3301836eb70cfa649052e7ce4fcd13ba ] Clang is especially sensitive about argument type matching when using __overloaded functions (like memcmp(), etc). Help it see that function pointers are just "void *". Avoids this error: arch/mips/bcm47xx/prom.c:89:8: error: no matching function for call to 'memcmp' if (!memcmp(prom_init, prom_init + mem, 32)) ^~~~~~ include/linux/string.h:156:12: note: candidate function not viable: no known conversion from 'void (void)' to 'const void *' for 1st argument extern int memcmp(const void *,const void *,__kernel_size_t); Cc: Hauke Mehrtens Cc: "Rafał Miłecki" Cc: Thomas Bogendoerfer Cc: linux-mips@vger.kernel.org Cc: Nathan Chancellor Cc: Nick Desaulniers Cc: llvm@lists.linux.dev Reported-by: kernel test robot Link: https://lore.kernel.org/lkml/202209080652.sz2d68e5-lkp@intel.com Signed-off-by: Kees Cook Signed-off-by: Thomas Bogendoerfer Signed-off-by: Sasha Levin --- arch/mips/bcm47xx/prom.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/mips/bcm47xx/prom.c b/arch/mips/bcm47xx/prom.c index 135a5407f015..d26d9a6f6ee7 100644 --- a/arch/mips/bcm47xx/prom.c +++ b/arch/mips/bcm47xx/prom.c @@ -85,7 +85,7 @@ static __init void prom_init_mem(void) pr_debug("Assume 128MB RAM\n"); break; } - if (!memcmp(prom_init, prom_init + mem, 32)) + if (!memcmp((void *)prom_init, (void *)prom_init + mem, 32)) break; } lowmem = mem; @@ -162,7 +162,7 @@ void __init bcm47xx_prom_highmem_init(void) off = EXTVBASE + __pa(off); for (extmem = 128 << 20; extmem < 512 << 20; extmem <<= 1) { - if (!memcmp(prom_init, (void *)(off + extmem), 16)) + if (!memcmp((void *)prom_init, (void *)(off + extmem), 16)) break; } extmem -= lowmem; From patchwork Mon Oct 24 11:31:31 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8844 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp431636wru; Mon, 24 Oct 2022 05:44:20 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7rAY4LRXkRr3jq72SKYu9GSI8BJJktUTfIYKSJE4PjDBAucJNPvKd3qPc5ikxtjlzYhD+v X-Received: by 2002:a17:907:948f:b0:7a7:5fc8:909 with SMTP id dm15-20020a170907948f00b007a75fc80909mr4967084ejc.658.1666615460556; Mon, 24 Oct 2022 05:44:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666615460; cv=none; d=google.com; s=arc-20160816; b=LEmC3Q09BOu6C39QPFPMCUnGjN6mkRyGpBTaHMd9zWJJ8xO23eOCuuJTXRcULq7M+j Aqrn881rb4/UfQToKPC+2p6+YFAMQpVK/hDm+jMFb9+1zFz6LTi1wqmKuVs9Jc/48t5w wgxRQ7bXa9Jg64W/nuxvE4iQ0JZxGTuo7yR46GkNSQadcBAdKX8QtRNzucDFuhU3NQQz cVvKB/7BBzcWI5cTQDFd5PRKmaZHqrUfM+yGVRnVlWHUDaswY4g+7rY1bRS5/iXI2gpq 85wJd83f6fCNG97uhQEala2iCTECUC0pk0joFtXx+tmGLBoC61ssFJ9Vwp74pgvKgb8e lbuQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=YgsaH0QHMTWJ38CLHHGXaZ2Gz1hlGvwx8gH/D5BuGpY=; b=bx0lSaQDqGlNQUXXJcfPEix/qP6lodRvKo3Ptb57Og8/W//unao9DYhlHrH9nQ7cgN HPyvzjW7/nlJc+whxfll9Qj0waZi1jBIuZxTKXT+6okTHpqHfHp+sn2/ZiO6qxytkkuH xOEg/BcpS7ZVI0mV8gsFW8WOeLKiN4CIxKXAdOg+XbYWJw2vwr6DC/XyyAGUN6SbQFcx ccu4YNfHEceVkNZ3JRQGZw/GDfP1n8l69tRIYR8xn9a4Yjm7HPHJzT36ksRSWbgR7xud bMwE/A8vc2EZb0qrA7snjLFqcS9XN7E+dTHMTXQac5ymaxwz7ILxO+69nTsC5nwyoiOp U74Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=URM9KukG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c6-20020a05640227c600b00461e3e1a628si1613938ede.110.2022.10.24.05.43.54; Mon, 24 Oct 2022 05:44:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=URM9KukG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231963AbiJXMiM (ORCPT + 99 others); Mon, 24 Oct 2022 08:38:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57260 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234337AbiJXMew (ORCPT ); Mon, 24 Oct 2022 08:34:52 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B306F58504; Mon, 24 Oct 2022 05:05:12 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 4DB0161311; Mon, 24 Oct 2022 12:02:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5D272C433D6; Mon, 24 Oct 2022 12:02:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612927; bh=D10J9yBbVDhCPyPeEabyHA9i/KE6B7sbMw0ny/UqgeY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=URM9KukGNMflYMSxV4AYHJM51WBO74L1qcIc199vtWFHX/lL2X0zwMtiYW9v5jS4F YR1TUTwYXF3VWxeJliqJdi+0zlqketSCGpqzkyp/fTsCP1BacNDrz6Z4Ucu0Jvzl8f tITkcTZuguvK5zj5h9zzE02kN1LbtOYHR7Plc+CU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Chao Qin , Zhang Rui , "Rafael J. Wysocki" , Sasha Levin Subject: [PATCH 4.19 172/229] powercap: intel_rapl: fix UBSAN shift-out-of-bounds issue Date: Mon, 24 Oct 2022 13:31:31 +0200 Message-Id: <20221024113004.659711297@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747572973394575971?= X-GMAIL-MSGID: =?utf-8?q?1747572973394575971?= From: Chao Qin [ Upstream commit 2d93540014387d1c73b9ccc4d7895320df66d01b ] When value < time_unit, the parameter of ilog2() will be zero and the return value is -1. u64(-1) is too large for shift exponent and then will trigger shift-out-of-bounds: shift exponent 18446744073709551615 is too large for 32-bit type 'int' Call Trace: rapl_compute_time_window_core rapl_write_data_raw set_time_window store_constraint_time_window_us Signed-off-by: Chao Qin Acked-by: Zhang Rui Signed-off-by: Rafael J. Wysocki Signed-off-by: Sasha Levin --- drivers/powercap/intel_rapl.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/powercap/intel_rapl.c b/drivers/powercap/intel_rapl.c index 8cbfcce57a06..ae6721333c0f 100644 --- a/drivers/powercap/intel_rapl.c +++ b/drivers/powercap/intel_rapl.c @@ -1068,6 +1068,9 @@ static u64 rapl_compute_time_window_core(struct rapl_package *rp, u64 value, y = value & 0x1f; value = (1 << y) * (4 + f) * rp->time_unit / 4; } else { + if (value < rp->time_unit) + return 0; + do_div(value, rp->time_unit); y = ilog2(value); f = div64_u64(4 * (value - (1 << y)), 1 << y); From patchwork Mon Oct 24 11:31:32 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8873 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp433208wru; Mon, 24 Oct 2022 05:48:50 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4+zRQv5UXLKxR/V19WTD045WRgdPraEyIymwj89DdDlG82tWK2W4KNp1F+wnVJE/X6N8xk X-Received: by 2002:a05:6a02:47:b0:46e:ea48:9543 with SMTP id az7-20020a056a02004700b0046eea489543mr8557868pgb.6.1666615729764; Mon, 24 Oct 2022 05:48:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666615729; cv=none; d=google.com; s=arc-20160816; b=J8GMKg7qLIYM8DUsc3x2Jje1PT/uiAlK/cGw/7HL8IYBr7O3QUWi47YX2rKNh+UHcH cxVqWASIpTKSjglWq9thQCqaM80IBKV6s4IDsg5qnZMoRPTpgNe+0UekmoOPa6rJLC4R n4DX6eF1WseKTnRj4viBxJhcCIB70VyXXSiUAeGNAMgs9yGSUqZl1/MbB2DbE0fMZyz9 vz6+zuUCJxu695FBqLwGHEicukHKWOXNYPJxsihSOV+/h/xG/qZ3Vwo56gQsqYzb3N6z rZhs2Ji+4ufLk93856Rfn1M9l8gbGCLhWnJnRrTW5ITpAcPtZd3Nqnc+PKfpxEUIyZdT N7Pw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=e6iCx7EO0f6T4vO5MNEVYHFKu7fPSIrRX0hnCZxICY4=; b=OBvM3Bb4wnNwz8zU6aL/TowCosnsb96Fxm3SSfi/rn7dx7jemlOHR3T5QG2eaqKHav LReEZ9tjTirxqY4QB5vsBu9DYz9yN9xutA4tEsD7mD2+yFicoahUIcTOhUo1To51nrrB +/5J0MX69WQ+VONvc/givaExxGITRJ2SBqlSmy/f7ToSLJ5Px4yf20JUjOiJ6o0dnpgM aIPeyPv8wAWTiT8vKsaMpFDzcbBc7dYhgY/Juuci9Tq/sPynu/jMWDNrdFLrXBpftH+D v76V/DCpcE9OuYv/RFocGpM8enOCNGu7erfm7qxAeYgn810Yk9MgWasU+lbVdGSkLuAa iEaA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="x/531WpZ"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i7-20020aa796e7000000b00557c8a20395si32551574pfq.120.2022.10.24.05.48.35; Mon, 24 Oct 2022 05:48:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="x/531WpZ"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230099AbiJXMhd (ORCPT + 99 others); Mon, 24 Oct 2022 08:37:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45036 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233719AbiJXMac (ORCPT ); Mon, 24 Oct 2022 08:30:32 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C71EE20F70; Mon, 24 Oct 2022 05:04:44 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 98A44B811A5; Mon, 24 Oct 2022 12:02:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EDE9EC433C1; Mon, 24 Oct 2022 12:02:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612930; bh=KgnZvTami7Wf2KkSJ7asjZWoX20lDkMswAbmsI/MM1U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=x/531WpZnbhV75V9NR5JxZr94sPoPRBiyEljS1wVzyKyMwvKJYzFKqA0W8avi2uQU kPcGC6mE8Vz0NIK5xbPaMshqrdZIEJDNdPSaPkq5PtRh/pNyd1CczG4yo16k6LCp27 sj62EEpgzGFN4rtbpJAX2LeMjUFb30idnqkjPqaE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Chen Yu , Srinivas Pandruvada , "Rafael J. Wysocki" , Sasha Levin Subject: [PATCH 4.19 173/229] thermal: intel_powerclamp: Use get_cpu() instead of smp_processor_id() to avoid crash Date: Mon, 24 Oct 2022 13:31:32 +0200 Message-Id: <20221024113004.689527133@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747573255387516006?= X-GMAIL-MSGID: =?utf-8?q?1747573255387516006?= From: Srinivas Pandruvada [ Upstream commit 68b99e94a4a2db6ba9b31fe0485e057b9354a640 ] When CPU 0 is offline and intel_powerclamp is used to inject idle, it generates kernel BUG: BUG: using smp_processor_id() in preemptible [00000000] code: bash/15687 caller is debug_smp_processor_id+0x17/0x20 CPU: 4 PID: 15687 Comm: bash Not tainted 5.19.0-rc7+ #57 Call Trace: dump_stack_lvl+0x49/0x63 dump_stack+0x10/0x16 check_preemption_disabled+0xdd/0xe0 debug_smp_processor_id+0x17/0x20 powerclamp_set_cur_state+0x7f/0xf9 [intel_powerclamp] ... ... Here CPU 0 is the control CPU by default and changed to the current CPU, if CPU 0 offlined. This check has to be performed under cpus_read_lock(), hence the above warning. Use get_cpu() instead of smp_processor_id() to avoid this BUG. Suggested-by: Chen Yu Signed-off-by: Srinivas Pandruvada [ rjw: Subject edits ] Signed-off-by: Rafael J. Wysocki Signed-off-by: Sasha Levin --- drivers/thermal/intel_powerclamp.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/thermal/intel_powerclamp.c b/drivers/thermal/intel_powerclamp.c index 8e8328347c0e..079c8c1a5f15 100644 --- a/drivers/thermal/intel_powerclamp.c +++ b/drivers/thermal/intel_powerclamp.c @@ -550,8 +550,10 @@ static int start_power_clamp(void) /* prefer BSP */ control_cpu = 0; - if (!cpu_online(control_cpu)) - control_cpu = smp_processor_id(); + if (!cpu_online(control_cpu)) { + control_cpu = get_cpu(); + put_cpu(); + } clamping = true; schedule_delayed_work(&poll_pkg_cstate_work, 0); From patchwork Mon Oct 24 11:31:33 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8849 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp432931wru; Mon, 24 Oct 2022 05:48:06 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7V6IQJJvv2HOxxJ1ckjFmXVEGT2bmdnU+GVN5wsUbtIVMC6+AnHqDMaOxOmG6uWbIP8cxV X-Received: by 2002:a17:90b:1bc3:b0:20d:75b8:ee74 with SMTP id oa3-20020a17090b1bc300b0020d75b8ee74mr75946638pjb.1.1666615686285; Mon, 24 Oct 2022 05:48:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666615686; cv=none; d=google.com; s=arc-20160816; b=AkS4OqL82RUnotHW6ttEAbICiAoaGBBREl6CW5atqymUYYLb9pOCdQF2l1WxArdz69 vp5/LHDUVpBs0R7TTJW0oAp6hqQ4iM2xtn+xUw9U8EMAReELu5nSs/pNp/SAqGIODekA GQ4pdHxDjUzBN17xV3jLKb/pI/7RogzCbwXHdNQehNA1jQt/HqqzXxP3oGVq4zCwoYPJ PKjRV0gm348aGWxXT2Cya4SFDbLe9G7kiw5CJnrMRwH63gcKHsrDjVkxi0wR4b/BOOVh hGtUbRVr5bDBeUWhV3DRgxOm72aJ6o9NOcWTjvNCGwH8Hm2EG6ijZ6J3d3sCmt56/EuU Xq3g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Vu6DnC/P6o7/3l0/q2sbN/O7vaXsYXzI6YUf1WOVMdE=; b=VmmTG841pt8guOz7q3ZgAt2vMxdetlfxd5x8rj3ES4wAnP5YjvPqc/s8c/VfDfUcrd 4gUysM0YPrKrF4nr+o/raKm1E00Mod+cYSjDYsZAdTnGVnB6ajefRmrMSoezScLELGS2 RSgKo4Ja64kGa8Sk5o4YA9XpR0UoJxJChvtX79Lfr5mr9VHAqouRXDnr0FWAY8mFv8io L9pUYX+hCTHXKWLl0jdO/XrIYCBTwk82UKe182OK3k9nsjJpVM4pS0pTMOdpVaUNAroO K2BQyAHGRUBnGDyoVz8RBzwL7ze8lZpN2OX7NrCzu5fyQUZnJ4mUFJP3GddeidiTNc+D 7Ndw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=pND0li9P; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 206-20020a6306d7000000b00460dd0eed0csi36834390pgg.176.2022.10.24.05.47.51; Mon, 24 Oct 2022 05:48:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=pND0li9P; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231449AbiJXMip (ORCPT + 99 others); Mon, 24 Oct 2022 08:38:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60592 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233808AbiJXM26 (ORCPT ); Mon, 24 Oct 2022 08:28:58 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5176F87689; Mon, 24 Oct 2022 05:02:39 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 7A538612CC; Mon, 24 Oct 2022 12:02:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 64D13C433D6; Mon, 24 Oct 2022 12:02:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612932; bh=HDBZX01FN2W9c75Sd8NoXHb1ZhN7yyXXynCHY/64+/k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pND0li9PULhAZ5WGWsVwxg82gs5hly/Vnn/CKFpKa2LRY7bOsjDtEpcmCVbQwj/O2 gn1YSu/K3jWSnXc47NgdgmPwB9t620DY8KGXQCWZFjktH23fUfjmrYlggGyGdSzy1g 5UskNI2UYgsHLyuQGVhQKGGGC6UFXCP8xlpcR/RA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Juergen Gross , Boris Ostrovsky , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , xen-devel@lists.xenproject.org, Kees Cook , Sasha Levin Subject: [PATCH 4.19 174/229] x86/entry: Work around Clang __bdos() bug Date: Mon, 24 Oct 2022 13:31:33 +0200 Message-Id: <20221024113004.718917343@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747573209826523086?= X-GMAIL-MSGID: =?utf-8?q?1747573209826523086?= From: Kees Cook [ Upstream commit 3e1730842f142add55dc658929221521a9ea62b6 ] Clang produces a false positive when building with CONFIG_FORTIFY_SOURCE=y and CONFIG_UBSAN_BOUNDS=y when operating on an array with a dynamic offset. Work around this by using a direct assignment of an empty instance. Avoids this warning: ../include/linux/fortify-string.h:309:4: warning: call to __write_overflow_field declared with 'warn ing' attribute: detected write beyond size of field (1st parameter); maybe use struct_group()? [-Wat tribute-warning] __write_overflow_field(p_size_field, size); ^ which was isolated to the memset() call in xen_load_idt(). Note that this looks very much like another bug that was worked around: https://github.com/ClangBuiltLinux/linux/issues/1592 Cc: Juergen Gross Cc: Boris Ostrovsky Cc: Thomas Gleixner Cc: Ingo Molnar Cc: Borislav Petkov Cc: Dave Hansen Cc: x86@kernel.org Cc: "H. Peter Anvin" Cc: xen-devel@lists.xenproject.org Reviewed-by: Boris Ostrovsky Link: https://lore.kernel.org/lkml/41527d69-e8ab-3f86-ff37-6b298c01d5bc@oracle.com Signed-off-by: Kees Cook Signed-off-by: Sasha Levin --- arch/x86/xen/enlighten_pv.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/x86/xen/enlighten_pv.c b/arch/x86/xen/enlighten_pv.c index 8f1ff8dad2ce..04bfd9c3987b 100644 --- a/arch/x86/xen/enlighten_pv.c +++ b/arch/x86/xen/enlighten_pv.c @@ -752,6 +752,7 @@ static void xen_load_idt(const struct desc_ptr *desc) { static DEFINE_SPINLOCK(lock); static struct trap_info traps[257]; + static const struct trap_info zero = { }; unsigned out; trace_xen_cpu_load_idt(desc); @@ -761,7 +762,7 @@ static void xen_load_idt(const struct desc_ptr *desc) memcpy(this_cpu_ptr(&idt_desc), desc, sizeof(idt_desc)); out = xen_convert_trap_info(desc, traps, false); - memset(&traps[out], 0, sizeof(traps[0])); + traps[out] = zero; xen_mc_flush(); if (HYPERVISOR_set_trap_table(traps)) From patchwork Mon Oct 24 11:31:34 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8871 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp433201wru; Mon, 24 Oct 2022 05:48:49 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5mgJVhNCVWAC283FWqWbkLx8LLOxaKPbZ16l7srlP2fUFu4RMOm2Ms2LqhIU54BhSNJGCW X-Received: by 2002:a17:902:ce82:b0:185:47af:a0e8 with SMTP id f2-20020a170902ce8200b0018547afa0e8mr33295567plg.7.1666615729262; Mon, 24 Oct 2022 05:48:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666615729; cv=none; d=google.com; s=arc-20160816; b=t63PePgRuV81kXhILTegQv80mbezgzH7Qyp7FGBmK8JfKHzYguusfT/HdIcECh+MhD RWGyyromEhtQoB4sa0f3BHW07rcDu8Wqj7wDZjV6KqUUL2TUdGOKLMPQe0vvweKU1bqF 6/cxPqQ/O0J4XUoTwS/WBwOq2LHUuxnUaqnKueDFL104nX6GFwozpUFn0iCQRpgXhVg5 zmpK1c6szvelUqSmuY0525hRPqNN2uqlXh6Re/SYhzorfNNDOH9aUlldVghBpdzBirG5 HauookOiuKMr/ROhjPbm41z4X4MDBhFOWUkxYL8xgpcemJlSO6G0AvLGrdtjR6jhvOdt 1Jkw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Z5nqwFD+CaOOTSbOfYzj88Kbq/GKGD8OjLtExiCG038=; b=EmJrUy1Jz7bwfdZNGFj4CbZLAWUa0BghfaUN4M6TMfmGacFtPjF+iL4UIwcoLVo7td 8VTCStFgJyFNYoyzQcphE7J00b8+HmvKmrgEgSsGkuL2uneQJJM7tsXYdyVVl+3m5N7j 3h9Aa1jyC4XCSOGwf8yyoQFnVj01zfqc1idZPK4U1DZHsqEFYhAS1XoYkICf4ivRM/2y F40yBSfFhygPKNJBy8AfPBYBhqXTW9/26ON5d4jv2KzvWO90sWTKRytB/Bltzpt9w+Xo N9F3t3hkRB/aqR4pfhoZTKNAJU9MBrRry+rmyQbqx+yxtcxoAgn9yzMSVDcv7QzzcH7s WIdg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=eQ8ecTBo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id mz21-20020a17090b379500b00200ab48e149si7906230pjb.72.2022.10.24.05.48.35; Mon, 24 Oct 2022 05:48:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=eQ8ecTBo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229914AbiJXMht (ORCPT + 99 others); Mon, 24 Oct 2022 08:37:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55018 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233901AbiJXMbj (ORCPT ); Mon, 24 Oct 2022 08:31:39 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C708820F55; Mon, 24 Oct 2022 05:04:44 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id C7CCFB81134; Mon, 24 Oct 2022 12:02:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2C479C433C1; Mon, 24 Oct 2022 12:02:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612935; bh=b5hxz7ELFsuA/ayGSxoTJzXWNM2liJklMoKmYT0WhN8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eQ8ecTBoX/FDJnQxjRuDb3yz6pLicC2MoeS6S9xrP0z7UJuezXA0JsQHoAPEeIleP EXP++56Z5AqSIWZK450F47Mxv3kFEx7ldTUOe3ggQKNt7LhK+rhcKy1Z4D4GJPRtu8 SJBk4d2hfFCRRsxD58jTd8AwSfVxOppjzGbtl16Y= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Anna Schumaker , Chuck Lever , Sasha Levin Subject: [PATCH 4.19 175/229] NFSD: Return nfserr_serverfault if splice_ok but buf->pages have data Date: Mon, 24 Oct 2022 13:31:34 +0200 Message-Id: <20221024113004.748316952@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747573255027740069?= X-GMAIL-MSGID: =?utf-8?q?1747573255027740069?= From: Anna Schumaker [ Upstream commit 06981d560606ac48d61e5f4fff6738b925c93173 ] This was discussed with Chuck as part of this patch set. Returning nfserr_resource was decided to not be the best error message here, and he suggested changing to nfserr_serverfault instead. Signed-off-by: Anna Schumaker Link: https://lore.kernel.org/linux-nfs/20220907195259.926736-1-anna@kernel.org/T/#t Signed-off-by: Chuck Lever Signed-off-by: Sasha Levin --- fs/nfsd/nfs4xdr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c index f67c5de1aeb8..96b79bd90631 100644 --- a/fs/nfsd/nfs4xdr.c +++ b/fs/nfsd/nfs4xdr.c @@ -3594,7 +3594,7 @@ nfsd4_encode_read(struct nfsd4_compoundres *resp, __be32 nfserr, if (resp->xdr.buf->page_len && test_bit(RQ_SPLICE_OK, &resp->rqstp->rq_flags)) { WARN_ON_ONCE(1); - return nfserr_resource; + return nfserr_serverfault; } xdr_commit_encode(xdr); From patchwork Mon Oct 24 11:31:35 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8857 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp433012wru; Mon, 24 Oct 2022 05:48:21 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6Lz+PSszrLlO+HWDSwEdDV/Fvg84Rbs64Y/PyOiHR+y4Yh5G0uydCAB/6eYG2pEszVTxYS X-Received: by 2002:a17:90b:3141:b0:20d:49d6:30b with SMTP id ip1-20020a17090b314100b0020d49d6030bmr70776555pjb.223.1666615701416; Mon, 24 Oct 2022 05:48:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666615701; cv=none; d=google.com; s=arc-20160816; b=g+jgv8oJ5UF/oCwyKEhM0VHHzLkMo/NQ6pRPqLqIPQ3C742/r1hEbmfA0tqlfC728c 80o6aQ/S8BU8+dXdcyg+ym+PNaGtubAgVZ9+De8AoGmIEQP43/VcnfzKMhD7t8hVfYvR yWe4/b2wuIqJO80+KWGxxqQ7ae5ZNhJIZebOnxvEEQvfvS2GWtI+FTIU0x3ChoOs9Pls UTMSIymzQHddM33fE0ioiyYxT+VbRdscVMkx8lw8ejMdW/fMe8WX9cpyn7AitGfdfMdY UFqepiV6AsxUXZHbm/8r+gFIohgafXe2N7P65XX5/FsK2L23bzNearhCQLP7HOh/wEuw q9mA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=dKvHghGnKL3Nb1N/EU4WBshHLTLebbQD0llejKM7Geo=; b=vb30Pz+/If7ENQyuTWUOcG1+c9Sq9Y9rC2+5t02UpLUXX2ZQvTalx5zA8iQiR/k6I7 p7qpS8gpdZhuc3rzZmM52eAEn9vEFk+A9oT+fWK9jMVG+PMHsn3zUk0eKTDIr1R5dqZk 6qyrpK19YMSEwERyW320atkX6FxnFPflN1naTvH1LcEhLAPVb6n6uQEhkS7soke1MIZE qkoouG4LHsAT7UU5nB0ghuXfQx/f8h4CMsp64+6M87R7MeU37YWEo4HwGlBezwoEMyZF RNbU3XVp7JFNA9UL72awCwESCuVb4KlqNryKF5YOaB5Es+T2N4eaonCXmqvMiP+mVzIJ aOlQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=haL+Ep5U; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z17-20020a170902ccd100b0017eae5cc961si34704052ple.306.2022.10.24.05.48.06; Mon, 24 Oct 2022 05:48:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=haL+Ep5U; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230366AbiJXMkg (ORCPT + 99 others); Mon, 24 Oct 2022 08:40:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45244 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230235AbiJXMf7 (ORCPT ); Mon, 24 Oct 2022 08:35:59 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B87EA7E005; Mon, 24 Oct 2022 05:05:57 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id AA5A0612BB; Mon, 24 Oct 2022 12:02:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BB436C433D6; Mon, 24 Oct 2022 12:02:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612938; bh=UXuYkRg57IpIdhL+0EpbJonj4qIC8kvPF/3E5EhuwQc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=haL+Ep5U82igLq05LkygCoKcVHZAPniDK0vjAjkdY5AeV/JbokKQUElS1McP9orNG Vy7n4BF8T1c70xQ/rCZQCUS3IXw1sctmXfNApKTs+DmJaJG+ckdKCAsWAisELqdgmR ZBBpy6SbXmkt4mwF7DRv8ZmabBmEQfPPfyuusqlQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Wright Feng , Chi-hsien Lin , Ahmad Fatoum , =?utf-8?q?Alvin_=C5=A0ipraga?= , Kalle Valo , Sasha Levin Subject: [PATCH 4.19 176/229] wifi: brcmfmac: fix invalid address access when enabling SCAN log level Date: Mon, 24 Oct 2022 13:31:35 +0200 Message-Id: <20221024113004.782832823@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747573225486621239?= X-GMAIL-MSGID: =?utf-8?q?1747573225486621239?= From: Wright Feng [ Upstream commit aa666b68e73fc06d83c070d96180b9010cf5a960 ] The variable i is changed when setting random MAC address and causes invalid address access when printing the value of pi->reqs[i]->reqid. We replace reqs index with ri to fix the issue. [ 136.726473] Unable to handle kernel access to user memory outside uaccess routines at virtual address 0000000000000000 [ 136.737365] Mem abort info: [ 136.740172] ESR = 0x96000004 [ 136.743359] Exception class = DABT (current EL), IL = 32 bits [ 136.749294] SET = 0, FnV = 0 [ 136.752481] EA = 0, S1PTW = 0 [ 136.755635] Data abort info: [ 136.758514] ISV = 0, ISS = 0x00000004 [ 136.762487] CM = 0, WnR = 0 [ 136.765522] user pgtable: 4k pages, 48-bit VAs, pgdp = 000000005c4e2577 [ 136.772265] [0000000000000000] pgd=0000000000000000 [ 136.777160] Internal error: Oops: 96000004 [#1] PREEMPT SMP [ 136.782732] Modules linked in: brcmfmac(O) brcmutil(O) cfg80211(O) compat(O) [ 136.789788] Process wificond (pid: 3175, stack limit = 0x00000000053048fb) [ 136.796664] CPU: 3 PID: 3175 Comm: wificond Tainted: G O 4.19.42-00001-g531a5f5 #1 [ 136.805532] Hardware name: Freescale i.MX8MQ EVK (DT) [ 136.810584] pstate: 60400005 (nZCv daif +PAN -UAO) [ 136.815429] pc : brcmf_pno_config_sched_scans+0x6cc/0xa80 [brcmfmac] [ 136.821811] lr : brcmf_pno_config_sched_scans+0x67c/0xa80 [brcmfmac] [ 136.828162] sp : ffff00000e9a3880 [ 136.831475] x29: ffff00000e9a3890 x28: ffff800020543400 [ 136.836786] x27: ffff8000b1008880 x26: ffff0000012bf6a0 [ 136.842098] x25: ffff80002054345c x24: ffff800088d22400 [ 136.847409] x23: ffff0000012bf638 x22: ffff0000012bf6d8 [ 136.852721] x21: ffff8000aced8fc0 x20: ffff8000ac164400 [ 136.858032] x19: ffff00000e9a3946 x18: 0000000000000000 [ 136.863343] x17: 0000000000000000 x16: 0000000000000000 [ 136.868655] x15: ffff0000093f3b37 x14: 0000000000000050 [ 136.873966] x13: 0000000000003135 x12: 0000000000000000 [ 136.879277] x11: 0000000000000000 x10: ffff000009a61888 [ 136.884589] x9 : 000000000000000f x8 : 0000000000000008 [ 136.889900] x7 : 303a32303d726464 x6 : ffff00000a1f957d [ 136.895211] x5 : 0000000000000000 x4 : ffff00000e9a3942 [ 136.900523] x3 : 0000000000000000 x2 : ffff0000012cead8 [ 136.905834] x1 : ffff0000012bf6d8 x0 : 0000000000000000 [ 136.911146] Call trace: [ 136.913623] brcmf_pno_config_sched_scans+0x6cc/0xa80 [brcmfmac] [ 136.919658] brcmf_pno_start_sched_scan+0xa4/0x118 [brcmfmac] [ 136.925430] brcmf_cfg80211_sched_scan_start+0x80/0xe0 [brcmfmac] [ 136.931636] nl80211_start_sched_scan+0x140/0x308 [cfg80211] [ 136.937298] genl_rcv_msg+0x358/0x3f4 [ 136.940960] netlink_rcv_skb+0xb4/0x118 [ 136.944795] genl_rcv+0x34/0x48 [ 136.947935] netlink_unicast+0x264/0x300 [ 136.951856] netlink_sendmsg+0x2e4/0x33c [ 136.955781] __sys_sendto+0x120/0x19c Signed-off-by: Wright Feng Signed-off-by: Chi-hsien Lin Signed-off-by: Ahmad Fatoum Signed-off-by: Alvin Šipraga Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/20220722115632.620681-4-alvin@pqrs.dk Signed-off-by: Sasha Levin --- .../net/wireless/broadcom/brcm80211/brcmfmac/pno.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pno.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pno.c index ffa243e2e2d0..581a23549ee5 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pno.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pno.c @@ -163,12 +163,12 @@ static int brcmf_pno_set_random(struct brcmf_if *ifp, struct brcmf_pno_info *pi) struct brcmf_pno_macaddr_le pfn_mac; u8 *mac_addr = NULL; u8 *mac_mask = NULL; - int err, i; + int err, i, ri; - for (i = 0; i < pi->n_reqs; i++) - if (pi->reqs[i]->flags & NL80211_SCAN_FLAG_RANDOM_ADDR) { - mac_addr = pi->reqs[i]->mac_addr; - mac_mask = pi->reqs[i]->mac_addr_mask; + for (ri = 0; ri < pi->n_reqs; ri++) + if (pi->reqs[ri]->flags & NL80211_SCAN_FLAG_RANDOM_ADDR) { + mac_addr = pi->reqs[ri]->mac_addr; + mac_mask = pi->reqs[ri]->mac_addr_mask; break; } @@ -190,7 +190,7 @@ static int brcmf_pno_set_random(struct brcmf_if *ifp, struct brcmf_pno_info *pi) pfn_mac.mac[0] |= 0x02; brcmf_dbg(SCAN, "enabling random mac: reqid=%llu mac=%pM\n", - pi->reqs[i]->reqid, pfn_mac.mac); + pi->reqs[ri]->reqid, pfn_mac.mac); err = brcmf_fil_iovar_data_set(ifp, "pfn_macaddr", &pfn_mac, sizeof(pfn_mac)); if (err) From patchwork Mon Oct 24 11:31:36 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9834 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp555987wru; Mon, 24 Oct 2022 10:00:59 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5x4UYm5zCut0GrLn0jrwvR41ApbMxD0+iWJp24klw0PBVR3nRzRgsGY6qroIgnycNDZPd6 X-Received: by 2002:a17:902:bd02:b0:178:1a1c:889 with SMTP id p2-20020a170902bd0200b001781a1c0889mr34209990pls.107.1666630858720; Mon, 24 Oct 2022 10:00:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666630858; cv=none; d=google.com; s=arc-20160816; b=V5trAqkEXMtqt7IaTMm9ReNGRAUHnY+AsHezPqHoWGlaMvHZvgg1b94QIWxFAlkGZO WLQWuLz3A2JFAEKGMyDYEaNiFaUpEZ9T13woJmM2yPCiN+jGFN5JFJ+MKQoapb0DjFgk BURFG4a0X9a4L5WAIXp2mZf7xeI6AgU3/HjeucxWcgiLOd2+SLr1yfyp/r/haQ1smKGq S1I8e4sSeE80LN1UB97DC/b9wZkA8pCjDkABb8/6vJf31h+rfSoZrJCgd0+0JS2pxix4 68EfszoqjJjnOSRl0zE7tMWbfyTzjyR2YDkM2eB+SL7DqYDWime0ZpXFmuhO7OtiHewz Vq/Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=NQTjwj1okKal2zUZYOb+rFp+XT0RovHKzCW2HZRkkDM=; b=yrLzR9wLw4bvEa1Wwt9e5GSGXkJ0pLDkw5QiZkThm9QpeFcmB8f5+bjtI9l9pawJAj AYUBpwBHiy8fWGvl/y34HeDDWt6PDbsBSGFGgc+F7jd/59vy413cnOTFq8EuFveOrAdG gN6Uqa+pFhdLPq1zx7me7/2GquCwqPUEbpCHOP1A/sdtQsKf8dC2FgTBmxrr6M8BlCdP XAc+UrkHbYi1KyRN1eDxuLFWZztZfYyFgnhfcXW9aaGNgkgBcylRLJBTtA3d4JeIohI7 tIKj9DD1Mnyk2FJ8vBwPmiEjrgIRN9+XHwMK3mSrK/eSsYukFtmn+91PL0u0k60mGdAw Euaw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=PTsRZNKR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h132-20020a636c8a000000b0045ceb2c2eb7si29113595pgc.760.2022.10.24.10.00.32; Mon, 24 Oct 2022 10:00:58 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=PTsRZNKR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235156AbiJXQyP (ORCPT + 99 others); Mon, 24 Oct 2022 12:54:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56006 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235449AbiJXQth (ORCPT ); Mon, 24 Oct 2022 12:49:37 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8A15C2871B; Mon, 24 Oct 2022 08:33:05 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 052A7B8119B; Mon, 24 Oct 2022 12:02:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 574F0C433D6; Mon, 24 Oct 2022 12:02:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612940; bh=LYOZmQeizkuIeOn1+GAegEIME+ZYeJwyvA0+gG8HBBs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PTsRZNKR+TWM25qCStelVCGjmLX5RPJXOtzLrNjgdku3HaJzgg2XXaEsVPJBeMpNE urKFrrcg3uEaWZH/biM9Okcq+vjp9w1B5dxBwq0sufQbgNfvA+dec3vJj6WZBe0Qfq tmPYGcp2fuZMVxunKEExXFQEG2HpbJYrMZJJsjuQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mike Pattrick , "David S. Miller" , Sasha Levin Subject: [PATCH 4.19 177/229] openvswitch: Fix double reporting of drops in dropwatch Date: Mon, 24 Oct 2022 13:31:36 +0200 Message-Id: <20221024113004.822883523@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747589119142405656?= X-GMAIL-MSGID: =?utf-8?q?1747589119142405656?= From: Mike Pattrick [ Upstream commit 1100248a5c5ccd57059eb8d02ec077e839a23826 ] Frames sent to userspace can be reported as dropped in ovs_dp_process_packet, however, if they are dropped in the netlink code then netlink_attachskb will report the same frame as dropped. This patch checks for error codes which indicate that the frame has already been freed. Signed-off-by: Mike Pattrick Link: https://bugzilla.redhat.com/show_bug.cgi?id=2109946 Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- net/openvswitch/datapath.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/net/openvswitch/datapath.c b/net/openvswitch/datapath.c index f350faef044d..a9868e97db45 100644 --- a/net/openvswitch/datapath.c +++ b/net/openvswitch/datapath.c @@ -249,10 +249,17 @@ void ovs_dp_process_packet(struct sk_buff *skb, struct sw_flow_key *key) upcall.portid = ovs_vport_find_upcall_portid(p, skb); upcall.mru = OVS_CB(skb)->mru; error = ovs_dp_upcall(dp, skb, key, &upcall, 0); - if (unlikely(error)) - kfree_skb(skb); - else + switch (error) { + case 0: + case -EAGAIN: + case -ERESTARTSYS: + case -EINTR: consume_skb(skb); + break; + default: + kfree_skb(skb); + break; + } stats_counter = &stats->n_missed; goto out; } From patchwork Mon Oct 24 11:31:37 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8787 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp430752wru; Mon, 24 Oct 2022 05:42:12 -0700 (PDT) X-Google-Smtp-Source: AMsMyM78lJDuUjaeaDwEkddP7n6ZiTFEWMOGAzUfKHCmtjX5LtklHRNIPc/NnQUEKP37GjWbxdcD X-Received: by 2002:a17:902:db01:b0:186:9329:723f with SMTP id m1-20020a170902db0100b001869329723fmr10374150plx.172.1666615332698; Mon, 24 Oct 2022 05:42:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666615332; cv=none; d=google.com; s=arc-20160816; b=b8hDEoUbgiA+HLhrMpxCrNKouDRUpEgBNfIsHrzLa2uIV5l9z8oTngADLPSlTFalGr V/Jdv2je8cAJPXADhjiVvgYxRhMhMMs/7e30RETIlkoprbdKZTUIcrMztO3nFd2/n0vs Kx42MIVefvYex2hGqtdGSs5EWrRp3Q6FMPLC0rSVQDV1f9UlcAuwuUNhZ5bgnDUYBobU Cz7jydJljGZ9/AWdkoEw05bZDqdxzNOPiSJbCwqd/fUN9pVSOETYK8ZQdjZ/lnTGzmq8 9U/sHcx0DFGCEpA9kLoqe4D4uDlSjj7P7S+BlAKoz5rv99pkciupYS8GTMCwn9hzJKhm d24Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=kUoTzrRjyvRlavI6DWzzossrSHhbqyaQHSE4uFw4PRQ=; b=TzO9N3hVik7c5dpn/Ue/a7P9NDTAyx4qaTJs+pr6pdbLPzyNfSzpIrPtJl0wi9p+do lflvD7KOVXd2yi58tnNgB1ZBmmNsW9vJSY37y3Bu9h2qMorjU1n19cG1gH09WrlCVufn SLH8PBdehac2vumoDIG/5SKSQmTIPNCv/juAUx55uMPF36BJqtWrohtIo5TxtOY86nMI T+0K7+wRL36ohw1bYv6eY2Y1V1G0PMQE0hA2fdfI32jFtDNbx/mSHcZgkPrQ0HsZDEc1 f9iN3SEXxag8N/85X81qie7793eVETmXJJLVb/UROokp/e0feJPSyYIJVqHbs4NjXPfM EAIg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=JkufbTLX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w1-20020a63a741000000b00461c7200fafsi34411069pgo.320.2022.10.24.05.41.58; Mon, 24 Oct 2022 05:42:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=JkufbTLX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233956AbiJXMcK (ORCPT + 99 others); Mon, 24 Oct 2022 08:32:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60616 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233836AbiJXM3B (ORCPT ); Mon, 24 Oct 2022 08:29:01 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 95BB11007C; Mon, 24 Oct 2022 05:02:41 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id E697261254; Mon, 24 Oct 2022 12:02:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 01370C433D7; Mon, 24 Oct 2022 12:02:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612943; bh=qauSKgpxQD3mSoJYIZLLYiRX2nOUMjRG4equd7WLjdc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JkufbTLXjpJJ3bnlLaWpPmH+mBKYodRi6+OcrqDBgX2/E8wJKp7PXfL02LPWG0eGI Y7bef4hp2L9tBl2c4O0jTUZlDEpNFMLv4FXZ3hghPqZ/Y0b4p9bKyA3fLuHtXguBcL smqUQIL6vtd3D+LvdpTh/wVv7JZTcuZ6ciXzKKJU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mike Pattrick , "David S. Miller" , Sasha Levin Subject: [PATCH 4.19 178/229] openvswitch: Fix overreporting of drops in dropwatch Date: Mon, 24 Oct 2022 13:31:37 +0200 Message-Id: <20221024113004.851952005@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747572839129813874?= X-GMAIL-MSGID: =?utf-8?q?1747572839129813874?= From: Mike Pattrick [ Upstream commit c21ab2afa2c64896a7f0e3cbc6845ec63dcfad2e ] Currently queue_userspace_packet will call kfree_skb for all frames, whether or not an error occurred. This can result in a single dropped frame being reported as multiple drops in dropwatch. This functions caller may also call kfree_skb in case of an error. This patch will consume the skbs instead and allow caller's to use kfree_skb. Signed-off-by: Mike Pattrick Link: https://bugzilla.redhat.com/show_bug.cgi?id=2109957 Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- net/openvswitch/datapath.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/net/openvswitch/datapath.c b/net/openvswitch/datapath.c index a9868e97db45..b4e3db194140 100644 --- a/net/openvswitch/datapath.c +++ b/net/openvswitch/datapath.c @@ -526,8 +526,9 @@ static int queue_userspace_packet(struct datapath *dp, struct sk_buff *skb, out: if (err) skb_tx_error(skb); - kfree_skb(user_skb); - kfree_skb(nskb); + consume_skb(user_skb); + consume_skb(nskb); + return err; } From patchwork Mon Oct 24 11:31:38 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8779 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp430664wru; Mon, 24 Oct 2022 05:42:04 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7M4FmUYlK0ckfKVrK2n3cRmBo8CXTvvQCcueaWT34avMk1Kse0NY3LlfCaJub0iscn+2mJ X-Received: by 2002:a63:c5d:0:b0:460:17cc:73a6 with SMTP id 29-20020a630c5d000000b0046017cc73a6mr27920302pgm.332.1666615324403; Mon, 24 Oct 2022 05:42:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666615324; cv=none; d=google.com; s=arc-20160816; b=vMStJdZTiiXiNH0DoMPHxBigVKefRza1fegF0MePxeLOARGFhm08dLv2tfCvxVQTxo tXa67jtG0RF5lZmLWDYbz0h9R0D2U0BeiMhZIihlcWJJSX8506VbDR3YqMyEEad2ho8w Y5jeaEgi3wDR3zihqv2s+gG9d79o7x6aYZrcMFCA/pMQMht/EQuONiVchqdLLfB4dtga uirnYrj7wj0ut0exCipO1FdiW4YGvDzD5kOwuij82qxWzuRdgWEsNlNs4Wn9czooflya u7QSSrPwxYO+bnhTQJMeelx8f9Yv5Pqce5Cl4IZzFRuJRWcK/Goj17uaWERqGGaEwJWX ik/Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=AElZRAF/mqrmbPkJ6h8YQogxyWe59RB1iZ38D/idbhA=; b=phahKvQRjRS87y/HrRhdXFhGDPRppHDl/2lhrGwB41skZ0WnH91THt+c+tqQt5nxvw AxrB4YiQerLXh3ddAhAP5MV+F9moBuOebSomFesQYlY9eXJqGZQGNDNQ0iU3xTrqfSnf VWZElxetptMHPhzyExiIYlC2FnfTMWu/qwsXtnoUu3jR1HCQkNTU4tJUzWRcuxByXlj3 EEwQnsgjVzRPiUsrcFHhIs3+Mop4fBTlPD7S6frILB5q3O3kqy4hqKGKAV1Kj+CQAu0R jGZl7R7ke6ehQKlYaUscHMkBdeeowcyzj+Rj8qs3CkicqKdrYuL+6Cn3TYU4OgkIGPry pTNA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=mUKyclbA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id bu3-20020a056a00410300b0056c0a9e09f0si223466pfb.292.2022.10.24.05.41.47; Mon, 24 Oct 2022 05:42:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=mUKyclbA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234028AbiJXMce (ORCPT + 99 others); Mon, 24 Oct 2022 08:32:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60536 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233985AbiJXM3J (ORCPT ); Mon, 24 Oct 2022 08:29:09 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 81A15876A3; Mon, 24 Oct 2022 05:02:45 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 27626612BF; Mon, 24 Oct 2022 12:02:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3EB35C433C1; Mon, 24 Oct 2022 12:02:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612948; bh=pLN/sFfYUW0NXqW4PeXLNd8RRvah68DsucHrBUN4/EM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mUKyclbA/OQvrja5k3lezGCiXoweJgL3ex0+q3NrIyd4V+zqmwl4mwFD645fL2u9z bWDzOjGuOuTltJq/07dRZ2/nW1hBcsGUNWAf7OKqAlXC97A9wViaFXVVgz+cJ3siZa bE0zvV1wpktRWaZc01GVhPuecW/VvnvwHRTuuSC4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Abhishek Shah , Eric Dumazet , "David S. Miller" , Sasha Levin Subject: [PATCH 4.19 179/229] tcp: annotate data-race around tcp_md5sig_pool_populated Date: Mon, 24 Oct 2022 13:31:38 +0200 Message-Id: <20221024113004.886317136@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747572830600863396?= X-GMAIL-MSGID: =?utf-8?q?1747572830600863396?= From: Eric Dumazet [ Upstream commit aacd467c0a576e5e44d2de4205855dc0fe43f6fb ] tcp_md5sig_pool_populated can be read while another thread changes its value. The race has no consequence because allocations are protected with tcp_md5sig_mutex. This patch adds READ_ONCE() and WRITE_ONCE() to document the race and silence KCSAN. Reported-by: Abhishek Shah Signed-off-by: Eric Dumazet Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- net/ipv4/tcp.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c index e25130812cc8..1a6c55441627 100644 --- a/net/ipv4/tcp.c +++ b/net/ipv4/tcp.c @@ -3692,12 +3692,16 @@ static void __tcp_alloc_md5sig_pool(void) * to memory. See smp_rmb() in tcp_get_md5sig_pool() */ smp_wmb(); - tcp_md5sig_pool_populated = true; + /* Paired with READ_ONCE() from tcp_alloc_md5sig_pool() + * and tcp_get_md5sig_pool(). + */ + WRITE_ONCE(tcp_md5sig_pool_populated, true); } bool tcp_alloc_md5sig_pool(void) { - if (unlikely(!tcp_md5sig_pool_populated)) { + /* Paired with WRITE_ONCE() from __tcp_alloc_md5sig_pool() */ + if (unlikely(!READ_ONCE(tcp_md5sig_pool_populated))) { mutex_lock(&tcp_md5sig_mutex); if (!tcp_md5sig_pool_populated) @@ -3705,7 +3709,8 @@ bool tcp_alloc_md5sig_pool(void) mutex_unlock(&tcp_md5sig_mutex); } - return tcp_md5sig_pool_populated; + /* Paired with WRITE_ONCE() from __tcp_alloc_md5sig_pool() */ + return READ_ONCE(tcp_md5sig_pool_populated); } EXPORT_SYMBOL(tcp_alloc_md5sig_pool); @@ -3721,7 +3726,8 @@ struct tcp_md5sig_pool *tcp_get_md5sig_pool(void) { local_bh_disable(); - if (tcp_md5sig_pool_populated) { + /* Paired with WRITE_ONCE() from __tcp_alloc_md5sig_pool() */ + if (READ_ONCE(tcp_md5sig_pool_populated)) { /* coupled with smp_wmb() in __tcp_alloc_md5sig_pool() */ smp_rmb(); return this_cpu_ptr(&tcp_md5sig_pool); From patchwork Mon Oct 24 11:31:39 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8818 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp431116wru; Mon, 24 Oct 2022 05:43:00 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5sGLmMwCFyjjKclcqFx0Y86/uLZ8kMWI/GHWw9bG4Uq4E3OsOMUKHx42WPKwDJ8KSXTe6a X-Received: by 2002:a17:902:da8e:b0:186:9869:adfa with SMTP id j14-20020a170902da8e00b001869869adfamr9515965plx.57.1666615380621; Mon, 24 Oct 2022 05:43:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666615380; cv=none; d=google.com; s=arc-20160816; b=Y+nSE9U23AJs2GtaYzBWXjYsv6kn8uA4at12U5sB0OVvZAjYNptDPHElOyUsLH/vUB cN68jovLRCF6uuIQdLA4leRNvtpY+hbi880Pbj+GNz5rbcjnMT5/ryLbTD1rXCo6DYHr hoZ2L5bjJMQmNIhg4eWZmX5+y9DWv1/PXwrkMHunatg/m+tRjtH5FYkYhoHCmXW9cBSd iMn3+J39FQfRNjO1l+izb+u59wu04QQBXjY+Vvwu41iNxRpnlmFrLxH8SFN/tRB7VtQ+ 09AXaRZEtDYQYXFWYi+K1tci6wiSVAGWXQHzxM4I/7LZllbyrVzuGgPvhgXdq1Ts+OP8 Vg7Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=NR1z0r9gT6UvmrKCjILK1I/gbXSLbg6botcZNy4HE1I=; b=E9ox3oJ6MBmu3E+lp0bxngYCSg9637Jz5A3dmPSMihNdsC01Ul3UEoa2TOBxLFA/Xy UbA3iNDz42kKfQWCecBD7Wj11JRSDvyiGysXBvUFUtmajI/dfRRonJTyfljkbmD2LQsp KYYeA1DCDpc6lUir34wAExw/DrGI/ERmy4HSWkcj1LrW1ZblRiWOgvDl2RCE4X530XUm Rr7crN+iHxdpRSo0ymY6Zikg+RUUxNjch6qTl+w6WF5DIaXAPs690ufKjIfV16l5jb5I oGMEDm6ZV34cpVW0zVvlzaDGz/FNlvmhBLCLY+36q8TEXCdI+LERkqx3GAuxd4QS6osk 4OVg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=edw7Nym8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id cn15-20020a056a00340f00b00560cc24dcdcsi31669642pfb.270.2022.10.24.05.42.44; Mon, 24 Oct 2022 05:43:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=edw7Nym8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233973AbiJXMcV (ORCPT + 99 others); Mon, 24 Oct 2022 08:32:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47702 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233954AbiJXM3F (ORCPT ); Mon, 24 Oct 2022 08:29:05 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 529F45591; Mon, 24 Oct 2022 05:02:53 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id C8637612E3; Mon, 24 Oct 2022 12:02:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D24C7C433C1; Mon, 24 Oct 2022 12:02:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612951; bh=m/QdiEsyaqsXyeYZVuoxXTWReCx/204ZsauJ1OlEs0U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=edw7Nym8mBVrLAJwlpVZG/MpX7AZRYNKPYs03A+BoxBW0awT2wsAHDCrp1cS8OCon 7IXBBt5xoopfHTZdD3FdxSttQpEIm2czBCNDifHnedzIIa2gVwz0h20He+4QqmJ/h+ B+xQ+g9BclVFPMxT+HM4fcef4LChXruVKKR1+x78= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, syzbot , Tetsuo Handa , =?utf-8?q?Toke_H=C3=B8il?= =?utf-8?q?and-J=C3=B8rgensen?= , Kalle Valo , Sasha Levin Subject: [PATCH 4.19 180/229] wifi: ath9k: avoid uninit memory read in ath9k_htc_rx_msg() Date: Mon, 24 Oct 2022 13:31:39 +0200 Message-Id: <20221024113004.915215859@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747572889392672486?= X-GMAIL-MSGID: =?utf-8?q?1747572889392672486?= From: Tetsuo Handa [ Upstream commit b383e8abed41cc6ff1a3b34de75df9397fa4878c ] syzbot is reporting uninit value at ath9k_htc_rx_msg() [1], for ioctl(USB_RAW_IOCTL_EP_WRITE) can call ath9k_hif_usb_rx_stream() with pkt_len = 0 but ath9k_hif_usb_rx_stream() uses __dev_alloc_skb(pkt_len + 32, GFP_ATOMIC) based on an assumption that pkt_len is valid. As a result, ath9k_hif_usb_rx_stream() allocates skb with uninitialized memory and ath9k_htc_rx_msg() is reading from uninitialized memory. Since bytes accessed by ath9k_htc_rx_msg() is not known until ath9k_htc_rx_msg() is called, it would be difficult to check minimal valid pkt_len at "if (pkt_len > 2 * MAX_RX_BUF_SIZE) {" line in ath9k_hif_usb_rx_stream(). We have two choices. One is to workaround by adding __GFP_ZERO so that ath9k_htc_rx_msg() sees 0 if pkt_len is invalid. The other is to let ath9k_htc_rx_msg() validate pkt_len before accessing. This patch chose the latter. Note that I'm not sure threshold condition is correct, for I can't find details on possible packet length used by this protocol. Link: https://syzkaller.appspot.com/bug?extid=2ca247c2d60c7023de7f [1] Reported-by: syzbot Signed-off-by: Tetsuo Handa Acked-by: Toke Høiland-Jørgensen Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/7acfa1be-4b5c-b2ce-de43-95b0593fb3e5@I-love.SAKURA.ne.jp Signed-off-by: Sasha Levin --- drivers/net/wireless/ath/ath9k/htc_hst.c | 43 +++++++++++++++--------- 1 file changed, 28 insertions(+), 15 deletions(-) diff --git a/drivers/net/wireless/ath/ath9k/htc_hst.c b/drivers/net/wireless/ath/ath9k/htc_hst.c index e37de14bc502..6d69cf69fd86 100644 --- a/drivers/net/wireless/ath/ath9k/htc_hst.c +++ b/drivers/net/wireless/ath/ath9k/htc_hst.c @@ -367,33 +367,27 @@ void ath9k_htc_txcompletion_cb(struct htc_target *htc_handle, } static void ath9k_htc_fw_panic_report(struct htc_target *htc_handle, - struct sk_buff *skb) + struct sk_buff *skb, u32 len) { uint32_t *pattern = (uint32_t *)skb->data; - switch (*pattern) { - case 0x33221199: - { + if (*pattern == 0x33221199 && len >= sizeof(struct htc_panic_bad_vaddr)) { struct htc_panic_bad_vaddr *htc_panic; htc_panic = (struct htc_panic_bad_vaddr *) skb->data; dev_err(htc_handle->dev, "ath: firmware panic! " "exccause: 0x%08x; pc: 0x%08x; badvaddr: 0x%08x.\n", htc_panic->exccause, htc_panic->pc, htc_panic->badvaddr); - break; - } - case 0x33221299: - { + return; + } + if (*pattern == 0x33221299) { struct htc_panic_bad_epid *htc_panic; htc_panic = (struct htc_panic_bad_epid *) skb->data; dev_err(htc_handle->dev, "ath: firmware panic! " "bad epid: 0x%08x\n", htc_panic->epid); - break; - } - default: - dev_err(htc_handle->dev, "ath: unknown panic pattern!\n"); - break; + return; } + dev_err(htc_handle->dev, "ath: unknown panic pattern!\n"); } /* @@ -414,16 +408,26 @@ void ath9k_htc_rx_msg(struct htc_target *htc_handle, if (!htc_handle || !skb) return; + /* A valid message requires len >= 8. + * + * sizeof(struct htc_frame_hdr) == 8 + * sizeof(struct htc_ready_msg) == 8 + * sizeof(struct htc_panic_bad_vaddr) == 16 + * sizeof(struct htc_panic_bad_epid) == 8 + */ + if (unlikely(len < sizeof(struct htc_frame_hdr))) + goto invalid; htc_hdr = (struct htc_frame_hdr *) skb->data; epid = htc_hdr->endpoint_id; if (epid == 0x99) { - ath9k_htc_fw_panic_report(htc_handle, skb); + ath9k_htc_fw_panic_report(htc_handle, skb, len); kfree_skb(skb); return; } if (epid < 0 || epid >= ENDPOINT_MAX) { +invalid: if (pipe_id != USB_REG_IN_PIPE) dev_kfree_skb_any(skb); else @@ -435,21 +439,30 @@ void ath9k_htc_rx_msg(struct htc_target *htc_handle, /* Handle trailer */ if (htc_hdr->flags & HTC_FLAGS_RECV_TRAILER) { - if (be32_to_cpu(*(__be32 *) skb->data) == 0x00C60000) + if (be32_to_cpu(*(__be32 *) skb->data) == 0x00C60000) { /* Move past the Watchdog pattern */ htc_hdr = (struct htc_frame_hdr *)(skb->data + 4); + len -= 4; + } } /* Get the message ID */ + if (unlikely(len < sizeof(struct htc_frame_hdr) + sizeof(__be16))) + goto invalid; msg_id = (__be16 *) ((void *) htc_hdr + sizeof(struct htc_frame_hdr)); /* Now process HTC messages */ switch (be16_to_cpu(*msg_id)) { case HTC_MSG_READY_ID: + if (unlikely(len < sizeof(struct htc_ready_msg))) + goto invalid; htc_process_target_rdy(htc_handle, htc_hdr); break; case HTC_MSG_CONNECT_SERVICE_RESPONSE_ID: + if (unlikely(len < sizeof(struct htc_frame_hdr) + + sizeof(struct htc_conn_svc_rspmsg))) + goto invalid; htc_process_conn_rsp(htc_handle, htc_hdr); break; default: From patchwork Mon Oct 24 11:31:40 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8854 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp432983wru; Mon, 24 Oct 2022 05:48:15 -0700 (PDT) X-Google-Smtp-Source: AMsMyM74SwruyslTUakG/DNq92/4+LoAul8Pj152bek6WEuZMQS7VLeGJtMzjzD4DBJ1AJ83IFc6 X-Received: by 2002:a17:90a:354:b0:20a:6867:4a2b with SMTP id 20-20020a17090a035400b0020a68674a2bmr74049819pjf.157.1666615695454; Mon, 24 Oct 2022 05:48:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666615695; cv=none; d=google.com; s=arc-20160816; b=yJ82Z6zvzuhd4yLgjI0mEMAnbD3raRCkX/8H/LQfcoYPod7L/s63DxsuMUQ1cSbKgz kp5Q3hjacJhhTODj3Dyup7Oo80FcdpUMyMNePGB9b5TtByRAaLFlsAHUAEIhAAd8VlKp KzDL0oIDkuGAFz28DHR7ZpJ+0Ap43UPjjTqRZbM5TKTJGT4CWh0Ndt1BxgvvNI/AViTu fybph4eSjLPIZUxqHA1gkQyxpJgFsQksjqpJeyCvR4zcR30mgD/+vBlNPVavrkJ6kyOA aX3grE+28pt6fWUwBnRF067avF72Hox4y/IHpLSXYbykwn211V76txJ9J8GyoL8DDwax imFQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Tm717FB0OfzvRFjmRnD6aZ2+61xnbGzoQzQDqRQxaYQ=; b=aZK58FHSwFJ0GhblBrA4xsUkI4xXtBY5jnKxeSbH7vbcdVOqwqfKDU/2u9Fh+wQWD/ 0ET+vGnZW8giI97OrzcnArkh+bsaCZmsg31j3JeGZgdsMRA5L0dKZiI+p2v0+k2tPEFm 5GYczHpooMzppc8BFSbcmAam3mTbnuCCGp2qPT2zdvqhuFbXX3NJhpSYcLOYOyYxIC8v i3WQ5fSRePTBFygz0vRvWts/LD4257BYMQWpU6HKoMsXSRz2Uko8NQreJYzQN9KTSR09 nKLFRBWoyg5Cw6qy3KlGhmFP+DPk0iczBysg7rdx1QpqEGUjU+0ADH11Mdgfq6yRelb0 PbTA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="jrqRm/k1"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id bc22-20020a656d96000000b0046ed85dc141si7732418pgb.472.2022.10.24.05.48.01; Mon, 24 Oct 2022 05:48:15 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="jrqRm/k1"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234022AbiJXMi2 (ORCPT + 99 others); Mon, 24 Oct 2022 08:38:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45248 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234489AbiJXMfK (ORCPT ); Mon, 24 Oct 2022 08:35:10 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E2DD25FF40; Mon, 24 Oct 2022 05:05:29 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 687F5612DB; Mon, 24 Oct 2022 12:02:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7BA1EC433C1; Mon, 24 Oct 2022 12:02:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612953; bh=/XB4y2LpgVtKSLfj2FRGEXMsobFlbWAbbPzG5tqVxqA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jrqRm/k1b/V6HcATXfa9l86fIiZ6IF0qWDEEhRh7Aoz5Ree4YSeYoj/qAH3GxycIB x3r2AyBE3Wur04PIUccxhaIURwkSnRKKRvs/LAnWAH9CiYxvqvMcKokHeKE60+0qt6 3vX1IMAsVfMuNFFVSrE4pogp2RTRtiyIH7e9BAzQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Herbert Xu , syzbot+5ec9bb042ddfe9644773@syzkaller.appspotmail.com, Khalid Masum , Steffen Klassert , Sasha Levin Subject: [PATCH 4.19 181/229] xfrm: Update ipcomp_scratches with NULL when freed Date: Mon, 24 Oct 2022 13:31:40 +0200 Message-Id: <20221024113004.944366721@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747573219820352051?= X-GMAIL-MSGID: =?utf-8?q?1747573219820352051?= From: Khalid Masum [ Upstream commit 8a04d2fc700f717104bfb95b0f6694e448a4537f ] Currently if ipcomp_alloc_scratches() fails to allocate memory ipcomp_scratches holds obsolete address. So when we try to free the percpu scratches using ipcomp_free_scratches() it tries to vfree non existent vm area. Described below: static void * __percpu *ipcomp_alloc_scratches(void) { ... scratches = alloc_percpu(void *); if (!scratches) return NULL; ipcomp_scratches does not know about this allocation failure. Therefore holding the old obsolete address. ... } So when we free, static void ipcomp_free_scratches(void) { ... scratches = ipcomp_scratches; Assigning obsolete address from ipcomp_scratches if (!scratches) return; for_each_possible_cpu(i) vfree(*per_cpu_ptr(scratches, i)); Trying to free non existent page, causing warning: trying to vfree existent vm area. ... } Fix this breakage by updating ipcomp_scrtches with NULL when scratches is freed Suggested-by: Herbert Xu Reported-by: syzbot+5ec9bb042ddfe9644773@syzkaller.appspotmail.com Tested-by: syzbot+5ec9bb042ddfe9644773@syzkaller.appspotmail.com Signed-off-by: Khalid Masum Acked-by: Herbert Xu Signed-off-by: Steffen Klassert Signed-off-by: Sasha Levin --- net/xfrm/xfrm_ipcomp.c | 1 + 1 file changed, 1 insertion(+) diff --git a/net/xfrm/xfrm_ipcomp.c b/net/xfrm/xfrm_ipcomp.c index a00ec715aa46..32aed1d0f6ee 100644 --- a/net/xfrm/xfrm_ipcomp.c +++ b/net/xfrm/xfrm_ipcomp.c @@ -216,6 +216,7 @@ static void ipcomp_free_scratches(void) vfree(*per_cpu_ptr(scratches, i)); free_percpu(scratches); + ipcomp_scratches = NULL; } static void * __percpu *ipcomp_alloc_scratches(void) From patchwork Mon Oct 24 11:31:41 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9826 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp555974wru; Mon, 24 Oct 2022 10:00:58 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4lpaGvOeRNIzLik8pHNvxQRrR+Y4ZY26v5gN3+7onxlAkjp/RyDe+/xOiBKxU+Mz9ylJPd X-Received: by 2002:a63:b4d:0:b0:454:d8b4:285 with SMTP id a13-20020a630b4d000000b00454d8b40285mr29366114pgl.410.1666630858500; Mon, 24 Oct 2022 10:00:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666630858; cv=none; d=google.com; s=arc-20160816; b=C6AJLzzYlJ+PjvQb0dNHGjKKy2Gr/SGaVfy7zjCSUOloH0JFASMAFjBjrukncghVyH YoQGUW+zO7iTz8L6ElyNvz014Tbd1kcdHZ4SGAcoKo2HgTKDjD5dcQWBa94qvT++ZN7D i8xzXNRsrLmQNe4p9UITAPQC2Rtuky2GSCfdzSm5n4qT0JIBrbt8yJYGCJHcRpumNLjs aSFo0gnn/udttL8ycSck9iT+YieG2C7P+CZnqWwc6vadvqNCHIayzB+9LPmYA291cOl9 XInTU2T0vni9q7jmDv+43kCEhb36VLAY02OPDdlwf2wAJXCL1j49HMZbYMmAjPMuv64g 91IA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=yLJNe0nAAMrJ3oHI/VqSjhUuNzuRsG1dPQpL8SyDtMQ=; b=f/c+q8lHdtqOWdQ8ghOr3Nxw7enov1jaxrPIZXe63KnA6nh77T78ll4M0oVMS/1Csr riXpI3NDkgv3qGmdx2+ebVros/EqQf6IzXRBMZWF8c49xVFAQCjGT/1FLN0yXElGh/7U vJ2w/xHyQY+cy9vHR401s6raBLGM/2BkMLiNj5fZ/sg1x/kezGfPudlUwVRcUtFDbLDH TTtFbWgVdJCTF3a6O5KWS3OBea/RU+sfACeg+8GmRpRi6VwtdHt3MNAsD36HjNXW0/TQ Fc5IkQM4nxz9WgBuYf2W3WS+wV2vLw6BVr+ieoVDDXycJSO7GHM5L6EjZqtaufra1YQ0 6mnQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ICr32e2b; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ot6-20020a17090b3b4600b0020bbfb294a1si11760764pjb.174.2022.10.24.10.00.32; Mon, 24 Oct 2022 10:00:58 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ICr32e2b; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233248AbiJXQwG (ORCPT + 99 others); Mon, 24 Oct 2022 12:52:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58068 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235156AbiJXQtI (ORCPT ); Mon, 24 Oct 2022 12:49:08 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AA5838F972; Mon, 24 Oct 2022 08:32:07 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id B892FB810DB; Mon, 24 Oct 2022 12:02:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1837FC433D6; Mon, 24 Oct 2022 12:02:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612956; bh=Ic8RLd6b6zmXHlnLO6l/ZxdPrIULVAHglm6eOY1Z9CE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ICr32e2bpYL9Us7yTkd/8V/HCiHitaRBF820dnwtfailQu+ANl3HPL5l5fRV9kE1I yPIPNie9fsD5DkaIksTwxzwdDHQMo/EX9SAkxcjgqc8K+DFoebXTimEiF/ofRyXwnE W+pd7QrXtbsMJ7TpbF2ZAUPaLl+FIOL9YlXfgzg0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alexander Coffin , Kalle Valo , Sasha Levin Subject: [PATCH 4.19 182/229] wifi: brcmfmac: fix use-after-free bug in brcmf_netdev_start_xmit() Date: Mon, 24 Oct 2022 13:31:41 +0200 Message-Id: <20221024113004.984082782@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747589118932906396?= X-GMAIL-MSGID: =?utf-8?q?1747589118932906396?= From: Alexander Coffin [ Upstream commit 3f42faf6db431e04bf942d2ebe3ae88975723478 ] > ret = brcmf_proto_tx_queue_data(drvr, ifp->ifidx, skb); may be schedule, and then complete before the line > ndev->stats.tx_bytes += skb->len; [ 46.912801] ================================================================== [ 46.920552] BUG: KASAN: use-after-free in brcmf_netdev_start_xmit+0x718/0x8c8 [brcmfmac] [ 46.928673] Read of size 4 at addr ffffff803f5882e8 by task systemd-resolve/328 [ 46.935991] [ 46.937514] CPU: 1 PID: 328 Comm: systemd-resolve Tainted: G O 5.4.199-[REDACTED] #1 [ 46.947255] Hardware name: [REDACTED] [ 46.954568] Call trace: [ 46.957037] dump_backtrace+0x0/0x2b8 [ 46.960719] show_stack+0x24/0x30 [ 46.964052] dump_stack+0x128/0x194 [ 46.967557] print_address_description.isra.0+0x64/0x380 [ 46.972877] __kasan_report+0x1d4/0x240 [ 46.976723] kasan_report+0xc/0x18 [ 46.980138] __asan_report_load4_noabort+0x18/0x20 [ 46.985027] brcmf_netdev_start_xmit+0x718/0x8c8 [brcmfmac] [ 46.990613] dev_hard_start_xmit+0x1bc/0xda0 [ 46.994894] sch_direct_xmit+0x198/0xd08 [ 46.998827] __qdisc_run+0x37c/0x1dc0 [ 47.002500] __dev_queue_xmit+0x1528/0x21f8 [ 47.006692] dev_queue_xmit+0x24/0x30 [ 47.010366] neigh_resolve_output+0x37c/0x678 [ 47.014734] ip_finish_output2+0x598/0x2458 [ 47.018927] __ip_finish_output+0x300/0x730 [ 47.023118] ip_output+0x2e0/0x430 [ 47.026530] ip_local_out+0x90/0x140 [ 47.030117] igmpv3_sendpack+0x14c/0x228 [ 47.034049] igmpv3_send_cr+0x384/0x6b8 [ 47.037895] igmp_ifc_timer_expire+0x4c/0x118 [ 47.042262] call_timer_fn+0x1cc/0xbe8 [ 47.046021] __run_timers+0x4d8/0xb28 [ 47.049693] run_timer_softirq+0x24/0x40 [ 47.053626] __do_softirq+0x2c0/0x117c [ 47.057387] irq_exit+0x2dc/0x388 [ 47.060715] __handle_domain_irq+0xb4/0x158 [ 47.064908] gic_handle_irq+0x58/0xb0 [ 47.068581] el0_irq_naked+0x50/0x5c [ 47.072162] [ 47.073665] Allocated by task 328: [ 47.077083] save_stack+0x24/0xb0 [ 47.080410] __kasan_kmalloc.isra.0+0xc0/0xe0 [ 47.084776] kasan_slab_alloc+0x14/0x20 [ 47.088622] kmem_cache_alloc+0x15c/0x468 [ 47.092643] __alloc_skb+0xa4/0x498 [ 47.096142] igmpv3_newpack+0x158/0xd78 [ 47.099987] add_grhead+0x210/0x288 [ 47.103485] add_grec+0x6b0/0xb70 [ 47.106811] igmpv3_send_cr+0x2e0/0x6b8 [ 47.110657] igmp_ifc_timer_expire+0x4c/0x118 [ 47.115027] call_timer_fn+0x1cc/0xbe8 [ 47.118785] __run_timers+0x4d8/0xb28 [ 47.122457] run_timer_softirq+0x24/0x40 [ 47.126389] __do_softirq+0x2c0/0x117c [ 47.130142] [ 47.131643] Freed by task 180: [ 47.134712] save_stack+0x24/0xb0 [ 47.138041] __kasan_slab_free+0x108/0x180 [ 47.142146] kasan_slab_free+0x10/0x18 [ 47.145904] slab_free_freelist_hook+0xa4/0x1b0 [ 47.150444] kmem_cache_free+0x8c/0x528 [ 47.154292] kfree_skbmem+0x94/0x108 [ 47.157880] consume_skb+0x10c/0x5a8 [ 47.161466] __dev_kfree_skb_any+0x88/0xa0 [ 47.165598] brcmu_pkt_buf_free_skb+0x44/0x68 [brcmutil] [ 47.171023] brcmf_txfinalize+0xec/0x190 [brcmfmac] [ 47.176016] brcmf_proto_bcdc_txcomplete+0x1c0/0x210 [brcmfmac] [ 47.182056] brcmf_sdio_sendfromq+0x8dc/0x1e80 [brcmfmac] [ 47.187568] brcmf_sdio_dpc+0xb48/0x2108 [brcmfmac] [ 47.192529] brcmf_sdio_dataworker+0xc8/0x238 [brcmfmac] [ 47.197859] process_one_work+0x7fc/0x1a80 [ 47.201965] worker_thread+0x31c/0xc40 [ 47.205726] kthread+0x2d8/0x370 [ 47.208967] ret_from_fork+0x10/0x18 [ 47.212546] [ 47.214051] The buggy address belongs to the object at ffffff803f588280 [ 47.214051] which belongs to the cache skbuff_head_cache of size 208 [ 47.227086] The buggy address is located 104 bytes inside of [ 47.227086] 208-byte region [ffffff803f588280, ffffff803f588350) [ 47.238814] The buggy address belongs to the page: [ 47.243618] page:ffffffff00dd6200 refcount:1 mapcount:0 mapping:ffffff804b6bf800 index:0xffffff803f589900 compound_mapcount: 0 [ 47.255007] flags: 0x10200(slab|head) [ 47.258689] raw: 0000000000010200 ffffffff00dfa980 0000000200000002 ffffff804b6bf800 [ 47.266439] raw: ffffff803f589900 0000000080190018 00000001ffffffff 0000000000000000 [ 47.274180] page dumped because: kasan: bad access detected [ 47.279752] [ 47.281251] Memory state around the buggy address: [ 47.286051] ffffff803f588180: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb [ 47.293277] ffffff803f588200: fb fb fc fc fc fc fc fc fc fc fc fc fc fc fc fc [ 47.300502] >ffffff803f588280: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb [ 47.307723] ^ [ 47.314343] ffffff803f588300: fb fb fb fb fb fb fb fb fb fb fc fc fc fc fc fc [ 47.321569] ffffff803f588380: fc fc fc fc fc fc fc fc fb fb fb fb fb fb fb fb [ 47.328789] ================================================================== Signed-off-by: Alexander Coffin Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/20220808174925.3922558-1-alex.coffin@matician.com Signed-off-by: Sasha Levin --- drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c index db4c541f58ae..31bf2eb47b49 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c @@ -270,6 +270,7 @@ static netdev_tx_t brcmf_netdev_start_xmit(struct sk_buff *skb, struct brcmf_pub *drvr = ifp->drvr; struct ethhdr *eh; int head_delta; + unsigned int tx_bytes = skb->len; brcmf_dbg(DATA, "Enter, bsscfgidx=%d\n", ifp->bsscfgidx); @@ -341,7 +342,7 @@ static netdev_tx_t brcmf_netdev_start_xmit(struct sk_buff *skb, ndev->stats.tx_dropped++; } else { ndev->stats.tx_packets++; - ndev->stats.tx_bytes += skb->len; + ndev->stats.tx_bytes += tx_bytes; } /* Return ok: we always eat the packet */ From patchwork Mon Oct 24 11:31:42 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9006 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp440518wru; Mon, 24 Oct 2022 06:04:23 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6puCyW9SnbXryGq+MF53vaTv+H+/+YlX1UbDnxvlK5qIpC5sry9qHD+OqCjnCLAeSioL/0 X-Received: by 2002:a63:1612:0:b0:461:4180:d88b with SMTP id w18-20020a631612000000b004614180d88bmr28853786pgl.434.1666616662945; Mon, 24 Oct 2022 06:04:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666616662; cv=none; d=google.com; s=arc-20160816; b=cmzBlONBZvpINFwK9oGZR9cyrfv5evvJohDnJHZrE2OnXYhaM2HB8PTaBiXQgEkOou q+bSg68hbyXIQROQQjYe7W+XX3uJQf8+E0L1sbYH9gV5JghrKN3BBRkX49/1WnEB87XS 0i0t51d/IEjL75Mx6xGvVo2g10KIZQczNrvBIjEWYYZukahysuS2kT8jBGLLJ7I5ARPa uLhiWDuC9+T8evI/LItMq67eEWFtGjeB4Hcto2E/oikiF38JJAnWT0cvocgcedv0j8Y5 BxAZNi2d48RIEASS4cu5FyZPCfcXknnFqg1yy+29uloFQ6aFAtfF6T19l9aQ2pYZ89Hr YsjA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=GlfaECGuFhxs+Ynrsri76Cy74YuI/WNYA/brMj6NgKI=; b=xdKpyQe7WU2YTYXt+DlM8jvfSkffTj9/AjcZ75izqVn8zqNOitIJMbCQoJyz3xwjya 3Yg3UFWOi1wpl5YmtmYgYZJOvcOamilxaj+pZQCwRS0H4FJG3iplflOg9gLtwAdmbSFF tYnApS5Sdi91WKGptoP1enHAsFpnceSUXEGt9wla17Cogju5nsJjmlXesB0EL2Vb3TyT /r79lJZlgnUVpZHOh+T6e8rpVfnmly3H52Enbe9w/dAgzAyMAFF5p5LKA2gdkpHiQ1vV SSTFKINpS/enTp2nLY6w3tZmQadKXAuP1XhtK4z6I3lLKSBPiCYHBhIqLu+gR7LM2azk fLpA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=F8rdWeWW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g7-20020a170902740700b00186aee00facsi2047708pll.518.2022.10.24.06.03.44; Mon, 24 Oct 2022 06:04:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=F8rdWeWW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232239AbiJXNDO (ORCPT + 99 others); Mon, 24 Oct 2022 09:03:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33342 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235244AbiJXM7o (ORCPT ); Mon, 24 Oct 2022 08:59:44 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3DE669AC3B; Mon, 24 Oct 2022 05:19:07 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 25C6761257; Mon, 24 Oct 2022 12:04:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 38DE7C433C1; Mon, 24 Oct 2022 12:04:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613061; bh=rNP+Al6u5YeMGaU/bAoWFB6k46B24myAjYk+sEp9nMk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=F8rdWeWWY5NBUOfmK0KPFbaZbtuuphunuT8ZnOewF2cO5jvyLPsUJvJiKkYgA1d92 EoA6ZcuXF68rsgupPt/5H7c209JrjuZgpJyFCzLjk0OETjc8iKaZj1V1yg4Dr9O/o1 V2pBzsVjr0JyA9/JigJQc/N+DSXC81rzI7emvvcY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, syzbot , Tetsuo Handa , Luiz Augusto von Dentz , Sasha Levin Subject: [PATCH 4.19 183/229] Bluetooth: L2CAP: initialize delayed works at l2cap_chan_create() Date: Mon, 24 Oct 2022 13:31:42 +0200 Message-Id: <20221024113005.022499824@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747574233742269220?= X-GMAIL-MSGID: =?utf-8?q?1747574233742269220?= From: Tetsuo Handa [ Upstream commit 2d2cb3066f2c90cd8ca540b36ba7a55e7f2406e0 ] syzbot is reporting cancel_delayed_work() without INIT_DELAYED_WORK() at l2cap_chan_del() [1], for CONF_NOT_COMPLETE flag (which meant to prevent l2cap_chan_del() from calling cancel_delayed_work()) is cleared by timer which fires before l2cap_chan_del() is called by closing file descriptor created by socket(AF_BLUETOOTH, SOCK_STREAM, BTPROTO_L2CAP). l2cap_bredr_sig_cmd(L2CAP_CONF_REQ) and l2cap_bredr_sig_cmd(L2CAP_CONF_RSP) are calling l2cap_ertm_init(chan), and they call l2cap_chan_ready() (which clears CONF_NOT_COMPLETE flag) only when l2cap_ertm_init(chan) succeeded. l2cap_sock_init() does not call l2cap_ertm_init(chan), and it instead sets CONF_NOT_COMPLETE flag by calling l2cap_chan_set_defaults(). However, when connect() is requested, "command 0x0409 tx timeout" happens after 2 seconds from connect() request, and CONF_NOT_COMPLETE flag is cleared after 4 seconds from connect() request, for l2cap_conn_start() from l2cap_info_timeout() callback scheduled by schedule_delayed_work(&conn->info_timer, L2CAP_INFO_TIMEOUT); in l2cap_connect() is calling l2cap_chan_ready(). Fix this problem by initializing delayed works used by L2CAP_MODE_ERTM mode as soon as l2cap_chan_create() allocates a channel, like I did in commit be8597239379f0f5 ("Bluetooth: initialize skb_queue_head at l2cap_chan_create()"). Link: https://syzkaller.appspot.com/bug?extid=83672956c7aa6af698b3 [1] Reported-by: syzbot Signed-off-by: Tetsuo Handa Signed-off-by: Luiz Augusto von Dentz Signed-off-by: Sasha Levin --- net/bluetooth/l2cap_core.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c index 65d20bdff023..7c280fcdcaa0 100644 --- a/net/bluetooth/l2cap_core.c +++ b/net/bluetooth/l2cap_core.c @@ -63,6 +63,9 @@ static void l2cap_send_disconn_req(struct l2cap_chan *chan, int err); static void l2cap_tx(struct l2cap_chan *chan, struct l2cap_ctrl *control, struct sk_buff_head *skbs, u8 event); +static void l2cap_retrans_timeout(struct work_struct *work); +static void l2cap_monitor_timeout(struct work_struct *work); +static void l2cap_ack_timeout(struct work_struct *work); static inline u8 bdaddr_type(u8 link_type, u8 bdaddr_type) { @@ -470,6 +473,9 @@ struct l2cap_chan *l2cap_chan_create(void) write_unlock(&chan_list_lock); INIT_DELAYED_WORK(&chan->chan_timer, l2cap_chan_timeout); + INIT_DELAYED_WORK(&chan->retrans_timer, l2cap_retrans_timeout); + INIT_DELAYED_WORK(&chan->monitor_timer, l2cap_monitor_timeout); + INIT_DELAYED_WORK(&chan->ack_timer, l2cap_ack_timeout); chan->state = BT_OPEN; @@ -3154,10 +3160,6 @@ int l2cap_ertm_init(struct l2cap_chan *chan) chan->rx_state = L2CAP_RX_STATE_RECV; chan->tx_state = L2CAP_TX_STATE_XMIT; - INIT_DELAYED_WORK(&chan->retrans_timer, l2cap_retrans_timeout); - INIT_DELAYED_WORK(&chan->monitor_timer, l2cap_monitor_timeout); - INIT_DELAYED_WORK(&chan->ack_timer, l2cap_ack_timeout); - skb_queue_head_init(&chan->srej_q); err = l2cap_seq_list_init(&chan->srej_list, chan->tx_win); From patchwork Mon Oct 24 11:31:43 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8804 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp430915wru; Mon, 24 Oct 2022 05:42:31 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7ZQWTdqI1L0EfUDFmdyu6b65gpi7V9fglCH3cHPpqJxl4euw8PI9s2Nnuc5OX2ZcQl58df X-Received: by 2002:a17:902:c948:b0:186:7baa:10ef with SMTP id i8-20020a170902c94800b001867baa10efmr16251188pla.73.1666615351662; Mon, 24 Oct 2022 05:42:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666615351; cv=none; d=google.com; s=arc-20160816; b=f5S1NMBaHPpBCoa014xbTQuyCDXxAy5ZRwkY1J/pVs5wZA91eACPcC9Yp768Iz/6Aj 3nTXU92X/+DkoQPC4hoOE5KGP2+brhxKEVAKUL89l6GM4nh4du2sCYR0wx8/fC0CrmAb eujvwO7bI0GUwQQr3dh3ZseZ8z5WlrxQrw0vR9L/YNvyKwrr55BC384IPAjbUqa+K5eH TraLl7S8cdqfblwEGLqCEf0VZjfyeDF3xnrpYX/bDZOtknzN69QIqVa8X60TyAw8FxuN 34z2n1zHdnwIrWXb6t7GPolaVZMfgnGM8c4GBipiogGuHT0vbwlE4oiuNQyxny2M5cFK QU3A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=GyxGt+SWXQTAwYz4R+BoKPDTe7QaEX+DSk21RVUtlkc=; b=PUPISzhtSLTWYLK2d7zEMqxyUqZ74cbHN2LaM6vVgCHbxxep8z7wJjGc4XCtz5vOCe hJ4keHiePQXSnpwm+7x3dXJP/ql5ol+F5Np6+PNbhdcEAkPAh1yC20eygFN+yuRcoAhz HOfqEtPgtZrXn3ZD/o/E0u8rIgvazTEMujMW9zudaUDpfc7y3USLZ6sm4Fs7ujIPL4eB 5IfU8AZgQ1Ex4KISiAkzPkPOo8ti0+BdQE3qNhvMcsJlotgHA/A9QX/Obc0VdGH3Ux9z KUVXkbe6CcKyE1N4wK0DOo4/VQHbk/2H0mFzDU+p9/lFWnt7c6o34VmUPhVwmvfXXAth HARw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=WTfOdAAa; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 192-20020a6301c9000000b0044bf53e335dsi34393151pgb.767.2022.10.24.05.42.18; Mon, 24 Oct 2022 05:42:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=WTfOdAAa; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234327AbiJXMeu (ORCPT + 99 others); Mon, 24 Oct 2022 08:34:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45122 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234208AbiJXM3j (ORCPT ); Mon, 24 Oct 2022 08:29:39 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EFE7E895F1; Mon, 24 Oct 2022 05:03:47 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 292156128E; Mon, 24 Oct 2022 12:02:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3C5ECC433C1; Mon, 24 Oct 2022 12:02:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612977; bh=/BleCwNH4q+MxKT7DR0P99zio7f8ZwEn9aOrqdQJuJE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WTfOdAAaGCLlIr9/cNzTuzQ8Bu5P/PDG9zXMUQ9wgFBPyN44EkkQWFW2Yz5JJ7gt5 19gtG9ILGeQgO/VW162ETjoqrtwHXhnyvPvQSB7BAwgw+Hc2zIxdZSjP34KocCFlqI LA4kll60HcF5cytvOscFqUQuS3sL2nMOyDWy5KIU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Luiz Augusto von Dentz , Hawkins Jiawei , Sasha Levin Subject: [PATCH 4.19 184/229] Bluetooth: hci_sysfs: Fix attempting to call device_add multiple times Date: Mon, 24 Oct 2022 13:31:43 +0200 Message-Id: <20221024113005.052777577@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747572858899974938?= X-GMAIL-MSGID: =?utf-8?q?1747572858899974938?= From: Luiz Augusto von Dentz [ Upstream commit 448a496f760664d3e2e79466aa1787e6abc922b5 ] device_add shall not be called multiple times as stated in its documentation: 'Do not call this routine or device_register() more than once for any device structure' Syzkaller reports a bug as follows [1]: ------------[ cut here ]------------ kernel BUG at lib/list_debug.c:33! invalid opcode: 0000 [#1] PREEMPT SMP KASAN [...] Call Trace: __list_add include/linux/list.h:69 [inline] list_add_tail include/linux/list.h:102 [inline] kobj_kset_join lib/kobject.c:164 [inline] kobject_add_internal+0x18f/0x8f0 lib/kobject.c:214 kobject_add_varg lib/kobject.c:358 [inline] kobject_add+0x150/0x1c0 lib/kobject.c:410 device_add+0x368/0x1e90 drivers/base/core.c:3452 hci_conn_add_sysfs+0x9b/0x1b0 net/bluetooth/hci_sysfs.c:53 hci_le_cis_estabilished_evt+0x57c/0xae0 net/bluetooth/hci_event.c:6799 hci_le_meta_evt+0x2b8/0x510 net/bluetooth/hci_event.c:7110 hci_event_func net/bluetooth/hci_event.c:7440 [inline] hci_event_packet+0x63d/0xfd0 net/bluetooth/hci_event.c:7495 hci_rx_work+0xae7/0x1230 net/bluetooth/hci_core.c:4007 process_one_work+0x991/0x1610 kernel/workqueue.c:2289 worker_thread+0x665/0x1080 kernel/workqueue.c:2436 kthread+0x2e4/0x3a0 kernel/kthread.c:376 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:306 Link: https://syzkaller.appspot.com/bug?id=da3246e2d33afdb92d66bc166a0934c5b146404a Signed-off-by: Luiz Augusto von Dentz Tested-by: Hawkins Jiawei Signed-off-by: Sasha Levin --- net/bluetooth/hci_sysfs.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/net/bluetooth/hci_sysfs.c b/net/bluetooth/hci_sysfs.c index b69d88b88d2e..ccd2c377bf83 100644 --- a/net/bluetooth/hci_sysfs.c +++ b/net/bluetooth/hci_sysfs.c @@ -48,6 +48,9 @@ void hci_conn_add_sysfs(struct hci_conn *conn) BT_DBG("conn %p", conn); + if (device_is_registered(&conn->dev)) + return; + dev_set_name(&conn->dev, "%s:%d", hdev->name, conn->handle); if (device_add(&conn->dev) < 0) { From patchwork Mon Oct 24 11:31:44 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8859 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp433063wru; Mon, 24 Oct 2022 05:48:30 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7GO+eMjhTsL/aK/8A06aC/QHGLzlff2qX8nn3Ck595tREBbK+YiKGyWYu/quPkdshsVXKI X-Received: by 2002:aa7:985a:0:b0:566:5057:3ff3 with SMTP id n26-20020aa7985a000000b0056650573ff3mr33757425pfq.55.1666615710422; Mon, 24 Oct 2022 05:48:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666615710; cv=none; d=google.com; s=arc-20160816; b=rR+jm81s2HCtINX1zxuEqPCLn+m70UV2AnNKsSV7FIYtg21CKv4PynedHr02kjylAq 14f2MAa512ayQgyvC3evDacyV0uGMpo9LmSD5u5rN+bMrCSYG9W/q2Dh3Rd95OWFFiCv HvAIOiyvSxBqZHXkI96DdAVUkpIUS9QlmIxxzJeeGDfbVrNbb/7r9AraVtndXnikgJH/ 9l0Z18XJ/fYtA/YgH2h1XizUgQLa1tb9u7bU8Br9fSDHC3+jicstZqwO5FrMW2kYAYcn rGjBw+LhyjsKsxNvW2+pppXmT3vF+FljnoFIVXnrGO8tjHmU9C9Pt1TLzvokZ7k8N7bb CEQA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=PjSCLg5zsHyXPlnuRsaTGxznV2I2PlM89V5YYg/7h4Y=; b=RpIeEEf+Z4Ls0cKwzxwVVVbOEW/S7Bt5eC/XS1oR5GW3l3QTYPapUKo19/SJmaGBA5 YKWjWls/hC3d7mlULhF5nqnX8wAkzm4rj7TxtrFoR8DVXo4ekjCodZqXzT6Ips3TWgtB 32iNDvt3Uz8J9hbt7WDrynuJq18m+x32kf1LPrNt/Z9TqnQ577M/T6/ctyYa/ifctBNA oCZ2VzlIOCWvMHyDBnKu49RloNHTiIZqFEBl3i1meMXXX2n3rjWWGFHYF8T8fSEGLzY5 JCel6jVyx6cmhMTW8PrswWUUWFHPEs1o1N1yYw9YF7Rzp42GNp4uw+Zc9NBGJXgOvjOa coBw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=q9nKZmr1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n23-20020a635917000000b0045f0757ead9si36560335pgb.727.2022.10.24.05.48.13; Mon, 24 Oct 2022 05:48:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=q9nKZmr1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231244AbiJXMkp (ORCPT + 99 others); Mon, 24 Oct 2022 08:40:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45684 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232012AbiJXMgq (ORCPT ); Mon, 24 Oct 2022 08:36:46 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C3D288982C; Mon, 24 Oct 2022 05:06:10 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id CEB98B811C0; Mon, 24 Oct 2022 12:03:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 39967C433D6; Mon, 24 Oct 2022 12:03:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613006; bh=Kzis1vLhezwehNxVB+MAMkeHuzcWMxACM/LeTgmHF4I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=q9nKZmr1BlrXFhLC9us8I+JsMl31x0b8DGn5b46wnRnOAYQbLvGFU50Q6/lzf+aq0 tobXf4lRVCvmNPGjz0XErnezM9BeHe+kAxL8zqA6jdSn2M1OEzXWvKtpUncIBPSxtU s51SksCwiw1PfjnAsLgEJ7RViKU0/imN6O7+2HKA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Marc Kleine-Budde , Oliver Hartkopp , Ziyang Xuan , Sasha Levin Subject: [PATCH 4.19 185/229] can: bcm: check the result of can_send() in bcm_can_tx() Date: Mon, 24 Oct 2022 13:31:44 +0200 Message-Id: <20221024113005.097019844@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747573235019506115?= X-GMAIL-MSGID: =?utf-8?q?1747573235019506115?= From: Ziyang Xuan [ Upstream commit 3fd7bfd28cfd68ae80a2fe92ea1615722cc2ee6e ] If can_send() fail, it should not update frames_abs counter in bcm_can_tx(). Add the result check for can_send() in bcm_can_tx(). Suggested-by: Marc Kleine-Budde Suggested-by: Oliver Hartkopp Signed-off-by: Ziyang Xuan Link: https://lore.kernel.org/all/9851878e74d6d37aee2f1ee76d68361a46f89458.1663206163.git.william.xuanziyang@huawei.com Acked-by: Oliver Hartkopp Signed-off-by: Marc Kleine-Budde Signed-off-by: Sasha Levin --- net/can/bcm.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/net/can/bcm.c b/net/can/bcm.c index 3c825b158fb5..74e555a22de7 100644 --- a/net/can/bcm.c +++ b/net/can/bcm.c @@ -273,6 +273,7 @@ static void bcm_can_tx(struct bcm_op *op) struct sk_buff *skb; struct net_device *dev; struct canfd_frame *cf = op->frames + op->cfsiz * op->currframe; + int err; /* no target device? => exit */ if (!op->ifindex) @@ -297,11 +298,11 @@ static void bcm_can_tx(struct bcm_op *op) /* send with loopback */ skb->dev = dev; can_skb_set_owner(skb, op->sk); - can_send(skb, 1); + err = can_send(skb, 1); + if (!err) + op->frames_abs++; - /* update statistics */ op->currframe++; - op->frames_abs++; /* reached last frame? */ if (op->currframe >= op->nframes) From patchwork Mon Oct 24 11:31:45 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9738 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp548566wru; Mon, 24 Oct 2022 09:41:52 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5oXLm+2EYopx3CVUqCMIE/axPB/zz8XJdBIQPwSj4BWpNd/KzMk5wMxnrCt+LC5y32fa5B X-Received: by 2002:a05:6a00:1943:b0:563:8173:b46a with SMTP id s3-20020a056a00194300b005638173b46amr33573531pfk.34.1666629712486; Mon, 24 Oct 2022 09:41:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666629712; cv=none; d=google.com; s=arc-20160816; b=OM6Yr4DydEgMJ5TEBhuTwNyQVL38sHXTMaqq7VzTr5HVasTwFthYdOI8Q4EkW4FppV vNAk6VL1615ngo19IRVgAK7oh+qXFfbR38KoCscj8ltO4rRL3XDWFJDI83QIGcAIF2CZ t0RFpDfL38uoLFaFY3EJExi/yr4q9eFdsYQ5/9FKqjGTrbctDFqnc2OcxLp0zy5sv7Sv gcT8K4KtDfAdPctlp8KaWR+5kIoGa+Nlk802ukQmZFfNVd7jvhFj9pZBz2L+IQLrc9F7 TtesnI6M4rZmdz97BSs0s1nKODM77Epyyg8H0xJJc8MdZoKwR+lgaM3Fzve0YdPFNYO7 bNvA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=0YcRAtOdJiq5FB+FFdzLMfsEplQVbzXXrJMUjfL66kk=; b=thKUljMVjlX55f4hol9CVSn3Fnw6oHx9YQQ12BRT94WXipf2q/e2C2wG7DXM0ZkURr PpeN8NdIA3rMxterAwmwkLPu/QieCdCvIw6ecSJ1Fp2GFpH6E9iiebHg4CquEKDAOPsN SjfQ78Y5+XYE5SEJfjvtddd/VBGGmZTlTIMnWEkvz2pTMDdhD4rrK3brjMHRdWsf/uiI wgdXy7VJiDZTFJEkB+fbYyU+JSo2IC1khG6Pyp95X2i8e5EoLzBqeHynBebiwUOTbqUi 8+FXxycObHW9DgINLwm9Fs1YRHN2ReRgoWF6TKkyccXjnvzT+v2mB4yy5Ex2N6KfT+Om cF5g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=YniwDv0p; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g1-20020a635641000000b0042b57d7bc14si34490693pgm.763.2022.10.24.09.41.39; Mon, 24 Oct 2022 09:41:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=YniwDv0p; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234419AbiJXQks (ORCPT + 99 others); Mon, 24 Oct 2022 12:40:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33682 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234398AbiJXQkS (ORCPT ); Mon, 24 Oct 2022 12:40:18 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EDE9BDD8B8; Mon, 24 Oct 2022 08:27:28 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 97C08B811D2; Mon, 24 Oct 2022 12:03:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 014ABC433D6; Mon, 24 Oct 2022 12:03:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613035; bh=9bBZYAXceArHwz/IrqPMXLuYHRvA+j2qC4KJRN/Ft08=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YniwDv0pKXw8lluU6IS0VHOf0HVRrw85YYRlv4MoU/AuVx523rDfnp3P806tKN0a2 eQLJKnkSXkL7FY+N3sFvB0tQWNsg/hg9LkrO7nAuumvyIw5c3uC2UZM+4Jwc2oJcgl Di/qdZWIpB6UBWr0OkwrOmBBNMQTrIV2aMeOhnWI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Serge Vasilugin , Daniel Golle , Kalle Valo , Sasha Levin Subject: [PATCH 4.19 186/229] wifi: rt2x00: dont run Rt5592 IQ calibration on MT7620 Date: Mon, 24 Oct 2022 13:31:45 +0200 Message-Id: <20221024113005.132248780@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747587917473086856?= X-GMAIL-MSGID: =?utf-8?q?1747587917473086856?= From: Daniel Golle [ Upstream commit d3aad83d05aec0cfd7670cf0028f2ad4b81de92e ] The function rt2800_iq_calibrate is intended for Rt5592 only. Don't call it for MT7620 which has it's own calibration functions. Reported-by: Serge Vasilugin Signed-off-by: Daniel Golle Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/31a1c34ddbd296b82f38c18c9ae7339059215fdc.1663445157.git.daniel@makrotopia.org Signed-off-by: Sasha Levin --- drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c index a567bc273ffc..2a119f314c38 100644 --- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c +++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c @@ -3838,7 +3838,8 @@ static void rt2800_config_channel(struct rt2x00_dev *rt2x00dev, reg += 2 * rt2x00dev->lna_gain; rt2800_bbp_write_with_rx_chain(rt2x00dev, 66, reg); - rt2800_iq_calibrate(rt2x00dev, rf->channel); + if (rt2x00_rt(rt2x00dev, RT5592)) + rt2800_iq_calibrate(rt2x00dev, rf->channel); } bbp = rt2800_bbp_read(rt2x00dev, 4); From patchwork Mon Oct 24 11:31:46 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9237 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp461132wru; Mon, 24 Oct 2022 06:43:13 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6UJocFX73P129Vm82RlWM59Czi6CoJC0NeB8A8h4N7MuDPhbD8c2NCg+10c1QY806viPxD X-Received: by 2002:a05:6402:31f4:b0:461:604d:2607 with SMTP id dy20-20020a05640231f400b00461604d2607mr14446463edb.330.1666618993050; Mon, 24 Oct 2022 06:43:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666618993; cv=none; d=google.com; s=arc-20160816; b=aujXhB4VqTxcUjMb/hO/7kdlyK03+qS2n1AuMizHqZDtm59m1VsbrYqx3Ed5TMSqxu H+iYHN3yGdFBhupp27HN+5KKwttr8zYRnJ3jeKEgvZSK/JT5xom6yHc1XdQz7mdculIe YA1nZzMFNvxkZh21mj/LjTF3ql7M7iNJQvWVqux9l+L6I2VTvPti1jad4gaCLaGd3Fqh qg0apkFA702SkWwVsqxcOEkWzR4J/ANhmbeqLlzzbIyJ0cEU1D8QWiBrV+vF0tLK6mLu Wo9J37R/grMmL2yAcJ/xuXB2BF8DRZPSMIdkyBfGuRoFFxzmhSKwwOgB3CODpNV1tONT czVA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=wHlhdyYwxmvNJdbjqJ11ec+WRxqR2YRW/5tGs9Ks3K4=; b=JCkWIRUjSCBVH+Ms+sAPR3+B5uGRFEETNqdtfhX5ukpQxcuc4N9sYG+VRqDdrvP6c7 ekUTsgkHVc2PHCb/+kPaHXBQi2nsKC+6riqA3jsAszVZRP1Dbd0HSo722rYtf+AzbGQG z1pUDvI8c26J/tBU6aoYQP0ou1Xd0ADkPeA987CGljm7cfyyTUbh+kt4cJ/mlB5f4c6f Xsn94o1XsNJDhgJW7C0rIxG3+74fLeoR7sU+ndMvRd+ZQAuLSsaXt0jt7fb8yAGspmMv p42+TBhjRYzdtegc8sTpb3YkuH2KvNvksYTKxgN6AYnL2KighiUcpTng4TXKIXOMxjk3 FRow== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=FKUqHlPD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x2-20020a05640225c200b0045928479b71si27432609edb.405.2022.10.24.06.42.45; Mon, 24 Oct 2022 06:43:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=FKUqHlPD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233199AbiJXNgU (ORCPT + 99 others); Mon, 24 Oct 2022 09:36:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43792 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236401AbiJXNa7 (ORCPT ); Mon, 24 Oct 2022 09:30:59 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 46895ACA15; Mon, 24 Oct 2022 05:33:26 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 4DDB5B811A3; Mon, 24 Oct 2022 12:04:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9FEE7C433D6; Mon, 24 Oct 2022 12:04:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613046; bh=aEG1Q87LEw/VLXcyOS6H+7+xQgq198aUjuI9fqs0HMo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FKUqHlPDaKGiwFOIGk+cGwiGhpV+v6QHLRpSHs/zOUBKxuM8ISublCfNd1f+9MT8+ wnDR7/OX8YGLi8Aty0uE7aaJlE4KrxIYFCIme2D1iof+/Iekoh37PUHmyxPyfFO/7m L4huEijVGIAORF6P92TWxZ/eMAkmX+NcSVlD4saA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Serge Vasilugin , Daniel Golle , Stanislaw Gruszka , Kalle Valo , Sasha Levin Subject: [PATCH 4.19 187/229] wifi: rt2x00: set correct TX_SW_CFG1 MAC register for MT7620 Date: Mon, 24 Oct 2022 13:31:46 +0200 Message-Id: <20221024113005.161656239@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747576676936194400?= X-GMAIL-MSGID: =?utf-8?q?1747576676936194400?= From: Daniel Golle [ Upstream commit eeb50acf15762b61921f9df18663f839f387c054 ] Set correct TX_SW_CFG1 MAC register as it is done also in v3 of the vendor driver[1]. [1]: https://gitlab.com/dm38/padavan-ng/-/blob/master/trunk/proprietary/rt_wifi/rtpci/3.0.X.X/mt76x2/chips/rt6352.c#L531 Reported-by: Serge Vasilugin Signed-off-by: Daniel Golle Acked-by: Stanislaw Gruszka Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/4be38975ce600a34249e12d09a3cb758c6e71071.1663445157.git.daniel@makrotopia.org Signed-off-by: Sasha Levin --- drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c index 2a119f314c38..b8224b215532 100644 --- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c +++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c @@ -5318,7 +5318,7 @@ static int rt2800_init_registers(struct rt2x00_dev *rt2x00dev) rt2800_register_write(rt2x00dev, TX_SW_CFG0, 0x00000404); } else if (rt2x00_rt(rt2x00dev, RT6352)) { rt2800_register_write(rt2x00dev, TX_SW_CFG0, 0x00000401); - rt2800_register_write(rt2x00dev, TX_SW_CFG1, 0x000C0000); + rt2800_register_write(rt2x00dev, TX_SW_CFG1, 0x000C0001); rt2800_register_write(rt2x00dev, TX_SW_CFG2, 0x00000000); rt2800_register_write(rt2x00dev, MIMO_PS_CFG, 0x00000002); rt2800_register_write(rt2x00dev, TX_PIN_CFG, 0x00150F0F); From patchwork Mon Oct 24 11:31:47 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 10333 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp669813wru; Mon, 24 Oct 2022 14:58:32 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4BwORE+K1X8uv0OktHocQ/7WEybKuOvTqkUj8D2TU/GzSlrEARb3GW5QbJmR1JvBOq+vx7 X-Received: by 2002:a17:907:2e0d:b0:78e:1d21:8001 with SMTP id ig13-20020a1709072e0d00b0078e1d218001mr28887202ejc.246.1666648712316; Mon, 24 Oct 2022 14:58:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666648712; cv=none; d=google.com; s=arc-20160816; b=kVrefv/oQ5msh8UTZJikyFWCyUOnxiXVuq8ECKurzQf+XFkGyttt+apPbFYznZ4t18 7JFsO2ZliKzDezBcTQNtymWmCZljt9ZUUO63EX7BINZt4egrugir9i47QvU02aA1cWKb VC6JjRYDH4vs3YBW3wsyHaVntr6AXAUJ4sawJ+YmbcRATOJYO09BfE1e89/aPDgvkj9l zocdp8h8J+/bFyeCYqYn43yAEBuWzzdnTmI3twQ7pyFfsUnS6Xuji4Fty5MEGrZZV+gL 6iPykbdk22SkLvAQr927wUnJDXiJsFu7lZb6Ezs+JkeJUOzw6J6cGp+fxHBKPgLReNKA FJsw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=YGU5yDuv6+inuh5cOAOae0EGbAF3j18A6bfz+rfRZ8o=; b=N5Od4IWE7dkMw9F+jv1hCxHDjwY7tS813ElzaDeQgbfx+WOjMxI0VrZtz5kn6LKxsS I2Exo+MGat0zX3VfHV5qmpxCLUvZ0Q3D8YHIbXIYEhdCdNyoMFExXn4+Q2FS5yrvnF4e 4aJt8nCV4UPDqJJm1QvsN71w0Rd/48RWpk3m0HIvpTspSJx073WdwdNSmnQEZ/QXwna4 dGAgClKaqN9j0mzZEcASx9CSBnZNwbbXEDvNNKmhs25X1NNk3DJZgXzQn91b046+fD82 i9v2OLqMDepDZwVyXNnjWzebdxBRMJFxEWJOR7aBfCwX09F5u7sObpleDWEmDGmSEmSW xWyQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=SPytivKE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a11-20020a170906368b00b0073ce34d1a13si657195ejc.499.2022.10.24.14.58.08; Mon, 24 Oct 2022 14:58:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=SPytivKE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229968AbiJXVuq (ORCPT + 99 others); Mon, 24 Oct 2022 17:50:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58492 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230261AbiJXVuL (ORCPT ); Mon, 24 Oct 2022 17:50:11 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7AD4E2F047F; Mon, 24 Oct 2022 13:03:12 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id D8782B81195; Mon, 24 Oct 2022 12:04:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3A368C433D6; Mon, 24 Oct 2022 12:04:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613048; bh=sX2gRoFUhS/b17jy2aWNfgFBlBHg0RqVEUsQmHyGTCo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SPytivKEugRqvEK7xi2ZxXQVmKifOvxkJZki90iEdKWlKICYBLjNiGsx7+smHqlme G3PZuGKjBjJ5iBgCJwExI9+PdIPXDY+iO/cSz763ymH+pGIGXNhks6pbw9u2lZb6oW aU274iPqB/E0xhOuHec/fS3Onn4/4g35Pdo7qNEY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Serge Vasilugin , Daniel Golle , Stanislaw Gruszka , Kalle Valo , Sasha Levin Subject: [PATCH 4.19 188/229] wifi: rt2x00: set SoC wmac clock register Date: Mon, 24 Oct 2022 13:31:47 +0200 Message-Id: <20221024113005.200542027@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747607840273531914?= X-GMAIL-MSGID: =?utf-8?q?1747607840273531914?= From: Daniel Golle [ Upstream commit cbde6ed406a51092d9e8a2df058f5f8490f27443 ] Instead of using the default value 33 (pci), set US_CYC_CNT init based on Programming guide: If available, set chipset bus clock with fallback to cpu clock/3. Reported-by: Serge Vasilugin Signed-off-by: Daniel Golle Acked-by: Stanislaw Gruszka Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/3e275d259f476f597dab91a9c395015ef3fe3284.1663445157.git.daniel@makrotopia.org Signed-off-by: Sasha Levin --- .../net/wireless/ralink/rt2x00/rt2800lib.c | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c index b8224b215532..9469517ac65f 100644 --- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c +++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c @@ -5570,6 +5570,27 @@ static int rt2800_init_registers(struct rt2x00_dev *rt2x00dev) reg = rt2800_register_read(rt2x00dev, US_CYC_CNT); rt2x00_set_field32(®, US_CYC_CNT_CLOCK_CYCLE, 125); rt2800_register_write(rt2x00dev, US_CYC_CNT, reg); + } else if (rt2x00_is_soc(rt2x00dev)) { + struct clk *clk = clk_get_sys("bus", NULL); + int rate; + + if (IS_ERR(clk)) { + clk = clk_get_sys("cpu", NULL); + + if (IS_ERR(clk)) { + rate = 125; + } else { + rate = clk_get_rate(clk) / 3000000; + clk_put(clk); + } + } else { + rate = clk_get_rate(clk) / 1000000; + clk_put(clk); + } + + reg = rt2800_register_read(rt2x00dev, US_CYC_CNT); + rt2x00_set_field32(®, US_CYC_CNT_CLOCK_CYCLE, rate); + rt2800_register_write(rt2x00dev, US_CYC_CNT, reg); } reg = rt2800_register_read(rt2x00dev, HT_FBK_CFG0); From patchwork Mon Oct 24 11:31:48 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9089 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp445963wru; Mon, 24 Oct 2022 06:13:28 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6F4ysi7dx1XpdQiYgwyPylKqBot+2hbofnJ2ijcy98ccK6hl0FK1nj3LC/503l26YP13FP X-Received: by 2002:a17:90a:4d04:b0:212:ee1c:b0ec with SMTP id c4-20020a17090a4d0400b00212ee1cb0ecmr11836707pjg.66.1666617207767; Mon, 24 Oct 2022 06:13:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666617207; cv=none; d=google.com; s=arc-20160816; b=pI//ppLp87375XHqjjUwO3tFak0DGdn0empKRhnZv7LT4BVMKIneUVJQKsdptM3lGV Hin5RtECi91nzEEQ6bEn0QVTMIwKiJa1u9vb3O5wKc7O4fH6di4kUDMMFpiDK1yab2W2 pVCId5QLTN7bUHyx6rNdLFlPd2ESJJdjTi0O4wN+p7i9AU9eIWfZj8rVx7QTHdvWu1qA asGTNp8rGl4PK3wK5h/3/cvBo02qT66lPzWc95LDLd1fpT8FHsqIGlZ59Z59eSjfQaJp /1o4AnHT1X1PRzbOZyCC4FVMmAdjnQmkkwOSEH+2XJHsAbqr92iuI0wLO03IJHtMZ2Mw XpUw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=q1KR79493r5S5k1LJ0tkfqdzMaokbSs2JMK62GWSGGM=; b=wjzNFQXizytR6FC2ue7N8j+xVbtzGjVLhRV8WZu4ag7it46DDxJ6UyY3Rgr1dw1ObN KNwIFm2D0IX8lMxgwA6o37aXESUD4nYwMwcobLm5b16vjeLDUSw3wT78yJLY6IAvi6A4 qrMlaLO09KadwWXTooAyHxF/UvHaT0r7hTnIhxjNsFtJjTrLeSfesalJa/8BMaY1c+1F rY7DJsK9H5KJdeyj/lyRz17iWgncnPuPDkPm6WmvoS/3vClK4p2ldoCGvjcwQgcfk+re 3TIWvXjtwfqqRWU5GaC+4tIA1SxbGDxaWlbZpci6/FS88Ng1cWkgvjWJiq7ZOYs2SgOD o04g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=xduJRwtE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z6-20020a056a00240600b00562b0b92756si37914924pfh.297.2022.10.24.06.13.13; Mon, 24 Oct 2022 06:13:27 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=xduJRwtE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235425AbiJXNMn (ORCPT + 99 others); Mon, 24 Oct 2022 09:12:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41744 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235974AbiJXNKT (ORCPT ); Mon, 24 Oct 2022 09:10:19 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 66D0EA2236; Mon, 24 Oct 2022 05:23:57 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 83472B81202; Mon, 24 Oct 2022 12:04:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D12D3C433C1; Mon, 24 Oct 2022 12:04:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613051; bh=AV3dXYVdawBurlLUfKnkCxYe4h33AiN01pwO+9A7fS8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xduJRwtE6Bx9EW//ISZ4limVgRRRPkh/xg5L6rF/f8xPP4fCqKUpzy0JsJd9Tnr+Z Px+wtcKeRZYlDp2KJRTy8rnzY2bJNdVzedX55x6RghEf5CsCbrr73LtzW0TIPV2nEs VvnJ+W3Oe+4bIgWvl6ltA/NXaoobo+bKR6kjXTh0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Serge Vasilugin , Daniel Golle , Stanislaw Gruszka , Kalle Valo , Sasha Levin Subject: [PATCH 4.19 189/229] wifi: rt2x00: correctly set BBP register 86 for MT7620 Date: Mon, 24 Oct 2022 13:31:48 +0200 Message-Id: <20221024113005.238941629@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747574805250691663?= X-GMAIL-MSGID: =?utf-8?q?1747574805250691663?= From: Daniel Golle [ Upstream commit c9aada64fe6493461127f1522d7e2f01792d2424 ] Instead of 0 set the correct value for BBP register 86 for MT7620. Reported-by: Serge Vasilugin Signed-off-by: Daniel Golle Acked-by: Stanislaw Gruszka Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/257267247ee4fa7ebc6a5d0c4948b3f8119c0d77.1663445157.git.daniel@makrotopia.org Signed-off-by: Sasha Levin --- drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c index 9469517ac65f..c9fa56b721b2 100644 --- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c +++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c @@ -3658,7 +3658,10 @@ static void rt2800_config_channel(struct rt2x00_dev *rt2x00dev, rt2800_bbp_write(rt2x00dev, 62, 0x37 - rt2x00dev->lna_gain); rt2800_bbp_write(rt2x00dev, 63, 0x37 - rt2x00dev->lna_gain); rt2800_bbp_write(rt2x00dev, 64, 0x37 - rt2x00dev->lna_gain); - rt2800_bbp_write(rt2x00dev, 86, 0); + if (rt2x00_rt(rt2x00dev, RT6352)) + rt2800_bbp_write(rt2x00dev, 86, 0x38); + else + rt2800_bbp_write(rt2x00dev, 86, 0); } if (rf->channel <= 14) { From patchwork Mon Oct 24 11:31:49 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8869 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp433187wru; Mon, 24 Oct 2022 05:48:46 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7ht9CrvKZUuC/vNu6f1RtTEHAuz9i+VteX9ihsTsab5XJlCnp1kT6kRwu6b9MhD/mbXhq/ X-Received: by 2002:a17:902:ce0c:b0:185:36ce:abb6 with SMTP id k12-20020a170902ce0c00b0018536ceabb6mr33809683plg.149.1666615726464; Mon, 24 Oct 2022 05:48:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666615726; cv=none; d=google.com; s=arc-20160816; b=Iy8SkiwhtVZL+a6JV84FzeTV4PGPHqmJVOHDJA5B3ikP0ta33+ExHd+3wzDDbqluxz EkiTwkssnGnLmKvxgsgihRp9Y4r4w5rs2aW2CAq4mY57GvynEJYgMBVtqBUJu6GQa5Mc amWpQV/TPBbSu7VpsjdXIeqyA0XWea+INfIyzfKn+EueLOIPW+t7N9+PBs6NaZ6AoAjw lqqEzw6/9MEcrzO5cd81biXOOjw0NUMG9FpuaRw2skFIJpMbelswFx0YNS9gbNXbZyHs NeZp2xrlWn2urkV/L1RlJsfHFQ9WiUoU8ST60unyrlHYNV7XYpjDcEDYOn+5VRJzL/BJ lQQw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=1Zh8dhpeWeOATpRx2nQ0fYcQapQzuALyrA9WF3k0Z8k=; b=wXW8GSb2tuwQWnlbkEv9VxgvyVeycER1FCYPpulTYZAXOvaHpLL5/e9Be9mKjCWtNF 2zFZ52pCiOepc7dwtaGoAOOU9vRK6GTXHFfrgz9QyFPpLz7SwM5LWhkad7c9F0wSs5oT PvDI0IqDEywVlCwpnoC+DFtIOWG+28o1chcOTqhnH/o5VZoGRsAD3MgJcTJIAVi6oIEQ nE4VMxqDfoQQcZ2rFDOksYwbFlr+Hcm/o4VkEGkKVjoCZEQmCqiipxg6GnTjsncxpmii AgYN8PEz0u1ZMWTay7TSqbsh/wJhs54dvlsKhdbFt0nGB0PKnKTW69VO+hOclABMjodM S+Pw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=SmAYl7lq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p13-20020a056a000b4d00b0056590018a63si38036577pfo.54.2022.10.24.05.48.31; Mon, 24 Oct 2022 05:48:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=SmAYl7lq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234101AbiJXMmD (ORCPT + 99 others); Mon, 24 Oct 2022 08:42:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44562 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234164AbiJXMjM (ORCPT ); Mon, 24 Oct 2022 08:39:12 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 51D6A8A1E3; Mon, 24 Oct 2022 05:06:50 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 5017D612A5; Mon, 24 Oct 2022 12:04:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 66156C433C1; Mon, 24 Oct 2022 12:04:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613053; bh=/uUdM+oKqHOU5RS8nYx4xunaSoAOYepM1eEAdpERTus=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SmAYl7lqRohZQeSovI7sAFKAWvUgdvLVj8Nx99mrF/o176k1KJjl5v3Gy1A4rJzfp zRpX4yXL5M6S/SgzZKquR2TsYbCk3eH+4Rdosn9Swi+XHReVrfi2yn0cE2oPVSJ0iX lIdjud49XIdCoZirW9agAFxwtXTyZ5OGjzGwiZww= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jakub Sitnicki , Liu Jian , Daniel Borkmann , John Fastabend , Eric Dumazet , Sasha Levin Subject: [PATCH 4.19 190/229] net: If sock is dead dont access socks sk_wq in sk_stream_wait_memory Date: Mon, 24 Oct 2022 13:31:49 +0200 Message-Id: <20221024113005.272954094@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747573252049107050?= X-GMAIL-MSGID: =?utf-8?q?1747573252049107050?= From: Liu Jian [ Upstream commit 3f8ef65af927db247418d4e1db49164d7a158fc5 ] Fixes the below NULL pointer dereference: [...] [ 14.471200] Call Trace: [ 14.471562] [ 14.471882] lock_acquire+0x245/0x2e0 [ 14.472416] ? remove_wait_queue+0x12/0x50 [ 14.473014] ? _raw_spin_lock_irqsave+0x17/0x50 [ 14.473681] _raw_spin_lock_irqsave+0x3d/0x50 [ 14.474318] ? remove_wait_queue+0x12/0x50 [ 14.474907] remove_wait_queue+0x12/0x50 [ 14.475480] sk_stream_wait_memory+0x20d/0x340 [ 14.476127] ? do_wait_intr_irq+0x80/0x80 [ 14.476704] do_tcp_sendpages+0x287/0x600 [ 14.477283] tcp_bpf_push+0xab/0x260 [ 14.477817] tcp_bpf_sendmsg_redir+0x297/0x500 [ 14.478461] ? __local_bh_enable_ip+0x77/0xe0 [ 14.479096] tcp_bpf_send_verdict+0x105/0x470 [ 14.479729] tcp_bpf_sendmsg+0x318/0x4f0 [ 14.480311] sock_sendmsg+0x2d/0x40 [ 14.480822] ____sys_sendmsg+0x1b4/0x1c0 [ 14.481390] ? copy_msghdr_from_user+0x62/0x80 [ 14.482048] ___sys_sendmsg+0x78/0xb0 [ 14.482580] ? vmf_insert_pfn_prot+0x91/0x150 [ 14.483215] ? __do_fault+0x2a/0x1a0 [ 14.483738] ? do_fault+0x15e/0x5d0 [ 14.484246] ? __handle_mm_fault+0x56b/0x1040 [ 14.484874] ? lock_is_held_type+0xdf/0x130 [ 14.485474] ? find_held_lock+0x2d/0x90 [ 14.486046] ? __sys_sendmsg+0x41/0x70 [ 14.486587] __sys_sendmsg+0x41/0x70 [ 14.487105] ? intel_pmu_drain_pebs_core+0x350/0x350 [ 14.487822] do_syscall_64+0x34/0x80 [ 14.488345] entry_SYSCALL_64_after_hwframe+0x63/0xcd [...] The test scenario has the following flow: thread1 thread2 ----------- --------------- tcp_bpf_sendmsg tcp_bpf_send_verdict tcp_bpf_sendmsg_redir sock_close tcp_bpf_push_locked __sock_release tcp_bpf_push //inet_release do_tcp_sendpages sock->ops->release sk_stream_wait_memory // tcp_close sk_wait_event sk->sk_prot->close release_sock(__sk); *** lock_sock(sk); __tcp_close sock_orphan(sk) sk->sk_wq = NULL release_sock **** lock_sock(__sk); remove_wait_queue(sk_sleep(sk), &wait); sk_sleep(sk) //NULL pointer dereference &rcu_dereference_raw(sk->sk_wq)->wait While waiting for memory in thread1, the socket is released with its wait queue because thread2 has closed it. This caused by tcp_bpf_send_verdict didn't increase the f_count of psock->sk_redir->sk_socket->file in thread1. We should check if SOCK_DEAD flag is set on wakeup in sk_stream_wait_memory before accessing the wait queue. Suggested-by: Jakub Sitnicki Signed-off-by: Liu Jian Signed-off-by: Daniel Borkmann Acked-by: John Fastabend Cc: Eric Dumazet Link: https://lore.kernel.org/bpf/20220823133755.314697-2-liujian56@huawei.com Signed-off-by: Sasha Levin --- net/core/stream.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/net/core/stream.c b/net/core/stream.c index 3d98774cf128..7b411a91a81c 100644 --- a/net/core/stream.c +++ b/net/core/stream.c @@ -159,7 +159,8 @@ int sk_stream_wait_memory(struct sock *sk, long *timeo_p) *timeo_p = current_timeo; } out: - remove_wait_queue(sk_sleep(sk), &wait); + if (!sock_flag(sk, SOCK_DEAD)) + remove_wait_queue(sk_sleep(sk), &wait); return err; do_error: From patchwork Mon Oct 24 11:31:50 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9222 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp459484wru; Mon, 24 Oct 2022 06:39:38 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7h0TguFcGcW8bOMuzzqNDgPPCLPi293K43FhjmbrWjNAhVm/Kruj/6S93SPzkCJt3hWhjV X-Received: by 2002:a17:907:6e28:b0:7a0:b6b5:5103 with SMTP id sd40-20020a1709076e2800b007a0b6b55103mr10749548ejc.300.1666618778552; Mon, 24 Oct 2022 06:39:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666618778; cv=none; d=google.com; s=arc-20160816; b=YPgUVZdVwYqcB+B7/9TIQOcnDZq4WO7aektbAG/hhyebnVBt/+W8VWtJx3Wh1CjqPZ d0rihWQzNIFXinaPrQVql/TvxUUZ243t3h7qJNtwEgZa+A+ITs2cyFvj8xl1lA0cifB0 VRAKFZ4VPk6vYbfXxs/XpYTLeJf/E9UbM9lmJD8r8/x8e8mrhUHtXDddx1jdk8udxCye BSmwfOxHszceQkGL2NNjBN5f+f8dmbQlwTGi+taGiUUaq6wFA5xVyHQoJVNmB0dABwHt Yl/Xd6/gF7VnywQszRxRBxstO/c6r4t97h0yQVolVvS7jEIO/+MmaRJCllTrYC2vl5fG 452g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=USoZ+RROFmS4qPmQKOmmdod7T6s9t9PLBxbslQ1cr9s=; b=kyUojFv0yJN3jux09/mRPWZB2BxsloA8cudxiawAupBMUsSmbuBGL1B2SX/le7s/sk bZVJv6nD0GHx3xARS5YQP/kEEs/T71hn5Fqk03vIIwhO1G9Bn2AS7g1eQZUl32HTxfLw YQ2me8mWrB8QN6w0mJ3Qx3Fx9ms9KGhLLcYWZMLDeYPqjnsNZSKy5DiAmLyxBQL9OZKP +HMuUoBBpvUfTtgQ8jrbXrY/oBcFXGoyz3+8IHTY5ZTL+ddij5EBLSZ+lVwoRrpVGCnz GYd9UJ7BKULrD3BORizXAAuqS2++9P06mZk0uwkYhCYNs05WYyvoUzkGUQsLHlZnnr3y aTNw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="pcQjuQ/u"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x11-20020a05640226cb00b0045d46f28533si28493018edd.377.2022.10.24.06.39.13; Mon, 24 Oct 2022 06:39:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="pcQjuQ/u"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235953AbiJXNeJ (ORCPT + 99 others); Mon, 24 Oct 2022 09:34:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42056 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236190AbiJXN35 (ORCPT ); Mon, 24 Oct 2022 09:29:57 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3FF2EAC4AC; Mon, 24 Oct 2022 05:33:17 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 9F3F7B811C1; Mon, 24 Oct 2022 12:04:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F145AC433D7; Mon, 24 Oct 2022 12:04:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613056; bh=QqpHLqiHJ8pQMZ2r9rm0Nz/ebpA/pgrtpSt7B2/lRsc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pcQjuQ/uDiZ+SmDlzrAHufTcvWDHFv/03JNe2rS6wMhbi6OhqSnxHV8DZp5K0/vNj Av9oj9WmjHb3VLmBvaHeBeuQvOOBOpRvpj+J3/yA8h+CQtF5YCRGfuUTtPQHjJL/4U ImPObQ8av9NTYmcyW3XECNmJSruO6ctoT3sCm3gQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Luiz Augusto von Dentz , Sungwoo Kim , Sasha Levin Subject: [PATCH 4.19 191/229] Bluetooth: L2CAP: Fix user-after-free Date: Mon, 24 Oct 2022 13:31:50 +0200 Message-Id: <20221024113005.308616466@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747576452142480851?= X-GMAIL-MSGID: =?utf-8?q?1747576452142480851?= From: Luiz Augusto von Dentz [ Upstream commit 35fcbc4243aad7e7d020b7c1dfb14bb888b20a4f ] This uses l2cap_chan_hold_unless_zero() after calling __l2cap_get_chan_blah() to prevent the following trace: Bluetooth: l2cap_core.c:static void l2cap_chan_destroy(struct kref *kref) Bluetooth: chan 0000000023c4974d Bluetooth: parent 00000000ae861c08 ================================================================== BUG: KASAN: use-after-free in __mutex_waiter_is_first kernel/locking/mutex.c:191 [inline] BUG: KASAN: use-after-free in __mutex_lock_common kernel/locking/mutex.c:671 [inline] BUG: KASAN: use-after-free in __mutex_lock+0x278/0x400 kernel/locking/mutex.c:729 Read of size 8 at addr ffff888006a49b08 by task kworker/u3:2/389 Link: https://lore.kernel.org/lkml/20220622082716.478486-1-lee.jones@linaro.org Signed-off-by: Luiz Augusto von Dentz Signed-off-by: Sungwoo Kim Signed-off-by: Sasha Levin --- net/bluetooth/l2cap_core.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c index 7c280fcdcaa0..5c965f7b1709 100644 --- a/net/bluetooth/l2cap_core.c +++ b/net/bluetooth/l2cap_core.c @@ -4049,6 +4049,12 @@ static int l2cap_connect_create_rsp(struct l2cap_conn *conn, } } + chan = l2cap_chan_hold_unless_zero(chan); + if (!chan) { + err = -EBADSLT; + goto unlock; + } + err = 0; l2cap_chan_lock(chan); @@ -4078,6 +4084,7 @@ static int l2cap_connect_create_rsp(struct l2cap_conn *conn, } l2cap_chan_unlock(chan); + l2cap_chan_put(chan); unlock: mutex_unlock(&conn->chan_lock); From patchwork Mon Oct 24 11:31:51 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8865 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp433146wru; Mon, 24 Oct 2022 05:48:40 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7TbsdMeuMuk/zVubngkJicKhHtubPPEjXBu6bqc+lUnxQX+nsSCQ0fuiQBHvmfUOm5Louk X-Received: by 2002:a17:90b:1e0c:b0:20f:bcbf:ab5 with SMTP id pg12-20020a17090b1e0c00b0020fbcbf0ab5mr36760906pjb.187.1666615720154; Mon, 24 Oct 2022 05:48:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666615720; cv=none; d=google.com; s=arc-20160816; b=CGKVAzOjVUUkdykBWdNT6ErPwJY0WAf4sLcIXZFIrBSIjgbRNMJg+NeQrtlwMW65G8 pYcZH/zq8GmG0tOhG7/etvKVz10xmYpMwUmvsrAmiqUGRFXbRaVj5lUoNRMnxQ24a3OK UFF0m9s4RZ2AzPUlb5j4LOg/IH7J46jqSW7rI4JyZwEpVmOc8u2D6Hx2uOhA8QbjJARw sHrKaGrkQ2MDFmlz4DP70FHvWi2dRKCSimAsjkVuD/jCdEpJe0ATjFcC9na+4D44ArHJ RePEAG3pjIlZ87HDzrqkRpXBx4LjxujAdw9dGfncXWZm3azXcqeKghN42osbNLjvKvFN so4Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=QwLT/N1paEeSYq1rnharI9SY2nL+19Ipz0YSxIedqyw=; b=TZdeWf1EYvtdKqo/pxnK4DjV08YLsgduyHlWtfw7B4HK28pgb849GKQ7HmTXkH2a1I S5EHrSVUkJPyPEgz8Cz+5ImFsKwv/Zjs/5RSYhI/7ltP6kbyN+Jk/zsTixvs2jWUCZJp Wgj7Nf92zSaFrUH3qlle5b28yFCVWdOQJynx4zQPDmKBQlWFOApEffL0Aop64HjMBSXG IJ5cDooe3cv6Di4iUla+EH/h0x3jhFtQBV0i/Hy/aLDh1eAU7/ruIiOv0nbCLKPXUJJ9 pCtnhjprRZRCPewZ78ohdL4L2sCM55joWbUwb0qeStSB3E6AnEV4EriiSsamiWijC1QR emYQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=XGa3WTS8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e8-20020a170902ef4800b00176b7e66c9asi34813011plx.155.2022.10.24.05.48.26; Mon, 24 Oct 2022 05:48:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=XGa3WTS8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234054AbiJXMlv (ORCPT + 99 others); Mon, 24 Oct 2022 08:41:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33418 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234097AbiJXMi7 (ORCPT ); Mon, 24 Oct 2022 08:38:59 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7557B8A6CE; Mon, 24 Oct 2022 05:06:55 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 7F90A61218; Mon, 24 Oct 2022 12:04:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 963EAC433D6; Mon, 24 Oct 2022 12:04:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613058; bh=tRZBHcgUkPFk6ogO1WZRmubxnpsxcFS9qgub1Py0cnc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XGa3WTS8YOhJ8J9OkRsXSjLpwo6EergmU+4K8YQ6RP9rzSa70ptZ3mg0u3p1/ypd8 rFxXGlnHUR9GWuVFTMSjxyQjgA275weBJ351B5jtFlsVmX6xSBPlgTxZZpMD3I50j6 7dvtBrKrt1C/ulpCyWcjm87A3qUAn9b8YN2Y1mLQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Andrew Gaul , Jakub Kicinski , Sasha Levin Subject: [PATCH 4.19 192/229] r8152: Rate limit overflow messages Date: Mon, 24 Oct 2022 13:31:51 +0200 Message-Id: <20221024113005.343223466@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747573245382126596?= X-GMAIL-MSGID: =?utf-8?q?1747573245382126596?= From: Andrew Gaul [ Upstream commit 93e2be344a7db169b7119de21ac1bf253b8c6907 ] My system shows almost 10 million of these messages over a 24-hour period which pollutes my logs. Signed-off-by: Andrew Gaul Link: https://lore.kernel.org/r/20221002034128.2026653-1-gaul@google.com Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin --- drivers/net/usb/r8152.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c index 4764e4f54cef..d5a74a71bf59 100644 --- a/drivers/net/usb/r8152.c +++ b/drivers/net/usb/r8152.c @@ -1386,7 +1386,9 @@ static void intr_callback(struct urb *urb) "Stop submitting intr, status %d\n", status); return; case -EOVERFLOW: - netif_info(tp, intr, tp->netdev, "intr status -EOVERFLOW\n"); + if (net_ratelimit()) + netif_info(tp, intr, tp->netdev, + "intr status -EOVERFLOW\n"); goto resubmit; /* -EPIPE: should clear the halt */ default: From patchwork Mon Oct 24 11:31:52 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8808 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp430946wru; Mon, 24 Oct 2022 05:42:35 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5UvSKfFkCl8RWUvjZCAAadaDZLgY/rzF7a8XC92xHUplk/MHTNHVlDJtWG+iMWbOwIOPUv X-Received: by 2002:a17:902:6b04:b0:181:5dc6:5348 with SMTP id o4-20020a1709026b0400b001815dc65348mr33308719plk.69.1666615354745; Mon, 24 Oct 2022 05:42:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666615354; cv=none; d=google.com; s=arc-20160816; b=XPnPm0M0jMyXXZC7J3hBk8Ytav6xmRgbAOspjpwRONQ0WfYc44v03FuA70u4M/jSus f1RK5lSuOYmC2qesfnoo6csFGu16m3CFDDPX0mbbLiSytRMSGVUnzmh/rmxbyKyCEgat /yVUsdaqq0oqWcDSTcmNEUXYCF8wjQlnDhXcaOhVODGZoOUpLYaHi5yAT+868RpoUQSI MPA7xrmrXBq1lic6Iryheu6BZIVCtNo41F27uakfjC/xMUw3g7+lSHqT5lirGywGSki9 InAGwwslY744AXfFORI5R0sVU/QdpsdVtluIKt7bl8OlgYL+exHrekL1d3rjkCIMtFmn 06BQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=D8phQkkkzlcOiymb7+gznCaX/n+tQLFWIpnaz5lCqK8=; b=bZNM23xyvAeeXPYD2XdxTRZM+x0ha/Rn9d3itH9LJ9n+7Fvg2fFDQKwMSZAh3CEv0d 987NhcL65saEZPa1jmhrYj4pMwEb9WX769SqZdZfPUOMdyufwq6qY0YQg5u9coXxgxf4 WHDtvAipQLkCMdJUnkMefd1VF4xiElH9cGHwAvkjJFj0+f+evD6xkMvvAMMsTwI7wOVN b4oBLUzF0TciDOIX9oRgt2rnbKV3NsIU2aRoQdY0+YbKL4NuUYxS8gcD78dC4eLpU5Li LzILfmvoAKpTH2sYfNJodNQy3Ur5Ks/td3TLCQ+CCfyccrm+omfwf/kS/qQvnweYxqLp 2m6w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Ieo7OnM5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x13-20020a65538d000000b0043c8ce98a69si38211952pgq.711.2022.10.24.05.42.21; Mon, 24 Oct 2022 05:42:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Ieo7OnM5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234586AbiJXMfa (ORCPT + 99 others); Mon, 24 Oct 2022 08:35:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51198 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234253AbiJXM3v (ORCPT ); Mon, 24 Oct 2022 08:29:51 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 41C6388DE2; Mon, 24 Oct 2022 05:03:48 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id C893E61254; Mon, 24 Oct 2022 12:03:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DC215C433C1; Mon, 24 Oct 2022 12:02:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612980; bh=n5ji/6Rvcj9gwglRBVe1y6EZQDOybbfeuTH2XpQ1AzA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ieo7OnM5vxPMFYRxU+LDs2kImRH7VWIxXYmLlC9prwHfbXbDlQQ6EfUSZSDoDngoK 1O6TPq0vIfkjWoDgtehX+7vpW/vGgaAB5aRVMwhFAxEMFhWRxR38pqhfQWkkY9USS/ rZft0JTE5pCR1gVudbRcQnHka/5MyiHGOaWgQnHI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Javier Martinez Canillas , Peter Robinson , Thomas Zimmermann , Sasha Levin Subject: [PATCH 4.19 193/229] drm: Use size_t type for len variable in drm_copy_field() Date: Mon, 24 Oct 2022 13:31:52 +0200 Message-Id: <20221024113005.372170248@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747572862124095866?= X-GMAIL-MSGID: =?utf-8?q?1747572862124095866?= From: Javier Martinez Canillas [ Upstream commit 94dc3471d1b2b58b3728558d0e3f264e9ce6ff59 ] The strlen() function returns a size_t which is an unsigned int on 32-bit arches and an unsigned long on 64-bit arches. But in the drm_copy_field() function, the strlen() return value is assigned to an 'int len' variable. Later, the len variable is passed as copy_from_user() third argument that is an unsigned long parameter as well. In theory, this can lead to an integer overflow via type conversion. Since the assignment happens to a signed int lvalue instead of a size_t lvalue. In practice though, that's unlikely since the values copied are set by DRM drivers and not controlled by userspace. But using a size_t for len is the correct thing to do anyways. Signed-off-by: Javier Martinez Canillas Tested-by: Peter Robinson Reviewed-by: Thomas Zimmermann Link: https://patchwork.freedesktop.org/patch/msgid/20220705100215.572498-2-javierm@redhat.com Signed-off-by: Sasha Levin --- drivers/gpu/drm/drm_ioctl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/drm_ioctl.c b/drivers/gpu/drm/drm_ioctl.c index babd7ebabfef..4fea6519510c 100644 --- a/drivers/gpu/drm/drm_ioctl.c +++ b/drivers/gpu/drm/drm_ioctl.c @@ -458,7 +458,7 @@ EXPORT_SYMBOL(drm_invalid_op); */ static int drm_copy_field(char __user *buf, size_t *buf_len, const char *value) { - int len; + size_t len; /* don't overflow userbuf */ len = strlen(value); From patchwork Mon Oct 24 11:31:53 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9790 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp554426wru; Mon, 24 Oct 2022 09:57:04 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4klcslp/U1gqBjHdKuK6udzqvXaGX/8jwR975kk/oDOVcrXuagKUHr37KKbkc5fInMgntq X-Received: by 2002:a17:907:720e:b0:78e:2b59:fdf1 with SMTP id dr14-20020a170907720e00b0078e2b59fdf1mr29441382ejc.659.1666630624459; Mon, 24 Oct 2022 09:57:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666630624; cv=none; d=google.com; s=arc-20160816; b=WJTe8NehIxJPnZ4lBdz033gxrFAtVtqzmreJVz7CL7hhOyWNPk3lTQgbsg3SFTlAiY 61DlnpM8w5WsSeQqxNKtDLhEVCrrVoELg+7ooMRZ4GnonByrTgtH0wCMcHHA/NtFCAIc yMXld8CnpaI6ZN5TgnMCI3AV/vGlgUtXy5ryQb4HibIBXPEbnRuU36zumghsdllXFpfh NhIzabhiFNL3sV38++/tRbcwCSuHXIUmPexUYYqNAUJ/09R85rXmjokGZQbn2650xd+F Pb5QpgkgytrAycJ8ttLrCB3zF5TO0pjvWv3rlS55bnT1KVSUL3TN0ngWTo8vDys+B4q2 bN6Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=K3QEmtD1ES+mwCYzYzifJV+W7+DhVFoPO5O3PJfiBKg=; b=aJ4eF9MbMOltHAgyy6LPqNeWzevFf4Pmt6sQMsKyqm5HxUuwyckWzk9X6/6gRCjSwI 3XuvQg7uVaS3O8NCy5+H7ETT+avNl1lY+tpbr0ypBnsl87glD9wkg5C041Am2Rh95mPe aBGL0bQE0GyW0SiInD3coVFPpblohlHN6EHEhNeVPrLVhRPCi4Rx0EceVc8DrQl+yvtz ACbMcpviYFjBfqK/kru4ZC5DFwxnmRnORGMD6RLZEyPZZL3P4HOtmdzr1YktRY57kBIk t8VJhCasOmRLaombVuJVpw9m9C6S//EHXZx1t6vY7fp/pA49PjEb6ApmSR5Uv80QtbMk BsHg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=IXzBPHLH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id nb15-20020a1709071c8f00b007413b206b16si194459ejc.843.2022.10.24.09.56.27; Mon, 24 Oct 2022 09:57:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=IXzBPHLH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233407AbiJXQvH (ORCPT + 99 others); Mon, 24 Oct 2022 12:51:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36304 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233678AbiJXQrk (ORCPT ); Mon, 24 Oct 2022 12:47:40 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F0C97169105; Mon, 24 Oct 2022 08:31:41 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 53450B811AC; Mon, 24 Oct 2022 12:03:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7F073C433C1; Mon, 24 Oct 2022 12:03:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612983; bh=uh4tAMinP/rEAHn+FCntp1011ta1Ubrk3F2gTJ+r6pA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IXzBPHLHUYY55FqLbPoS7M4LtnAmn6FdBV/mrB6QyrWWWyalFns247gwQ8u+GsWye kbOKcDTF8ayzSW5SZvfHwATSLTfo4a20DiR329OGC/CbY80nmbVg16LgjvRyn01+ZN CqlAC2sc7XXi3IFSb89ajz802j+9wiZzs2beP3Co= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Peter Robinson , Javier Martinez Canillas , Thomas Zimmermann , Sasha Levin Subject: [PATCH 4.19 194/229] drm: Prevent drm_copy_field() to attempt copying a NULL pointer Date: Mon, 24 Oct 2022 13:31:53 +0200 Message-Id: <20221024113005.400833863@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747588873571811425?= X-GMAIL-MSGID: =?utf-8?q?1747588873571811425?= From: Javier Martinez Canillas [ Upstream commit f6ee30407e883042482ad4ad30da5eaba47872ee ] There are some struct drm_driver fields that are required by drivers since drm_copy_field() attempts to copy them to user-space via DRM_IOCTL_VERSION. But it can be possible that a driver has a bug and did not set some of the fields, which leads to drm_copy_field() attempting to copy a NULL pointer: [ +10.395966] Unable to handle kernel access to user memory outside uaccess routines at virtual address 0000000000000000 [ +0.010955] Mem abort info: [ +0.002835] ESR = 0x0000000096000004 [ +0.003872] EC = 0x25: DABT (current EL), IL = 32 bits [ +0.005395] SET = 0, FnV = 0 [ +0.003113] EA = 0, S1PTW = 0 [ +0.003182] FSC = 0x04: level 0 translation fault [ +0.004964] Data abort info: [ +0.002919] ISV = 0, ISS = 0x00000004 [ +0.003886] CM = 0, WnR = 0 [ +0.003040] user pgtable: 4k pages, 48-bit VAs, pgdp=0000000115dad000 [ +0.006536] [0000000000000000] pgd=0000000000000000, p4d=0000000000000000 [ +0.006925] Internal error: Oops: 96000004 [#1] SMP ... [ +0.011113] pstate: 80400005 (Nzcv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--) [ +0.007061] pc : __pi_strlen+0x14/0x150 [ +0.003895] lr : drm_copy_field+0x30/0x1a4 [ +0.004156] sp : ffff8000094b3a50 [ +0.003355] x29: ffff8000094b3a50 x28: ffff8000094b3b70 x27: 0000000000000040 [ +0.007242] x26: ffff443743c2ba00 x25: 0000000000000000 x24: 0000000000000040 [ +0.007243] x23: ffff443743c2ba00 x22: ffff8000094b3b70 x21: 0000000000000000 [ +0.007241] x20: 0000000000000000 x19: ffff8000094b3b90 x18: 0000000000000000 [ +0.007241] x17: 0000000000000000 x16: 0000000000000000 x15: 0000aaab14b9af40 [ +0.007241] x14: 0000000000000000 x13: 0000000000000000 x12: 0000000000000000 [ +0.007239] x11: 0000000000000000 x10: 0000000000000000 x9 : ffffa524ad67d4d8 [ +0.007242] x8 : 0101010101010101 x7 : 7f7f7f7f7f7f7f7f x6 : 6c6e6263606e7141 [ +0.007239] x5 : 0000000000000000 x4 : 0000000000000000 x3 : 0000000000000000 [ +0.007241] x2 : 0000000000000000 x1 : ffff8000094b3b90 x0 : 0000000000000000 [ +0.007240] Call trace: [ +0.002475] __pi_strlen+0x14/0x150 [ +0.003537] drm_version+0x84/0xac [ +0.003448] drm_ioctl_kernel+0xa8/0x16c [ +0.003975] drm_ioctl+0x270/0x580 [ +0.003448] __arm64_sys_ioctl+0xb8/0xfc [ +0.003978] invoke_syscall+0x78/0x100 [ +0.003799] el0_svc_common.constprop.0+0x4c/0xf4 [ +0.004767] do_el0_svc+0x38/0x4c [ +0.003357] el0_svc+0x34/0x100 [ +0.003185] el0t_64_sync_handler+0x11c/0x150 [ +0.004418] el0t_64_sync+0x190/0x194 [ +0.003716] Code: 92402c04 b200c3e8 f13fc09f 5400088c (a9400c02) [ +0.006180] ---[ end trace 0000000000000000 ]--- Reported-by: Peter Robinson Signed-off-by: Javier Martinez Canillas Acked-by: Thomas Zimmermann Link: https://patchwork.freedesktop.org/patch/msgid/20220705100215.572498-3-javierm@redhat.com Signed-off-by: Sasha Levin --- drivers/gpu/drm/drm_ioctl.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/gpu/drm/drm_ioctl.c b/drivers/gpu/drm/drm_ioctl.c index 4fea6519510c..2651bfb763a4 100644 --- a/drivers/gpu/drm/drm_ioctl.c +++ b/drivers/gpu/drm/drm_ioctl.c @@ -460,6 +460,12 @@ static int drm_copy_field(char __user *buf, size_t *buf_len, const char *value) { size_t len; + /* don't attempt to copy a NULL pointer */ + if (WARN_ONCE(!value, "BUG: the value to copy was not set!")) { + *buf_len = 0; + return 0; + } + /* don't overflow userbuf */ len = strlen(value); if (len > *buf_len) From patchwork Mon Oct 24 11:31:54 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9830 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp555981wru; Mon, 24 Oct 2022 10:00:58 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4oRSJlSESDTw/fJYp16R4MPR1OJPPUssK5VC3BgphsUb9q+8BR3uZY/9ifrqljnMvXX+Y3 X-Received: by 2002:a62:6497:0:b0:56b:6889:7ed0 with SMTP id y145-20020a626497000000b0056b68897ed0mr16034546pfb.44.1666630858619; Mon, 24 Oct 2022 10:00:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666630858; cv=none; d=google.com; s=arc-20160816; b=D5aLZcM3Qq0vZtEIgUfCSy+jHflgDr+fsEKxRmExG2CDIYM72Lhn/svjASMWM5ZX7w Rf6J5FL1u9ZwhZdy7k0PyH0OsVKCZgfwH+jFHxv/sj2anFmKrZnckqjcoPSf18PMeQx2 j2vPL68+W5oYeVUMjFYEQAvOaA5fOW4qUiGRuK6sXzJm2fTw3qpd2eAGaunsSQR6Jk8E Gl+YUBZ9RWdxLDH5bXnSLgn0HJdB+4iE/XFhXm/7ILvyF9JjaoyeBRjP/yV7dY3gNyG6 0tDnBSmxORLywvAHdaLHKhP3gZtn7FLeC8CSYcC+QfBlZyKjbh4sUsOZvDqggFgTZ3l+ lqKA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=EOHZ/C2sGLzAOqAVEzTfcy1PhIkdX5F4TY+qivuWJig=; b=KHvQ8q1pkVHeCbyKIhhjWMf8IHV6ut5rjIl86RcQISe96P6+NPQZTr8q+NCusOhC8e 7Ex6FPqFNYRKEiSaQ/QHwGvyXFr2z/0otncKAW4cY9bBOK3ATBoidDXH8NC9iHXNTs6c 41RECE/xA4xOdPf5ABZ2dd8EUw2SlI6Yv2zrqTYk0nAVYtah+koX0jAmT8PP4GeViEqE 7oNB0+pq47eW/we0XD4xD1dPjO4CH1yc/UtNVYW9cuxIVxH2QsCyI5TC0EeR6asXUxEQ ba2TuEtoeQZyUWSWjwRaDS0o8+VTJ6lSgyR4YaUGX3HjsWK1XykWShZAFPnYlihw87kF xt0A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=cGWUC15k; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k4-20020a635a44000000b00454649777ddsi37055653pgm.601.2022.10.24.10.00.32; Mon, 24 Oct 2022 10:00:58 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=cGWUC15k; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234862AbiJXQx7 (ORCPT + 99 others); Mon, 24 Oct 2022 12:53:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33322 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235406AbiJXQtb (ORCPT ); Mon, 24 Oct 2022 12:49:31 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E39C717FD4A; Mon, 24 Oct 2022 08:32:47 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id E537AB811EC; Mon, 24 Oct 2022 12:03:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 469E9C433C1; Mon, 24 Oct 2022 12:03:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612985; bh=IqXIc2zb1gPqjZAiZAuDXqBufstMjobSxTTlD79UXjo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cGWUC15kFAwA7wcupt1PX4XhVR2VVQha1VQlYrYg0JhO7ZrDTCXM/iyRiRXbfjfqv WFJ4x/F1Tqd70b5DtS3ajEZJCvUDSpB8xazf/O8K3USWg/CYKGcm0KapzLiR6rRFpD JrZrGll04YsThrRoC48hCvh/EmaCxzkG0hhkItY4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, David Gow , Tales Aparecida , Alex Deucher , Sasha Levin Subject: [PATCH 4.19 195/229] drm/amd/display: fix overflow on MIN_I64 definition Date: Mon, 24 Oct 2022 13:31:54 +0200 Message-Id: <20221024113005.440623785@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747589119010105172?= X-GMAIL-MSGID: =?utf-8?q?1747589119010105172?= From: David Gow [ Upstream commit 6ae0632d17759852c07e2d1e0a31c728eb6ba246 ] The definition of MIN_I64 in bw_fixed.c can cause gcc to whinge about integer overflow, because it is treated as a positive value, which is then negated. The temporary positive value is not necessarily representable. This causes the following warning: ../drivers/gpu/drm/amd/amdgpu/../display/dc/dml/calcs/bw_fixed.c:30:19: warning: integer overflow in expression ‘-9223372036854775808’ of type ‘long long int’ results in ‘-9223372036854775808’ [-Woverflow] 30 | (int64_t)(-(1LL << 63)) | ^ Writing out (-MAX_I64 - 1) works instead. Signed-off-by: David Gow Signed-off-by: Tales Aparecida Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin --- drivers/gpu/drm/amd/display/dc/calcs/bw_fixed.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/amd/display/dc/calcs/bw_fixed.c b/drivers/gpu/drm/amd/display/dc/calcs/bw_fixed.c index 6ca288fb5fb9..2d46bc527b21 100644 --- a/drivers/gpu/drm/amd/display/dc/calcs/bw_fixed.c +++ b/drivers/gpu/drm/amd/display/dc/calcs/bw_fixed.c @@ -26,12 +26,12 @@ #include "bw_fixed.h" -#define MIN_I64 \ - (int64_t)(-(1LL << 63)) - #define MAX_I64 \ (int64_t)((1ULL << 63) - 1) +#define MIN_I64 \ + (-MAX_I64 - 1) + #define FRACTIONAL_PART_MASK \ ((1ULL << BW_FIXED_BITS_PER_FRACTIONAL_PART) - 1) From patchwork Mon Oct 24 11:31:55 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8847 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp432927wru; Mon, 24 Oct 2022 05:48:06 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6sWhfnOalPhvhcdLx1yRzG7wpgE2kMPwH5PgHoYX5JR9W2sCAOFFlNxB4a1hbizv788NAa X-Received: by 2002:a62:a512:0:b0:536:e2bd:e15e with SMTP id v18-20020a62a512000000b00536e2bde15emr33953450pfm.1.1666615686291; Mon, 24 Oct 2022 05:48:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666615686; cv=none; d=google.com; s=arc-20160816; b=xivbPkqMDNvpRINXJp0othknszqr74okOQvdOa1LcoXqPnwJSGOjSwZrVH9rMpZDXU 6RVePGi4F2Kly+Knttk6kKhd63imDcF7cI3lHmFkz5bnBodEtYl5hrs7uvvL172LFbLq Nnr7p7VcJm8GRKdW7Is6jTj7Y1/1YLbqwOpklIqLDRPtWlShJFH8OjpP9vCiNUPrtVLY 8+TUNK68sfO9Tj0UcjI44g2tlqlAUcdnMhLVOZbMdAWeu17h/7QD2dVD0pgzBXS2CSC4 Yx5ZYDeIWljZ/8KlTlNDbTe1mEeg3PGlxP64ggQ+baWpC94STwqPnW5tCBEfpXiW9S0B Acfg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=xZvZdfzIIOgy2IMlWorEamHN7BDZoYXDJ/TEXieA5YU=; b=MpafuV/n/fNuPEGXJXSgJLru1gRL6DHvNMmoEr98lHmGE5FbMvr3X9QYB6s5sH01X1 j/s35J4IgxVRXKvAvoTrHtMYORmI4pdRQ1e4wue0/uZJVOc+8cj8knbjryCmqu1LJT0q DxSzpt/Xnp1QxVnWn8Z/6pMQX6gptYU80dmKUIrRf68rxCiI7epLGCHSpb486LZ5giYq s1Rzo/Oc2btcrxa+TX73jld7B2KYL9NOB2Edu96nTYgwAPzAMCkeYXkiUajojrbVNfWL pyQkTxTakcZlGExvRkm4ztEe1w7ANVbHX554ijdaljiFOxYpncChA2WOh/JvWjfH/0Fa LiuQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=2HArZGhY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u14-20020a63df0e000000b00455ee9915c3si34735455pgg.746.2022.10.24.05.47.42; Mon, 24 Oct 2022 05:48:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=2HArZGhY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234611AbiJXMfd (ORCPT + 99 others); Mon, 24 Oct 2022 08:35:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53754 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234260AbiJXM3w (ORCPT ); Mon, 24 Oct 2022 08:29:52 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F1622BF4C; Mon, 24 Oct 2022 05:03:50 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id C10E8612FC; Mon, 24 Oct 2022 12:03:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D8397C433C1; Mon, 24 Oct 2022 12:03:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612988; bh=oLQNDm95SWVtvPjxRy2VakTKeT3riPaK0HtW3lY2t8k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=2HArZGhYaZtNx3rI0lSjhtheESYo1rHWR+N8+EKpzUvN85er0ElhEBE+O07cQoCYK dihCFEcpK5snDQURzH1Z9DSUxPYSqamra6oOQGIkjmohnECn48zJdJERtdxacISMoo xM1M0wJ35s5tmx8QJnw+e3+yV/PK9aweiz8fDjVk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mateusz Kwiatkowski , =?utf-8?q?Noralf_Tr?= =?utf-8?q?=C3=B8nnes?= , Maxime Ripard , Sasha Levin Subject: [PATCH 4.19 196/229] drm/vc4: vec: Fix timings for VEC modes Date: Mon, 24 Oct 2022 13:31:55 +0200 Message-Id: <20221024113005.475032976@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747573209914446280?= X-GMAIL-MSGID: =?utf-8?q?1747573209914446280?= From: Mateusz Kwiatkowski [ Upstream commit 30d7565be96b3946c18a1ce3fd538f7946839092 ] This commit fixes vertical timings of the VEC (composite output) modes to accurately represent the 525-line ("NTSC") and 625-line ("PAL") ITU-R standards. Previous timings were actually defined as 502 and 601 lines, resulting in non-standard 62.69 Hz and 52 Hz signals being generated, respectively. Signed-off-by: Mateusz Kwiatkowski Acked-by: Noralf Trønnes Signed-off-by: Maxime Ripard Link: https://patchwork.freedesktop.org/patch/msgid/20220728-rpi-analog-tv-properties-v2-28-459522d653a7@cerno.tech Signed-off-by: Sasha Levin --- drivers/gpu/drm/vc4/vc4_vec.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/vc4/vc4_vec.c b/drivers/gpu/drm/vc4/vc4_vec.c index 8e7facb6514e..ae0354ceb2a3 100644 --- a/drivers/gpu/drm/vc4/vc4_vec.c +++ b/drivers/gpu/drm/vc4/vc4_vec.c @@ -291,7 +291,7 @@ static void vc4_vec_ntsc_j_mode_set(struct vc4_vec *vec) static const struct drm_display_mode ntsc_mode = { DRM_MODE("720x480", DRM_MODE_TYPE_DRIVER, 13500, 720, 720 + 14, 720 + 14 + 64, 720 + 14 + 64 + 60, 0, - 480, 480 + 3, 480 + 3 + 3, 480 + 3 + 3 + 16, 0, + 480, 480 + 7, 480 + 7 + 6, 525, 0, DRM_MODE_FLAG_INTERLACE) }; @@ -313,7 +313,7 @@ static void vc4_vec_pal_m_mode_set(struct vc4_vec *vec) static const struct drm_display_mode pal_mode = { DRM_MODE("720x576", DRM_MODE_TYPE_DRIVER, 13500, 720, 720 + 20, 720 + 20 + 64, 720 + 20 + 64 + 60, 0, - 576, 576 + 2, 576 + 2 + 3, 576 + 2 + 3 + 20, 0, + 576, 576 + 4, 576 + 4 + 6, 625, 0, DRM_MODE_FLAG_INTERLACE) }; From patchwork Mon Oct 24 11:31:56 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8824 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp431290wru; Mon, 24 Oct 2022 05:43:25 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4Awnn5Tk6ywPFLFu8GtZ1RVDa+eScF3cZxoo6PI9JwAzwIXIsar2HZh6R3f/YBb3IpNwIQ X-Received: by 2002:a17:902:7b95:b0:178:ab50:76b5 with SMTP id w21-20020a1709027b9500b00178ab5076b5mr33668154pll.161.1666615405528; Mon, 24 Oct 2022 05:43:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666615405; cv=none; d=google.com; s=arc-20160816; b=ONFY7Es/EqkIQHzFwjOrAxrF/O02hfbRrxjueWvcDL3llYo3UijrrKeG+ZulyvE8iL zN6cKhvqa5/fykhXbw5r0y/MxMJiNAGLX+qM4tz0Gitw0lRTqK3DyekRkarOQNqIbvDQ RLKupYUTBdOrdpYmdu13ZbQxx1/jjRi1ddEcQU5X3FWhL1BMbA1rnIwW3wbdSGoIA/+9 R4sXpfmVIscgLFkgDs9LjhFfw1+5+kie0e+fu7/FcIXmObUVq6btq6Z/MiTlI0pV0YRj cHeTisZe8JAzXFBW/MKf0hsbQyI4mcDjz3VuOtYZI/JOOX/uKj6YBff5BQSrljD1qr3O PamA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=kRVB8tQIxodMw9D4gjJpKNI2JyoWlM1ze1hf0sDpXvE=; b=cab3x+9yFO4zb6dnk4yP6PqZgKWZE5/hL4YWcYG7OzH3eCoy7uxwLPxGzmiqmhxyOK dwjgTgOS76uexz25PCqVWQdltXNxNlb3N4f34GGfeVIih+faH3+ddxTvTFaSVFxSvCUP Bn4Zw7QKlUJF/2GxLuknSSS6mme3rQYABSCuXZrfSBV95m3T0UmJRdPYF1N5heW4jnTF f/umxuOnwWypWSTTiiB0ahyS7AeT2742s1iEfr9JrUHfuMECUrW036xg9XFLzhv9H+q+ b4LUCGeUfwj3Xi3Prh8sbcIVIYI4gHFAIzXCLgNEElUsTg9Bi4YSJPgSDaAgPlJ9ELaU e9UQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=v7S8zZjM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a20-20020aa794b4000000b0056bfad4be89si1079288pfl.311.2022.10.24.05.43.04; Mon, 24 Oct 2022 05:43:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=v7S8zZjM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234385AbiJXMe6 (ORCPT + 99 others); Mon, 24 Oct 2022 08:34:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45142 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234221AbiJXM3k (ORCPT ); Mon, 24 Oct 2022 08:29:40 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 91CB616588; Mon, 24 Oct 2022 05:03:51 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 7FB7D612E7; Mon, 24 Oct 2022 12:03:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 91C87C433C1; Mon, 24 Oct 2022 12:03:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612990; bh=Nxy2U0gzgIzMrtOcaB91OFC1EoClhzcPB5ggCZdx4mw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=v7S8zZjMPynlI+VSZi7ijQgf4E3/TFkNwveLnBFLG3xASOshwx3dZ5FzIrQuaoShW 490GuM/S/51apGAXPB4HQ2VPjlli/eNsl+4Yji7LG/Z29WMQn07vfKchvl5hLFBXv8 xMovve2hiq0O2qkgeEaIh9a06FrwFnOfOW7Vi4+o= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Maya Matuszczyk , Hans de Goede , Sasha Levin Subject: [PATCH 4.19 197/229] drm: panel-orientation-quirks: Add quirk for Anbernic Win600 Date: Mon, 24 Oct 2022 13:31:56 +0200 Message-Id: <20221024113005.512681324@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747572915291041391?= X-GMAIL-MSGID: =?utf-8?q?1747572915291041391?= From: Maya Matuszczyk [ Upstream commit 770e19076065e079a32f33eb11be2057c87f1cde ] This device is another x86 gaming handheld, and as (hopefully) there is only one set of DMI IDs it's using DMI_EXACT_MATCH Signed-off-by: Maya Matuszczyk Reviewed-by: Hans de Goede Signed-off-by: Hans de Goede Link: https://patchwork.freedesktop.org/patch/msgid/20220803182402.1217293-1-maccraft123mc@gmail.com Signed-off-by: Sasha Levin --- drivers/gpu/drm/drm_panel_orientation_quirks.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/gpu/drm/drm_panel_orientation_quirks.c b/drivers/gpu/drm/drm_panel_orientation_quirks.c index 265df1e67eb3..bea1d3e7e964 100644 --- a/drivers/gpu/drm/drm_panel_orientation_quirks.c +++ b/drivers/gpu/drm/drm_panel_orientation_quirks.c @@ -95,6 +95,12 @@ static const struct dmi_system_id orientation_data[] = { DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "One S1003"), }, .driver_data = (void *)&lcd800x1280_rightside_up, + }, { /* Anbernic Win600 */ + .matches = { + DMI_EXACT_MATCH(DMI_BOARD_VENDOR, "Anbernic"), + DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "Win600"), + }, + .driver_data = (void *)&lcd720x1280_rightside_up, }, { /* Asus T100HA */ .matches = { DMI_EXACT_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."), From patchwork Mon Oct 24 11:31:57 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8836 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp431480wru; Mon, 24 Oct 2022 05:43:56 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6NPDebxQP1EfUV5Tb/fjKwAJWL+Aucfbu8bVqaoPOV953npAqTQa4sdzEq9sqZi0+hUP7L X-Received: by 2002:a05:6a00:114f:b0:563:a934:718e with SMTP id b15-20020a056a00114f00b00563a934718emr33416477pfm.41.1666615435953; Mon, 24 Oct 2022 05:43:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666615435; cv=none; d=google.com; s=arc-20160816; b=DZnMFRg/8/zVODr/sS5UqgVL+JQp73Kmo15v2b+Ti08D0LtChlmiTAiAUJzVOTU9DQ NDsnlnG7WJ5t5hQY0vaoE5fr0b+SU3YamickrNnzppm0sKgGba5exgCYrAOt67NZ0emI DjPHCAQ1RdJmaUsIl9gIFeAghDSLCOjBjx+wpIG0OeOyA149u7jjELDRewTcVc7ANlem dcEj/RiUY7AUygYQKLms0B9/OGQkMexz85aHjwQr44SLMPt/ahteeRrfTGc5j4HDyJ9J 7VRROY2AP3dW/V0uSsyR+rN88m84UZoqyGY814P6BjyG8gjtxCkeZ1ghZMYQC8RKgnf4 agXg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Eov/uMuMp9j+hJEgM21txxRehHFmYrDxlL6AB+0WeQg=; b=a7l2BbY1FXU/qq3N0uJPdpd4gFOT2Tl58zFWwQ2YszuiGTVMn2udfg639cadst0CbM NH/2wG89sU2lPppVkEpcnXF9NJGoLBlD9fTm4ISYFhaogQsc2RLMoKjmEYO218lmsdKq AeuS9UAI4ShrO4LyzCLlaey/mZhHeBLCQ0odyaDyTS8PFN6VYppZF3GREjl1Pc8NSywQ SXwTnJZIYJ3MgS/tkGSI+mhtvzf7jw72nKD7YphRdYZWs43i7sq3DvwjGB5lKZdDZqD6 UsHlRYaaPwQkO0HCkA+wkHJmYaB84O0++4yxBJwqZX3beht/2ac4VCT1IJ1WWMs3+17V vM/g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ZM7+Ti4T; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u4-20020a170902e80400b0017a7506e0dcsi37868665plg.231.2022.10.24.05.43.40; Mon, 24 Oct 2022 05:43:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ZM7+Ti4T; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234739AbiJXMft (ORCPT + 99 others); Mon, 24 Oct 2022 08:35:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45036 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234280AbiJXM3z (ORCPT ); Mon, 24 Oct 2022 08:29:55 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 514062FFEC; Mon, 24 Oct 2022 05:03:55 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 23681612E3; Mon, 24 Oct 2022 12:03:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 331D2C433D6; Mon, 24 Oct 2022 12:03:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612993; bh=GNPGlTVN0Wx/jDcaPTBSQwgG0mCsQRKC7an2BZBzTCA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZM7+Ti4TJ0WBnsZcmsS/Iie777ik+XyBJmqxHKfbI8vaxf0xm/Q/P0mmi1SIwKTZa mqJr0buioa+042oJsGTwMXdbiRSGXBV0zO97pr5ReIwOW2sAoMizi3CQ7/i+Q3rhZN 9zi/DD9XzuSPiNlJZSkSd94QZs9j5KjMJ5UCT834= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hans de Goede , Sasha Levin Subject: [PATCH 4.19 198/229] platform/x86: msi-laptop: Change DMI match / alias strings to fix module autoloading Date: Mon, 24 Oct 2022 13:31:57 +0200 Message-Id: <20221024113005.545254819@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747572947398590214?= X-GMAIL-MSGID: =?utf-8?q?1747572947398590214?= From: Hans de Goede [ Upstream commit 2a2565272a3628e45d61625e36ef17af7af4e3de ] On a MSI S270 with Fedora 37 x86_64 / systemd-251.4 the module does not properly autoload. This is likely caused by issues with how systemd-udevd handles the single quote char (') which is part of the sys_vendor / chassis_vendor strings on this laptop. As a workaround remove the single quote char + everything behind it from the sys_vendor + chassis_vendor matches. This fixes the module not autoloading. Link: https://github.com/systemd/systemd/issues/24715 Signed-off-by: Hans de Goede Link: https://lore.kernel.org/r/20220917210407.647432-1-hdegoede@redhat.com Signed-off-by: Sasha Levin --- drivers/platform/x86/msi-laptop.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/platform/x86/msi-laptop.c b/drivers/platform/x86/msi-laptop.c index 1ba5f4689df4..42b31c549db0 100644 --- a/drivers/platform/x86/msi-laptop.c +++ b/drivers/platform/x86/msi-laptop.c @@ -609,11 +609,10 @@ static const struct dmi_system_id msi_dmi_table[] __initconst = { { .ident = "MSI S270", .matches = { - DMI_MATCH(DMI_SYS_VENDOR, "MICRO-STAR INT'L CO.,LTD"), + DMI_MATCH(DMI_SYS_VENDOR, "MICRO-STAR INT"), DMI_MATCH(DMI_PRODUCT_NAME, "MS-1013"), DMI_MATCH(DMI_PRODUCT_VERSION, "0131"), - DMI_MATCH(DMI_CHASSIS_VENDOR, - "MICRO-STAR INT'L CO.,LTD") + DMI_MATCH(DMI_CHASSIS_VENDOR, "MICRO-STAR INT") }, .driver_data = &quirk_old_ec_model, .callback = dmi_check_cb @@ -646,8 +645,7 @@ static const struct dmi_system_id msi_dmi_table[] __initconst = { DMI_MATCH(DMI_SYS_VENDOR, "NOTEBOOK"), DMI_MATCH(DMI_PRODUCT_NAME, "SAM2000"), DMI_MATCH(DMI_PRODUCT_VERSION, "0131"), - DMI_MATCH(DMI_CHASSIS_VENDOR, - "MICRO-STAR INT'L CO.,LTD") + DMI_MATCH(DMI_CHASSIS_VENDOR, "MICRO-STAR INT") }, .driver_data = &quirk_old_ec_model, .callback = dmi_check_cb From patchwork Mon Oct 24 11:31:58 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8812 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp431034wru; Mon, 24 Oct 2022 05:42:48 -0700 (PDT) X-Google-Smtp-Source: AMsMyM77EGTKm1lq63Bec+WOVerUQI+fcvS69LVzmPZ6To322oAC671UCLm4cKpQAp70v70/24+B X-Received: by 2002:a17:907:7b93:b0:770:1d4f:4de9 with SMTP id ne19-20020a1709077b9300b007701d4f4de9mr27795336ejc.201.1666615368290; Mon, 24 Oct 2022 05:42:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666615368; cv=none; d=google.com; s=arc-20160816; b=dOBJHqTNFQEod1GXUI3GycOxQpZLA/6dINDzgNc8HxF+HseSSU69NOYzyPveJtJnGo ZIRSuVVsGKJWfuwaMaUA1/TOCRxbjE7PCBN2yXUrstrtJx6j11+A+a3Z6uacbfhmCopE eXD6Nbz9r74T4K/g526k3Vf8yUXjxy2d4AR2ZOpbxl6XelD9gaoTuNdhXbrPWkJ7guc2 6uB8KoSaSpDGgEoFCthlPrGIg2fzPURTcgig0RPPg5lpgw7gm0mxwK4fSi1mJQz/DLyu BsU5LZaN+ffqYjm07T5l9expmS2IfZ10Wp5FnjAbJGhCgtnJlNQVVn1/6Y82FJ+DLgk0 9v3w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=5hcUie6IpDgs1+Z+EmrIpS2ADxskD2wy08G4BqMWU/k=; b=zI5Ya//gFVEVWTUOUcswCgWX93pKIktBRcIUZ4teJxXQsNAbdF6QCfp2x6HJqBk3Od CHpFPJgIo/1lrS4FFXwpFsCFb06tqo7heQYP9rRYgXCh3ECaI9a9hsBmQ/SGq4yJBltu dT+n3YZE8haMPioSvX+ngAtqTIFObHY9Rncz0UjQWgtjuo1YVikilpqgV+GFVuiq21Cy QMsngMFNozDLn1NO60ONvCsLteQN5ZBAZ4KwSjkcnPJdX9uouii8zqNFPZjWX9TOEM2D OSd9ULHdCg+Y75yk/uWoLee0RtsRE7rknBn0AoIzDs6m11uBDo2KmSwV0wDFAlE4H3uz DN5w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Y3K8aD3r; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v22-20020a056402349600b0045cea9cf231si32101486edc.566.2022.10.24.05.42.20; Mon, 24 Oct 2022 05:42:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Y3K8aD3r; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234556AbiJXMf1 (ORCPT + 99 others); Mon, 24 Oct 2022 08:35:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51192 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234251AbiJXM3u (ORCPT ); Mon, 24 Oct 2022 08:29:50 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 911192314F; Mon, 24 Oct 2022 05:03:59 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id B6E9D612CC; Mon, 24 Oct 2022 12:03:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C7FC6C433C1; Mon, 24 Oct 2022 12:03:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612996; bh=x64p9PIf/71AI9EqI80e9YSybdV7Rzg21I92kH5YS6w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Y3K8aD3rAFeS9iqm7yYvfB13Ymx6SccH6JEWbjj3smToe7/JGlyBO6SjUdgk8/vUU uWckbM3kPfqIF6aDQIn1g+9Qlm3Fgb/r0R3WxAWZzxWdyQjcINyeEdrwkOULzYD6D/ RVxYVLCZbnrg0MesYlQzcXjpgl1MkgkAIo84GbbY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, hongao , Alex Deucher , Sasha Levin Subject: [PATCH 4.19 199/229] drm/amdgpu: fix initial connector audio value Date: Mon, 24 Oct 2022 13:31:58 +0200 Message-Id: <20221024113005.574907046@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747572876807902531?= X-GMAIL-MSGID: =?utf-8?q?1747572876807902531?= From: hongao [ Upstream commit 4bb71fce58f30df3f251118291d6b0187ce531e6 ] This got lost somewhere along the way, This fixes audio not working until set_property was called. Signed-off-by: hongao Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin --- drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c index 3e4305c3c983..86ceefb8b8fb 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c @@ -1638,10 +1638,12 @@ amdgpu_connector_add(struct amdgpu_device *adev, adev->mode_info.dither_property, AMDGPU_FMT_DITHER_DISABLE); - if (amdgpu_audio != 0) + if (amdgpu_audio != 0) { drm_object_attach_property(&amdgpu_connector->base.base, adev->mode_info.audio_property, AMDGPU_AUDIO_AUTO); + amdgpu_connector->audio = AMDGPU_AUDIO_AUTO; + } subpixel_order = SubPixelHorizontalRGB; connector->interlace_allowed = true; @@ -1746,6 +1748,7 @@ amdgpu_connector_add(struct amdgpu_device *adev, drm_object_attach_property(&amdgpu_connector->base.base, adev->mode_info.audio_property, AMDGPU_AUDIO_AUTO); + amdgpu_connector->audio = AMDGPU_AUDIO_AUTO; } drm_object_attach_property(&amdgpu_connector->base.base, adev->mode_info.dither_property, @@ -1794,6 +1797,7 @@ amdgpu_connector_add(struct amdgpu_device *adev, drm_object_attach_property(&amdgpu_connector->base.base, adev->mode_info.audio_property, AMDGPU_AUDIO_AUTO); + amdgpu_connector->audio = AMDGPU_AUDIO_AUTO; } drm_object_attach_property(&amdgpu_connector->base.base, adev->mode_info.dither_property, @@ -1839,6 +1843,7 @@ amdgpu_connector_add(struct amdgpu_device *adev, drm_object_attach_property(&amdgpu_connector->base.base, adev->mode_info.audio_property, AMDGPU_AUDIO_AUTO); + amdgpu_connector->audio = AMDGPU_AUDIO_AUTO; } drm_object_attach_property(&amdgpu_connector->base.base, adev->mode_info.dither_property, From patchwork Mon Oct 24 11:31:59 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8852 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp432967wru; Mon, 24 Oct 2022 05:48:11 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5EYL9Wj0tHYXWHuqj/n56Y5/mrbiLftJ4FN6nTvjXx96TTBo85YbZP6h0sVa+ZQgyr6Nzs X-Received: by 2002:a65:6c11:0:b0:46a:eec8:19f7 with SMTP id y17-20020a656c11000000b0046aeec819f7mr28468472pgu.478.1666615691356; Mon, 24 Oct 2022 05:48:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666615691; cv=none; d=google.com; s=arc-20160816; b=Py8E+CqTo7ynck60iPerNGrr5PWmRfdWxTDgsECHIMP02URTcJSFHzyItWSM9CJF9t qPbE8nGdiycqzkmOgYK4IyUK+MmheByORRkrNKDyIz16xaMkna0ppHPcevwDaWkP0JAQ MPGxf/LQcJDWwt/tsVfgcRoDDvog5tiieBU8Tq3P+mcz0VHbaAfpeXM++fuNbZW0hHMz ISjxmz6QHKVlEw10SY0s/ODY3t+IC4UrBguSHYA8EedaZYnRFKqYlbA7aFj/Qfkvt6XR EybbyNTHoK6vitfSU9QfXnK8hzZw9ioCKKGjluC1V/EFoi8tyULk55IcSHaHE13YFMt+ rK2w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=13R6P2gGiq7QWLIKyqytanzjXJjtBqE8gQlLhxZcEYE=; b=S3f139gZCKWXSrC9v57E5v7l4B+0eoIUmdAlgXHJWDjv4MSbZmraVQKKqcSycTJkNw kAX+B4txNuT+ffodspBs9cGCFRplUDt5ds/wqMhnd5co46RfkIy7hx0ZUMalpEMH6U/7 /qsV/XGcwsNeIBUS4sliXygry1wA8SD4gQaOgD3HgaqiyUlLi4zW7UIXoBy+4NWNGXpn GR3+ocY8+SgKRgZp10ssjrf45apfQTlKP2PPj6OmFlz3Z6kIrB3ll8S3fmsze6kQluGs k2ujb0pXFKkNw26KtGseO0Y4nRTjB2nLV5dtue1LHyyOHuPUdhLH6wP1L1hL0X0xaLeu T/Qw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=nIjiJGJW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id rm1-20020a17090b3ec100b0020593d282desi17992601pjb.12.2022.10.24.05.47.58; Mon, 24 Oct 2022 05:48:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=nIjiJGJW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234099AbiJXMjA (ORCPT + 99 others); Mon, 24 Oct 2022 08:39:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48672 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234651AbiJXMfj (ORCPT ); Mon, 24 Oct 2022 08:35:39 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 25ADC474FA; Mon, 24 Oct 2022 05:05:38 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 16DA0B811F9; Mon, 24 Oct 2022 12:03:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 65061C433D7; Mon, 24 Oct 2022 12:03:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612998; bh=bWLgJsdT1xT7yzgqkpyFEL+i9+i23FLq//RwWqB7Aog=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nIjiJGJWL5KcR/k5FoHk8Qb6H0s9OYt8q25g7mFYY8NdNkpanM2ygREKS1FaIY3cY BxrkjZNo3tOTKP8Vf4p8XqOqF2XV7xzh6BU7Y0BZCwnD7qVnVUTEIbxidotIlnw6bJ erLYqMb4M5xuydPoU/pd+viZvDoYVzYG4uHFvr8k= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Haibo Chen , Shawn Guo , Sasha Levin Subject: [PATCH 4.19 200/229] ARM: dts: imx7d-sdb: config the max pressure for tsc2046 Date: Mon, 24 Oct 2022 13:31:59 +0200 Message-Id: <20221024113005.616360725@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747573215142173549?= X-GMAIL-MSGID: =?utf-8?q?1747573215142173549?= From: Haibo Chen [ Upstream commit e7c4ebe2f9cd68588eb24ba4ed122e696e2d5272 ] Use the general touchscreen method to config the max pressure for touch tsc2046(data sheet suggest 8 bit pressure), otherwise, for ABS_PRESSURE, when config the same max and min value, weston will meet the following issue, [17:19:39.183] event1 - ADS7846 Touchscreen: is tagged by udev as: Touchscreen [17:19:39.183] event1 - ADS7846 Touchscreen: kernel bug: device has min == max on ABS_PRESSURE [17:19:39.183] event1 - ADS7846 Touchscreen: was rejected [17:19:39.183] event1 - not using input device '/dev/input/event1' This will then cause the APP weston-touch-calibrator can't list touch devices. root@imx6ul7d:~# weston-touch-calibrator could not load cursor 'dnd-move' could not load cursor 'dnd-copy' could not load cursor 'dnd-none' No devices listed. And accroding to binding Doc, "ti,x-max", "ti,y-max", "ti,pressure-max" belong to the deprecated properties, so remove them. Also for "ti,x-min", "ti,y-min", "ti,x-plate-ohms", the value set in dts equal to the default value in driver, so are redundant, also remove here. Signed-off-by: Haibo Chen Signed-off-by: Shawn Guo Signed-off-by: Sasha Levin --- arch/arm/boot/dts/imx7d-sdb.dts | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/arch/arm/boot/dts/imx7d-sdb.dts b/arch/arm/boot/dts/imx7d-sdb.dts index 317f1bcc56e2..bd2c3c8f4ebb 100644 --- a/arch/arm/boot/dts/imx7d-sdb.dts +++ b/arch/arm/boot/dts/imx7d-sdb.dts @@ -163,12 +163,7 @@ interrupt-parent = <&gpio2>; interrupts = <29 0>; pendown-gpio = <&gpio2 29 GPIO_ACTIVE_HIGH>; - ti,x-min = /bits/ 16 <0>; - ti,x-max = /bits/ 16 <0>; - ti,y-min = /bits/ 16 <0>; - ti,y-max = /bits/ 16 <0>; - ti,pressure-max = /bits/ 16 <0>; - ti,x-plate-ohms = /bits/ 16 <400>; + touchscreen-max-pressure = <255>; wakeup-source; }; }; From patchwork Mon Oct 24 11:32:00 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8827 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp431325wru; Mon, 24 Oct 2022 05:43:29 -0700 (PDT) X-Google-Smtp-Source: AMsMyM56CCWQ20mAaS5X0mGGIV+/O5kRq7HcUQ7Le/qocFxPOPAQ3ndCHVRFQK7YsPud1VyU4Bz8 X-Received: by 2002:a17:902:ea06:b0:185:3d64:8d55 with SMTP id s6-20020a170902ea0600b001853d648d55mr32658724plg.7.1666615409508; Mon, 24 Oct 2022 05:43:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666615409; cv=none; d=google.com; s=arc-20160816; b=ksbjXDa37duNfV9ccMUsVQ8HRQkDYxQgrb0hIfNfjV6Sqar0jZskcF7V4thVA6yi2O z9IyE/uhg51P/qqsR0nqGUdxdnP5kJNvxgd7Ps+lvEu0D9s7bv92F8eyYdSXg2FvRv3r CGqHQVh0GN9hr7/lgP6yZnnTBNq9yxQzkniC48TYzTIDmkgadgAsbGBCULa945J6pSj3 1eNP7CSERaUaTj0bAH55eDUhgColYs5TACMlWK4szrzVmS7bc40axCwav2FwoMUZARRK rK/QiURCt75RaJ3UpGqClofj5gQyxRM4lg6ceIfI8mgSECTDrrvt5A+iDmbWGA6z526I Ig5A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=YSmVdTGbe3ghfqdyiaW8kwOC3WjPIcySPJr+ZO07y1g=; b=YcTib1kXuO6y2WMYcow+ZvN9QeUV+gZWgi5jPAth4qPMJhanZ8cSn/uVXIlUmrXLjA YBKRWgosM/VEGgi9lglFyrxrkLS6g9etihO2bhpgbnQBNdLcwyjJX9eBvgeoXgeelRA9 2hu1YFNl0xK+VoJqltwx09Fi5FNs3PMsibovNKesnUkMYQ4rqf4Fd1PVQrIZ0kZKygj0 W8dGNg6rPDP9FMGOIYOI2DbE3lBNhxJVMDv/JABLTPHBqE59YaMhdwfcU+xmqyQSZjXl zxw1uLRgsHEilzcByPb8n3Pj1l/n4L+U+Pyn7ba24c0Oh2s4kyFKBCoFwikassdJlPO3 JdkQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=vlYxJn0L; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i10-20020a170902c94a00b00186605b7528si12005037pla.185.2022.10.24.05.43.07; Mon, 24 Oct 2022 05:43:29 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=vlYxJn0L; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231253AbiJXMgk (ORCPT + 99 others); Mon, 24 Oct 2022 08:36:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51194 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234355AbiJXMaH (ORCPT ); Mon, 24 Oct 2022 08:30:07 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 91550371A6; Mon, 24 Oct 2022 05:03:59 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id E6D11612BF; Mon, 24 Oct 2022 12:03:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 07B1CC433D6; Mon, 24 Oct 2022 12:03:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613001; bh=7GMsAKLqLcGgeJuOdMjpUAgcMRmROOQuPR8u01j9H1o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vlYxJn0L3NgYkIWFwac4HvNGReaTsH4fDdl1wcCRj09Zx1HN2Uwks+aQCaRIUdGew l4oozsTkEbs0+2PDMhCLTSnko758Aqx6anU0Fy3FqtQJgRVJoexX9Uamw/w5KEBZRd 6c5uIWTfkTg8N4zZiOn0HaUSGZVq5/UnfuMeZRpk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alexander Stein , Shawn Guo , Sasha Levin Subject: [PATCH 4.19 201/229] ARM: dts: imx6q: add missing properties for sram Date: Mon, 24 Oct 2022 13:32:00 +0200 Message-Id: <20221024113005.656408984@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747572919535856048?= X-GMAIL-MSGID: =?utf-8?q?1747572919535856048?= From: Alexander Stein [ Upstream commit b11d083c5dcec7c42fe982c854706d404ddd3a5f ] All 3 properties are required by sram.yaml. Fixes the dtbs_check warning: sram@900000: '#address-cells' is a required property sram@900000: '#size-cells' is a required property sram@900000: 'ranges' is a required property Signed-off-by: Alexander Stein Signed-off-by: Shawn Guo Signed-off-by: Sasha Levin --- arch/arm/boot/dts/imx6q.dtsi | 3 +++ 1 file changed, 3 insertions(+) diff --git a/arch/arm/boot/dts/imx6q.dtsi b/arch/arm/boot/dts/imx6q.dtsi index 0193ee6fe964..a28dce3c6457 100644 --- a/arch/arm/boot/dts/imx6q.dtsi +++ b/arch/arm/boot/dts/imx6q.dtsi @@ -158,6 +158,9 @@ ocram: sram@900000 { compatible = "mmio-sram"; reg = <0x00900000 0x40000>; + ranges = <0 0x00900000 0x40000>; + #address-cells = <1>; + #size-cells = <1>; clocks = <&clks IMX6QDL_CLK_OCRAM>; }; From patchwork Mon Oct 24 11:32:01 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8815 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp431074wru; Mon, 24 Oct 2022 05:42:53 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4SlRN61L+LfKoZLnHFX/RRDGstPogdo32NmfsiJvgnsd6aai4If/GanqHofviDWs4RS+wV X-Received: by 2002:a65:4c0e:0:b0:46a:eeb1:e78a with SMTP id u14-20020a654c0e000000b0046aeeb1e78amr28210714pgq.193.1666615373498; Mon, 24 Oct 2022 05:42:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666615373; cv=none; d=google.com; s=arc-20160816; b=BEF8DwdTehyEGZGFrC+cX1dXcIrsK21piXjvbh9zbes4CHqLEqeY+4IrXApK+TlPI7 XnKmxK4D4WtRC22COfYeuwsuoBmNrG1bfWmmLgNOxgtlL/b7mzV667uzwePsFR2I1dJS fBllNdYCHz2+bQp81b96flAD2CZg31M+2wb2E7rmqMdJM7HhOCddDEGeZN2rmYEv2HO/ FUaSmlCsoJKCN9koDFTOm6+7WQ8CerhYqzVp3PfV6s8dodK7ZnpmP5fZe3CxxRYKM9eA VVnpyw7T/sv4rvt41sfYIqcvCfp7amSuLDWM/ML/Ss/GeDXnWAPJfL0JAUZEw1um16fQ aHvw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=+KkeiulqHDPuhim0J5IbrBiP5fTmM/QSbJQrYJxi6pA=; b=PDZJ4mKd269tq6SnnLJJTuob5ehRAPFapXFC7Coemwjj3tApwD1+hRlMJ49Xw+OYMU O3LAMt/oam0ayd1g5hdURuDLxGk/jUOwdbK5kizndYeiAIk9BAbbDnghyQjG9WwTWc+a ohCSxqkqauNkyGJc/wNrBbmXPRy5JNijIjdT7TNkJd54y0GHghNya+AQFXO4IjRaawF+ /OP8MgwDeSPW9jY+HQDGI6l8294HLz4a4Bnknx1eXBRcAeiIG2Ha1k98fdep7UAckADp ueCLjEgOOfrloI5gfqQFyXpfG0XBMnvF5WYLLo2Ydmplo1zyxs5+iEjJ9cXXoRXfbpa6 Uu8w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="J/bk2KY1"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y65-20020a638a44000000b004614aa5f31csi34158032pgd.255.2022.10.24.05.42.38; Mon, 24 Oct 2022 05:42:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="J/bk2KY1"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231200AbiJXMgF (ORCPT + 99 others); Mon, 24 Oct 2022 08:36:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45258 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234312AbiJXM37 (ORCPT ); Mon, 24 Oct 2022 08:29:59 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8D1B839112; Mon, 24 Oct 2022 05:04:02 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 9209A612D5; Mon, 24 Oct 2022 12:03:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9BC1AC433D6; Mon, 24 Oct 2022 12:03:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613004; bh=FwSMJGBQ21UcchXwi0pC2cCu9Y98Gdm1Se469QUuPDA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=J/bk2KY1MkO77RKhcJKsv39tbk1JtxvOTwDlT+t7khwPofJzhzHr+KYgK/ZmTItvk 4a5c4T1V5woxM2oEGqufetUZkaTa4XvWLhudzmkS4GcRAUoWFQCMReBJQQZskHsYXZ QzErxu9WqKN2lQoQRqr3/lO0PDgfdZHsuHeQ7X6g= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alexander Stein , Shawn Guo , Sasha Levin Subject: [PATCH 4.19 202/229] ARM: dts: imx6dl: add missing properties for sram Date: Mon, 24 Oct 2022 13:32:01 +0200 Message-Id: <20221024113005.696537033@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747572881888316208?= X-GMAIL-MSGID: =?utf-8?q?1747572881888316208?= From: Alexander Stein [ Upstream commit f5848b95633d598bacf0500e0108dc5961af88c0 ] All 3 properties are required by sram.yaml. Fixes the dtbs_check warning: sram@900000: '#address-cells' is a required property sram@900000: '#size-cells' is a required property sram@900000: 'ranges' is a required property Signed-off-by: Alexander Stein Signed-off-by: Shawn Guo Signed-off-by: Sasha Levin --- arch/arm/boot/dts/imx6dl.dtsi | 3 +++ 1 file changed, 3 insertions(+) diff --git a/arch/arm/boot/dts/imx6dl.dtsi b/arch/arm/boot/dts/imx6dl.dtsi index f0607eb41df4..079f77c7e0f0 100644 --- a/arch/arm/boot/dts/imx6dl.dtsi +++ b/arch/arm/boot/dts/imx6dl.dtsi @@ -81,6 +81,9 @@ ocram: sram@900000 { compatible = "mmio-sram"; reg = <0x00900000 0x20000>; + ranges = <0 0x00900000 0x20000>; + #address-cells = <1>; + #size-cells = <1>; clocks = <&clks IMX6QDL_CLK_OCRAM>; }; From patchwork Mon Oct 24 11:32:02 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9163 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp457810wru; Mon, 24 Oct 2022 06:36:34 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6D39pMeX/HojkGZZtQqkdZm+y3nnUJQAphOmj1ZvTRchQ2u3l9CmFM7/3Pv4eOcTjyRLFS X-Received: by 2002:a05:6402:501b:b0:459:df91:983 with SMTP id p27-20020a056402501b00b00459df910983mr29430998eda.85.1666618594828; Mon, 24 Oct 2022 06:36:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666618594; cv=none; d=google.com; s=arc-20160816; b=CW2AGxg+7512n1ILRQGND6Sr4swStAfS1INt/FagTS0DjnvrOKWp4Yk+FPIFAtAJfV MCY8oheN8jDwl6O2ELXzVw+A68pj3fsdbfxSo7+p8PPzvzWtZvmXSxefrGGgxg7Szbkz 6tZuqNGupzLEln7Sfi3BZopfDffCQm6oCsjlOLYneXlpXx1myKpk94gJkiUMxmKvGmKA ACrK1RfoyJLmcGV4trX2QloE09izAWfpZutl/o1gy/3tH2wDHr+NPVlPTEYvm2QL4dpG AEwaARVQOK5Ncwch7ujsqDGj77vQphsHSOUZbq0l0uCv+EmxY8GGyhyjY/XFiFzWa3FF 3Pig== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=itgmzacG4BDdYGv58xaMOPUI1Q4iI9pUCOPBfjHpSVw=; b=vbXfKZiPWcPEEXP86z0IYF+PD8mno/v74bocEZ83O/eF6mP0TPYZm0CSBx5kl+NTdK zGmj5plsQ4A28nPNvzb7grf+ypQCDp5H2ZZ7WOYo/MKEN0tJTUU7Lro04f2WH9SuAb82 hIkrpgRCwiNwluV6aG/AqkEh7Wp2Sfp4okM0xyEipCsjpTdgayk9JWXg+MQTajlruU4P 6Jr+PuUqAOFFwrV7MYREW3s8q40uoMxgJYrQV+HhL+SH/6GvZuUhNQ/jKsxFvnz+wQEB hUq49cni+D2qcOOWahS+Z2oobPVYuJwsAEM9VMCjZFC0leCL34myjpa5Bebm4lfd6NMd WZ4w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=m5puIhqZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a16-20020aa7cf10000000b00456eaa4fb1fsi15442787edy.223.2022.10.24.06.36.09; Mon, 24 Oct 2022 06:36:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=m5puIhqZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235672AbiJXNVE (ORCPT + 99 others); Mon, 24 Oct 2022 09:21:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36996 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236230AbiJXNTj (ORCPT ); Mon, 24 Oct 2022 09:19:39 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1BA683DF21; Mon, 24 Oct 2022 05:28:05 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 77A27B811D7; Mon, 24 Oct 2022 12:03:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CDDB3C433D6; Mon, 24 Oct 2022 12:03:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613009; bh=sROAur3aGXlT8ifTU8ZjjjERgRM0DiGP+pQC/jW0V5g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=m5puIhqZ4gg4iH8HvjKBIA2uTuu52fyOY/cyYt5Ji6uXRDDUmIRxB1ZLTLXSvtdNy c4GvZlTCI6Pj9m29XR6aFCdb68v0M42UqRWUssxS+nGVgaHuN1gA3lFhoLqK88XEdQ 7XzoEp/ZhtbijVBY2PLx4x+7xZcY856yGjS4MwGo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alexander Stein , Shawn Guo , Sasha Levin Subject: [PATCH 4.19 203/229] ARM: dts: imx6qp: add missing properties for sram Date: Mon, 24 Oct 2022 13:32:02 +0200 Message-Id: <20221024113005.738940625@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747576259727521168?= X-GMAIL-MSGID: =?utf-8?q?1747576259727521168?= From: Alexander Stein [ Upstream commit 088fe5237435ee2f7ed4450519b2ef58b94c832f ] All 3 properties are required by sram.yaml. Fixes the dtbs_check warning: sram@940000: '#address-cells' is a required property sram@940000: '#size-cells' is a required property sram@940000: 'ranges' is a required property Signed-off-by: Alexander Stein Signed-off-by: Shawn Guo Signed-off-by: Sasha Levin --- arch/arm/boot/dts/imx6qp.dtsi | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/arch/arm/boot/dts/imx6qp.dtsi b/arch/arm/boot/dts/imx6qp.dtsi index d91f92f944c5..3633383db706 100644 --- a/arch/arm/boot/dts/imx6qp.dtsi +++ b/arch/arm/boot/dts/imx6qp.dtsi @@ -9,12 +9,18 @@ ocram2: sram@940000 { compatible = "mmio-sram"; reg = <0x00940000 0x20000>; + ranges = <0 0x00940000 0x20000>; + #address-cells = <1>; + #size-cells = <1>; clocks = <&clks IMX6QDL_CLK_OCRAM>; }; ocram3: sram@960000 { compatible = "mmio-sram"; reg = <0x00960000 0x20000>; + ranges = <0 0x00960000 0x20000>; + #address-cells = <1>; + #size-cells = <1>; clocks = <&clks IMX6QDL_CLK_OCRAM>; }; From patchwork Mon Oct 24 11:32:03 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9799 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp554709wru; Mon, 24 Oct 2022 09:57:53 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7mhPU+wQJNpJ/t3l4tq97nx0lr9Exgnn9gLpWJLIflKQhZdByaZDXVCdlNs9rv293iFYkQ X-Received: by 2002:a17:906:fe0b:b0:787:f1d3:2105 with SMTP id wy11-20020a170906fe0b00b00787f1d32105mr28512452ejb.83.1666630672826; Mon, 24 Oct 2022 09:57:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666630672; cv=none; d=google.com; s=arc-20160816; b=ccOw/Eayc9h6vUDls9x6bxdoP/qDbEpg79tRN24TyWRf9sIRdaQACnFjqTC8xWoS9p XQcMwZj+xLZLDuRkZvP6Obc5ZVrWi6pNl8zL7DS+gwZyO1LKBV3t/fr8bU/lssg0uJDr dGiFuDjwakl5Ju/5bUCliNduTlP7z8n99JjTvVT1WRNHXBRJMK88Yo28rxx+kYjvCOqk vmVvj8xPxWK7Ig/ZqG9J/d0cOrRc8SDFiMbT1HHgDX6in5qP21hKN+7B45+WXT5t5CEQ mui/T8juzctMaTXC0LTtEbHUqoGvPgV4RTbFeRUkgdVMzZtQp68FEfSI37F4j0luin70 zqtQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=lO4KcOfyFF0RvvrtRujlsJuKAZVvt9pcZM5QCxZY9F4=; b=qna0rCpwr1oDpM6cmHum8UENc8CyT4MB7QvPybr3VrqbefUfExeo7wAzfL10oOjPk8 AXU9MtX5ZCg5Eg9qA9xj1R4Nev9T5qyWU65vnCsRoNVmbDxZGBwwTeLCj/VDaDOyTKk7 mCtI71e23pSc/Nx3XozhhiwyF2xSgcLFYPpELGXeTy52lwWEXQ8+S7lLg2d8XWN6Ly6M QihdeZvO3Vpezp70OHVu3aWbWzrsLgksSJqYF6JWRWbrj4ykzgwjD86LX5YlknQGuKSv PNZnF4KME3qJhd6fOiuu2xFqpBjUXvgtbDnoGMlza4DFTZ/P4t8hu+Jo+MIaCCpqiyn8 Cz6A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="VGSM/XzZ"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p1-20020a17090628c100b0078dcdbb3e87si203621ejd.530.2022.10.24.09.57.20; Mon, 24 Oct 2022 09:57:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="VGSM/XzZ"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233236AbiJXQxL (ORCPT + 99 others); Mon, 24 Oct 2022 12:53:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36102 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235310AbiJXQtX (ORCPT ); Mon, 24 Oct 2022 12:49:23 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7397A169122; Mon, 24 Oct 2022 08:32:36 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 1E7E5B811F8; Mon, 24 Oct 2022 12:03:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 728E8C433C1; Mon, 24 Oct 2022 12:03:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613011; bh=XstuXJ9XP7b/uB89HOndhXrfHzTGzsgT8se1TPjq8OE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VGSM/XzZFoK2Rsvr1OYrNPBYAji5xbsER944kMYN1xT1Jqip3YfVb+NEe/xuKj77F dNJALZ8ygL0u3Onon/EUCp23TB0WnzsPNovNH4p4MgH7jiNWlvi2VJl2ELiuq5jkh8 Fhvom/Tzvi0lNscXo4CPSg+vr4Ih6ZS1v3SBpWOg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alexander Stein , Shawn Guo , Sasha Levin Subject: [PATCH 4.19 204/229] ARM: dts: imx6sl: add missing properties for sram Date: Mon, 24 Oct 2022 13:32:03 +0200 Message-Id: <20221024113005.777979171@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747588924359601729?= X-GMAIL-MSGID: =?utf-8?q?1747588924359601729?= From: Alexander Stein [ Upstream commit 60c9213a1d9941a8b33db570796c3f9be8984974 ] All 3 properties are required by sram.yaml. Fixes the dtbs_check warning: sram@900000: '#address-cells' is a required property sram@900000: '#size-cells' is a required property sram@900000: 'ranges' is a required property Signed-off-by: Alexander Stein Signed-off-by: Shawn Guo Signed-off-by: Sasha Levin --- arch/arm/boot/dts/imx6sl.dtsi | 3 +++ 1 file changed, 3 insertions(+) diff --git a/arch/arm/boot/dts/imx6sl.dtsi b/arch/arm/boot/dts/imx6sl.dtsi index 9d19183f40e1..afde0ed6d71a 100644 --- a/arch/arm/boot/dts/imx6sl.dtsi +++ b/arch/arm/boot/dts/imx6sl.dtsi @@ -118,6 +118,9 @@ ocram: sram@900000 { compatible = "mmio-sram"; reg = <0x00900000 0x20000>; + ranges = <0 0x00900000 0x20000>; + #address-cells = <1>; + #size-cells = <1>; clocks = <&clks IMX6SL_CLK_OCRAM>; }; From patchwork Mon Oct 24 11:32:04 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9201 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp458926wru; Mon, 24 Oct 2022 06:38:32 -0700 (PDT) X-Google-Smtp-Source: AMsMyM54P2AHzKqemC9LMffrkjltUNe5kX70w/oyRHyvIVh/2pqXfjJBFrPnZs8g8r1t85svZcii X-Received: by 2002:aa7:dbd2:0:b0:45c:97bb:4ae0 with SMTP id v18-20020aa7dbd2000000b0045c97bb4ae0mr30783963edt.417.1666618712143; Mon, 24 Oct 2022 06:38:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666618712; cv=none; d=google.com; s=arc-20160816; b=m3To+THhmMnqjd7gXeGpmNwpXWklfrjxHp1kcdT01xjTLWj6eMlKjKNLZ99Goj1TgQ S385STsu6MksekiWxkAmbD+Mdohhy8tf1h2sQzmbODMMTjc1Eyxoy8NA6qspOZBeepes luWo0kG0IqAhwJyKTveN+oTN1j9/sEEJBPzJeYII2zNmgNBlDzd8wS2WA6huj8J3uYuk C6Sjmlm1Bbvy8PbOyVgBXqNjPNNoop4xEMi98+vFrsowZj2FUftxBNrvykXtmMOxJhBQ wEFRk17bzM9Xd8pKMWSmeWHd53fPFtf+NUTH8QRIEHk7DSc5T+IT9smJThRcvEznvlWe +usQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=e74CttIFnnMzULDch+Eaii4G0JmFIqrHIeM70b5exAA=; b=uBQo/ajRbr52eHFFmgRJi72gDsnRNyzqw1lpqwqkCnnmJGx+4RoAs2lfFmJDyE8LGL /lB9yeC/Pj+ZWeoHwhRV94IdL6tGiZaU+emDr3yUk5ijn7anlUcos+v5Tit4kVPYpn4z yvhfiE6b6h8cbZ8Qjv6dPwW9zazZqOp7UucSlucol5+lGXtE1Pd26LMN1TPDKWPKNUQM A5HBhcdyinp6x5ASdimvl4adePtdH0kzvENDtZAiP8FJzRHa9CGQAtFrLpAzoNO9R6KQ /GS1YJOZ5IhJki9hSuuWGaVV9tFRa7IQ/2UFBgEKEQMR/Cg+QvxSK388oLKA5mupo37h c8YA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=nh1tN4sZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hg6-20020a1709072cc600b007820f00167fsi8272039ejc.260.2022.10.24.06.37.52; Mon, 24 Oct 2022 06:38:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=nh1tN4sZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232481AbiJXNWJ (ORCPT + 99 others); Mon, 24 Oct 2022 09:22:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56512 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232806AbiJXNU6 (ORCPT ); Mon, 24 Oct 2022 09:20:58 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 72459357F5; Mon, 24 Oct 2022 05:29:16 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id B622BB811FC; Mon, 24 Oct 2022 12:03:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0CC01C433D6; Mon, 24 Oct 2022 12:03:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613014; bh=iw48475QRx7v4s8qbBNZI1Ai7GbAlZtxcpRYI/WKWcM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nh1tN4sZgItK94DW18XZkpwDfyS6sMVwf/Moqn5aXHfP0bLy8KkchPYkn3KqFAr1y o40h+JIt9lNrLtAT+Kjsg4X4oiJ1vPwOKCFdqp8vuyIFnanvPbheshgDnqjc5rkwDr vs8W14xOja0NMsMvc23t1oS5aQJQq7G6T5/mQgw4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alexander Stein , Shawn Guo , Sasha Levin Subject: [PATCH 4.19 205/229] ARM: dts: imx6sll: add missing properties for sram Date: Mon, 24 Oct 2022 13:32:04 +0200 Message-Id: <20221024113005.817126408@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747576382746741784?= X-GMAIL-MSGID: =?utf-8?q?1747576382746741784?= From: Alexander Stein [ Upstream commit 7492a83ed9b7a151e2dd11d64b06da7a7f0fa7f9 ] All 3 properties are required by sram.yaml. Fixes the dtbs_check warning: sram@900000: '#address-cells' is a required property sram@900000: '#size-cells' is a required property sram@900000: 'ranges' is a required property Signed-off-by: Alexander Stein Signed-off-by: Shawn Guo Signed-off-by: Sasha Levin --- arch/arm/boot/dts/imx6sll.dtsi | 3 +++ 1 file changed, 3 insertions(+) diff --git a/arch/arm/boot/dts/imx6sll.dtsi b/arch/arm/boot/dts/imx6sll.dtsi index 7c7d5c47578e..d7d092a5522a 100644 --- a/arch/arm/boot/dts/imx6sll.dtsi +++ b/arch/arm/boot/dts/imx6sll.dtsi @@ -131,6 +131,9 @@ ocram: sram@900000 { compatible = "mmio-sram"; reg = <0x00900000 0x20000>; + ranges = <0 0x00900000 0x20000>; + #address-cells = <1>; + #size-cells = <1>; }; L2: l2-cache@a02000 { From patchwork Mon Oct 24 11:32:05 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9109 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp456108wru; Mon, 24 Oct 2022 06:33:35 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4EAZkeC+3stpm7cHui66vzT6ZT7wUsnHpWEf2quSgA2qJxo6a5J23qWxfWjFOjlQh3pVyd X-Received: by 2002:a05:6402:2813:b0:461:e7bc:560a with SMTP id h19-20020a056402281300b00461e7bc560amr2253853ede.340.1666618415237; Mon, 24 Oct 2022 06:33:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666618415; cv=none; d=google.com; s=arc-20160816; b=Pf0/VtYlSW6z//QpArrYYLdPyjj+rWKNkfvtEct7LtO+xNT/8S+c0RtON33d+m+xES KTxaOtnXvSSJXVsKaTMflC8WAan4zLB9+Q7ttuinNoaWNDfiN6uERYmZ4NeBIV06skda N47AqxBjj/MefoREjpuA4G9xtdvqGggthAsWTuCe94mruRj72Qi2yLDk5DZhlPB2KsTh pL+hnS1Fwt7MbvTx2znygSfrrtW6pFPy+h8W5crB5yS8MPyActc86vF4uKX7U6S5gMG0 YPjbt9oGyVXLyiTsGXMcYGhkhzAgO2y2Lf8N67bEP6iNZ3AzH69PbeHkKK+DVoecgMWQ aGHw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=HllRqmtUkzletW4sk+/s1sM1UU/XflJH8VgzqEBjAyo=; b=FvtnvX+MdhDnLdVwzK3DHBBnaCzWGvnT7dCkC+52Cdbdi6DkUubALxzaU8pXknQuB6 jiiqCnpMVzrO6k0ZJIlvNMmcHgP9QOkBMDXVLZ4gbmi8ES87eirjndhTUf5LUINDpyBX 4z0aZrT4Pv2aR1CMFJZjNn8OIuzCsCZ3/sW3o2oD3xnMgubW8VC4R1UHqrOQ3/4KvEpG D46pFF8X0jt1gloSiYK1vyQfOKcorqcVpvIzg9mJsE3PWWqqE3HVIT3PqYSnpIf44cdP jNl/6+c9PfBkJIqocszpppIXnLsVUXP5kYxbhtP927M9TshOyKI09H8GKgsGJDGnKyfp sp4Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=GQuN2duT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id et15-20020a056402378f00b004607378ae65si13061982edb.160.2022.10.24.06.33.10; Mon, 24 Oct 2022 06:33:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=GQuN2duT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235762AbiJXNP0 (ORCPT + 99 others); Mon, 24 Oct 2022 09:15:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45644 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235867AbiJXNOB (ORCPT ); Mon, 24 Oct 2022 09:14:01 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 509BB2B624; Mon, 24 Oct 2022 05:24:49 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 52B81B81201; Mon, 24 Oct 2022 12:03:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A17F1C433C1; Mon, 24 Oct 2022 12:03:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613017; bh=Iul5fpP5tJGolxNKlD+A7Fhp6lD0yeaECeZf6LI08pM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GQuN2duTuPgjCd99KzH7q/3rz1n3NHykS4tuWtT1UjUw9hxPIekiGZv+uhAStBj+e IjekT/jU1A4DNg8HhvNVBesNC5UuhYCcNSZEhllDCXReQUe/yJ1eZp1gX/dl93QAC4 NN9Bdw/oT+pTZdxdMIwkfVnFhNIe8IxXmepE2PZo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alexander Stein , Shawn Guo , Sasha Levin Subject: [PATCH 4.19 206/229] ARM: dts: imx6sx: add missing properties for sram Date: Mon, 24 Oct 2022 13:32:05 +0200 Message-Id: <20221024113005.863672739@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747576071594667532?= X-GMAIL-MSGID: =?utf-8?q?1747576071594667532?= From: Alexander Stein [ Upstream commit 415432c008b2bce8138841356ba444631cabaa50 ] All 3 properties are required by sram.yaml. Fixes the dtbs_check warning: sram@900000: '#address-cells' is a required property sram@900000: '#size-cells' is a required property sram@900000: 'ranges' is a required property Signed-off-by: Alexander Stein Signed-off-by: Shawn Guo Signed-off-by: Sasha Levin --- arch/arm/boot/dts/imx6sx.dtsi | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/arch/arm/boot/dts/imx6sx.dtsi b/arch/arm/boot/dts/imx6sx.dtsi index ae0728df542e..b9ab1118be30 100644 --- a/arch/arm/boot/dts/imx6sx.dtsi +++ b/arch/arm/boot/dts/imx6sx.dtsi @@ -167,12 +167,18 @@ ocram_s: sram@8f8000 { compatible = "mmio-sram"; reg = <0x008f8000 0x4000>; + ranges = <0 0x008f8000 0x4000>; + #address-cells = <1>; + #size-cells = <1>; clocks = <&clks IMX6SX_CLK_OCRAM_S>; }; ocram: sram@900000 { compatible = "mmio-sram"; reg = <0x00900000 0x20000>; + ranges = <0 0x00900000 0x20000>; + #address-cells = <1>; + #size-cells = <1>; clocks = <&clks IMX6SX_CLK_OCRAM>; }; From patchwork Mon Oct 24 11:32:06 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8834 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp431455wru; Mon, 24 Oct 2022 05:43:48 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7KD0SXUix7rawSVMTDeijf8H5gHeCMi1BVMp4gs8b0Y5d2/mV4uqQBBQhXohn6wCKc0Jxp X-Received: by 2002:a17:90b:4f46:b0:20d:1fe8:dcd2 with SMTP id pj6-20020a17090b4f4600b0020d1fe8dcd2mr73696756pjb.235.1666615427876; Mon, 24 Oct 2022 05:43:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666615427; cv=none; d=google.com; s=arc-20160816; b=ckjY75ZYKXjc0t9sTVDfUjIkGFhO4QIZq0hQzNxeiSWVLcjscXBCcICjwQgpuJ4s6F KJKc/zVl8+eX0oI00DlRhIFDoEO7wU+mXpaARql9kRBQb0+FkHDahMwmi1L3T1wOHY7a T3XtOQKjJzbhbG9fRjWIh2jCQrKea1MyIHbzbDiqQBu9pGgfxGAk0Hq/vWSW/mVGiq9q 5C+A5uq/cvlCyFXyRJmUV+53INl6Qd9qbIn5ryMtY2zfCFUl0H3/5gEuzc5BkBo3IO6U 1n1VDQGKPe5vlSf+Gdxaai9h5e7TqeSS/+ejY4YLb6a7Jx304KeuvLFQzx18vzkx4DcD Yp3g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=VBNY9/IGHuiPtZoiWxaV6gTrKzYGmUrxZbPiOzNJ8Yw=; b=CmOr8jPjsZocDwDtINdWwBIQGOv8JGhTBipZ6fpLM744aMnH+AtozkXDIeXsUQ3RRM P0PHT3DiVs8JKVkIl5xtqTCwde560T0fFKqriGYHEG3kTspBxXs/2tJZJp4eRdGtFcLI 7we7FIfxRjaJT2plWXABPXP2ZPf2zWYdBzguzNudrQrcRs2yKrXSCF19V0P79zmWdU2R 2ZdLUHM6Um3EybH53EjcpBMm6GnjlyVJ5ch+MYNLvyV/Y5j8/n3jPlpAJtT87KKAK2xi Q75tcMIuc/evRGGxtFEjF/VtxUVAcHidFocoM3ProUOewdsHJ2dEDtAcAbmN1vejfcTR io1g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ffGTDCxR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y16-20020a17090aa41000b0020d5c7ae3cbsi14457740pjp.38.2022.10.24.05.43.33; Mon, 24 Oct 2022 05:43:47 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ffGTDCxR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234674AbiJXMfl (ORCPT + 99 others); Mon, 24 Oct 2022 08:35:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53826 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234272AbiJXM3y (ORCPT ); Mon, 24 Oct 2022 08:29:54 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8C2CE2C10A; Mon, 24 Oct 2022 05:04:02 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 3456A6121A; Mon, 24 Oct 2022 12:03:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 436B7C433C1; Mon, 24 Oct 2022 12:03:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613019; bh=T5i1R27xp5nyi5Tgeqhglx5gFkApiPnJX27oHS5I4c0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ffGTDCxR/Ex2VJlspyYHGdCk/Fj6c+SRR4dTAKUxJX0qNIttqZ+Ck1reO6sbsuaT1 G3OfsYnhu3RKZPpeu+WdHjZAso8qEtMLsKAR4KDLVL5BLMsIm5d2dDdkgqgf8QRON6 eOrKjDlrNhwzQ9sECo6X7l2iTKnGZ5Z0kRfNTc8M= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zheyu Ma , Hans Verkuil , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 4.19 207/229] media: cx88: Fix a null-ptr-deref bug in buffer_prepare() Date: Mon, 24 Oct 2022 13:32:06 +0200 Message-Id: <20221024113005.892568251@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747572938685423657?= X-GMAIL-MSGID: =?utf-8?q?1747572938685423657?= From: Zheyu Ma [ Upstream commit 2b064d91440b33fba5b452f2d1b31f13ae911d71 ] When the driver calls cx88_risc_buffer() to prepare the buffer, the function call may fail, resulting in a empty buffer and null-ptr-deref later in buffer_queue(). The following log can reveal it: [ 41.822762] general protection fault, probably for non-canonical address 0xdffffc0000000000: 0000 [#1] PREEMPT SMP KASAN PTI [ 41.824488] KASAN: null-ptr-deref in range [0x0000000000000000-0x0000000000000007] [ 41.828027] RIP: 0010:buffer_queue+0xc2/0x500 [ 41.836311] Call Trace: [ 41.836945] __enqueue_in_driver+0x141/0x360 [ 41.837262] vb2_start_streaming+0x62/0x4a0 [ 41.838216] vb2_core_streamon+0x1da/0x2c0 [ 41.838516] __vb2_init_fileio+0x981/0xbc0 [ 41.839141] __vb2_perform_fileio+0xbf9/0x1120 [ 41.840072] vb2_fop_read+0x20e/0x400 [ 41.840346] v4l2_read+0x215/0x290 [ 41.840603] vfs_read+0x162/0x4c0 Fix this by checking the return value of cx88_risc_buffer() [hverkuil: fix coding style issues] Signed-off-by: Zheyu Ma Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin --- drivers/media/pci/cx88/cx88-vbi.c | 9 +++--- drivers/media/pci/cx88/cx88-video.c | 43 +++++++++++++++-------------- 2 files changed, 26 insertions(+), 26 deletions(-) diff --git a/drivers/media/pci/cx88/cx88-vbi.c b/drivers/media/pci/cx88/cx88-vbi.c index 58489ea0c1da..7cf2271866d0 100644 --- a/drivers/media/pci/cx88/cx88-vbi.c +++ b/drivers/media/pci/cx88/cx88-vbi.c @@ -144,11 +144,10 @@ static int buffer_prepare(struct vb2_buffer *vb) return -EINVAL; vb2_set_plane_payload(vb, 0, size); - cx88_risc_buffer(dev->pci, &buf->risc, sgt->sgl, - 0, VBI_LINE_LENGTH * lines, - VBI_LINE_LENGTH, 0, - lines); - return 0; + return cx88_risc_buffer(dev->pci, &buf->risc, sgt->sgl, + 0, VBI_LINE_LENGTH * lines, + VBI_LINE_LENGTH, 0, + lines); } static void buffer_finish(struct vb2_buffer *vb) diff --git a/drivers/media/pci/cx88/cx88-video.c b/drivers/media/pci/cx88/cx88-video.c index 248fb3b6833c..2bc5080198bb 100644 --- a/drivers/media/pci/cx88/cx88-video.c +++ b/drivers/media/pci/cx88/cx88-video.c @@ -452,6 +452,7 @@ static int queue_setup(struct vb2_queue *q, static int buffer_prepare(struct vb2_buffer *vb) { + int ret; struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb); struct cx8800_dev *dev = vb->vb2_queue->drv_priv; struct cx88_core *core = dev->core; @@ -466,35 +467,35 @@ static int buffer_prepare(struct vb2_buffer *vb) switch (core->field) { case V4L2_FIELD_TOP: - cx88_risc_buffer(dev->pci, &buf->risc, - sgt->sgl, 0, UNSET, - buf->bpl, 0, core->height); + ret = cx88_risc_buffer(dev->pci, &buf->risc, + sgt->sgl, 0, UNSET, + buf->bpl, 0, core->height); break; case V4L2_FIELD_BOTTOM: - cx88_risc_buffer(dev->pci, &buf->risc, - sgt->sgl, UNSET, 0, - buf->bpl, 0, core->height); + ret = cx88_risc_buffer(dev->pci, &buf->risc, + sgt->sgl, UNSET, 0, + buf->bpl, 0, core->height); break; case V4L2_FIELD_SEQ_TB: - cx88_risc_buffer(dev->pci, &buf->risc, - sgt->sgl, - 0, buf->bpl * (core->height >> 1), - buf->bpl, 0, - core->height >> 1); + ret = cx88_risc_buffer(dev->pci, &buf->risc, + sgt->sgl, + 0, buf->bpl * (core->height >> 1), + buf->bpl, 0, + core->height >> 1); break; case V4L2_FIELD_SEQ_BT: - cx88_risc_buffer(dev->pci, &buf->risc, - sgt->sgl, - buf->bpl * (core->height >> 1), 0, - buf->bpl, 0, - core->height >> 1); + ret = cx88_risc_buffer(dev->pci, &buf->risc, + sgt->sgl, + buf->bpl * (core->height >> 1), 0, + buf->bpl, 0, + core->height >> 1); break; case V4L2_FIELD_INTERLACED: default: - cx88_risc_buffer(dev->pci, &buf->risc, - sgt->sgl, 0, buf->bpl, - buf->bpl, buf->bpl, - core->height >> 1); + ret = cx88_risc_buffer(dev->pci, &buf->risc, + sgt->sgl, 0, buf->bpl, + buf->bpl, buf->bpl, + core->height >> 1); break; } dprintk(2, @@ -502,7 +503,7 @@ static int buffer_prepare(struct vb2_buffer *vb) buf, buf->vb.vb2_buf.index, core->width, core->height, dev->fmt->depth, dev->fmt->name, (unsigned long)buf->risc.dma); - return 0; + return ret; } static void buffer_finish(struct vb2_buffer *vb) From patchwork Mon Oct 24 11:32:07 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 10200 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp642039wru; Mon, 24 Oct 2022 13:37:12 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4IhETYnN4JZ6awmZZm3JqHV6QcO3wc48PgMN3kdgEMLgt81aUVBvsL8XU3NMLeZRVttnS5 X-Received: by 2002:a63:fa17:0:b0:43c:3f26:48e3 with SMTP id y23-20020a63fa17000000b0043c3f2648e3mr29757001pgh.66.1666643832472; Mon, 24 Oct 2022 13:37:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666643832; cv=none; d=google.com; s=arc-20160816; b=avc07hQFWithhE4OslUV20/E3Xg724Ma4urB+z5qrzZL55EoTNERzGu6zo52+6DyYb 0vPMlJB/zkOqHqNPuKzM1Sgw+Sjz+zsPOJFApmanwk9QarG+T1qmZtzkBEi2+3rsvzfd iLKfOoBJ5wv17eWIgwERuPLzEeVWbLxibSnjpP+7JKfSLZsoGkai57MBIj6mdu9KkGGv vyY+TfHbFCLkH8ivvdjaVlDkfiNvPbRnDfilDjJj+ZgRXBZSE0wgX+ZD80iMXkvkdM5J 8hcyQENKkY8bWSOo96zvirWowv5YcM9gv7QjqnkzaU1lmMSF4KagfsKrGKuOKT6AwvQg RMpg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=cucQtzdpCBD5y5fNHGKmYdu1OVFx2u50v8Gf6EwUYgE=; b=EZHGiQQPSuoxMY4XVI4p46R3nrksOl+RSuVJv9D2vwSrY6dsM78S0qeiYQLMOkJp4d N33sDIJvef7v7b/5wjQRW2/n3zk+EfRa77jEAXQoqmXa4zC5JqLzuXkdfW1vaQpMWIbL /jY+8LplT4Zj+pVIvmlpCv4CjA8EIjpqB1PUWsVTFZ4yLUr+JOpE6TIq0Uv4VQ1Iyut7 gum0hlW/lwixS8jEHupITFf+4gXw1EwERH8IQRzu28P7u0K/TvCE0a+vYf/WjgwKrWyl mkXKgUKm0ptvNo6Gu8m8VPJ5pxNEFGX99v6QbSyaeTmjEaKUaQEPcbkI9bqUV2zzXo2u a7lw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=wtMp5BLP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id pg16-20020a17090b1e1000b0020dbd4207fasi13046173pjb.46.2022.10.24.13.36.59; Mon, 24 Oct 2022 13:37:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=wtMp5BLP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232901AbiJXUaM (ORCPT + 99 others); Mon, 24 Oct 2022 16:30:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50002 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234618AbiJXU3c (ORCPT ); Mon, 24 Oct 2022 16:29:32 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A5701EC50F; Mon, 24 Oct 2022 11:42:20 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 8DB08B811FF; Mon, 24 Oct 2022 12:03:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E1333C433D6; Mon, 24 Oct 2022 12:03:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613022; bh=YzIQwmqfE2s9hKK5FABSVnPtBIwFJRppvwDBQ0Ueq18=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wtMp5BLPf8LHFOrMsPaxsKWJxVC0e4XcmtKVVF9NwowrUHQhOgP20H106QzWzPj9q yWmpU+F0Bp0l0jLceIDSYN1o+dxQrtQcxoNR4N1OB1FqV9JXlem4X9etjLIdIOUflI DMKCVWJodr9wNR0rb0pXqbX8NC9nO++TQq55XWoo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zheyu Ma , Letu Ren , "Martin K. Petersen" , Sasha Levin Subject: [PATCH 4.19 208/229] scsi: 3w-9xxx: Avoid disabling device if failing to enable it Date: Mon, 24 Oct 2022 13:32:07 +0200 Message-Id: <20221024113005.922926283@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747602723605446698?= X-GMAIL-MSGID: =?utf-8?q?1747602723605446698?= From: Letu Ren [ Upstream commit 7eff437b5ee1309b34667844361c6bbb5c97df05 ] The original code will "goto out_disable_device" and call pci_disable_device() if pci_enable_device() fails. The kernel will generate a warning message like "3w-9xxx 0000:00:05.0: disabling already-disabled device". We shouldn't disable a device that failed to be enabled. A simple return is fine. Link: https://lore.kernel.org/r/20220829110115.38789-1-fantasquex@gmail.com Reported-by: Zheyu Ma Signed-off-by: Letu Ren Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin --- drivers/scsi/3w-9xxx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/scsi/3w-9xxx.c b/drivers/scsi/3w-9xxx.c index 27521fc3ef5a..ea2cd8ecc3a5 100644 --- a/drivers/scsi/3w-9xxx.c +++ b/drivers/scsi/3w-9xxx.c @@ -2009,7 +2009,7 @@ static int twa_probe(struct pci_dev *pdev, const struct pci_device_id *dev_id) retval = pci_enable_device(pdev); if (retval) { TW_PRINTK(host, TW_DRIVER, 0x34, "Failed to enable pci device"); - goto out_disable_device; + return -ENODEV; } pci_set_master(pdev); From patchwork Mon Oct 24 11:32:08 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 10310 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp656376wru; Mon, 24 Oct 2022 14:17:54 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6CuYsfF9WCn5BYoSBuZvJxLqQKTgPY7UP44pPfl1dkyYq2lZ2gnGXS+IQYhsLEIAlV0YeK X-Received: by 2002:a17:90b:4c8b:b0:213:ec:4431 with SMTP id my11-20020a17090b4c8b00b0021300ec4431mr10109685pjb.20.1666646274442; Mon, 24 Oct 2022 14:17:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666646274; cv=none; d=google.com; s=arc-20160816; b=I5GWRaWBq54e/2keLdKz/wRIHq0Q2zfa6R9I6d3tgvksUKuVALuJHbdLLbvckcytOY i21ECV8hKBRa7/AmBSI112EJbX9fgpLXcnqe9jkqpBPjYi0LrRxlxVTKHabmF0r0/56P w6gsoEAWW3Uq2pnifWSMGNSMvp0MTYia08GGBcSUbf6YUymgYpHnqK/qpXUrUA8aq0Wc S+HJMswDhpGdXBKm99gwANm4ez0rku0yvbly/BDG4iJgUxhMf18k27rwa4X1wNPENtLe a6IY4gUmPl5iQ97LGmmLGyVEuqADTWnlgYoTbc18G7Y5H0zrnHAfxHg1J0emDBT1OCY1 BQ+Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=5gs6Qd7Jc5ZFe97NMyU7u3ZUueb7WRbdIpeOiS/sr+M=; b=CGmFJCyvvPXvI0vdrbOHFTatuSO0cIKj2bpvxN9FwaHEwQdaYyfQF71bzp4YX2We/R gn1BXUXpctewlY8IvTT6zWlol1qoVLFD10choA58RET5ef0oZ4g9dwnTihs6MVzDlD+g MhEWlws38D4TiAUoDMpQiPJslyE4hHcYx0In30lPqlfeJ1oz7z8rPJTK5VUm2BTEFz6d 7Rni1aLCTP7Ax8k86GMhbnTAMd43rS2GKEhZ2QII/BK75R1Y3Wt2b9O1w2AHnSkE5VC/ rIynmFj9/t9yS6zKE4av4ibmF/G+p5+W6wPat8hAFtiZeuqSvkHgEsNZhsiEXYVIw9C4 9EfQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ZChTQCb0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e3-20020a170902cf4300b0017f908814c6si608114plg.532.2022.10.24.14.17.40; Mon, 24 Oct 2022 14:17:54 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ZChTQCb0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230338AbiJXVRP (ORCPT + 99 others); Mon, 24 Oct 2022 17:17:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46898 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233589AbiJXVQj (ORCPT ); Mon, 24 Oct 2022 17:16:39 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C4849153E01; Mon, 24 Oct 2022 12:22:16 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 33A4DB811E0; Mon, 24 Oct 2022 12:03:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 87166C433D6; Mon, 24 Oct 2022 12:03:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613024; bh=LEl6rAYkaTCrqCjHts82zcSQepTHnV6TX+kZhzawsB0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZChTQCb0vGcdIMH2BsgdJMiOsM6SuEVSRHmsOxQoXPeKcOMEjHwHy2B3sNbGc+Qi8 JkrKfhlsVFtnCwKYZnBFeZ8m/DpkyHDrQ/xFX9Ih+i+aVcXvLwjYIMNfl3Po3CxY88 Zr/GsfA2NW2qgJFzSCGU8vro1RFE5SsLzKyL+WCs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, syzbot+38e6c55d4969a14c1534@syzkaller.appspotmail.com, Shigeru Yoshida , Josef Bacik , Jens Axboe , Sasha Levin Subject: [PATCH 4.19 209/229] nbd: Fix hung when signal interrupts nbd_start_device_ioctl() Date: Mon, 24 Oct 2022 13:32:08 +0200 Message-Id: <20221024113005.961123796@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747605283891537713?= X-GMAIL-MSGID: =?utf-8?q?1747605283891537713?= From: Shigeru Yoshida [ Upstream commit 1de7c3cf48fc41cd95adb12bd1ea9033a917798a ] syzbot reported hung task [1]. The following program is a simplified version of the reproducer: int main(void) { int sv[2], fd; if (socketpair(AF_UNIX, SOCK_STREAM, 0, sv) < 0) return 1; if ((fd = open("/dev/nbd0", 0)) < 0) return 1; if (ioctl(fd, NBD_SET_SIZE_BLOCKS, 0x81) < 0) return 1; if (ioctl(fd, NBD_SET_SOCK, sv[0]) < 0) return 1; if (ioctl(fd, NBD_DO_IT) < 0) return 1; return 0; } When signal interrupt nbd_start_device_ioctl() waiting the condition atomic_read(&config->recv_threads) == 0, the task can hung because it waits the completion of the inflight IOs. This patch fixes the issue by clearing queue, not just shutdown, when signal interrupt nbd_start_device_ioctl(). Link: https://syzkaller.appspot.com/bug?id=7d89a3ffacd2b83fdd39549bc4d8e0a89ef21239 [1] Reported-by: syzbot+38e6c55d4969a14c1534@syzkaller.appspotmail.com Signed-off-by: Shigeru Yoshida Reviewed-by: Josef Bacik Link: https://lore.kernel.org/r/20220907163502.577561-1-syoshida@redhat.com Signed-off-by: Jens Axboe Signed-off-by: Sasha Levin --- drivers/block/nbd.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c index 2ef7eec6461c..cc66983e8b6a 100644 --- a/drivers/block/nbd.c +++ b/drivers/block/nbd.c @@ -1271,10 +1271,12 @@ static int nbd_start_device_ioctl(struct nbd_device *nbd, struct block_device *b mutex_unlock(&nbd->config_lock); ret = wait_event_interruptible(config->recv_wq, atomic_read(&config->recv_threads) == 0); - if (ret) + if (ret) { sock_shutdown(nbd); - flush_workqueue(nbd->recv_workq); + nbd_clear_que(nbd); + } + flush_workqueue(nbd->recv_workq); mutex_lock(&nbd->config_lock); nbd_bdev_reset(bdev); /* user requested, ignore socket errors */ From patchwork Mon Oct 24 11:32:09 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9825 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp555239wru; Mon, 24 Oct 2022 09:59:22 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4cv/bNldr5eqx9m0J4HtZnx/quHD74vVvmRCx47UgtZt2U5vxt6c+VG3CZ/mn0xW9FZC9z X-Received: by 2002:a17:906:8a46:b0:7a0:b8ee:ac06 with SMTP id gx6-20020a1709068a4600b007a0b8eeac06mr11496899ejc.42.1666630762297; Mon, 24 Oct 2022 09:59:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666630762; cv=none; d=google.com; s=arc-20160816; b=iROVdDkfsfUeC32I190rgrSlT56QiIXmPR7AKDGNxhtCt0Z1FN7jyJq71255Nyvuwa prlSVSS0aOlaDGRHrqpJTcihtR0sWFOPleZrk1+wGe9eCMoHEqL2yiYY5dKyPhfnV1yr UvT+UJmmmUIMRgz9Y4kBVpOvIruLg3+0c0ztQ1vTfWGtHguQkCa0B2CgrKD/7i4YfSBB iQr7n2GigT2bvMREPnuLIShtK7Y2RAzkTheow1g4As92iU9I5kczhXjXLaSsrN/jji/u 5BWOub0KgjCS8MiFi2HWcoEKPHNwP9Pylf8hoWW8whDKbHEDv4aOK/p2s37uGhQM+J7Q wQkg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=H7/P9iODaKC4Rx7yhrYbvBxQwBMbLB5+b17qzc6SIJw=; b=GVhlKoZ+NbfrjDgwXnnD1jFLE6eKUeRaoov19fOQOJfOQZIDUKahoN4fbp4XG9cU7q IEureC51JVKI355YEx7rtuXAy8qo/w/i0yNlZYT2ZWreRbaBS79Sumltd3lm4N50tu0w X3zBPjpR26jHxCU9UqgvLWN0l4MACNOqw62QmFhJWFRT9PePKwERQhsGXzAtmXLWCFYG dGBdZ1LryJNNxGlWGt2bvnn7iO6vOZN3MKRkJQ7aExd09+SjTz3SspSOONXsx4nF6Irs yd9ZuUlRCKQnnxALeDviuGLYANSXNAkGCrpbJtzQlgILkdDGvf0C/xzaoEqDEo4paeKh 4zQw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=R9T2TNYE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id tl25-20020a170907c31900b007309eb6dcbfsi213907ejc.372.2022.10.24.09.58.53; Mon, 24 Oct 2022 09:59:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=R9T2TNYE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231186AbiJXQxP (ORCPT + 99 others); Mon, 24 Oct 2022 12:53:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52298 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235335AbiJXQtZ (ORCPT ); Mon, 24 Oct 2022 12:49:25 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B48CD65B7; Mon, 24 Oct 2022 08:32:28 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id CBCA9B81203; Mon, 24 Oct 2022 12:03:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2D226C433D6; Mon, 24 Oct 2022 12:03:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613027; bh=ksRKJY5TQUMx/Q1CSvNcnmyPvkMbckLSJ11m16BwXMg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=R9T2TNYEwUG4oLRdtWJadhBzfUFM2bwc+RgqNV9OEH/GPRyJhJZl3nsD3CqjWL33p ZVU3f93G2iY6EPSRkXPjRfFNOAvGZS5cZg0qxptXAKbVwMY9drbhSpTn0i3ha3fBKp ptzXbSN5Qyd4bV3gWr46OBPCbDF967t/MZe1FRic= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Wei Yongjun , Michael Hennerich , Sebastian Reichel , Sasha Levin Subject: [PATCH 4.19 210/229] power: supply: adp5061: fix out-of-bounds read in adp5061_get_chg_type() Date: Mon, 24 Oct 2022 13:32:09 +0200 Message-Id: <20221024113005.989970320@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747589017975327620?= X-GMAIL-MSGID: =?utf-8?q?1747589017975327620?= From: Wei Yongjun [ Upstream commit 9d47e01b9d807808224347935562f7043a358054 ] ADP5061_CHG_STATUS_1_CHG_STATUS is masked with 0x07, which means a length of 8, but adp5061_chg_type array size is 4, may end up reading 4 elements beyond the end of the adp5061_chg_type[] array. Signed-off-by: Wei Yongjun Acked-by: Michael Hennerich Signed-off-by: Sebastian Reichel Signed-off-by: Sasha Levin --- drivers/power/supply/adp5061.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/power/supply/adp5061.c b/drivers/power/supply/adp5061.c index 939fd3d8fb1a..1ad044330599 100644 --- a/drivers/power/supply/adp5061.c +++ b/drivers/power/supply/adp5061.c @@ -428,11 +428,11 @@ static int adp5061_get_chg_type(struct adp5061_state *st, if (ret < 0) return ret; - chg_type = adp5061_chg_type[ADP5061_CHG_STATUS_1_CHG_STATUS(status1)]; - if (chg_type > ADP5061_CHG_FAST_CV) + chg_type = ADP5061_CHG_STATUS_1_CHG_STATUS(status1); + if (chg_type >= ARRAY_SIZE(adp5061_chg_type)) val->intval = POWER_SUPPLY_STATUS_UNKNOWN; else - val->intval = chg_type; + val->intval = adp5061_chg_type[chg_type]; return ret; } From patchwork Mon Oct 24 11:32:10 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9129 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp456464wru; Mon, 24 Oct 2022 06:34:14 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4slmM7h5s6ZF2y6wUJC3AVJYbxw4vG7Q4EUirSZP93Jtz39+lOKCeCNWsZgu29kunus4wS X-Received: by 2002:a17:907:5ce:b0:730:bae0:deb with SMTP id wg14-20020a17090705ce00b00730bae00debmr28625586ejb.181.1666618454463; Mon, 24 Oct 2022 06:34:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666618454; cv=none; d=google.com; s=arc-20160816; b=Go1U87ChtolmROwupYMHwLmXsU804Uz4UjdWjtIUqjqJ0bBE7vtGk5h9rB1ZWUgi8Q E+l0XNGPx/SoTtsZ6h1qR8gvnrXNyTx4Oes4a7m0NvmeBnNxuVEpxkwTqsSJXBL+str0 jtdho6k30tIV30iotNzfJ3IZp5FSfXSpXwEsTX5kET8dSof6cYL3/hKZUzbN31oYSBRc PALMdoa4KbKhkWw+KhRd0nkEWB3Eie0DawvqkTY0MIk1my0GByEmGTPndqINlym6lMGD lQ84GacEySXWcsZ29AhZ9AYuAx862RGZWlSahme3LV/GH8SjMa1baQ6vJxitJOS3+UTI 2LZg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=2Y3xQ8pO/9EUUdxrzSLB/ddlZ/VI5zSm4w1aaADmRS4=; b=FTy9ga0+XhhR2YPPAivz+WGfp8bxyQ9EwNs88QlQOBNXlSnsmL7f/PtZcjG+Vfgdtk eBjZZeTHOgAYJ5LdRPcM3KVC6+ubUZ1VZmPpyPQhC4IbG2a/38ZMlJ12aVChfGe35qIa lPZiyvZR1tkLbrUBVze1f3xYkugXzErrimJTM0NUTYHY3R2BEdRZnOTO6HwCSa/rsNZS mZbz/rMrfjlcdh1y2PlMq/2UmY1w8/7fSY14Q0iyglkPR1empc8WAQayi+rUsGORHmSP 4pUhQu6jdRT7vUC/xL80yrXmTLnWMr5qaLQnScEco0wBqTSMJHRctq9e+C9m95YbOdoG jxiQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=0dgQiFvr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q26-20020a056402249a00b00461dfe5f99bsi1730948eda.298.2022.10.24.06.33.42; Mon, 24 Oct 2022 06:34:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=0dgQiFvr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233052AbiJXNU7 (ORCPT + 99 others); Mon, 24 Oct 2022 09:20:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50476 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236102AbiJXNTV (ORCPT ); Mon, 24 Oct 2022 09:19:21 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A17CE855BE; Mon, 24 Oct 2022 05:27:49 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 72B14B811FE; Mon, 24 Oct 2022 12:03:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C1A7DC433D6; Mon, 24 Oct 2022 12:03:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613030; bh=59+QkenSEeOZ5nRSlBDnxK3mpHjFK5Nv+cNK/g2hqec=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0dgQiFvrIp1/Lzjv5hLftCaIgs2zbtk8gL3ckkKXf7asDrj3NMhBpxIuqrATB/zMZ oUl1Qw5YzvDpntOlogVPpWqdadxq0/J4ph6P40QXBpts/+3htP5EVIB0CYTqK2dLCp op9pgQFrtdFYztsBhq4Oz7HcxcPoTuxESTxyyDiA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Philipp Hortmann , Nam Cao , Sasha Levin Subject: [PATCH 4.19 211/229] staging: vt6655: fix potential memory leak Date: Mon, 24 Oct 2022 13:32:10 +0200 Message-Id: <20221024113006.033066607@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747576112505802233?= X-GMAIL-MSGID: =?utf-8?q?1747576112505802233?= From: Nam Cao [ Upstream commit c8ff91535880d41b49699b3829fb6151942de29e ] In function device_init_td0_ring, memory is allocated for member td_info of priv->apTD0Rings[i], with i increasing from 0. In case of allocation failure, the memory is freed in reversed order, with i decreasing to 0. However, the case i=0 is left out and thus memory is leaked. Modify the memory freeing loop to include the case i=0. Tested-by: Philipp Hortmann Signed-off-by: Nam Cao Link: https://lore.kernel.org/r/20220909141338.19343-1-namcaov@gmail.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/staging/vt6655/device_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/vt6655/device_main.c b/drivers/staging/vt6655/device_main.c index cf86b1efa821..4c4432adb6c9 100644 --- a/drivers/staging/vt6655/device_main.c +++ b/drivers/staging/vt6655/device_main.c @@ -677,7 +677,7 @@ static int device_init_td0_ring(struct vnt_private *priv) return 0; err_free_desc: - while (--i) { + while (i--) { desc = &priv->apTD0Rings[i]; kfree(desc->td_info); } From patchwork Mon Oct 24 11:32:11 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9812 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp554949wru; Mon, 24 Oct 2022 09:58:34 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7VMvQMSGcL6FYe/F9B2fQUHnsiGLdB17krWC0hMu8RuLosXw7Zgcv+Gz/SXDedmQZEKdt6 X-Received: by 2002:a17:90b:3891:b0:20d:59e3:1f4f with SMTP id mu17-20020a17090b389100b0020d59e31f4fmr39187486pjb.21.1666630713872; Mon, 24 Oct 2022 09:58:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666630713; cv=none; d=google.com; s=arc-20160816; b=QEEZV6oUhrQHZJ8bRVVFoPCXk+vUMfCnA6TVtRlwUD83FpbNUBhiKiwtPcZ/9N0PBi 2RJ270Tm8V0BtBvsFjC50/IG5We7RhQIZ9r03wDe3fFG2TClYj4Pd0rKYdFccxp9MhF4 wxTGt4Vuffm08AbYPXzufUwhMR/nf1ywMH9m+fk5QFzSIU3VsWNctTiHU6BvUIC75EAy WBPs3kdoelOhZl9DZ0KtWPEUWuNW2yzuEwcRKJYbZR/HzDEgTrj9Q921L1wQzy1cBaDn kVxj+kQ7wId9VlJB7yfVAYnvg158DSzXnTlCed5h6dxJIum197URAJa6lJXGjmCEnn/Y X+Lw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=9KBkjjH7Xhmv+crps0BG9KhyF+6+ZDXrsKPBAJdvD7k=; b=i32mkvedaR9Ufdb9b2P167r7lswxrHBU6WqJ7El1V2A6c2vmHP/U92NlygpsiDa++/ I5HY4i7UcdnAlUFlW+gidssVtFsCJz4g96buKSko+G0HFUQa4LkCJxqlEqVg0TdPOQJt Rr84cu8cID2n/RjqDQ1HfZkYN8nEQRWGweFzyCtxMMH3oY0fVWbKqBxK1pGWq36HRLE1 Ea6GnEKBE0kvtFTgHo7Qme74wMnaKsGiTE/s6JLkgv9Hf8hh4bJMcGYP+x0WN92/bYs+ 1/cdjcalW4opuJFLOFiGIUykYTC3/POrSRYc6cPQJ+ittaoBDhBXONzFwoEmoGBNhkcM +m9Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=rTii2JrY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z10-20020a170902d54a00b001869e76bbe3si5583711plf.487.2022.10.24.09.58.10; Mon, 24 Oct 2022 09:58:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=rTii2JrY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235533AbiJXQym (ORCPT + 99 others); Mon, 24 Oct 2022 12:54:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56918 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235491AbiJXQtq (ORCPT ); Mon, 24 Oct 2022 12:49:46 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 49C451F2E5; Mon, 24 Oct 2022 08:33:00 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 09FB0B811C9; Mon, 24 Oct 2022 12:03:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 65D9AC433C1; Mon, 24 Oct 2022 12:03:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613032; bh=8VBt0TV070VIaruyQ4lTpvVLgKOxHaLZWr95D3YRDZk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rTii2JrYBLYmz8cilJgRAIGpZ9Us514olfli1QJBlriIX0oNPO519bBT755iWNDcJ oLj3wks+TwCwmDCG3SuA09QFP6iVAsnoVRauxNfZJC29We8eSJmMpiK7Iq+rqP3rF8 tK+YTAwZorR7UE48bugPGSVH7rwEivGPO1QeEbbM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Serge Semin , Hannes Reinecke , Damien Le Moal , Sasha Levin Subject: [PATCH 4.19 212/229] ata: libahci_platform: Sanity check the DT child nodes number Date: Mon, 24 Oct 2022 13:32:11 +0200 Message-Id: <20221024113006.073177126@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747588967696684680?= X-GMAIL-MSGID: =?utf-8?q?1747588967696684680?= From: Serge Semin [ Upstream commit 3c132ea6508b34956e5ed88d04936983ec230601 ] Having greater than AHCI_MAX_PORTS (32) ports detected isn't that critical from the further AHCI-platform initialization point of view since exceeding the ports upper limit will cause allocating more resources than will be used afterwards. But detecting too many child DT-nodes doesn't seem right since it's very unlikely to have it on an ordinary platform. In accordance with the AHCI specification there can't be more than 32 ports implemented at least due to having the CAP.NP field of 5 bits wide and the PI register of dword size. Thus if such situation is found the DTB must have been corrupted and the data read from it shouldn't be reliable. Let's consider that as an erroneous situation and halt further resources allocation. Note it's logically more correct to have the nports set only after the initialization value is checked for being sane. So while at it let's make sure nports is assigned with a correct value. Signed-off-by: Serge Semin Reviewed-by: Hannes Reinecke Signed-off-by: Damien Le Moal Signed-off-by: Sasha Levin --- drivers/ata/libahci_platform.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/drivers/ata/libahci_platform.c b/drivers/ata/libahci_platform.c index 6a55aac0c60f..63086f90bbf8 100644 --- a/drivers/ata/libahci_platform.c +++ b/drivers/ata/libahci_platform.c @@ -421,14 +421,24 @@ struct ahci_host_priv *ahci_platform_get_resources(struct platform_device *pdev, } } - hpriv->nports = child_nodes = of_get_child_count(dev->of_node); + /* + * Too many sub-nodes most likely means having something wrong with + * the firmware. + */ + child_nodes = of_get_child_count(dev->of_node); + if (child_nodes > AHCI_MAX_PORTS) { + rc = -EINVAL; + goto err_out; + } /* * If no sub-node was found, we still need to set nports to * one in order to be able to use the * ahci_platform_[en|dis]able_[phys|regulators] functions. */ - if (!child_nodes) + if (child_nodes) + hpriv->nports = child_nodes; + else hpriv->nports = 1; hpriv->phys = devm_kcalloc(dev, hpriv->nports, sizeof(*hpriv->phys), GFP_KERNEL); From patchwork Mon Oct 24 11:32:12 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8817 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp431104wru; Mon, 24 Oct 2022 05:42:59 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4A//cIxJF+Hit4icacrjzsjcSUz7WYK3u/YbdWaQ0f8BayRwnBOgh6bHmOkLuC703yfF3c X-Received: by 2002:a17:90b:3141:b0:20d:49d6:30c with SMTP id ip1-20020a17090b314100b0020d49d6030cmr37826287pjb.175.1666615379234; Mon, 24 Oct 2022 05:42:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666615379; cv=none; d=google.com; s=arc-20160816; b=KD2z+9Yc2WDFuKaQQRcx0xJt/I+dNo3RaFVycZjRbz9pUV5J50R3Ijouf1gKR41AuH G5Dq2SKQqPCQDh9lJPPatsCGW16mV+cD3QrwlDfqW2DaCO5AtM01heKYdddFYhFm3YGt u8okzpC1sQzyPIkgTlmPPlwR/QjTcmucSsE0VxE3M/isVVu7hCT5d2cOQm2qmMShmeR9 eFMLTcOb7vzzIdob/u1fNkbFoCujet0s58V4cFJm7tXklpZObJY5EvZ9Q3MK7yb4RjDB wbCBv1Y5TtYvtRR78iggdbeI/QEFCFUsu+uF5/BAw23dXlGL5RhPsUjgJS/0gLZlISMx 37OQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=G4uk5i0+bSWrpOOfmEy9duYbhh6NtBcqcwNkOLDhaDI=; b=DIGCtz15VylBWw/v8lJay3tlinNTxBLPKlqM3oYGk8LiAtsgloNYnSnh0YISXBEcmR OMa5I5H0aCvvgz9Wa4nspsVO8meLBZJ2e37ZjAwmrhhVwH3rZTQcO7/arl4GglWbTJua MPmANr0tQFwSzrfuk4hc2+ZpTHmp/kgyIP+cU4by/x0OhhPAx4BhR1/UZQ9w5caxmfqf 5xfzdzYmQ0ZQ54qFCJSOuQmviKDozXdsvBaItZMcBKU7QlaHqLT7x3gT+wgcXI3qkXmN Iqa8KaQ+Xk7e+CjPcQfWZ6KXcO9q+A6E31u0q1HRVbaYKJ9mfUj5OgTwkHbMpSHK5u4i ktQg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=YbdfvEj2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c18-20020a056a000ad200b0050d80e4935fsi34330206pfl.256.2022.10.24.05.42.44; Mon, 24 Oct 2022 05:42:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=YbdfvEj2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230396AbiJXMgM (ORCPT + 99 others); Mon, 24 Oct 2022 08:36:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52592 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234323AbiJXMaB (ORCPT ); Mon, 24 Oct 2022 08:30:01 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 545A2356EA; Mon, 24 Oct 2022 05:04:04 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 8719361295; Mon, 24 Oct 2022 12:03:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 97DDEC433C1; Mon, 24 Oct 2022 12:03:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613038; bh=c9KwSiNVgBXBuKA/mG8YVGWL/opA9IdLJkp3LRCodbs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YbdfvEj2ScSh0UmzMbT1QJW7K6CYLcMSa0fKiiFBbkyzMU1tbZiO8Xqt64YeUyBKz Igf9Af0s5Iqb/bkXdMhOWIFo1HarNc+rD93h6zF3+iBNV+CW4DV9CnTPtnNNM9484h MohChdSypAjREgukUwIcX3ExhvFHDQYD9iGEC9cM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hyunwoo Kim , Jiri Kosina , Sasha Levin Subject: [PATCH 4.19 213/229] HID: roccat: Fix use-after-free in roccat_read() Date: Mon, 24 Oct 2022 13:32:12 +0200 Message-Id: <20221024113006.104138122@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747572888026163546?= X-GMAIL-MSGID: =?utf-8?q?1747572888026163546?= From: Hyunwoo Kim [ Upstream commit cacdb14b1c8d3804a3a7d31773bc7569837b71a4 ] roccat_report_event() is responsible for registering roccat-related reports in struct roccat_device. int roccat_report_event(int minor, u8 const *data) { struct roccat_device *device; struct roccat_reader *reader; struct roccat_report *report; uint8_t *new_value; device = devices[minor]; new_value = kmemdup(data, device->report_size, GFP_ATOMIC); if (!new_value) return -ENOMEM; report = &device->cbuf[device->cbuf_end]; /* passing NULL is safe */ kfree(report->value); ... The registered report is stored in the struct roccat_device member "struct roccat_report cbuf[ROCCAT_CBUF_SIZE];". If more reports are received than the "ROCCAT_CBUF_SIZE" value, kfree() the saved report from cbuf[0] and allocates a new reprot. Since there is no lock when this kfree() is performed, kfree() can be performed even while reading the saved report. static ssize_t roccat_read(struct file *file, char __user *buffer, size_t count, loff_t *ppos) { struct roccat_reader *reader = file->private_data; struct roccat_device *device = reader->device; struct roccat_report *report; ssize_t retval = 0, len; DECLARE_WAITQUEUE(wait, current); mutex_lock(&device->cbuf_lock); ... report = &device->cbuf[reader->cbuf_start]; /* * If report is larger than requested amount of data, rest of report * is lost! */ len = device->report_size > count ? count : device->report_size; if (copy_to_user(buffer, report->value, len)) { retval = -EFAULT; goto exit_unlock; } ... The roccat_read() function receives the device->cbuf report and delivers it to the user through copy_to_user(). If the N+ROCCAT_CBUF_SIZE th report is received while copying of the Nth report->value is in progress, the pointer that copy_to_user() is working on is kfree()ed and UAF read may occur. (race condition) Since the device node of this driver does not set separate permissions, this is not a security vulnerability, but because it is used for requesting screen display of profile or dpi settings, a user using the roccat device can apply udev to this device node or There is a possibility to use it by giving. Signed-off-by: Hyunwoo Kim Signed-off-by: Jiri Kosina Signed-off-by: Sasha Levin --- drivers/hid/hid-roccat.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/hid/hid-roccat.c b/drivers/hid/hid-roccat.c index 5be8de70c651..c9cec00b4e6e 100644 --- a/drivers/hid/hid-roccat.c +++ b/drivers/hid/hid-roccat.c @@ -260,6 +260,8 @@ int roccat_report_event(int minor, u8 const *data) if (!new_value) return -ENOMEM; + mutex_lock(&device->cbuf_lock); + report = &device->cbuf[device->cbuf_end]; /* passing NULL is safe */ @@ -279,6 +281,8 @@ int roccat_report_event(int minor, u8 const *data) reader->cbuf_start = (reader->cbuf_start + 1) % ROCCAT_CBUF_SIZE; } + mutex_unlock(&device->cbuf_lock); + wake_up_interruptible(&device->wait); return 0; } From patchwork Mon Oct 24 11:32:13 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 10213 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp642542wru; Mon, 24 Oct 2022 13:38:46 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6CujaQRj8XG3un0vzcNTqJF6/99246NcCX2wriOGvtln0aNPeWbypJGgj/2dk+MYe7IROU X-Received: by 2002:a17:902:e395:b0:186:9cf7:3147 with SMTP id g21-20020a170902e39500b001869cf73147mr9993148ple.52.1666643926596; Mon, 24 Oct 2022 13:38:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666643926; cv=none; d=google.com; s=arc-20160816; b=ccV06Pik8j7ciyLtca7Q1HxZ4RTlLNMw7W+vhU9HwXzkMV9ppSKMIx1wq13m65MlEJ 3xby8+T3azDHU15x4Imuy9dls0BvCLnatSY04raIS7HxY2foZOlSJFLurfeO3Pg3Hrtl lQ7+ZZedvTYVCF8n62a7cqpIInoDtw73TYNY42wyAjh9gh+89APO6E+Cn83nDqsBoKWX kiyN4vcvlhMlts1P0F+6VRFV24Abdg0j3OMo4XgtRfHIzEaj5TB+yMmvS6L2UrqAsdzV JPnqRbWc3R79fO7qvYIpDlSIxH0NbKFD+lUrUn1RmVkOuUIG7bC24H4f9HJlou8zFPTd vwFQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=NPiKhnt1rGJktPXkxh8CMNyaa5P6w6mOGhWrqr0ocl8=; b=f5Xnu+XT5Tnh6U1s55SLIWvxvHr5arkpxA/6CNR0VLFlnEO6ClrKs9AJZPyHmyBq6s ElmXXkk5Tqv3h7XjbbH3JLjKIFvHqXotI4cQXwKSczSNjoSFuKgmdDWjqjVY4+g6pXMh q1YKpoCAknsqx0q3LGfH3AaJhNGEcBkBLwO3vpoxqsW7BNAk0d3/Bvw2G8oHM5dBD77q uSIff8U0yM5DpJT7kzQtm98vFSgA6mk2bHC6ZHP2TUP8wHSxwemvPWIjPvf3bZLBdGS/ OwjRRVMEF1kXh1TlnvbAnwau9cDRO2asTOGtOm2o+1I8Kgs+0Vyep5obXiZnbN2VjZV7 8eHA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=d+qtJV0G; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z12-20020a1709028f8c00b0018262dc4e92si477229plo.241.2022.10.24.13.38.31; Mon, 24 Oct 2022 13:38:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=d+qtJV0G; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234498AbiJXUg4 (ORCPT + 99 others); Mon, 24 Oct 2022 16:36:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35234 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231200AbiJXUgP (ORCPT ); Mon, 24 Oct 2022 16:36:15 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7A9271946F6; Mon, 24 Oct 2022 11:48:04 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id DA2E7B81148; Mon, 24 Oct 2022 12:04:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3D79FC433C1; Mon, 24 Oct 2022 12:04:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613040; bh=hbrNI6UZGqIUMmr7wMjGk5RiYuUfR5NKahn1VHVNLng=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=d+qtJV0GF7IW2ea/INsvnwyjqXKjujcB53/k4skNUPPHXusSgTMa+RtVucrGaYpkI hlbjf2Wjj7P0q88ucGEkqN55vCoO7xuSFeeDpLJEa2hzDOT2grUHdNwr03zx8Bg4I1 9T/nGgFq+2zLnt5kotzvumSq5kmv68b+hd1cApyU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Logan Gunthorpe , Song Liu , Sasha Levin Subject: [PATCH 4.19 214/229] md/raid5: Wait for MD_SB_CHANGE_PENDING in raid5d Date: Mon, 24 Oct 2022 13:32:13 +0200 Message-Id: <20221024113006.135387848@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747602821839484410?= X-GMAIL-MSGID: =?utf-8?q?1747602821839484410?= From: Logan Gunthorpe [ Upstream commit 5e2cf333b7bd5d3e62595a44d598a254c697cd74 ] A complicated deadlock exists when using the journal and an elevated group_thrtead_cnt. It was found with loop devices, but its not clear whether it can be seen with real disks. The deadlock can occur simply by writing data with an fio script. When the deadlock occurs, multiple threads will hang in different ways: 1) The group threads will hang in the blk-wbt code with bios waiting to be submitted to the block layer: io_schedule+0x70/0xb0 rq_qos_wait+0x153/0x210 wbt_wait+0x115/0x1b0 io_schedule+0x70/0xb0 rq_qos_wait+0x153/0x210 wbt_wait+0x115/0x1b0 __rq_qos_throttle+0x38/0x60 blk_mq_submit_bio+0x589/0xcd0 wbt_wait+0x115/0x1b0 __rq_qos_throttle+0x38/0x60 blk_mq_submit_bio+0x589/0xcd0 __submit_bio+0xe6/0x100 submit_bio_noacct_nocheck+0x42e/0x470 submit_bio_noacct+0x4c2/0xbb0 ops_run_io+0x46b/0x1a30 handle_stripe+0xcd3/0x36b0 handle_active_stripes.constprop.0+0x6f6/0xa60 raid5_do_work+0x177/0x330 Or: io_schedule+0x70/0xb0 rq_qos_wait+0x153/0x210 wbt_wait+0x115/0x1b0 __rq_qos_throttle+0x38/0x60 blk_mq_submit_bio+0x589/0xcd0 __submit_bio+0xe6/0x100 submit_bio_noacct_nocheck+0x42e/0x470 submit_bio_noacct+0x4c2/0xbb0 flush_deferred_bios+0x136/0x170 raid5_do_work+0x262/0x330 2) The r5l_reclaim thread will hang in the same way, submitting a bio to the block layer: io_schedule+0x70/0xb0 rq_qos_wait+0x153/0x210 wbt_wait+0x115/0x1b0 __rq_qos_throttle+0x38/0x60 blk_mq_submit_bio+0x589/0xcd0 __submit_bio+0xe6/0x100 submit_bio_noacct_nocheck+0x42e/0x470 submit_bio_noacct+0x4c2/0xbb0 submit_bio+0x3f/0xf0 md_super_write+0x12f/0x1b0 md_update_sb.part.0+0x7c6/0xff0 md_update_sb+0x30/0x60 r5l_do_reclaim+0x4f9/0x5e0 r5l_reclaim_thread+0x69/0x30b However, before hanging, the MD_SB_CHANGE_PENDING flag will be set for sb_flags in r5l_write_super_and_discard_space(). This flag will never be cleared because the submit_bio() call never returns. 3) Due to the MD_SB_CHANGE_PENDING flag being set, handle_stripe() will do no processing on any pending stripes and re-set STRIPE_HANDLE. This will cause the raid5d thread to enter an infinite loop, constantly trying to handle the same stripes stuck in the queue. The raid5d thread has a blk_plug that holds a number of bios that are also stuck waiting seeing the thread is in a loop that never schedules. These bios have been accounted for by blk-wbt thus preventing the other threads above from continuing when they try to submit bios. --Deadlock. To fix this, add the same wait_event() that is used in raid5_do_work() to raid5d() such that if MD_SB_CHANGE_PENDING is set, the thread will schedule and wait until the flag is cleared. The schedule action will flush the plug which will allow the r5l_reclaim thread to continue, thus preventing the deadlock. However, md_check_recovery() calls can also clear MD_SB_CHANGE_PENDING from the same thread and can thus deadlock if the thread is put to sleep. So avoid waiting if md_check_recovery() is being called in the loop. It's not clear when the deadlock was introduced, but the similar wait_event() call in raid5_do_work() was added in 2017 by this commit: 16d997b78b15 ("md/raid5: simplfy delaying of writes while metadata is updated.") Link: https://lore.kernel.org/r/7f3b87b6-b52a-f737-51d7-a4eec5c44112@deltatee.com Signed-off-by: Logan Gunthorpe Signed-off-by: Song Liu Signed-off-by: Sasha Levin --- drivers/md/raid5.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c index 3310f670a4ab..7fe0619c487a 100644 --- a/drivers/md/raid5.c +++ b/drivers/md/raid5.c @@ -44,6 +44,7 @@ */ #include +#include #include #include #include @@ -6329,7 +6330,18 @@ static void raid5d(struct md_thread *thread) spin_unlock_irq(&conf->device_lock); md_check_recovery(mddev); spin_lock_irq(&conf->device_lock); + + /* + * Waiting on MD_SB_CHANGE_PENDING below may deadlock + * seeing md_check_recovery() is needed to clear + * the flag when using mdmon. + */ + continue; } + + wait_event_lock_irq(mddev->sb_wait, + !test_bit(MD_SB_CHANGE_PENDING, &mddev->sb_flags), + conf->device_lock); } pr_debug("%d stripes handled\n", handled); From patchwork Mon Oct 24 11:32:14 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9960 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp609552wru; Mon, 24 Oct 2022 12:11:12 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4DG62Qrn5gYl1PsZNmDWI4KcXDroardISWs48qz3geibyJ+svzICsiPiGaAWrl5ZjoVNw9 X-Received: by 2002:aa7:9f0c:0:b0:56b:c0a0:6ab with SMTP id g12-20020aa79f0c000000b0056bc0a006abmr2518235pfr.7.1666638672197; Mon, 24 Oct 2022 12:11:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666638672; cv=none; d=google.com; s=arc-20160816; b=nHggRrv8TAQQsaEQsSaH6bkR88Y1oP2MaGpPpvAK30KdtBZrER1bNPmLQ0HOrkYzKD xnKJYKeQboYxfR9cG223Jdo5IlTZak/eXSZDZsXga7DrjNm9A8r5xfJg4OwjJzowXOFo QVtAnmoYUKhhKg9hibkp0kHgyzGzLrzm6uUrkCmAwodcOVHG87gKQt+od6m9aNp3PL2A WJXXqywKZiouMVxOqWBOXLux/XrW/BFgOlTP4gOmnKyTvVcNN/W9bg0Yx80n9GORhEEr oi5kxon2f5QMdUOIEDDyA+rKsq/cgZorZ6lo1eIT+6fLktDa92MGe4E2ZqOQPm4cttW3 2bjA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=GK0p8PSDvaT638jEruoYNUEYVj7GvKfWplXLw7oisLU=; b=zkBVdtgQ1mQI+ySWgjxEpL84JqWgSKA+/bIhI84xQoxfs23IGwfEVAvKqWenb2X6Gt 3ZNzjqhP1/dyKivqnut5Y0KRl9JEF7kMZf9Z12k+GI6kJdpXxZE5AuBU3m8l/pWUWeW2 kcAx23byjvpl5wxZ3Ano/uF4yEuUY8hFRrHrCBzyVdSULJ8/0FA18q7wF/V9DOs9xBgh dVQ8BFGvaZvhiohxU14FNwmE7x52xNejspu2Z3zhxlCacv4skFxF8IuXl4/qlSmBG5uM ZtEQRH4o79sjifqhzNq2J4UMPECYqd7dww8mtGbiys+5iBS4DRm5cWsf4PKxxk2qQkln lyBg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=KM4FLZvh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b8-20020a6541c8000000b004554963e1d2si339854pgq.172.2022.10.24.12.10.57; Mon, 24 Oct 2022 12:11:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=KM4FLZvh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231901AbiJXTK1 (ORCPT + 99 others); Mon, 24 Oct 2022 15:10:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47582 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231915AbiJXTJx (ORCPT ); Mon, 24 Oct 2022 15:09:53 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1BE4AEE01; Mon, 24 Oct 2022 10:49:08 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id B2606B8118A; Mon, 24 Oct 2022 12:04:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1105AC433C1; Mon, 24 Oct 2022 12:04:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613043; bh=BN27ZtVKkJ3LHKlBDcv2Kvb9Ok07kbOCpdjRtHGbjVk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KM4FLZvhVLo/SRcuGafTh3rI7bTvLsplNhDff9uj4qdboQQnnVMdxPsqZzKxk+vad lkXnD1SZtJ7ANlhuvgO2Fu4S48abAluJtQ0E1RMnI3INq5UySeJGecGHcbFq0MuhsH SGGv1Q7PjDUw1dP7eU6yjh57fCQ6f+GpTP629UW8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jianglei Nie , Mathias Nyman , Sasha Levin Subject: [PATCH 4.19 215/229] usb: host: xhci: Fix potential memory leak in xhci_alloc_stream_info() Date: Mon, 24 Oct 2022 13:32:14 +0200 Message-Id: <20221024113006.173383163@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747597312233207646?= X-GMAIL-MSGID: =?utf-8?q?1747597312233207646?= From: Jianglei Nie [ Upstream commit 7e271f42a5cc3768cd2622b929ba66859ae21f97 ] xhci_alloc_stream_info() allocates stream context array for stream_info ->stream_ctx_array with xhci_alloc_stream_ctx(). When some error occurs, stream_info->stream_ctx_array is not released, which will lead to a memory leak. We can fix it by releasing the stream_info->stream_ctx_array with xhci_free_stream_ctx() on the error path to avoid the potential memory leak. Signed-off-by: Jianglei Nie Signed-off-by: Mathias Nyman Link: https://lore.kernel.org/r/20220921123450.671459-2-mathias.nyman@linux.intel.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/usb/host/xhci-mem.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/usb/host/xhci-mem.c b/drivers/usb/host/xhci-mem.c index 798823ce2b34..7de21722d455 100644 --- a/drivers/usb/host/xhci-mem.c +++ b/drivers/usb/host/xhci-mem.c @@ -650,7 +650,7 @@ struct xhci_stream_info *xhci_alloc_stream_info(struct xhci_hcd *xhci, num_stream_ctxs, &stream_info->ctx_array_dma, mem_flags); if (!stream_info->stream_ctx_array) - goto cleanup_ctx; + goto cleanup_ring_array; memset(stream_info->stream_ctx_array, 0, sizeof(struct xhci_stream_ctx)*num_stream_ctxs); @@ -711,6 +711,11 @@ struct xhci_stream_info *xhci_alloc_stream_info(struct xhci_hcd *xhci, } xhci_free_command(xhci, stream_info->free_streams_command); cleanup_ctx: + xhci_free_stream_ctx(xhci, + stream_info->num_stream_ctxs, + stream_info->stream_ctx_array, + stream_info->ctx_array_dma); +cleanup_ring_array: kfree(stream_info->stream_rings); cleanup_info: kfree(stream_info); From patchwork Mon Oct 24 11:32:15 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9207 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp459122wru; Mon, 24 Oct 2022 06:38:54 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6PGR9HqSUYntDj7tV3I8bgloSWYrhF42nEQWVDwwJITum3j3Xturt4kOkFCSz7p32/sErF X-Received: by 2002:a17:90b:4b0b:b0:213:227d:149e with SMTP id lx11-20020a17090b4b0b00b00213227d149emr2822109pjb.145.1666618734407; Mon, 24 Oct 2022 06:38:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666618734; cv=none; d=google.com; s=arc-20160816; b=AsbQ3McN/QjgIF7SZHJfD2Db//SuDNo5ZVs5gycqPn1wdLFo62x4Y3QehmSU28C1ax cO5OvDB2dLBhS8KRBZaZ3gM5kLvpi4PXje5tE/4vzJ4PE9zHDaQdyz/HOXmhXj1ob+KE mSGe+zjmkCIzKrHNFvw//yMmA6JOMEZKtJCG3MJxE8ySGK1eVw2UzSrRTsJ7gX5PWmR0 b8kHpuK+GVTuK7K8XFJauqCUo1JYMkIAX9o+07M1alZtGE+26GDBwFJu/2+iELS6+qPu KvGusPBCQME0npgsKL2E6v4MPZjeWWSWe7Ia7IrIbGCmyOm7CQFTiLMkcfLDySf5TWzr v7KA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=WuxO5I/Q0IGJ5mS5tvLxOPcVP0ypG8rnZIY664CTwhY=; b=bVCDsbU7wC1ylXzT5ufh+vRJT1NvObqvUKvctJG9BAwzfP8RkMijApCVhFTqz0OUVX /Veq8v/PC+Jb0wQyJhbg5wWVRr8jKF5qJvc9yXzGnL5V6jruD4QEfzoCC33Kg+ZlaD5b W4W4Z3FXBO5G90XxXWGTzhQmJw8bk8MBYFrNgsGB7etogrdlmpX3xZyjfihtz9S0/yZh 5TDfx3gLZji9iewlGtUuLvD3WwpcY/UpPcbgUrU68Qq5DQSgBmzxZzRXTyxywfmiCf6C MzMFjqY9biAowa6toseXRfooOFyJZZqWkigvc9yWOpSr/ChjhTo0yV1AonzH2M6G9iD/ v5SQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=nWkcUXVp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t206-20020a635fd7000000b00454a7fa276asi35468032pgb.181.2022.10.24.06.38.39; Mon, 24 Oct 2022 06:38:54 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=nWkcUXVp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233988AbiJXNdu (ORCPT + 99 others); Mon, 24 Oct 2022 09:33:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42004 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236179AbiJXN34 (ORCPT ); Mon, 24 Oct 2022 09:29:56 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 71A14AC39F; Mon, 24 Oct 2022 05:33:03 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 94534B811AB; Mon, 24 Oct 2022 12:04:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E3469C433C1; Mon, 24 Oct 2022 12:04:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613098; bh=HvREvjpTGd2nnADgQQw/gRZ+w1eD5zoouABPrVUj1hQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nWkcUXVp1JEMReNU1Tdbl/pWfvo9lsOXhtAnigkvYoOt2kv9VdhXWV7WvDUPOvYxz wxf5igFRBl6CijWWl/gc8khxoD/lLJHDNMFugCy9PqrepQBb3qDVsAPRe5+BgYwOLZ PyXwoJe456vewZcexBO9wyLjKStylmJjUwwMnPG4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Robin Guo , Sasha Levin Subject: [PATCH 4.19 216/229] usb: musb: Fix musb_gadget.c rxstate overflow bug Date: Mon, 24 Oct 2022 13:32:15 +0200 Message-Id: <20221024113006.217091685@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747576406104885347?= X-GMAIL-MSGID: =?utf-8?q?1747576406104885347?= From: Robin Guo [ Upstream commit eea4c860c3b366369eff0489d94ee4f0571d467d ] The usb function device call musb_gadget_queue() adds the passed request to musb_ep::req_list,If the (request->length > musb_ep->packet_sz) and (is_buffer_mapped(req) return false),the rxstate() will copy all data in fifo to request->buf which may cause request->buf out of bounds. Fix it by add the length check : fifocnt = min_t(unsigned, request->length - request->actual, fifocnt); Signed-off-by: Robin Guo Link: https://lore.kernel.org/r/20220906102119.1b071d07a8391ff115e6d1ef@inspur.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/usb/musb/musb_gadget.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/usb/musb/musb_gadget.c b/drivers/usb/musb/musb_gadget.c index 4622400ba4dd..8e83995fc3bd 100644 --- a/drivers/usb/musb/musb_gadget.c +++ b/drivers/usb/musb/musb_gadget.c @@ -760,6 +760,9 @@ static void rxstate(struct musb *musb, struct musb_request *req) musb_writew(epio, MUSB_RXCSR, csr); buffer_aint_mapped: + fifo_count = min_t(unsigned int, + request->length - request->actual, + (unsigned int)fifo_count); musb_read_fifo(musb_ep->hw_ep, fifo_count, (u8 *) (request->buf + request->actual)); request->actual += fifo_count; From patchwork Mon Oct 24 11:32:16 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8957 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp436266wru; Mon, 24 Oct 2022 05:56:49 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5XjmcM9TpWrON2dPj1q82Ot5p/jnw59BQESy3KAl26G40fenT83VPz+zUJrzxwiVJq2itd X-Received: by 2002:a17:902:e28b:b0:186:ada2:8173 with SMTP id o11-20020a170902e28b00b00186ada28173mr3872208plc.138.1666616209359; Mon, 24 Oct 2022 05:56:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666616209; cv=none; d=google.com; s=arc-20160816; b=zj4XKmJhGgnucohUEo+lcBataD8Mjc8OxbP3GQ9rsd6Vf6vwTEYcfRtLR06jeEed6L dMolUmXXxgPUuWjJVKi9vOyKpSi5sSAI2rOwuBr/zFbDIPU+5ISYUMc/80i52W3iS78h p1xPFJAOjeJ9vpmgZIU89NtH3NhYFqKzjojdD19fraJcbHCViq7d7zNOA0IWqwKfT1KK +sDYsoPJgme2H3T2xqt+wBGY5GtpOCgSUyOJcrY1MFdSvWfjXR5A/XXcBJ3VTpDy+VXz uAGQ+Snb1wFXhYfg+xVnp+Yx5r2z6RKMcZUHtq/zsmnn6+7zgK160Bo6gsarFOOaPeek 9MCg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=9SEQQBejgvCYb4i4gdFNtD1eAU+v00ORZRu1N0jub68=; b=kb0szHMXH+9EZSfyjVSFmTwigaYO9/kzC35YjAKHqgJKheKk5DrL5lRIAtrwpm2Ppq Q+cKfs72xpe0k/0DBVQj4FHnUr/6BJSNihA1q+Jn8OHpzx06Bc2hGl1qYgz/ebimO87A kzT5wY2XkeLtLHW+iA2rrd9ceVgppgKWJnH/Yajf4my7l0wErN6d2tu6PCOFQodL5iQb kXs5CuBIbnVYHeC3gXUoW6VhG0bQ/MWf5iUiQ69bvtuX8z2cwDWvlX81TrHeuxSopds3 ADuyGpEUewOAHTxxr4G9rmRg8vdk/d2M43OXGPGvqHjxgdGXR9D/i14L1BfnivB8odBJ 5epA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=EKbSeLWd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 35-20020a630c63000000b0043a345c81edsi34893915pgm.836.2022.10.24.05.56.35; Mon, 24 Oct 2022 05:56:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=EKbSeLWd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234724AbiJXMzg (ORCPT + 99 others); Mon, 24 Oct 2022 08:55:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41076 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234679AbiJXMyi (ORCPT ); Mon, 24 Oct 2022 08:54:38 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3AD36B843; Mon, 24 Oct 2022 05:15:05 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id BA0A16126B; Mon, 24 Oct 2022 12:04:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CD754C433C1; Mon, 24 Oct 2022 12:04:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613064; bh=9nmIX1CbbtzBfzsDqPxMj8VYIeUwmfAAsFdjW+FQUjg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EKbSeLWdTbaoxaFvv8BuwL5FGsyq0HMRsFook4lyfGFxCcyXPjVYfZND564gcZOaH /UviGAbjFPavULQB81A/Q2UMgsqvVV7npFgkknSpx6EJ4uyxCjijuuZBD8wyWY802d wK4MfPFhibwAPe34Igm9cl1EPG0i2scIvo83DU4E= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, sunghwan jung , Sasha Levin Subject: [PATCH 4.19 217/229] Revert "usb: storage: Add quirk for Samsung Fit flash" Date: Mon, 24 Oct 2022 13:32:16 +0200 Message-Id: <20221024113006.260648538@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747573757970538602?= X-GMAIL-MSGID: =?utf-8?q?1747573757970538602?= From: sunghwan jung [ Upstream commit ad5dbfc123e6ffbbde194e2a4603323e09f741ee ] This reverts commit 86d92f5465958752481269348d474414dccb1552, which fix the timeout issue for "Samsung Fit Flash". But the commit affects not only "Samsung Fit Flash" but also other usb storages that use the same controller and causes severe performance regression. # hdparm -t /dev/sda (without the quirk) Timing buffered disk reads: 622 MB in 3.01 seconds = 206.66 MB/sec # hdparm -t /dev/sda (with the quirk) Timing buffered disk reads: 220 MB in 3.00 seconds = 73.32 MB/sec The commit author mentioned that "Issue was reproduced after device has bad block", so this quirk should be applied when we have the timeout issue with a device that has bad blocks. We revert the commit so that we apply this quirk by adding kernel paramters using a bootloader or other ways when we really need it, without the performance regression with devices that don't have the issue. Signed-off-by: sunghwan jung Link: https://lore.kernel.org/r/20220913114913.3073-1-onenowy@gmail.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/usb/storage/unusual_devs.h | 6 ------ 1 file changed, 6 deletions(-) diff --git a/drivers/usb/storage/unusual_devs.h b/drivers/usb/storage/unusual_devs.h index 6a59950a63a0..b270be141b8e 100644 --- a/drivers/usb/storage/unusual_devs.h +++ b/drivers/usb/storage/unusual_devs.h @@ -1275,12 +1275,6 @@ UNUSUAL_DEV( 0x090a, 0x1200, 0x0000, 0x9999, USB_SC_RBC, USB_PR_BULK, NULL, 0 ), -UNUSUAL_DEV(0x090c, 0x1000, 0x1100, 0x1100, - "Samsung", - "Flash Drive FIT", - USB_SC_DEVICE, USB_PR_DEVICE, NULL, - US_FL_MAX_SECTORS_64), - /* aeb */ UNUSUAL_DEV( 0x090c, 0x1132, 0x0000, 0xffff, "Feiya", From patchwork Mon Oct 24 11:32:17 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9156 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp457762wru; Mon, 24 Oct 2022 06:36:29 -0700 (PDT) X-Google-Smtp-Source: AMsMyM50EsSXiJ3QIEn8yA2kbPx/yT4TRW/+w+tkkjfVEEYmckVM5x5jDYBRLvJMGw+AJes7B8E/ X-Received: by 2002:a17:907:7f20:b0:7aa:acf9:c07f with SMTP id qf32-20020a1709077f2000b007aaacf9c07fmr1433808ejc.559.1666618589609; Mon, 24 Oct 2022 06:36:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666618589; cv=none; d=google.com; s=arc-20160816; b=VXp3U2Ge6niZF+ZSc77VOp7kGkFBT9AwYEhoIwHGPbsGNUwUqht8F5Ptk1N2qpHD8/ jmQBn8xd99WVYGOaPcIv1sVgX5NjCi0bwRPI9yh4eVakUceeWSGtxCuj/fbtwCVxOM74 8wVb9CKktmGC/VvDI6yC0DC5NfuHUdVONwdmqBP3JdPrRZ/2IkY1oP3N199IiMX/EixO XyfUp1SxlderPz+gtsj+jSWB2fkO/mYS8pv74zeF74kSCDaidOYTqZPmg7Djg9vgQR+2 Q8VtncUonpRC587d4N070889voDjRjxtFH45/RAGbxKn26ensPXuzGpP44m9jctglZeT oTdg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=bbQqD09h0kMDWH3J0zUV/OlX+1yLdEhK5ckTWLr8oks=; b=Ah1ssCRrQZrjOgsjfCjDVrue8IC1IeindtxHB5RONEoApaJAuJbU7gJYHlBUqoEo3g kcZBz3GCGTeotq7EWiF/wFqZXKa5X5J8N6GEUA10Ivi7tsOBKVK47dwTfOdA9bKmp7vv wVgxHXBfPDHi1UUP6A/jmVhtc248rcQg9QG1ToKzRwjIfQYz6MoY6z41q9xhsyr9S4HH sqQGiNRR3ZsWGjGo3LB33nhWYAPjvvmzvJNaK//C+03cK+vt2Ikvv7YkQZJSJ2npa3dE MP4tWT+CPuQ081V62x5XWq6UQbBw9EVrSu7ZNnBkqEHiakHyZaHDerT9qYlp46jxxis/ utVg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=OxWhS+te; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g17-20020a1709065d1100b007316ac034acsi26691414ejt.834.2022.10.24.06.35.27; Mon, 24 Oct 2022 06:36:29 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=OxWhS+te; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235935AbiJXNV6 (ORCPT + 99 others); Mon, 24 Oct 2022 09:21:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48268 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236471AbiJXNUd (ORCPT ); Mon, 24 Oct 2022 09:20:33 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 01B2F87681; Mon, 24 Oct 2022 05:29:07 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id D6964612C4; Mon, 24 Oct 2022 12:04:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EE1A8C433D7; Mon, 24 Oct 2022 12:04:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613077; bh=QU5vmXNJ3Gr1SJU1WZy8eaBaS35TPYAliopPzIIp1pY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OxWhS+teHRx/gFvEFDfccYRp9yl7x2hiN87EhtYxn9hAZcN7YNs0hZMzdeNzAwmdn HR1yFsbSvkjo2RtF3ODaWVhKoP9VZamhqVPOg8jddNKUzUuxxSSmeZj6eS7mKyua6O C0AvBDCg+aej92p+76AGn7kgsyyhEVG2GuNLWpiY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jeff Lien , Keith Busch , Sagi Grimberg , Chaitanya Kulkarni , Chao Leng , Christoph Hellwig , Sasha Levin Subject: [PATCH 4.19 218/229] nvme: copy firmware_rev on each init Date: Mon, 24 Oct 2022 13:32:17 +0200 Message-Id: <20221024113006.299576645@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747576253855266905?= X-GMAIL-MSGID: =?utf-8?q?1747576253855266905?= From: Keith Busch [ Upstream commit a8eb6c1ba48bddea82e8d74cbe6e119f006be97d ] The firmware revision can change on after a reset so copy the most recent info each time instead of just the first time, otherwise the sysfs firmware_rev entry may contain stale data. Reported-by: Jeff Lien Signed-off-by: Keith Busch Reviewed-by: Sagi Grimberg Reviewed-by: Chaitanya Kulkarni Reviewed-by: Chao Leng Signed-off-by: Christoph Hellwig Signed-off-by: Sasha Levin --- drivers/nvme/host/core.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c index 582c3b190418..986912e680d8 100644 --- a/drivers/nvme/host/core.c +++ b/drivers/nvme/host/core.c @@ -2320,7 +2320,6 @@ static int nvme_init_subsystem(struct nvme_ctrl *ctrl, struct nvme_id_ctrl *id) nvme_init_subnqn(subsys, ctrl, id); memcpy(subsys->serial, id->sn, sizeof(subsys->serial)); memcpy(subsys->model, id->mn, sizeof(subsys->model)); - memcpy(subsys->firmware_rev, id->fr, sizeof(subsys->firmware_rev)); subsys->vendor_id = le16_to_cpu(id->vid); subsys->cmic = id->cmic; @@ -2481,6 +2480,8 @@ int nvme_init_identify(struct nvme_ctrl *ctrl) ctrl->quirks |= core_quirks[i].quirks; } } + memcpy(ctrl->subsys->firmware_rev, id->fr, + sizeof(ctrl->subsys->firmware_rev)); if (force_apst && (ctrl->quirks & NVME_QUIRK_NO_DEEPEST_PS)) { dev_warn(ctrl->device, "forcibly allowing all power states due to nvme_core.force_apst -- use at your own risk\n"); From patchwork Mon Oct 24 11:32:18 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9238 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp461131wru; Mon, 24 Oct 2022 06:43:13 -0700 (PDT) X-Google-Smtp-Source: AMsMyM72B3PtgeEdHo/pEr4FZB73CPyFWsaH7WAtJOCI+heWUhIllMRw7frEsMsiYd7w89gQTWiJ X-Received: by 2002:a17:907:608a:b0:791:9dbc:cc11 with SMTP id ht10-20020a170907608a00b007919dbccc11mr27236182ejc.357.1666618993025; Mon, 24 Oct 2022 06:43:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666618993; cv=none; d=google.com; s=arc-20160816; b=tClFjiDfja1DlAE94Eg0Vd8RnS0oprWWzhekokWVUFgEqiZynxVndc+gvxbKBkBI5R KibDLSixOQg/DiuTwTwHXioeFOCB+0TqyksvJLvdWOALiA8AS8hdH5gGtU4VAy8/X8fF wDrvkY6FVHHB9YSDLJEl+LTiaasV5/eqERKS2ldF2ycAsgh80b+Q3XeLWNcBmd8hDu/L rAbJgph+ebmp/ZngBGcOHPvXJXzvk6Wuz5wpU5JiMmdScxFdtrZQlRcE6cAzi7c0V4jy oO1t8bHxe5fLLCKiePPIwsGTCxJt9ms1qK8bncnsJESKf0KKgdHC8VwkO4dwUc5LCKfG 8FYw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=10suO6Ku1BxCpxh9hBNndXSI7ZETMWQubE9F20GAvrE=; b=AnGK9G71pqSpHhvApQsPEfChaRNG1q6Dac3EozyLsJHLwU/3ofL3/BFmr5g/Ti0ZHY 9KV3VenyXuAFpgGww/1Iu/3KJRt2V2P0tuZ6pCTwlQq5mEuwrDFcSDXEhkGJTvcE3IuC L2HOWj0RIQ1560Mo+Zq8TC1AC7uGxYtXdpa8UB042l85AqWKXE5yz+0CH+NiiGc6ox67 mJ4WzvJwUDNu+4oPNnnov9bmJ0ugs9+EKESdDU0rSzDrB0OdTJ6MPU3ZIXVdwAFgu7ks itBtoOyyIcTHC71FfNgigksq2l2gcUZdLj3SzOm/GoK9xg6fWbazMHbRBwtEfLUNKQKb qlWQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=XiaERIhJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y17-20020a056402359100b0045d5cf18d4bsi28126327edc.583.2022.10.24.06.42.45; Mon, 24 Oct 2022 06:43:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=XiaERIhJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236104AbiJXNh6 (ORCPT + 99 others); Mon, 24 Oct 2022 09:37:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42826 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235985AbiJXNeL (ORCPT ); Mon, 24 Oct 2022 09:34:11 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 977B02CE09; Mon, 24 Oct 2022 05:34:57 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 3A624B81147; Mon, 24 Oct 2022 12:04:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 936ADC433C1; Mon, 24 Oct 2022 12:04:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613079; bh=9IwWBpBPAy1XPz+qmN4K1594agSedGaY6AGFztpHjGA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XiaERIhJoIIZem7Cw4OyLlbUIvsnYq/jMpJupzOGZXgjT2JTjVLEP79uZ9zRRO/41 jBgDT+lTBE9la1CSlp/efoImQJmvvNYEpp3uiYa1Ye+LrpcZW52kZfNYI8Veg1D9yv ONpiwFJFPAfJlF7xRkFu1bF6yuE62p4E7V0htJwA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, syzbot+79832d33eb89fb3cd092@syzkaller.appspotmail.com, Dongliang Mu , Sasha Levin Subject: [PATCH 4.19 219/229] usb: idmouse: fix an uninit-value in idmouse_open Date: Mon, 24 Oct 2022 13:32:18 +0200 Message-Id: <20221024113006.330019597@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747576677039994543?= X-GMAIL-MSGID: =?utf-8?q?1747576677039994543?= From: Dongliang Mu [ Upstream commit bce2b0539933e485d22d6f6f076c0fcd6f185c4c ] In idmouse_create_image, if any ftip_command fails, it will go to the reset label. However, this leads to the data in bulk_in_buffer[HEADER..IMGSIZE] uninitialized. And the check for valid image incurs an uninitialized dereference. Fix this by moving the check before reset label since this check only be valid if the data after bulk_in_buffer[HEADER] has concrete data. Note that this is found by KMSAN, so only kernel compilation is tested. Reported-by: syzbot+79832d33eb89fb3cd092@syzkaller.appspotmail.com Signed-off-by: Dongliang Mu Link: https://lore.kernel.org/r/20220922134847.1101921-1-dzm91@hust.edu.cn Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/usb/misc/idmouse.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/usb/misc/idmouse.c b/drivers/usb/misc/idmouse.c index bb24527f3c70..ba2b6fbab9b8 100644 --- a/drivers/usb/misc/idmouse.c +++ b/drivers/usb/misc/idmouse.c @@ -178,10 +178,6 @@ static int idmouse_create_image(struct usb_idmouse *dev) bytes_read += bulk_read; } - /* reset the device */ -reset: - ftip_command(dev, FTIP_RELEASE, 0, 0); - /* check for valid image */ /* right border should be black (0x00) */ for (bytes_read = sizeof(HEADER)-1 + WIDTH-1; bytes_read < IMGSIZE; bytes_read += WIDTH) @@ -193,6 +189,10 @@ static int idmouse_create_image(struct usb_idmouse *dev) if (dev->bulk_in_buffer[bytes_read] != 0xFF) return -EAGAIN; + /* reset the device */ +reset: + ftip_command(dev, FTIP_RELEASE, 0, 0); + /* should be IMGSIZE == 65040 */ dev_dbg(&dev->interface->dev, "read %d bytes fingerprint data\n", bytes_read); From patchwork Mon Oct 24 11:32:19 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9158 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp457769wru; Mon, 24 Oct 2022 06:36:30 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4BXsrdzWkq0vVBBKGkXfWonEmhgUKWD+bH1eUjaB+WsoJKnFYrkiwoMn6ndhrm/jwgU/DQ X-Received: by 2002:a17:90b:110c:b0:205:cfeb:cfb with SMTP id gi12-20020a17090b110c00b00205cfeb0cfbmr39092554pjb.75.1666618589837; Mon, 24 Oct 2022 06:36:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666618589; cv=none; d=google.com; s=arc-20160816; b=zwxCTr8MAb5L4vBAlIT+jn2rA3tZBbOKAxHHAQ6PZ8D6iGw+dhjYuCAWdj6BU8WgeX 39QE9sg+C3ifBWdAu31bxe10e6Km8u+WxRICRPdUhpRsicdRfn139HbJvsgXmrhbCB3H w7TeOXk75tyx6dd+NVaLwn+jpz0xWok58CL1fhIqy6qvjSh9ODimC0WvkkqV9ktIZun1 KapbQzGQ2etG8b2prw65DKB042ZE75Z5H3BTn/uajlgkpEuwc9TAiKGGFsjVqUhfDRiV VUDA5ehrJEeJ/Wl7SiG59hYqajpGbqDvsjOxJkK/jEyuXTzipy+YKzp7zuHhDP1uWc+k MHqw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=vdko9PHJXcgQzJFIVTxjnQU8/97DsQn/zeFFz0NnEMA=; b=UAHTiCUMbZ6C/cPo8YWAX2TxmmTe+yo9TY2r8c0srsm0M1s7qrESXPwby9sCu+XT2l E13Ee2UPNeag8tn+ZEsIdVoxB8sRuQMO78Y3w3PSZtYzna9OatawkCpbMa4h+V9qP6qH TJaV+YVT9n10ekySHRSRPOB1h03wYiQrM5sAL63V+6OtXhaaAw4IwCMFlcdUIhQz+1wE fpa7GViuZrAfhCqTMij9AUHxmJZN/yrh/4ldplr/EN22jrdwshkY2cmM7BeYxGsyYdYq 0pNW9bzP3+9hY44e+RzrIrffi18HnCyZ2bBUeNC1M2avocniQxXuBKXCuN8n/VVT+Zuz uL6w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=oi0EEdJQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j19-20020a633c13000000b0046efa6dfeaasi4922587pga.859.2022.10.24.06.36.15; Mon, 24 Oct 2022 06:36:29 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=oi0EEdJQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235883AbiJXNRc (ORCPT + 99 others); Mon, 24 Oct 2022 09:17:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49856 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233113AbiJXNQw (ORCPT ); Mon, 24 Oct 2022 09:16:52 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 02F1B537F6; Mon, 24 Oct 2022 05:26:07 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id DFA64B81199; Mon, 24 Oct 2022 12:04:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 357A5C433D6; Mon, 24 Oct 2022 12:04:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613082; bh=WWkcmlAyA3f6jXwUv+XMv0JhZ1/YMiSwL+vY8mPdxkY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oi0EEdJQJJCJEVZk3tlb1xC3fYQjt+xwyNas+ac8OJ6vCk88CNJyvVj9H4DywK0sE a+MGL1ZFOQogFWwwBkG1WMQpIb2HGezlN76U5jy2AjWzqI0UNPD4cHvTjH+M2Xb6yQ da5KsBaYdyagTL2JKUXBhIrJtpk8pWLvq4VQwOcU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?utf-8?q?Noralf_Tr=C3=B8nnes?= , Maxime Ripard , Stefan Wahren , Stephen Boyd , Sasha Levin Subject: [PATCH 4.19 220/229] clk: bcm2835: Make peripheral PLLC critical Date: Mon, 24 Oct 2022 13:32:19 +0200 Message-Id: <20221024113006.365791198@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747576254797743664?= X-GMAIL-MSGID: =?utf-8?q?1747576254797743664?= From: Maxime Ripard [ Upstream commit 6c5422851d8be8c7451e968fd2e6da41b6109e17 ] When testing for a series affecting the VEC, it was discovered that turning off and on the VEC clock is crashing the system. It turns out that, when disabling the VEC clock, it's the only child of the PLLC-per clock which will also get disabled. The source of the crash is PLLC-per being disabled. It's likely that some other device might not take a clock reference that it actually needs, but it's unclear which at this point. Let's make PLLC-per critical so that we don't have that crash. Reported-by: Noralf Trønnes Signed-off-by: Maxime Ripard Link: https://lore.kernel.org/r/20220926084509.12233-1-maxime@cerno.tech Reviewed-by: Stefan Wahren Acked-by: Noralf Trønnes Signed-off-by: Stephen Boyd Signed-off-by: Sasha Levin --- drivers/clk/bcm/clk-bcm2835.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/clk/bcm/clk-bcm2835.c b/drivers/clk/bcm/clk-bcm2835.c index 5a2f8d5d8d7a..180abc00160d 100644 --- a/drivers/clk/bcm/clk-bcm2835.c +++ b/drivers/clk/bcm/clk-bcm2835.c @@ -1737,7 +1737,7 @@ static const struct bcm2835_clk_desc clk_desc_array[] = { .load_mask = CM_PLLC_LOADPER, .hold_mask = CM_PLLC_HOLDPER, .fixed_divider = 1, - .flags = CLK_SET_RATE_PARENT), + .flags = CLK_IS_CRITICAL | CLK_SET_RATE_PARENT), /* * PLLD is the display PLL, used to drive DSI display panels. From patchwork Mon Oct 24 11:32:20 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8956 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp436151wru; Mon, 24 Oct 2022 05:56:33 -0700 (PDT) X-Google-Smtp-Source: AMsMyM41TzdS9LWOGUGhscVV97zxm4QPAcKAHoij68BhJAck5QNyyxmz024cvcp1z3BI/q5jwnIl X-Received: by 2002:a17:902:e902:b0:186:9c03:5f27 with SMTP id k2-20020a170902e90200b001869c035f27mr8131210pld.16.1666616193428; Mon, 24 Oct 2022 05:56:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666616193; cv=none; d=google.com; s=arc-20160816; b=DVCKLnc67ry1JG98djw9ZA8iWGJezHK/LjXq2l8U86jvuh62aq+XKJ0QHpvqucll3x ITJSF0JaHhr5lTmIvCTRGPdSLINLkh3LCmhb4nPXoBhouQW8RM/cAdlmkrbC0NfdO6n4 n8ieaiXJ2fTa5yYXpeSE6ALQH7xlitWFD6QChP9LFO+FyfOG0ukAY3BfA1M4Afevlr3A C+44HKyG9Zua6cV653ZeQLilTuaQq9qAuDZKd+PX7z2Gjxi9523hYcFwBvNi107QsvIx E5mhtBadNLRNWkMLRlreGrKd/jJHjJdpnYEGDECM22wk9PcAHlpP/iL3AqVYtLpTRTtL Uq1A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=6Y8d9y4cD27hwdK2bOfgFib9vmYCK8Awq2WCbQsfX40=; b=b2USbxDyOy8IYlXbzj3EyuAzdo5w9eLtBBo2q7mxnLET0uTS2xiHnCQ/TGycpXx6z4 YAGtJ661yTkY7OQPsOBNGluDDYH/lFity4g2UXMeEzjn/DwwA5Ax+rxr3sr63wwFqWWd cwcJOrLu/7zmefXScxrqxGp3UlzPE5VHYHQ35cYSVqV+nPzK1vlfa+EdN9Bcm+lJxQ+a U5DV6hd41z5mE0MXr/xTz0SJar2pejLRPs67Vt3NiD3pzBw8NxbzxPlXmTQ3JgnL5OvH UnWrffEvXCqYHz5O+TkQv+rMexkKkAw3/MqlRF99tKSFuyhSC+mzzmIxpgtBUCfcgxBS IGJA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=u6Krc4ig; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v6-20020a1709029a0600b001614cd997a6si10351021plp.481.2022.10.24.05.56.20; Mon, 24 Oct 2022 05:56:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=u6Krc4ig; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234565AbiJXMzY (ORCPT + 99 others); Mon, 24 Oct 2022 08:55:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33260 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231911AbiJXMy1 (ORCPT ); Mon, 24 Oct 2022 08:54:27 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 78967201B3; Mon, 24 Oct 2022 05:15:00 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id B9C106121A; Mon, 24 Oct 2022 12:04:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CE001C433D6; Mon, 24 Oct 2022 12:04:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613085; bh=Z6Jp/s2PYgjHFNbyhiSArB81BC6Uh7z2TR6mIj/hsJE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=u6Krc4ig5wuTlJvS9/Bl+j6E68bURc996UbCJF+5xIh5azFRl72o4lxBahOXRwSOS rJQfDBzNerr50NrReDAwAnxacAvpqhpoi7MzDRdLUkwMv9ki8feBOEu1b1NZwkpQIa QgJFG1EdFry86B78qxGXdinHPNWHMvB5uFbXCX3o= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Adrian Hunter , Namhyung Kim , Ian Rogers , Jiri Olsa , Arnaldo Carvalho de Melo Subject: [PATCH 4.19 221/229] perf intel-pt: Fix segfault in intel_pt_print_info() with uClibc Date: Mon, 24 Oct 2022 13:32:20 +0200 Message-Id: <20221024113006.403705714@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747573741534855006?= X-GMAIL-MSGID: =?utf-8?q?1747573741534855006?= From: Adrian Hunter commit 5a3d47071f0ced0431ef82a5fb6bd077ed9493db upstream. uClibc segfaulted because NULL was passed as the format to fprintf(). That happened because one of the format strings was missing and intel_pt_print_info() didn't check that before calling fprintf(). Add the missing format string, and check format is not NULL before calling fprintf(). Fixes: 11fa7cb86b56d361 ("perf tools: Pass Intel PT information for decoding MTC and CYC") Signed-off-by: Adrian Hunter Acked-by: Namhyung Kim Cc: Adrian Hunter Cc: Ian Rogers Cc: Jiri Olsa Cc: stable@vger.kernel.org Link: https://lore.kernel.org/r/20221012082259.22394-2-adrian.hunter@intel.com Signed-off-by: Arnaldo Carvalho de Melo Signed-off-by: Greg Kroah-Hartman --- tools/perf/util/intel-pt.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) --- a/tools/perf/util/intel-pt.c +++ b/tools/perf/util/intel-pt.c @@ -2373,6 +2373,7 @@ static const char * const intel_pt_info_ [INTEL_PT_SNAPSHOT_MODE] = " Snapshot mode %"PRId64"\n", [INTEL_PT_PER_CPU_MMAPS] = " Per-cpu maps %"PRId64"\n", [INTEL_PT_MTC_BIT] = " MTC bit %#"PRIx64"\n", + [INTEL_PT_MTC_FREQ_BITS] = " MTC freq bits %#"PRIx64"\n", [INTEL_PT_TSC_CTC_N] = " TSC:CTC numerator %"PRIu64"\n", [INTEL_PT_TSC_CTC_D] = " TSC:CTC denominator %"PRIu64"\n", [INTEL_PT_CYC_BIT] = " CYC bit %#"PRIx64"\n", @@ -2387,8 +2388,12 @@ static void intel_pt_print_info(u64 *arr if (!dump_trace) return; - for (i = start; i <= finish; i++) - fprintf(stdout, intel_pt_info_fmts[i], arr[i]); + for (i = start; i <= finish; i++) { + const char *fmt = intel_pt_info_fmts[i]; + + if (fmt) + fprintf(stdout, fmt, arr[i]); + } } static void intel_pt_print_info_str(const char *name, const char *str) From patchwork Mon Oct 24 11:32:21 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8843 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp431635wru; Mon, 24 Oct 2022 05:44:20 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6NsrAR5fVlnuNds1/aUhdgriXsp7dMeS7GYIjSFFyg42g51HWjufuyFZ+RQCW7oliKS5r2 X-Received: by 2002:aa7:c6c1:0:b0:460:f684:901a with SMTP id b1-20020aa7c6c1000000b00460f684901amr19867351eds.6.1666615460618; Mon, 24 Oct 2022 05:44:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666615460; cv=none; d=google.com; s=arc-20160816; b=vunhmh9b8JnMT+XMDk+/QqGhBKuE+H8HADTX0Z83ZiRovBkyVvqszDQQqdr2399PBU yHi4+5Fl7arweXzpinpP1zEEEhoIhHKYCjdYlvsPSplmtHl08DDOuqxGGdbmS4hatolH DnqlMlZfgF0dHcgTH2fP8GVSCTXbeIWX2mq2IeIfOG0LOVYE87aDOOx2yTMbl1CbNLZM 65N5rHGJx3OU5zM6Y+y2TGu3wVbBMEbEwje9iuY/MQ4hggUS2qdeAvI80AeB9cE6CET9 FLW5cYFLMqVBRaJaTh5oFoHN/MCgP9rF12Hzttk9IxwlC80/kSjpWcxccem9Gk1Qz0ay 2nSg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=w+JeoqngnDIj22oFXTpwtF8uTj2pzFV8HLCcISlxjDE=; b=bzPfrcM3xL10dC3Q0y057tVn92zEGOeV7mGFEng2MBqkNeJvONC6LfCjFqqR0REjZV /cmfTqL6QMEgAbY7fdBfEkLKASo6R/GjKK/WOFc2gV50sbJcgF3JLrb+ipZsYINr3kgk EDV6xHQwHhmW7krU85OjnHXWBXDP6cJofbHEiy3LKBUZOSKj+lioy777VZueQnBhXfdO italTDLxto1neTOtWqzYphZvdsgr1jH3XCKZoDPt3EcE9bpmBGospLHL9S5xLsgcRtO2 PYND4NZCeefviFciNVJzx08DtZL9lQD08cKUrh7b76z8JJrZjBFRKMfBCXVAGPn4uioy B3sw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=hL3a5z6l; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n14-20020aa7c78e000000b00458ee128628si23638722eds.470.2022.10.24.05.43.53; Mon, 24 Oct 2022 05:44:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=hL3a5z6l; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231218AbiJXMiJ (ORCPT + 99 others); Mon, 24 Oct 2022 08:38:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44412 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234278AbiJXMem (ORCPT ); Mon, 24 Oct 2022 08:34:42 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E11574A807; Mon, 24 Oct 2022 05:05:04 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 5D53E612BF; Mon, 24 Oct 2022 12:04:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6DE76C433C1; Mon, 24 Oct 2022 12:04:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613087; bh=nU5shlmlTDL+WA15wXTBEMZOu70bg3gompzMDfGsWu8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hL3a5z6l2Qr4q2CC+F7xlvybcngWdUmP0CH8b3G3ITelh5Eejbfb14fMgIk9iWj/t zTvzTlD1ph2n/77BFkecYMbeRceu0rJcglBDqmPiBTi7iH5U3BgrY/zyP1+3NR0F35 M4WcJg7dCGhjcFs5oiEY1kwYP4efYORP92GwrZG8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alexander Aring , "David S. Miller" Subject: [PATCH 4.19 222/229] net: ieee802154: return -EINVAL for unknown addr type Date: Mon, 24 Oct 2022 13:32:21 +0200 Message-Id: <20221024113006.446380153@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747572973490626382?= X-GMAIL-MSGID: =?utf-8?q?1747572973490626382?= From: Alexander Aring commit 30393181fdbc1608cc683b4ee99dcce05ffcc8c7 upstream. This patch adds handling to return -EINVAL for an unknown addr type. The current behaviour is to return 0 as successful but the size of an unknown addr type is not defined and should return an error like -EINVAL. Fixes: 94160108a70c ("net/ieee802154: fix uninit value bug in dgram_sendmsg") Signed-off-by: Alexander Aring Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- include/net/ieee802154_netdev.h | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) --- a/include/net/ieee802154_netdev.h +++ b/include/net/ieee802154_netdev.h @@ -193,21 +193,27 @@ static inline int ieee802154_sockaddr_check_size(struct sockaddr_ieee802154 *daddr, int len) { struct ieee802154_addr_sa *sa; + int ret = 0; sa = &daddr->addr; if (len < IEEE802154_MIN_NAMELEN) return -EINVAL; switch (sa->addr_type) { + case IEEE802154_ADDR_NONE: + break; case IEEE802154_ADDR_SHORT: if (len < IEEE802154_NAMELEN_SHORT) - return -EINVAL; + ret = -EINVAL; break; case IEEE802154_ADDR_LONG: if (len < IEEE802154_NAMELEN_LONG) - return -EINVAL; + ret = -EINVAL; + break; + default: + ret = -EINVAL; break; } - return 0; + return ret; } static inline void ieee802154_addr_from_sa(struct ieee802154_addr *a, From patchwork Mon Oct 24 11:32:22 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9139 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp457502wru; Mon, 24 Oct 2022 06:36:07 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6xFnovQ07cFI9fPlijzURyVb/dOM5JzfEQasVK1nxulR14iLlfmqOvKK3QPlQgrDJgTAKi X-Received: by 2002:a17:906:d550:b0:78d:a6d4:c18f with SMTP id cr16-20020a170906d55000b0078da6d4c18fmr28150597ejc.113.1666618567338; Mon, 24 Oct 2022 06:36:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666618567; cv=none; d=google.com; s=arc-20160816; b=Q7wREZTmqYD3VJQscFwYE+QGXPXbula/3/ZdLodk/naeZtYo4V6EsIRzWjBDNAakjv BltglJWNL9TzZwdRkCOdznFKs69DnSjfRyQaP67j3jsTZcOuRCC/tp53QlES1s5vPsVd Hn2UrZUa1/J9Ccp1fWpMUSse+40WzkpA1Eaiy7fbck01x84SjsYRWolOR+Vu7rirjhAO L0PYmTm5JcJCGFgRH65rdr7uxNctoS7RZiHwivhpLBLaICThL/FyNTUvVC5j+taaJM6m KVuUjPX+a3nmhYfYIeHsnm5bPDduJ98DT1KquXW1PlJNVVGhPQPHqXmLZ2adTWqs3niR a0fw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=ypex75ENVyEUgfugp7ggpAxNDT9AiHsnsZ5tLNK+66g=; b=SpVVZC4SaHw2GLOgFFFD2oeKauBvE6Bz4qLgy+koPNZvekOtyXY7bLubxkVsxoTgY4 JAvLNHX9BRY3SeDgbKgr97s48GQje2O0z6nyHRZJLOgAnooaY7C6AqKqSxO6yULhxNLp G8EU5WEu6EAsqV/Tm4NDVo8KNLgjWCpejn59WTbndCYyo9ZEbBDL+mGP1OLFbi4daR6f 9gH9JiMeohRgU0Un5IjImqHUGktPiG5ZdKLIopZo/i3jnPMj+eKrB/3HQ7NMhxayisPH HjevgHGiWkqKzGWjZ55Gqx6tCoxMVfafrQqLLFN0rdJW94DE8FaIgUPu0UHBHz5bUJ7F zSxQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=X+aJkKuP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id gs41-20020a1709072d2900b0078e030224fdsi31697063ejc.768.2022.10.24.06.35.26; Mon, 24 Oct 2022 06:36:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=X+aJkKuP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231522AbiJXNVp (ORCPT + 99 others); Mon, 24 Oct 2022 09:21:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42688 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236439AbiJXNU2 (ORCPT ); Mon, 24 Oct 2022 09:20:28 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 98B1B29CB0; Mon, 24 Oct 2022 05:29:01 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id B73EFB8119E; Mon, 24 Oct 2022 12:04:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 16FC9C433D6; Mon, 24 Oct 2022 12:04:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613090; bh=/K/z/rK+8z3Z74OMUw1WBkuyfmRSNZoUhy4sU47g0Yk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=X+aJkKuPnV3DOjrJbOY+ndxIzR5G5RTqAuyUaTASLNm27IrtXPlpruNzqiBEq03Qx XEk7WWM2MYuza49VqnrbM8Cf5MdUDcHoyKvKw7yz8Rqya/Taoz+QI8iRTBbGXZ/HVV UDI6SeOyj5AYlvYxF4W37f1+0qTZSi371gGZ0npw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, syzbot , Tetsuo Handa , Alexander Aring , Stefan Schmidt , Sasha Levin Subject: [PATCH 4.19 223/229] net/ieee802154: dont warn zero-sized raw_sendmsg() Date: Mon, 24 Oct 2022 13:32:22 +0200 Message-Id: <20221024113006.476744345@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747576230958744867?= X-GMAIL-MSGID: =?utf-8?q?1747576230958744867?= From: Tetsuo Handa [ Upstream commit b12e924a2f5b960373459c8f8a514f887adf5cac ] syzbot is hitting skb_assert_len() warning at __dev_queue_xmit() [1], for PF_IEEE802154 socket's zero-sized raw_sendmsg() request is hitting __dev_queue_xmit() with skb->len == 0. Since PF_IEEE802154 socket's zero-sized raw_sendmsg() request was able to return 0, don't call __dev_queue_xmit() if packet length is 0. ---------- #include #include int main(int argc, char *argv[]) { struct sockaddr_in addr = { .sin_family = AF_INET, .sin_addr.s_addr = htonl(INADDR_LOOPBACK) }; struct iovec iov = { }; struct msghdr hdr = { .msg_name = &addr, .msg_namelen = sizeof(addr), .msg_iov = &iov, .msg_iovlen = 1 }; sendmsg(socket(PF_IEEE802154, SOCK_RAW, 0), &hdr, 0); return 0; } ---------- Note that this might be a sign that commit fd1894224407c484 ("bpf: Don't redirect packets with invalid pkt_len") should be reverted, for skb->len == 0 was acceptable for at least PF_IEEE802154 socket. Link: https://syzkaller.appspot.com/bug?extid=5ea725c25d06fb9114c4 [1] Reported-by: syzbot Fixes: fd1894224407c484 ("bpf: Don't redirect packets with invalid pkt_len") Signed-off-by: Tetsuo Handa Signed-off-by: Alexander Aring Link: https://lore.kernel.org/r/20221005014750.3685555-2-aahringo@redhat.com Signed-off-by: Stefan Schmidt Signed-off-by: Sasha Levin --- net/ieee802154/socket.c | 4 ++++ 1 file changed, 4 insertions(+) --- a/net/ieee802154/socket.c +++ b/net/ieee802154/socket.c @@ -285,6 +285,10 @@ static int raw_sendmsg(struct sock *sk, err = -EMSGSIZE; goto out_dev; } + if (!size) { + err = 0; + goto out_dev; + } hlen = LL_RESERVED_SPACE(dev); tlen = dev->needed_tailroom; From patchwork Mon Oct 24 11:32:23 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 10382 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp696082wru; Mon, 24 Oct 2022 16:10:37 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5PxEsg/ryRO5cohYtlOlP6umAN6D33vClqhuiQMav6Zy8pz/fDXS4pi8h3y8Hua2SVZ/5B X-Received: by 2002:a17:902:ecc4:b0:180:3104:2fc0 with SMTP id a4-20020a170902ecc400b0018031042fc0mr35987639plh.56.1666653037055; Mon, 24 Oct 2022 16:10:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666653037; cv=none; d=google.com; s=arc-20160816; b=w+RpVlrpWSEalzEChkeb4gTbdXH0gZ6D9ZK2byBoC4v9zBXFEf8R918Qd2GFswlfvq UZ6BuIUvIp138Wol2qbTJADRKM28WJDBrECKq4u09tUqW6DkSwdDFMJuFsZ1GA8xmdqg w1T7lkJ7+4zp8Ptk8jzUMuIirmVjnyD6N5rN3d66PXnNdmWOl54JyecgYGndm/jJdh95 J9p6pzXohjjTBTKWazTx3fHjJgMEvLgJZNcJHemmxr6nc7nfzNtUxYakFcHE1BNQv999 turfx0UZSK1QsnKDZqEUFWYmbsNdweb8sHoFfa8vrUkNiUO7O+aYdxcmhZwSJJKT8OOf 4scQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=a6P0SGjXbNCva0N66Mya0mr/lNCewNWlMt/yWQwEdbA=; b=rQIaZzgpITiSooVuH7GsOWik78S8UMA8mORXwuXTFyP56f/s/Yod3z+sqVopHN+vqW w9QBZYgtwwab/ML0epo9Lp17a4SKKx3Aq9XpBJQx6Ky/LNI6bFMDNZC2mi2jD4JEhzuQ A4+zntrCtoyqsjbw+wUWulDeNC+d9YZIYMRCA6L5NK82egr4/tl6VvjGQZqS/HgqrnJC c9DWT2CeVocFlIygoYMhzzyqm3Xz4ZkWj5B9WWWjTH8AGqcVwDuQGUoDOa1146GcEG7z RUfLQlpVU+l1shlrRLl2mXc4kNCdAmxgexrVqInUIDugV0A8L51p7QB/nT5ImDCFsMoR /upw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="Zj/5OQEu"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ik28-20020a170902ab1c00b00179c921918esi838807plb.17.2022.10.24.16.10.23; Mon, 24 Oct 2022 16:10:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="Zj/5OQEu"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230220AbiJXWz5 (ORCPT + 99 others); Mon, 24 Oct 2022 18:55:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37160 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231998AbiJXWz0 (ORCPT ); Mon, 24 Oct 2022 18:55:26 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9322818B748; Mon, 24 Oct 2022 14:16:51 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 57E67B811A6; Mon, 24 Oct 2022 12:04:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AC0C9C433D6; Mon, 24 Oct 2022 12:04:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613093; bh=jyb3/nDrTgwKr3xF4zM27CdoKJT44I6GKaJXVXMSvN0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Zj/5OQEuI0ag1Wtr1HKyLiA/O5A/C6w014x0REUgh4mgaT8ujbdi0m708jW7VN6Cp FW+YaZlO2CPCpfCk5qLHV3MjZ2AFBdtqLt8LcJ9AZS79Vrwme56EBC5NxFkT0Wm6WD 3XYEYvkjNVlly1/UPHOnSSjKCPToV66OnZqGxuBY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jerry Lee , Theodore Tso Subject: [PATCH 4.19 224/229] ext4: continue to expand file system when the target size doesnt reach Date: Mon, 24 Oct 2022 13:32:23 +0200 Message-Id: <20221024113006.512522416@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747612374805601749?= X-GMAIL-MSGID: =?utf-8?q?1747612374805601749?= From: Jerry Lee 李修賢 commit df3cb754d13d2cd5490db9b8d536311f8413a92e upstream. When expanding a file system from (16TiB-2MiB) to 18TiB, the operation exits early which leads to result inconsistency between resize2fs and Ext4 kernel driver. === before === ○ → resize2fs /dev/mapper/thin resize2fs 1.45.5 (07-Jan-2020) Filesystem at /dev/mapper/thin is mounted on /mnt/test; on-line resizing required old_desc_blocks = 2048, new_desc_blocks = 2304 The filesystem on /dev/mapper/thin is now 4831837696 (4k) blocks long. [ 865.186308] EXT4-fs (dm-5): mounted filesystem with ordered data mode. Opts: (null). Quota mode: none. [ 912.091502] dm-4: detected capacity change from 34359738368 to 38654705664 [ 970.030550] dm-5: detected capacity change from 34359734272 to 38654701568 [ 1000.012751] EXT4-fs (dm-5): resizing filesystem from 4294966784 to 4831837696 blocks [ 1000.012878] EXT4-fs (dm-5): resized filesystem to 4294967296 === after === [ 129.104898] EXT4-fs (dm-5): mounted filesystem with ordered data mode. Opts: (null). Quota mode: none. [ 143.773630] dm-4: detected capacity change from 34359738368 to 38654705664 [ 198.203246] dm-5: detected capacity change from 34359734272 to 38654701568 [ 207.918603] EXT4-fs (dm-5): resizing filesystem from 4294966784 to 4831837696 blocks [ 207.918754] EXT4-fs (dm-5): resizing filesystem from 4294967296 to 4831837696 blocks [ 207.918758] EXT4-fs (dm-5): Converting file system to meta_bg [ 207.918790] EXT4-fs (dm-5): resizing filesystem from 4294967296 to 4831837696 blocks [ 221.454050] EXT4-fs (dm-5): resized to 4658298880 blocks [ 227.634613] EXT4-fs (dm-5): resized filesystem to 4831837696 Signed-off-by: Jerry Lee Link: https://lore.kernel.org/r/PU1PR04MB22635E739BD21150DC182AC6A18C9@PU1PR04MB2263.apcprd04.prod.outlook.com Signed-off-by: Theodore Ts'o Signed-off-by: Greg Kroah-Hartman --- fs/ext4/resize.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/fs/ext4/resize.c +++ b/fs/ext4/resize.c @@ -2092,7 +2092,7 @@ retry: goto out; } - if (ext4_blocks_count(es) == n_blocks_count) + if (ext4_blocks_count(es) == n_blocks_count && n_blocks_count_retry == 0) goto out; err = ext4_alloc_flex_bg_array(sb, n_group + 1); From patchwork Mon Oct 24 11:32:24 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8965 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp436904wru; Mon, 24 Oct 2022 05:58:24 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7F6a3UDQUrMSdu5r4t9Wh24LBPiDLCwgGmjCPs5CcEWLCRsCVMJOPfgcSooHPR4cTp33E2 X-Received: by 2002:aa7:985a:0:b0:566:5057:3ff3 with SMTP id n26-20020aa7985a000000b0056650573ff3mr33796127pfq.55.1666616304635; Mon, 24 Oct 2022 05:58:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666616304; cv=none; d=google.com; s=arc-20160816; b=xKdT4x8yYypJYekeThA8ddNCp+D6nEFUbhC/H86Rv/n5XmjZ/6YdjB7CTBBtCZLXtp YmWPAPkHc+89ikTPlVA8pk+eFUAJMwVwnYnLDDPWqLzkDr9sz1U70+SL1ZDHQe+AXRw7 gSDiIhAdfZ4uuqO7+OvpZh09UfCzIpkN1lnUfilL45FiGE4gIQhfJbHr6bTy3aA1/Ef1 jBtJwkuNArdE2nfC0qsVwsyWd0bZHatl9by1BKuPd+RBCjilt3vvvY4je+gCIBLBlLAV dAq3c3ryH7cA1stErCKta4HJu0i+Spuf55o2Jf+g/HzHVWmScyBne+ctutQpUAp0b+0N f2kQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=nA3UjYYQRo3nS1Agz/LGKGm6CatuNb1mmn1Hj5c0ga4=; b=0vViKxSplf+O79JX7avQ+ck+9JVkvJRrTuelJdnJi2vXIDLRWNyO1H/42lKgqTzhiA sTOUI5JhF7ni0lnXJ5PbQcw42EWycLDmUO80ZikKlz1uLfZerv2+BmFbxWjR05rssk3M 8XsItOPl35p+Pgg5oysa6QEIkZlZC8XILt1NP59uXHxsvQI48jejrqS29nWq0i74i/H+ 3aGBacgBTSGWRWACn7YWkqq1V9WC+FZ/7qBjeSxVrKYDN5NZE9JZVohMLG4v1EgKbb7E Pqs/t4feH5BOi7YHbL6agTi+HifZtjGstXDig/2GllhZ1CkBzMCilxFPzhplGvDVQQYV 1G3g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=SEat03x4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t190-20020a6381c7000000b004606d9040b9si36096010pgd.649.2022.10.24.05.58.11; Mon, 24 Oct 2022 05:58:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=SEat03x4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234432AbiJXM4T (ORCPT + 99 others); Mon, 24 Oct 2022 08:56:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43014 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234803AbiJXMzt (ORCPT ); Mon, 24 Oct 2022 08:55:49 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 50684580A0; Mon, 24 Oct 2022 05:15:29 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 399E1612CF; Mon, 24 Oct 2022 12:04:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4B265C433C1; Mon, 24 Oct 2022 12:04:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613095; bh=E0YbGMFmtEwZiigkCgf2+nGcnuIodXf/bVhO/X1D1PI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SEat03x4XvHr5G4UcQPlAbfMV2OD0oRZJ8KB0ZY7OMt16emoizAvVdo8pdBypLuz5 QLuK0LmhIn+mLYWK3D7vBNh326jCen+YUwYLkhnS7uyN/m+H19ui3q+66Y9XrJNbW9 6luMSs40EETVz3c54BGiQU4nDLSu/QXUTRoxvaKw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Michael Kelley , Guoqing Jiang , Saurabh Sengar , Song Liu Subject: [PATCH 4.19 225/229] md: Replace snprintf with scnprintf Date: Mon, 24 Oct 2022 13:32:24 +0200 Message-Id: <20221024113006.555447474@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747573858039259426?= X-GMAIL-MSGID: =?utf-8?q?1747573858039259426?= From: Saurabh Sengar commit 1727fd5015d8f93474148f94e34cda5aa6ad4a43 upstream. Current code produces a warning as shown below when total characters in the constituent block device names plus the slashes exceeds 200. snprintf() returns the number of characters generated from the given input, which could cause the expression “200 – len” to wrap around to a large positive number. Fix this by using scnprintf() instead, which returns the actual number of characters written into the buffer. [ 1513.267938] ------------[ cut here ]------------ [ 1513.267943] WARNING: CPU: 15 PID: 37247 at /lib/vsprintf.c:2509 vsnprintf+0x2c8/0x510 [ 1513.267944] Modules linked in: [ 1513.267969] CPU: 15 PID: 37247 Comm: mdadm Not tainted 5.4.0-1085-azure #90~18.04.1-Ubuntu [ 1513.267969] Hardware name: Microsoft Corporation Virtual Machine/Virtual Machine, BIOS Hyper-V UEFI Release v4.1 05/09/2022 [ 1513.267971] RIP: 0010:vsnprintf+0x2c8/0x510 <-snip-> [ 1513.267982] Call Trace: [ 1513.267986] snprintf+0x45/0x70 [ 1513.267990] ? disk_name+0x71/0xa0 [ 1513.267993] dump_zones+0x114/0x240 [raid0] [ 1513.267996] ? _cond_resched+0x19/0x40 [ 1513.267998] raid0_run+0x19e/0x270 [raid0] [ 1513.268000] md_run+0x5e0/0xc50 [ 1513.268003] ? security_capable+0x3f/0x60 [ 1513.268005] do_md_run+0x19/0x110 [ 1513.268006] md_ioctl+0x195e/0x1f90 [ 1513.268007] blkdev_ioctl+0x91f/0x9f0 [ 1513.268010] block_ioctl+0x3d/0x50 [ 1513.268012] do_vfs_ioctl+0xa9/0x640 [ 1513.268014] ? __fput+0x162/0x260 [ 1513.268016] ksys_ioctl+0x75/0x80 [ 1513.268017] __x64_sys_ioctl+0x1a/0x20 [ 1513.268019] do_syscall_64+0x5e/0x200 [ 1513.268021] entry_SYSCALL_64_after_hwframe+0x44/0xa9 Fixes: 766038846e875 ("md/raid0: replace printk() with pr_*()") Reviewed-by: Michael Kelley Acked-by: Guoqing Jiang Signed-off-by: Saurabh Sengar Signed-off-by: Song Liu Signed-off-by: Greg Kroah-Hartman --- drivers/md/raid0.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/drivers/md/raid0.c +++ b/drivers/md/raid0.c @@ -70,8 +70,8 @@ static void dump_zones(struct mddev *mdd int len = 0; for (k = 0; k < conf->strip_zone[j].nb_dev; k++) - len += snprintf(line+len, 200-len, "%s%s", k?"/":"", - bdevname(conf->devlist[j*raid_disks + len += scnprintf(line+len, 200-len, "%s%s", k?"/":"", + bdevname(conf->devlist[j*raid_disks + k]->bdev, b)); pr_debug("md: zone%d=[%s]\n", j, line); From patchwork Mon Oct 24 11:32:25 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9017 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp441298wru; Mon, 24 Oct 2022 06:05:43 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7azqrvlJB/Ca0GOXctQ6mFFBdzMDNs/Krts23/NzlAETvWKDL722AecNYSNVOTX4NHLQm3 X-Received: by 2002:a17:902:b20a:b0:178:6f5b:f903 with SMTP id t10-20020a170902b20a00b001786f5bf903mr34378074plr.39.1666616742791; Mon, 24 Oct 2022 06:05:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666616742; cv=none; d=google.com; s=arc-20160816; b=XavqmQoHq4QXEs/5+OmZDzQ75i/wPSW6DCN4nArCcNGxQpozS9hczud41or8i9pPQl 1b1AjOj7visaLkh3//RGSaevaECR4Zj1ezUtVRPrpzxE+x9oZ37upeXMNfDTvx9+b/Oh vgYpXvxLsEPh64tf+ffk8MEX9ozcixS5Yu8mrhf7+wUnF9bZNT9XjNYj3CDcbIkFqO7d NB/nnvns+3clxJ5uUr5P92orJvqCC9PnQ6yMGGFPZTFpgOuH6O3tqBBtt1IUh1/7OCIG 4Sn18f2leJoeCJ7tdzCBgMXd6t/7A3L2H23zvb7z7Ty0DBaQooi3ir2wNXBiUwn8Uci6 jRHg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=KoyxwZn6X1wThRDckOywlX+i4OhYO5cRjgxTSSOJf00=; b=NT9GgY8Mw7BBpdW4GXovxDm6yH4frieFWoGmSR2GPzXRd0b/AF+hXE3AQy8EePm59l 3hlzQsG1Wo+vZVeFqfGn00ha5Tg0M54d/NjrNu+PYzn4kpJh25tS1NDIckOxOQtLKuH+ mcffhQOjTm6pcRB/nwUaU2eT5TgvV3S3W+nHyHhWXiVzL1dnERT+B5FAPzmW73DvFJbd wuCV+mJYrE+LwQcCsQiCbDs/Fk0PKctVOBaY4ZzilaE9V3qg9tdUZUbT5oYwQNwZfziR chX5TIA6fuVj/eNuItK/zd7zk0PTl+gtPiJWsGa5VDDRwb7MosEuxKAfxG7PKiqGGX/P YZcA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ZtMMnkrj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h13-20020a65480d000000b0041c506dde92si32947884pgs.636.2022.10.24.06.04.54; Mon, 24 Oct 2022 06:05:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ZtMMnkrj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235010AbiJXNDm (ORCPT + 99 others); Mon, 24 Oct 2022 09:03:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43004 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235314AbiJXM7z (ORCPT ); Mon, 24 Oct 2022 08:59:55 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C364D265E; Mon, 24 Oct 2022 05:19:28 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 59A61612B4; Mon, 24 Oct 2022 12:04:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6BD28C433C1; Mon, 24 Oct 2022 12:04:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613066; bh=/GUBL19Jp9NmcH/HaL4btiEfO1T1Pkk6YALZLRd1jc4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZtMMnkrjEkT1zqFX5r9JbiBAK4BhirHQcChf5oEoy/rmBF1ylxp7P/DJYOAKzVa9d Jz8hKvpTaosuRxxWYfK92H8qIt2C6MUl5UYbbMUXq3aVkbzM4/9Huo2RtWQe3N6P7X 5SZPYfkonYsghqAxozTPSuoQzHa1kYit1KDfHpnQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ard Biesheuvel Subject: [PATCH 4.19 226/229] efi: libstub: drop pointless get_memory_map() call Date: Mon, 24 Oct 2022 13:32:25 +0200 Message-Id: <20221024113006.590063404@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747574317547425574?= X-GMAIL-MSGID: =?utf-8?q?1747574317547425574?= From: Ard Biesheuvel commit d80ca810f096ff66f451e7a3ed2f0cd9ef1ff519 upstream. Currently, the non-x86 stub code calls get_memory_map() redundantly, given that the data it returns is never used anywhere. So drop the call. Cc: # v4.14+ Fixes: 24d7c494ce46 ("efi/arm-stub: Round up FDT allocation to mapping size") Signed-off-by: Ard Biesheuvel Signed-off-by: Greg Kroah-Hartman --- drivers/firmware/efi/libstub/fdt.c | 8 -------- 1 file changed, 8 deletions(-) --- a/drivers/firmware/efi/libstub/fdt.c +++ b/drivers/firmware/efi/libstub/fdt.c @@ -301,14 +301,6 @@ efi_status_t allocate_new_fdt_and_exit_b goto fail; } - /* - * Now that we have done our final memory allocation (and free) - * we can get the memory map key needed for exit_boot_services(). - */ - status = efi_get_memory_map(sys_table, &map); - if (status != EFI_SUCCESS) - goto fail_free_new_fdt; - status = update_fdt(sys_table, (void *)fdt_addr, fdt_size, (void *)*new_fdt_addr, MAX_FDT_SIZE, cmdline_ptr, initrd_addr, initrd_size); From patchwork Mon Oct 24 11:32:26 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9819 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp555115wru; Mon, 24 Oct 2022 09:59:03 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7Bq1p0kSD+gVLxSNBgdQ9eJuUmK1FZK3QhSr4IM2o6kTLUmaI2Kj7YBloUg0Ej/LpGRlN9 X-Received: by 2002:a63:69c6:0:b0:46e:af43:1588 with SMTP id e189-20020a6369c6000000b0046eaf431588mr17309968pgc.520.1666630742870; Mon, 24 Oct 2022 09:59:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666630742; cv=none; d=google.com; s=arc-20160816; b=jwgKGv0LxH8NmrxpSTfuYW3VfJCBtMpH64o3/k4LHvrzzmhkjP2uwRBfejykauXxHv gRz5BumUl5rltDtaJ2mdWoh0qMQbTVAA7U0IFQdYG6O2LG3J3HVbkJAUPEDFr4EtxxNC iuW0UWYwKVuynbwG7kjdqMQijWIpRwNPhqieerG5V+9RCrGnn77Kr0TUjw9B349CpYUf 3aGEhDEOZ9ZDLJ4BKztVgtYmGz07HW/A6OuOFIB4/IzXw5bswahWkDK+sLzBpBEWkRGh SSxYcDguYtoyIA40otJieDwc7ravqdcT1+phqG5wH/r696OYYABV/QMbYH/QYDL6w4Xa 9Arw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=TpMLyKpw+crb/lRdawTWkIT83cP5/63xXvs06uLHpOo=; b=GqxWf2QbO+s2zUo9fLRkxi4Z1PDeZkVEXv6Qv/n9+8pps5RdQ3jFO7KGpcy6Y7eMrt 7Vv9l0wolToUX+XRqq4rhxy4mNTW6X3auv+MKCpROy+pQld16ojI9Z2WMWIRXk2/zBWg 5ngzN9KtTr/f8DBdJAjfkTrcNB6SJlJawd1TnWziWvRq+zbFvPRWpGijbAFLEvEYstDM eqoJhXdW4sehKUuyExhD/pML4GHlrdsO/bIQer9IYpDqOWQpCBi/paaQCrzzkQ8ILTD6 eDjFh96UnNlcPMxlg5SnHq6MwAkBmZWHTn6HOCxDAlmIq/bicHNgF2zvDNwgdDTUqWgg QJWw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=18osOPz8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c2-20020a170902724200b00179f9521d08si20501pll.149.2022.10.24.09.58.47; Mon, 24 Oct 2022 09:59:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=18osOPz8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232246AbiJXQwZ (ORCPT + 99 others); Mon, 24 Oct 2022 12:52:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55372 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235193AbiJXQtM (ORCPT ); Mon, 24 Oct 2022 12:49:12 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DFF454D812; Mon, 24 Oct 2022 08:32:15 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id AA4FEB811A1; Mon, 24 Oct 2022 12:04:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0F410C433C1; Mon, 24 Oct 2022 12:04:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613069; bh=uVTuhiu8uSPPYi6R959VK4yn2WuwpL50i1NibvnVatk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=18osOPz8A9/ExmdDrvjBL895E2XyuaCDRWmRzwAHM6wRpxiRy/xsI7SH5x8PI/9ys FfRBXJFB5a/rrNlaiEU7GYSa4YGY3NGIgHXtMpqWMGghRvlKwFRZt8Dk3cTnPaQQ+4 BFHsF9SDmSX+EqF7T89yIFR+2+UrL9ymBPbI56l4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Eric Dumazet , Jakub Kicinski , Carlos Llamas Subject: [PATCH 4.19 227/229] inet: fully convert sk->sk_rx_dst to RCU rules Date: Mon, 24 Oct 2022 13:32:26 +0200 Message-Id: <20221024113006.625388538@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747588997725025585?= X-GMAIL-MSGID: =?utf-8?q?1747588997725025585?= From: Eric Dumazet commit 8f905c0e7354ef261360fb7535ea079b1082c105 upstream. syzbot reported various issues around early demux, one being included in this changelog [1] sk->sk_rx_dst is using RCU protection without clearly documenting it. And following sequences in tcp_v4_do_rcv()/tcp_v6_do_rcv() are not following standard RCU rules. [a] dst_release(dst); [b] sk->sk_rx_dst = NULL; They look wrong because a delete operation of RCU protected pointer is supposed to clear the pointer before the call_rcu()/synchronize_rcu() guarding actual memory freeing. In some cases indeed, dst could be freed before [b] is done. We could cheat by clearing sk_rx_dst before calling dst_release(), but this seems the right time to stick to standard RCU annotations and debugging facilities. [1] BUG: KASAN: use-after-free in dst_check include/net/dst.h:470 [inline] BUG: KASAN: use-after-free in tcp_v4_early_demux+0x95b/0x960 net/ipv4/tcp_ipv4.c:1792 Read of size 2 at addr ffff88807f1cb73a by task syz-executor.5/9204 CPU: 0 PID: 9204 Comm: syz-executor.5 Not tainted 5.16.0-rc5-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0xcd/0x134 lib/dump_stack.c:106 print_address_description.constprop.0.cold+0x8d/0x320 mm/kasan/report.c:247 __kasan_report mm/kasan/report.c:433 [inline] kasan_report.cold+0x83/0xdf mm/kasan/report.c:450 dst_check include/net/dst.h:470 [inline] tcp_v4_early_demux+0x95b/0x960 net/ipv4/tcp_ipv4.c:1792 ip_rcv_finish_core.constprop.0+0x15de/0x1e80 net/ipv4/ip_input.c:340 ip_list_rcv_finish.constprop.0+0x1b2/0x6e0 net/ipv4/ip_input.c:583 ip_sublist_rcv net/ipv4/ip_input.c:609 [inline] ip_list_rcv+0x34e/0x490 net/ipv4/ip_input.c:644 __netif_receive_skb_list_ptype net/core/dev.c:5508 [inline] __netif_receive_skb_list_core+0x549/0x8e0 net/core/dev.c:5556 __netif_receive_skb_list net/core/dev.c:5608 [inline] netif_receive_skb_list_internal+0x75e/0xd80 net/core/dev.c:5699 gro_normal_list net/core/dev.c:5853 [inline] gro_normal_list net/core/dev.c:5849 [inline] napi_complete_done+0x1f1/0x880 net/core/dev.c:6590 virtqueue_napi_complete drivers/net/virtio_net.c:339 [inline] virtnet_poll+0xca2/0x11b0 drivers/net/virtio_net.c:1557 __napi_poll+0xaf/0x440 net/core/dev.c:7023 napi_poll net/core/dev.c:7090 [inline] net_rx_action+0x801/0xb40 net/core/dev.c:7177 __do_softirq+0x29b/0x9c2 kernel/softirq.c:558 invoke_softirq kernel/softirq.c:432 [inline] __irq_exit_rcu+0x123/0x180 kernel/softirq.c:637 irq_exit_rcu+0x5/0x20 kernel/softirq.c:649 common_interrupt+0x52/0xc0 arch/x86/kernel/irq.c:240 asm_common_interrupt+0x1e/0x40 arch/x86/include/asm/idtentry.h:629 RIP: 0033:0x7f5e972bfd57 Code: 39 d1 73 14 0f 1f 80 00 00 00 00 48 8b 50 f8 48 83 e8 08 48 39 ca 77 f3 48 39 c3 73 3e 48 89 13 48 8b 50 f8 48 89 38 49 8b 0e <48> 8b 3e 48 83 c3 08 48 83 c6 08 eb bc 48 39 d1 72 9e 48 39 d0 73 RSP: 002b:00007fff8a413210 EFLAGS: 00000283 RAX: 00007f5e97108990 RBX: 00007f5e97108338 RCX: ffffffff81d3aa45 RDX: ffffffff81d3aa45 RSI: 00007f5e97108340 RDI: ffffffff81d3aa45 RBP: 00007f5e97107eb8 R08: 00007f5e97108d88 R09: 0000000093c2e8d9 R10: 0000000000000000 R11: 0000000000000000 R12: 00007f5e97107eb0 R13: 00007f5e97108338 R14: 00007f5e97107ea8 R15: 0000000000000019 Allocated by task 13: kasan_save_stack+0x1e/0x50 mm/kasan/common.c:38 kasan_set_track mm/kasan/common.c:46 [inline] set_alloc_info mm/kasan/common.c:434 [inline] __kasan_slab_alloc+0x90/0xc0 mm/kasan/common.c:467 kasan_slab_alloc include/linux/kasan.h:259 [inline] slab_post_alloc_hook mm/slab.h:519 [inline] slab_alloc_node mm/slub.c:3234 [inline] slab_alloc mm/slub.c:3242 [inline] kmem_cache_alloc+0x202/0x3a0 mm/slub.c:3247 dst_alloc+0x146/0x1f0 net/core/dst.c:92 rt_dst_alloc+0x73/0x430 net/ipv4/route.c:1613 ip_route_input_slow+0x1817/0x3a20 net/ipv4/route.c:2340 ip_route_input_rcu net/ipv4/route.c:2470 [inline] ip_route_input_noref+0x116/0x2a0 net/ipv4/route.c:2415 ip_rcv_finish_core.constprop.0+0x288/0x1e80 net/ipv4/ip_input.c:354 ip_list_rcv_finish.constprop.0+0x1b2/0x6e0 net/ipv4/ip_input.c:583 ip_sublist_rcv net/ipv4/ip_input.c:609 [inline] ip_list_rcv+0x34e/0x490 net/ipv4/ip_input.c:644 __netif_receive_skb_list_ptype net/core/dev.c:5508 [inline] __netif_receive_skb_list_core+0x549/0x8e0 net/core/dev.c:5556 __netif_receive_skb_list net/core/dev.c:5608 [inline] netif_receive_skb_list_internal+0x75e/0xd80 net/core/dev.c:5699 gro_normal_list net/core/dev.c:5853 [inline] gro_normal_list net/core/dev.c:5849 [inline] napi_complete_done+0x1f1/0x880 net/core/dev.c:6590 virtqueue_napi_complete drivers/net/virtio_net.c:339 [inline] virtnet_poll+0xca2/0x11b0 drivers/net/virtio_net.c:1557 __napi_poll+0xaf/0x440 net/core/dev.c:7023 napi_poll net/core/dev.c:7090 [inline] net_rx_action+0x801/0xb40 net/core/dev.c:7177 __do_softirq+0x29b/0x9c2 kernel/softirq.c:558 Freed by task 13: kasan_save_stack+0x1e/0x50 mm/kasan/common.c:38 kasan_set_track+0x21/0x30 mm/kasan/common.c:46 kasan_set_free_info+0x20/0x30 mm/kasan/generic.c:370 ____kasan_slab_free mm/kasan/common.c:366 [inline] ____kasan_slab_free mm/kasan/common.c:328 [inline] __kasan_slab_free+0xff/0x130 mm/kasan/common.c:374 kasan_slab_free include/linux/kasan.h:235 [inline] slab_free_hook mm/slub.c:1723 [inline] slab_free_freelist_hook+0x8b/0x1c0 mm/slub.c:1749 slab_free mm/slub.c:3513 [inline] kmem_cache_free+0xbd/0x5d0 mm/slub.c:3530 dst_destroy+0x2d6/0x3f0 net/core/dst.c:127 rcu_do_batch kernel/rcu/tree.c:2506 [inline] rcu_core+0x7ab/0x1470 kernel/rcu/tree.c:2741 __do_softirq+0x29b/0x9c2 kernel/softirq.c:558 Last potentially related work creation: kasan_save_stack+0x1e/0x50 mm/kasan/common.c:38 __kasan_record_aux_stack+0xf5/0x120 mm/kasan/generic.c:348 __call_rcu kernel/rcu/tree.c:2985 [inline] call_rcu+0xb1/0x740 kernel/rcu/tree.c:3065 dst_release net/core/dst.c:177 [inline] dst_release+0x79/0xe0 net/core/dst.c:167 tcp_v4_do_rcv+0x612/0x8d0 net/ipv4/tcp_ipv4.c:1712 sk_backlog_rcv include/net/sock.h:1030 [inline] __release_sock+0x134/0x3b0 net/core/sock.c:2768 release_sock+0x54/0x1b0 net/core/sock.c:3300 tcp_sendmsg+0x36/0x40 net/ipv4/tcp.c:1441 inet_sendmsg+0x99/0xe0 net/ipv4/af_inet.c:819 sock_sendmsg_nosec net/socket.c:704 [inline] sock_sendmsg+0xcf/0x120 net/socket.c:724 sock_write_iter+0x289/0x3c0 net/socket.c:1057 call_write_iter include/linux/fs.h:2162 [inline] new_sync_write+0x429/0x660 fs/read_write.c:503 vfs_write+0x7cd/0xae0 fs/read_write.c:590 ksys_write+0x1ee/0x250 fs/read_write.c:643 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x44/0xae The buggy address belongs to the object at ffff88807f1cb700 which belongs to the cache ip_dst_cache of size 176 The buggy address is located 58 bytes inside of 176-byte region [ffff88807f1cb700, ffff88807f1cb7b0) The buggy address belongs to the page: page:ffffea0001fc72c0 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x7f1cb flags: 0xfff00000000200(slab|node=0|zone=1|lastcpupid=0x7ff) raw: 00fff00000000200 dead000000000100 dead000000000122 ffff8881413bb780 raw: 0000000000000000 0000000000100010 00000001ffffffff 0000000000000000 page dumped because: kasan: bad access detected page_owner tracks the page as allocated page last allocated via order 0, migratetype Unmovable, gfp_mask 0x112a20(GFP_ATOMIC|__GFP_NOWARN|__GFP_NORETRY|__GFP_HARDWALL), pid 5, ts 108466983062, free_ts 108048976062 prep_new_page mm/page_alloc.c:2418 [inline] get_page_from_freelist+0xa72/0x2f50 mm/page_alloc.c:4149 __alloc_pages+0x1b2/0x500 mm/page_alloc.c:5369 alloc_pages+0x1a7/0x300 mm/mempolicy.c:2191 alloc_slab_page mm/slub.c:1793 [inline] allocate_slab mm/slub.c:1930 [inline] new_slab+0x32d/0x4a0 mm/slub.c:1993 ___slab_alloc+0x918/0xfe0 mm/slub.c:3022 __slab_alloc.constprop.0+0x4d/0xa0 mm/slub.c:3109 slab_alloc_node mm/slub.c:3200 [inline] slab_alloc mm/slub.c:3242 [inline] kmem_cache_alloc+0x35c/0x3a0 mm/slub.c:3247 dst_alloc+0x146/0x1f0 net/core/dst.c:92 rt_dst_alloc+0x73/0x430 net/ipv4/route.c:1613 __mkroute_output net/ipv4/route.c:2564 [inline] ip_route_output_key_hash_rcu+0x921/0x2d00 net/ipv4/route.c:2791 ip_route_output_key_hash+0x18b/0x300 net/ipv4/route.c:2619 __ip_route_output_key include/net/route.h:126 [inline] ip_route_output_flow+0x23/0x150 net/ipv4/route.c:2850 ip_route_output_key include/net/route.h:142 [inline] geneve_get_v4_rt+0x3a6/0x830 drivers/net/geneve.c:809 geneve_xmit_skb drivers/net/geneve.c:899 [inline] geneve_xmit+0xc4a/0x3540 drivers/net/geneve.c:1082 __netdev_start_xmit include/linux/netdevice.h:4994 [inline] netdev_start_xmit include/linux/netdevice.h:5008 [inline] xmit_one net/core/dev.c:3590 [inline] dev_hard_start_xmit+0x1eb/0x920 net/core/dev.c:3606 __dev_queue_xmit+0x299a/0x3650 net/core/dev.c:4229 page last free stack trace: reset_page_owner include/linux/page_owner.h:24 [inline] free_pages_prepare mm/page_alloc.c:1338 [inline] free_pcp_prepare+0x374/0x870 mm/page_alloc.c:1389 free_unref_page_prepare mm/page_alloc.c:3309 [inline] free_unref_page+0x19/0x690 mm/page_alloc.c:3388 qlink_free mm/kasan/quarantine.c:146 [inline] qlist_free_all+0x5a/0xc0 mm/kasan/quarantine.c:165 kasan_quarantine_reduce+0x180/0x200 mm/kasan/quarantine.c:272 __kasan_slab_alloc+0xa2/0xc0 mm/kasan/common.c:444 kasan_slab_alloc include/linux/kasan.h:259 [inline] slab_post_alloc_hook mm/slab.h:519 [inline] slab_alloc_node mm/slub.c:3234 [inline] kmem_cache_alloc_node+0x255/0x3f0 mm/slub.c:3270 __alloc_skb+0x215/0x340 net/core/skbuff.c:414 alloc_skb include/linux/skbuff.h:1126 [inline] alloc_skb_with_frags+0x93/0x620 net/core/skbuff.c:6078 sock_alloc_send_pskb+0x783/0x910 net/core/sock.c:2575 mld_newpack+0x1df/0x770 net/ipv6/mcast.c:1754 add_grhead+0x265/0x330 net/ipv6/mcast.c:1857 add_grec+0x1053/0x14e0 net/ipv6/mcast.c:1995 mld_send_initial_cr.part.0+0xf6/0x230 net/ipv6/mcast.c:2242 mld_send_initial_cr net/ipv6/mcast.c:1232 [inline] mld_dad_work+0x1d3/0x690 net/ipv6/mcast.c:2268 process_one_work+0x9b2/0x1690 kernel/workqueue.c:2298 worker_thread+0x658/0x11f0 kernel/workqueue.c:2445 Memory state around the buggy address: ffff88807f1cb600: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88807f1cb680: fb fb fb fb fb fb fc fc fc fc fc fc fc fc fc fc >ffff88807f1cb700: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff88807f1cb780: fb fb fb fb fb fb fc fc fc fc fc fc fc fc fc fc ffff88807f1cb800: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb Fixes: 41063e9dd119 ("ipv4: Early TCP socket demux.") Signed-off-by: Eric Dumazet Link: https://lore.kernel.org/r/20211220143330.680945-1-eric.dumazet@gmail.com Signed-off-by: Jakub Kicinski [cmllamas: fixed trivial merge conflict] Signed-off-by: Carlos Llamas Signed-off-by: Greg Kroah-Hartman --- include/net/sock.h | 2 +- net/ipv4/af_inet.c | 2 +- net/ipv4/tcp.c | 3 +-- net/ipv4/tcp_input.c | 2 +- net/ipv4/tcp_ipv4.c | 11 +++++++---- net/ipv4/udp.c | 6 +++--- net/ipv6/tcp_ipv6.c | 11 +++++++---- net/ipv6/udp.c | 4 ++-- 8 files changed, 23 insertions(+), 18 deletions(-) --- a/include/net/sock.h +++ b/include/net/sock.h @@ -401,7 +401,7 @@ struct sock { #ifdef CONFIG_XFRM struct xfrm_policy __rcu *sk_policy[2]; #endif - struct dst_entry *sk_rx_dst; + struct dst_entry __rcu *sk_rx_dst; struct dst_entry __rcu *sk_dst_cache; atomic_t sk_omem_alloc; int sk_sndbuf; --- a/net/ipv4/af_inet.c +++ b/net/ipv4/af_inet.c @@ -157,7 +157,7 @@ void inet_sock_destruct(struct sock *sk) kfree(rcu_dereference_protected(inet->inet_opt, 1)); dst_release(rcu_dereference_check(sk->sk_dst_cache, 1)); - dst_release(sk->sk_rx_dst); + dst_release(rcu_dereference_protected(sk->sk_rx_dst, 1)); sk_refcnt_debug_dec(sk); } EXPORT_SYMBOL(inet_sock_destruct); --- a/net/ipv4/tcp.c +++ b/net/ipv4/tcp.c @@ -2626,8 +2626,7 @@ int tcp_disconnect(struct sock *sk, int icsk->icsk_ack.rcv_mss = TCP_MIN_MSS; memset(&tp->rx_opt, 0, sizeof(tp->rx_opt)); __sk_dst_reset(sk); - dst_release(sk->sk_rx_dst); - sk->sk_rx_dst = NULL; + dst_release(xchg((__force struct dst_entry **)&sk->sk_rx_dst, NULL)); tcp_saved_syn_free(tp); tp->compressed_ack = 0; tp->segs_in = 0; --- a/net/ipv4/tcp_input.c +++ b/net/ipv4/tcp_input.c @@ -5552,7 +5552,7 @@ void tcp_rcv_established(struct sock *sk trace_tcp_probe(sk, skb); tcp_mstamp_refresh(tp); - if (unlikely(!sk->sk_rx_dst)) + if (unlikely(!rcu_access_pointer(sk->sk_rx_dst))) inet_csk(sk)->icsk_af_ops->sk_rx_dst_set(sk, skb); /* * Header prediction. --- a/net/ipv4/tcp_ipv4.c +++ b/net/ipv4/tcp_ipv4.c @@ -1544,15 +1544,18 @@ int tcp_v4_do_rcv(struct sock *sk, struc struct sock *rsk; if (sk->sk_state == TCP_ESTABLISHED) { /* Fast path */ - struct dst_entry *dst = sk->sk_rx_dst; + struct dst_entry *dst; + + dst = rcu_dereference_protected(sk->sk_rx_dst, + lockdep_sock_is_held(sk)); sock_rps_save_rxhash(sk, skb); sk_mark_napi_id(sk, skb); if (dst) { if (inet_sk(sk)->rx_dst_ifindex != skb->skb_iif || !dst->ops->check(dst, 0)) { + RCU_INIT_POINTER(sk->sk_rx_dst, NULL); dst_release(dst); - sk->sk_rx_dst = NULL; } } tcp_rcv_established(sk, skb); @@ -1627,7 +1630,7 @@ int tcp_v4_early_demux(struct sk_buff *s skb->sk = sk; skb->destructor = sock_edemux; if (sk_fullsock(sk)) { - struct dst_entry *dst = READ_ONCE(sk->sk_rx_dst); + struct dst_entry *dst = rcu_dereference(sk->sk_rx_dst); if (dst) dst = dst_check(dst, 0); @@ -1932,7 +1935,7 @@ void inet_sk_rx_dst_set(struct sock *sk, struct dst_entry *dst = skb_dst(skb); if (dst && dst_hold_safe(dst)) { - sk->sk_rx_dst = dst; + rcu_assign_pointer(sk->sk_rx_dst, dst); inet_sk(sk)->rx_dst_ifindex = skb->skb_iif; } } --- a/net/ipv4/udp.c +++ b/net/ipv4/udp.c @@ -2050,7 +2050,7 @@ bool udp_sk_rx_dst_set(struct sock *sk, struct dst_entry *old; if (dst_hold_safe(dst)) { - old = xchg(&sk->sk_rx_dst, dst); + old = xchg((__force struct dst_entry **)&sk->sk_rx_dst, dst); dst_release(old); return old != dst; } @@ -2240,7 +2240,7 @@ int __udp4_lib_rcv(struct sk_buff *skb, struct dst_entry *dst = skb_dst(skb); int ret; - if (unlikely(sk->sk_rx_dst != dst)) + if (unlikely(rcu_dereference(sk->sk_rx_dst) != dst)) udp_sk_rx_dst_set(sk, dst); ret = udp_unicast_rcv_skb(sk, skb, uh); @@ -2398,7 +2398,7 @@ int udp_v4_early_demux(struct sk_buff *s skb->sk = sk; skb->destructor = sock_efree; - dst = READ_ONCE(sk->sk_rx_dst); + dst = rcu_dereference(sk->sk_rx_dst); if (dst) dst = dst_check(dst, 0); --- a/net/ipv6/tcp_ipv6.c +++ b/net/ipv6/tcp_ipv6.c @@ -97,7 +97,7 @@ static void inet6_sk_rx_dst_set(struct s if (dst && dst_hold_safe(dst)) { const struct rt6_info *rt = (const struct rt6_info *)dst; - sk->sk_rx_dst = dst; + rcu_assign_pointer(sk->sk_rx_dst, dst); inet_sk(sk)->rx_dst_ifindex = skb->skb_iif; inet6_sk(sk)->rx_dst_cookie = rt6_get_cookie(rt); } @@ -1344,15 +1344,18 @@ static int tcp_v6_do_rcv(struct sock *sk opt_skb = skb_clone(skb, sk_gfp_mask(sk, GFP_ATOMIC)); if (sk->sk_state == TCP_ESTABLISHED) { /* Fast path */ - struct dst_entry *dst = sk->sk_rx_dst; + struct dst_entry *dst; + + dst = rcu_dereference_protected(sk->sk_rx_dst, + lockdep_sock_is_held(sk)); sock_rps_save_rxhash(sk, skb); sk_mark_napi_id(sk, skb); if (dst) { if (inet_sk(sk)->rx_dst_ifindex != skb->skb_iif || dst->ops->check(dst, np->rx_dst_cookie) == NULL) { + RCU_INIT_POINTER(sk->sk_rx_dst, NULL); dst_release(dst); - sk->sk_rx_dst = NULL; } } @@ -1697,7 +1700,7 @@ static void tcp_v6_early_demux(struct sk skb->sk = sk; skb->destructor = sock_edemux; if (sk_fullsock(sk)) { - struct dst_entry *dst = READ_ONCE(sk->sk_rx_dst); + struct dst_entry *dst = rcu_dereference(sk->sk_rx_dst); if (dst) dst = dst_check(dst, inet6_sk(sk)->rx_dst_cookie); --- a/net/ipv6/udp.c +++ b/net/ipv6/udp.c @@ -828,7 +828,7 @@ int __udp6_lib_rcv(struct sk_buff *skb, struct dst_entry *dst = skb_dst(skb); int ret; - if (unlikely(sk->sk_rx_dst != dst)) + if (unlikely(rcu_dereference(sk->sk_rx_dst) != dst)) udp6_sk_rx_dst_set(sk, dst); if (!uh->check && !udp_sk(sk)->no_check6_rx) { @@ -940,7 +940,7 @@ static void udp_v6_early_demux(struct sk skb->sk = sk; skb->destructor = sock_efree; - dst = READ_ONCE(sk->sk_rx_dst); + dst = rcu_dereference(sk->sk_rx_dst); if (dst) dst = dst_check(dst, inet6_sk(sk)->rx_dst_cookie); From patchwork Mon Oct 24 11:32:27 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8878 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp433303wru; Mon, 24 Oct 2022 05:49:04 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6e2XkiDZfxGA9plz3yo1CXltmEI4MZ/9XsjqCA3njBtZQnl9DtD2z075VLYcAOM4pg0oLB X-Received: by 2002:a17:90a:8504:b0:212:c1f4:ddf1 with SMTP id l4-20020a17090a850400b00212c1f4ddf1mr23798574pjn.224.1666615733877; Mon, 24 Oct 2022 05:48:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666615733; cv=none; d=google.com; s=arc-20160816; b=Blohg5hOjSMkCV5xVo2kxGCCdGP5mgRbvZcPe4oz6iGoJXJQsOShP8JSWA0S+ybWf2 mPAJnmvCXZKSCDqfr9rigxA1iK/3owkEyWnpN0bE8WszLfRTeQi0AlqP1kOp2P3NlS77 0I5AexCLGK0pT/XkOVSOKDmKyTs0JfUhtbq42KqhY8D3py92HLyDI9u3d1qZZ9KVmhs2 IoxsWQNma14d7M8JU+6X1QXnRb9PImJjPcufWGoR+jmrtdKzCFJ6LLi6+Nht/UVJLjal czr4Pwp1cZnrtL/CLYW0SR4a3xjMqw5K7BSwptq8vgjoCkjM+2QBJqodS4/iJj/7nxFw 1Xnw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=NGQPDhb7x7+wydTtcZFehZh80yJnk0tehq4AXLIshBE=; b=RzGUjW+gH5xGYLvZCZeBd0ZCIAJAM3t+oJNweY884hAmSbPruVnhqu1MJik7hjYcg/ pFVeToeXIiQ4/V+Jff537iBpCU2NpLjzriFobvzG3fZPqdV9trwjMWT/EulJPT2SHHo+ WN2o8nQI/FG/E2gKzUN6NAQpb4nfyezZelc6hH8hkacosHJ0HiNcaRS74fwGbW5eiiZe ZWHCnOP3btrIZZKuUNBoQ3/o2KuWO+BLa1wCtW5Zsj9ufsMBAVXgiUf49BwlvGkS1GCc 0c/NdP2Dm2BNQ6OOTzYXu9WsePFZ+WMQQbe18Bo+eaApSlUVI2h+l8N1LOMseAFFFbp0 +DjA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=xKjBEAbk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k62-20020a17090a4cc400b00212d5631badsi8223350pjh.55.2022.10.24.05.48.39; Mon, 24 Oct 2022 05:48:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=xKjBEAbk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234201AbiJXMmT (ORCPT + 99 others); Mon, 24 Oct 2022 08:42:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43984 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234276AbiJXMjX (ORCPT ); Mon, 24 Oct 2022 08:39:23 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 659958B2C0; Mon, 24 Oct 2022 05:07:09 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id A5DB46128E; Mon, 24 Oct 2022 12:04:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B8B3BC433C1; Mon, 24 Oct 2022 12:04:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613072; bh=jUlYH+CCO+C1GozJgPk99oAfl+QuIg9M6++iiseMq9I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xKjBEAbkIafJ/5IzASvz7RZbb6Ri1ddILtXgv61ynTSUADUtElmhTPWDnnh7cg/gJ J/2GY9gblUw3EXXWnmGtlGCLA68wtyZReKSFogLQTW/Fx6w3w+n+T9JdMOGM0MKk1h oaYx2XPWAejI4A6S7Q2aSdeDTlm3faPTPAHFjA7A= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Rafael J. Wysocki" , Chen Yu Subject: [PATCH 4.19 228/229] thermal: intel_powerclamp: Use first online CPU as control_cpu Date: Mon, 24 Oct 2022 13:32:27 +0200 Message-Id: <20221024113006.655375423@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747573259651921793?= X-GMAIL-MSGID: =?utf-8?q?1747573259651921793?= From: Rafael J. Wysocki commit 4bb7f6c2781e46fc5bd00475a66df2ea30ef330d upstream. Commit 68b99e94a4a2 ("thermal: intel_powerclamp: Use get_cpu() instead of smp_processor_id() to avoid crash") fixed an issue related to using smp_processor_id() in preemptible context by replacing it with a pair of get_cpu()/put_cpu(), but what is needed there really is any online CPU and not necessarily the one currently running the code. Arguably, getting the one that's running the code in there is confusing. For this reason, simply give the control CPU role to the first online one which automatically will be CPU0 if it is online, so one check can be dropped from the code for an added benefit. Link: https://lore.kernel.org/linux-pm/20221011113646.GA12080@duo.ucw.cz/ Fixes: 68b99e94a4a2 ("thermal: intel_powerclamp: Use get_cpu() instead of smp_processor_id() to avoid crash") Signed-off-by: Rafael J. Wysocki Reviewed-by: Chen Yu Signed-off-by: Greg Kroah-Hartman --- drivers/thermal/intel_powerclamp.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) --- a/drivers/thermal/intel_powerclamp.c +++ b/drivers/thermal/intel_powerclamp.c @@ -549,11 +549,7 @@ static int start_power_clamp(void) get_online_cpus(); /* prefer BSP */ - control_cpu = 0; - if (!cpu_online(control_cpu)) { - control_cpu = get_cpu(); - put_cpu(); - } + control_cpu = cpumask_first(cpu_online_mask); clamping = true; schedule_delayed_work(&poll_pkg_cstate_work, 0); From patchwork Mon Oct 24 11:32:28 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8876 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp433249wru; Mon, 24 Oct 2022 05:48:55 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6klsoP1+sBQZ8EARdu10FZj/HN84kW7j0jgILKUt5XRsJOcBaQj16q1PSVnrFtcaf/OkWl X-Received: by 2002:a17:903:41ca:b0:186:a68e:c06d with SMTP id u10-20020a17090341ca00b00186a68ec06dmr5419047ple.61.1666615735479; Mon, 24 Oct 2022 05:48:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666615735; cv=none; d=google.com; s=arc-20160816; b=TQJpXoWSYRcv9dYuRQWI8uyZ7E+L/ttkVZi+EF9BlTlVV6FCR/PzdB82Sxq/x2ModA mOamw6p/AfMbrFwAxBr1E8GFxm5VzIpYgwfYvaErWJ9XinS2WI4m39PygN6hF9v6oFOH QXoUZhue5TJtcQyhbznUr6SJp7yBLvPp7fqRQbNQNcWlEYED2pXVSRLMwhmqIhpB+o/H S5K8d8GmEynDI5JsyJ//Akd52H6dr237gPXfxV38YuAykZ58w0nQDMWN5BmL1hu2k7xt iti1lVdJe0m9XmYC9bPM1tUi9vQf8uVltuEb70a3bDV+tOukAwXKw7HsjsucvT7uhv/c g6BQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=E3LFXV2vyuRDWnSXKx01IaPvG9g3EwNCRRsEgRJ1rQs=; b=FHl5w/yDJQWRaJc3/6kc9HJPMGQbHBOnokgrzvv9+JnQnqZxiAt3KmwR9opVKI3rMc rGAYDRZPRPgTQ71/23xjlYWG+mVuWucnyjb+o7bcTemRfhr9uVOoCJc0GB9CxxkWJVsJ cHLxEGEhn0ZjqqJJaVWuIV80tLooNU2ePh6aiq6eWKdxYxDuZefx74HQRMj23GhrhuRo ARPERVxMbs60O2pYDnESWfH1ehEPgwvP2dJfE+My2qm898JCaujJ7i7Lbldt6N9OY3f2 tMTZhXNVZQX4cFqZaRH8+hpja1PyrvQsVBcrvl7Etvp06GaW9VSJN8dRJ2WUNVPpu51D EaQA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=i1tTvQKO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l1-20020a635701000000b00438d11be245si32475731pgb.429.2022.10.24.05.48.40; Mon, 24 Oct 2022 05:48:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=i1tTvQKO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229706AbiJXMmX (ORCPT + 99 others); Mon, 24 Oct 2022 08:42:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34818 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234301AbiJXMjd (ORCPT ); Mon, 24 Oct 2022 08:39:33 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 656998A7FE; Mon, 24 Oct 2022 05:07:08 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 45B8D61254; Mon, 24 Oct 2022 12:04:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 58C2FC433C1; Mon, 24 Oct 2022 12:04:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613074; bh=0+56YQKLRS3I50WR/rVpZJDlwNIJzh94dKECmtCa8lc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=i1tTvQKOvkN8DBtVPbJCe9WCB3kZ3Gh2G/+xi//3IVXgFro+JAXcO/fMXqEmr32xZ Hy1h7dKQHHfYM3CCG4Hu8H+1LcXV7IsKteIOTyHaheh0t1p5yX1w+rrzLMdJ9DFXYn umXQHXD/ou/q8pi1GaafZlhN7kBz8kVEKkKzjwUk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Martin Liska , Peter Oberparleiter , Andrew Morton Subject: [PATCH 4.19 229/229] gcov: support GCC 12.1 and newer compilers Date: Mon, 24 Oct 2022 13:32:28 +0200 Message-Id: <20221024113006.684314336@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747573261565819104?= X-GMAIL-MSGID: =?utf-8?q?1747573261565819104?= From: Martin Liska commit 977ef30a7d888eeb52fb6908f99080f33e5309a8 upstream. Starting with GCC 12.1, the created .gcda format can't be read by gcov tool. There are 2 significant changes to the .gcda file format that need to be supported: a) [gcov: Use system IO buffering] (23eb66d1d46a34cb28c4acbdf8a1deb80a7c5a05) changed that all sizes in the format are in bytes and not in words (4B) b) [gcov: make profile merging smarter] (72e0c742bd01f8e7e6dcca64042b9ad7e75979de) add a new checksum to the file header. Tested with GCC 7.5, 10.4, 12.2 and the current master. Link: https://lkml.kernel.org/r/624bda92-f307-30e9-9aaa-8cc678b2dfb2@suse.cz Signed-off-by: Martin Liska Tested-by: Peter Oberparleiter Reviewed-by: Peter Oberparleiter Cc: Signed-off-by: Andrew Morton Signed-off-by: Greg Kroah-Hartman --- kernel/gcov/gcc_4_7.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) --- a/kernel/gcov/gcc_4_7.c +++ b/kernel/gcov/gcc_4_7.c @@ -33,6 +33,13 @@ #define GCOV_TAG_FUNCTION_LENGTH 3 +/* Since GCC 12.1 sizes are in BYTES and not in WORDS (4B). */ +#if (__GNUC__ >= 12) +#define GCOV_UNIT_SIZE 4 +#else +#define GCOV_UNIT_SIZE 1 +#endif + static struct gcov_info *gcov_info_head; /** @@ -439,12 +446,18 @@ static size_t convert_to_gcda(char *buff pos += store_gcov_u32(buffer, pos, info->version); pos += store_gcov_u32(buffer, pos, info->stamp); +#if (__GNUC__ >= 12) + /* Use zero as checksum of the compilation unit. */ + pos += store_gcov_u32(buffer, pos, 0); +#endif + for (fi_idx = 0; fi_idx < info->n_functions; fi_idx++) { fi_ptr = info->functions[fi_idx]; /* Function record. */ pos += store_gcov_u32(buffer, pos, GCOV_TAG_FUNCTION); - pos += store_gcov_u32(buffer, pos, GCOV_TAG_FUNCTION_LENGTH); + pos += store_gcov_u32(buffer, pos, + GCOV_TAG_FUNCTION_LENGTH * GCOV_UNIT_SIZE); pos += store_gcov_u32(buffer, pos, fi_ptr->ident); pos += store_gcov_u32(buffer, pos, fi_ptr->lineno_checksum); pos += store_gcov_u32(buffer, pos, fi_ptr->cfg_checksum); @@ -458,7 +471,8 @@ static size_t convert_to_gcda(char *buff /* Counter record. */ pos += store_gcov_u32(buffer, pos, GCOV_TAG_FOR_COUNTER(ct_idx)); - pos += store_gcov_u32(buffer, pos, ci_ptr->num * 2); + pos += store_gcov_u32(buffer, pos, + ci_ptr->num * 2 * GCOV_UNIT_SIZE); for (cv_idx = 0; cv_idx < ci_ptr->num; cv_idx++) { pos += store_gcov_u64(buffer, pos,