From patchwork Sat Oct 22 07:18: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: 7145 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1087622wrr; Sat, 22 Oct 2022 00:37:07 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6D7smXypA9AbZZAHUdjrhzUQHz8uOp4U9Dlw7fohDRQWR2CF1AiKuha3Fd4FYjjUn/xI8t X-Received: by 2002:a05:6402:3890:b0:45c:2b5:b622 with SMTP id fd16-20020a056402389000b0045c02b5b622mr21437463edb.69.1666424227815; Sat, 22 Oct 2022 00:37:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666424227; cv=none; d=google.com; s=arc-20160816; b=mcZYe2Z4FHyV5RfdXkV/7CxptAhk9+dF2vOvVo84IBj5sfbbhIR+lZP/ksSEkMm1h6 nvqaiR9fvVKYxPZugYx8wBdk/3RCR4sAKnHs9hOX5kHQpIAB1EL8E6+q7OYhLPWHjBBt VtZjYoJqnTCh0AilA8XWOvH0+M7eHMt7xPljwoui22WmNpKgMZSnXGase98mXix45IB1 IEyjfzawS8RtAcia344fharUVcZtPLswCPzHKbrmH20bs7UDqR3y0PdTjnVC2kMbilUW 3uh7ehhMD50riLVGXWmks/iNQDqO2n1Lr6yjOTeWhVNMZXJe3H5GBeqh8HBANXI/kgx4 5kAQ== 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=F4j8IraKba5r8jbZzh53laeM55SFpVoLsjWn3+W0o3c=; b=Ky+oGmvqnofRjM4HYNpJzzh0cmtKbh8FNTHlvST9FPomTr2LJYipGpv0awe+ygvpRu m6d6bQRl7cqmMB4paCeG95b9Oz/nkISNoCcNpgjoid927oIXYrHMHwZMrLtmUU0oESA8 CKmdoyMVHWyOVbJROrKo5enBqETJOtKvt2689dqvJo/WBWydvtDu8NlSLZ/WjRapFFex 8jUo9f8P5f5WpD2GDN1BeynYpdRT4gDDUMbai8q3nJAQcCOpsgjPjY4Dpcn6+vJLuigD DH81ALcUsp7eI1cJPL1vLxc4FQe5qW0V8TQgYF7FVFOauW3O5mERtIvHEdxFg4oGFHKQ vwWw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="qYjgHV/h"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 o19-20020aa7dd53000000b00447dfae6181si18619799edw.235.2022.10.22.00.36.44; Sat, 22 Oct 2022 00:37: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="qYjgHV/h"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S230292AbiJVHfj (ORCPT + 99 others); Sat, 22 Oct 2022 03:35:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51636 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230265AbiJVHfH (ORCPT ); Sat, 22 Oct 2022 03:35:07 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6248745229; Sat, 22 Oct 2022 00:34:37 -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 8EB7CB82DF1; Sat, 22 Oct 2022 07:34:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D9B61C433C1; Sat, 22 Oct 2022 07:34:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424074; bh=6Q8RJsXE1kESmQt7BuzCD7VcjKXu9zTMzzTGYbKSZ8k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qYjgHV/hNVjp+lTMSSOn5pOk4RFNXHbOkNt9uGrSdSeKunzp2Fqjwyn7dgEm4/qxV CUM4lzKGdKFdUHfTFK2aJZipQklpshlZ7T+/1QURnjq6FP6xLAw1pb5bzbO1pt9G8z XViKRZXS5iumRwKiFOBygjKTAaz97izZaq3eXejg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Takashi Iwai Subject: [PATCH 5.19 002/717] ALSA: oss: Fix potential deadlock at unregistration Date: Sat, 22 Oct 2022 09:18:01 +0200 Message-Id: <20221022072415.458280635@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747372450976441967?= X-GMAIL-MSGID: =?utf-8?q?1747372450976441967?= 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 @@ -162,7 +162,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); @@ -174,12 +173,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 Sat Oct 22 07:18: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: 7150 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1087881wrr; Sat, 22 Oct 2022 00:37:57 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6d2rAXIdHFrS5n83bLtnPGWXidzQR/bqmi6u+rGrw69BcXQQzcdrJu2rxlQbfHPcdJi+FZ X-Received: by 2002:a05:6402:7d7:b0:460:8460:134e with SMTP id u23-20020a05640207d700b004608460134emr11306409edy.84.1666424277541; Sat, 22 Oct 2022 00:37:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666424277; cv=none; d=google.com; s=arc-20160816; b=LiVYFYQESiSn1/h0tGP872f6IMF1aF+MTZf4Win+V/IOKd60a9fZOOVIhLZhQFypEh RFCQPHZSs4SL5WgmXMPndEDty0KzZmLGgdxaNtRQPIWlS9pIEPU6SVE05s7EXJyLJRZx ZRmA1/lDq+UKhLaPiaGWPQ4OeMKNYVlD/7CEf0yHvhcehdlKrlfvH3q1o8xwtvn2hcjE W/y9GX8HpF38DYgJvGaRIbAqjE5rFHuAZFgFGh+5jRUGTzgsWn2QbIdQTtWNgJdI2f86 Wo20B1UCvDaPgRlcXswUvwAzmdkFbuB/A/L0qGWJlPrr6UDhgUNe1IpvPSD/nuuYKZwz 4+vQ== 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=03jgGr6HwFQAtS5OxGZuj5lNrcCdb/ggv6vvWFUZ4Gc=; b=x9893qPTPgdOUDIvWvnfdNEGcfbSnbBb/TzyWt8Pw6QTwzoaPR2tSEP7IrzXNfaKZA JSdmuSpzMFMOJ8DA5IB0IS33zl9nTybCehwKzIx+cxi1j2nymPL9vzyzTEASn8L50A8u wXJdO2I2EQdTzvYqRTsJVJJcrgJymCG5fq2I7oOK9aYVklfO2JlLfENfbxg221cVTwQh TUrPT7ulWwMeGLd4k+TdbH70tmNE+tcnAu37UcIQJB1Dmz1fiFq/srV8dlOV+h+xD67V sfApY0ANK/sdAoCS9qGPxJiLVDZb2bgnBMfidLyQjiBzOBC2A6d9TimKJO7lJyMQlZe5 2sbg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=uyenJxij; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 b12-20020a056402278c00b00447a7af56b2si24781968ede.326.2022.10.22.00.37.33; Sat, 22 Oct 2022 00:37: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=uyenJxij; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S230303AbiJVHg6 (ORCPT + 99 others); Sat, 22 Oct 2022 03:36:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48150 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230253AbiJVHg3 (ORCPT ); Sat, 22 Oct 2022 03:36: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 52FF036DD5; Sat, 22 Oct 2022 00:35: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 2A123B82DEF; Sat, 22 Oct 2022 07:35:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 65988C433D6; Sat, 22 Oct 2022 07:35:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424107; bh=8fi4KRnTeAjrn2RZpFpUaMqKpGr4C7VXsqZt/H77q6U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uyenJxijD2Whif/fKhAg65xur7rVaqr9O8y6TOVV4gtMCw9u++ckorYghGGbf8OH4 V87bU5MbMfhMHLHlP+JVTSm2pybgcjkM2WNi18WFyngwp/bFJKHEOGPtxulZ1LqU7B FHutiANflQ2GMW0s2azv3lwdoFPIVbt+iPca243s= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Takashi Iwai Subject: [PATCH 5.19 003/717] ALSA: rawmidi: Drop register_mutex in snd_rawmidi_free() Date: Sat, 22 Oct 2022 09:18:02 +0200 Message-Id: <20221022072415.630907767@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747372503570825252?= X-GMAIL-MSGID: =?utf-8?q?1747372503570825252?= 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 @@ -1835,10 +1835,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 Sat Oct 22 07:18: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: 7152 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1087920wrr; Sat, 22 Oct 2022 00:38:10 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7QYKzVqPRtKlw1o7vAu5fkouXqHQNjX7/4e2q7qpXyR0sHM7ZEs69v9y1PrxPTjpyPm4Tb X-Received: by 2002:a17:906:eec9:b0:783:e662:2513 with SMTP id wu9-20020a170906eec900b00783e6622513mr18758521ejb.656.1666424290529; Sat, 22 Oct 2022 00:38:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666424290; cv=none; d=google.com; s=arc-20160816; b=CpVYfmPQDxYDPAk5v8hHRjIaxPPc7n1B710un9I/n/e3H+N0ObJ3EUaCHJBe9iq4Hc sc2j65gBcj2E+1PzAAiOkc4GrEKklJCqF8+GpnZ5B4HGuNDNvB+lqnGk8k4IoFhLmmsu OKFk4SumKlTDOwxXM8f1CNI3AWAUl9KgRquyfFj3Z3gFRV9ZNd0khsuf2hUje3pJoEi9 kkndTKTMj8M3Lb8PxHfNgnnFxKfNha7a8z4KxaymiRkq52080iKJNtDfwlrV3YN3hDDY IAIY6ZCzMmYjTD4ZfVhVeXWyUoCViU4es5WKwdMTiHR6HLbj973GRfG2NbPqrLsvh1N0 HMoQ== 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=+JWXyrfUpuPNSadoVrKpARPqPk4jtBbPH1fSNQ2syHo=; b=eTl2JyOnzXqkj28W0QHKjYUi9PXlSIQPZYhGyKSuKXmBpMJF0JtbyBLI7uJfjNoi2l 0nwyWEDywPnYKmAW4gnSeIuxRIYsEJgjsHi129lLGTNYwQkFguVu1OOcE1R8AD2GUsxX OeyjVyfMaBIQg4NiS+jtmtmxjyVtwC9CbSEJM2OM3v6C0mxXdXlwWwYlPTsubr2vOa9Q sZAD+7GNJplROiBwwSp3bmUevE9vbxgJHlPwdqJPTVy61tmJ9HaJqiTs21Y9lBJMD0b9 uRXEQli6qh2HBWqe901Tpr5QPMw+Q4RQtaukNg1u8Yttfh63QZzOAw7fSlUkt4vQAUwg Fmxw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=uGhlicha; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 e5-20020a056402104500b00458bef9c70esi20133507edu.612.2022.10.22.00.37.46; Sat, 22 Oct 2022 00:38: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=uGhlicha; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S230267AbiJVHhF (ORCPT + 99 others); Sat, 22 Oct 2022 03:37:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47132 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230270AbiJVHge (ORCPT ); Sat, 22 Oct 2022 03:36: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 61E65357C5; Sat, 22 Oct 2022 00:35: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 3D37460AD9; Sat, 22 Oct 2022 07:35:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 21DB8C433D6; Sat, 22 Oct 2022 07:35:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424111; bh=FAUBq+xOHHhAmdDXr0nUjCQSE5N3RTGbcKi+sVW2no4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uGhlicha5W5p6nz0UBLnh0bBklqIdqqsfQjUMzZ0KRL856CHq8ouFRMgQwsIplSvJ VAUI+mscD34GvME6npHwRvPJEq6Q/GkR1204j7fjmcy1A1fCM8Yq8A/f/CNLCbt6Rm 405pdp1Ugk8xDf3BbTVibsWKD1gdR2YG8PvKkh4Q= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Takashi Iwai Subject: [PATCH 5.19 004/717] ALSA: usb-audio: Fix potential memory leaks Date: Sat, 22 Oct 2022 09:18:03 +0200 Message-Id: <20221022072415.820715261@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747372516885795306?= X-GMAIL-MSGID: =?utf-8?q?1747372516885795306?= 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 @@ -1261,6 +1261,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; @@ -1280,8 +1281,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 Sat Oct 22 07:18: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: 7153 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1087944wrr; Sat, 22 Oct 2022 00:38:16 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4ZfY4D/SP88k3N6gamwMLcNnQbSyZAx59fBD+wwOxZCAp4W1xAquQ0EnLHpFDgjRR0sq/R X-Received: by 2002:a05:6402:35cc:b0:45d:4a39:2a43 with SMTP id z12-20020a05640235cc00b0045d4a392a43mr21244846edc.304.1666424296687; Sat, 22 Oct 2022 00:38:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666424296; cv=none; d=google.com; s=arc-20160816; b=pQ6v0fZ2JnGVRe6S6jH/miXp50v1ZVh7zcZ4PSStv+YyIVTmeDSHwP3Ai5Qu2EmRzl 8b7UYQ9RJsp8ssalPXYh0p7Q1FAW8SA8/iTPAItBCAV6IjJGLrwRd1S7LNMsVmZdaagD SJtGHmDObpAYUlQjKJo++XucFO9gDLg4vScSo2n2OWvk+oOnGHDWxBLnIX1CutipSLIF 5rjM3rurPzXvTy4BEPF2isme9YLiACFbkrDHS4FdXUefJJAhFBDXZ75Qg6+l61KtgKKO y5OdEcbnUK1vucSVlxz01JbsP9XEqZ8snWGVoRqhHwA1egIoFG54whaxzxzP7El1UBJc s/kg== 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=z80ZjE2YL/ZbpBogZGd3BFMn4gDm6TtkhkZ2yiRsiRA=; b=Xvr0T5p9BjZra5Tnje4HnWDZ6+YpjFB/eNc7nqOV021OWRlp1EokDBSJwIcDoJkMFi YJkB7eONzHtOdcEdsDquWOYTuo6QXY2GlTq9cnpxjSg6Li7gEg4AHgsKA9UGsSwCATEH NVxi0urh+iPjkBuWH1oCZMKxbFwyFVXQUk4qBtRbhWjSIwUXeQ0UfSX9bySmmiBLMmbQ QQVOHnX9JK6kRT+HlX3iPx8SIkv89zkKpGtDNtxjFWjwBC7MTYxEIweoVY2pkaDx2kT6 uPmgeQGj5Gl4G0jX38fiGwrivFgaJb+Ns06/8TyqF9JUKWjCOd2nw07OgvrzOdpgl0Uu Ujuw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=AnLs+eng; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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-20020a50c003000000b0045d4f99616dsi1838357edb.456.2022.10.22.00.37.52; Sat, 22 Oct 2022 00:38: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=AnLs+eng; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S230315AbiJVHhb (ORCPT + 99 others); Sat, 22 Oct 2022 03:37:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48844 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230286AbiJVHgu (ORCPT ); Sat, 22 Oct 2022 03:36:50 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F15A81843FB; Sat, 22 Oct 2022 00:35: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 69FDA60ADA; Sat, 22 Oct 2022 07:35:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5E6CEC433C1; Sat, 22 Oct 2022 07:35:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424114; bh=nqOrFT/Y66TGULVPHHQkkVqwTkFRjIX6uhUPep+lG1U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AnLs+engcI05TfhztNYFBozcy9Y2708HEE84WZ0yZyEuscgcyYOmNfezTPSY0g6w4 P2UwTXkE5odLoc5/kxcER2qEQyZOuqB8iyY4sz9JlgSE/LXSuZTP2Z02bcKGAm5Hme 61sK/0j49J1Idqod9xDOY81SLH4EctclHpIcPWCs= 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 5.19 005/717] ALSA: usb-audio: Fix NULL dererence at error path Date: Sat, 22 Oct 2022 09:18:04 +0200 Message-Id: <20221022072415.997711105@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747372523488809898?= X-GMAIL-MSGID: =?utf-8?q?1747372523488809898?= 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 @@ -93,12 +93,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 Sat Oct 22 07:18: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: 7155 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1088015wrr; Sat, 22 Oct 2022 00:38:27 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7uoRFzHbwu/YRc/SDr333uKrRMImooEEHm4ys63W60Q/X+Y9ZYtrY9DpCvv0T2AEUZY4LR X-Received: by 2002:a17:907:7704:b0:780:da38:4480 with SMTP id kw4-20020a170907770400b00780da384480mr19218690ejc.64.1666424307814; Sat, 22 Oct 2022 00:38:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666424307; cv=none; d=google.com; s=arc-20160816; b=M2OOg5eLXDJAZr+76jH9A2swg/hAP9kiq4WPTFH7wYLA9sYkpGJDUH2tJ0odAgg1eW vRo9YngoQprWBGy/DdVTYqY04SKYPoevF3iLZCiERezqu+NRXQgMXpdgiiRSWBLotH40 LHDU/K1IcqwRilPmh2H4E9xyMxC6u3CzsLDdp7EKmCzwRFcHihxpxHi3LBxPdy75d5eb 7m+7Z4VgiRvhJ9V+OgSwcvRk3FJsJX2UEwdRbbqma3Zwn7cQSG3EXJ99POswYwokPDT8 FFCIDxmKLidclqqcPSpP+7gDXalet/Vc+3vXm/k0iB55RmxOdhPsBgiLy6AAe2rSx5cj qxow== 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=lG0byh4LVcrlgAoUPDvq7T/ChO9FOAe0ySYVLa2ba+k=; b=d0ZUhOIwElm9cmPhSRfHmN/LtjQYDORrjy6JhFJOm6MdiiRl2WQksxlFmTpr74gccy 16ftIRquICmUGOPPBtddC9kjMdIpGDNOkfGMC7WamXGqiJ222pFrr+5ie5VwpQ8RcQ3m Wzj5fuuAnfCzhda7mfOCcGhnJzxYJwg1moUqotrD6BS04sSeLT+I82WJv6wDoyQZqS0z vduQYIzz/hgZ4to2RIkPgKmtW+HsvHWaakKRSR2IdWWd4ns2vY8uI7SCDsCy1Lbf/FzU TcCUpzfmMbaLmiFhUE+Te018vzO+Ui5z5RPZsJjJpmjfvPeYMveCpwLTv3PmrwR4Bva/ H0Xg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="ixYUUXP/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 f8-20020a0564021e8800b0044e78dbb615si25953516edf.379.2022.10.22.00.38.03; Sat, 22 Oct 2022 00:38: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="ixYUUXP/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S230368AbiJVHhg (ORCPT + 99 others); Sat, 22 Oct 2022 03:37:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49058 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230331AbiJVHgu (ORCPT ); Sat, 22 Oct 2022 03:36: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 F04C44E410; Sat, 22 Oct 2022 00:35: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 3C08F60AD7; Sat, 22 Oct 2022 07:35:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 537BBC4347C; Sat, 22 Oct 2022 07:35:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424117; bh=m+TRFRTP9gvTQtFF2Gus8jbfXoqPRF+vKAg3y1aelXY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ixYUUXP/ezUt/AUQsRU6Bs+73imfHvfjxQVUpqIeSrtvr9Jqs7OyVFTUxestgRKeT 1SvtQdKqwYdJtNihWRtuowcvWyWfkE7sdYY7oqKseWCquuKrkaDdHGN6sdtM16rbaH WOnSjp0RhP9tfbLm5VlGC9tPk0rN2H92/xeok/Uc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Callum Osmotherly , Takashi Iwai Subject: [PATCH 5.19 006/717] ALSA: hda/realtek: remove ALC289_FIXUP_DUAL_SPK for Dell 5530 Date: Sat, 22 Oct 2022 09:18:05 +0200 Message-Id: <20221022072416.192634022@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747372535226555626?= X-GMAIL-MSGID: =?utf-8?q?1747372535226555626?= 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 @@ -9151,7 +9151,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 Sat Oct 22 07:18: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: 7162 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1088312wrr; Sat, 22 Oct 2022 00:39:36 -0700 (PDT) X-Google-Smtp-Source: AMsMyM44XF/li9l1B7P8euH7DSnU/B6LgEsikZsj6dMpDM9ec0CAhbPBJ+s8sedEXR3bvgJtqOXl X-Received: by 2002:aa7:d5d3:0:b0:458:814c:6d57 with SMTP id d19-20020aa7d5d3000000b00458814c6d57mr21245095eds.186.1666424376529; Sat, 22 Oct 2022 00:39:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666424376; cv=none; d=google.com; s=arc-20160816; b=LDWVFhNj2IJfqfAcmeoOACSb/wm2RIoycXv/KaErbDaGjWWgPgWVM7ghrNfVX/grRD k47RX6qTJqZWAY0hMdprRLCDsJ0pihB08qmS4npL6bralT0js6emuoGYynAb7a0S6awe 3Qj+F4QHm5g1Kfmz2r9HB4zoJ5UiVZ4bDBUTm0it4GnsUiwP1CJPKmtnSuyue/11DYW7 6MLsGT2GQ6TR7xc7kvoQGjiHkSxayTemz1BlIdtptn6+cyizKexr6JEZAAyQgnOiMDib fRVoy71XI67ZromVpkRFQQ7G7cN/ufszVvJIp7r0+DvYpEFKrOiyTOwlU3FB+LK0HMOE zecQ== 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=vkUXuT3ooxIRPildZr43SS7l3+bta1AwCZ7A7ojUqM8=; b=q3DwdSK3bDpttSpTpMzETgwyiaFbyaZo8zgRMnbo79421VryrDz6amlsxSc77owfgm T7FT3RTa9jF8GSXIwU25Ky2aEi8YXLcV6qA7+VqnJ1WI9FGDYj2JtAP6vOtXUgavorhi u7KXu8vkibgAdoFwmmGAul5zvntfzPX/9c7wtTBXwGkgENvXf36oJWIB3m7JPnLEouAT N7v6T7knJ8YLU7hjM/W/Mu/NevOdVQcPz6olGtijFtGNffXx72OcOzGYj+tyIQrfO6zu TSstSWfjIZiJ0pO5zOtrfI5pf6vrEKm1jEn8Jm0XW2VghOaIviJum4R9XaduDM5X47vJ 2nQA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=wqoob1K9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 dp19-20020a170906c15300b0078c47b4478esi20713409ejc.106.2022.10.22.00.39.12; Sat, 22 Oct 2022 00:39: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=wqoob1K9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S230217AbiJVHil (ORCPT + 99 others); Sat, 22 Oct 2022 03:38:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50062 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230387AbiJVHhR (ORCPT ); Sat, 22 Oct 2022 03:37: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 41FC33EA43; Sat, 22 Oct 2022 00:35: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 02D79B82DE2; Sat, 22 Oct 2022 07:35:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3B79EC433D7; Sat, 22 Oct 2022 07:35:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424120; bh=W1TBsJ7qVPDisZmRcj5ehPhfk4MheiAIYfQxWqtgAmo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wqoob1K9hwXnc9vBpWZsqcxYdJI3BpfU9ffeT21JHOu1NHYT5qdTGmgtlmyUUFoVd sEiiYAGm/NdWQ9CVGFN6qSGCi4Y1r3mf28TJpF8+fx8DwFqWwjinOzkuggOyOibKpj 4LBbicRTObPMbqJ1usitTjUNjQ61c3jrmQrkqsy8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Luke D. Jones" , Takashi Iwai Subject: [PATCH 5.19 007/717] ALSA: hda/realtek: Correct pin configs for ASUS G533Z Date: Sat, 22 Oct 2022 09:18:06 +0200 Message-Id: <20221022072416.364454804@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747372607022165285?= X-GMAIL-MSGID: =?utf-8?q?1747372607022165285?= From: Luke D. Jones commit 66ba7c88507344dee68ad1acbdb630473ab36114 upstream. The initial fix for ASUS G533Z was based on faulty information. This fixes the pincfg to values that have been verified with no existing module options or other hacks enabled. Enables headphone jack, and 5.1 surround. [ corrected the indent level by tiwai ] Fixes: bc2c23549ccd ("ALSA: hda/realtek: Add pincfg for ASUS G533Z HP jack") Signed-off-by: Luke D. Jones Cc: Link: https://lore.kernel.org/r/20221010065702.35190-1-luke@ljones.dev Signed-off-by: Takashi Iwai Signed-off-by: Greg Kroah-Hartman --- sound/pci/hda/patch_realtek.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c @@ -8396,11 +8396,13 @@ static const struct hda_fixup alc269_fix [ALC285_FIXUP_ASUS_G533Z_PINS] = { .type = HDA_FIXUP_PINS, .v.pins = (const struct hda_pintbl[]) { - { 0x14, 0x90170120 }, + { 0x14, 0x90170152 }, /* Speaker Surround Playback Switch */ + { 0x19, 0x03a19020 }, /* Mic Boost Volume */ + { 0x1a, 0x03a11c30 }, /* Mic Boost Volume */ + { 0x1e, 0x90170151 }, /* Rear jack, IN OUT EAPD Detect */ + { 0x21, 0x03211420 }, { } }, - .chained = true, - .chain_id = ALC294_FIXUP_ASUS_G513_PINS, }, [ALC294_FIXUP_ASUS_COEF_1B] = { .type = HDA_FIXUP_VERBS, From patchwork Sat Oct 22 07:18: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: 7160 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1088236wrr; Sat, 22 Oct 2022 00:39:17 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5E0fMfRPtvT+PflyGL6hwR1Hml3pOEZ+enkoym3GqRuF6JHIuAnpemJrsDRHawyrQ+3Cz6 X-Received: by 2002:a05:6402:4150:b0:44a:ec16:def4 with SMTP id x16-20020a056402415000b0044aec16def4mr21381432eda.21.1666424357073; Sat, 22 Oct 2022 00:39:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666424357; cv=none; d=google.com; s=arc-20160816; b=Xa9SHe4yD3D922EcKXnlThjggyEidyPptsKiLeXUDy5rDSO/bccvZ4pRR4RQPLx2Ky wb1EyaN4NtqJAfaSchtITjKFyqXSnSjGMeDEVXdY/KOvWxjjl9HhTb/EbKPtsoPDnUAL jdA7pIVtwzmWogToEJzKn7Li832HWWmoSw22f7T7X197BgHTefzm16gt6jfQu3EBPXD9 8tRdQvK9/6WrRA7fDg5XmtMSWXm5yX8ZxZHNB5ykW2xUlF+A8V2pYe3+c7xxq7W6mpSz Ju/3kATC7WKIPjdOec/cnBlwyY2KviGuB6TTlC2X8zO/qzuqqE096s3XS+kxp3z+SiWP c8Eg== 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=CPHPc/EBshGzUluGRqU6OahW1BeGtAtfZ4nede6gunA=; b=pltc5zL9nbEacEhBa/G8HGPVl7j0prOj6bZDm8ZZsGxyjaStr7GDiDujRUu2oPBssQ Tq31w5hnLzWGQSIzaIDA3BgfXL6xW6JBCoyPIu2HAU4MniBBSSHw1OV26yHuwgwfieNP MqUtF8nfmuorJe5+hV4R1To2xmanqg/3sLqQu3+ORXDdDadejtJ5k0i2okxaZ1ehsprT mt5XDWpG88HIymSM4VajmM8lD74B0Y02mOb0yGVltTTMSd7+dcjaoqGepsUhh4Qcfqzm LuNjdWHIz94LsUQV8RljB1p7rljfVoLEvfGslcpIiXRZpIJ5u+2mwLUcUyse5nyVe5iP qJyQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="KAn4nS/O"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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-20020aa7ccca000000b004612220a97fsi4724704edt.100.2022.10.22.00.38.53; Sat, 22 Oct 2022 00:39: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="KAn4nS/O"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S230437AbiJVHiD (ORCPT + 99 others); Sat, 22 Oct 2022 03:38:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52524 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230377AbiJVHg4 (ORCPT ); Sat, 22 Oct 2022 03:36: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 44DAA246C18; Sat, 22 Oct 2022 00:35: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 ams.source.kernel.org (Postfix) with ESMTPS id EF2C9B82DF0; Sat, 22 Oct 2022 07:35:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 50D9EC433D7; Sat, 22 Oct 2022 07:35:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424123; bh=HjO84Ehz41YJ8eOElHAagtRlH7Cx52E9B3ic4oIAI34=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KAn4nS/OhgSJdWDAyzrSijluKsOO1aHkcrod0usWF0Is36dVe2bEmZPQU+Ij7uEcc GvIH4cPmOYG/A0bBGFJxKjrTFOTtW8IdPHnIVPwltdzsDCtL6jrf9cMZucxW9nJOuY zno1TBL1I76qjhAFojNWwhTw7D2XUF7iNRq7Wwgs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Luke D. Jones" , Takashi Iwai Subject: [PATCH 5.19 008/717] ALSA: hda/realtek: Add quirk for ASUS GV601R laptop Date: Sat, 22 Oct 2022 09:18:07 +0200 Message-Id: <20221022072416.541252091@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747372586744199145?= X-GMAIL-MSGID: =?utf-8?q?1747372586744199145?= From: Luke D. Jones commit 2ea8e1297801f7b0220ebf6ae61a5b74ca83981e upstream. The ASUS ROG X16 (GV601R) series laptop has the same node-to-DAC pairs as early models and the G14, this includes bass speakers which are by default mapped incorrectly to the 0x06 node. Add a quirk to use the same DAC pairs as the G14. Signed-off-by: Luke D. Jones Cc: Link: https://lore.kernel.org/r/20221010070347.36883-1-luke@ljones.dev Signed-off-by: Takashi Iwai Signed-off-by: Greg Kroah-Hartman --- sound/pci/hda/patch_realtek.c | 1 + 1 file changed, 1 insertion(+) --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c @@ -9376,6 +9376,7 @@ static const struct snd_pci_quirk alc269 SND_PCI_QUIRK(0x1043, 0x1e8e, "ASUS Zephyrus G15", ALC289_FIXUP_ASUS_GA401), SND_PCI_QUIRK(0x1043, 0x1c52, "ASUS Zephyrus G15 2022", ALC289_FIXUP_ASUS_GA401), SND_PCI_QUIRK(0x1043, 0x1f11, "ASUS Zephyrus G14", ALC289_FIXUP_ASUS_GA401), + SND_PCI_QUIRK(0x1043, 0x1f92, "ASUS ROG Flow X16", ALC289_FIXUP_ASUS_GA401), SND_PCI_QUIRK(0x1043, 0x3030, "ASUS ZN270IE", ALC256_FIXUP_ASUS_AIO_GPIO2), SND_PCI_QUIRK(0x1043, 0x831a, "ASUS P901", ALC269_FIXUP_STEREO_DMIC), SND_PCI_QUIRK(0x1043, 0x834a, "ASUS S101", ALC269_FIXUP_STEREO_DMIC), From patchwork Sat Oct 22 07:18: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: 7158 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1088197wrr; Sat, 22 Oct 2022 00:39:08 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5v5FqpeYtUMlnrq+0DFdgYSvfm/AeRDQZluEqF6X+E8ez1FPYqTK1KsOqAnsSvWh4C+e8d X-Received: by 2002:a17:907:7635:b0:78d:c5e9:3e57 with SMTP id jy21-20020a170907763500b0078dc5e93e57mr19230471ejc.204.1666424348272; Sat, 22 Oct 2022 00:39:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666424348; cv=none; d=google.com; s=arc-20160816; b=Av4IIVbwmcWwNSJyas6WhT9CC427wX7gzd8InUHqoCYu6tp03N9sZwAG1s/JO4Hv1r ZBo5AqZVQFnHs42oKpoYv1+xdf9teweShkk4oE3h/RLv/0X0RMAxFLKPmI2ccomTCeDR 9TcpeO5l7/lIp8/ZLLBvFyeBelAlsSCWrkWXnk9EzkTdUAjZvjvprlaRzZNXDffqFH1S ItaEhfeXxtvPSgvmi1Pqbjdk3scbnvmC8cdFL9K2QBXV3UdxsU+B804JwWBzZtJpPno4 otEoUTzHYgH+zelHpIE57HVcBOKU8qXibRCuN62jfyJLf0vOc8ViGkDWtUeMm/0Gz5xx ldig== 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=MwkjW9ucMd8oYvdZ5OqK40dzFy9EYxFXOQ5pFbs3wxU=; b=v0Uo5KZX7QECZm+BOvFm0jSFPhMebZKo+CX+Foz9yoyOadKNoWQ+AYSfRi1X8FfIUL 3ST3gf4J+pjGf6mwsQO0NsGb1clVUjrRixRMNKsJZ0zJKCHSjLBFH7FOyMtQRq0MOKIQ gfhQUKsHG4aJaPIUEYU/30u2ETuj1QoKAXRZAN7QkLmvXprhXPlWmwdwn4bGdlE+E3ek VelpzVdEvmXuJArIg3df82pvW1RWIWyN7vXxC80nD+cOXdZxV7KISj/jZyuC8t0hukAJ 4E4YzSlGU513dWncv2CFeMrKUTQqIVmKxwSDrURqe4pTqq9Mx7yY6WzwaHSfCdJn922q LJsA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=oa2kFzti; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 x17-20020aa7cd91000000b0045cad599362si4027381edv.530.2022.10.22.00.38.44; Sat, 22 Oct 2022 00:39: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=oa2kFzti; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S230427AbiJVHhu (ORCPT + 99 others); Sat, 22 Oct 2022 03:37:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51636 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230363AbiJVHgy (ORCPT ); Sat, 22 Oct 2022 03:36:54 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4658F2498A8; Sat, 22 Oct 2022 00:35: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 sin.source.kernel.org (Postfix) with ESMTPS id 8A824CE1D33; Sat, 22 Oct 2022 07:35:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 89397C433D6; Sat, 22 Oct 2022 07:35:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424126; bh=78i/cgAWTbQkSXWQ+NR65kH4S/tabs/wimPBpwk6rOQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oa2kFztiO2AQDL3JCXftYywb+Ag4A0Lvblvsc+rTK4fKTv/632lKNUpB7EVl+HkBz lz2zSLb8v1gt4GxOxYxPlX+fz1jW0GDuaR6fe/FFFNUxC1rGnVeSa/yGMq6AYsi69Y wCdE8vmjuq6zcku+XIYl+R64lE8bVoJLdZo/FY08= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Saranya Gopal , Ninad Naik , Takashi Iwai Subject: [PATCH 5.19 009/717] ALSA: hda/realtek: Add Intel Reference SSID to support headset keys Date: Sat, 22 Oct 2022 09:18:08 +0200 Message-Id: <20221022072416.724433893@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747372577789861702?= X-GMAIL-MSGID: =?utf-8?q?1747372577789861702?= From: Saranya Gopal commit 4f2e56a59b9947b3e698d3cabcb858765c12b1e8 upstream. This patch fixes the issue with 3.5mm headset keys on RPL-P platform. [ Rearranged the entry in SSID order by tiwai ] Signed-off-by: Saranya Gopal Signed-off-by: Ninad Naik Cc: Link: https://lore.kernel.org/r/20221011044916.2278867-1-saranya.gopal@intel.com Signed-off-by: Takashi Iwai Signed-off-by: Greg Kroah-Hartman --- sound/pci/hda/patch_realtek.c | 1 + 1 file changed, 1 insertion(+) --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c @@ -9398,6 +9398,7 @@ static const struct snd_pci_quirk alc269 SND_PCI_QUIRK(0x10ec, 0x10f2, "Intel Reference board", ALC700_FIXUP_INTEL_REFERENCE), SND_PCI_QUIRK(0x10ec, 0x118c, "Medion EE4254 MD62100", ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE), SND_PCI_QUIRK(0x10ec, 0x1230, "Intel Reference board", ALC295_FIXUP_CHROME_BOOK), + SND_PCI_QUIRK(0x10ec, 0x124c, "Intel Reference board", ALC295_FIXUP_CHROME_BOOK), SND_PCI_QUIRK(0x10ec, 0x1252, "Intel Reference board", ALC295_FIXUP_CHROME_BOOK), SND_PCI_QUIRK(0x10ec, 0x1254, "Intel Reference board", ALC295_FIXUP_CHROME_BOOK), SND_PCI_QUIRK(0x10f7, 0x8338, "Panasonic CF-SZ6", ALC269_FIXUP_HEADSET_MODE), From patchwork Sat Oct 22 07:18: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: 7132 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1087059wrr; Sat, 22 Oct 2022 00:35:11 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4ehQSzwDb4AsEv8Amc3WHU+IyxvYyOwZWqVhrThYdeKDfaIwERiHKgOInPiTm9j6jm1lNI X-Received: by 2002:a05:6402:3508:b0:45d:c4b4:4968 with SMTP id b8-20020a056402350800b0045dc4b44968mr20458982edd.272.1666424111383; Sat, 22 Oct 2022 00:35:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666424111; cv=none; d=google.com; s=arc-20160816; b=n2DbZrKOQO+m5gvS32GrjmOgY+hWflj4mJhhD1ufVG7JYILi1ttqLT19a8LcG1jqmn XESINY2zPAceq876q5qeluqKIK5o3mDlOxljcmDiRpUixShvWB20VdQ6gjzLV2ILBwVu 9jB4yUnSckTE2uIWcxduaePm8WpYAE3Axw9GnI6k6+wtQCDKfF2NANqOTPQCY8JCilqX TiHgTsbkcbc9oiFDdcdLshVWvWzcY+qQTZn4aTQ3a90qaYpyy4pD5shEjqdIi/LeZtun echaBEiM/ZVp+jfWsXJVQZxYb4Jkkty9C63W9xdhblk1ym0LmOM9ADm4e2PWsfE+8LKt sdzA== 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=ICerq/AfOym981P0Y+JYGeCVM6Th1jVdBD5o94nQtNY=; b=wOwmB0QwHIDUSi6TVKa046Qmqs6o8TnmvPiho51FnTgzfEpfEEQCsmkn1F8yzNbdQL iqTztV01fU+T9L/z7n7CJKvw3NZNlBMspIRQnPbl+/KpzlxXh2PzubGvb5oSuxVRUQEV zIN1HcT2Nyd54fI5lWBFvo6Lt/RW553TuWZMiQFvjXZDysrQreDV8KRF65FHmARqcy+1 GF5dkj9it64JFc0y6W8HKtrmfTy5RqkAuvFeoYQsFTCeLGcz9GrMqA3DCqwS6Fy7ss5p cTINWbWvyWqJUmh4vPmyLSqGkVRfx+N3SU86/xqoJq7h05LzaBWUVM+q9MM6ZJ/ts8kZ vcLw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=yKjIxHpE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 dm12-20020a170907948c00b0078a802cce5dsi10361708ejc.592.2022.10.22.00.34.47; Sat, 22 Oct 2022 00:35: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=yKjIxHpE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S229823AbiJVHeF (ORCPT + 99 others); Sat, 22 Oct 2022 03:34:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46878 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230103AbiJVHeD (ORCPT ); Sat, 22 Oct 2022 03:34:03 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CA2B7230808; Sat, 22 Oct 2022 00:34: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 48AB260A5C; Sat, 22 Oct 2022 07:34:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 50187C433C1; Sat, 22 Oct 2022 07:34:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424040; bh=0LcxMqzKBXHZAcPKt0pyDjPeM3azFWJ3SFXQ6kVQIP8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=yKjIxHpEfhh993AEUH4nJu/U5WUDueWNBL+6Bj921jAty/WZEZuOKyo2pyUWSAaN5 8ba6XloYJjfpHZ7dtJ7ZPX6TRxwUD69Vay0QKRquLNmaTFuDxU6I0yCBKnKYuKV8zG mIIv94ooID3BRHF3rbsKf7/i6+6FZVtlZxnTiMaQ= 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 5.19 010/717] mtd: rawnand: atmel: Unmap streaming DMA mappings Date: Sat, 22 Oct 2022 09:18:09 +0200 Message-Id: <20221022072416.900873665@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747372329009326334?= X-GMAIL-MSGID: =?utf-8?q?1747372329009326334?= 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 @@ -405,6 +405,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 Sat Oct 22 07:18: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: 7133 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1087148wrr; Sat, 22 Oct 2022 00:35:24 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5UXNFNYIXzTixwvmGOFENISBgdf54LrdWtEWGL9ueB+WZJPKOhNMcYbHk4+03z1aEvV7Fi X-Received: by 2002:a17:907:3181:b0:787:d81c:a6ad with SMTP id xe1-20020a170907318100b00787d81ca6admr18985525ejb.769.1666424123956; Sat, 22 Oct 2022 00:35:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666424123; cv=none; d=google.com; s=arc-20160816; b=I1efVaGo9ibUKveleXjirrrUWJCwIBGJr3kWKuje0G64/05tv1Is+NLBvnb78vO+tk 0fX5ALPltN3gOBBfHbbhXFKhS+sf5hy6jn+DN1o2axJCRhQVmR+ZqANeDQk/SP+7GVBa UhD0VHfSvzFOr4x0sUU4PhizOZ27nbcmT8bUGWkONWYQBpRGlbv3G3pZKiTQLU+K/SSP SC6BlVEQjiDL8uipqBjp9K3DuSC7fV4z1UqA5LKip8AZNfyTJWp0mK7l0k/b3UYlNf// nJVi4Qzav/KOttmimnncBZvWwchpY8crAVjUDyj9LYjfcPxN+fYE4NFuNbZHKCFaMkUN 3TtA== 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=Vi/mddzSzAydFbleTJOoNR0gJBqbz0lhusrF8lInsQ0=; b=fiWxEicU1Fo9EmILX+fge5uxosVJR+8C0MNHlZ5oz8Jkh4/Dp5LtfSmv3uv7FTSUAn DKVFdMfS/ogufa0HR5RoU65QU+KBWZJSZ+XwtlNDAijrAWy8woGXhmHFy8oBgaNeHmt+ TQFYSm1dp4C6Rgl/o6DQx/lTeKcrkOWy+0ku41o6jeiKG0vWCukbRNl4bwRg+VTPQLbW f670xB+9qTUNaTkNzYrK/QhEamE6Abt5trR9n58JzbLZMN71UQgw59oQippXSSX9sMaT WOVS6TPNXQgsR6QZyz4bv+my/GDMrOm67fmOHvl20z1fjq77a1atE6XjrN80tFjLBTSm rVGQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=VNj9T9DJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 xc13-20020a170907074d00b007a0f4d6bf83si1099437ejb.305.2022.10.22.00.34.59; Sat, 22 Oct 2022 00:35: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=VNj9T9DJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S230126AbiJVHeM (ORCPT + 99 others); Sat, 22 Oct 2022 03:34:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46934 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230043AbiJVHeG (ORCPT ); Sat, 22 Oct 2022 03:34:06 -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 C6240213451; Sat, 22 Oct 2022 00:34: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 5F8D060ADB; Sat, 22 Oct 2022 07:34:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 64B75C433D6; Sat, 22 Oct 2022 07:34:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424043; bh=FkjzUhUl5EbNNLaFPOUkRAlXaQ5oBJlhSD4w0qnx4nA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VNj9T9DJX/oRugflZg0PUnUCHJ12fmEyIgVn0MTjRpSiPlnMsoGvZd4Apsbli2c0Y kegqB23mYak7/OwNA55BdFMlcsezvDMgBiBNXoq1qaH6+V7GAlLhFiNFB+spZ92yPv vzx5zW8hKtns8QZdmNvfNIyO61GqeL4mAvK+zrrg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Pavel Begunkov , Jens Axboe , Beld Zhang Subject: [PATCH 5.19 011/717] io_uring/rw: fix unexpected link breakage Date: Sat, 22 Oct 2022 09:18:10 +0200 Message-Id: <20221022072417.091622636@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747372342595475721?= X-GMAIL-MSGID: =?utf-8?q?1747372342595475721?= From: Pavel Begunkov commit bf68b5b34311ee57ed40749a1257a30b46127556 upstream. req->cqe.res is set in io_read() to the amount of bytes left to be done, which is used to figure out whether to fail a read or not. However, io_read() may do another without returning, and we stash the previous value into ->bytes_done but forget to update cqe.res. Then we ask a read to do strictly less than cqe.res but expect the return to be exactly cqe.res. Fix the bug by updating cqe.res for retries. Cc: stable@vger.kernel.org Reported-and-Tested-by: Beld Zhang Signed-off-by: Pavel Begunkov Link: https://lore.kernel.org/r/3a1088440c7be98e5800267af922a67da0ef9f13.1664235732.git.asml.silence@gmail.com Signed-off-by: Jens Axboe Signed-off-by: Greg Kroah-Hartman --- io_uring/io_uring.c | 1 + 1 file changed, 1 insertion(+) --- a/io_uring/io_uring.c +++ b/io_uring/io_uring.c @@ -4215,6 +4215,7 @@ static int io_read(struct io_kiocb *req, return -EAGAIN; } + req->cqe.res = iov_iter_count(&s->iter); /* * Now retry read with the IOCB_WAITQ parts set in the iocb. If * we get -EIOCBQUEUED, then we'll get a notification when the From patchwork Sat Oct 22 07:18: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: 7135 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1087224wrr; Sat, 22 Oct 2022 00:35:35 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6ChXnWUWNZl5QNy2R2Y2MA1aMrmUoD2cbSxP/Uq42ENzghOdMB8I2JRi8GHp9GIxTkavrE X-Received: by 2002:a17:907:3e1b:b0:78d:ccd0:c9f8 with SMTP id hp27-20020a1709073e1b00b0078dccd0c9f8mr19583054ejc.705.1666424135161; Sat, 22 Oct 2022 00:35:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666424135; cv=none; d=google.com; s=arc-20160816; b=Mnah+egmyJm6ltOyfwFE+iqjb4/wJU9st57bBC6Kw9r7utpiz1eUuEm24M42YNHCco bTMyaGYRDEyeOGFChOi50RCGF0iN89Vd8gr10jx6AxUr0vb03ZOuTDBySmVMIcCSd4NM FxLjc9zm1kEXc7j0pmMOe9w3VPco3ADsyGPvYrxHoi++wGgxqc536iz5rtY+YstcxySi o3qfWdi58z9oawuyfixXwBzwIY36BddK/sWjjEQItmck9MVEjTeqeWr2mQlg+4ACKnlk UibYUzLE6aUC/G2w53xygkIA7p30abqhXmF6LVpfm0FsxOaQDbVDk54pnZAAe2sh3/uj 5lrQ== 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=+qZwEeyTktkD3SbM0MIT67uzbujkWiOS4Lde+uyu7wo=; b=Q1wdVM5oNYCSxtRObaKu5oXe31Pij7R4lZMjfDdS65RICARxHNdn07ypn8VAjqK0IF iX9lpoB06/QoT4jmXDQb77hoGbDxUuKx+C2Z/k4N0OZ56tdYLgCVslwmHgtXUaVIVBwG t5LV3B43MWOurMxMbpPDzHlsNSH08bqBJ5ya0haKrvczmazdR9YqCN8aXbIxTOJd5odP 49j5dst45JerkP3GZFShWXLC4P9Gi3tDJ618IPtzmZiJo6GANOt77nNI25WURvAwHm5V mvenf390f3fiAQZPmCWbscWxZ1OzFYdzlv6Gu7wagnWWhmwJWYcOjnJ3gKHEwUILloEL MAhA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=pQpTig+w; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 ds1-20020a170907724100b0078e18bd3073si22774348ejc.820.2022.10.22.00.35.10; Sat, 22 Oct 2022 00:35: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=pQpTig+w; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S230096AbiJVHeW (ORCPT + 99 others); Sat, 22 Oct 2022 03:34:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46956 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230129AbiJVHeM (ORCPT ); Sat, 22 Oct 2022 03:34: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 928B4237F81; Sat, 22 Oct 2022 00:34: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 A80BB60AD9; Sat, 22 Oct 2022 07:34:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BC0FDC433D6; Sat, 22 Oct 2022 07:34:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424047; bh=jFXfkCbmESFMSgMQFwTsMxOFIK6FkZvxqzNt+bUecq8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pQpTig+woQjbWnsQ6y0qXzo0a95q1ycXPdw7phjP+xBI3RnihBJVRs9GvF64Lc1K+ NVWNeNQmjwSr3ZHoSQc7U4SuDWQXDS6JE4KKEZVme7QldDOiI9h5T5XYoB2hlpKlpg pttoKGKoPd5I6qA8LHFM4mmwFlsTYtmJGDX8gsYU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Stefan Metzmacher , Pavel Begunkov , Jens Axboe Subject: [PATCH 5.19 012/717] io_uring/net: fix fast_iov assignment in io_setup_async_msg() Date: Sat, 22 Oct 2022 09:18:11 +0200 Message-Id: <20221022072417.268623570@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747372353885934916?= X-GMAIL-MSGID: =?utf-8?q?1747372353885934916?= From: Stefan Metzmacher commit 3e4cb6ebbb2bad201c1186bc0b7e8cf41dd7f7e6 upstream. I hit a very bad problem during my tests of SENDMSG_ZC. BUG(); in first_iovec_segment() triggered very easily. The problem was io_setup_async_msg() in the partial retry case, which seems to happen more often with _ZC. iov_iter_iovec_advance() may change i->iov in order to have i->iov_offset being only relative to the first element. Which means kmsg->msg.msg_iter.iov is no longer the same as kmsg->fast_iov. But this would rewind the copy to be the start of async_msg->fast_iov, which means the internal state of sync_msg->msg.msg_iter is inconsitent. I tested with 5 vectors with length like this 4, 0, 64, 20, 8388608 and got a short writes with: - ret=2675244 min_ret=8388692 => remaining 5713448 sr->done_io=2675244 - ret=-EAGAIN => io_uring_poll_arm - ret=4911225 min_ret=5713448 => remaining 802223 sr->done_io=7586469 - ret=-EAGAIN => io_uring_poll_arm - ret=802223 min_ret=802223 => res=8388692 While this was easily triggered with SENDMSG_ZC (queued for 6.1), it was a potential problem starting with 7ba89d2af17aa879dda30f5d5d3f152e587fc551 in 5.18 for IORING_OP_RECVMSG. And also with 4c3c09439c08b03d9503df0ca4c7619c5842892e in 5.19 for IORING_OP_SENDMSG. However 257e84a5377fbbc336ff563833a8712619acce56 introduced the critical code into io_setup_async_msg() in 5.11. Fixes: 7ba89d2af17aa ("io_uring: ensure recv and recvmsg handle MSG_WAITALL correctly") Fixes: 257e84a5377fb ("io_uring: refactor sendmsg/recvmsg iov managing") Cc: stable@vger.kernel.org Signed-off-by: Stefan Metzmacher Reviewed-by: Pavel Begunkov Link: https://lore.kernel.org/r/b2e7be246e2fb173520862b0c7098e55767567a2.1664436949.git.metze@samba.org Signed-off-by: Jens Axboe Signed-off-by: Greg Kroah-Hartman --- io_uring/io_uring.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) --- a/io_uring/io_uring.c +++ b/io_uring/io_uring.c @@ -5852,8 +5852,10 @@ static int io_setup_async_msg(struct io_ memcpy(async_msg, kmsg, sizeof(*kmsg)); async_msg->msg.msg_name = &async_msg->addr; /* if were using fast_iov, set it to the new one */ - if (!async_msg->free_iov) - async_msg->msg.msg_iter.iov = async_msg->fast_iov; + if (!kmsg->free_iov) { + size_t fast_idx = kmsg->msg.msg_iter.iov - kmsg->fast_iov; + async_msg->msg.msg_iter.iov = &async_msg->fast_iov[fast_idx]; + } return -EAGAIN; } From patchwork Sat Oct 22 07:18: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: 7134 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1087182wrr; Sat, 22 Oct 2022 00:35:28 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7kwqUSxVCBk7WWy7TUmz31iO6A922geA8oJwAfSjfQAjLe7JufN4TdZ7UdYnQFm/b2JYXE X-Received: by 2002:a17:902:b907:b0:178:9d11:c978 with SMTP id bf7-20020a170902b90700b001789d11c978mr23147868plb.90.1666424127954; Sat, 22 Oct 2022 00:35:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666424127; cv=none; d=google.com; s=arc-20160816; b=Z/V0ErMWiZIWjp4Fz/XyhKAstKIDKVEh/yM3mccEDeGXv1I6vwNCFo5EbYAcncOK0t 4pX9Z/UFFtM55e02x63fs+mF5OoKz7SFWNfoBlYzVEK3WMQ3Go3sHG9Lw5MDyPed5y4H S00mIPdQy0ZYgLYMqPLFbJmiG/cZKh6rlY5Eg4YoaaUmdSzBa5nj1woHZw0GGcQBa+BA +AMkSquVheT14BwER0kVIZzUA5OftOdALTX/WomyieI0oQfIl+nP3As05kS701BscQRz lSScNwYb1ijnTe03cDPwiQxlNH43m1MjRv9U28bYUOsFYod7+EeCNvwG8I1HM7fwEQWJ nPhQ== 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=sCjD4fdHgGXLAjoOV5OjjQt6DErWdd8i9JDY8IsFw5o=; b=PYKz8WWWAl0EqcdRTrRPvjYTrmVvJUR7DJfahSVqj8z60FPbo7NiIH9WjCgpO3kCiA 6+ofd0TbQNRl4iQrDsx4clytyLKvVRLeT0mdtdLPcHXtS8CYKm2jqvy7IvlVYml2wPcK P1JaJ1o3bGuCWYHwHf9n9C15KBi507zoS8VmZajy8YuH/L2ygDOwwYhZeUkRqZXpn90b m8N5zamLTq0eV+dAHkKBU0TZXh59Fw2vxficQvT0+A3mfA7hwLBFD2xNcB4afdYfooqN K4aHQ8dcjl6hJzEeyy6VURj7Oxk9bhU9Gp0PtQ/vw8DIGEtJGCMXkcuKKyxpDkNQOqFH U/6A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=t4a5HlmZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 n9-20020a170902f60900b0017f73e4af01si11598970plg.298.2022.10.22.00.35.15; Sat, 22 Oct 2022 00:35: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=t4a5HlmZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S230111AbiJVHe0 (ORCPT + 99 others); Sat, 22 Oct 2022 03:34:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47368 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230139AbiJVHeT (ORCPT ); Sat, 22 Oct 2022 03:34:19 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 67AA3241B3C; Sat, 22 Oct 2022 00:34: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 4B0DE60A5C; Sat, 22 Oct 2022 07:34:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5C08DC433C1; Sat, 22 Oct 2022 07:34:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424049; bh=ImQoJW0u2lFxkZslQa97Yh0eN410XO3v29zyD6EWlN4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=t4a5HlmZ85tvv0+Tqx1m9jSYgRfE6oqg2VSdVeWfgcE+zILz1siDx9qMjJarwYguJ ddX4GxlUb3BkDobjtyHwCEcA2e7nruFC8TC+gVYMF3x5nUzqqkBmOm17rvmVHXOLcd BsQ8fw/lr+O95P4yUc9bsRHUkMUKP4oVuuYqW7IA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Pavel Begunkov , Jens Axboe Subject: [PATCH 5.19 013/717] io_uring/net: dont update msg_name if not provided Date: Sat, 22 Oct 2022 09:18:12 +0200 Message-Id: <20221022072417.423138942@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747372345965998280?= X-GMAIL-MSGID: =?utf-8?q?1747372345965998280?= From: Pavel Begunkov commit 6f10ae8a155446248055c7ddd480ef40139af788 upstream. io_sendmsg_copy_hdr() may clear msg->msg_name if the userspace didn't provide it, we should retain NULL in this case. Cc: stable@vger.kernel.org Signed-off-by: Pavel Begunkov Link: https://lore.kernel.org/r/97d49f61b5ec76d0900df658cfde3aa59ff22121.1664486545.git.asml.silence@gmail.com Signed-off-by: Jens Axboe Signed-off-by: Greg Kroah-Hartman --- io_uring/io_uring.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/io_uring/io_uring.c +++ b/io_uring/io_uring.c @@ -5850,7 +5850,8 @@ static int io_setup_async_msg(struct io_ async_msg = req->async_data; req->flags |= REQ_F_NEED_CLEANUP; memcpy(async_msg, kmsg, sizeof(*kmsg)); - async_msg->msg.msg_name = &async_msg->addr; + if (async_msg->msg.msg_name) + async_msg->msg.msg_name = &async_msg->addr; /* if were using fast_iov, set it to the new one */ if (!kmsg->free_iov) { size_t fast_idx = kmsg->msg.msg_iter.iov - kmsg->fast_iov; From patchwork Sat Oct 22 07:18: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: 7138 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1087363wrr; Sat, 22 Oct 2022 00:36:08 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7qQDk0b0yOipPiav/5ezqc83hPzAdqfSId/w8TMSQ4fW/1VUkStVUXwNYYYZxi1k78XxeK X-Received: by 2002:a17:907:25c5:b0:783:f5df:900e with SMTP id ae5-20020a17090725c500b00783f5df900emr18372873ejc.491.1666424167876; Sat, 22 Oct 2022 00:36:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666424167; cv=none; d=google.com; s=arc-20160816; b=dAy1ADXZVIz4ecWUt6xbwp9Y34zuOIqEdh4r0Lc8PMfOqAafQ2tfmpZp8pEbbS3puI er5AmiulSspWL4nrXrlErasrSigkk3zdmvfdnNaR0hrMgWMmR+uSfjbLNdqIK712RObR k9D30JQuqXQRHx2oL3Jfoyk+T/e9crKXLnrodgO3ptHBZ2i97eVPErHNqyu3pghjOpAN +ZcGWdACTvOyhFYHbL8SOvclstRwo55UuUi2CRfCpyoqokpV2T+eF9Hi47yE6x+mlEri EI+RZUhIcHoRLa8HIKGYAZbgJcomwISLNyblfN4WvJtDxU5eIBV+/E+3NLx7nm+aReTS jnRQ== 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=m/YT5GlOipOjDSS3xYZKzsuu9hLRKMwXTpBLDX/lWII=; b=fbrvs8FSFzEZCEYkehCIBqFhVm529ObcDTmIStJE3/gu0ogRLCxmS7INRTzY1CcgSZ ssZyaJz/kBc+4zIJKZEI3KI4QJ0YXleT/yuXHtAmaHnQ/PP97mUfr/5cLOBWgKKjhAd+ /vCI5NeRqEhnifCz0Da0sxqcrtBKqdQk3vAL07OM2bdtgkT2xCiL0yOA4IoRYsOsboF2 894wDiwXvCGl1slblgc3ieqA1MquMdpMK0ViMEXPWWrf7xFH/mCSR10j93xzbjLOx3U7 T+NkUXBICjOTVhUrSfh40vqb1+0kIEsBS0G8XTwrrA+AnUr4hpZY1Bd2MCZ/nFYTjE7I SD4A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=C3RnepN6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 r24-20020aa7d158000000b004614db9083csi3371176edo.313.2022.10.22.00.35.44; Sat, 22 Oct 2022 00: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=C3RnepN6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S230139AbiJVHeo (ORCPT + 99 others); Sat, 22 Oct 2022 03:34:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48216 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230161AbiJVHe2 (ORCPT ); Sat, 22 Oct 2022 03:34: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 78F2D295B2B; Sat, 22 Oct 2022 00:34: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 1B16260AD9; Sat, 22 Oct 2022 07:34:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F4095C433D6; Sat, 22 Oct 2022 07:34:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424055; bh=wgeTeUmxqjOE8P3QiWfW7xlfoUAGvL/ZupeOKUqspo8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=C3RnepN6sw1bDkiHCCTA1aP+3vDdK7AVzYo4Qca6ldBBIPLuIvF5+bkqP5A+KkCKk k5FRgH7Ai+nLF+95+jh6LwEWG5LAnKrHFigib2oAjsp+D2EjAHzWDKL/OCWke6COJg ukT+t60GNs/l57Hl26LmflwOE8TJBf5U4WVhF9Ho= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Pavel Begunkov , Thadeu Lima de Souza Cascardo , Jens Axboe , David Bouman Subject: [PATCH 5.19 014/717] io_uring/af_unix: defer registered files gc to io_uring release Date: Sat, 22 Oct 2022 09:18:13 +0200 Message-Id: <20221022072417.584975027@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747372387971153261?= X-GMAIL-MSGID: =?utf-8?q?1747372387971153261?= From: Pavel Begunkov commit 0091bfc81741b8d3aeb3b7ab8636f911b2de6e80 upstream. Instead of putting io_uring's registered files in unix_gc() we want it to be done by io_uring itself. The trick here is to consider io_uring registered files for cycle detection but not actually putting them down. Because io_uring can't register other ring instances, this will remove all refs to the ring file triggering the ->release path and clean up with io_ring_ctx_free(). Cc: stable@vger.kernel.org Fixes: 6b06314c47e1 ("io_uring: add file set registration") Reported-and-tested-by: David Bouman Signed-off-by: Pavel Begunkov Signed-off-by: Thadeu Lima de Souza Cascardo [axboe: add kerneldoc comment to skb, fold in skb leak fix] Signed-off-by: Jens Axboe Signed-off-by: Greg Kroah-Hartman --- include/linux/skbuff.h | 2 ++ io_uring/io_uring.c | 1 + net/unix/garbage.c | 20 ++++++++++++++++++++ 3 files changed, 23 insertions(+) --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h @@ -965,6 +965,7 @@ typedef unsigned char *sk_buff_data_t; * @csum_level: indicates the number of consecutive checksums found in * the packet minus one that have been verified as * CHECKSUM_UNNECESSARY (max 3) + * @scm_io_uring: SKB holds io_uring registered files * @dst_pending_confirm: need to confirm neighbour * @decrypted: Decrypted SKB * @slow_gro: state present at GRO time, slower prepare step required @@ -1144,6 +1145,7 @@ struct sk_buff { #endif __u8 slow_gro:1; __u8 csum_not_inet:1; + __u8 scm_io_uring:1; #ifdef CONFIG_NET_SCHED __u16 tc_index; /* traffic control index */ --- a/io_uring/io_uring.c +++ b/io_uring/io_uring.c @@ -9484,6 +9484,7 @@ static int io_scm_file_account(struct io UNIXCB(skb).fp = fpl; skb->sk = sk; + skb->scm_io_uring = 1; skb->destructor = unix_destruct_scm; refcount_add(skb->truesize, &sk->sk_wmem_alloc); } --- a/net/unix/garbage.c +++ b/net/unix/garbage.c @@ -204,6 +204,7 @@ void wait_for_unix_gc(void) /* The external entry point: unix_gc() */ void unix_gc(void) { + struct sk_buff *next_skb, *skb; struct unix_sock *u; struct unix_sock *next; struct sk_buff_head hitlist; @@ -297,11 +298,30 @@ void unix_gc(void) spin_unlock(&unix_gc_lock); + /* We need io_uring to clean its registered files, ignore all io_uring + * originated skbs. It's fine as io_uring doesn't keep references to + * other io_uring instances and so killing all other files in the cycle + * will put all io_uring references forcing it to go through normal + * release.path eventually putting registered files. + */ + skb_queue_walk_safe(&hitlist, skb, next_skb) { + if (skb->scm_io_uring) { + __skb_unlink(skb, &hitlist); + skb_queue_tail(&skb->sk->sk_receive_queue, skb); + } + } + /* Here we are. Hitlist is filled. Die. */ __skb_queue_purge(&hitlist); spin_lock(&unix_gc_lock); + /* There could be io_uring registered files, just push them back to + * the inflight list + */ + list_for_each_entry_safe(u, next, &gc_candidates, link) + list_move_tail(&u->link, &gc_inflight_list); + /* All candidates should have been detached by now. */ BUG_ON(!list_empty(&gc_candidates)); From patchwork Sat Oct 22 07:18: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: 7136 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1087355wrr; Sat, 22 Oct 2022 00:36:04 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4SwQbl9D+G3qA5bGJGPDjzMb++BRBVRo9ih81P+Px8/0GYhDoIqBkZgB2N/6lRaZXw2nAe X-Received: by 2002:a17:907:2c4a:b0:78d:f5c2:70d1 with SMTP id hf10-20020a1709072c4a00b0078df5c270d1mr19270653ejc.198.1666424164576; Sat, 22 Oct 2022 00:36:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666424164; cv=none; d=google.com; s=arc-20160816; b=yEvuqwu5hJRdpqcez4+AubGi+E2cpDG814hTOqU/hIwT44WQ8nEx1TPNeu+82jkvCT l+drlrjfpb+nf+wbUwPu7d1d83WM1HwNB2gsd9b42yswGgXhBJgszlqD3bk06Hy2nWiG OW638bJJFkwwQBstAYciwgo9dIguRPVzYHLR5AZJkbuIeztL93RnkRhxYQ+3avpIZgH1 ISAbpa8haOlr0FkZiPK/PtzGjP50tAyjopn1Wl7IG5Gr92rnwBdy5R8u3GtKcddKLFoZ GOsdyrf6f3ouBjvuZvCXyL+HAbiWngp32UhQekU0msV6rmq6+FzYbbYa/3wlc/uYrM8D BZAA== 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=vWlGNTYUuZgGynLNezk0uYxRzVHvMAtJHwZMGykD+2A=; b=R54giWO9u1+Y5xop2L+GWUEHhoKalNVfTO9Xnv44Wh8jg3QBIFsjQbGOYcpnAh0/mI ltk9Lh/9jTz2LssDuCOHSvi1FgpxSpyGEyg77imO5YeQP1BUgliw45F4c8so6t+2+tOL AOrFmEX69AFhXBUL4reh2L3cSkhHQAD/lGlWD9yCeS+/wd0v/uhno/0wxKDSkyqMNKOi aBRXwJi7PMW0Y77kzFGCTds9c+3HK3VatUcZeGg+YyNm+oj5dhV8SwJ3HSg4+snLslbz jFhuzyVjNPeX1MriKnpG8bNU+93Tq17UsjMw7c97j9RC0idg/rBY83Dm8iPUo+8r3UAU Eozg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=uvjQKuNI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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-20020a056402240800b004608020a52esi6226849eda.466.2022.10.22.00.35.40; Sat, 22 Oct 2022 00:36: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=uvjQKuNI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S230168AbiJVHes (ORCPT + 99 others); Sat, 22 Oct 2022 03:34:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48264 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230176AbiJVHe2 (ORCPT ); Sat, 22 Oct 2022 03:34: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 04D3610B9; Sat, 22 Oct 2022 00:34: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 dfw.source.kernel.org (Postfix) with ESMTPS id 4CBC260ADA; Sat, 22 Oct 2022 07:34:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3EFB4C433C1; Sat, 22 Oct 2022 07:34:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424058; bh=4JYcccYrPbaiYI/ym+uHOnTSOSvp7iMYJl+Av0/3swQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uvjQKuNIorfqgjF9dwDBeyQzd86t5UaIsybI5vFqQzxD36c1mPwwgTc3I9YyyjQg8 t7+1cA9v68/soja/gPR3UIQoni/0sMZUOndz0qVewxomW9Vcpbdgtmi/qcjDnp7xVJ CoiTDb/7CywSlg93Lwx7CjpqEJlQ+NZmsve8Q3Xo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Stable@vger.kernel.org, Pavel Begunkov , Jens Axboe Subject: [PATCH 5.19 015/717] io_uring: correct pinned_vm accounting Date: Sat, 22 Oct 2022 09:18:14 +0200 Message-Id: <20221022072417.741102098@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747372384694558324?= X-GMAIL-MSGID: =?utf-8?q?1747372384694558324?= From: Pavel Begunkov commit 42b6419d0aba47c5d8644cdc0b68502254671de5 upstream. ->mm_account should be released only after we free all registered buffers, otherwise __io_sqe_buffers_unregister() will see a NULL ->mm_account and skip locked_vm accounting. Cc: Signed-off-by: Pavel Begunkov Link: https://lore.kernel.org/r/6d798f65ed4ab8db3664c4d3397d4af16ca98846.1664849932.git.asml.silence@gmail.com Signed-off-by: Jens Axboe Signed-off-by: Greg Kroah-Hartman --- io_uring/io_uring.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) --- a/io_uring/io_uring.c +++ b/io_uring/io_uring.c @@ -10711,12 +10711,6 @@ static void io_flush_apoll_cache(struct static __cold void io_ring_ctx_free(struct io_ring_ctx *ctx) { io_sq_thread_finish(ctx); - - if (ctx->mm_account) { - mmdrop(ctx->mm_account); - ctx->mm_account = NULL; - } - io_rsrc_refs_drop(ctx); /* __io_rsrc_put_work() may need uring_lock to progress, wait w/o it */ io_wait_rsrc_data(ctx->buf_data); @@ -10755,6 +10749,10 @@ static __cold void io_ring_ctx_free(stru #endif WARN_ON_ONCE(!list_empty(&ctx->ltimeout_list)); + if (ctx->mm_account) { + mmdrop(ctx->mm_account); + ctx->mm_account = NULL; + } io_mem_free(ctx->rings); io_mem_free(ctx->sq_sqes); From patchwork Sat Oct 22 07:18: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: 7139 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1087401wrr; Sat, 22 Oct 2022 00:36:17 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4qQquTO6FHlQ+UtTTsW+HbBasxDTdY8l2ylTK3t/w3cjJ9bD/PpGmOkcgCviLHI6STCPYM X-Received: by 2002:a05:6402:2211:b0:461:5d0a:6678 with SMTP id cq17-20020a056402221100b004615d0a6678mr4721062edb.378.1666424177072; Sat, 22 Oct 2022 00:36:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666424177; cv=none; d=google.com; s=arc-20160816; b=0++qIY7OiKIWMTTwtlrBi6YPXN+pxtid3G+rLWXKYoaytWy05bRGXZsY8aM2Xl5a4/ WgsLpqR6lA5L43k2/0EaW1/lsl6XD3uVROhQP0h7Vi28aelxJ3XUJ6I8k1cBjFS1bcHs fHb9f1sWkj7203Dwp+eUWTWxF9pjyo68/4YJB/YQffxC36AxgplUj93VWr/b4xC91OFj +eqrhl27t56iis8ZEA1FoKombTGd3thPJdvwQ4rsU9PSYof9v2BpNAcvuwXcBF3pWH0B hKptpbyPpmRRLvCP5ZeNLdATmce9Zde3CUgUvNcC6Y18b9JGxdWC/kq3/e3LBCnRFZ97 JoBQ== 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=beT7UKZDXTZh/bPrJqdNaL8Bv0op8oPEPbElUbwPhjU=; b=rvtdIqRYxmLaGn2V0e5dzG/vNWFxbIDQCzy6y4QyWxNX06AxZaViW0LZP95wn1LDSw prlwyOdqS3La+YgO2y90Regn2T+D4fnN9rYbOQyFng3kiellD/vWL4iVcT+Eu+0qwdbF Ho3JJvyu5CtKNlc7trtg/mIg/0O8vj5yXDhIxoecCTmFiWwtjpUTWEdsrQE8xk1fcNts 7NPEjUMR40BeALRwe79yHGe6kW1B1UZy2ABBT5oTcDTm+0EGxl/kg5RlzgMnzxymBj7b loLYOthseHC3XMtGm+Sp4XJbQKgA1koJ6aqbMbdl6b7pOFbTJVqYjEHv1MhHdTF6T7nN 2QeQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="SXp/g9iT"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 hk6-20020a170906c9c600b0077497671e2asi20963552ejb.406.2022.10.22.00.35.53; Sat, 22 Oct 2022 00:36: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="SXp/g9iT"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S230170AbiJVHe6 (ORCPT + 99 others); Sat, 22 Oct 2022 03:34:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46990 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230190AbiJVHed (ORCPT ); Sat, 22 Oct 2022 03:34: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 2929A1F9EE; Sat, 22 Oct 2022 00:34:25 -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 44DD0B82DF1; Sat, 22 Oct 2022 07:34:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 823A4C433D7; Sat, 22 Oct 2022 07:34:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424062; bh=db2V0LRd+meO9yClRgIgT7wRDLvS+JUnwgMu5rf4fkg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SXp/g9iTCFVDx4JNibCKgs2SU12FS8J/uqnSNbPf6v2PmArNZiUmhQSHRPCgLSLz4 gCU5G98+HHWVgGJteqxqPtzbNywhAMrQmbSni96ADL82To4BJiGd8KgykPfTijlHDR cg3bSARydyIZz1EbuEkQmORsEd5d5EDkLlR3w7co= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Haiyang Zhang , Gaurav Kohli , "David S. Miller" Subject: [PATCH 5.19 016/717] hv_netvsc: Fix race between VF offering and VF association message from host Date: Sat, 22 Oct 2022 09:18:15 +0200 Message-Id: <20221022072417.934407805@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747372397965487065?= X-GMAIL-MSGID: =?utf-8?q?1747372397965487065?= From: Gaurav Kohli commit 365e1ececb2905f94cc10a5817c5b644a32a3ae2 upstream. During vm boot, there might be possibility that vf registration call comes before the vf association from host to vm. And this might break netvsc vf path, To prevent the same block vf registration until vf bind message comes from host. Cc: stable@vger.kernel.org Fixes: 00d7ddba11436 ("hv_netvsc: pair VF based on serial number") Reviewed-by: Haiyang Zhang Signed-off-by: Gaurav Kohli Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- drivers/net/hyperv/hyperv_net.h | 3 ++- drivers/net/hyperv/netvsc.c | 4 ++++ drivers/net/hyperv/netvsc_drv.c | 19 +++++++++++++++++++ 3 files changed, 25 insertions(+), 1 deletion(-) --- a/drivers/net/hyperv/hyperv_net.h +++ b/drivers/net/hyperv/hyperv_net.h @@ -1051,7 +1051,8 @@ struct net_device_context { u32 vf_alloc; /* Serial number of the VF to team with */ u32 vf_serial; - + /* completion variable to confirm vf association */ + struct completion vf_add; /* Is the current data path through the VF NIC? */ bool data_path_is_vf; --- a/drivers/net/hyperv/netvsc.c +++ b/drivers/net/hyperv/netvsc.c @@ -1580,6 +1580,10 @@ static void netvsc_send_vf(struct net_de net_device_ctx->vf_alloc = nvmsg->msg.v4_msg.vf_assoc.allocated; net_device_ctx->vf_serial = nvmsg->msg.v4_msg.vf_assoc.serial; + + if (net_device_ctx->vf_alloc) + complete(&net_device_ctx->vf_add); + netdev_info(ndev, "VF slot %u %s\n", net_device_ctx->vf_serial, net_device_ctx->vf_alloc ? "added" : "removed"); --- a/drivers/net/hyperv/netvsc_drv.c +++ b/drivers/net/hyperv/netvsc_drv.c @@ -2313,6 +2313,18 @@ static struct net_device *get_netvsc_bys } + /* Fallback path to check synthetic vf with + * help of mac addr + */ + list_for_each_entry(ndev_ctx, &netvsc_dev_list, list) { + ndev = hv_get_drvdata(ndev_ctx->device_ctx); + if (ether_addr_equal(vf_netdev->perm_addr, ndev->perm_addr)) { + netdev_notice(vf_netdev, + "falling back to mac addr based matching\n"); + return ndev; + } + } + netdev_notice(vf_netdev, "no netdev found for vf serial:%u\n", serial); return NULL; @@ -2409,6 +2421,11 @@ static int netvsc_vf_changed(struct net_ if (net_device_ctx->data_path_is_vf == vf_is_up) return NOTIFY_OK; + if (vf_is_up && !net_device_ctx->vf_alloc) { + netdev_info(ndev, "Waiting for the VF association from host\n"); + wait_for_completion(&net_device_ctx->vf_add); + } + ret = netvsc_switch_datapath(ndev, vf_is_up); if (ret) { @@ -2440,6 +2457,7 @@ static int netvsc_unregister_vf(struct n netvsc_vf_setxdp(vf_netdev, NULL); + reinit_completion(&net_device_ctx->vf_add); netdev_rx_handler_unregister(vf_netdev); netdev_upper_dev_unlink(vf_netdev, ndev); RCU_INIT_POINTER(net_device_ctx->vf_netdev, NULL); @@ -2479,6 +2497,7 @@ static int netvsc_probe(struct hv_device INIT_DELAYED_WORK(&net_device_ctx->dwork, netvsc_link_change); + init_completion(&net_device_ctx->vf_add); spin_lock_init(&net_device_ctx->lock); INIT_LIST_HEAD(&net_device_ctx->reconfig_events); INIT_DELAYED_WORK(&net_device_ctx->vf_takeover, netvsc_vf_setup); From patchwork Sat Oct 22 07:18: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: 7137 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1087359wrr; Sat, 22 Oct 2022 00:36:06 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5TvQIcKSB1XkrRFY8N2S4Ta0APuC4+oIwAawqUjuWG7Pc+EWYQUt5O/joqMOuD3BanJXDo X-Received: by 2002:a50:9519:0:b0:45f:ca89:cf9a with SMTP id u25-20020a509519000000b0045fca89cf9amr12773893eda.248.1666424166772; Sat, 22 Oct 2022 00:36:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666424166; cv=none; d=google.com; s=arc-20160816; b=lSBOBpcG3Z5HXjvvIqoRbl4Zg5v9VYWCZ6b/htNPNvT4llW3cKaCaIw4OC/Sw2Rcni N3qgi6G4VbFRaYK0CHL7e13+J2LrwEAuvFNTWwbDonh1J+tjSyoaDlf+bh06wCxCgSgk oGUQ8CCsb5HE2aeTVL8shwviGjKMI7lj72sJdtd3i9sGneysOOKEQKzxH03idW5foCz8 GV9hSTa6AgX+c166FG3+hnvdE/6i3lfg/5RnTZ/5zMFuYKPrG9TQUs4+9P9qKBonm0c2 O87rnqa99MIvuy1rq5OOsJq99T8HqNoh44HilRj/F9/BbXn1S1Ui5+3omWXNea2sHV5A GMRQ== 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=YSZ4hcP452Veo+hrwyJREgE2Xyk3t5GdTFBsh2ngQN8=; b=UEGp8sRwDnbMrNJAT8frdFppuuRgU+TYxGCeeTOVza8CrJJVSeY/RJobSNzkavz8O2 d0b9upaRxUE29D1m0XajYhIGgGzYbMeiAmyQc2cRs7YZR2Jo+ZPEpolpY0gUZe2Oo4kJ Mwesr7lqzjsexnCulnU438iGu6/M16pZ9ikRAZLqxptwJWupZQMZz3U0zvkVgEr5158R tBJb3XvPrbVONHLUoHFugoUVJiCb8e+IEM0vjsjcPDgHxGpuu1CS/WOQT8EM46aAqHrG yDB+Viwt4cJWeDeGkjEaU+UxxDj9sNc2NnC3EGsxMc0NS45keOo+Gt6Vic6Ol1HMMG/+ +Nyw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Wn8jEu89; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 jz18-20020a17090775f200b0078d00203ab4si17186257ejc.691.2022.10.22.00.35.42; Sat, 22 Oct 2022 00:36: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=Wn8jEu89; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S230241AbiJVHex (ORCPT + 99 others); Sat, 22 Oct 2022 03:34:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47900 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230164AbiJVHed (ORCPT ); Sat, 22 Oct 2022 03:34:33 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0B7E926561; Sat, 22 Oct 2022 00:34: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 dfw.source.kernel.org (Postfix) with ESMTPS id 8752860A5C; Sat, 22 Oct 2022 07:34:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8ABB4C433C1; Sat, 22 Oct 2022 07:34:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424065; bh=CObaSo7Y/jwaBtljqRsg6xczal4y423u8EiZaZKe4sY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Wn8jEu899xwfYwJcqc0YNOlvXbwdJfkFyiJfi5mnzUEF3gjXfvnUrvfUCOOQ4dtqO eFzONSrUkALiYxd1BlglBLHcCE0ygI4HLDGhaKQ/3+vvqgGl6Zx5e3bqhrwgJ5G9uv zbugEYXlHLLJlcYqMbqwRN8GaM4SWeqcywN0B4C0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Paulo Alcantara (SUSE)" , Enzo Matsumiya , Ronnie Sahlberg , Steve French Subject: [PATCH 5.19 017/717] cifs: destage dirty pages before re-reading them for cache=none Date: Sat, 22 Oct 2022 09:18:16 +0200 Message-Id: <20221022072418.117632497@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747372386991221948?= X-GMAIL-MSGID: =?utf-8?q?1747372386991221948?= From: Ronnie Sahlberg commit bb44c31cdcac107344dd2fcc3bd0504a53575c51 upstream. This is the opposite case of kernel bugzilla 216301. If we mmap a file using cache=none and then proceed to update the mmapped area these updates are not reflected in a later pread() of that part of the file. To fix this we must first destage any dirty pages in the range before we allow the pread() to proceed. Cc: stable@vger.kernel.org Reviewed-by: Paulo Alcantara (SUSE) Reviewed-by: Enzo Matsumiya Signed-off-by: Ronnie Sahlberg Signed-off-by: Steve French Signed-off-by: Greg Kroah-Hartman --- fs/cifs/file.c | 9 +++++++++ 1 file changed, 9 insertions(+) --- a/fs/cifs/file.c +++ b/fs/cifs/file.c @@ -4024,6 +4024,15 @@ static ssize_t __cifs_readv( len = ctx->len; } + if (direct) { + rc = filemap_write_and_wait_range(file->f_inode->i_mapping, + offset, offset + len - 1); + if (rc) { + kref_put(&ctx->refcount, cifs_aio_ctx_release); + return -EAGAIN; + } + } + /* grab a lock here due to read response handlers can access ctx */ mutex_lock(&ctx->aio_mutex); From patchwork Sat Oct 22 07:18: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: 7140 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1087428wrr; Sat, 22 Oct 2022 00:36:25 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6cF+5cCJR0fdt6E7uESfcvkzeSklqJdVNIHY0U01iRZ7Fw74yiljnc580/hvneE4Ic6Q6E X-Received: by 2002:a17:906:cc4f:b0:78d:fdd5:9ea9 with SMTP id mm15-20020a170906cc4f00b0078dfdd59ea9mr18516048ejb.57.1666424185459; Sat, 22 Oct 2022 00:36:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666424185; cv=none; d=google.com; s=arc-20160816; b=Cy1wbDQs1dAsGdyX+VKc3l9h/C7c1j4UQlsRilmQcYV9LaYxURW1tG6uNLWtth8FrD 1CvuQAX90I2yW7pL654i2+RqhZPaouI4CNQ/6dmL+9ej8+MOr18OW34FQ+HxOtFw80QO tkcvP4jEe43sDf3ZoqAWE9c7w3HwRO4ScM3RHmbT23w8DoXVekxLsu1NRNxXs/AE9+aj ua5xLDowDX4tCtWEm21/Z9KoxHX6gsW2FP3r1yZoGWsWcRTJ/70v685QxaiUd/qIybj4 2oU6KypRBEzaY41zwbEs3q6bPaEGl9OsrWEz06ArhTj74zlX28/T9E5ExvSt3DjGyVJN y5Kw== 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=1Z0cpAA2gPaxaDA7Hudpfi6w4Z1UIJnNWCC05RLFmNE=; b=ZI6WkZIWaeIY2YpBZw9QCBLV0xM9KrkW2XSLNi0wNnQfZAAPYDOkXVpNARD4Ltuvh+ Fq1hWJbGL26/oDv/CK2f9YYD2ctQNm/sxzG4quG96LStW/UN+a0hSM72QP9w5QxpxgVO Lbes8d527srMuSN8Tsy9n6yiXpK/xnIX6UBuHAb+Ez/f/1jhF1Qz4EdMsnwU82fiDUMg 0BuekN/sCU2Z6vuuLhuK34IevX8DMqGhRgRIcqowHwR1h9zqKgTuT0VgSl5fuI7gq5ga UGX06L1ntFmwS/jZHJTqiL79az+kjZEu8+YtgJPaYAe9wdDbEPG/CofLRaLHoPGNm/6d wH9A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ZqIF+TsJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 nd10-20020a170907628a00b0078dacbcaa7asi22416665ejc.992.2022.10.22.00.36.01; Sat, 22 Oct 2022 00:36: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=ZqIF+TsJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S230273AbiJVHfR (ORCPT + 99 others); Sat, 22 Oct 2022 03:35:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49562 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230203AbiJVHem (ORCPT ); Sat, 22 Oct 2022 03:34: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 908A1357C5; Sat, 22 Oct 2022 00:34: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 B936E60AD9; Sat, 22 Oct 2022 07:34:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BB2D1C433D7; Sat, 22 Oct 2022 07:34:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424068; bh=R9pusQAITq/r7Pnku+U28DKSfwlq7tVODE7WmxvlkmY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZqIF+TsJbRFNV/ICgXAgtHDo0DS00AeOviUE/6LM+Cm89BEpCJN88fqTpCVdBBBFM AZAB0JU3h6eriy0M9ghxwZeyOp+lzpmc+bK78Ugtia0vxaeA7lTEdvWB8IPI2cD8i3 aC/DZlARRXJCTZjr0m/n/t0nnA/EINXtk2ZYFiv0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zhang Xiaoxu , "Paulo Alcantara (SUSE)" , Tom Talpey , Steve French Subject: [PATCH 5.19 018/717] cifs: Fix the error length of VALIDATE_NEGOTIATE_INFO message Date: Sat, 22 Oct 2022 09:18:17 +0200 Message-Id: <20221022072418.296354338@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747372406721768356?= X-GMAIL-MSGID: =?utf-8?q?1747372406721768356?= From: Zhang Xiaoxu commit e98ecc6e94f4e6d21c06660b0f336df02836694f upstream. Commit d5c7076b772a ("smb3: add smb3.1.1 to default dialect list") extend the dialects from 3 to 4, but forget to decrease the extended length when specific the dialect, then the message length is larger than expected. This maybe leak some info through network because not initialize the message body. After apply this patch, the VALIDATE_NEGOTIATE_INFO message length is reduced from 28 bytes to 26 bytes. Fixes: d5c7076b772a ("smb3: add smb3.1.1 to default dialect list") Signed-off-by: Zhang Xiaoxu Cc: Acked-by: Paulo Alcantara (SUSE) Reviewed-by: Tom Talpey Signed-off-by: Steve French Signed-off-by: Greg Kroah-Hartman --- fs/cifs/smb2pdu.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/fs/cifs/smb2pdu.c +++ b/fs/cifs/smb2pdu.c @@ -1168,9 +1168,9 @@ int smb3_validate_negotiate(const unsign pneg_inbuf->Dialects[0] = cpu_to_le16(server->vals->protocol_id); pneg_inbuf->DialectCount = cpu_to_le16(1); - /* structure is big enough for 3 dialects, sending only 1 */ + /* structure is big enough for 4 dialects, sending only 1 */ inbuflen = sizeof(*pneg_inbuf) - - sizeof(pneg_inbuf->Dialects[0]) * 2; + sizeof(pneg_inbuf->Dialects[0]) * 3; } rc = SMB2_ioctl(xid, tcon, NO_FILE_ID, NO_FILE_ID, From patchwork Sat Oct 22 07:18:18 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 7141 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1087465wrr; Sat, 22 Oct 2022 00:36:35 -0700 (PDT) X-Google-Smtp-Source: AMsMyM54bBimf3YFY9R4V186z4TQnHj6kMLPqT+Uei1iG1HwlHdF6Dv8oPeIByvsL2MqB+IkCy+A X-Received: by 2002:a17:907:2c4f:b0:78d:eebe:f413 with SMTP id hf15-20020a1709072c4f00b0078deebef413mr19200623ejc.221.1666424195737; Sat, 22 Oct 2022 00:36:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666424195; cv=none; d=google.com; s=arc-20160816; b=W5HRBdvNH1pqYGqSDeRQZ1oquXMYxYUJvUMtt6DPANoC77htd5zhWuAYMxG1efzYYC 4/TT7SXV7X1ABDOYREP4wHFgUGXJcxDZQ1fuWYITlVVPdZkeRd1oCEWjoEfediBTm37h OoJtVx1PeKHg+mg73tiQhnZegAF5PKOvOSedsv/QzFnun+dpleLe4HXQmdEkIcb2UuTG rnOaYtFbpCxtAFbaT+mKlrW5yfHHdd6OoLIMRQnZA5xDmbqSWhyYrNeVumapfnC5SXbd bTI9I8gMWYeJu9FcIwFEvzIYBfG2KqOsaob6QbXUR6iWeUgUhQ/4w5+HuuHx71WU+jzN FgNQ== 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=jQQ3lBtOkQf+d1Gg3b/h1c8ZppgjH0DXRnlUpyoFj+4=; b=lBcVDXnWF35qbylYTBG3KaqflOqWL0w3YjMG9f4HeMc/g3TbLjygbhmcplYMUHfvhV SvnY+mIwC0+cktAT/3tgJiYMxSGj238z6iKNZMqjLRsv24XADQrh8baMJe5xLlp9dTmL 9mXCkqMhLHvaJM4RJlBViJozyzzi/WZAX9+/u8JhRSKLHnbq4MDA6CXTnwKKWwXT35SI sPCYfmO0A3qiig4ACFItcuAEg15u71Y7MLAsmdDB3OV79JGOKFIMjxHCv3Fz8gAAXhVZ Egfmmmnn3MVBzAS54L0UJPsShmafRzJ4paDH2ECXrED/wUYKQcFnK6SpD0HtTkoASJlh GwFQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ua8yRYpN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 nb38-20020a1709071ca600b00773db351c39si24783539ejc.64.2022.10.22.00.36.10; Sat, 22 Oct 2022 00:36: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=ua8yRYpN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S230184AbiJVHfZ (ORCPT + 99 others); Sat, 22 Oct 2022 03:35:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47284 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230220AbiJVHer (ORCPT ); Sat, 22 Oct 2022 03:34:47 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 14FC341D0F; Sat, 22 Oct 2022 00:34: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 ams.source.kernel.org (Postfix) with ESMTPS id B6D69B82DF0; Sat, 22 Oct 2022 07:34:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D0C18C433D6; Sat, 22 Oct 2022 07:34:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424071; bh=LKzotlONbnZIXGa7AgoINdc1KVArDb4wRqS7Xv8qXCU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ua8yRYpNEZS8YQqiHXWObgR3X7rOH282HTjp2cUUB8gt26UR6uR5ENLZ8ZqJ39db3 6KKA/MevxDXnhGeOi4Fsf0jecHqBtkN4CIPXGFAIxCabahlr/QM3KMC0NPDdBDcwu6 86f9t+Z7IKerJljuARuSjqBGjdhdA6iLaTtsCs1Y= 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 5.19 019/717] iio: dac: ad5593r: Fix i2c read protocol requirements Date: Sat, 22 Oct 2022 09:18:18 +0200 Message-Id: <20221022072418.461052255@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747372417543949561?= X-GMAIL-MSGID: =?utf-8?q?1747372417543949561?= 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 @@ -13,6 +13,8 @@ #include #include +#include + #define AD5593R_MODE_CONF (0 << 4) #define AD5593R_MODE_DAC_WRITE (1 << 4) #define AD5593R_MODE_ADC_READBACK (4 << 4) @@ -20,6 +22,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); @@ -38,13 +58,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) @@ -58,25 +72,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 Sat Oct 22 07:18: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: 7142 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1087551wrr; Sat, 22 Oct 2022 00:36:57 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4YuEexaJhprqDJly21ihhmDRCPdAktMaaNAI5+YzgDtzQYR+op6TaigP3Pr57cpqP6mSjo X-Received: by 2002:a17:907:62a1:b0:781:b320:90c0 with SMTP id nd33-20020a17090762a100b00781b32090c0mr17825611ejc.255.1666424216893; Sat, 22 Oct 2022 00:36:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666424216; cv=none; d=google.com; s=arc-20160816; b=qQrBVasj2ulgtHJddYi26RRaco4knLuWeSXGqQQPo6rJXGkMNmAyKFkDqTk7kxwTc5 6nmUUoSGBmj2reg9zc4fn9lzJHxzNxbaCcZ/oR7OOqYCw3RhdQjTqOzu1z+nIyyy0qC6 prKY3tMNGfjIC0/PtLtvpCB3cX6FpWlFhCrKaBYOkYUmN3kRk+agITj4qKYJUVPcvIWp IwL6cDZXKaxLC77w/z6wsF3n8LCGTj62rPBxDGUq6deABJxrs/f6yBa3LxiUdBQP1O9W NkIbo7Fu+Yhr8kTvKWO6/cRJwV4AXI/zhUB9ss5UgipZTwQkeaT36NRmQ451JcWfl9rP aj/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=bUz+5s37sHEm/1PxeiFhL6q43PpNa3f+qJgf9K8KdBU=; b=XIVElLACNb0qzCGk04e5JOs8XZOt8kDW5ILmrt5QSCP43cQjmpInnfvPT2OGZVtOfH bFpJYEKmvq5SbvAwyox9JHCcjdSTxEUCsV2YWbcRTfPbTgjBZ1OqDN6KclNMg5tFWzjD GUMRKJkUviMSF5emJ17BAIEuNsj4QX0LLK65bZ9XnIMKl5bOAUI3BmIJ1ofEngQNDStX PiLfqJazvZ4yFAV9gHGc/20zW539ZYDU2Nl26T6O/16jwPGbokJPAdaMA37sqa/7eUj9 z/G69pJyefks0B7mBZdf6Au6nridgSILvp9NjNFXrv7yH3od+KlsF9K2SuIvMB0O/kQp h5QA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=LqXu0+XA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 hg3-20020a1709072cc300b00790058488dcsi3798806ejc.48.2022.10.22.00.36.32; Sat, 22 Oct 2022 00:36: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=LqXu0+XA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S230302AbiJVHfl (ORCPT + 99 others); Sat, 22 Oct 2022 03:35:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49434 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230134AbiJVHfI (ORCPT ); Sat, 22 Oct 2022 03:35: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 47D6F48A23; Sat, 22 Oct 2022 00:34: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 C3BF3B82DB2; Sat, 22 Oct 2022 07:34:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F3367C433C1; Sat, 22 Oct 2022 07:34:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424077; bh=fS92YeGgAE7/jfevSZZ9qKCTlZHn8Zq5p+Rkx1Cwmg4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LqXu0+XA+vTGrN4aFGUfldbVNn+YNxZnPv3+RUqKoE4meQpbaZQMdpRqzl+0biyDK NK/UBU8gq8E/V7AkatpiT3cQxvHwh+rf7zJPklXesj4go2YzshvT8B3iiJQSqwMePr O8+XK/7PcnXNKVa1whFkkOUdn/OoV5LkhBa0SjNc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Meng Li , =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= , Denys Zagorui , Stable@vger.kernel.org, Jonathan Cameron Subject: [PATCH 5.19 020/717] iio: ltc2497: Fix reading conversion results Date: Sat, 22 Oct 2022 09:18:19 +0200 Message-Id: <20221022072418.654044047@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747372439819679878?= X-GMAIL-MSGID: =?utf-8?q?1747372439819679878?= From: Uwe Kleine-König commit 7f4f1096d5921f5d90547596f9ce80e0b924f887 upstream. After the result of the previous conversion is read the chip automatically starts a new conversion and doesn't accept new i2c transfers until this conversion is completed which makes the function return failure. So add an early return iff the programming of the new address isn't needed. Note this will not fix the problem in general, but all cases that are currently used. Once this changes we get the failure back, but this can be addressed when the need arises. Fixes: 69548b7c2c4f ("iio: adc: ltc2497: split protocol independent part in a separate module ") Reported-by: Meng Li Signed-off-by: Uwe Kleine-König Tested-by: Denys Zagorui Cc: Link: https://lore.kernel.org/r/20220815091647.1523532-1-dzagorui@cisco.com Signed-off-by: Jonathan Cameron Signed-off-by: Greg Kroah-Hartman --- drivers/iio/adc/ltc2497.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) --- a/drivers/iio/adc/ltc2497.c +++ b/drivers/iio/adc/ltc2497.c @@ -41,6 +41,19 @@ static int ltc2497_result_and_measure(st } *val = (be32_to_cpu(st->buf) >> 14) - (1 << 17); + + /* + * The part started a new conversion at the end of the above i2c + * transfer, so if the address didn't change since the last call + * everything is fine and we can return early. + * If not (which should only happen when some sort of bulk + * conversion is implemented) we have to program the new + * address. Note that this probably fails as the conversion that + * was triggered above is like not complete yet and the two + * operations have to be done in a single transfer. + */ + if (ddata->addr_prev == address) + return 0; } ret = i2c_smbus_write_byte(st->client, From patchwork Sat Oct 22 07:18:20 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 7143 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1087569wrr; Sat, 22 Oct 2022 00:36:59 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5/Mk4Mu/5x95gudH/DIf5b15qdLBWs4csVwt5WiWMn2tf4pIeReXqc2Fq48+MCHF2ORtoq X-Received: by 2002:a17:907:3ea4:b0:78e:25e2:c33b with SMTP id hs36-20020a1709073ea400b0078e25e2c33bmr18271929ejc.603.1666424219007; Sat, 22 Oct 2022 00:36:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666424219; cv=none; d=google.com; s=arc-20160816; b=dYXZ58vPQzx9oauuhrdHoqApwd1mE3vPlQUtckJ9mFwF0Urc7SAIk+K2Y1aoFz0cHe 8z8H21/BK6nPPCzY2gSqdYhJDjrc5gRWf6rsBA2B3XUMvPOZTOt1LF994jb4fTIAVVWC qWr2bMYw/0mNC1Roz1jfgjz8ugEqoAbWxzIh4MB9xnWbFDDYhv5UxC0/ombtkm3yTa24 sI7+xYt8DASanTgJ0CUqIth2Pd/BK1bJ6eT7gU91BqNLz/oj7O5R3zwA7OcTw4s+pNSO qocI4HYs11A7f5ELYDZsLhs4976tdu0SHMtdjSQlzfFuF/edcU14rhgI501BkJZA5pfT qfkA== 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=hwuEHQ4Yj4TnGatb2JRWwukiknIOVCPFr4FcDVO1pTA=; b=R2oOnadywMpAXObGGxWfODPdLCzObm5yiLWHR2++LVmm0oSJX532lIkmgAz5Z33rtX oO0xCCRrERyxS06PhWtusTCMPFmOkVSm4XgLY08HRWmaIc68oTHjp+bN0YXl9hN/7XTm 3c0SpROMo+ePVBtJfJ1CxgDBcXsEE+mtU7kCqv4Au7QwgoOrxN6sTRpkvcforUe6kIQf jpmKxZFAE10yM00AK8NEcz2YDtU0kje3Tm1BIaPi3U4YRTZkohKSyzFVcuI3SL6DPmcu TokiaCE/TC4094i0jbSdNcU2AGjFLhmAkn1luuYh3o77nXSYkh6vJk5ZVfVx8EWq2MvZ DOYQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Z58ydCmm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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-20020a170906fd8800b0079dccbbf0c0si3005237ejb.146.2022.10.22.00.36.35; Sat, 22 Oct 2022 00:36: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=Z58ydCmm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S230188AbiJVHfr (ORCPT + 99 others); Sat, 22 Oct 2022 03:35:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48154 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230193AbiJVHfL (ORCPT ); Sat, 22 Oct 2022 03:35:11 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1F6A310B9; Sat, 22 Oct 2022 00:34: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 4C6E860AD9; Sat, 22 Oct 2022 07:34:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 42C5DC433C1; Sat, 22 Oct 2022 07:34:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424080; bh=ua2YKCret8Q3QdpyymxKIeW3ykV2g5RTC7x+GcOzxVY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Z58ydCmmhDIST5ZKR4nRnChXTCxmA10teoGqWaR8GZxkK0hA9wpqLSeSDSs5IxcOZ B3lLr1qTUtj1e/BdyZDZca5IJFz1nqEimj/hV+ePundNexfn8lFgsD2P/bORV6IKtB eqZXA/bBnEPzxv+mvh1qkiLiDI/3WkatdpdcVxXc= 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?= , Stable@vger.kernel.org, Jonathan Cameron Subject: [PATCH 5.19 021/717] iio: adc: ad7923: fix channel readings for some variants Date: Sat, 22 Oct 2022 09:18:20 +0200 Message-Id: <20221022072418.828181689@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747372441840543066?= X-GMAIL-MSGID: =?utf-8?q?1747372441840543066?= From: Nuno Sá commit f4f43f01cff2f29779343ade755191afd2581c77 upstream. Some of the supported devices have 4 or 2 LSB trailing bits that should not be taken into account. Hence we need to shift these bits out which fits perfectly on the scan type shift property. This change fixes both raw and buffered reads. Fixes: f2f7a449707e ("iio:adc:ad7923: Add support for the ad7904/ad7914/ad7924") Fixes: 851644a60d20 ("iio: adc: ad7923: Add support for the ad7908/ad7918/ad7928") Signed-off-by: Nuno Sá Link: https://lore.kernel.org/r/20220912081223.173584-2-nuno.sa@analog.com Cc: Signed-off-by: Jonathan Cameron Signed-off-by: Greg Kroah-Hartman --- drivers/iio/adc/ad7923.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) --- a/drivers/iio/adc/ad7923.c +++ b/drivers/iio/adc/ad7923.c @@ -93,6 +93,7 @@ enum ad7923_id { .sign = 'u', \ .realbits = (bits), \ .storagebits = 16, \ + .shift = 12 - (bits), \ .endianness = IIO_BE, \ }, \ } @@ -268,7 +269,8 @@ static int ad7923_read_raw(struct iio_de return ret; if (chan->address == EXTRACT(ret, 12, 4)) - *val = EXTRACT(ret, 0, 12); + *val = EXTRACT(ret, chan->scan_type.shift, + chan->scan_type.realbits); else return -EIO; From patchwork Sat Oct 22 07:18: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: 7149 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1087745wrr; Sat, 22 Oct 2022 00:37:33 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5QoAkmbxuDOafvXgiFeQwSjjCIppYXom+dt26Qq6931MI4UcKKIcN/6wXVgYIcRKAsoQQT X-Received: by 2002:a17:907:6e9e:b0:78c:5533:4158 with SMTP id sh30-20020a1709076e9e00b0078c55334158mr18105709ejc.417.1666424242676; Sat, 22 Oct 2022 00:37:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666424242; cv=none; d=google.com; s=arc-20160816; b=tEAKC1pjkOrQV7sfwcFh7UEv6BIWXZb1Ce/Q3xZzL2r1gnSkj/iOdcu9xrt1K2PlPV wh32nDDr1SiOXM7yLLFAm3/23rfgV2eaxP5T2exw1fpzIuHFaD3SMpxlaB+pO2oqUetL uQooacqG6bHa/0eSVPG8Va227A4ywHDOgxG+kviRGgsSazse668hyrSM01UxQ+DGKUoH mNYtK5erV+WJ1hXKXkq4eHqPEA2BE8xOEDSWt6a3Ytf6avP9pdOK7lhFm5ezLuNdrvhw rZNpAxjAKTROhQJk+u5DEvXX9wrq3/BN7rfcvz98YeC4mO8+n9c/VfYn6Qxd9Mt6EoM/ 7KeA== 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=8FHYFr4Nwdv/iOPNXYj6eVcFWvQYx1EYUPazb6fkq3I=; b=W/aMmLyeL0aBk2c5QVALiuYCN5VIvqGZf7iT6EkALoI2qfcSI5FfUQvbgo8CRSiaDW dR/TsgDjbLJWNCOvN+ggjjkoD/CE8QXBOQ4FxM/R8Y37OTYoTYcfPBcgD9lfAOSuRxJe jSigKaqYsH4tFr2zjHHmK3HV/CMwSr5Ce+Tg6VVj/3o1OxIpzraZtDCrxAqdVeoulUio NaX7YoKDdiNc2Q0+zUww2c5i7tJPD5iDBByWyNUlTubKsQLL/RLLilXQfrVWAhFTelBu EM3CcimhXXQbX4aLGdZpcB86IS5LeOa34HgQ121FLrpHhP/OtT0YY9cQ+16Qs3ENHKH7 PCfQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=vuLnur5x; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 y18-20020a056402359200b0045d06ea5596si24076437edc.26.2022.10.22.00.36.59; Sat, 22 Oct 2022 00:37: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=vuLnur5x; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S230327AbiJVHgA (ORCPT + 99 others); Sat, 22 Oct 2022 03:36:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50064 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230286AbiJVHf1 (ORCPT ); Sat, 22 Oct 2022 03:35:27 -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 E68256450; Sat, 22 Oct 2022 00:34: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 D5627B82DEF; Sat, 22 Oct 2022 07:34:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 440A5C433C1; Sat, 22 Oct 2022 07:34:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424083; bh=lHA+zVgSOdyqCjkiWL6eqbyOGZwAZZm29Yp/49MU+HM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vuLnur5xf7LmhM3PsNhXeO1+coq0dBuDm51GJaHN90hUe/4/WwdQvxPcS9J2IlLEx ZTLXDU552dNO6LjsxBVBMf1pWq0P1wYxQVLv8gGTO3Tgx3MFARwvKpSU8iCLzcx2Lb 7ukEfGJkqFpiXLd/7N77y71AQZhshccWZqO6Xvpc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Eddie James , Joel Stanley , Andy Shevchenko , Jonathan Cameron Subject: [PATCH 5.19 022/717] iio: pressure: dps310: Refactor startup procedure Date: Sat, 22 Oct 2022 09:18:21 +0200 Message-Id: <20221022072419.007754699@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747372466443173761?= X-GMAIL-MSGID: =?utf-8?q?1747372466443173761?= From: Eddie James commit c2329717bdd3fa62f8a2f3d8d85ad0bee4556bd7 upstream. Move the startup procedure into a function, and correct a missing check on the return code for writing the PRS_CFG register. Cc: Signed-off-by: Eddie James Reviewed-by: Joel Stanley Reviewed-by: Andy Shevchenko Link: https://lore.kernel.org/r/20220915195719.136812-2-eajames@linux.ibm.com Signed-off-by: Jonathan Cameron Signed-off-by: Greg Kroah-Hartman --- drivers/iio/pressure/dps310.c | 188 ++++++++++++++++++++++-------------------- 1 file changed, 99 insertions(+), 89 deletions(-) --- a/drivers/iio/pressure/dps310.c +++ b/drivers/iio/pressure/dps310.c @@ -159,6 +159,102 @@ static int dps310_get_coefs(struct dps31 return 0; } +/* + * Some versions of the chip will read temperatures in the ~60C range when + * it's actually ~20C. This is the manufacturer recommended workaround + * to correct the issue. The registers used below are undocumented. + */ +static int dps310_temp_workaround(struct dps310_data *data) +{ + int rc; + int reg; + + rc = regmap_read(data->regmap, 0x32, ®); + if (rc) + return rc; + + /* + * If bit 1 is set then the device is okay, and the workaround does not + * need to be applied + */ + if (reg & BIT(1)) + return 0; + + rc = regmap_write(data->regmap, 0x0e, 0xA5); + if (rc) + return rc; + + rc = regmap_write(data->regmap, 0x0f, 0x96); + if (rc) + return rc; + + rc = regmap_write(data->regmap, 0x62, 0x02); + if (rc) + return rc; + + rc = regmap_write(data->regmap, 0x0e, 0x00); + if (rc) + return rc; + + return regmap_write(data->regmap, 0x0f, 0x00); +} + +static int dps310_startup(struct dps310_data *data) +{ + int rc; + int ready; + + /* + * Set up pressure sensor in single sample, one measurement per second + * mode + */ + rc = regmap_write(data->regmap, DPS310_PRS_CFG, 0); + if (rc) + return rc; + + /* + * Set up external (MEMS) temperature sensor in single sample, one + * measurement per second mode + */ + rc = regmap_write(data->regmap, DPS310_TMP_CFG, DPS310_TMP_EXT); + if (rc) + return rc; + + /* Temp and pressure shifts are disabled when PRC <= 8 */ + rc = regmap_write_bits(data->regmap, DPS310_CFG_REG, + DPS310_PRS_SHIFT_EN | DPS310_TMP_SHIFT_EN, 0); + if (rc) + return rc; + + /* MEAS_CFG doesn't update correctly unless first written with 0 */ + rc = regmap_write_bits(data->regmap, DPS310_MEAS_CFG, + DPS310_MEAS_CTRL_BITS, 0); + if (rc) + return rc; + + /* Turn on temperature and pressure measurement in the background */ + rc = regmap_write_bits(data->regmap, DPS310_MEAS_CFG, + DPS310_MEAS_CTRL_BITS, DPS310_PRS_EN | + DPS310_TEMP_EN | DPS310_BACKGROUND); + if (rc) + return rc; + + /* + * Calibration coefficients required for reporting temperature. + * They are available 40ms after the device has started + */ + rc = regmap_read_poll_timeout(data->regmap, DPS310_MEAS_CFG, ready, + ready & DPS310_COEF_RDY, 10000, 40000); + if (rc) + return rc; + + rc = dps310_get_coefs(data); + if (rc) + return rc; + + return dps310_temp_workaround(data); +} + static int dps310_get_pres_precision(struct dps310_data *data) { int rc; @@ -677,52 +773,12 @@ static const struct iio_info dps310_info .write_raw = dps310_write_raw, }; -/* - * Some verions of chip will read temperatures in the ~60C range when - * its actually ~20C. This is the manufacturer recommended workaround - * to correct the issue. The registers used below are undocumented. - */ -static int dps310_temp_workaround(struct dps310_data *data) -{ - int rc; - int reg; - - rc = regmap_read(data->regmap, 0x32, ®); - if (rc < 0) - return rc; - - /* - * If bit 1 is set then the device is okay, and the workaround does not - * need to be applied - */ - if (reg & BIT(1)) - return 0; - - rc = regmap_write(data->regmap, 0x0e, 0xA5); - if (rc < 0) - return rc; - - rc = regmap_write(data->regmap, 0x0f, 0x96); - if (rc < 0) - return rc; - - rc = regmap_write(data->regmap, 0x62, 0x02); - if (rc < 0) - return rc; - - rc = regmap_write(data->regmap, 0x0e, 0x00); - if (rc < 0) - return rc; - - return regmap_write(data->regmap, 0x0f, 0x00); -} - static int dps310_probe(struct i2c_client *client, const struct i2c_device_id *id) { struct dps310_data *data; struct iio_dev *iio; - int rc, ready; + int rc; iio = devm_iio_device_alloc(&client->dev, sizeof(*data)); if (!iio) @@ -747,54 +803,8 @@ static int dps310_probe(struct i2c_clien if (rc) return rc; - /* - * Set up pressure sensor in single sample, one measurement per second - * mode - */ - rc = regmap_write(data->regmap, DPS310_PRS_CFG, 0); - - /* - * Set up external (MEMS) temperature sensor in single sample, one - * measurement per second mode - */ - rc = regmap_write(data->regmap, DPS310_TMP_CFG, DPS310_TMP_EXT); - if (rc < 0) - return rc; - - /* Temp and pressure shifts are disabled when PRC <= 8 */ - rc = regmap_write_bits(data->regmap, DPS310_CFG_REG, - DPS310_PRS_SHIFT_EN | DPS310_TMP_SHIFT_EN, 0); - if (rc < 0) - return rc; - - /* MEAS_CFG doesn't update correctly unless first written with 0 */ - rc = regmap_write_bits(data->regmap, DPS310_MEAS_CFG, - DPS310_MEAS_CTRL_BITS, 0); - if (rc < 0) - return rc; - - /* Turn on temperature and pressure measurement in the background */ - rc = regmap_write_bits(data->regmap, DPS310_MEAS_CFG, - DPS310_MEAS_CTRL_BITS, DPS310_PRS_EN | - DPS310_TEMP_EN | DPS310_BACKGROUND); - if (rc < 0) - return rc; - - /* - * Calibration coefficients required for reporting temperature. - * They are available 40ms after the device has started - */ - rc = regmap_read_poll_timeout(data->regmap, DPS310_MEAS_CFG, ready, - ready & DPS310_COEF_RDY, 10000, 40000); - if (rc < 0) - return rc; - - rc = dps310_get_coefs(data); - if (rc < 0) - return rc; - - rc = dps310_temp_workaround(data); - if (rc < 0) + rc = dps310_startup(data); + if (rc) return rc; rc = devm_iio_device_register(&client->dev, iio); From patchwork Sat Oct 22 07:18: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: 7146 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1087690wrr; Sat, 22 Oct 2022 00:37:19 -0700 (PDT) X-Google-Smtp-Source: AMsMyM54IhsO6cFJy6HtErHpS3Ztee5RYbd+t51cgZGhxI4tith+zUFWj7moawsM7wk/Y3Xo4dUR X-Received: by 2002:a05:6402:2712:b0:45d:de37:f828 with SMTP id y18-20020a056402271200b0045dde37f828mr20277367edd.317.1666424239269; Sat, 22 Oct 2022 00:37:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666424239; cv=none; d=google.com; s=arc-20160816; b=0sut0/pzgMhYgV37bBryCvdIqt+qzs53eVHhziIdo6+/Gk8kFx9ViO/07Eb2FlHRu2 6UptL34mWgKvzuyffei3xciJX0mvAD2o+4ppxEfqu43GQF4HGuJQhaRarb4cT2ZpiY+C Dhx6mwk2I+CnOwaMw2V0zcdFIjBnlnVQAQUVdSQrP8tdpYUsBDRYWtHyVAVgABHQqkJN 0kVk65O3KHlAvNcvSwAsO5hLEaaUhxZP8fZRVOQbmG8c1rlV5PU1U7qxszwJzdy1Liq9 zjL7vCqpVsoFRi1nod0YtSSwqR9Fne4G2fvsAM2Nh/+cpBnFk3Faxpac4EFnvWWE+hVv yFrA== 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=gJZVwGfpFKJKpPU3C0p768rRfXZR8eoFVlxv7IglUho=; b=PG/BL7J26GHYqS4jDdUfo8P+CXjd/YJmwizd0e6YJWQiRwm6K1kk4Yzllra/VGWHgV tObkWxVXDLnAcX5dw09frsiJuFwK5D6si5H8t2Vl2G0dMV3f1RYFyj/uEp9IaTnIkUZQ M3bFUJjnkXH34kYCQA+whvtCtXcUxkkgoxvnGwgMAzQC6EtisXv2t1CEw1PT1WZHkFaX djlcn0DkP5d/e/pEJ2GDEWKZl/rAh6TX37jKNMh6Hq1n1I6A9RqU9XjJ+Hk1HWztO+rF Mk9oJgh/f7v9gZDVvD4fhGe0wWCCOCoYbkW73VPLBUdOyW6jaxAxqc0+iyDU79Xi2iTc 08DA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ijP4Ab5v; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 js13-20020a17090797cd00b00782f3e3bb71si8753841ejc.912.2022.10.22.00.36.55; Sat, 22 Oct 2022 00:37: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=ijP4Ab5v; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S230272AbiJVHf4 (ORCPT + 99 others); Sat, 22 Oct 2022 03:35:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53108 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230221AbiJVHfZ (ORCPT ); Sat, 22 Oct 2022 03:35:25 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E897359E9C; Sat, 22 Oct 2022 00:34: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 sin.source.kernel.org (Postfix) with ESMTPS id 422E5CE2C98; Sat, 22 Oct 2022 07:34:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 34ABBC43470; Sat, 22 Oct 2022 07:34:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424086; bh=z6BUKnQXIYEmBq/uQLvhq8qTqLB0q2qvgDL8SK8Bizo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ijP4Ab5vKNYIv2CUCzCp4Mf6g1HgIrfsaOG/0974cPEqX1QxRccdqmvQuM+iNydqk Fj+V18HO7/+/QbBWbrTj44RyVC/cwyh6nuIt+rVjNz645IjZe6uTPJFDs7wzlBUuJG Y6zPw6fCaLDZbHHvQazYEkKLRcrZ+nGYrvCNfUvw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Eddie James , Andy Shevchenko , Jonathan Cameron Subject: [PATCH 5.19 023/717] iio: pressure: dps310: Reset chip after timeout Date: Sat, 22 Oct 2022 09:18:22 +0200 Message-Id: <20221022072419.211535118@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747372463056003902?= X-GMAIL-MSGID: =?utf-8?q?1747372463056003902?= From: Eddie James commit 7b4ab4abcea4c0c10b25187bf2569e5a07e9a20c upstream. The DPS310 chip has been observed to get "stuck" such that pressure and temperature measurements are never indicated as "ready" in the MEAS_CFG register. The only solution is to reset the device and try again. In order to avoid continual failures, use a boolean flag to only try the reset after timeout once if errors persist. Fixes: ba6ec48e76bc ("iio: Add driver for Infineon DPS310") Cc: Signed-off-by: Eddie James Reviewed-by: Andy Shevchenko Link: https://lore.kernel.org/r/20220915195719.136812-3-eajames@linux.ibm.com Signed-off-by: Jonathan Cameron Signed-off-by: Greg Kroah-Hartman --- drivers/iio/pressure/dps310.c | 74 ++++++++++++++++++++++++++++++++++++------ 1 file changed, 64 insertions(+), 10 deletions(-) --- a/drivers/iio/pressure/dps310.c +++ b/drivers/iio/pressure/dps310.c @@ -89,6 +89,7 @@ struct dps310_data { s32 c00, c10, c20, c30, c01, c11, c21; s32 pressure_raw; s32 temp_raw; + bool timeout_recovery_failed; }; static const struct iio_chan_spec dps310_channels[] = { @@ -393,11 +394,69 @@ static int dps310_get_temp_k(struct dps3 return scale_factors[ilog2(rc)]; } +static int dps310_reset_wait(struct dps310_data *data) +{ + int rc; + + rc = regmap_write(data->regmap, DPS310_RESET, DPS310_RESET_MAGIC); + if (rc) + return rc; + + /* Wait for device chip access: 2.5ms in specification */ + usleep_range(2500, 12000); + return 0; +} + +static int dps310_reset_reinit(struct dps310_data *data) +{ + int rc; + + rc = dps310_reset_wait(data); + if (rc) + return rc; + + return dps310_startup(data); +} + +static int dps310_ready_status(struct dps310_data *data, int ready_bit, int timeout) +{ + int sleep = DPS310_POLL_SLEEP_US(timeout); + int ready; + + return regmap_read_poll_timeout(data->regmap, DPS310_MEAS_CFG, ready, ready & ready_bit, + sleep, timeout); +} + +static int dps310_ready(struct dps310_data *data, int ready_bit, int timeout) +{ + int rc; + + rc = dps310_ready_status(data, ready_bit, timeout); + if (rc) { + if (rc == -ETIMEDOUT && !data->timeout_recovery_failed) { + /* Reset and reinitialize the chip. */ + if (dps310_reset_reinit(data)) { + data->timeout_recovery_failed = true; + } else { + /* Try again to get sensor ready status. */ + if (dps310_ready_status(data, ready_bit, timeout)) + data->timeout_recovery_failed = true; + else + return 0; + } + } + + return rc; + } + + data->timeout_recovery_failed = false; + return 0; +} + static int dps310_read_pres_raw(struct dps310_data *data) { int rc; int rate; - int ready; int timeout; s32 raw; u8 val[3]; @@ -409,9 +468,7 @@ static int dps310_read_pres_raw(struct d timeout = DPS310_POLL_TIMEOUT_US(rate); /* Poll for sensor readiness; base the timeout upon the sample rate. */ - rc = regmap_read_poll_timeout(data->regmap, DPS310_MEAS_CFG, ready, - ready & DPS310_PRS_RDY, - DPS310_POLL_SLEEP_US(timeout), timeout); + rc = dps310_ready(data, DPS310_PRS_RDY, timeout); if (rc) goto done; @@ -448,7 +505,6 @@ static int dps310_read_temp_raw(struct d { int rc; int rate; - int ready; int timeout; if (mutex_lock_interruptible(&data->lock)) @@ -458,10 +514,8 @@ static int dps310_read_temp_raw(struct d timeout = DPS310_POLL_TIMEOUT_US(rate); /* Poll for sensor readiness; base the timeout upon the sample rate. */ - rc = regmap_read_poll_timeout(data->regmap, DPS310_MEAS_CFG, ready, - ready & DPS310_TMP_RDY, - DPS310_POLL_SLEEP_US(timeout), timeout); - if (rc < 0) + rc = dps310_ready(data, DPS310_TMP_RDY, timeout); + if (rc) goto done; rc = dps310_read_temp_ready(data); @@ -756,7 +810,7 @@ static void dps310_reset(void *action_da { struct dps310_data *data = action_data; - regmap_write(data->regmap, DPS310_RESET, DPS310_RESET_MAGIC); + dps310_reset_wait(data); } static const struct regmap_config dps310_regmap_config = { From patchwork Sat Oct 22 07:18: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: 7144 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1087608wrr; Sat, 22 Oct 2022 00:37:06 -0700 (PDT) X-Google-Smtp-Source: AMsMyM704eimPcHe+Ml5ypQxtY78HqM+IRMpG77UnH/6WdweSGOiAFDE20dKGrwsq2s6WK33pQHN X-Received: by 2002:a17:907:6d27:b0:78d:46f6:c59e with SMTP id sa39-20020a1709076d2700b0078d46f6c59emr18918618ejc.30.1666424226204; Sat, 22 Oct 2022 00:37:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666424226; cv=none; d=google.com; s=arc-20160816; b=kkOuuOMHVE2KL41IhAf6I++dU/8nWS4X3OlL2n8WsqU3FhAnBmNYZfbR02yLKNJ6na kvtGiJQO7pWB9H38SSC9Rg0iZy6MvZ5nXb+XTRe22Hz3BQXgg98+E1MuYHDTaT1S6jpB tF7WohAwT/nDf/QtyrFPbv7SdeAc8i3TrOnjVYYw9h1o3t34hKo0MjOzD1ikN8o/AOiM zVMQhTCg95Y3vL1uS6CR35dVH0A7ETFhUGhB30Osgy39sx0ii3wUyELtowqN7gNq3W0A abyZY8qr+gsu+apGl998WfnO5/NDkbdAmobyMKbx2VQJRns+FVAGt5d6TT1XdsB/R6zZ Czqw== 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=+CvRpaSl0iUjdb4ggzzMlvLFPMYMUJaHhIUNJI4GGsk=; b=iMFp9QSyX6s33q3+zaZ7Z3ZxVOV8LBBO7sgKbKWrcGrf3pYBCA0G+Jgs0LXtR49Ouk Xm5UJAXrr0ZdW3QB5sfU3hZJ84RyoLZESVDxHYyaxEr/4BAJThjttbXoylfb06m94cs8 M8mLtyd077cIzBl4Gdm7fNcUk6nRRlw3kBu46LP1o2IxN9zZNhKmlXvkWnHnzf+90oeB zZBsx1El/iVcfIWGXIGfZfgk1dT/tR5SBiJUQ+BsjWeZrSm9KM57vFds5hna+liahR5d m6tsseHMKNJdZPT9Z7jKLN78dtdefK21/vlFY1o9lChC3GcF/wecxDZ2Oim5Uz8PGgK6 8C7Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=TMvJz0Mf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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-20020aa7c301000000b004612915d1a0si4493933edq.507.2022.10.22.00.36.42; Sat, 22 Oct 2022 00:37: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=TMvJz0Mf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S230220AbiJVHfw (ORCPT + 99 others); Sat, 22 Oct 2022 03:35:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48608 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230272AbiJVHfR (ORCPT ); Sat, 22 Oct 2022 03:35:17 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EAE4E4E60B; Sat, 22 Oct 2022 00:34:52 -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 8B0BE60ADA; Sat, 22 Oct 2022 07:34:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 787D5C433D6; Sat, 22 Oct 2022 07:34:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424090; bh=fgdXg1wobOdeihxoqquNWvbEhAq2SyCVppXeIRBGkRs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TMvJz0MfUM4sCCdr1HUwErv5EsYadjEQutN6wdEYF7nWE9aZNdgpMmxjAk0gfTQ6K jqnTIsLWE2gwG5i95kdlHWxHOGz0E5x7mToI3U4TUWga4Gm+bQReRveaqXI++4sHQI FJXoIjTLL+YCiA5HueRjdkOZOkNalU1ZSfxVZZZo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Rafael Mendonca , Mathias Nyman Subject: [PATCH 5.19 024/717] xhci: dbc: Fix memory leak in xhci_alloc_dbc() Date: Sat, 22 Oct 2022 09:18:23 +0200 Message-Id: <20221022072419.380936693@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747372449027483231?= X-GMAIL-MSGID: =?utf-8?q?1747372449027483231?= From: Rafael Mendonca commit d591b32e519603524a35b172156db71df9116902 upstream. If DbC is already in use, then the allocated memory for the xhci_dbc struct doesn't get freed before returning NULL, which leads to a memleak. Fixes: 534675942e90 ("xhci: dbc: refactor xhci_dbc_init()") Cc: stable@vger.kernel.org Signed-off-by: Rafael Mendonca Signed-off-by: Mathias Nyman Link: https://lore.kernel.org/r/20220921123450.671459-3-mathias.nyman@linux.intel.com Signed-off-by: Greg Kroah-Hartman --- drivers/usb/host/xhci-dbgcap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/usb/host/xhci-dbgcap.c +++ b/drivers/usb/host/xhci-dbgcap.c @@ -988,7 +988,7 @@ xhci_alloc_dbc(struct device *dev, void dbc->driver = driver; if (readl(&dbc->regs->control) & DBC_CTRL_DBC_ENABLE) - return NULL; + goto err; INIT_DELAYED_WORK(&dbc->event_work, xhci_dbc_handle_events); spin_lock_init(&dbc->lock); From patchwork Sat Oct 22 07:18: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: 7147 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1087710wrr; Sat, 22 Oct 2022 00:37:26 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7lJjNeNOpeslY4q8bInO2MIflNvJcdQLpFRziaKwdAXjLrmu03zzAyB1HTgTn+Wb3xrUzf X-Received: by 2002:a17:907:75d2:b0:7a0:72b8:236a with SMTP id jl18-20020a17090775d200b007a072b8236amr2132267ejc.47.1666424245870; Sat, 22 Oct 2022 00:37:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666424245; cv=none; d=google.com; s=arc-20160816; b=ZU0HnFdXAQPxGpnn12jJo3V91o+6nWO7uQOo9exBf/UccXWkNSqaFmIh5Fb/94IQa/ /KaeMz9730JWOeqMfioUK37MVsPro2o46mHxeVP0kzqdjDuoHcE41i5bwumryDV3tkGL 4EN8g8RZB1wqQhzL68/XuNmLYPg9uYwt2CxDlLNtlBwIXvfOdCeDX1D+/kDj3rQT0vbn ZZ+aEZolzhflsmUs+qSUsBtdDV5oPn4rhkUw+3a5UYah9KL73HcOxemKw0q+yiHoOKri fWnlyK21Aw+VtrGHwbrsfEm/VomItm0VlclVbWd6QR4+n757U4vFlp3HKvIUXoCOxlf0 IX6A== 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=0ey07O3mw8bK6McbG2I2Q+4vEP2gq6ox0PK/zyk3hys=; b=gXwqXfGuMovOFfsSMzssZeH7JFrhpGwC5uoECh/WMoWXUWGdRVzfYxSZGdI97JV2EI h6Jt0G9r5LzNL1YB59Gfv1v51BOVEqO0c/VuKzHtwzNsEDMPoNQJ8epU5Okb81o3xGrN +7tT/sGr26luRWyfW3mIM3t7KWM5OZj0W36eRbQShqYIUtpKMA7CF56+lrfpNfUC5cUR pJTkiR6BWvO3VLjgTSAG6TLBE4cYqErsC0ndKy10Fv0TSAMRXN1xWbzM4Muerki3c+gH 3qB8zeIMh1zABTMwaWt6ccOEwOSI7/6XDnkUWJAzm+cfqghbbK0zoH7C74E9q0sxWinn vOvQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="KRRQLXm/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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-20020a056402348a00b0045901aa2468si26308857edc.333.2022.10.22.00.37.01; Sat, 22 Oct 2022 00:37: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="KRRQLXm/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S230335AbiJVHgK (ORCPT + 99 others); Sat, 22 Oct 2022 03:36:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47810 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230149AbiJVHfc (ORCPT ); Sat, 22 Oct 2022 03:35:32 -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 E81BCDFF5; Sat, 22 Oct 2022 00:34: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 AC43160AED; Sat, 22 Oct 2022 07:34:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 97B5FC43149; Sat, 22 Oct 2022 07:34:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424093; bh=r6sndrCPLnTm7kILdqqn2LD7psgBrGdbjQMZY6nBT90=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KRRQLXm/BWdudsjdLwshK5efecblsa6et4n+/1lmLIBV+E8i1egpUyDvIvahAPb0m xaOLljlEFURSILb9M1QmU47IT6s5MU4KFQmVfgz/vl5mEsnWYNQF3xV7341JbSV0tu U63hlSpfAjwaKzk2aTj9lnksc63LL/77RI5mEAlw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Nathan Chancellor , Laurent Pinchart , Kees Cook Subject: [PATCH 5.19 025/717] usb: gadget: uvc: Fix argument to sizeof() in uvc_register_video() Date: Sat, 22 Oct 2022 09:18:24 +0200 Message-Id: <20221022072419.538904799@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747372470008063923?= X-GMAIL-MSGID: =?utf-8?q?1747372470008063923?= From: Nathan Chancellor commit a15e17acce5aaae54243f55a7349c2225450b9bc upstream. When building s390 allmodconfig after commit 9b91a6523078 ("usb: gadget: uvc: increase worker prio to WQ_HIGHPRI"), the following error occurs: In file included from ../include/linux/string.h:253, from ../include/linux/bitmap.h:11, from ../include/linux/cpumask.h:12, from ../include/linux/smp.h:13, from ../include/linux/lockdep.h:14, from ../include/linux/rcupdate.h:29, from ../include/linux/rculist.h:11, from ../include/linux/pid.h:5, from ../include/linux/sched.h:14, from ../include/linux/ratelimit.h:6, from ../include/linux/dev_printk.h:16, from ../include/linux/device.h:15, from ../drivers/usb/gadget/function/f_uvc.c:9: In function ‘fortify_memset_chk’, inlined from ‘uvc_register_video’ at ../drivers/usb/gadget/function/f_uvc.c:424:2: ../include/linux/fortify-string.h:301:25: error: call to ‘__write_overflow_field’ declared with attribute warning: detected write beyond size of field (1st parameter); maybe use struct_group()? [-Werror=attribute-warning] 301 | __write_overflow_field(p_size_field, size); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ This points to the memset() in uvc_register_video(). It is clear that the argument to sizeof() is incorrect, as uvc->vdev (a 'struct video_device') is being zeroed out but the size of uvc->video (a 'struct uvc_video') is being used as the third arugment to memset(). pahole shows that prior to commit 9b91a6523078 ("usb: gadget: uvc: increase worker prio to WQ_HIGHPRI"), 'struct video_device' and 'struct ucv_video' had the same size, meaning that the argument to sizeof() is incorrect semantically but there is no visible issue: $ pahole -s build/drivers/usb/gadget/function/f_uvc.o | grep -E "(uvc_video|video_device)\s+" video_device 1400 4 uvc_video 1400 3 After that change, uvc_video becomes slightly larger, meaning that the memset() will overwrite by 8 bytes: $ pahole -s build/drivers/usb/gadget/function/f_uvc.o | grep -E "(uvc_video|video_device)\s+" video_device 1400 4 uvc_video 1408 3 Fix the arugment to sizeof() so that there is no overwrite. Cc: stable@vger.kernel.org Fixes: e4ce9ed835bc ("usb: gadget: uvc: ensure the vdev is unset") Signed-off-by: Nathan Chancellor Reviewed-by: Laurent Pinchart Reviewed-by: Kees Cook Link: https://lore.kernel.org/r/20220928201921.3152163-1-nathan@kernel.org Signed-off-by: Greg Kroah-Hartman --- drivers/usb/gadget/function/f_uvc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/usb/gadget/function/f_uvc.c +++ b/drivers/usb/gadget/function/f_uvc.c @@ -421,7 +421,7 @@ uvc_register_video(struct uvc_device *uv int ret; /* TODO reference counting. */ - memset(&uvc->vdev, 0, sizeof(uvc->video)); + memset(&uvc->vdev, 0, sizeof(uvc->vdev)); uvc->vdev.v4l2_dev = &uvc->v4l2_dev; uvc->vdev.v4l2_dev->dev = &cdev->gadget->dev; uvc->vdev.fops = &uvc_v4l2_fops; From patchwork Sat Oct 22 07:18: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: 7157 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1088179wrr; Sat, 22 Oct 2022 00:39:05 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4nCicCTXzEmOAtOpG2ZroFQwMhL5+5MPm427O+AmIJcHz93cCK5BWOCcgTW+kFh4T+GOjN X-Received: by 2002:a05:6402:448c:b0:457:52eb:b57e with SMTP id er12-20020a056402448c00b0045752ebb57emr21477222edb.178.1666424345428; Sat, 22 Oct 2022 00:39:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666424345; cv=none; d=google.com; s=arc-20160816; b=lxXxUJVD1PD5l0L2MYhIiACr158rKht4eAXvd1yWP7jyYNoq/txQOzzthMFUi5zFHg 55ObaTh+qKSohAB24Hz2QtDxtlllt6sDCuUPTGvZyhzZ8T7FUvQbM54g9hoIzxrYstig Wg/ic+xjNuhLb/+jLFiB813HlxeJdruV1Kj9MYHNFLJTSbDciGyAsX8hj6zb0rxp5nDp RL/yiqnlL2IR/gavlhCcUlyTL35md0kqvwert5ofH+nZGdtMjmM2KWiOpnkcLO9cjnbx t1elyzpkpn/Ee/wmhOOFUumwOBmRzIpqibn0hqJTQaEGEoBHP2aETQpKZmfNzqF+55gD TQng== 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=KuUp48M7v+OFGwnF4eGOvZlZMiZTxzsftYW+e6GOZfM=; b=GlZ/moUTWwt7dKXu9uqGFLKrU0Ep7VUaDEh3JuSP8kRjbOBSo2Pz1lUaP+Lb4GH3pR mRjScwZDtPfTWJUd4dY7XhArFT1VtI+IgAxiPBp0/3919uoxLIA4FGadxlvKVSjLIyaI i4MT+nxAukVP/EKJSiRVxQxiZcN+ndX5yAm7aNTS5I7mtl6UI69TE+BoGAhxOLeNt54V rTqUP0im2hzOpZM++J83l93THXOSbsP48g/2bLxFtzHQAuL6iY5DvN7v1278FEyOuSpx drRh/OAcPUbtby8ZrWdUP3yVCE4AVtvVnY3/O8z1DDvv9SdLkH25jiBGzra4MJUBXwN1 sKlA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=BzNGW5kL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 k20-20020a170906159400b0077bab1f707esi18448933ejd.159.2022.10.22.00.38.41; Sat, 22 Oct 2022 00:39: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=BzNGW5kL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S230347AbiJVHgc (ORCPT + 99 others); Sat, 22 Oct 2022 03:36:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51668 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229819AbiJVHfi (ORCPT ); Sat, 22 Oct 2022 03:35:38 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0C5E459EA8; Sat, 22 Oct 2022 00: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 dfw.source.kernel.org (Postfix) with ESMTPS id 8B72960AD7; Sat, 22 Oct 2022 07:34:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8681FC433C1; Sat, 22 Oct 2022 07:34:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424096; bh=XjTpf1SwUn1ueTangGWnryxHJFIZLLzPWdM8TV5F8/A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BzNGW5kLMLhXVQ40nrmaJ1CDXwyCdSn+QG3yGbbBsAvlJS/U1XKt/gHwZOuqFeujb yOpy5VnkN5YpLqol9ligferqfFmexE/UjxEij2jt+CqSIFn9MwFt2GjsfjzAEqku7L jOGQqrzfxmP0r4LRRX2Hr0YHFl4m3/icJvOeFlk0= 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 5.19 026/717] usb: add quirks for Lenovo OneLink+ Dock Date: Sat, 22 Oct 2022 09:18:25 +0200 Message-Id: <20221022072419.717816748@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747372574542423537?= X-GMAIL-MSGID: =?utf-8?q?1747372574542423537?= 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 @@ -437,6 +437,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 Sat Oct 22 07:18: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: 7148 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1087728wrr; Sat, 22 Oct 2022 00:37:29 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6WXk0KMBw5/5huF0+7qcpo1bZr5LcWKW7QReOA5KQCszcj3d8pr4clFgzg5a70oafMKFgm X-Received: by 2002:a63:fa4d:0:b0:43c:7fa:95f7 with SMTP id g13-20020a63fa4d000000b0043c07fa95f7mr19186001pgk.48.1666424249385; Sat, 22 Oct 2022 00:37:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666424249; cv=none; d=google.com; s=arc-20160816; b=FqEQsSR4h8t6w1osiF6KdTvHBhdMEM9KVLOART/qPH+C9crVzQRPbEsZlikBgZS9RY ycFmxGTRnWjq9ooUNBuGFWIrC2QAa9vC78RupXtV8dU8nkDhT0Mxtq2KM95AhcrcLCj0 bBeq1rXd7XhXhY2+wCZifNF4CRkiHnp/EUHVlNSusltpz8OVFGjQ+0tTEI1MQf7VsBJU 3No1hkjxsL+RcIALIrGJdvyHWwx1hZh2CI2oupWFHev9SocrGbvfJ64R7OYEfj7OkKN4 9KRuCJrgZiGbCcEo2gbnuYrVrvZgevec0fOzJMdcL9/RNY2liuapWW3WbOpNwLrueqG2 1Wsg== 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=3Ria8PZQ6eYLTv5p9jKfpoIDY4A4qRlSn88ua++31EY=; b=n5R/wD0AQGrsCU5vU5i0KDc5sc916+8HEukFGJE7/YcmOaI8G8kHVXa9jlr1TFi/YG 0p3htPqR0gjpfdZElYkX62t+TR+DXYh/SiygABQjS9ewFtY63qZJX8q51Qp/l1yLLacG KsT5cEkbOEHu9vJSp08DvmPpLe96ROb+FxYhJoF9axokQDU5pa7i7i4IPxUFoTg774dD fPlOmRYmJ4DE1ayDIwOv6kRq+nieOVJ6uAAqJgNx75iv+iYlgYwHi9jm+CNgyAZ0cyO+ 2UPBnjpd8FGH7SS6zzQmFJeUFOe2Yrj14VM67QMBYf2nV+GxVMqgo9JFsPm4kODHYyYf y7yQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=aS5hFWag; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 n9-20020a170902f60900b0017f73e4af01si11598970plg.298.2022.10.22.00.37.16; Sat, 22 Oct 2022 00:37: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=aS5hFWag; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S230218AbiJVHgg (ORCPT + 99 others); Sat, 22 Oct 2022 03:36:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48264 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230146AbiJVHfk (ORCPT ); Sat, 22 Oct 2022 03:35:40 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DB60863F24; Sat, 22 Oct 2022 00:34: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 8741260ADB; Sat, 22 Oct 2022 07:34:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8B7E9C433D6; Sat, 22 Oct 2022 07:34:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424099; bh=RfWcLuhdM/efK7GPaA8Whk+57q1ge3rUrqp2Fx8g4os=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=aS5hFWagyT8on5QN0N/lmc1vtAkPjc93kdPahL1JWrEy9r2rEZ2GMTI1g5U0yoV9P Mm/v3ylSySTPgReR4bhE1Zz7sYoiynLPRmBV3oDoEysSGaaNKPIhN+z0YZphP4qL62 rokg/hadZfzC1+u1VRQ1Xh+1Q+Y5GdgurqPUkDiM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Avri Altman , Ulf Hansson Subject: [PATCH 5.19 027/717] mmc: core: Add SD card quirk for broken discard Date: Sat, 22 Oct 2022 09:18:26 +0200 Message-Id: <20221022072419.914374623@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747372473789018712?= X-GMAIL-MSGID: =?utf-8?q?1747372473789018712?= From: Avri Altman commit 07d2872bf4c864eb83d034263c155746a2fb7a3b upstream. Some SD-cards from Sandisk that are SDA-6.0 compliant reports they supports discard, while they actually don't. This might cause mk2fs to fail while trying to format the card and revert it to a read-only mode. To fix this problem, let's add a card quirk (MMC_QUIRK_BROKEN_SD_DISCARD) to indicate that we shall fall-back to use the legacy erase command instead. Signed-off-by: Avri Altman Cc: stable@vger.kernel.org Link: https://lore.kernel.org/r/20220928095744.16455-1-avri.altman@wdc.com [Ulf: Updated the commit message] Signed-off-by: Ulf Hansson Signed-off-by: Greg Kroah-Hartman --- drivers/mmc/core/block.c | 6 +++++- drivers/mmc/core/card.h | 6 ++++++ drivers/mmc/core/quirks.h | 6 ++++++ include/linux/mmc/card.h | 1 + 4 files changed, 18 insertions(+), 1 deletion(-) --- a/drivers/mmc/core/block.c +++ b/drivers/mmc/core/block.c @@ -1140,8 +1140,12 @@ static void mmc_blk_issue_discard_rq(str { struct mmc_blk_data *md = mq->blkdata; struct mmc_card *card = md->queue.card; + unsigned int arg = card->erase_arg; - mmc_blk_issue_erase_rq(mq, req, MMC_BLK_DISCARD, card->erase_arg); + if (mmc_card_broken_sd_discard(card)) + arg = SD_ERASE_ARG; + + mmc_blk_issue_erase_rq(mq, req, MMC_BLK_DISCARD, arg); } static void mmc_blk_issue_secdiscard_rq(struct mmc_queue *mq, --- a/drivers/mmc/core/card.h +++ b/drivers/mmc/core/card.h @@ -73,6 +73,7 @@ struct mmc_fixup { #define EXT_CSD_REV_ANY (-1u) #define CID_MANFID_SANDISK 0x2 +#define CID_MANFID_SANDISK_SD 0x3 #define CID_MANFID_ATP 0x9 #define CID_MANFID_TOSHIBA 0x11 #define CID_MANFID_MICRON 0x13 @@ -258,4 +259,9 @@ static inline int mmc_card_broken_hpi(co return c->quirks & MMC_QUIRK_BROKEN_HPI; } +static inline int mmc_card_broken_sd_discard(const struct mmc_card *c) +{ + return c->quirks & MMC_QUIRK_BROKEN_SD_DISCARD; +} + #endif --- a/drivers/mmc/core/quirks.h +++ b/drivers/mmc/core/quirks.h @@ -100,6 +100,12 @@ static const struct mmc_fixup __maybe_un MMC_FIXUP("V10016", CID_MANFID_KINGSTON, CID_OEMID_ANY, add_quirk_mmc, MMC_QUIRK_TRIM_BROKEN), + /* + * Some SD cards reports discard support while they don't + */ + MMC_FIXUP(CID_NAME_ANY, CID_MANFID_SANDISK_SD, 0x5344, add_quirk_sd, + MMC_QUIRK_BROKEN_SD_DISCARD), + END_FIXUP }; --- a/include/linux/mmc/card.h +++ b/include/linux/mmc/card.h @@ -292,6 +292,7 @@ struct mmc_card { #define MMC_QUIRK_BROKEN_IRQ_POLLING (1<<11) /* Polling SDIO_CCCR_INTx could create a fake interrupt */ #define MMC_QUIRK_TRIM_BROKEN (1<<12) /* Skip trim */ #define MMC_QUIRK_BROKEN_HPI (1<<13) /* Disable broken HPI support */ +#define MMC_QUIRK_BROKEN_SD_DISCARD (1<<14) /* Disable broken SD discard support */ bool reenable_cmdq; /* Re-enable Command Queue */ From patchwork Sat Oct 22 07:18: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: 7154 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1087955wrr; Sat, 22 Oct 2022 00:38:18 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4N7OYrU7RwwTigF+VmVtb+P3aRPDG9ZIsZ7ot7JqC8J+wA5knAg0yHoB9hqrS08Jr98d5F X-Received: by 2002:aa7:d4d9:0:b0:45c:7eae:d8d8 with SMTP id t25-20020aa7d4d9000000b0045c7eaed8d8mr21260074edr.254.1666424298653; Sat, 22 Oct 2022 00:38:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666424298; cv=none; d=google.com; s=arc-20160816; b=WwrJoj3T/Gw7kHSqZ0TNQOb1XsZocpVSICNXeMITLAEr8uqHBSlmsLlIWofWzy2N6m TP5CvMFVgUVaVhxyDyO1XfayvbGsqOCmJvGKDOHjdfKSpRwBI5wmvu4dkdKnA+e+n+m2 sPkYYnzFc8A4SxjqVasHjVAV5WMPO/AjcaUi9995DfQeODa99HhjRcOe+p3Y7peud6I+ Lgdwb4xU3Mu1HkqdxeKNBRLhPFAZXM11cxk/vRCIIxTAKWlxO9WPMHrViSMc88QnAWdd /TXeOee6fI6iNL5y/hu8AMyqsaaCHmVv/Hy0B7bV4T6UhF76g9UFV6gknaAlvI3z4mou oUZw== 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=x7m1HZNmkdebieyzcDaH9/r7YeOcC8p7Wq5oIqcb25M=; b=uvXPh/8Vd0PCvrjnZo1ATJB1dtyFDdOD1k8pOvuqP9/eAOwAjpv4NjuWH+lhTlxGYh SjTtqITwXb5YBSefqrr5C6DU2VMCm0I4MXovj+xlIqHBfzBz4Jifkzs/sn3hR3tBywFo /jJsCHoIWAC9KH4lx0W4gTLkZGNfg4q1/2MNP1mOVKeuoVZkQ4guBMcugikQ9q6mHFvQ WD4CsLqwMneTSNmv+lWqz0efbHKDFSzMTOaGfuGrKUFT5dBYzZVAWQ8R/rJqyENQbE2p qP4+GH/oDguJ2qU1QzsN1wVK2lbq+A62JOZsDVvKqHuMI9O7TSG6hfhwZlrPu9HUK7Sb 4PZg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Hll0OjoL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 dp20-20020a170906c15400b0073da0ce043csi24235495ejc.619.2022.10.22.00.37.55; Sat, 22 Oct 2022 00:38: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=Hll0OjoL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S230248AbiJVHgy (ORCPT + 99 others); Sat, 22 Oct 2022 03:36:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50864 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230164AbiJVHgO (ORCPT ); Sat, 22 Oct 2022 03:36: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 80B256F24E; Sat, 22 Oct 2022 00:35: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 99A7E60A5C; Sat, 22 Oct 2022 07:35:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A058DC433C1; Sat, 22 Oct 2022 07:35:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424102; bh=kPlLgIU4K3Nj0h9buGsIm0radl9uI7/hOyIa4w0HL+s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Hll0OjoL4Ehtjj7W01ETAPYFpF33Ij4u4XIG2Yc8N4az7UEyt5+goz65aHwx93rsC 63XnUCbVqwf6B6TGlmUEsYd3UhH2qG56C1Nh8pQQLTHDDiArxasAAcWL2p8c5G+DAr F5W+dHFhlvEcvysGDOlWenqNDYLiRsvfrXtTWdFs= 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 5.19 028/717] can: kvaser_usb: Fix use of uninitialized completion Date: Sat, 22 Oct 2022 09:18:27 +0200 Message-Id: <20221022072420.061082568@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747372525496511858?= X-GMAIL-MSGID: =?utf-8?q?1747372525496511858?= 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 @@ -712,6 +712,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 @@ -1914,7 +1914,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 Sat Oct 22 07:18: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: 7151 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1087906wrr; Sat, 22 Oct 2022 00:38:04 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7KAC/YKX3EHUryJz3UscMbQztU1GRrY2Z6NljwhyZEvbSt44sUzHyxwBN22pIEZHKtq6DI X-Received: by 2002:a17:907:160e:b0:791:8ae7:4fb8 with SMTP id hb14-20020a170907160e00b007918ae74fb8mr19821037ejc.271.1666424284777; Sat, 22 Oct 2022 00:38:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666424284; cv=none; d=google.com; s=arc-20160816; b=vxO7Mg7lv/xnHRRlXpPC645hRMKbJzMMx25phkD3ZatgDbJ6tAZl4b2t/oyonMNps5 CMOdyso0g5WE7R7Z2XvVIgiMDiZRoNCAe+FnuwXRUL0VyzqWMjLysQH6id5RvHGcjynj EbWCnaNXRuXfxp/4v+8/Otr1UeJobFLCp6L9LQ53hejPGyLFAVDIqYrEvlevXoEwY12u P5MQx4svM5qt6y3HHyciisEbd0wLTlx9XjnhNGC1UfqsREX5zKYMOfA/mshy7e/QlEut YdbARmpRKqoRNAjkLhPm8WF58UefqlxsXZcH6caIPjHI1l1YTl6wBHoZkEv+/FJwbLBg It4A== 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=oEdeSkKwMYRGRbeNz760vSTv5k4nEfvkfmkF6/BYVpU=; b=CYjYcdC4kbin5+I0yiqXK1AhgDvPGVLaaaGbSYebcjckGNk/G5UFCMFVSwgFWCexsh CI84YnbUelIEDUC2I5p4/UAdsC/1i3OnDU2owC4N+ii0THr/SLNncZ2QlkKKVGFrPLKd gNdeob6PtqU5ieTXzxtZoHvm9sKuGSAT+fvrRV+jMZGnfQpVlcGLFzMuu0tsrMLRLqhv i7nIGlAc82cIk4g5GE0TYkIOZg6jsFu33aqcaxW67Fa0bhbE7eJbsqYyMdC3VhWv3+K/ zkHWmWnh+WVrsUFoiangKK/P2Cu5Vlem5FVfx41cg4QosCwxSUiOAsxRTd6EhYoOAwRj RInA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Ut1Ga3wG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 i37-20020a0564020f2500b0045fc914660csi7144744eda.200.2022.10.22.00.37.40; Sat, 22 Oct 2022 00:38: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=Ut1Ga3wG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S230187AbiJVHhB (ORCPT + 99 others); Sat, 22 Oct 2022 03:37:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48180 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230254AbiJVHg3 (ORCPT ); Sat, 22 Oct 2022 03:36: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 BFF7659270; Sat, 22 Oct 2022 00:35: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 55743B82DB2; Sat, 22 Oct 2022 07:35:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 85724C433C1; Sat, 22 Oct 2022 07:35:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424105; bh=3petXBYhOdMTs9G9cpU2Em1vojDjevNC7lZTSJlmbEM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ut1Ga3wGeJpmVQTygDrRXnmkavFm3OtuDJbvRUHOcb/nIZTraFFsOrqt+Vrs/Px5y Z9FpUEazOiTh4WzwCtuHYOtjFkyYSt4NgEsr3iQUUj5Xthp7nme2kEOmzWrCrmm0q2 6Qt+2e1bf+DwNT3uXjnmJ0C7BJxGvI9L5au4fLcU= 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 5.19 029/717] can: kvaser_usb_leaf: Fix overread with an invalid command Date: Sat, 22 Oct 2022 09:18:28 +0200 Message-Id: <20221022072420.237738487@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747372511046842946?= X-GMAIL-MSGID: =?utf-8?q?1747372511046842946?= 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 @@ -310,6 +310,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: * @@ -397,6 +429,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 *cmd_len, @@ -502,6 +571,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; } @@ -1132,6 +1204,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 Sat Oct 22 07:18: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: 7334 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1094745wrr; Sat, 22 Oct 2022 01:00:55 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5iMSi6WGOveS9CapQv8MLwWyCCGcXAB7QKLW24R4hkk02HaC2mTlCMDuE1c3RPEuWAVDYc X-Received: by 2002:a65:6bd3:0:b0:42b:9117:b9d1 with SMTP id e19-20020a656bd3000000b0042b9117b9d1mr19412493pgw.238.1666425655280; Sat, 22 Oct 2022 01:00:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666425655; cv=none; d=google.com; s=arc-20160816; b=N1PmXKrimfLdnt8LACN/u1yc1ceYWbCIDRzGxgeMwJQw1W+CI5XsvM75ME5BFPpfty 9Sfyo0xuqWsgxRcyCvS60yJOVeyuMZDj1dZDevVr9sE2Ka65s0TaBSN16fR9TEem+srV P0njzNW0RlH145Y+equu3Ps/TqzK5wgG1C73QobE+nOTHEVAOtWu+N1aszAEgEe52exG OQakGMwr+iuizMG8mbZ4IywFDZiJZ1LA1VlpU07I9zwC++AjcZOqwhyJZr1w8K0Umgbo AF46pxSFBIWSyr04WzyYgwnTHrlnobhj2g6vA7ghpBI8+Cwb7fywV6yrql+TB7N2AYEE lAuw== 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=ICOHt6j6YbzkVBn2kxni7Ikzi3RJzqPvyzW1AkzdPgM=; b=QvpgdkdoC6CV7sEisJeuhqBKEh0gYp+beLCJ+NPpwVYrAqUmACUaKADp4dOB+qrTRf 0srOBxXaSfGSC0hkO5LizyjGrD1RyIOnBu0BazPYrZkP5kjAurzDk4BDe8+thJTWGzfB i53hhhWzw2Oj7ZcTYWkjDZeC/UQmQWvFVRHP0L1/okYKodbGZ7Yph/ebXsVWvrV3sGGd cOc2Q53uf7NeEozOpKcyV6UoH/RqRzzZ1jxOMo6UxCgnGsQJI0vHWyI0rJHLn5JoBR3g fGOPzhgETRvFUj/LvM21tjXPBlX1/jtG/NVs1IKMGh9yRRCLtWEbhYKudDwkBmD5R67U PLZA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=HBuJTBqv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 q17-20020a656251000000b0044c3ec9ea71si25970825pgv.630.2022.10.22.01.00.38; Sat, 22 Oct 2022 01:00: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=HBuJTBqv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S232404AbiJVH6x (ORCPT + 99 others); Sat, 22 Oct 2022 03:58:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42802 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232108AbiJVHyE (ORCPT ); Sat, 22 Oct 2022 03:54: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 9E4B066F29; Sat, 22 Oct 2022 00:47: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 0412AB82DEF; Sat, 22 Oct 2022 07:37:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 66246C433C1; Sat, 22 Oct 2022 07:37:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424231; bh=u9d3oKohvpH9ZPwexg1uXySnrW6COWM2acNwiTVHdCE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HBuJTBqvQzqebnEZ5wPZ3wVawQRmKHuXfCae8akOWDwfRTdBgBliTm2LpVrG7YVr3 /JWenuZurHOBca+3Insxt323i5QyyR0gtQJOlCFhabXQtRRc7XwQxCrkiFccFZCjby stW/Nw9pfLzPVYNEiveA/ZIZpMVO8hUAL0I+1EJk= 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 5.19 030/717] can: kvaser_usb_leaf: Fix TX queue out of sync after restart Date: Sat, 22 Oct 2022 09:18:29 +0200 Message-Id: <20221022072420.440551038@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747373947746550282?= X-GMAIL-MSGID: =?utf-8?q?1747373947746550282?= 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 @@ -177,6 +177,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 @@ -476,7 +476,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 @@ -1425,6 +1425,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 Sat Oct 22 07:18: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: 7156 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1088061wrr; Sat, 22 Oct 2022 00:38:35 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5DUA1sMKQ7s49nTgOzXJxTmGN/TkWjoCvmwpPtqYQFXoVsPUZ/4AKGZqD+MArRNazrJ4Lw X-Received: by 2002:a17:907:1b1e:b0:783:8e33:2d1c with SMTP id mp30-20020a1709071b1e00b007838e332d1cmr18800967ejc.304.1666424315417; Sat, 22 Oct 2022 00:38:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666424315; cv=none; d=google.com; s=arc-20160816; b=EaCGSRnlhRrOFcBHHMnT3ZpSYBTpITj+tICpKfrCOzW0GGHbDLUHT4EgrLCkhUCWDQ KEMFHp7DD2XM+HbsVW+lJk0F72SxBavd8fQ4x7jr7P8q2xYtd54djeKeR161wMmFNQ73 vzR2fI/FBPvQNmGlHMJdhG73bZlZe9kmBVDjCc6jGroxgxurXHaGPlUFMBg07x+KnTSW p7jT/AsXhDgkb9silhvwROJOUTdNWH/Y68BA2ajnGxn+NY3AWpmbBPCby0mna4bPsMuP kBPFIu+sVfuOhhvWHFNjw2FSGnzEAReUjJQyV0euCzKdrm6DduZGLR8N1adAgB1hG8IS 2Dew== 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=jLRnZqzM9F9BlYAleRvJUpTMU7vlux8xW73Go4JxDAY=; b=UYfvpawmR7ryC2UTbnX8fyqcQOSlzHWTALzlJR44inqFbsIIkL1+MEvM7kAlftfz0x mhchM6xv58+4S1lyFJrLhd7yGjDuEVt5Q5lNnOLD1D50oFGtYbgjQt2CngD3brpcfgVB 5WH1foxZET61Z5535p3a0GrePNuMQc/fDu7Z5VPmTRzEQz0bjZNgDM4QtkUl4GpS6msM peerl2/Y+9YCA9oP5J0hP8WFA1gmoU4q+T3/7Q3M7s42/ps5HjfBd6K298lbnZOHLrzb PRotDgWVQwpcSMSYo6fxsn0J0k1JKw501tyEUUCgLO1YRxckda58j3zd2c++ufI9HqT0 NN0A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=laRFcud6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 e17-20020a056402191100b0045cfb63a018si24850772edz.31.2022.10.22.00.38.11; Sat, 22 Oct 2022 00:38: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=laRFcud6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S230372AbiJVHhj (ORCPT + 99 others); Sat, 22 Oct 2022 03:37:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33004 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230342AbiJVHgx (ORCPT ); Sat, 22 Oct 2022 03:36: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 D070A2527CD; Sat, 22 Oct 2022 00:35: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 dfw.source.kernel.org (Postfix) with ESMTPS id ABDBD60AD7; Sat, 22 Oct 2022 07:35:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B7782C433C1; Sat, 22 Oct 2022 07:35:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424135; bh=AaxTY1K/uBZpdEq0piQ+Qb9lab+8zrIvUtBFpyqkGPU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=laRFcud6hpjyhNzmMyTK5abp9m1VEYO4UsaruDGTugUOd+tFikxjwc92OxubaPx0B UJv0m5AcNvij7hCeaTO1KbYRl2VTMUdgSFhuNRbRvOIHHvukvXs3LVs7w9Wv7pN4da da8wzqwv5f1LAnmd0z3ZMfbdjE8Yllyg/biCsKzI= 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 5.19 031/717] can: kvaser_usb_leaf: Fix CAN state after restart Date: Sat, 22 Oct 2022 09:18:30 +0200 Message-Id: <20221022072420.628135573@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747372543398142534?= X-GMAIL-MSGID: =?utf-8?q?1747372543398142534?= 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 @@ -1430,6 +1430,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 Sat Oct 22 07:18: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: 7170 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1088481wrr; Sat, 22 Oct 2022 00:40:10 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4db1zsfCOH1mhIbxkT2cSPgGv2Cb4U6pc8HJAFsrZRyfeWiUSmQozZQUkaNYacJuHK5L1s X-Received: by 2002:a17:90b:2741:b0:20a:ebc3:6513 with SMTP id qi1-20020a17090b274100b0020aebc36513mr27350665pjb.29.1666424410637; Sat, 22 Oct 2022 00:40:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666424410; cv=none; d=google.com; s=arc-20160816; b=Q43aKhlczNjklFtdkw9XDnMYS9BiPBzLWqsL01Qer+To9/6L/j/lzuQf1hw6luh18x 1IzhDraPgEbO77LWqAtTng7jMOG7X2nVa3Ir8Dd8VkK+zzhluP4OA1uMzxn/uZgXR5L1 kGTCQcg68vMfX/bWbFdQ9TqcTlwwqIU5qo9KSwlBBFvmjxRWuC+i/BGsuA89Z5MMVpU2 hmpPPaR4PgozNzVNWrcJBb2auWQaoOeYgVMHtcs/GhiFSjMl6h86/3kAZ8brncu57K3K nrHdkP2xQ6iBubhpI2ykUA24ObcJk/x+aY5NX6VFkYmTYVa2qiVznJJ53Jt50UlbsfQB 2I1A== 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=rQcYVprb7lq0eUVaMLISSGXF3Wck4rzGh+PlwoQIhYY=; b=g0H2GzQRY7+D7IhGd7oXK7gKDLH/dqTlHcmLFzpgmlUM+yeaSYFkVyWdt62HE/jJm/ g26gv30FGR4pA4G7tx8uWfAcN6ONbXUiqEQINVJEubytIRyeQ2SKLjDqYIfugS+m2DC0 BSp/oNYMerBByEmbCXPmya+eHPRfwieF2i8hravVoy4NHgvl/ofPiskewLEjrfyLfhOQ iH0HY+r4jjFQJLnuVN5bNLOTEileqQBuKcGI++g3E9n03B5Q88syNP9T8Td/zE6wRyU6 TrLiBsWoc/kXSLjxFcyLSvHgV9DKPba/bBLqKEg4RYZL3OGmNjDx9V+KEFYMcxnqamed STUQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Le+LrxNU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 d23-20020a634f17000000b0043a1129e476si27402865pgb.340.2022.10.22.00.39.56; Sat, 22 Oct 2022 00:40: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=Le+LrxNU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S230486AbiJVHjg (ORCPT + 99 others); Sat, 22 Oct 2022 03:39:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48608 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230467AbiJVHiw (ORCPT ); Sat, 22 Oct 2022 03:38:52 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7FB8229B898; Sat, 22 Oct 2022 00:36: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 563E7B82DEF; Sat, 22 Oct 2022 07:36:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C364CC433D6; Sat, 22 Oct 2022 07:36:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424171; bh=OQ5+raYgpwxt5gHw9gmhOZpaGz9bNoTbg+XUHADCeTM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Le+LrxNUJTuB7DYqHVoUBEvw8PvcRN+E5kOt/r+UHfi04MP6BeHeTWHpZBYHacL0x jO3TE/q39IekijDSPnvCn8tRk4ORICWusytVSAcNY+2iS2o+aTkedrmLOcN859BnFD WW3jbZHTQZUNIo3yrHTj+iaoo2Rv7TkPgNfQ955Q= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Biju Das , Geert Uytterhoeven , Wolfram Sang , Ulf Hansson Subject: [PATCH 5.19 032/717] mmc: renesas_sdhi: Fix rounding errors Date: Sat, 22 Oct 2022 09:18:31 +0200 Message-Id: <20221022072420.811562401@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747372643319867758?= X-GMAIL-MSGID: =?utf-8?q?1747372643319867758?= From: Biju Das commit f0c00454bf78975925eccc9737faaa4d4951edbf upstream. Due to clk rounding errors on RZ/G2L platforms, it selects a clock source with a lower clock rate compared to a higher one. For eg: The rounding error (533333333 Hz / 4 * 4 = 533333332 Hz < 5333333 33 Hz) selects a clk source of 400 MHz instead of 533.333333 MHz. This patch fixes this issue by adding a margin of (1/1024) higher to the clock rate. Signed-off-by: Biju Das Reviewed-by: Geert Uytterhoeven Tested-by: Geert Uytterhoeven Reviewed-by: Wolfram Sang Tested-by: Wolfram Sang Fixes: bb6d3fa98a41 ("clk: renesas: rcar-gen3: Switch to new SD clock handling") Cc: stable@vger.kernel.org Link: https://lore.kernel.org/r/20220928110755.849275-1-biju.das.jz@bp.renesas.com Signed-off-by: Ulf Hansson Signed-off-by: Greg Kroah-Hartman --- drivers/mmc/host/renesas_sdhi_core.c | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) --- a/drivers/mmc/host/renesas_sdhi_core.c +++ b/drivers/mmc/host/renesas_sdhi_core.c @@ -128,6 +128,7 @@ static unsigned int renesas_sdhi_clk_upd struct clk *ref_clk = priv->clk; unsigned int freq, diff, best_freq = 0, diff_min = ~0; unsigned int new_clock, clkh_shift = 0; + unsigned int new_upper_limit; int i; /* @@ -153,13 +154,20 @@ static unsigned int renesas_sdhi_clk_upd * greater than, new_clock. As we can divide by 1 << i for * any i in [0, 9] we want the input clock to be as close as * possible, but no greater than, new_clock << i. + * + * Add an upper limit of 1/1024 rate higher to the clock rate to fix + * clk rate jumping to lower rate due to rounding error (eg: RZ/G2L has + * 3 clk sources 533.333333 MHz, 400 MHz and 266.666666 MHz. The request + * for 533.333333 MHz will selects a slower 400 MHz due to rounding + * error (533333333 Hz / 4 * 4 = 533333332 Hz < 533333333 Hz)). */ for (i = min(9, ilog2(UINT_MAX / new_clock)); i >= 0; i--) { freq = clk_round_rate(ref_clk, new_clock << i); - if (freq > (new_clock << i)) { + new_upper_limit = (new_clock << i) + ((new_clock << i) >> 10); + if (freq > new_upper_limit) { /* Too fast; look for a slightly slower option */ freq = clk_round_rate(ref_clk, (new_clock << i) / 4 * 3); - if (freq > (new_clock << i)) + if (freq > new_upper_limit) continue; } @@ -181,6 +189,7 @@ static unsigned int renesas_sdhi_clk_upd static void renesas_sdhi_set_clock(struct tmio_mmc_host *host, unsigned int new_clock) { + unsigned int clk_margin; u32 clk = 0, clock; sd_ctrl_write16(host, CTL_SD_CARD_CLK_CTL, ~CLK_CTL_SCLKEN & @@ -194,7 +203,13 @@ static void renesas_sdhi_set_clock(struc host->mmc->actual_clock = renesas_sdhi_clk_update(host, new_clock); clock = host->mmc->actual_clock / 512; - for (clk = 0x80000080; new_clock >= (clock << 1); clk >>= 1) + /* + * Add a margin of 1/1024 rate higher to the clock rate in order + * to avoid clk variable setting a value of 0 due to the margin + * provided for actual_clock in renesas_sdhi_clk_update(). + */ + clk_margin = new_clock >> 10; + for (clk = 0x80000080; new_clock + clk_margin >= (clock << 1); clk >>= 1) clock <<= 1; /* 1/1 clock is option */ From patchwork Sat Oct 22 07:18: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: 7185 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1089083wrr; Sat, 22 Oct 2022 00:42:08 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7qoZNFcj3TskRYmlQcg/O/SvZvejPrAPXlyOdaHHywwLy6QmHHCHWr1eHld/huIY+nA4Mx X-Received: by 2002:aa7:9212:0:b0:562:b5f6:f7d7 with SMTP id 18-20020aa79212000000b00562b5f6f7d7mr23804688pfo.70.1666424528262; Sat, 22 Oct 2022 00:42:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666424528; cv=none; d=google.com; s=arc-20160816; b=ttpmjpmkRX7PIF1wLC1AfsGa+a/TFRjxt/q+9eB+xg0qNmzpShSQLTNgLBf+utlVPu LzB0MuOr57WkXAvnD2miV46YiofYtX6Vk/00M/sT9M024SK+TI4sz3IuDD+fLXq4TrlL n3oxrYcrwjOCU35imbcH8Bo7RZgZCPpNfpctNtks5oGnDMMxApFGMEo+sXhPgmEqbf+2 TPMOaHE8QEnTC4ciddLSsg5GXrwkPeR10UUWlYnPhiLa63Wb7BRDUTpn3AkB7TUAqjCI nIap/B9VoRMyVcEgeCQcLytOjHa5ce2DlyxnjIRSXcNYl0mGgzVZCAHn1zcvoBmepXQt jVdg== 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=IjXcW/SeV8N4p9bNZuOiZS26fNFOrPxc1vzkfOVaOY4=; b=SiU1lePCa31YoM+xmxsawuIjY+Ui606h1f71q+rOMAP8kEF55PLkXOyHTIzVFovOlk VVrrQABBXeLH3KnKY3D7I70tRMjT4XLWspOr9QiDwBjTlpaWTdtJabbZi02hr+kIWOEr yeuyY41zP58VCxDVMHCDPzNy1v+YJRsSza3Vv77X0/1WuPbcUTfQ6XCx30kFM3EyDQX7 ImdNk3VcQypA1j2SLbv48aj3hpTTSfehQ+LOPQGNJuKHMjYEt8DtL6q0KCWKBxD1I8kC csD0VwM5VL0DkIbr3K9QqNaaNor/vYtiPbTuENC4Z0gto7HHzwJHVeEhfFWaoVfrEKcO QJkw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=q+Np6cMI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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-20020a17090b3b4100b00210d1aeabc1si2232945pjb.188.2022.10.22.00.41.56; Sat, 22 Oct 2022 00:42: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=q+Np6cMI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231214AbiJVHlX (ORCPT + 99 others); Sat, 22 Oct 2022 03:41:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42762 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231205AbiJVHkj (ORCPT ); Sat, 22 Oct 2022 03:40:39 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 79227645D9; Sat, 22 Oct 2022 00:37: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 7192060AD7; Sat, 22 Oct 2022 07:36:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 71855C433D6; Sat, 22 Oct 2022 07:36:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424204; bh=YOAwwPrV6/YirX98LJtbHU/XaaLQu0LAr2I1+3I1W6k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=q+Np6cMI5l0txx7noKAxhNs2oFpl0QJnxlRsWIW3jUH60BJOr93tsl5VDJ1U/lWjB bhnk8jfGbnZbhmPmz+RRIPzZKQaCGmfR+FRf+Vow7kIAOcYNM/rO/cbnN2C9Hd+Z8g dOESOESRMHTLZrOlgmS8knjZzXvpYajXSc4yNses= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Aniruddha TVS Rao , Prathamesh Shete , Adrian Hunter , Thierry Reding , Ulf Hansson Subject: [PATCH 5.19 033/717] mmc: sdhci-tegra: Use actual clock rate for SW tuning correction Date: Sat, 22 Oct 2022 09:18:32 +0200 Message-Id: <20221022072421.007366217@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747372766227886141?= X-GMAIL-MSGID: =?utf-8?q?1747372766227886141?= From: Prathamesh Shete commit b78870e7f41534cc719c295d1f8809aca93aeeab upstream. Ensure tegra_host member "curr_clk_rate" holds the actual clock rate instead of requested clock rate for proper use during tuning correction algorithm. Actual clk rate may not be the same as the requested clk frequency depending on the parent clock source set. Tuning correction algorithm depends on certain parameters which are sensitive to current clk rate. If the host clk is selected instead of the actual clock rate, tuning correction algorithm may end up applying invalid correction, which could result in errors Fixes: ea8fc5953e8b ("mmc: tegra: update hw tuning process") Signed-off-by: Aniruddha TVS Rao Signed-off-by: Prathamesh Shete Acked-by: Adrian Hunter Acked-by: Thierry Reding Cc: stable@vger.kernel.org Link: https://lore.kernel.org/r/20221006130622.22900-4-pshete@nvidia.com Signed-off-by: Ulf Hansson Signed-off-by: Greg Kroah-Hartman --- drivers/mmc/host/sdhci-tegra.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/mmc/host/sdhci-tegra.c +++ b/drivers/mmc/host/sdhci-tegra.c @@ -773,7 +773,7 @@ static void tegra_sdhci_set_clock(struct dev_err(dev, "failed to set clk rate to %luHz: %d\n", host_clk, err); - tegra_host->curr_clk_rate = host_clk; + tegra_host->curr_clk_rate = clk_get_rate(pltfm_host->clk); if (tegra_host->ddr_signaling) host->max_clk = host_clk; else From patchwork Sat Oct 22 07:18: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: 7186 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1089187wrr; Sat, 22 Oct 2022 00:42:29 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5Px10eN/0jWrWeJbUaOhnRcG0tsNcvlm5cjek/yZBFP3yyAZhO/hO8ad5hyWXeRvx/HODV X-Received: by 2002:a17:902:bc86:b0:186:5d80:f62f with SMTP id bb6-20020a170902bc8600b001865d80f62fmr15199137plb.28.1666424537862; Sat, 22 Oct 2022 00:42:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666424537; cv=none; d=google.com; s=arc-20160816; b=fju2AVxUfsbW6keJrVcVcWeQmpn+E/4GjXVh9veDzybQSSRhUV9VGUPbKTgMGW5vw4 WDxbA0rMxgl3AIRVgaqFeCaBLasjwR/f+p72OpDjj9kJGppZPWTGrHvcLWQD9K8DYaSm K20vHNAmT0XlgATwXx5aZBPR5bvuhAT3lx/YtFXvs602oF+k81Im5JbpTbaWdV2exqd5 3M4OnbL3lQvU4tVFrTSPrfpAd8u3ZO9nmV44/MLWVhSofcedKk4B/+iR7IXVJ57uvZ3h FzdBf2KIHOIqN+PNc47om9aLHQDzRA2wxuhaL6RmLeuzxppAF8AZvoLI1kp9c5+yxox6 DEwA== 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=Vt+YFb+bPtwxgVtxWHawy6D4lSr3RVMKh8ErEiJMb1o=; b=MuwgkcsxN99VsoSgLM8eZzUwT4W7UWj9Xv2oN3NurXd2/vRFbVKYMa6UZ+sQfNye7D EVzcOkrm1SoQwViBOveH/n3i6xdEJOG9ADefUzNqLWTKZZWnmF98ZHSGXNBiMl/Ytomi pzCTywfpRwEQQMdjJCnesdHq+5+1hXgqCMtu8HHXch8ako664hNlMTExjV8GduCAAyeZ WPJ/Tl6ZkePEdYX/OC9RIZ4+q9Xuaqz0q2FZvD1Hqe3KgwQoivtoaTwfP3eSIa3Dvl5t lZ9zNcobHAajMLQ76haUMjdGSezgF8KtPAZKmP2REPtKNvBom4gHwqx8CjebgZTHeaob niyg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=OrQbbhfT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 s14-20020a17090302ce00b0016c44b7c8c5si25592835plk.11.2022.10.22.00.42.05; Sat, 22 Oct 2022 00: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=OrQbbhfT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S230494AbiJVHl1 (ORCPT + 99 others); Sat, 22 Oct 2022 03:41:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43030 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231210AbiJVHkj (ORCPT ); Sat, 22 Oct 2022 03:40: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 C6DB465001; Sat, 22 Oct 2022 00:38: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 55B1860ADC; Sat, 22 Oct 2022 07:36:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5F34CC433D6; Sat, 22 Oct 2022 07:36:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424213; bh=lVh1oP4UqEge0pFZJpJr/ff3E2QK73mfpro3qwWesks=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OrQbbhfT4vKiJph0qERXFwuqMtIJDbHoo2UYG7koaBzqr4dwLDfTcFJrmFtXH2a3m 4R5lQG6ysyvNCS57u6EZZMdUO3fQrPvgEQ8UCUxNj+mRD06JxR8aQdsdtQED/f3FiD uLrhXd3WY/A6ZG5hYRLUw7l9CAxCcUbyidEb7icw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Wenchao Chen , Adrian Hunter , Ulf Hansson Subject: [PATCH 5.19 034/717] mmc: sdhci-sprd: Fix minimum clock limit Date: Sat, 22 Oct 2022 09:18:33 +0200 Message-Id: <20221022072421.181001786@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747372776046268510?= X-GMAIL-MSGID: =?utf-8?q?1747372776046268510?= From: Wenchao Chen commit 6e141772e6465f937458b35ddcfd0a981b6f5280 upstream. The Spreadtrum controller supports 100KHz minimal clock rate, which means that the current value 400KHz is wrong. Unfortunately this has also lead to fail to initialize some cards, which are allowed to require 100KHz to work. So, let's fix the problem by changing the minimal supported clock rate to 100KHz. Signed-off-by: Wenchao Chen Acked-by: Adrian Hunter Fixes: fb8bd90f83c4 ("mmc: sdhci-sprd: Add Spreadtrum's initial host controller") Cc: stable@vger.kernel.org Link: https://lore.kernel.org/r/20221011104935.10980-1-wenchao.chen666@gmail.com [Ulf: Clarified to commit-message] Signed-off-by: Ulf Hansson Signed-off-by: Greg Kroah-Hartman --- drivers/mmc/host/sdhci-sprd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/mmc/host/sdhci-sprd.c +++ b/drivers/mmc/host/sdhci-sprd.c @@ -309,7 +309,7 @@ static unsigned int sdhci_sprd_get_max_c static unsigned int sdhci_sprd_get_min_clock(struct sdhci_host *host) { - return 400000; + return 100000; } static void sdhci_sprd_set_uhs_signaling(struct sdhci_host *host, From patchwork Sat Oct 22 07:18: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: 7642 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1107663wrr; Sat, 22 Oct 2022 01:41:39 -0700 (PDT) X-Google-Smtp-Source: AMsMyM59RCifyIB0CIIa60JZOquNGgYwMgkvJoA0De8zx9ReOunntEc9a9XCEAMznUCDxI8YqAuc X-Received: by 2002:a05:6402:5ca:b0:43b:6e01:482c with SMTP id n10-20020a05640205ca00b0043b6e01482cmr21753685edx.189.1666428099469; Sat, 22 Oct 2022 01:41:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666428099; cv=none; d=google.com; s=arc-20160816; b=GvbF47obLx2C8Ahh6BM5v1bKJlMrHIwk29HZ8/qkzxDUssvhsourqVfRU2hdD2SMIu ICYO8rsMwTUlA4fgnWnAEYz+yPB70LvK3/YIuxG4JcI8ye4u+uUjLOVZf2pvuPx+hZjx XfAAE4BkPMJGjbFi0J0Uf5uj6S80w3ZewfueRPeFHkcnci53VuZJB0Fl0anND1Gy07Ne ZmMDWqbCmII9YvqUsZwB3Tdr6HRZdG6G2HR+lXANwDv+bvZYKAhkWX9543na+xRIL2s6 GR3+LE0Vd8TtE11fBsV+BAKhBDboq62NEi/i1JaWxISdsrb6rYci08CFhqd7pOG+KBCy 5P8w== 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=SC1dvavRum/rZ+XA63jr5Pq4lYHqhje7TzAd/C62WBM=; b=LM266Yq9yYgY2fGJs24thzkeQ1TOS2kG9GOp/3HLfvp1t95/QP8431i+pRSRugBaAo CNzKoHv+CLrkZUlLPYa1VOZULL7LZ6vNnazAQUnLoHhlCxtzcHs8uHDTQM/jTjIYwSz6 vvVDOwmRVCjHgRQhi9DwX52EL15AFyn19Q+/ntnShnIfLL8dNsS/tg6OBVD9qWNttYXO RB55axULeCjFi9+A9GwBPhg5wjFe0CzjUz0xTuxYELcLAIksu1sp10+V7aCkmrqfsjJv v2DdcIF+weUoO0ELl7sZ+tM0LNuRgWnH0giac7CdI+Om09RB8wgqDOAGC/G7VDlpvqUA GCzQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=HuWuGVfU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 gb38-20020a170907962600b0078261fd56efsi24143416ejc.571.2022.10.22.01.41.14; Sat, 22 Oct 2022 01:41: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=HuWuGVfU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S234549AbiJVIjH (ORCPT + 99 others); Sat, 22 Oct 2022 04:39:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54932 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234381AbiJVIfJ (ORCPT ); Sat, 22 Oct 2022 04:35:09 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 914BB3685C; Sat, 22 Oct 2022 01:04: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 dfw.source.kernel.org (Postfix) with ESMTPS id 66CC960AE4; Sat, 22 Oct 2022 07:36:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 59EF6C433C1; Sat, 22 Oct 2022 07:36:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424216; bh=HHK5F+bVk5ccs/l91De+g7lQ4jXHY0mt5/MgFWT9rdQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HuWuGVfUpk0oC0jLmlvlrDttaioyricwrErANZ5ux1k/r7IWjVk6ZfnVPea9x8ZaB u+uK7g5YMdd9PZaguqWqFk32rlxpOJRARai9LZPTASb7eFhpVCI8xhjiiQN1wCy0f9 Zyo0qYilrL43PUMZp5nB6x+z2ZlCLrvBf4xUx56w= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Samuel Clark , Jarkko Nikula , Andy Shevchenko , Wolfram Sang Subject: [PATCH 5.19 035/717] i2c: designware: Fix handling of real but unexpected device interrupts Date: Sat, 22 Oct 2022 09:18:34 +0200 Message-Id: <20221022072421.381452549@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376510808332640?= X-GMAIL-MSGID: =?utf-8?q?1747376510808332640?= From: Jarkko Nikula commit 301c8f5c32c8fb79c67539bc23972dc3ef48024c upstream. Commit c7b79a752871 ("mfd: intel-lpss: Add Intel Alder Lake PCH-S PCI IDs") caused a regression on certain Gigabyte motherboards for Intel Alder Lake-S where system crashes to NULL pointer dereference in i2c_dw_xfer_msg() when system resumes from S3 sleep state ("deep"). I was able to debug the issue on Gigabyte Z690 AORUS ELITE and made following notes: - Issue happens when resuming from S3 but not when resuming from "s2idle" - PCI device 00:15.0 == i2c_designware.0 is already in D0 state when system enters into pci_pm_resume_noirq() while all other i2c_designware PCI devices are in D3. Devices were runtime suspended and in D3 prior entering into suspend - Interrupt comes after pci_pm_resume_noirq() when device interrupts are re-enabled - According to register dump the interrupt really comes from the i2c_designware.0. Controller is enabled, I2C target address register points to a one detectable I2C device address 0x60 and the DW_IC_RAW_INTR_STAT register START_DET, STOP_DET, ACTIVITY and TX_EMPTY bits are set indicating completed I2C transaction. My guess is that the firmware uses this controller to communicate with an on-board I2C device during resume but does not disable the controller before giving control to an operating system. I was told the UEFI update fixes this but never the less it revealed the driver is not ready to handle TX_EMPTY (or RX_FULL) interrupt when device is supposed to be idle and state variables are not set (especially the dev->msgs pointer which may point to NULL or stale old data). Introduce a new software status flag STATUS_ACTIVE indicating when the controller is active in driver point of view. Now treat all interrupts that occur when is not set as unexpected and mask all interrupts from the controller. Fixes: c7b79a752871 ("mfd: intel-lpss: Add Intel Alder Lake PCH-S PCI IDs") Reported-by: Samuel Clark Link: https://bugzilla.kernel.org/show_bug.cgi?id=215907 Cc: stable@vger.kernel.org # v5.12+ Signed-off-by: Jarkko Nikula Reviewed-by: Andy Shevchenko Signed-off-by: Wolfram Sang Signed-off-by: Greg Kroah-Hartman --- drivers/i2c/busses/i2c-designware-core.h | 7 +++++-- drivers/i2c/busses/i2c-designware-master.c | 13 +++++++++++++ 2 files changed, 18 insertions(+), 2 deletions(-) --- a/drivers/i2c/busses/i2c-designware-core.h +++ b/drivers/i2c/busses/i2c-designware-core.h @@ -126,8 +126,9 @@ * status codes */ #define STATUS_IDLE 0x0 -#define STATUS_WRITE_IN_PROGRESS 0x1 -#define STATUS_READ_IN_PROGRESS 0x2 +#define STATUS_ACTIVE 0x1 +#define STATUS_WRITE_IN_PROGRESS 0x2 +#define STATUS_READ_IN_PROGRESS 0x4 /* * operation modes @@ -334,12 +335,14 @@ void i2c_dw_disable_int(struct dw_i2c_de static inline void __i2c_dw_enable(struct dw_i2c_dev *dev) { + dev->status |= STATUS_ACTIVE; regmap_write(dev->map, DW_IC_ENABLE, 1); } static inline void __i2c_dw_disable_nowait(struct dw_i2c_dev *dev) { regmap_write(dev->map, DW_IC_ENABLE, 0); + dev->status &= ~STATUS_ACTIVE; } void __i2c_dw_disable(struct dw_i2c_dev *dev); --- a/drivers/i2c/busses/i2c-designware-master.c +++ b/drivers/i2c/busses/i2c-designware-master.c @@ -716,6 +716,19 @@ static int i2c_dw_irq_handler_master(str u32 stat; stat = i2c_dw_read_clear_intrbits(dev); + + if (!(dev->status & STATUS_ACTIVE)) { + /* + * Unexpected interrupt in driver point of view. State + * variables are either unset or stale so acknowledge and + * disable interrupts for suppressing further interrupts if + * interrupt really came from this HW (E.g. firmware has left + * the HW active). + */ + regmap_write(dev->map, DW_IC_INTR_MASK, 0); + return 0; + } + if (stat & DW_IC_INTR_TX_ABRT) { dev->cmd_err |= DW_IC_ERR_TX_ABRT; dev->status = STATUS_IDLE; From patchwork Sat Oct 22 07:18: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: 7188 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1089254wrr; Sat, 22 Oct 2022 00:42:40 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4xBSoabXXxSkbTbyflJPDinSxmjEOk7SnDIzefdFG7Aq1WR7P6DPum5iVaa3mxwTcD0oJn X-Received: by 2002:a17:90a:4594:b0:20b:23d5:8ead with SMTP id v20-20020a17090a459400b0020b23d58eadmr61194029pjg.127.1666424549248; Sat, 22 Oct 2022 00:42:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666424549; cv=none; d=google.com; s=arc-20160816; b=F1gUZWa054szyX2N9aaQknHQi5e7W9aN8VNUjRVsGyY/KcB3h8ljUPy9ZgLZcLCmG9 CpzJMbBbPdSG71QQjNprUsvvQMSazoUiCkXWMnOYYbE7nWgepeGgLQ6JfD9hp6HcIE3e 4VgWp4P0lWSDkQFRnjpZXppvnHBxVXIVTQOELlxW3BuIgCBEsh4eEqYoB/FQkJ/oTVwK FwDhvOfaHCaasrCH0ZXnYC/kDhcdcAJWNrZlqe+qotI1d0DdOizeRbvTNjJ/82Ria0F7 K296xW4dX1PJc9KSL2oLa1glyUFFqYk9U7WV7g+8up5kzjj1b5j7sWQ0ZTUfLLpolUDp hO6A== 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=j8Xomj0fQuqTrEPYs85LyPIT2S8pL5SEO58O73gA53g=; b=gL9JicuhWV6VRshN7+whE9QXH+vXe6tKMVhi61c+bV7Jl5mULZU3QL7fItFw8+ESPh 8LHY/G3ui9KRJUlZUoWmvT9Crm742cBQMSt1wFOvL1phx61H0w3tDdpPCoPpRS9gazHS y35h1GWnNroWAruP0sOQq0DANeBh5Dkbh5fFet47H/Fhg0THGO+Dz7fORF8nR4eC+wTq S+Sv6TXWToQ48Mbd5Se7Jev9f7CP3p6fZ3gu1eitv3HyCCmWTZbCACwK07LOer8nX/ln PFLW7lwamDAWkw04gBvZNrlHbGHTBRZKR11sotkRVmt76hHrpI1CgeXCUshWMOtkofTK +kfA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=TZV78V4v; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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-20020a056a00340f00b005655fc278f3si24079209pfb.201.2022.10.22.00.42.17; Sat, 22 Oct 2022 00: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=TZV78V4v; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231210AbiJVHlz (ORCPT + 99 others); Sat, 22 Oct 2022 03:41:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33004 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230519AbiJVHl3 (ORCPT ); Sat, 22 Oct 2022 03:41:29 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C97002D762; Sat, 22 Oct 2022 00:39: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 1BADAB82DB2; Sat, 22 Oct 2022 07:37:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6BC9AC433D6; Sat, 22 Oct 2022 07:36:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424219; bh=jBoTbudxBixvFylnCwkGubpi1p23EEKMHTLT51gJ8yc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TZV78V4vEcacLNqVOteInxngf0sBchFvD3o6EC965Uq5kPflbJFWVWB/gdBnhrTIG lxnzjkFaddwXFWYRLS0jKUzx0X7gyIRiWfw243xy+tdse1ebRxIcPfG7YIJ/2Si0yK kNlGnOKRDk1lOueTEoiszkwzdskaWLFA4PnkZKzw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alexander Aring , David Teigland Subject: [PATCH 5.19 036/717] fs: dlm: fix race between test_bit() and queue_work() Date: Sat, 22 Oct 2022 09:18:35 +0200 Message-Id: <20221022072421.521048689@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747372788243186739?= X-GMAIL-MSGID: =?utf-8?q?1747372788243186739?= 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); @@ -288,7 +288,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 Sat Oct 22 07:18: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: 7179 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1088795wrr; Sat, 22 Oct 2022 00:41:15 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4x87N98ObvV3NL44xNO+UxkQ06U7Q9oJqbhEzFnGvPkMRVa2HeNC9PgWjsHt/b40PePAPq X-Received: by 2002:a65:6e82:0:b0:41a:9b73:f0e6 with SMTP id bm2-20020a656e82000000b0041a9b73f0e6mr19928513pgb.371.1666424475181; Sat, 22 Oct 2022 00:41:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666424475; cv=none; d=google.com; s=arc-20160816; b=zvBVtwv09fifUK9o5cvsykJj45RgusaEgmZyLUfvfHr3xEzLnJFkr0xHjSzWO398RG L0wYNN9MW3mh+VNLcmrbTVWeXUMCY/fcs2XGy12NKrvLRdSFB80nnXsmrGsxjI2GqxuA 2bzi8k1MVaQjfTuyn9gQYEWyFJ6Q0MV+gRLx92AE1ReuiisIZrogunk4aLH+a/Em6C0v DLIaZ9CMQQekuWREiXnmwGHWbF4Q/1ljTlO1QD6Upyw+9hNBPzPpyrU2pRDqicACh5gG IU/vLgnPl+oZSpzkmBRlhhNDZvQBPja+gF0wFXi/prljfqZlBfcaymfvgL77MS40nSYn Bqxg== 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=ZqGnEI4Jq7R6voxy/Op05zxw4aJDgL6TrVylHwgeCw0=; b=rVpx+TBk5ooYPW0ycqZjtr1/m64fxHcCaPwf0+BG7CdeWoaFAOhjzr39RIvsgYeTbu sj9kkZaSwrYg1vhPkJRAXeDgh55RhAXaw1NiJ8QCnsuw0WHAciH0MqKcZsULmB+j1Wjx p7vzlygirk/yY4AaQJy48vSbiDi/gu8AjMrwPCDITgJb+drV+cFPqgQhT9LCs9wewvvC GDg+CTrx9HwYDIbwL1MmEa1mNenHFgnaWHD67hPyLLaV+GD3QsdGTdl1exporzrWJPou 71JXsIVZ5ihFgBBIex+iYMoLdEOTz2HLJiEp1Z06VgyN6aywz9e+v8cq5Bxj6g1LeslN a5ug== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=jrnuaAKw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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-20020a17090a53c700b00205ef38b646si8708592pjh.80.2022.10.22.00.41.03; Sat, 22 Oct 2022 00: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=jrnuaAKw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S230148AbiJVHko (ORCPT + 99 others); Sat, 22 Oct 2022 03:40:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53118 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230328AbiJVHjl (ORCPT ); Sat, 22 Oct 2022 03:39:41 -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 B46C92BE883; Sat, 22 Oct 2022 00:37: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 21F6FB82D9F; Sat, 22 Oct 2022 07:37:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 74775C433D6; Sat, 22 Oct 2022 07:37:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424222; bh=armA+utm4/fRQ9XPab00JtG4j1S4Qjzm6rdXp+Ft1Gw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jrnuaAKwKnmFiXEGjzDI7hlIBBON1kEW1LAUHickutdSRUhdavq2ZHXw038g8jvgc 5ve65IAOtR0Q/7NyBLwFm7u3R6PJfr4lv4DpSgRFvHnlEprCbd9uJz5Ry0Dz2qygEL Bskp/frFfa4EjnUspUcnCwKEZwAfAqOsR/9YikVo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alexander Aring , David Teigland Subject: [PATCH 5.19 037/717] fs: dlm: handle -EBUSY first in lock arg validation Date: Sat, 22 Oct 2022 09:18:36 +0200 Message-Id: <20221022072421.703068835@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747372710537495652?= X-GMAIL-MSGID: =?utf-8?q?1747372710537495652?= 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 | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) --- a/fs/dlm/lock.c +++ b/fs/dlm/lock.c @@ -2920,17 +2920,9 @@ 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) - goto out; - - if (args->flags & DLM_LKF_QUECVT && - !__quecvt_compat_matrix[lkb->lkb_grmode+1][args->mode+1]) - goto out; - - rv = -EBUSY; if (lkb->lkb_status != DLM_LKSTS_GRANTED) goto out; @@ -2940,6 +2932,14 @@ static int validate_lock_args(struct dlm if (is_overlap(lkb)) goto out; + + rv = -EINVAL; + if (lkb->lkb_flags & DLM_IFL_MSTCPY) + goto out; + + if (args->flags & DLM_LKF_QUECVT && + !__quecvt_compat_matrix[lkb->lkb_grmode+1][args->mode+1]) + goto out; } lkb->lkb_exflags = args->flags; From patchwork Sat Oct 22 07:18: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: 7632 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1107524wrr; Sat, 22 Oct 2022 01:41:09 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4M0F9vMTHpZ151ikOWDFEtCvzJEA0uFS9DLs7l3Fh1ADJE1lHnZe03sh9hIoVvysumCppg X-Received: by 2002:a05:6402:2802:b0:43a:9098:55a0 with SMTP id h2-20020a056402280200b0043a909855a0mr20886236ede.179.1666428069303; Sat, 22 Oct 2022 01:41:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666428069; cv=none; d=google.com; s=arc-20160816; b=vP6rBX/rUCGbTHGy470Ffuq3AK+lQqnpCT4hJd2cQyVJvbZfTcLN6YutemgIZvGMHM g8a7KLeIAltOwNKMVuwIQuG6oWTfeoQFwU0FpCLR8G7h+ohoFJHJZDyauChYMZwnM6ia GThQ388ZQpcEvcjtTcq/iFLUQjEMhc8VGAk7K8kNA2BfA6sCXZuETT3P6KPgd+BU6INH Kdv6demaDsQvO37GSqXMP/7vNKx/78DNmCCGKqRdGDdjh8EJDGYZsyozR7AQ8AVGDeUG e8u9GHoCFKwx21pP7gG5dzChAUYNRNku9Y3PQovQbQwD5CTe6ejLL+Tl6bfyzMCqwQ3j f2Jg== 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=P98BZtkdRuOwQ5sCG1pBtMwwtEr8oDFYCWtzPGiWloQ=; b=TRL58lWeB5hblmb1ALYdGqRCGkj+NjzFwt9YEgHZaK8+6HCMcDYzXZ7Kh+JUkVIxPe FzKMinOPFfSMllEXXmC8dTC4bLBGIQH9rlsrcdKsI9sn8+821uq6bl7Kk8Ur25JCgcw3 X9PgFmXy1BBUEWYu91rIgsPiXTosSsl1TfyztVAN9TLaDNgRXCjwKs7+LPqf9/4iqfad +m2Z3lE0yP+yTrH+HqGwQKAm/qVien+QV0TEdrA2rJMwzhpSeLoo/q3xFhK4gRjHVMKi jAgOEl/EhJBK0hJI5U/2f5/18U/Of1LLzev4+2Spxznqm4Iwnok5DjmWlgpXUCgabAR3 RJXw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=hDE0OHBe; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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-20020a50a68b000000b0045cd10a4c20si22916816edc.321.2022.10.22.01.40.40; Sat, 22 Oct 2022 01:41: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=hDE0OHBe; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S234195AbiJVIiY (ORCPT + 99 others); Sat, 22 Oct 2022 04:38:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58714 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234100AbiJVIdj (ORCPT ); Sat, 22 Oct 2022 04:33: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 BA4C12E714E; Sat, 22 Oct 2022 01: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 86CA860ADF; Sat, 22 Oct 2022 07:37:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 75746C433C1; Sat, 22 Oct 2022 07:37:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424225; bh=8hdFmbiA//YLxkYte55BVBrayGfZqJ15QswTqUflJWA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hDE0OHBeQXinu8SvCNe8aquJxIzHLWxwPpckH0odoRq5o4xKwjL68+taQg48SMgbG jpPgvR6A9d2qzwu58j0aPdZxxNuUcafnEF+WWO90WIGHkHO7fEkpdV9OgzdwXdawQA 4HcSxNtDP05OnfZHzGGkibvmrcwfFtjTxd9ls2TM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alexander Aring , David Teigland Subject: [PATCH 5.19 038/717] fs: dlm: fix invalid derefence of sb_lvbptr Date: Sat, 22 Oct 2022 09:18:37 +0200 Message-Id: <20221022072421.881250194@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376478924976393?= X-GMAIL-MSGID: =?utf-8?q?1747376478924976393?= From: Alexander Aring commit 7175e131ebba47afef47e6ac4d5bab474d1e6e49 upstream. I experience issues when putting a lkbsb on the stack and have sb_lvbptr field to a dangled pointer while not using DLM_LKF_VALBLK. It will crash with the following kernel message, the dangled pointer is here 0xdeadbeef as example: [ 102.749317] BUG: unable to handle page fault for address: 00000000deadbeef [ 102.749320] #PF: supervisor read access in kernel mode [ 102.749323] #PF: error_code(0x0000) - not-present page [ 102.749325] PGD 0 P4D 0 [ 102.749332] Oops: 0000 [#1] PREEMPT SMP PTI [ 102.749336] CPU: 0 PID: 1567 Comm: lock_torture_wr Tainted: G W 5.19.0-rc3+ #1565 [ 102.749343] Hardware name: Red Hat KVM/RHEL-AV, BIOS 1.16.0-2.module+el8.7.0+15506+033991b0 04/01/2014 [ 102.749344] RIP: 0010:memcpy_erms+0x6/0x10 [ 102.749353] Code: cc cc cc cc eb 1e 0f 1f 00 48 89 f8 48 89 d1 48 c1 e9 03 83 e2 07 f3 48 a5 89 d1 f3 a4 c3 66 0f 1f 44 00 00 48 89 f8 48 89 d1 a4 c3 0f 1f 80 00 00 00 00 48 89 f8 48 83 fa 20 72 7e 40 38 fe [ 102.749355] RSP: 0018:ffff97a58145fd08 EFLAGS: 00010202 [ 102.749358] RAX: ffff901778b77070 RBX: 0000000000000000 RCX: 0000000000000040 [ 102.749360] RDX: 0000000000000040 RSI: 00000000deadbeef RDI: ffff901778b77070 [ 102.749362] RBP: ffff97a58145fd10 R08: ffff901760b67a70 R09: 0000000000000001 [ 102.749364] R10: ffff9017008e2cb8 R11: 0000000000000001 R12: ffff901760b67a70 [ 102.749366] R13: ffff901760b78f00 R14: 0000000000000003 R15: 0000000000000001 [ 102.749368] FS: 0000000000000000(0000) GS:ffff901876e00000(0000) knlGS:0000000000000000 [ 102.749372] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 102.749374] CR2: 00000000deadbeef CR3: 000000017c49a004 CR4: 0000000000770ef0 [ 102.749376] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 [ 102.749378] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 [ 102.749379] PKRU: 55555554 [ 102.749381] Call Trace: [ 102.749382] [ 102.749383] ? send_args+0xb2/0xd0 [ 102.749389] send_common+0xb7/0xd0 [ 102.749395] _unlock_lock+0x2c/0x90 [ 102.749400] unlock_lock.isra.56+0x62/0xa0 [ 102.749405] dlm_unlock+0x21e/0x330 [ 102.749411] ? lock_torture_stats+0x80/0x80 [dlm_locktorture] [ 102.749416] torture_unlock+0x5a/0x90 [dlm_locktorture] [ 102.749419] ? preempt_count_sub+0xba/0x100 [ 102.749427] lock_torture_writer+0xbd/0x150 [dlm_locktorture] [ 102.786186] kthread+0x10a/0x130 [ 102.786581] ? kthread_complete_and_exit+0x20/0x20 [ 102.787156] ret_from_fork+0x22/0x30 [ 102.787588] [ 102.787855] Modules linked in: dlm_locktorture torture rpcsec_gss_krb5 intel_rapl_msr intel_rapl_common kvm_intel iTCO_wdt iTCO_vendor_support kvm vmw_vsock_virtio_transport qxl irqbypass vmw_vsock_virtio_transport_common drm_ttm_helper crc32_pclmul joydev crc32c_intel ttm vsock virtio_scsi virtio_balloon snd_pcm drm_kms_helper virtio_console snd_timer snd drm soundcore syscopyarea i2c_i801 sysfillrect sysimgblt i2c_smbus pcspkr fb_sys_fops lpc_ich serio_raw [ 102.792536] CR2: 00000000deadbeef [ 102.792930] ---[ end trace 0000000000000000 ]--- This patch fixes the issue by checking also on DLM_LKF_VALBLK on exflags is set when copying the lvbptr array instead of if it's just null which fixes for me the issue. I think this patch can fix other dlm users as well, depending how they handle the init, freeing memory handling of sb_lvbptr and don't set DLM_LKF_VALBLK for some dlm_lock() calls. It might a there could be a hidden issue all the time. However with checking on DLM_LKF_VALBLK the user always need to provide a sb_lvbptr non-null value. There might be more intelligent handling between per ls lvblen, DLM_LKF_VALBLK and non-null to report the user the way how DLM API is used is wrong but can be added for later, this will only fix the current behaviour. 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 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/fs/dlm/lock.c +++ b/fs/dlm/lock.c @@ -3672,7 +3672,7 @@ static void send_args(struct dlm_rsb *r, case cpu_to_le32(DLM_MSG_REQUEST_REPLY): case cpu_to_le32(DLM_MSG_CONVERT_REPLY): case cpu_to_le32(DLM_MSG_GRANT): - if (!lkb->lkb_lvbptr) + if (!lkb->lkb_lvbptr || !(lkb->lkb_exflags & DLM_LKF_VALBLK)) break; memcpy(ms->m_extra, lkb->lkb_lvbptr, r->res_ls->ls_lvblen); break; From patchwork Sat Oct 22 07:18: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: 7451 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1098519wrr; Sat, 22 Oct 2022 01:11:06 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4qX6YZo0C34QNMWeSUA67Fx8bTPXruVwtIFGNaXbtCh2Lymh5HjoIwDAnPjYElEU5+ZHVO X-Received: by 2002:a17:903:4d7:b0:178:8564:f754 with SMTP id jm23-20020a17090304d700b001788564f754mr23212563plb.60.1666426265767; Sat, 22 Oct 2022 01:11:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666426265; cv=none; d=google.com; s=arc-20160816; b=YpQaZ9mX/qPJ+ZEy5AP/jgxiKxjOMIg1xMcxS9yobfbCN/yy9xwM0M6gYp4lUKTsGi HHK+EzaRdMhK1Y32OZOUu4GQ+LZZIJcoSrZFEWxXaOC3LLhJ/ZhNYPLDC46dgTjd+0xJ AzBpOkaerr6c1jELa3AI/6GyAqlWajkRc4UWwD7teEPHWSntLcq7/90Da1eZlmj/6n1o zZexABCZUQFZ4pSBUrb0IHJgfT/djRh965DOy1O9gz0hI8HRtfXiiPABjefzRzbmC2ez 0okEX2DuF0XHcLGtmHnihOiBEEAHsAsXHi4B/LLeb1FyWziTBLh8aNri2PXIysbBkx67 y8mg== 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=642PGjFqDZ0CGtOhYVSVDmanyvQBYmUfzM1qcwgz9LE=; b=H5jyNQtzFE1bsvNMsV4Z6taUwpuiOdKIvFpAxnUVG0DW0sIkp5C0pc3TNYlK/XSy6h 4NYmBKgZTBqcXGacfVdOqMBDXyk9LPs/yP6OVVB+503kBfZ5dYhaEJd1Jzk/nBi3+lm0 o79DIfrd0pGxokdWBKJFcI7OdcDQ8beKLd62CQD3Bs4MkER2ruBA/GAzOWhAzK81v11S 9ZiZ8y09ZN349NnSsQtjZK4L7eddnXeU1/E4dAvgU0/fLDZwcT744aMqiY9mcyIY7MXs 2c59L9W1T3H/PdSagpB2Ng30Rx/4+XJDkB1HO29rmKL3rj39lzniRHGqPK3bglNk/Ked 769Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="vsFjGY/O"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 19-20020a170902c21300b001867a6a1791si4174903pll.426.2022.10.22.01.10.52; Sat, 22 Oct 2022 01:11: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="vsFjGY/O"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S233483AbiJVIJ5 (ORCPT + 99 others); Sat, 22 Oct 2022 04:09:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37534 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232685AbiJVIFj (ORCPT ); Sat, 22 Oct 2022 04:05:39 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CE2862C6E26; Sat, 22 Oct 2022 00:52: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 423F560ADE; Sat, 22 Oct 2022 07:37:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 54CE8C433D6; Sat, 22 Oct 2022 07:37:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424228; bh=CJh7BEGtcX3x0wey5F8aR0SgwStg4GuMXPmHzzulGjc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vsFjGY/O5L3RP3TCR/3fHwBe/YmAhXpJFoUokAYYPKhmz05fqbSSUvAtEfrIKoRT4 XG3x265OKh1z/ZfMXZ+Li3p1516Q4mhfruSuZOUJKWHpAvf22fe5rkX/D3eyaM4J/i KIsc6VPkTQPxRRnfhTUN64jKkjarT+Y0C7gjpssY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Joanne Koong , Roberto Sassu , Yonghong Song , KP Singh , Alexei Starovoitov Subject: [PATCH 5.19 039/717] btf: Export bpf_dynptr definition Date: Sat, 22 Oct 2022 09:18:38 +0200 Message-Id: <20221022072422.045996090@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747374588349112761?= X-GMAIL-MSGID: =?utf-8?q?1747374588349112761?= From: Roberto Sassu commit 00f146413ccb6c84308e559281449755c83f54c5 upstream. eBPF dynamic pointers is a new feature recently added to upstream. It binds together a pointer to a memory area and its size. The internal kernel structure bpf_dynptr_kern is not accessible by eBPF programs in user space. They instead see bpf_dynptr, which is then translated to the internal kernel structure by the eBPF verifier. The problem is that it is not possible to include at the same time the uapi include linux/bpf.h and the vmlinux BTF vmlinux.h, as they both contain the definition of some structures/enums. The compiler complains saying that the structures/enums are redefined. As bpf_dynptr is defined in the uapi include linux/bpf.h, this makes it impossible to include vmlinux.h. However, in some cases, e.g. when using kfuncs, vmlinux.h has to be included. The only option until now was to include vmlinux.h and add the definition of bpf_dynptr directly in the eBPF program source code from linux/bpf.h. Solve the problem by using the same approach as for bpf_timer (which also follows the same scheme with the _kern suffix for the internal kernel structure). Add the following line in one of the dynamic pointer helpers, bpf_dynptr_from_mem(): BTF_TYPE_EMIT(struct bpf_dynptr); Cc: stable@vger.kernel.org Cc: Joanne Koong Fixes: 97e03f521050c ("bpf: Add verifier support for dynptrs") Signed-off-by: Roberto Sassu Acked-by: Yonghong Song Tested-by: KP Singh Link: https://lore.kernel.org/r/20220920075951.929132-3-roberto.sassu@huaweicloud.com Signed-off-by: Alexei Starovoitov Signed-off-by: Greg Kroah-Hartman --- kernel/bpf/helpers.c | 2 ++ 1 file changed, 2 insertions(+) --- a/kernel/bpf/helpers.c +++ b/kernel/bpf/helpers.c @@ -1468,6 +1468,8 @@ BPF_CALL_4(bpf_dynptr_from_mem, void *, { int err; + BTF_TYPE_EMIT(struct bpf_dynptr); + err = bpf_dynptr_check_size(size); if (err) goto error; From patchwork Sat Oct 22 07:18: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: 7159 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1088220wrr; Sat, 22 Oct 2022 00:39:12 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5/iTWZ2osxG52dtmd5hkz8QsKByhwx3FbbT9+F3rBM+0lVPCd0mMH+A3697MvRjwrNpL/B X-Received: by 2002:a17:907:2672:b0:734:a952:439a with SMTP id ci18-20020a170907267200b00734a952439amr17750380ejc.539.1666424351827; Sat, 22 Oct 2022 00:39:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666424351; cv=none; d=google.com; s=arc-20160816; b=lLt1uvKp+zspqolFITDzCW+VzsH8V1WIjzUttF4R7sDh2vzpkfppx173AkN5KdINR3 b85NR5/9Uh4FvbZ/UA1HifLgNCJ5AI/O/k+Y4aBFy4Fzn/svOOYxTfFQLKk7ufE95msr mLdeniskdeVOF2jDDFfxDdGp9PywgPJ38e3/siLWpG6/V+7RUuFdtWmwIvCdGJJdN36k xsY6HXrByrq263gJOQyspKSbS8+6hU0WBNeEmbhDsDC3MlYD/daSsI8XgLqdUgvZ2GT1 zb5k7e2VbnTiOEBDU9cF2b7bhuzfjpTG/4D4yV97cBplM2JBlO5urNxMx8GOSc5obTMt ofxw== 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=iFeCblNChNlaSTZdY8WhlkVGglMokRRAR29ZlMmMZ70=; b=DkUuLH1WXsHGawYIvzw8dTN99pBC/p+RLLa6qW7PVk6+YN4nZIvBWy9FOwgXKKptkj CRsw3OH40NtBssGzpikqyyvTG/gMK/QIm6nYxCQJRBlo2QcO7gjBUdnLlAMCRofftaVB fwWR8rsWV9+wwignKnGZAIwn2dem6ojq7Onpy6FcKpcIpldq9BydEFwzxcN89a5LYh4o t5TAcWc+OAVKO99lfSUpgIATseR20mIfAkhtkUAT2uOk2OBI5zj0ZIhthvYCDnDqdQJu 54AKR3zJKdOii4cZxHM7EyftlQ6mLQCJI6ub6XvENBZk+BoZ4fzDRBjzutS417R3SwbP 1A0w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=2C1ordG9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 q12-20020a056402248c00b004605f289f68si7048042eda.158.2022.10.22.00.38.47; Sat, 22 Oct 2022 00:39: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=2C1ordG9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S230432AbiJVHh5 (ORCPT + 99 others); Sat, 22 Oct 2022 03:37:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48608 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230378AbiJVHg4 (ORCPT ); Sat, 22 Oct 2022 03:36: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 3C563640F; Sat, 22 Oct 2022 00:35: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 ams.source.kernel.org (Postfix) with ESMTPS id 872EBB82DF2; Sat, 22 Oct 2022 07:35:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EE494C433C1; Sat, 22 Oct 2022 07:35:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424140; bh=HenN0VoiMNEdJ5jaJIOFFLb3urg5OvjE0Y0BVaFny5Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=2C1ordG9NdYwja+8wGrQbCCQtoLLEwvmfatEieZ/jpO+wwNykgBGMneLMzLMs/U2K 1F/vgMEMzrWqXfAGmRt5E+ufboJlSxQNG2KKjQMMjBH59eCGbF5P5UsqK0bamMq2HE ap4Gu1V1zfN7eAXHxTMEbLvfXJEPNAEd9ZmxBDxA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Andri Yngvason , Benjamin Tissoires Subject: [PATCH 5.19 040/717] HID: multitouch: Add memory barriers Date: Sat, 22 Oct 2022 09:18:39 +0200 Message-Id: <20221022072422.207107285@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747372581180922871?= X-GMAIL-MSGID: =?utf-8?q?1747372581180922871?= 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 @@ -1186,7 +1186,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; @@ -1267,7 +1267,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, @@ -1699,11 +1699,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 Sat Oct 22 07:18: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: 7161 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1088261wrr; Sat, 22 Oct 2022 00:39:22 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7X7zX6E73hOzKE8tmmenXyg3FfUtPxkqyF27ffdGKMOSffBnZy8GCteczXJM7pwhL7TOgu X-Received: by 2002:a17:907:3f94:b0:78d:9d2f:3002 with SMTP id hr20-20020a1709073f9400b0078d9d2f3002mr18839369ejc.40.1666424362217; Sat, 22 Oct 2022 00:39:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666424362; cv=none; d=google.com; s=arc-20160816; b=eJaVE8/lM3gxFhlVjFSVahKeztpan+fK4d9RAJNt26afzY6QcdG+hkhZszdJJjmCMD QYUVGrxTdwXLfzZMWW1NX6oS5WOv2xMIfk/gqGDlbd36nDOGzo2yUoG1HMfITKOm/mLU G+dsGaMtzZxHldcaETOB6v9TZOqm4eg0FhwfFc7aHCFJfyqUoQnu6fImeS6hDY8ZkMPF PKjrNeuf4G0DmV8vpy4XlwzpLSna0U/f+3qodqQ5cF6gSbXOLtsXCKkWwBhTMrm2uGVD jnuqPo/eTGzynQGnY3XOsgHhncjrj5egsE/W4+vBin+29XMTNTgokmXm7+VPGueP40Wo X34g== 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=7TsOtbrUHU3FOxvbYMqoOl4X2gSxeqHZoyOC/5UxSMw=; b=LK2kuiKZ+mPjq12Z3hmExeBoRcrBcCO/KD6FlIWLJzkWCtrYfMWuiVKAR+o1NukW/O RxAQF+N6xOToCTV0xG78uAi11Ry4rDeWTsMkkRz9nF4ThzhzxsRlviyzD/1IS54FWTRb JoBC+W30CresTILu9ALGyFu/dvyw95F79AMQJvVJIITiCwnIOPVtDEcSUsJ83r48nkJy oT0lRr27KB56FfXI0ra2bQcxW2W4OWj+rVJWl9e8s/NffW1uZ1CC7kd+z9em7z5V8wvp /fyA6AV0FsCk5AY22E8JyAd//KM/5eyZuTAgB1Mfk4f23MZEg0oPxMQZCNYzEafVhX6y ET9g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=WMpQ6spw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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-20020a1709078b0f00b0078d4a0c77f9si15999209ejc.458.2022.10.22.00.38.57; Sat, 22 Oct 2022 00:39: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=WMpQ6spw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S230270AbiJVHi1 (ORCPT + 99 others); Sat, 22 Oct 2022 03:38:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53108 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230274AbiJVHg6 (ORCPT ); Sat, 22 Oct 2022 03:36:58 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 83F6D1A04F; Sat, 22 Oct 2022 00:35: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 1FABD60ADD; Sat, 22 Oct 2022 07:35:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0BEFBC433D7; Sat, 22 Oct 2022 07:35:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424143; bh=Hqtjr7aNx0r86rF679oxrOM1V3mIW40F3zza30mBDt0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WMpQ6spwqBFgPLd5SVIPzyi6tn8tpgYLhVaAYcq7eq6EPqwyvjBxyEW9TwznQATk7 t026iJEC+fJsCjbVLWNjptg8Odm/5mLJdywAa4Jx7jS5FjlqMKUEAxRB4RFYHX4r/f P+ZC4lYcs02emu87Pu5Qi3JX8jSe6L9OBGuJqp/8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zhihao Cheng , Jan Kara Subject: [PATCH 5.19 041/717] quota: Check next/prev free block number after reading from quota file Date: Sat, 22 Oct 2022 09:18:40 +0200 Message-Id: <20221022072422.384473484@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747372592077323693?= X-GMAIL-MSGID: =?utf-8?q?1747372592077323693?= 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 @@ -71,6 +71,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) { @@ -85,6 +114,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 { @@ -232,6 +264,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) { @@ -424,6 +459,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 Sat Oct 22 07:18: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: 7164 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1088346wrr; Sat, 22 Oct 2022 00:39:42 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4Er0FuiCcvCx6kdCjc0WhdDhUXSM4s5Vj2eMlG9tJwHF2JinhM/pRgyZxoDLwF9Hieqd+D X-Received: by 2002:a17:906:8471:b0:7a2:859a:873a with SMTP id hx17-20020a170906847100b007a2859a873amr123476ejc.730.1666424382831; Sat, 22 Oct 2022 00:39:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666424382; cv=none; d=google.com; s=arc-20160816; b=y1VT+ji3sMX1flvbKORTKtjncQdaxRwKhGIVURH99B1pKw2bUdGnBuArw1Nl8mrO99 kFtSe/NCYRmFh4IaQmz12cQwyT9mxZgWjl5c18YomowWldSzCN3softnR4hEL922vwst DvczGF2AOkhq53VZNvCWbFNQQxbOX7PgFOw5knC66MkAzi2hogfsDG1B1k1k8WheusGB Yg7d9rDEkqKImqUEQaz/KIgS/sq2ZLE1SveblcmT6f8jNb6ZJVFnp2l3lnV68+B1Ax1/ INo+VtqrU9q3Top7hiuhAYwqcCm1GCZ7dBUQkmVmmD2/poAEAeFZzs5QA6a+no9z+e6d YjEA== 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=cNo+WhE+2jPQ08AJsuysaRnAKkpzoVlZoBvdWbRUyRY=; b=Yy97AyzRmhhzHANgD10y8ev5DkIqh3lSEIijBPeVv36Pk+BdFywMDPt2RHpMaeLefi QZwd63yOpkb6j23sao3/gb0yLvjXTc4r94lqabX0VpnpwBkuVykjBb9IQ/npbfC++H3R N8D5yDc8yuhQ/Ox8ATEc2C3sSGUjy7W1VWpVpEGybqeoxgG6e0SqZq0W1JOk6CqVJq8E F+u7PnGLbh9g1Uwxi78Fwtu6S2PklKVIn8kIXKW5BfSInXlW4N6FALRsulIITiTvb/5e 5XB1+2e1sSTx+EbUxlefiXqtfflHCrPeTdiz5uFKWzd8qYgaOGWyOwHs5JIKzaxvPxAD OgkA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="ZkDp/6bl"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 ga8-20020a1709070c0800b0077a5733ac08si12711786ejc.601.2022.10.22.00.39.17; Sat, 22 Oct 2022 00:39: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="ZkDp/6bl"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S230459AbiJVHiq (ORCPT + 99 others); Sat, 22 Oct 2022 03:38:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49058 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230233AbiJVHh2 (ORCPT ); Sat, 22 Oct 2022 03:37:28 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9284C253BD0; Sat, 22 Oct 2022 00:35: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 26D8C60AE4; Sat, 22 Oct 2022 07:35:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E9186C43149; Sat, 22 Oct 2022 07:35:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424146; bh=JFJnt6l5AzW/+GUVBKRpZolRl75WP0tf6bsnS/+TL9Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZkDp/6ble/hIN4Dt/Mg45MQEu8Mwm3s5le3OeoKXYcbfSYdMAiP3uX6u7aoVncjFc Cm7ucJd1/6aPNUx6m9I4T7/XE342bKwFF6WndtVdAyLfPE6zSQja9oX/N404TKfVxk AvMFxYLx/k8/MK8M4nw+9BPgYq1nCgmK7SutLzEY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Guenter Roeck , Patryk Duda , Tzung-Bi Shih Subject: [PATCH 5.19 042/717] platform/chrome: cros_ec_proto: Update version on GET_NEXT_EVENT failure Date: Sat, 22 Oct 2022 09:18:41 +0200 Message-Id: <20221022072422.565259619@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747372613297854143?= X-GMAIL-MSGID: =?utf-8?q?1747372613297854143?= From: Patryk Duda commit f74c7557ed0d321947e8bb4e9d47c1013f8b2227 upstream. Some EC based devices (e.g. Fingerpint MCU) can jump to RO part of the firmware (intentionally or due to device reboot). The RO part doesn't change during the device lifecycle, so it won't support newer version of EC_CMD_GET_NEXT_EVENT command. Function cros_ec_query_all() is responsible for finding maximum supported MKBP event version. It's usually called when the device is running RW part of the firmware, so the command version can be potentially higher than version supported by the RO. The problem was fixed by updating maximum supported version when the device returns EC_RES_INVALID_VERSION (mapped to -ENOPROTOOPT). That way the kernel will use highest common version supported by RO and RW. Fixes: 3300fdd630d4 ("platform/chrome: cros_ec: handle MKBP more events flag") Cc: # 5.10+ Reviewed-by: Guenter Roeck Signed-off-by: Patryk Duda Signed-off-by: Tzung-Bi Shih Link: https://lore.kernel.org/r/20220802154128.21175-1-pdk@semihalf.com Signed-off-by: Greg Kroah-Hartman --- drivers/platform/chrome/cros_ec_proto.c | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) --- a/drivers/platform/chrome/cros_ec_proto.c +++ b/drivers/platform/chrome/cros_ec_proto.c @@ -750,6 +750,7 @@ int cros_ec_get_next_event(struct cros_e u8 event_type; u32 host_event; int ret; + u32 ver_mask; /* * Default value for wake_event. @@ -771,6 +772,37 @@ int cros_ec_get_next_event(struct cros_e return get_keyboard_state_event(ec_dev); ret = get_next_event(ec_dev); + /* + * -ENOPROTOOPT is returned when EC returns EC_RES_INVALID_VERSION. + * This can occur when EC based device (e.g. Fingerprint MCU) jumps to + * the RO image which doesn't support newer version of the command. In + * this case we will attempt to update maximum supported version of the + * EC_CMD_GET_NEXT_EVENT. + */ + if (ret == -ENOPROTOOPT) { + dev_dbg(ec_dev->dev, + "GET_NEXT_EVENT returned invalid version error.\n"); + ret = cros_ec_get_host_command_version_mask(ec_dev, + EC_CMD_GET_NEXT_EVENT, + &ver_mask); + if (ret < 0 || ver_mask == 0) + /* + * Do not change the MKBP supported version if we can't + * obtain supported version correctly. Please note that + * calling EC_CMD_GET_NEXT_EVENT returned + * EC_RES_INVALID_VERSION which means that the command + * is present. + */ + return -ENOPROTOOPT; + + ec_dev->mkbp_event_supported = fls(ver_mask); + dev_dbg(ec_dev->dev, "MKBP support version changed to %u\n", + ec_dev->mkbp_event_supported - 1); + + /* Try to get next event with new MKBP support version set. */ + ret = get_next_event(ec_dev); + } + if (ret <= 0) return ret; From patchwork Sat Oct 22 07:18: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: 7165 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1088358wrr; Sat, 22 Oct 2022 00:39:47 -0700 (PDT) X-Google-Smtp-Source: AMsMyM58NwtD+UGo3OaJ/HNR6hJ/Vy26Eml1ii6doAdJHeEOM/sflxe3Y4M37XYYuSsg7+xS9NYX X-Received: by 2002:a17:907:2e0b:b0:78e:16cb:327b with SMTP id ig11-20020a1709072e0b00b0078e16cb327bmr18674165ejc.458.1666424386891; Sat, 22 Oct 2022 00:39:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666424386; cv=none; d=google.com; s=arc-20160816; b=GDWFmTOfN4BVq2PZgwbqpiTpaREqdbv5PaadmVDocnWUYBOffN8+g9atagt9SIhedH ObkBg3zabCH8eoHwq67+fQ6Dfat24DSN2yVDfqXhNBXG3Oflt0HIilTzgyLi3NSp8Tlc aVrip74eRYQd9+kKVWbIzHht/Yl+VEIlh/6JEbb66hCkn94Y/ZSA6oa8AloQyypAH+yO 7rL0b68rdc6UhjEhl1pP1nWnEZ86D6EFM3agjYeAn3sBhb6xViW7F4SQlN/qFJS2Gjg2 sc/FqD6xxni8TcekHp2XEmm9gAHIv6LyXiJG7J59cd/WU+P049OiLvECFahrVXQnX93l /8AQ== 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=mc22RDcpNcWmfoEAOrO2QFx3lZcVrWzMRzBUxy+G2N4=; b=ojWM/SfaJCf8n0I00ifuhtUZfiVXS6SxOxAFLvETOQ92d3CNPhadsK1EPrQ+FSC3yG Eygl0YMooIkOG5+a1YCYJf1C0CPOaAnb6BEGdtGLpfBZNiZye/Of35VV1jK0rzMO6cth jrUOd90rScAnHJJGBnS+f2xwCX3tNIf6g1W5JhJXQ7ao7tQc5d0t0KxvVjO5OHlWGxDf /p8ZE7zn8+YVkicZty8AyoyqKGbfylVQe8JTmWgwO7PmHBY29ZfS6cQJUoizopvWpRma P9zn6wpaPkzdA55TFKwpxV+rGxn4nwVkEROmcjqcHGlAg0O0knLa5cFYAW3xcETRG2OK z/xw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ZkNO2loy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 h6-20020a056402280600b0044f3b9ef98bsi27388158ede.27.2022.10.22.00.39.23; Sat, 22 Oct 2022 00:39: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=ZkNO2loy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S230400AbiJVHiz (ORCPT + 99 others); Sat, 22 Oct 2022 03:38:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49434 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230401AbiJVHhd (ORCPT ); Sat, 22 Oct 2022 03:37:33 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A5CE925CE05; Sat, 22 Oct 2022 00:35: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 sin.source.kernel.org (Postfix) with ESMTPS id 50115CE2C98; Sat, 22 Oct 2022 07:35:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3614CC433C1; Sat, 22 Oct 2022 07:35:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424149; bh=TJwrFLLzUDARRz227XFqeD/qM+dImWjLpczpwfOOLTY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZkNO2loy7xZSEZmtcFTyTKxH6jF5g3f9+lx/zNO2lV7TbFmlVfUVYBmnbRE3JdmQb MrTdsTCHfJQViDSDXeMGTNrDBEDYugISsNwjACEDhvAEDrMVLP4sdCfmHb4Uo4YLa0 dlVgoGgvBcJlBw4tIwa+2IJo8cG6DrWMKFmIwnVs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Krzysztof Kozlowski , Stephen Boyd , Vinod Koul , David Heidelberg , Bjorn Andersson Subject: [PATCH 5.19 043/717] arm64: dts: qcom: sdm845-mtp: correct ADC settle time Date: Sat, 22 Oct 2022 09:18:42 +0200 Message-Id: <20221022072422.734871840@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747372617730619214?= X-GMAIL-MSGID: =?utf-8?q?1747372617730619214?= From: Krzysztof Kozlowski commit 209a04885ab5f76722a1671d0fbf0a5b4bccacec upstream. The PMIC's VADC property for settle time is qcom,hw-settle-time, not qcom,hw-settle-time-us. The latter is used in PMIC's TM ADC. qcom/sdm845-mtp.dtb: pmic@0: adc@3100:adc-chan@4c: 'qcom,hw-settle-time-us' does not match any of the regexes: 'pinctrl-[0-9]+' Fixes: d5e12f3823ae ("arm64: dts: qcom: sdm845: mtp: Add vadc channels and thermal zones") Cc: Signed-off-by: Krzysztof Kozlowski Reviewed-by: Stephen Boyd Reviewed-by: Vinod Koul Reviewed-by: David Heidelberg Signed-off-by: Bjorn Andersson Link: https://lore.kernel.org/r/20220828084341.112146-13-krzysztof.kozlowski@linaro.org Signed-off-by: Greg Kroah-Hartman --- arch/arm64/boot/dts/qcom/sdm845-mtp.dts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) --- a/arch/arm64/boot/dts/qcom/sdm845-mtp.dts +++ b/arch/arm64/boot/dts/qcom/sdm845-mtp.dts @@ -536,42 +536,42 @@ reg = ; label = "xo_therm"; qcom,ratiometric; - qcom,hw-settle-time-us = <200>; + qcom,hw-settle-time = <200>; }; adc-chan@4d { reg = ; label = "msm_therm"; qcom,ratiometric; - qcom,hw-settle-time-us = <200>; + qcom,hw-settle-time = <200>; }; adc-chan@4f { reg = ; label = "pa_therm1"; qcom,ratiometric; - qcom,hw-settle-time-us = <200>; + qcom,hw-settle-time = <200>; }; adc-chan@51 { reg = ; label = "quiet_therm"; qcom,ratiometric; - qcom,hw-settle-time-us = <200>; + qcom,hw-settle-time = <200>; }; adc-chan@83 { reg = ; label = "vph_pwr"; qcom,ratiometric; - qcom,hw-settle-time-us = <200>; + qcom,hw-settle-time = <200>; }; adc-chan@85 { reg = ; label = "vcoin"; qcom,ratiometric; - qcom,hw-settle-time-us = <200>; + qcom,hw-settle-time = <200>; }; }; From patchwork Sat Oct 22 07:18: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: 7163 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1088347wrr; Sat, 22 Oct 2022 00:39:43 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5cLuVe39Sw04rWsASZCTR/pAYnHGPNMEHzLD0Sar16ou13Af2Bb63vkobMVkgsZUFCqJDw X-Received: by 2002:a17:907:6e03:b0:78e:1c82:1f2a with SMTP id sd3-20020a1709076e0300b0078e1c821f2amr18356772ejc.611.1666424382832; Sat, 22 Oct 2022 00:39:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666424382; cv=none; d=google.com; s=arc-20160816; b=kMl5LgOOl4aOKO9/ZeXAXwv64XTrNVWgS42JRfdlwJlnZZFDJTWcrAWm+sCltPwaQJ ptNqU6hTb1gFOeyHZa3y2nPVLlAaUp4OV4Zu8cA/f4IfbN13s/0M4K/UlzKTx69AL5fe w6//e/zcje9Kg7xOUsBd0I44NhUHLRGddZ/x4RuzBa6IXffbRE258FVocVV0r+qA3MAV R8vGGeQJqiR/nog3hByvgZOp1joA3wTEqakdjcA+bwLvZnXyiIQX3Lc8J3CavG2yazIV ag/CYs5oEbMFgEPskWXjCnuxeBK1P6z64SwbU+zQIr0snwDqe9dmrXfOz/pXQED2ld8f kY9w== 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=+zFa8brGdyiwgio9pC1Ae+ysVWZ8asWEUvWaf4xJCqE=; b=crHXFkfk51w/zA610GC9kLy4UTuMvz9XOYPLecsmiS6yPlFAmbAw78nex/KkIBWhcB D+Z4pb5FuTXpIGtSegR4TZBp2vfK63c+F66TPs8pU2d0SI4YCmkatcbIcF/R1ajWLyPk WN26edUiiO7ogelFSVjFaOv5kJPYYm57RYoQAwAb9bypmSeGS0idFfKqA/99ufJRwpkN cMNzWDGGQpnqRS8tSP3ESRD3DJGGkbtLIvUGxHxSIBMsPrdNYVQsKPopYGRKhLuxw2/o e/i6stC1nl3MmLiU7GDgO6WefDSMBGxBFdM1gVv+dRDwrWR4fJ23eT7yqkw23d7Coqsj jGRQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=HiJPfkP7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 dr8-20020a170907720800b0078b3edae43csi24281376ejc.37.2022.10.22.00.39.18; Sat, 22 Oct 2022 00:39: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=HiJPfkP7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S230404AbiJVHiu (ORCPT + 99 others); Sat, 22 Oct 2022 03:38:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48152 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230400AbiJVHhd (ORCPT ); Sat, 22 Oct 2022 03:37: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 6471D25CD94; Sat, 22 Oct 2022 00:35: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 192AD60ADD; Sat, 22 Oct 2022 07:35:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2F629C433D6; Sat, 22 Oct 2022 07:35:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424152; bh=F1qb6aNL2yA+5EeMnl75jCleXjWKk7O5bQePHg9VgMQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HiJPfkP7epirFt17FWUvgQZWq9k+G65nSxm9KcaDYuGZqyfOC4XqFAwJOwrITgU5q n+ajHgRKGrKO6VxOcBizG1+FrukjvqRTaePI2Mr3wCR8T8Eal1bDLCAPRvaMOmMfGV Y8e3UVfiyi1VJH+s3x+iZiko6h68UrJX9dD7GISg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Krzysztof Kozlowski , Srinivas Kandagatla , Mark Brown Subject: [PATCH 5.19 044/717] ASoC: wcd9335: fix order of Slimbus unprepare/disable Date: Sat, 22 Oct 2022 09:18:43 +0200 Message-Id: <20221022072422.871174474@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747372613750412586?= X-GMAIL-MSGID: =?utf-8?q?1747372613750412586?= From: Krzysztof Kozlowski commit ea8ef003aa53ad23e7705c5cab1c4e664faa6c79 upstream. Slimbus streams are first prepared and then enabled, so the cleanup path should reverse it. The unprepare sets stream->num_ports to 0 and frees the stream->ports. Calling disable after unprepare was not really effective (channels was not deactivated) and could lead to further issues due to making transfers on unprepared stream. Fixes: 20aedafdf492 ("ASoC: wcd9335: add support to wcd9335 codec") Cc: Signed-off-by: Krzysztof Kozlowski Reviewed-by: Srinivas Kandagatla Link: https://lore.kernel.org/r/20220921145354.1683791-1-krzysztof.kozlowski@linaro.org Signed-off-by: Mark Brown Signed-off-by: Greg Kroah-Hartman --- sound/soc/codecs/wcd9335.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/sound/soc/codecs/wcd9335.c +++ b/sound/soc/codecs/wcd9335.c @@ -1983,8 +1983,8 @@ static int wcd9335_trigger(struct snd_pc case SNDRV_PCM_TRIGGER_STOP: case SNDRV_PCM_TRIGGER_SUSPEND: case SNDRV_PCM_TRIGGER_PAUSE_PUSH: - slim_stream_unprepare(dai_data->sruntime); slim_stream_disable(dai_data->sruntime); + slim_stream_unprepare(dai_data->sruntime); break; default: break; From patchwork Sat Oct 22 07:18: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: 7166 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1088366wrr; Sat, 22 Oct 2022 00:39:49 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7BR0XPxPxg8Z63HoJSYVF/pj5UI8dz4s1Aw8+jEHOtERgYE5AZKLW1pJ980IYQG5jTsdlN X-Received: by 2002:a05:6a00:228f:b0:566:6ecd:29d9 with SMTP id f15-20020a056a00228f00b005666ecd29d9mr23642226pfe.62.1666424388904; Sat, 22 Oct 2022 00:39:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666424388; cv=none; d=google.com; s=arc-20160816; b=s/ECOutH9YmCgBWwIKCU+EsIRifh6XtzqDO/ICwEKsip0MwYN4vHmiMiVO0RYsfb/m SbwagUS7PfcoNEYXqdtIfKccvSpyOhSftWvRc1m5dSDiSnsmVzFiTJAqRzRrGOth7+W5 3pzl8G5n/Y1lx6zLTbLnJ2pDH8ceOwLgwYm5M5U+KupHendjDC0bY17jALHZbA5ZAbbv 1YzBnTVQoh1ijsoKKniTEqeW4gYlsThI1FnX9r0/sr3ESsq+ZoKuofLHDyQrZS4O31bQ pF0jnSbbcDTNARMvebLtu/0StqaawJ9dNn1iHh3qS2sTeTM+TUR7yJlJm5CFJz9frAt+ HYdg== 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=DYFMkEqEuQPqiZTlOVkacocWot7TykaL0hyRUIMhThw=; b=dxaQSstO+KqlCGQz+IEzLAKaj0MOwMp6aNlz86ofY1PWP79+nN+36+R7cSABYe3EmI ftrtvkfA+9YG+ZFGi+16cp+tYQ4WuJ8vUyrvpF7jB1e37hpw+CxEbALa+l0ecpsFfV8d cE/vL3wIpJkBHh3Ub/0FTyov8zDeaFuKMP0vjrHlOcI1eAkZjH9jN0CIsF7Kcmq6Rgyg oKm3kv+F24hmJ6X6xZM9NUoT/JvzCu7GAIZxa4slvgmmgS5I5/KhyjGVbQ+q6fjZKl3w ZiDMJJUzQxo8GGyXi0Kq3CEbzHT6fjdjuuUlS5OJGyNgS8I638OgXcmDIIW70ZMWzalN 4LhA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=WESiwq55; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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-20020a1709028f8c00b00178a33faa42si24124670plo.66.2022.10.22.00.39.36; Sat, 22 Oct 2022 00:39: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=WESiwq55; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S230157AbiJVHjJ (ORCPT + 99 others); Sat, 22 Oct 2022 03:39:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48608 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230408AbiJVHhk (ORCPT ); Sat, 22 Oct 2022 03:37:40 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AC35E29069E; Sat, 22 Oct 2022 00:35:56 -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 13F0860AC7; Sat, 22 Oct 2022 07:35:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1230AC433D6; Sat, 22 Oct 2022 07:35:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424155; bh=QISEug/oQPt/cNqoDbsduIJCybvN/wr90v+7N9BYJUc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WESiwq55m6nj8Oqn9HRSQdbaclo19Patq9zf+6FehdbT+LA+IzE5QVbvawAfv7fOO hjHoSOtdm6JGIdjN8OpbW/M8AcOOHFxSL2jhTNDZRzub/u6w971XJ5MpJRufPb6eP3 14Dg6cYy1SJDksy96phoekwdcjpvvc6V6nFKewM0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Krzysztof Kozlowski , Srinivas Kandagatla , Mark Brown Subject: [PATCH 5.19 045/717] ASoC: wcd934x: fix order of Slimbus unprepare/disable Date: Sat, 22 Oct 2022 09:18:44 +0200 Message-Id: <20221022072423.054476624@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747372619715123970?= X-GMAIL-MSGID: =?utf-8?q?1747372619715123970?= From: Krzysztof Kozlowski commit e96bca7eaa5747633ec638b065630ff83728982a upstream. Slimbus streams are first prepared and then enabled, so the cleanup path should reverse it. The unprepare sets stream->num_ports to 0 and frees the stream->ports. Calling disable after unprepare was not really effective (channels was not deactivated) and could lead to further issues due to making transfers on unprepared stream. Fixes: a61f3b4f476e ("ASoC: wcd934x: add support to wcd9340/wcd9341 codec") Cc: Signed-off-by: Krzysztof Kozlowski Reviewed-by: Srinivas Kandagatla Link: https://lore.kernel.org/r/20220921145354.1683791-2-krzysztof.kozlowski@linaro.org Signed-off-by: Mark Brown Signed-off-by: Greg Kroah-Hartman --- sound/soc/codecs/wcd934x.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/sound/soc/codecs/wcd934x.c +++ b/sound/soc/codecs/wcd934x.c @@ -1913,8 +1913,8 @@ static int wcd934x_trigger(struct snd_pc case SNDRV_PCM_TRIGGER_STOP: case SNDRV_PCM_TRIGGER_SUSPEND: case SNDRV_PCM_TRIGGER_PAUSE_PUSH: - slim_stream_unprepare(dai_data->sruntime); slim_stream_disable(dai_data->sruntime); + slim_stream_unprepare(dai_data->sruntime); break; default: break; From patchwork Sat Oct 22 07:18: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: 7167 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1088374wrr; Sat, 22 Oct 2022 00:39:50 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6otrArXo38zxleVY2LhNAx/SgcL0CF/0AAIjBCoEPju4TPLmQCLXXUjpBWQ1t3UOtpkdKU X-Received: by 2002:a65:6e0f:0:b0:43a:1cd4:4ae6 with SMTP id bd15-20020a656e0f000000b0043a1cd44ae6mr19097098pgb.289.1666424389758; Sat, 22 Oct 2022 00:39:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666424389; cv=none; d=google.com; s=arc-20160816; b=ksmgkvYxdCiqbpf6BtG5tmoNQPVt4ArWWbnc8CgcU/S68yKEaz6zliOXxFOGgbi11+ HsHwt3FrdFQ0OuRAxf2Ma7bbSiPKJZgehdfXZb0an+wOJGz1/D9uUMLvLWSLcXer/535 XxsvBMnU8jSGtITRc+n3JVRBFmGqxq4Atc5KDn8aFuBH0HqEZWynA3sDIr+3CbLE65dE d6ftY1UNSOOKDNIm+Fqf72P74KM4xsGIuyF4USpv4ucPMJh3a/+bTaf30e3EzUKGLoj0 bD5bJN938t2FqhxVV/AqpRtNHS7KUOr4u2GXDI6wlexfWmm0hl4UPeXanReiZng+E4sA 7tSA== 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=kAy4NrkKR2QiHW/iYdPqZ67JivxqMxR6zRtn6zBBxY0=; b=0GwpCAVQMMnP4jhjSiLOp/3Fo46NWJcZZ9OzEAFdKkoOF+RSnG8fUokbqEkudrW+W0 ubeDhcZ/H+nINPpuY2lgLgqV+q43uAvRIp7SRfFSBDJgKGc3LS/4mWmBIwHBIpjStX8e 15+7zTJWnXzdZCf32cLiBZ+DgNccT36fhmuJHeku0GSep7DfFFwJ6WsD+VyMkn/rNgfL dY95m9OrflPudczIfzpnYPSiBFTmpfRPJZL73exjHiu3CIrVZ9ldiKEuJ2Ah6x0d/DC6 UKn+uc4ImngLGKsUJDIqvm9Ykw/9quija+MX+yqCMvP9jJ++f3tzzLh9mGouas8FMn/n v0iQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=puq8u2ML; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 w8-20020aa79548000000b00561cb07c77csi27461281pfq.232.2022.10.22.00.39.37; Sat, 22 Oct 2022 00:39: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=puq8u2ML; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S230384AbiJVHjL (ORCPT + 99 others); Sat, 22 Oct 2022 03:39:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46990 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230440AbiJVHii (ORCPT ); Sat, 22 Oct 2022 03:38: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 EE4DB25CDA8; Sat, 22 Oct 2022 00:36: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 0A18660ADD; Sat, 22 Oct 2022 07:36:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1FC1EC433C1; Sat, 22 Oct 2022 07:35:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424159; bh=pz2UwXMRKNrNA4L+NtDLBqs3w52XvYBv/P4Jt38nelM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=puq8u2MLIYdvKdQwLvc8YMM1kEXdx6mkNQYpECwLUd6BQUxYXz3gfyn+ANDsIZTjU pQlniGL1BUlSkFIkP0Gt/yhqLKhshFLaC0pmxDvrITPZRK5KpUaBbAbSuvXTCkFao0 FwawAg9R+h0bb5CabbEr1FapBDqSNbfK8ttfRWmI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Liang He , Mengda Chen , Guenter Roeck Subject: [PATCH 5.19 046/717] hwmon: (gsc-hwmon) Call of_node_get() before of_find_xxx API Date: Sat, 22 Oct 2022 09:18:45 +0200 Message-Id: <20221022072423.257748921@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747372620872960263?= X-GMAIL-MSGID: =?utf-8?q?1747372620872960263?= From: Liang He commit 7f62cf781e6567d59c8935dc8c6068ce2bb904b7 upstream. In gsc_hwmon_get_devtree_pdata(), we should call of_node_get() before the of_find_compatible_node() which will automatically call of_node_put() for the 'from' argument. Fixes: 3bce5377ef66 ("hwmon: Add Gateworks System Controller support") Signed-off-by: Liang He Co-developed-by: Mengda Chen Signed-off-by: Mengda Chen Link: https://lore.kernel.org/r/20220916154708.3084515-1-chenmengda2009@163.com Cc: stable@vger.kernel.org Signed-off-by: Guenter Roeck Signed-off-by: Greg Kroah-Hartman --- drivers/hwmon/gsc-hwmon.c | 1 + 1 file changed, 1 insertion(+) --- a/drivers/hwmon/gsc-hwmon.c +++ b/drivers/hwmon/gsc-hwmon.c @@ -267,6 +267,7 @@ gsc_hwmon_get_devtree_pdata(struct devic pdata->nchannels = nchannels; /* fan controller base address */ + of_node_get(dev->parent->of_node); fan = of_find_compatible_node(dev->parent->of_node, NULL, "gw,gsc-fan"); if (fan && of_property_read_u32(fan, "reg", &pdata->fan_base)) { dev_err(dev, "fan node without base\n"); From patchwork Sat Oct 22 07:18: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: 7168 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1088413wrr; Sat, 22 Oct 2022 00:39:57 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7sH29LMXdxohFoZJiUrZbIEyrjhTQM/+SiYq3IWKwfXNTqvVv4scrQsHUwHZQK1AL4Ltwi X-Received: by 2002:a17:90a:c258:b0:20b:23d5:8eb2 with SMTP id d24-20020a17090ac25800b0020b23d58eb2mr26109651pjx.85.1666424397579; Sat, 22 Oct 2022 00:39:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666424397; cv=none; d=google.com; s=arc-20160816; b=oJZia1GTJJnM+WKiccrSwOTzNXXT63/E5R1H522ikU6AxIoSV+qYVfZTIXSgKYVbPM p3N41CCu1c2QAUxv5AuAsdH4WSTiarQuX5YahlJ8GgshDLTzG+rz2ZV6lRNQp3Z5JjwL y7av0hkjNFkN/NqMsowtEHIygRxHt3VauLs6aUq+dkHDute6TRgLOh0H8V9YEgfw8Tyb I1MKH/oYnQhSxZqDIsi/I67zpWZfFu1Pnx/OvW680r1+OqiMJ6DuUcjZufB3VWzFcAQQ 6V/8cMVG3vkCd4L/NNXP2rLVQ5v+0r6FWzWWo8HCR2wsaNk0R7YReG8sOcVl9C1z0Hai +hEA== 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=uXKqchtCfBTfSsss0+Af3fHqgjk1R3VG8xPchCBv0RU=; b=thv/Bjb0FoAjUwQEzYtdaV5uxWLBmM3dgrcpPl14rv6b1KOaG/5dYDfh11A2i1KrLb 7Df3zbQj1NrixdmI11IrqiQ8Fi3PcuyVraPsqfA8PooE4/6jICJbjND2Klx0wkUu95My c9iOicjS9XnqJGhpRfda5d9lmPJ7AizUETfZVWTViHq1hiC8yhgYE/NUaYAwwq+MTUyi TYLC3Lua/Towv7bzvfYy3CNT86bfxUZf1MY50Vtk9qpmySXU7SHqjsUJyXPDOktPEu7I VIdPqovF6hu4EkTXyQ7UrGSPekRKkf4/DFQXQs1P+0bdfxap9E/oxbShkH4s+frEmHWo wbug== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=GsoShnUt; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 a1-20020a170902ecc100b0017f75341cffsi32446698plh.143.2022.10.22.00.39.45; Sat, 22 Oct 2022 00:39: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=GsoShnUt; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S230343AbiJVHjR (ORCPT + 99 others); Sat, 22 Oct 2022 03:39:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48146 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230454AbiJVHin (ORCPT ); Sat, 22 Oct 2022 03:38:43 -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 5687029B88B; Sat, 22 Oct 2022 00:36: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 A65EFB82D9F; Sat, 22 Oct 2022 07:36:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F27B3C433C1; Sat, 22 Oct 2022 07:36:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424162; bh=qzNPjTgfZEYYgdxUncWZqKaKdlo8w1SbSuDFg3W8BnA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GsoShnUtufvycgSoX6JXO2BrK8EoeZInnkG38/zZ1SXTsVjTtncFZar/bR2Zx84WS R5Pv/NVnJmh9TcBvwlSQmGKARp//8cg69GNrdGkxHELBOVDgIOwfhTIXr0nZ2goy4N GpprgUDy6ReJjUuk2OJ/LVPZAZOqyuXrChvOHNcM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mika Westerberg , "David S. Miller" Subject: [PATCH 5.19 047/717] net: thunderbolt: Enable DMA paths only after rings are enabled Date: Sat, 22 Oct 2022 09:18:46 +0200 Message-Id: <20221022072423.447662635@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747372629358390439?= X-GMAIL-MSGID: =?utf-8?q?1747372629358390439?= From: Mika Westerberg commit ff7cd07f306406493f7b78890475e85b6d0811ed upstream. If the other host starts sending packets early on it is possible that we are still in the middle of populating the initial Rx ring packets to the ring. This causes the tbnet_poll() to mess over the queue and causes list corruption. This happens specifically when connected with macOS as it seems start sending various IP discovery packets as soon as its side of the paths are configured. To prevent this we move the DMA path enabling to happen after we have primed the Rx ring. This makes sure no incoming packets can arrive before we are ready to handle them. Fixes: e69b6c02b4c3 ("net: Add support for networking over Thunderbolt cable") Cc: stable@vger.kernel.org Signed-off-by: Mika Westerberg Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- drivers/net/thunderbolt.c | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) --- a/drivers/net/thunderbolt.c +++ b/drivers/net/thunderbolt.c @@ -612,18 +612,13 @@ static void tbnet_connected_work(struct return; } - /* Both logins successful so enable the high-speed DMA paths and - * start the network device queue. + /* Both logins successful so enable the rings, high-speed DMA + * paths and start the network device queue. + * + * Note we enable the DMA paths last to make sure we have primed + * the Rx ring before any incoming packets are allowed to + * arrive. */ - ret = tb_xdomain_enable_paths(net->xd, net->local_transmit_path, - net->rx_ring.ring->hop, - net->remote_transmit_path, - net->tx_ring.ring->hop); - if (ret) { - netdev_err(net->dev, "failed to enable DMA paths\n"); - return; - } - tb_ring_start(net->tx_ring.ring); tb_ring_start(net->rx_ring.ring); @@ -635,10 +630,21 @@ static void tbnet_connected_work(struct if (ret) goto err_free_rx_buffers; + ret = tb_xdomain_enable_paths(net->xd, net->local_transmit_path, + net->rx_ring.ring->hop, + net->remote_transmit_path, + net->tx_ring.ring->hop); + if (ret) { + netdev_err(net->dev, "failed to enable DMA paths\n"); + goto err_free_tx_buffers; + } + netif_carrier_on(net->dev); netif_start_queue(net->dev); return; +err_free_tx_buffers: + tbnet_free_buffers(&net->tx_ring); err_free_rx_buffers: tbnet_free_buffers(&net->rx_ring); err_stop_rings: From patchwork Sat Oct 22 07:18: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: 7169 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1088445wrr; Sat, 22 Oct 2022 00:40:02 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6ps5fAy89AGaqyccow5tXKDfDXIl1NaPiuXaGaCadel8ZcmXNfdnVpRbWeKSnzjHZGg9Wb X-Received: by 2002:a05:6a00:a04:b0:534:d8a6:40ce with SMTP id p4-20020a056a000a0400b00534d8a640cemr23678277pfh.15.1666424402704; Sat, 22 Oct 2022 00:40:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666424402; cv=none; d=google.com; s=arc-20160816; b=oYCzLTQsfKcQWh8iNUULVdEEAdctiD5552HyqIIxqyXAHfzgGEdy7vSFUOCBTouc2D j9yISZajZ9WtwhwUrap9ZNVIkbFLnqE6YkTNppuHFa/hZRKwJ0ReDgjdrSfXW7W9G+o8 Swwu5qnIcxgEiUA/95knAhWCjq+n0nuQ4KaYJaOQw7XoZhketKAXr7VvUh7eFbRDSUwi nA4eMvZWYGwjf5Jm4usDNjEO95n6eKDFPkkVzxFqJ2vhDcdKbmI+ugw6N1BSSrvTrFjj ieF6SErb6FhGMtwa2onubzqGQ+iKZP2hA7ID0YcXGAQCCYN9Dj/eqXEe0Rims3NANOgT T/OQ== 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=e0oyloDANX4qZ7yYao6NhCN7UInk2+mtNG14rMuVRw8=; b=PQyQhb5jdp0xdNV7qB42Xz9Eucp17MLy/zAQI4TELbUA3tTgX1319NgSsjzRMFUBzK fPL1SuK8W6WtNqKlOdsClfUqJxrNGfcLV7ijyneYiYZcPsOQgYWOq1rR0ImAEqTDPdxQ EHVhS32uSbZVut1SD/v5s7NlfCqYsHeryvFiGDfr+sxdUnnt0J3rPxpPOeA7/K+VEFnY ze4WPz6qNH0/5+RV/LXZvjcQP5sd+GRV+ZyhExgrMZYM1A4Ihan80g7ex1Gr63IpvVk7 ltBjUK2DYkPlbsDXl0xpPazufYWtAzpLtKO1TPJooE/sXmLfjtFjQmkyXpgt5fzhLtzM mNAg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=HuaWQZEM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 h6-20020a056a00218600b0056aafb43783si4822205pfi.155.2022.10.22.00.39.48; Sat, 22 Oct 2022 00:40: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=HuaWQZEM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S230447AbiJVHjV (ORCPT + 99 others); Sat, 22 Oct 2022 03:39:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51668 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230455AbiJVHin (ORCPT ); Sat, 22 Oct 2022 03:38: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 5701A29B89B; Sat, 22 Oct 2022 00:36: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 A601560ADA; Sat, 22 Oct 2022 07:36:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BE175C433D7; Sat, 22 Oct 2022 07:36:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424165; bh=beAhWKXvQm9GjdNfxG+/MZqHkyVEr24AhaspX2hWJsw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HuaWQZEMPqrpPB8WGKJBiNv6XZqXhz1dsXG9OzDhH3L5wL/MK2qVkWtLl5jQjkiR5 eojBel5C6jA02a+r4/CYVJ4aQs+H46hY5VRZ3f1+A9Hn+7r8V5yn5H5znTMZg6j1HP vUiGm0oSHKt66JIU0DYAovNjOe7yqEqYEIQS1xU8= 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 5.19 048/717] regulator: qcom_rpm: Fix circular deferral regression Date: Sat, 22 Oct 2022 09:18:47 +0200 Message-Id: <20221022072423.637828474@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747372634562547595?= X-GMAIL-MSGID: =?utf-8?q?1747372634562547595?= 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 @@ -802,6 +802,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" }, @@ -829,12 +835,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" }, @@ -843,6 +843,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" }, @@ -851,12 +857,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 Sat Oct 22 07:18: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: 7172 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1088517wrr; Sat, 22 Oct 2022 00:40:16 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5QlTdOsE9gtM3i1m3bWNFAV1OJyx+JCWNHtESHPt5Q3C93Ey/UkjjEA+ROEDDcY9X6nYju X-Received: by 2002:a05:6a00:2906:b0:52a:bc7f:f801 with SMTP id cg6-20020a056a00290600b0052abc7ff801mr23692507pfb.49.1666424416583; Sat, 22 Oct 2022 00:40:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666424416; cv=none; d=google.com; s=arc-20160816; b=HLEJFXUenZHsyO+pffdioswFJnfwHDNVFfPeWPsR+Y/Uu3DSBR1yVhsNfqoPG+FIUl Dj+kaCDkFcyZ6LC85XMcThCnspcU4j2NNlteDPlptqOi9TWjkcYLb1F89GgDQAuyztxx 6mj0FlOK30II2Mjd6mhKzoOlAoAWev8Wruj+NfpjRFJqZ4N0bbbZYXYm2V3KumCUq3D6 j3OQBH3o+8lHdJK1/zMzMuGecwWUXb73I23/mNDEMltLxxNJA8IbLQtF0qNa3WoEYjbm uoNis5eAOR6FL9rLy50tKfg5aoIUhRWT0MStg4duSt7WnFuEqwnQOk9IUKHZWcfLK46L X9ew== 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=dxzoifxGbZvVhUEGOgVwMXE1xNwMPdeSxSQR2oxXbuA=; b=HBrm+n7CZkQQ9/LdfqGpDvErf5pDVwaPngW0zQZJXGfqiDmMDI/gM28VDnD4ru0TXF L9YIRLpp+NMtk/Kk2USb8VNOI13Cz9czzbG5vBUnXWRFWAq3XyAjHGgq1d2++uKCFu7G 0Awk/TR9HSUsKLwd47K0bkIxpnuVQTODbqtoC1/YiN9BF3CEaaQiNpTTy3SYpF0RjnNE 7Vuwc871S9at32Xw6aQdZ1Rm8nFJcbM9H8Yl6xJxaWE2qAZ7uZaiSFIBqG7XEWfVvbh5 0SasxU755ci4GrLV6/ToW3ma8Kgvh9ctxZDnZze2Cr8Uc+al2yA1oQIhEwfLwDjtjjGt vYdQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="IVWkqib/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 y12-20020a1709027c8c00b001769e71398csi25111244pll.340.2022.10.22.00.40.04; Sat, 22 Oct 2022 00:40: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="IVWkqib/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231137AbiJVHjq (ORCPT + 99 others); Sat, 22 Oct 2022 03:39:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49730 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230473AbiJVHjB (ORCPT ); Sat, 22 Oct 2022 03:39:01 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 79A3429C4AA; Sat, 22 Oct 2022 00:36: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 A9B3C60AE6; Sat, 22 Oct 2022 07:36:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9A71CC433C1; Sat, 22 Oct 2022 07:36:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424168; bh=ZgtsA7uhgYQY0cLa9bVr9Xj0WekQOGNPc4X55m/AVGY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IVWkqib/ml8RMGgRTaZ1XzDf+6r28GXfUoFXe8X2Q2YuHeqo1oKlJrPaA5uxEmDjU thXgeZ45W1pYB5hJQa+oK83E+yFt9cqPK9fJ6/FSCzwF89ggnnFJg9tVhQOR8kjkvE 1S/tkXtpmK70+DMQDpaR0H2vRrf0PwYWo9s8G+dU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sudeep Holla , Catalin Marinas , Atish Patra , Conor Dooley Subject: [PATCH 5.19 049/717] arm64: topology: move store_cpu_topology() to shared code Date: Sat, 22 Oct 2022 09:18:48 +0200 Message-Id: <20221022072423.804804782@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747372648707798663?= X-GMAIL-MSGID: =?utf-8?q?1747372648707798663?= From: Conor Dooley commit 456797da792fa7cbf6698febf275fe9b36691f78 upstream. arm64's method of defining a default cpu topology requires only minimal changes to apply to RISC-V also. The current arm64 implementation exits early in a uniprocessor configuration by reading MPIDR & claiming that uniprocessor can rely on the default values. This is appears to be a hangover from prior to '3102bc0e6ac7 ("arm64: topology: Stop using MPIDR for topology information")', because the current code just assigns default values for multiprocessor systems. With the MPIDR references removed, store_cpu_topolgy() can be moved to the common arch_topology code. Reviewed-by: Sudeep Holla Acked-by: Catalin Marinas Reviewed-by: Atish Patra Signed-off-by: Conor Dooley Signed-off-by: Greg Kroah-Hartman --- arch/arm64/kernel/topology.c | 40 ---------------------------------------- drivers/base/arch_topology.c | 19 +++++++++++++++++++ 2 files changed, 19 insertions(+), 40 deletions(-) --- a/arch/arm64/kernel/topology.c +++ b/arch/arm64/kernel/topology.c @@ -22,46 +22,6 @@ #include #include -void store_cpu_topology(unsigned int cpuid) -{ - struct cpu_topology *cpuid_topo = &cpu_topology[cpuid]; - u64 mpidr; - - if (cpuid_topo->package_id != -1) - goto topology_populated; - - mpidr = read_cpuid_mpidr(); - - /* Uniprocessor systems can rely on default topology values */ - if (mpidr & MPIDR_UP_BITMASK) - return; - - /* - * This would be the place to create cpu topology based on MPIDR. - * - * However, it cannot be trusted to depict the actual topology; some - * pieces of the architecture enforce an artificial cap on Aff0 values - * (e.g. GICv3's ICC_SGI1R_EL1 limits it to 15), leading to an - * artificial cycling of Aff1, Aff2 and Aff3 values. IOW, these end up - * having absolutely no relationship to the actual underlying system - * topology, and cannot be reasonably used as core / package ID. - * - * If the MT bit is set, Aff0 *could* be used to define a thread ID, but - * we still wouldn't be able to obtain a sane core ID. This means we - * need to entirely ignore MPIDR for any topology deduction. - */ - cpuid_topo->thread_id = -1; - cpuid_topo->core_id = cpuid; - cpuid_topo->package_id = cpu_to_node(cpuid); - - pr_debug("CPU%u: cluster %d core %d thread %d mpidr %#016llx\n", - cpuid, cpuid_topo->package_id, cpuid_topo->core_id, - cpuid_topo->thread_id, mpidr); - -topology_populated: - update_siblings_masks(cpuid); -} - #ifdef CONFIG_ACPI static bool __init acpi_cpu_is_threaded(int cpu) { --- a/drivers/base/arch_topology.c +++ b/drivers/base/arch_topology.c @@ -791,4 +791,23 @@ void __init init_cpu_topology(void) else if (of_have_populated_dt() && parse_dt_topology()) reset_cpu_topology(); } + +void store_cpu_topology(unsigned int cpuid) +{ + struct cpu_topology *cpuid_topo = &cpu_topology[cpuid]; + + if (cpuid_topo->package_id != -1) + goto topology_populated; + + cpuid_topo->thread_id = -1; + cpuid_topo->core_id = cpuid; + cpuid_topo->package_id = cpu_to_node(cpuid); + + pr_debug("CPU%u: package %d core %d thread %d\n", + cpuid, cpuid_topo->package_id, cpuid_topo->core_id, + cpuid_topo->thread_id); + +topology_populated: + update_siblings_masks(cpuid); +} #endif From patchwork Sat Oct 22 07:18: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: 7173 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1088522wrr; Sat, 22 Oct 2022 00:40:18 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5NFaCnT86hDz98smgDaXXXbxWSMo0rNGtp36gX7JzMQ4jWWNM2irIpqtvdA/akQ/wdq5Ct X-Received: by 2002:a17:903:1110:b0:178:9f67:b524 with SMTP id n16-20020a170903111000b001789f67b524mr23499605plh.50.1666424418120; Sat, 22 Oct 2022 00:40:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666424418; cv=none; d=google.com; s=arc-20160816; b=vxUNfcii7jT7A8QH6Sc3MpDV8PkecB33TXuMdBeYQH7BG/KWhMx2swNAaloim7JEwr J9PCK7yw0b1JSi2Nji0bC/y+RY3CPYs4reaVD74Fm+XMIiF431ZU3vHr2/pQ8THML3fv CKQOwCOjnWjlsPRpiZhAbPjV1skfdUOh7MsOAmyGraiUtB0i+eD07nd+0KWgvgrcayu9 cqMzGh0fv+eFb6+uiDUYPyRLgDAgGOBSCIesEjvD+p7X4foe8TORwlkyTARorcJGX355 5GdXXAJHpZ5kNiOIQu5ot1htbw+zsgiNZvCrj+aepdQ658ekvPPX7c1/59krCnNzLV0C E6ng== 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/kxpKOZQLrI7gvn8ngNudVJwJgXTOJfaF7uDHm6rMg=; b=DuRIj9QjkL4OfJiJDD2Jp3JkUrDKI3fbEqIcLls3gZ2/VLOCFhe8ymi7SzCIkZZmVw YJjipMGM/qrvUcDuci9uHylwtET3K/r5rTkp6hdZgDyOjbad3wLQ+fuE1SJKjU8tR4Ab l47UpvuKu1vHHHEzPz2+yUrooDRfkW2lAIWIlPn5Fuv0r+GH1V/uO+hWaz33PePx04Nf 9xXo2aEZ4q/NQvHKcqk50g0eji6f2+c9QKGwaMjpZHfXTzSsf2k6gY0m41YnKflEw33R rWcWwIMYGl3xkfi/31FodSFLDJ9Mt9PH3EpMVPVwIbOixBaFlbl38hCbcsyJ7OZcufEk lRzg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=HXE815gp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 g5-20020a056a0023c500b00562040a507asi30678574pfc.85.2022.10.22.00.40.05; Sat, 22 Oct 2022 00:40: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=HXE815gp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231146AbiJVHju (ORCPT + 99 others); Sat, 22 Oct 2022 03:39:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52522 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230468AbiJVHiw (ORCPT ); Sat, 22 Oct 2022 03:38:52 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4744429F66C; Sat, 22 Oct 2022 00:36: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 27F3AB82DB2; Sat, 22 Oct 2022 07:36:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 89947C433C1; Sat, 22 Oct 2022 07:36:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424173; bh=GGLjFMYoJGfidgbt/07BvGlVlVrcFtoL5SxMq3ZmWTQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HXE815gpEaUtvVP+RofFO1KWzz5vTm6VDo2uifXT7TSqHmhdHvVvc40HHDKLygJv2 9wKo6BVb3hwkjBXAtRaslOXoHcBkym5r5boPKCIz2VJd8fk23dX42E8MawC5fIFzkZ G1X9sQzBfiSSY0MRp5go5Xz2ppngUKV0dXeR0TuU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Brice Goglin , Sudeep Holla , Atish Patra , Conor Dooley Subject: [PATCH 5.19 050/717] riscv: topology: fix default topology reporting Date: Sat, 22 Oct 2022 09:18:49 +0200 Message-Id: <20221022072423.955103270@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747372650797175554?= X-GMAIL-MSGID: =?utf-8?q?1747372650797175554?= From: Conor Dooley commit fbd92809997a391f28075f1c8b5ee314c225557c upstream. RISC-V has no sane defaults to fall back on where there is no cpu-map in the devicetree. Without sane defaults, the package, core and thread IDs are all set to -1. This causes user-visible inaccuracies for tools like hwloc/lstopo which rely on the sysfs cpu topology files to detect a system's topology. On a PolarFire SoC, which should have 4 harts with a thread each, lstopo currently reports: Machine (793MB total) Package L#0 NUMANode L#0 (P#0 793MB) Core L#0 L1d L#0 (32KB) + L1i L#0 (32KB) + PU L#0 (P#0) L1d L#1 (32KB) + L1i L#1 (32KB) + PU L#1 (P#1) L1d L#2 (32KB) + L1i L#2 (32KB) + PU L#2 (P#2) L1d L#3 (32KB) + L1i L#3 (32KB) + PU L#3 (P#3) Adding calls to store_cpu_topology() in {boot,smp} hart bringup code results in the correct topolgy being reported: Machine (793MB total) Package L#0 NUMANode L#0 (P#0 793MB) L1d L#0 (32KB) + L1i L#0 (32KB) + Core L#0 + PU L#0 (P#0) L1d L#1 (32KB) + L1i L#1 (32KB) + Core L#1 + PU L#1 (P#1) L1d L#2 (32KB) + L1i L#2 (32KB) + Core L#2 + PU L#2 (P#2) L1d L#3 (32KB) + L1i L#3 (32KB) + Core L#3 + PU L#3 (P#3) CC: stable@vger.kernel.org # 456797da792f: arm64: topology: move store_cpu_topology() to shared code Fixes: 03f11f03dbfe ("RISC-V: Parse cpu topology during boot.") Reported-by: Brice Goglin Link: https://github.com/open-mpi/hwloc/issues/536 Reviewed-by: Sudeep Holla Reviewed-by: Atish Patra Signed-off-by: Conor Dooley Signed-off-by: Greg Kroah-Hartman --- arch/riscv/Kconfig | 2 +- arch/riscv/kernel/smpboot.c | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) --- a/arch/riscv/Kconfig +++ b/arch/riscv/Kconfig @@ -52,7 +52,7 @@ config RISCV select COMMON_CLK select CPU_PM if CPU_IDLE select EDAC_SUPPORT - select GENERIC_ARCH_TOPOLOGY if SMP + select GENERIC_ARCH_TOPOLOGY select GENERIC_ATOMIC64 if !64BIT select GENERIC_CLOCKEVENTS_BROADCAST if SMP select GENERIC_EARLY_IOREMAP --- a/arch/riscv/kernel/smpboot.c +++ b/arch/riscv/kernel/smpboot.c @@ -49,6 +49,7 @@ void __init smp_prepare_cpus(unsigned in unsigned int curr_cpuid; curr_cpuid = smp_processor_id(); + store_cpu_topology(curr_cpuid); numa_store_cpu_info(curr_cpuid); numa_add_cpu(curr_cpuid); @@ -161,9 +162,9 @@ asmlinkage __visible void smp_callin(voi mmgrab(mm); current->active_mm = mm; + store_cpu_topology(curr_cpuid); notify_cpu_starting(curr_cpuid); numa_add_cpu(curr_cpuid); - update_siblings_masks(curr_cpuid); set_cpu_online(curr_cpuid, 1); /* From patchwork Sat Oct 22 07:18: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: 7171 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1088493wrr; Sat, 22 Oct 2022 00:40:13 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4Eki3tdalBjDnXW2f9bdjGkP9zD5DfPSRw2KxJ3re56tbzsYYpBV8/npIxitZidlz9JCbp X-Received: by 2002:a63:1e47:0:b0:43c:261f:f773 with SMTP id p7-20020a631e47000000b0043c261ff773mr19749440pgm.1.1666424413026; Sat, 22 Oct 2022 00:40:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666424413; cv=none; d=google.com; s=arc-20160816; b=Ejt7/cb3flsVD5FuCacDnlZNKuYTYaNruYtKKI7FsHAc+E7TnKxtS0/peDWGA9AztZ QwMjv/tz6tUUIGvVIM7y8/tNzWB29TC30dp16hTaftkIP9V+VnJ9pYwYNQXJeYtgxSHd g2hDxGw2XN3HWaCw0W66aNBH2Q7W0An94L2cBtXo6FHN0HRQmLdkJ0zXT+9TTt4ro/PB 6iWN/89y8LfFS605yfZdvJ7PJr85+k3c816dX+w0YiPeLEgTvxQgd7jrI89ZEfUdl+ON cdqwrv318N6Sy1km6QMc7OzWDZN2hzOvkIpdyBniQgnd4pUPLvLSPTNV7OsyJj15961t qefQ== 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=yZyt8OX2aLUrybbW6T6vV8l8c2Wacsh1wbEFam1YI2g=; b=VACFphJOnYG6ZaVVm2sdN0OmVc4Ze41nsSlSHIrPvn0c/uwTfZB+jwqURUXjXEcKCi UItFs+PICNmEUBNbtJ7CTOjq3Numb70ZGy1xismkGMJbWWVs8aXDarXzpvpDzGWnj1xx g8kwjr6DjLrR5uB3thINHahyp2Lkv9WR6w/OwUrvrcm6FL6+yI8RvTwG8FRUx+Ccm3Pj CGCznP/KGFSCs9HOoq1UmnZ4X/ASOSgq0N0vBLxAPiOoMZVRuXEX1KGNpY+wlf1aMh7q sdLxFhBHSdqNfNsElz2Td5ZHNthHkrIgoAmSfDMJZkNDIkpYSlj9Gxl+W2J1vNL1mULX nnOg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=AaKUhQWO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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-20020a6306d7000000b00460dd0eed0csi29266255pgg.176.2022.10.22.00.40.00; Sat, 22 Oct 2022 00:40: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=AaKUhQWO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S230495AbiJVHjn (ORCPT + 99 others); Sat, 22 Oct 2022 03:39:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48682 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230477AbiJVHjD (ORCPT ); Sat, 22 Oct 2022 03:39: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 2E8222A4387; Sat, 22 Oct 2022 00:36: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 21F3FB82D9F; Sat, 22 Oct 2022 07:36:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 83146C433D7; Sat, 22 Oct 2022 07:36:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424176; bh=mGRauISegIPrTXzdB7pt9upnSHpoEpaDkcfpDRK+yts=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AaKUhQWOqjkb0Q7QLosuaicV8YBBULk/KR/XIqXpHWy72dU4MIX1ME/LMuIV8KWmB ktM5c6yXiziWTnaVUbgqrHUQ0K8z0+mIsndJbEyq+GZ2BNYmCbGm/o8sZkCKjrpzuT bgsIWmAi/6D2ybZxK3JJBCfIUf2QV8yQV6Rupfao= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Conor Dooley , Palmer Dabbelt Subject: [PATCH 5.19 051/717] RISC-V: Re-enable counter access from userspace Date: Sat, 22 Oct 2022 09:18:50 +0200 Message-Id: <20221022072424.147975123@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747372645313869751?= X-GMAIL-MSGID: =?utf-8?q?1747372645313869751?= From: Palmer Dabbelt commit 5a5294fbe0200d1327f0e089135dad77b45aa2ee upstream. These counters were part of the ISA when we froze the uABI, removing them breaks userspace. Link: https://lore.kernel.org/all/YxEhC%2FmDW1lFt36J@aurel32.net/ Fixes: e9991434596f ("RISC-V: Add perf platform driver based on SBI PMU extension") Tested-by: Conor Dooley Reviewed-by: Conor Dooley Link: https://lore.kernel.org/r/20220928131807.30386-1-palmer@rivosinc.com Cc: stable@vger.kernel.org Signed-off-by: Palmer Dabbelt Signed-off-by: Greg Kroah-Hartman --- drivers/perf/riscv_pmu_sbi.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) --- a/drivers/perf/riscv_pmu_sbi.c +++ b/drivers/perf/riscv_pmu_sbi.c @@ -639,8 +639,11 @@ static int pmu_sbi_starting_cpu(unsigned struct riscv_pmu *pmu = hlist_entry_safe(node, struct riscv_pmu, node); struct cpu_hw_events *cpu_hw_evt = this_cpu_ptr(pmu->hw_events); - /* Enable the access for TIME csr only from the user mode now */ - csr_write(CSR_SCOUNTEREN, 0x2); + /* + * Enable the access for CYCLE, TIME, and INSTRET CSRs from userspace, + * as is necessary to maintain uABI compatibility. + */ + csr_write(CSR_SCOUNTEREN, 0x7); /* Stop all the counters so that they can be enabled from perf */ pmu_sbi_stop_all(pmu); From patchwork Sat Oct 22 07:18: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: 7175 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1088596wrr; Sat, 22 Oct 2022 00:40:36 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5IR6HCI38is7coS0Oim4RHwWPfjZZw5I1ImfsEL3K5K/yhDgSNfpZo5E4tjEgK8fY4zYYH X-Received: by 2002:a17:903:189:b0:183:7473:57f1 with SMTP id z9-20020a170903018900b00183747357f1mr21996938plg.28.1666424436613; Sat, 22 Oct 2022 00:40:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666424436; cv=none; d=google.com; s=arc-20160816; b=PeJCAn9wboO8+uDE8qyIivc3aC4N4cBD+wSEc7CBeJRmp9uLoy1IPfi429unL6pvBJ e+wd7YpDAcTjispr+dCVwpWMSMD9waudgJeZ12SkuOUBBKDesldrpwSRxCpkveZQPqW3 ZpXVZAy824YfyqxtND6eHXTNqw6ztmLZC9vasq1g80kBFIqrpRsFohGKLCE48Pu+Ti6j YY7kQ/Cxe/5e1dqDZEgz7VlhURRWFcI5Ygp8XZ2Kz4ER1cudxUk48Gxko6U66ztA9h6e 5x2j11P6p/vHyALQyeVYL2onWAnIgD4+Z9ioKGhc8MLyfl6hBL0WbidiFhPYXXu/lR+l fNKw== 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=0kv6cKgPHmHdPEBX0NttZpZ4pqU7Dh3TYoY5pk/re3c=; b=jylyyEkRtwZ1G/rczT0eW04JEs/wwCZPldArfvNieD7m99gn8lIpvdRjaWlQ08UNvM jZdIUmw+Qvp/m3HrihnI1Y+FdBeAKFsli394awWEoe4sweaDLy8q+fIow+B9hMS1f2nP tIzHnANk8wF45yBto22C+jYVPe+Q7SjryC/o8DfBOfBV2nAujthRa48rVHWoxHCbZmzI e5FJnPmEF4a1IdoFVnqxvefegNUJDZgGFhQM7i9xNAeH9+Wkv7RtxyztDiHYoenwtuiE 0+nY0GlKiGeUcPQYRq5ws05ZtKPeD9e707AiCPIgc8FPyhSp/U2JktzAp4M4P1X0mYcS Iu9A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ndsGSQEz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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-20020a6555cc000000b0041cefab5b61si29185730pgs.719.2022.10.22.00.40.22; Sat, 22 Oct 2022 00:40: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=ndsGSQEz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S230076AbiJVHjy (ORCPT + 99 others); Sat, 22 Oct 2022 03:39:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50062 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230515AbiJVHjH (ORCPT ); Sat, 22 Oct 2022 03:39:07 -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 8F1D72AA142; Sat, 22 Oct 2022 00:36:25 -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 39A75B82DE2; Sat, 22 Oct 2022 07:36:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8A7B7C433C1; Sat, 22 Oct 2022 07:36:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424180; bh=SlhrStvTgx3c8uQcJilQEUVVLx+czvdw+gcouuyd9TU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ndsGSQEz1d//lmE5iuFUJG+RM8VBo+MDb9PFbbmh6dsFtbkb+HRUT/4qOBUCuxFaJ xpLEYXJiLMSvN76PSX0cWn9Dud0uMdwiiUFnvwGBjVuy1hEmfoAiRFC3BifoiH9BjL Ncrg6wn9+vsZMGyNKhGQCTU9em7z1Wt0oM4AbLWs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Maciej W. Rozycki" , Arnd Bergmann , Palmer Dabbelt Subject: [PATCH 5.19 052/717] RISC-V: Make port I/O string accessors actually work Date: Sat, 22 Oct 2022 09:18:51 +0200 Message-Id: <20221022072424.313129964@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747372669826583855?= X-GMAIL-MSGID: =?utf-8?q?1747372669826583855?= From: Maciej W. Rozycki commit 9cc205e3c17d5716da7ebb7fa0c985555e95d009 upstream. Fix port I/O string accessors such as `insb', `outsb', etc. which use the physical PCI port I/O address rather than the corresponding memory mapping to get at the requested location, which in turn breaks at least accesses made by our parport driver to a PCIe parallel port such as: PCI parallel port detected: 1415:c118, I/O at 0x1000(0x1008), IRQ 20 parport0: PC-style at 0x1000 (0x1008), irq 20, using FIFO [PCSPP,TRISTATE,COMPAT,EPP,ECP] causing a memory access fault: Unable to handle kernel access to user memory without uaccess routines at virtual address 0000000000001008 Oops [#1] Modules linked in: CPU: 1 PID: 350 Comm: cat Not tainted 6.0.0-rc2-00283-g10d4879f9ef0-dirty #23 Hardware name: SiFive HiFive Unmatched A00 (DT) epc : parport_pc_fifo_write_block_pio+0x266/0x416 ra : parport_pc_fifo_write_block_pio+0xb4/0x416 epc : ffffffff80542c3e ra : ffffffff80542a8c sp : ffffffd88899fc60 gp : ffffffff80fa2700 tp : ffffffd882b1e900 t0 : ffffffd883d0b000 t1 : ffffffffff000002 t2 : 4646393043330a38 s0 : ffffffd88899fcf0 s1 : 0000000000001000 a0 : 0000000000000010 a1 : 0000000000000000 a2 : ffffffd883d0a010 a3 : 0000000000000023 a4 : 00000000ffff8fbb a5 : ffffffd883d0a001 a6 : 0000000100000000 a7 : ffffffc800000000 s2 : ffffffffff000002 s3 : ffffffff80d28880 s4 : ffffffff80fa1f50 s5 : 0000000000001008 s6 : 0000000000000008 s7 : ffffffd883d0a000 s8 : 0004000000000000 s9 : ffffffff80dc1d80 s10: ffffffd8807e4000 s11: 0000000000000000 t3 : 00000000000000ff t4 : 393044410a303930 t5 : 0000000000001000 t6 : 0000000000040000 status: 0000000200000120 badaddr: 0000000000001008 cause: 000000000000000f [] parport_pc_compat_write_block_pio+0xfe/0x200 [] parport_write+0x46/0xf8 [] lp_write+0x158/0x2d2 [] vfs_write+0x8e/0x2c2 [] ksys_write+0x52/0xc2 [] sys_write+0xe/0x16 [] ret_from_syscall+0x0/0x2 ---[ end trace 0000000000000000 ]--- For simplicity address the problem by adding PCI_IOBASE to the physical address requested in the respective wrapper macros only, observing that the raw accessors such as `__insb', `__outsb', etc. are not supposed to be used other than by said macros. Remove the cast to `long' that is no longer needed on `addr' now that it is used as an offset from PCI_IOBASE and add parentheses around `addr' needed for predictable evaluation in macro expansion. No need to make said adjustments in separate changes given that current code is gravely broken and does not ever work. Signed-off-by: Maciej W. Rozycki Fixes: fab957c11efe2 ("RISC-V: Atomic and Locking Code") Cc: stable@vger.kernel.org # v4.15+ Reviewed-by: Arnd Bergmann Link: https://lore.kernel.org/r/alpine.DEB.2.21.2209220223080.29493@angie.orcam.me.uk Signed-off-by: Palmer Dabbelt Signed-off-by: Greg Kroah-Hartman --- arch/riscv/include/asm/io.h | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) --- a/arch/riscv/include/asm/io.h +++ b/arch/riscv/include/asm/io.h @@ -101,9 +101,9 @@ __io_reads_ins(reads, u32, l, __io_br(), __io_reads_ins(ins, u8, b, __io_pbr(), __io_par(addr)) __io_reads_ins(ins, u16, w, __io_pbr(), __io_par(addr)) __io_reads_ins(ins, u32, l, __io_pbr(), __io_par(addr)) -#define insb(addr, buffer, count) __insb((void __iomem *)(long)addr, buffer, count) -#define insw(addr, buffer, count) __insw((void __iomem *)(long)addr, buffer, count) -#define insl(addr, buffer, count) __insl((void __iomem *)(long)addr, buffer, count) +#define insb(addr, buffer, count) __insb(PCI_IOBASE + (addr), buffer, count) +#define insw(addr, buffer, count) __insw(PCI_IOBASE + (addr), buffer, count) +#define insl(addr, buffer, count) __insl(PCI_IOBASE + (addr), buffer, count) __io_writes_outs(writes, u8, b, __io_bw(), __io_aw()) __io_writes_outs(writes, u16, w, __io_bw(), __io_aw()) @@ -115,22 +115,22 @@ __io_writes_outs(writes, u32, l, __io_bw __io_writes_outs(outs, u8, b, __io_pbw(), __io_paw()) __io_writes_outs(outs, u16, w, __io_pbw(), __io_paw()) __io_writes_outs(outs, u32, l, __io_pbw(), __io_paw()) -#define outsb(addr, buffer, count) __outsb((void __iomem *)(long)addr, buffer, count) -#define outsw(addr, buffer, count) __outsw((void __iomem *)(long)addr, buffer, count) -#define outsl(addr, buffer, count) __outsl((void __iomem *)(long)addr, buffer, count) +#define outsb(addr, buffer, count) __outsb(PCI_IOBASE + (addr), buffer, count) +#define outsw(addr, buffer, count) __outsw(PCI_IOBASE + (addr), buffer, count) +#define outsl(addr, buffer, count) __outsl(PCI_IOBASE + (addr), buffer, count) #ifdef CONFIG_64BIT __io_reads_ins(reads, u64, q, __io_br(), __io_ar(addr)) #define readsq(addr, buffer, count) __readsq(addr, buffer, count) __io_reads_ins(ins, u64, q, __io_pbr(), __io_par(addr)) -#define insq(addr, buffer, count) __insq((void __iomem *)addr, buffer, count) +#define insq(addr, buffer, count) __insq(PCI_IOBASE + (addr), buffer, count) __io_writes_outs(writes, u64, q, __io_bw(), __io_aw()) #define writesq(addr, buffer, count) __writesq(addr, buffer, count) __io_writes_outs(outs, u64, q, __io_pbr(), __io_paw()) -#define outsq(addr, buffer, count) __outsq((void __iomem *)addr, buffer, count) +#define outsq(addr, buffer, count) __outsq(PCI_IOBASE + (addr), buffer, count) #endif #include From patchwork Sat Oct 22 07:18: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: 7174 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1088587wrr; Sat, 22 Oct 2022 00:40:36 -0700 (PDT) X-Google-Smtp-Source: AMsMyM51os+wYQkgbEeZkmjzifJei+oRpVxWrcWz4xBkAGRdg2qMt8ZSSNM8s7QHwKQOnuCBW9VA X-Received: by 2002:a05:6a00:198f:b0:56b:95aa:3952 with SMTP id d15-20020a056a00198f00b0056b95aa3952mr394282pfl.20.1666424435774; Sat, 22 Oct 2022 00:40:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666424435; cv=none; d=google.com; s=arc-20160816; b=xaI+FmnsJBU2AO57ZEf4OWNanMiURPBL3qWK5aEi/8BVf1mwHwWK7/2H54QwW2GBZS mCI231QI0s6K/Y09gzUn2tDUrH1upx5an0qn9yNvFmhmMY+LVQ0cPQZWUUFuOihWV93h dzi0PLFtdur+p7WHKmaMslVFjfxjpfX6e6S7MIw5Q790NJiDWVu2BEPW0mo/BWEB2Ftc e4ZkOhK/ku1cnX5HMGzryThdIB8IgsWcFvYcs07sB+vifRc3/eBgrf8EVwis+PawSSSd xsCE2Ka8RZlQXDP9QKVTtv511wXDWyQ5Qq08OMcnxD2DcpM3s3ojH6uL1K5MN+oM37Qw GJwA== 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=hBOXftv2TRYcUUsb8yOfh9Dw6hTrr1Ks6JvwCRYYDtY=; b=svW0L6/V0aUWWC0letHevdjvwN58f+qF3ALgGZm85VmxdCqwcrZLPjlP/cIBryrQMN cvK7q9d2PZuoIONgpcDOuq7AaQrp+FwwVImC7/tgdk+ohA/HheThsLvuCa8VSAh3OdNw rvVQnAoYd066GmycYa5wyRHcRw+e+vWv5dDzC3apmEvnIryh7p++R9+DBxpuuuv8MoO/ Tyi+v6l6PnU/iGDNyq3oGG+wB/YP7H6kvattBXhoW30HWO2hh0Xj3Fo+60DbUm63PmXo 6orVPEn+g2ztXVAJg0vhVbrQdSj3HoS1ljfRgaKBmC9ZO9T/u/KKHuIwbL9XQ8/TTQhk gTUQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=vMvNaCRY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 z13-20020a170902cccd00b0018659ff71d2si10261833ple.62.2022.10.22.00.40.23; Sat, 22 Oct 2022 00:40: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=vMvNaCRY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231161AbiJVHj6 (ORCPT + 99 others); Sat, 22 Oct 2022 03:39:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50582 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230520AbiJVHjH (ORCPT ); Sat, 22 Oct 2022 03:39:07 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ED17C2ACBF3; Sat, 22 Oct 2022 00:36: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 55A2EB82DEF; Sat, 22 Oct 2022 07:36:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8BBDDC433D6; Sat, 22 Oct 2022 07:36:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424183; bh=FP0+Py/xiye3Lrwe1PTtluLDiVfZV2Fz/lWJUEeXaKY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vMvNaCRYxvhVP0ebP7WeIT5eHxaGCpTZhQTaIFdBBLmUj5nWdYfBNmv5mdZ51ToIC xYHfFx2Bz+jNfFKeSuxM77BLXaHRldaQ0/03qpiBLiiZwb21RsvMguD+bcSIsk8yGi oCVkJR9ObZg1VY4tRHp//Sc0F6P70g64v+sK4xBA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Helge Deller Subject: [PATCH 5.19 053/717] parisc: fbdev/stifb: Align graphics memory size to 4MB Date: Sat, 22 Oct 2022 09:18:52 +0200 Message-Id: <20221022072424.461422399@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747372669119385969?= X-GMAIL-MSGID: =?utf-8?q?1747372669119385969?= 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 @@ -1298,7 +1298,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 Sat Oct 22 07:18: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: 7176 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1088645wrr; Sat, 22 Oct 2022 00:40:45 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6TmHLtRxeqvJV5W88EyOp15vPS4T7ilLpVRR7VMmpqk+d+RIgAAVY5o5xRTq25ooJ/WwiK X-Received: by 2002:a63:1165:0:b0:44d:e5ba:5603 with SMTP id 37-20020a631165000000b0044de5ba5603mr19324107pgr.68.1666424445234; Sat, 22 Oct 2022 00:40:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666424445; cv=none; d=google.com; s=arc-20160816; b=X2OBUXlbpv9qJvl3z61NDQKIJjnC8+L970Xsc5ogoYHhJK2VFloO7qNSVHSgAPSHQu 343YtmLj6vApfc5C4npfx5xSq/5SnoC+X8IQr5heskz1jxYdHblqfZefhn5vvi/epPq/ DriPSyRHUrY3VMVQZPSVkSYP2R93o/G8EPbFCaSjeKBfbmCz4Ay2BzhobmZH39laz35i m4p4EDHF6/A4Shnu6UxHifWYM1/dQD2uSMK4MD8caDE2Aeasxl5qCwPI/g/fTAd3W+Hd 7wRccJ+vdYQEQ4Y1vfel79Ou1uHgVdvbCJagx+9HrdypM8CbVQ5cLi05n/Hdw0YECShM OU+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=wmv422MCiy74LRydq0A1Gsjax5JTZYnSkqYnZZomJwE=; b=wEthpupuDEO7g3NsZshGiK8SJ0v3QecSRFvSzANdeyaWhessVlXFCkAaxSiZdjPp82 qH+vkNeVzAxKQg5Tyig3fAZL5wZlumrgVxYIuMdh6YIZg6XRsjnrFkab8ef+YYrqy9XX +ESPQSiaQaZMlukaUuGQxcMEFHUS1uaVJ1mIVmxR0QePhCFJ7Af9q8FQc0KoIFiunxZP /XfYyKQsJHwZSfW8KrxgWbubwKmPB8rPoZApOxBYcyts6bjSEdxsy9D1eBHViBjsjjae 92K2OY92FgNnVXQAXXzZxYv6BDU9MySh0mRzdZJqMbZAl98J7n4ciCWLw/O8xx3Daet1 3OBw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=IyH7GbTu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 k186-20020a6384c3000000b0046edbb5b20esi1170185pgd.668.2022.10.22.00.40.32; Sat, 22 Oct 2022 00:40: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=IyH7GbTu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S230408AbiJVHkB (ORCPT + 99 others); Sat, 22 Oct 2022 03:40:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32852 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230385AbiJVHjL (ORCPT ); Sat, 22 Oct 2022 03:39: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 6550A83229; Sat, 22 Oct 2022 00:36: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 3259DB82DF2; Sat, 22 Oct 2022 07:36:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 84130C433C1; Sat, 22 Oct 2022 07:36:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424185; bh=Y4qDb4mZNU20ip9zLWEr74fGK+TtVytsTmrTYBy7Its=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IyH7GbTu/y47N2jCKFOUmXbudbPBIxOSckrRKn0TuFGOdZqwJ60oRyYMiuQVywpKv 13ZAXhxukUS5/FAr5NzVY+dogwfDuih+sBim0IX8NUi93HJ9Bb3l+zQ6QouoFpbePZ zsXSsQvtu4MHS1XjmZtjmkHPxF/ogYAkQvVceWWY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Helge Deller Subject: [PATCH 5.19 054/717] parisc: Fix userspace graphics card breakage due to pgtable special bit Date: Sat, 22 Oct 2022 09:18:53 +0200 Message-Id: <20221022072424.651114285@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747372679074969471?= X-GMAIL-MSGID: =?utf-8?q?1747372679074969471?= From: Helge Deller commit 70be49f2f6223ddd2fcddb0089a40864c37e1494 upstream. Commit df24e1783e6e ("parisc: Add vDSO support") introduced the vDSO support, for which a _PAGE_SPECIAL page table flag was needed. Since we wanted to keep every page table entry in 32-bits, this patch re-used the existing - but yet unused - _PAGE_DMB flag (which triggers a hardware break if a page is accessed) to store the special bit. But when graphics card memory is mmapped into userspace, the kernel uses vm_iomap_memory() which sets the the special flag. So, with the DMB bit set, every access to the graphics memory now triggered a hardware exception and segfaulted the userspace program. Fix this breakage by dropping the DMB bit when writing the page protection bits to the CPU TLB. In addition this patch adds a small optimization: if huge pages aren't configured (which is at least the case for 32-bit kernels), then the special bit is stored in the hpage (HUGE PAGE) bit instead. That way we can skip to reset the DMB bit. Fixes: df24e1783e6e ("parisc: Add vDSO support") Cc: # 5.18+ Signed-off-by: Helge Deller Signed-off-by: Greg Kroah-Hartman --- arch/parisc/include/asm/pgtable.h | 7 ++++++- arch/parisc/kernel/entry.S | 8 ++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) --- a/arch/parisc/include/asm/pgtable.h +++ b/arch/parisc/include/asm/pgtable.h @@ -192,6 +192,11 @@ extern void __update_cache(pte_t pte); #define _PAGE_PRESENT_BIT 22 /* (0x200) Software: translation valid */ #define _PAGE_HPAGE_BIT 21 /* (0x400) Software: Huge Page */ #define _PAGE_USER_BIT 20 /* (0x800) Software: User accessible page */ +#ifdef CONFIG_HUGETLB_PAGE +#define _PAGE_SPECIAL_BIT _PAGE_DMB_BIT /* DMB feature is currently unused */ +#else +#define _PAGE_SPECIAL_BIT _PAGE_HPAGE_BIT /* use unused HUGE PAGE bit */ +#endif /* N.B. The bits are defined in terms of a 32 bit word above, so the */ /* following macro is ok for both 32 and 64 bit. */ @@ -219,7 +224,7 @@ extern void __update_cache(pte_t pte); #define _PAGE_PRESENT (1 << xlate_pabit(_PAGE_PRESENT_BIT)) #define _PAGE_HUGE (1 << xlate_pabit(_PAGE_HPAGE_BIT)) #define _PAGE_USER (1 << xlate_pabit(_PAGE_USER_BIT)) -#define _PAGE_SPECIAL (_PAGE_DMB) +#define _PAGE_SPECIAL (1 << xlate_pabit(_PAGE_SPECIAL_BIT)) #define _PAGE_TABLE (_PAGE_PRESENT | _PAGE_READ | _PAGE_WRITE | _PAGE_DIRTY | _PAGE_ACCESSED) #define _PAGE_CHG_MASK (PAGE_MASK | _PAGE_ACCESSED | _PAGE_DIRTY | _PAGE_SPECIAL) --- a/arch/parisc/kernel/entry.S +++ b/arch/parisc/kernel/entry.S @@ -499,6 +499,10 @@ * Finally, _PAGE_READ goes in the top bit of PL1 (so we * trigger an access rights trap in user space if the user * tries to read an unreadable page */ +#if _PAGE_SPECIAL_BIT == _PAGE_DMB_BIT + /* need to drop DMB bit, as it's used as SPECIAL flag */ + depi 0,_PAGE_SPECIAL_BIT,1,\pte +#endif depd \pte,8,7,\prot /* PAGE_USER indicates the page can be read with user privileges, @@ -529,6 +533,10 @@ * makes the tlb entry for the differently formatted pa11 * insertion instructions */ .macro make_insert_tlb_11 spc,pte,prot +#if _PAGE_SPECIAL_BIT == _PAGE_DMB_BIT + /* need to drop DMB bit, as it's used as SPECIAL flag */ + depi 0,_PAGE_SPECIAL_BIT,1,\pte +#endif zdep \spc,30,15,\prot dep \pte,8,7,\prot extru,= \pte,_PAGE_NO_CACHE_BIT,1,%r0 From patchwork Sat Oct 22 07:18: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: 7177 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1088692wrr; Sat, 22 Oct 2022 00:40:58 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5Pxk9Ws31s5O13FGKv57QZFOOBn6ZT0BoElJp+PrpynzcjOi3uXWvcfL3pv+gFw45IP51a X-Received: by 2002:a17:902:968f:b0:180:a7ff:78ba with SMTP id n15-20020a170902968f00b00180a7ff78bamr23447910plp.87.1666424458048; Sat, 22 Oct 2022 00:40:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666424458; cv=none; d=google.com; s=arc-20160816; b=VAMmHudqBa5b9MAPNDtXh6URIFnQ7fQIgUvwojkMa4GYbkrZh7hHaHgqxUAO6dRJqa wpW5ieQMPtXd+gvyP12xJlBnygPfwQH/IudT4cwYD2r28dy6AmNwTDMORlGmY5IBYb7C plVdrap9/sGgHClKIyWOi+Lpo90jBUB62HCShe+8ci5uiU5iWR9tY+TAEygdwQtTiPJ6 JHB5RcpDM1oh4rfT1ESE5fvNxOxU3PHXh+S1EDyw2Q44iZG7BHm/RH4ZesmoS8eJmvK2 Fuq+a3PkjSXxfeNnaYBKPgIf6/pMis7jbt7Wwh7tcO+4HvKBb+icWmnmFh5GVRxYxdde hD7g== 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=+D7k/rP21NIKNprYaIuK47pJ+uSZyXiA5zTjojkay1I=; b=xNlMmRmfMDXztuF3ll+IMWiyEg+pCdtksHN6Vcwb89rXVNEaqSadRVDHUsMVbX3SDF dGe+oqX1wC226MthHT9WmwuViPhiimsqjKKR9oiXFPQ5fcy2LXmPMT4RciGJFRtsSnhw rX8SKnlYT1GzSVobWTms45a03NWXux3mGoEbUNE5ZDl19sxv3bXby6e8Ho7o3nGAoXX1 2SZVc8d73oBYsIXBtRwvNUU8h4ef0cxz3UUA7xJdT6pI9ke6a7MACq4TiCLMSHEODg8g DLngNm44rEWDhbT7DuwgnpCXZiVg8xM3/tfntINhzylbfIG4MK4c34zdMwK3mQW6t/Wl t5sg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=qDczIKll; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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-20020a170902cf0700b00179fafc3918si27803791plg.98.2022.10.22.00.40.46; Sat, 22 Oct 2022 00:40: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=qDczIKll; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231177AbiJVHkF (ORCPT + 99 others); Sat, 22 Oct 2022 03:40:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51514 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230413AbiJVHjM (ORCPT ); Sat, 22 Oct 2022 03:39:12 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6BD5B9F37F; Sat, 22 Oct 2022 00:36: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 404A0B82DB2; Sat, 22 Oct 2022 07:36:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 96839C433D6; Sat, 22 Oct 2022 07:36:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424189; bh=4o5hDaGZrryzhMIfNMSAmuAFWTiZqe00hWi8BwjboeE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qDczIKll8r1QGkGQ5A05qHBo8CZaNNVa/U4+jLr+KWhCc6Kd0iaRDe/DHL4VBCvoh Ekh9h+1mJo+oISei/xvn/9piIyH60dDee0lX5GA6JicbfdYzsp1RxUHHEJt+gapxyk iXlheVOLLbbe4vmZLflMNSY9hGPHBHRRG3P7nEOA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jisheng Zhang , Palmer Dabbelt Subject: [PATCH 5.19 055/717] riscv: vdso: fix NULL deference in vdso_join_timens() when vfork Date: Sat, 22 Oct 2022 09:18:54 +0200 Message-Id: <20221022072424.849345168@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747372692373517244?= X-GMAIL-MSGID: =?utf-8?q?1747372692373517244?= From: Jisheng Zhang commit a8616d2dc193b6becc36b5f3cfeaa9ac7a5762f9 upstream. Testing tools/testing/selftests/timens/vfork_exec.c got below kernel log: [ 6.838454] Unable to handle kernel access to user memory without uaccess routines at virtual address 0000000000000020 [ 6.842255] Oops [#1] [ 6.842871] Modules linked in: [ 6.844249] CPU: 1 PID: 64 Comm: vfork_exec Not tainted 6.0.0-rc3-rt15+ #8 [ 6.845861] Hardware name: riscv-virtio,qemu (DT) [ 6.848009] epc : vdso_join_timens+0xd2/0x110 [ 6.850097] ra : vdso_join_timens+0xd2/0x110 [ 6.851164] epc : ffffffff8000635c ra : ffffffff8000635c sp : ff6000000181fbf0 [ 6.852562] gp : ffffffff80cff648 tp : ff60000000fdb700 t0 : 3030303030303030 [ 6.853852] t1 : 0000000000000030 t2 : 3030303030303030 s0 : ff6000000181fc40 [ 6.854984] s1 : ff60000001e6c000 a0 : 0000000000000010 a1 : ffffffff8005654c [ 6.856221] a2 : 00000000ffffefff a3 : 0000000000000000 a4 : 0000000000000000 [ 6.858114] a5 : 0000000000000000 a6 : 0000000000000008 a7 : 0000000000000038 [ 6.859484] s2 : ff60000001e6c068 s3 : ff6000000108abb0 s4 : 0000000000000000 [ 6.860751] s5 : 0000000000001000 s6 : ffffffff8089dc40 s7 : ffffffff8089dc38 [ 6.862029] s8 : ffffffff8089dc30 s9 : ff60000000fdbe38 s10: 000000000000005e [ 6.863304] s11: ffffffff80cc3510 t3 : ffffffff80d1112f t4 : ffffffff80d1112f [ 6.864565] t5 : ffffffff80d11130 t6 : ff6000000181fa00 [ 6.865561] status: 0000000000000120 badaddr: 0000000000000020 cause: 000000000000000d [ 6.868046] [] timens_commit+0x38/0x11a [ 6.869089] [] timens_on_fork+0x72/0xb4 [ 6.870055] [] begin_new_exec+0x3c6/0x9f0 [ 6.871231] [] load_elf_binary+0x628/0x1214 [ 6.872304] [] bprm_execve+0x1f2/0x4e4 [ 6.873243] [] do_execveat_common+0x16e/0x1ee [ 6.874258] [] sys_execve+0x3c/0x48 [ 6.875162] [] ret_from_syscall+0x0/0x2 [ 6.877484] ---[ end trace 0000000000000000 ]--- This is because the mm->context.vdso_info is NULL in vfork case. From another side, mm->context.vdso_info either points to vdso info for RV64 or vdso info for compat, there's no need to bloat riscv's mm_context_t, we can handle the difference when setup the additional page for vdso. Signed-off-by: Jisheng Zhang Suggested-by: Palmer Dabbelt Fixes: 3092eb456375 ("riscv: compat: vdso: Add setup additional pages implementation") Link: https://lore.kernel.org/r/20220924070737.3048-1-jszhang@kernel.org Cc: stable@vger.kernel.org Signed-off-by: Palmer Dabbelt Signed-off-by: Greg Kroah-Hartman --- arch/riscv/include/asm/mmu.h | 1 - arch/riscv/kernel/vdso.c | 13 ++++++++++--- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/arch/riscv/include/asm/mmu.h b/arch/riscv/include/asm/mmu.h index cedcf8ea3c76..0099dc116168 100644 --- a/arch/riscv/include/asm/mmu.h +++ b/arch/riscv/include/asm/mmu.h @@ -16,7 +16,6 @@ typedef struct { atomic_long_t id; #endif void *vdso; - void *vdso_info; #ifdef CONFIG_SMP /* A local icache flush is needed before user execution can resume. */ cpumask_t icache_stale_mask; diff --git a/arch/riscv/kernel/vdso.c b/arch/riscv/kernel/vdso.c index 69b05b6c181b..4abc9aebdfae 100644 --- a/arch/riscv/kernel/vdso.c +++ b/arch/riscv/kernel/vdso.c @@ -60,6 +60,11 @@ struct __vdso_info { struct vm_special_mapping *cm; }; +static struct __vdso_info vdso_info; +#ifdef CONFIG_COMPAT +static struct __vdso_info compat_vdso_info; +#endif + static int vdso_mremap(const struct vm_special_mapping *sm, struct vm_area_struct *new_vma) { @@ -114,15 +119,18 @@ int vdso_join_timens(struct task_struct *task, struct time_namespace *ns) { struct mm_struct *mm = task->mm; struct vm_area_struct *vma; - struct __vdso_info *vdso_info = mm->context.vdso_info; mmap_read_lock(mm); for (vma = mm->mmap; vma; vma = vma->vm_next) { unsigned long size = vma->vm_end - vma->vm_start; - if (vma_is_special_mapping(vma, vdso_info->dm)) + if (vma_is_special_mapping(vma, vdso_info.dm)) zap_page_range(vma, vma->vm_start, size); +#ifdef CONFIG_COMPAT + if (vma_is_special_mapping(vma, compat_vdso_info.dm)) + zap_page_range(vma, vma->vm_start, size); +#endif } mmap_read_unlock(mm); @@ -264,7 +272,6 @@ static int __setup_additional_pages(struct mm_struct *mm, vdso_base += VVAR_SIZE; mm->context.vdso = (void *)vdso_base; - mm->context.vdso_info = (void *)vdso_info; ret = _install_special_mapping(mm, vdso_base, vdso_text_len, From patchwork Sat Oct 22 07:18: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: 7178 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1088714wrr; Sat, 22 Oct 2022 00:41:02 -0700 (PDT) X-Google-Smtp-Source: AMsMyM71idtYIxLBCFV9gFZqhREshueW8qJVwN1FOw5xX/LcNlgGP+Y3dsbHB6orJ9BiKr+9JGAF X-Received: by 2002:aa7:810a:0:b0:55b:674d:d123 with SMTP id b10-20020aa7810a000000b0055b674dd123mr23823789pfi.52.1666424462305; Sat, 22 Oct 2022 00:41:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666424462; cv=none; d=google.com; s=arc-20160816; b=j7e8FgLf9M5OFoRYDypqYa242taXaZNIrry00NlF1wlusRH6x4RkINE5o3RtCqyyCA as58Julxx2ZN5A4QZI5QHEad25LrSDe1KN7jlmZKcqS6FHCbezKX4IS82eObsQAkPCGA LEIBD8f59noobDv/n6MOTYiO9qblLgx7Qt0Xwlj7PEYcfFIix3VHM0vlOF1aTmU0F/Mv KLAdKQa088ZNJN6yNmCaydZepsF1HhLocre2RgIvaWM7QLp50AWLyvl/JflQYeFsn+yR fByQEg4qjmJ7MhwqkvE64QAW4bFX10178vSj7sA7tAMjLJt+KGGnGReLwdZhhJ8mQvOr AOPA== 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=TGsirIwj7n+/+mXu8Rw17nBfDG9OmYMcF6WaG/CsWPk=; b=FMfdQb97UACyYNB65SWfelEPZelDeIuVJUXS3RMT7tHrowCIMpjgk+Bxff0cP46SUM JG+KzHYxuv+qe1kxftkiOrsVUVIjtE2bc5vXJ7BrewKqyGGin4fua3KD3Ss3FTeBwasj AiFbJgMJjKyIMgjSdyPtL6BXeWgaA6iRzvN0wzsvxvLgInvg24MR6YrN5VwsYb3SLyEb 8qPWGXxdVWZOh95lIMypSritEDnSlcO0FjNu5UFyGD0QXnBH4TnhziqVjhVTqUh1VLmp UnX4uaxOewnMYN4jVqPVgbvoPB+Jt7MTP+01J7Q7Q8gbjl1ACd1sw4gLo6ahZqF/HaTk h0mQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=pNwAHnge; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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-20020a170902bcc800b00182c510591asi25086580pls.246.2022.10.22.00.40.49; Sat, 22 Oct 2022 00:41: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=pNwAHnge; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S230461AbiJVHkW (ORCPT + 99 others); Sat, 22 Oct 2022 03:40:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33192 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230456AbiJVHj0 (ORCPT ); Sat, 22 Oct 2022 03:39: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 04E962B322A; Sat, 22 Oct 2022 00:36:52 -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 54773B82D9F; Sat, 22 Oct 2022 07:36:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A90F4C433D6; Sat, 22 Oct 2022 07:36:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424192; bh=u8jCsQTg+AUQ8MfWiYmhRVCIrhrvAtAfKvtbHgYSGJM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pNwAHngeT2MGbN+zJJwpoMa2G4wU6qSxpg36yY3gtZjSfaZuuGodXdzgzDvIJCrJt 2xoqhEFVrb8AVUWHTvd3hVsqdEqjMcF8LPPcETBJAyjqmUAjtjYiQ3vHMHeLM70AA7 X6f3rGx23wnwbRXgDYJi0QIBjbBDkoH8gTCV6cmk= 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 5.19 056/717] riscv: Allow PROT_WRITE-only mmap() Date: Sat, 22 Oct 2022 09:18:55 +0200 Message-Id: <20221022072424.987680535@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747372696970016469?= X-GMAIL-MSGID: =?utf-8?q?1747372696970016469?= 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 @@ -18,9 +18,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 Sat Oct 22 07:18: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: 7181 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1088845wrr; Sat, 22 Oct 2022 00:41:25 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4XVq4B86twtujcO37oiumqpliiXKVjyu4Wa5Blnn1gwzFwI1SC6/F4kPkV2/QeaJHF3reE X-Received: by 2002:a17:902:d590:b0:185:4875:ae29 with SMTP id k16-20020a170902d59000b001854875ae29mr23456676plh.27.1666424485512; Sat, 22 Oct 2022 00:41:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666424485; cv=none; d=google.com; s=arc-20160816; b=mPn973QEVb3OQJYV7SW9OUzriiylQF7bcjZ7o3hPYE9fyQ5WgFZ4xyap4x6tEpeT0L pycMNqrHJKWGciundkaS6hkHR7OJMKGCslRzndMxHm9sBJ8TFn5tBxWS6DLBX1cpgUeZ Nng8/ojRqMAl3goGEM1xUuJP1Aa6uP9l2P0V/10d6fWWFUzpsbKv6Nyd427Gw5W2cx6m TMoDfwPM3AxVZLD8JJ+T5qMofSMEcSfvWaHLb8PffUqhVoEM0F9ZVp4ib4SNZgdw7bXM GjW4ue8Pnz11t1eFUaM9e8FbUxYvZ7p8TROOoLYbiQLmxGZNs5OkYdnZAnUmtmaeDLtj th6w== 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=MpoxWs+4RU7KPgafbWDZ7saYeqOSfW9VdtPGVQPSOUU=; b=DaVM4Oa9mS4wpaJ27y4vhKtHkLT5ZFjoakObOq53NliKUflaW1QDFAM74pXfj47WKv bUvtCAXksT/jkbySXCcW19qMnKESSS775/vDLJKM5uyCMZkSr2zvfxM4E/BgwvQWzH36 qk/buqJMwo9FpQvgl7Dh+VhrxxC8aIjXnAimQa5ZB8sHnqLf4sBtMr2OzhZlORbBtH9R xm99JBtXRdE0tdLdkWmnGnNEaQKMU70AzRTpOTvhWH6WPf6kszqbNyqb5F6vai3ZnA3m aIzWb5HhwOUGVk27eV/B8a9cZwnIlXFFsUzk66lS5MbYS608TjxrFwHwel4qQs1VVIzf RKxQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=AWvwpMjv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 cj7-20020a056a00298700b0053b9c18617esi24239308pfb.300.2022.10.22.00.41.13; Sat, 22 Oct 2022 00:41: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=AWvwpMjv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S230466AbiJVHkc (ORCPT + 99 others); Sat, 22 Oct 2022 03:40:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48608 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230522AbiJVHjb (ORCPT ); Sat, 22 Oct 2022 03:39:31 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 336112B3AD1; Sat, 22 Oct 2022 00:36: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 sin.source.kernel.org (Postfix) with ESMTPS id CB5D4CE2C9F; Sat, 22 Oct 2022 07:36:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D2379C433C1; Sat, 22 Oct 2022 07:36:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424195; bh=/2VWHXxCuruU2Yfpldt0LZ8uSfriJfdzL6Wr0+OwWB4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AWvwpMjv8oTrbDFqZN7+egBDOF5kbGVZIuYiyYcjssImf/milucUZTdGZZfWlRcB4 MRG5K6v/MX4kHAsjPEJgw3fYAKUR0hZVy3p3AUJLJP3KDLFNVnsTf5ZLZo6z3KMeLd x6fh6TknIncW8UezyLa95EmYwrAgOWjRqKmzmegU= 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 5.19 057/717] riscv: Make VM_WRITE imply VM_READ Date: Sat, 22 Oct 2022 09:18:56 +0200 Message-Id: <20221022072425.164960595@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747372721699473952?= X-GMAIL-MSGID: =?utf-8?q?1747372721699473952?= From: Andrew Bresticker commit 7ab72c597356be1e7f0f3d856e54ce78527f43c8 upstream. RISC-V does not presently have write-only mappings as that PTE bit pattern is considered reserved in the privileged spec, so allow handling of read faults in VMAs that have VM_WRITE without VM_READ in order to be consistent with other architectures that have similar limitations. 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-2-abrestic@rivosinc.com/ Signed-off-by: Palmer Dabbelt Signed-off-by: Greg Kroah-Hartman --- arch/riscv/mm/fault.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/arch/riscv/mm/fault.c +++ b/arch/riscv/mm/fault.c @@ -184,7 +184,8 @@ static inline bool access_error(unsigned } break; case EXC_LOAD_PAGE_FAULT: - if (!(vma->vm_flags & VM_READ)) { + /* Write implies read */ + if (!(vma->vm_flags & (VM_READ | VM_WRITE))) { return true; } break; From patchwork Sat Oct 22 07:18:57 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 7182 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1088908wrr; Sat, 22 Oct 2022 00:41:35 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4H12lctG75mZjWDZxziNPI0EuqniULMs7J0zz5ZQt/4oWewGrzOHS2d1BR2jarqbdL7HQJ X-Received: by 2002:a17:903:1c2:b0:185:47ce:f4d2 with SMTP id e2-20020a17090301c200b0018547cef4d2mr23408324plh.101.1666424494868; Sat, 22 Oct 2022 00:41:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666424494; cv=none; d=google.com; s=arc-20160816; b=YDSp8BlvWcEI2TgcyTiXGbtrwWeG6/OfEd1yGcrtopkj/bP9dnLMAhrUgCBVZbW4iF XcWr+b0ZQCZ8OebHkJHH9VG1ir63hWkCY4ecZUNrgbp3oM7UbEM5lTgIzEqEWTkd4g+6 5wzOac1ZMvTHtvlwdHljG8kdJgRO+wZQeXhM7sJQ4CHBlW50BMda+FzGGGH6M9AEpY6v vL1VGdHBn59yaN8g1mXKq1HtT92Ns8BsjnGthj9XrosRF28WzSz5wwnirinRxcrB9IIB CYYpO2M1qJZ5z1nacBJbYKF0ISC3veUq2jnVd3BjC1GwCM5TTtBrohKqbFNVs28HZYYV p64A== 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=1B/RCUtdnLtq9BK/uSdcBIvb3CWzHFA8ivSCAj+zrLE=; b=qr00TyaquJeWdv+3CY/bdIBTetzgHrCZszYilWmx0u6zSGlfpWFPLQTNrWmJt9Nd2X nwjCt3FG/eL9IYZ6C0HnOnBFXwLg18ZKJsl62Se6i6z1H9vEmFWHab3QylO2eso17rz1 RB6TUIIza51449bJo1cwIIWqY+i/niOmX1lm57HZumxBhph4N9MvU2BZ2LpTttJcyfHt E63ymU8SWZzn0QCl0S/lBNHZ+0QpPtM5JzQqc4Tk3sA9ns7ET7pyvP0EzXmZ/iXfKv0L dYXc5BYoNhYj38OJAVgN/LoPWvG+Y79RfZZmlWgcVHJkYk3EWXGVxUTQqXAt7tY/Shwp e+gg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ejrK+hhJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 o5-20020a1709026b0500b00184c33ddeb8si25173273plk.23.2022.10.22.00.41.22; Sat, 22 Oct 2022 00:41: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=ejrK+hhJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S230507AbiJVHlB (ORCPT + 99 others); Sat, 22 Oct 2022 03:41:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43026 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231153AbiJVHju (ORCPT ); Sat, 22 Oct 2022 03:39:50 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 97B2A625DA; Sat, 22 Oct 2022 00:37: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 sin.source.kernel.org (Postfix) with ESMTPS id 15454CE2C98; Sat, 22 Oct 2022 07:36:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F35DBC433D6; Sat, 22 Oct 2022 07:36:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424198; bh=XxnKI/qxyl90OHgJdQ5j3WiCFtPd7fI3vYFta5Y9THo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ejrK+hhJd1eqzCVgPIDmD1qMFicOcd9SXZHBDtMSfbKstPIIa4S8r/QGrqJVlG7V3 8jEezXCJ9uTWcy+rCRQgvYL2o4DfLjH5bcFPnUn9AaDoUheEvE18eQAy9Lz/wiML1A QXg8u3DkDGXyac5ZxRn3duQ0ZP6VMf7rH9TWtM0M= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Wenting Zhang , =?utf-8?b?QmrDtnJuIFTDtnBlbA==?= , Conor Dooley , Palmer Dabbelt Subject: [PATCH 5.19 058/717] riscv: always honor the CONFIG_CMDLINE_FORCE when parsing dtb Date: Sat, 22 Oct 2022 09:18:57 +0200 Message-Id: <20221022072425.331618486@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747372731127055366?= X-GMAIL-MSGID: =?utf-8?q?1747372731127055366?= From: Wenting Zhang commit 10f6913c548b32ecb73801a16b120e761c6957ea upstream. When CONFIG_CMDLINE_FORCE is enabled, cmdline provided by CONFIG_CMDLINE are always used. This allows CONFIG_CMDLINE to be used regardless of the result of device tree scanning. This especially fixes the case where a device tree without the chosen node is supplied to the kernel. In such cases, early_init_dt_scan would return true. But inside early_init_dt_scan_chosen, the cmdline won't be updated as there is no chosen node in the device tree. As a result, CONFIG_CMDLINE is not copied into boot_command_line even if CONFIG_CMDLINE_FORCE is enabled. This commit allows properly update boot_command_line in this situation. Fixes: 8fd6e05c7463 ("arch: riscv: support kernel command line forcing when no DTB passed") Signed-off-by: Wenting Zhang Reviewed-by: Björn Töpel Reviewed-by: Conor Dooley Link: https://lore.kernel.org/r/PSBPR04MB399135DFC54928AB958D0638B1829@PSBPR04MB3991.apcprd04.prod.outlook.com Cc: stable@vger.kernel.org Signed-off-by: Palmer Dabbelt Signed-off-by: Greg Kroah-Hartman --- arch/riscv/kernel/setup.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/arch/riscv/kernel/setup.c +++ b/arch/riscv/kernel/setup.c @@ -251,10 +251,10 @@ static void __init parse_dtb(void) pr_info("Machine model: %s\n", name); dump_stack_set_arch_desc("%s (DT)", name); } - return; + } else { + pr_err("No DTB passed to the kernel\n"); } - pr_err("No DTB passed to the kernel\n"); #ifdef CONFIG_CMDLINE_FORCE strscpy(boot_command_line, CONFIG_CMDLINE, COMMAND_LINE_SIZE); pr_info("Forcing kernel command line to: %s\n", boot_command_line); From patchwork Sat Oct 22 07:18: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: 7180 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1088810wrr; Sat, 22 Oct 2022 00:41:18 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7SYBf3RjmvB0o0JSbMQ4JgoDh74dmPw4v3f4d5Y5BJT1alye9zg56cehCUwq6NFF/fY8sc X-Received: by 2002:a17:902:b589:b0:179:f8c5:7212 with SMTP id a9-20020a170902b58900b00179f8c57212mr22960085pls.174.1666424478662; Sat, 22 Oct 2022 00:41:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666424478; cv=none; d=google.com; s=arc-20160816; b=qHsP3FhMc03vbEp8c2hLSvudMGhc9f0AbIYgJkKZ2WF1fcSsqKKdOuqob2wi6h1Kn4 TR3Mi2RxK+Fdos6gMheLZaiAopIY+AYexoe+zNy5c+bbbHv0I2/oBLEdkH5SoIj0J9PY 9Mcevj22XlCiDo3J5zK8lJbifE3YptVdQCKzflNXYFkWoYn6/LrDN4+SmTQstGbJ2HJY m8PYiPnVGKwa0dlB4mumHBEGW/H/lTcvGWzBnqczQZLlJ8sXZQ/gD/CGcg+EJhTVZG9x zqD/iwe6jjGMBTkOJ5eZLkl+Wwd42Ro//MEFtWaa339A0vqjW4sTcRaokK3xzHRSzaMv 4xug== 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=BIEPF+MSQ7lRp5vPBmB173yzLDRtzFdBFRo9ldmDQDY=; b=OXOG1FZKL4lJl5VEdJD7S4tOM/eRvWq7EpGfszJTKCn0fHb/vmdqilN9gsni4EgyNM nth+2dL00TVE1SaCSH8sKY6/cZZ9agdf7YrzeNE23hIti9SCN/qKkfin7LlKtYL7iO8b 8dtuZschfAgTIYvP72uaO5nWu8gReHzU2WgREmQtUeCFZCeergokr7sQPmcFiTpRA060 0hDieVfl4MsMIZXhOrbRakZBCVbKAQ0CIzHFQDwmzoaovnVPMfAPTrZkLgDPuCqKl2uh Bc51E0LLWZWHgDWDUlsidjmJGFCPqE+QKXA/EvvjUuyjF5sLLqrWL99mcwu6QW/HzIBi VrPg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=LCxp9o1s; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 n8-20020a1709026a8800b00176841aa2e3si5221316plk.93.2022.10.22.00.41.06; Sat, 22 Oct 2022 00: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=LCxp9o1s; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S230440AbiJVHkt (ORCPT + 99 others); Sat, 22 Oct 2022 03:40:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43462 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231160AbiJVHjy (ORCPT ); Sat, 22 Oct 2022 03:39: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 77817625CD; Sat, 22 Oct 2022 00:37: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 7921060ADA; Sat, 22 Oct 2022 07:36:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3485CC433D7; Sat, 22 Oct 2022 07:36:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424201; bh=c4NL67WudStCz85yeweG+NkIyETz6hxWtl4wxLcqfqE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LCxp9o1sNHdT6CpnIIlsNjTynAzOOuyaSAHQ/gWrotgOAijsQozen2QaEim1WfWSx yuVoT/2EUuu/u+migblgmsbwyS2JGkqcQMeEv7Ynz7nHL16hcTDL73xOQZS2kflnRM XlLmRv/DL4og84eWgyjFOmwoT1SuPjAddEY9KWYE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Fangrui Song , Nick Desaulniers , Nathan Chancellor , Conor Dooley , Palmer Dabbelt Subject: [PATCH 5.19 059/717] riscv: Pass -mno-relax only on lld < 15.0.0 Date: Sat, 22 Oct 2022 09:18:58 +0200 Message-Id: <20221022072425.506432681@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747372714139843220?= X-GMAIL-MSGID: =?utf-8?q?1747372714139843220?= From: Fangrui Song commit 3cebf80e9a0d3adcb174053be32c88a640b3344b upstream. lld since llvm:6611d58f5bbc ("[ELF] Relax R_RISCV_ALIGN"), which will be included in the 15.0.0 release, has implemented some RISC-V linker relaxation. -mno-relax is no longer needed in KBUILD_CFLAGS/KBUILD_AFLAGS to suppress R_RISCV_ALIGN which older lld can not handle: ld.lld: error: capability.c:(.fixup+0x0): relocation R_RISCV_ALIGN requires unimplemented linker relaxation; recompile with -mno-relax but the .o is already compiled with -mno-relax Signed-off-by: Fangrui Song Link: https://lore.kernel.org/r/20220710071117.446112-1-maskray@google.com/ Link: https://lore.kernel.org/r/20220918092933.19943-1-palmer@rivosinc.com Reviewed-by: Nick Desaulniers Tested-by: Nick Desaulniers Tested-by: Nathan Chancellor Tested-by: Conor Dooley Cc: stable@vger.kernel.org Signed-off-by: Palmer Dabbelt Signed-off-by: Greg Kroah-Hartman --- arch/riscv/Makefile | 2 ++ 1 file changed, 2 insertions(+) --- a/arch/riscv/Makefile +++ b/arch/riscv/Makefile @@ -37,6 +37,7 @@ else endif ifeq ($(CONFIG_LD_IS_LLD),y) +ifeq ($(shell test $(CONFIG_LLD_VERSION) -lt 150000; echo $$?),0) KBUILD_CFLAGS += -mno-relax KBUILD_AFLAGS += -mno-relax ifndef CONFIG_AS_IS_LLVM @@ -44,6 +45,7 @@ ifndef CONFIG_AS_IS_LLVM KBUILD_AFLAGS += -Wa,-mno-relax endif endif +endif # ISA string setting riscv-march-$(CONFIG_ARCH_RV32I) := rv32ima From patchwork Sat Oct 22 07:18: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: 7184 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1089014wrr; Sat, 22 Oct 2022 00:41:52 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5IQPuvpxPSiGlf796IDqnGYLP7GWvtoqDW1mVhof8k4YuC6zOrkYUV9i0u2fGALOE42aDb X-Received: by 2002:a65:62c7:0:b0:463:9c67:5fe2 with SMTP id m7-20020a6562c7000000b004639c675fe2mr19441314pgv.443.1666424512204; Sat, 22 Oct 2022 00:41:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666424512; cv=none; d=google.com; s=arc-20160816; b=M10pY9WzxM8HCTek31szZkCgPMoalZN1M1O4T5XeczJWf7aoRd6oU0ksouijh7sCAX 78S9ZDhywBxa2bvh5WJDcjE1wiTxbJ1l05OogAWn27OnuUp1dWv1vTVPWCy2aANkidYt UGVbL8fSp5w1aOdrZbFFlJVrkeSWG8g99SAnznWitveFtuUCnw0t37ZItxTmsof27fO6 2/FEwA8QuYf5xNvBtyJ6hDvSSARWULnY1RB546n11zes97F1UlIugCQCw9w6OU1IcMnn yZMtzxnyBkIoWNq9VxpnOvHbGGo4G8mUUcPSl/VAYj5wEMG9beCu7X8s7n+tWJ81zxR7 mJ9g== 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=3Zng3YthuBRp7NoZr9y9jX2epyePvtk7v3twtnGcWmM=; b=xG3eKnygmDXloklBydUwddcUX4eOJyjWCsiR6yJtOG1RP350+QUU+pZaaaZWsft9VA Qz7vBtoDrs6kGg0aI5sEL2dFhlTmwW2er3hHY3OVKTlX0kaJxl/Rz7zMGOcyPhW4ybPP 8/L1qbLoonDtbo3Wdnp0uFC14bdh84V62hpBavuyUDvhl5mTIKlhNASQc/5jXXRfNJsb pl2Orh/n4kyH2NkPzXOlkUugegmDnPObWmyt4JwKyj6Jjw5pLu3+VBUpDlNtMfUgtoyW mOvMIxkXDECvNqcxxYt1q0NfTIssIlkYbOR2wgXYKn+Rrqfn7ZVEe/K9W0G+/MkgymmM xh/A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="JQ/nUPrt"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 k2-20020a170902c40200b001769541146bsi32502788plk.573.2022.10.22.00.41.39; Sat, 22 Oct 2022 00: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="JQ/nUPrt"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S230527AbiJVHlG (ORCPT + 99 others); Sat, 22 Oct 2022 03:41:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45862 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230441AbiJVHkQ (ORCPT ); Sat, 22 Oct 2022 03:40:16 -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 998F05DF18; Sat, 22 Oct 2022 00:37: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 dfw.source.kernel.org (Postfix) with ESMTPS id 8019260ADB; Sat, 22 Oct 2022 07:36:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7E694C433C1; Sat, 22 Oct 2022 07:36:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424207; bh=fb5bovRJE0OE1x/kjgr6r3QY9hhCN3d1H51HtnbhOcY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JQ/nUPrtP3w+iz5OLmSoq/BwKO9q999NZgzVTH+1AID7QsaDyu3wJz4DA+wJIJrL3 J+Wct5/1iooCRTrifItGg1GDdxv/UM6krPVHl6NwU9IHRqmXRlsTVzstYfxoyeuX/m 2B3Wte8vsPy8Nj/rjBhEStWbmuZMlYea3vhJUM+I= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Huacai Chen , Richard Weinberger Subject: [PATCH 5.19 060/717] UM: cpuinfo: Fix a warning for CONFIG_CPUMASK_OFFSTACK Date: Sat, 22 Oct 2022 09:18:59 +0200 Message-Id: <20221022072425.691137563@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747372749617538995?= X-GMAIL-MSGID: =?utf-8?q?1747372749617538995?= 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 @@ -96,7 +96,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 Sat Oct 22 07:19: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: 7183 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1088962wrr; Sat, 22 Oct 2022 00:41:40 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7GyBWN51cQ/pD5tsWzMNeuD6KQzy/sNhc7gTKwkgTiEqYtVchz8E5uLN+IunzX1lw6G6a1 X-Received: by 2002:a17:903:11cf:b0:178:a8f4:d511 with SMTP id q15-20020a17090311cf00b00178a8f4d511mr23350462plh.72.1666424500700; Sat, 22 Oct 2022 00:41:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666424500; cv=none; d=google.com; s=arc-20160816; b=ahfgpbfMoX28KILAqXZBKbjrqo27HhfJmIHCf1hmplnA0GIu6wYg2fiaQwsH/sFHHd 5JZcpSAv3RfHpc4xG0w7v97EQHbXVi9WgoQqvRIxTfTdU9TCuzmF8tvSZgCzBpbYh1TD gPqWbDvn51MOfwV0MKQgaAiCGJ2BMFPNhrvYXjQCWsmEwnGleC76nzSyozICcDvvXXES L8rk4ZaxoCl9YEmkl8A/R46ItJmrLrUJGbyTUmSzrHS72MOoxWbF9o56WJ1qWKVeNhcG SHPxFw2rJVjQJD3zvJV41AGtCrPP2T8Rlap12uAYIgyJKIJHjwYhMB639H3dcsZ0A5EU F45Q== 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=sgHzeYAd7yv+AaNLjROWREAUCgtt9WGGemK+vLNmO3U=; b=if1KcrLKyOke5bRt0oqAFe9Gcc7PMKzZfxerwl9rtsc2CIcFRTkJ1x1+xDgouWBzna dsjeksH6eFPM0UtEtZM+BMi3KkwIMHchVudtWCNteLd6PwEOlS0HqlsTJ/FOjpogRDP4 KFuBZfA8eeUW9oAEZ+lMTu1CRJMx2vXccxqQitb7ESXFaIBGMYa/KaT10VHRdTLQuQy/ k+dELButXmFZM8XlDJl0yKcJVUyo8Pqwsx9sGhjjW7U5jrGEIApG3t3WnbDmqRn6Av2F enpe8sqOufpzHgyP8zNDEhHXdfmXex1wU62+ywaxzstHtZadhTYOdUmW1YhPA5W+cxH1 uEmA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="QvAdd/Ts"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 l17-20020a170903245100b0017811e3927bsi31035438pls.622.2022.10.22.00.41.28; Sat, 22 Oct 2022 00:41: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="QvAdd/Ts"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231176AbiJVHlJ (ORCPT + 99 others); Sat, 22 Oct 2022 03:41:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46722 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230283AbiJVHkW (ORCPT ); Sat, 22 Oct 2022 03:40: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 E38E643E43; Sat, 22 Oct 2022 00:37: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 5B5A560AC7; Sat, 22 Oct 2022 07:36:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6801CC433C1; Sat, 22 Oct 2022 07:36:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424210; bh=7VdRluWHI+RLGwVR0BCIqAPVnPkYCKskJthMfKF0DfM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QvAdd/TscqgDKzOPNT/7+5Oaf2GRXjBPFf57AnfZ3B0OYIZxvgi0qwuz2NT129ZT1 IZFuo21Ib7xMU2WgSpyqSmBM1Ye1bZaDBJCn90Qjob9HakAqEJYz8KdJp5O64//eL+ MIG56QHmkyGfwM0S+OIjVEAVkRp/REqyr68poC+s= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Gaosheng Cui , Srinivas Kandagatla Subject: [PATCH 5.19 061/717] nvmem: core: Fix memleak in nvmem_register() Date: Sat, 22 Oct 2022 09:19:00 +0200 Message-Id: <20221022072425.874526943@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747372736917808193?= X-GMAIL-MSGID: =?utf-8?q?1747372736917808193?= From: Gaosheng Cui commit bd1244561fa2a4531ded40dbf09c9599084f8b29 upstream. dev_set_name will alloc memory for nvmem->dev.kobj.name in nvmem_register, when nvmem_validate_keepouts failed, nvmem's memory will be freed and return, but nobody will free memory for nvmem->dev.kobj.name, there will be memleak, so moving nvmem_validate_keepouts() after device_register() and let the device core deal with cleaning name in error cases. Fixes: de0534df9347 ("nvmem: core: fix error handling while validating keepout regions") Cc: stable@vger.kernel.org Signed-off-by: Gaosheng Cui Signed-off-by: Srinivas Kandagatla Link: https://lore.kernel.org/r/20220916120402.38753-1-srinivas.kandagatla@linaro.org Signed-off-by: Greg Kroah-Hartman Signed-off-by: Greg Kroah-Hartman --- drivers/nvmem/core.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) --- a/drivers/nvmem/core.c +++ b/drivers/nvmem/core.c @@ -829,21 +829,18 @@ struct nvmem_device *nvmem_register(cons nvmem->dev.groups = nvmem_dev_groups; #endif - if (nvmem->nkeepout) { - rval = nvmem_validate_keepouts(nvmem); - if (rval) { - ida_free(&nvmem_ida, nvmem->id); - kfree(nvmem); - return ERR_PTR(rval); - } - } - dev_dbg(&nvmem->dev, "Registering nvmem device %s\n", config->name); rval = device_register(&nvmem->dev); if (rval) goto err_put_device; + if (nvmem->nkeepout) { + rval = nvmem_validate_keepouts(nvmem); + if (rval) + goto err_device_del; + } + if (config->compat) { rval = nvmem_sysfs_setup_compat(nvmem, config); if (rval) From patchwork Sat Oct 22 07:19: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: 7639 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1107638wrr; Sat, 22 Oct 2022 01:41:35 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4hoHwhYPzDAS8nd60KM37nGRlnroAM/6gRR2BjeWoBRHrGNuC18Td1lXahMth7IX+w432u X-Received: by 2002:a05:6402:35cc:b0:45d:442:1765 with SMTP id z12-20020a05640235cc00b0045d04421765mr21446019edc.51.1666428095187; Sat, 22 Oct 2022 01:41:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666428095; cv=none; d=google.com; s=arc-20160816; b=ZsYTziRRh2w1oanzcXaJmkpGzP9UB88IdGvqmC2TP1rSbu/6ILZjq0oVM0jZ0k4Nay Vd/k7PXPdkYLEoc8/YkJLHBz6ksMhGlyWTQ+qACdpjOiy9BCjv5iz2/4kBzKqWUY+kmy D6qRTaRewDrx3yY0pgJAYqLwk7okRMe2tUaV7tDtuMn/f8heRDjs2UByiTXgxjOR7ak4 Kcosjkq6dXs7kYvzT0PVfs8Mxf77w4tgz92U1zNm01K9KLYHbJX1M7AHtzwqsA0wLcCE UfMRyqp1k+MDpcQ4BbU8r++iy4znAz8zgz+z5Ogf7fjjEeEBGBWphTmFGRpHTm12Y1TK e5bw== 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=TW826vAKXuOrryw/6+DW8pbOkbYkeAdYmnPeHLAfYP0=; b=UkMVNwzW4/+zXjB/GGftvyHXPwPQidGUNDkndHgTqdYSQ6Vc14GnCH4YZQzd9nyOYn eIYc7VtU+rhoqhiYrP9z4w8fiKSOG1n07TGrHN21SNMKRG8Yi06nqf/dkOFx6dgvajH0 MR8/k6a5ir8qhLjWbGRnFMPw8lnhVqTui6EH7uZdoFrJDNOnR/0vp9mtM+wdBHLCdsNw x1/2TIujOuzHwj5neVw65YaosKpZygjjhR+8MzC4tdjFGRrmSY+QDYjPiIfGMmf/IPR2 jIW4Iwra6Jwf/gyHpKCubRqbQWeTwaKPWT50XijqqE/7P5qXGRUodhBdMcyJu4tdx+EX Q88Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="v/xdFGfp"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 bc13-20020a056402204d00b0046121c10e6fsi4895191edb.101.2022.10.22.01.41.09; Sat, 22 Oct 2022 01:41: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="v/xdFGfp"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S234437AbiJVIiP (ORCPT + 99 others); Sat, 22 Oct 2022 04:38:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59136 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234051AbiJVIca (ORCPT ); Sat, 22 Oct 2022 04:32:30 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B31592D12AA; Sat, 22 Oct 2022 01:03: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 F1DA260B16; Sat, 22 Oct 2022 07:38:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 149A2C433C1; Sat, 22 Oct 2022 07:38:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424321; bh=ON2evzD/PvT7GNtyEBzFcCThvASigkcrWtkR+/CpAo0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=v/xdFGfpnOwkMBNw+QAFrqkPcKDXzeu8KfkGc9ZQcxGzz9LZjNeazv3JoNCF3hYBY xkwtjGCALXSEW5U953bczsN6ZjT4EzvRGZOTAG8iw6zdanpK0ISscP/hUFDJqFwMCi S0nISfpOEQw/aCGoeOFoZ+KhwOy5y+f9xfb1yDQU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Yogev Cohen , Sagi Grimberg , Christoph Hellwig Subject: [PATCH 5.19 062/717] nvme-multipath: fix possible hang in live ns resize with ANA access Date: Sat, 22 Oct 2022 09:19:01 +0200 Message-Id: <20221022072426.061018181@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376506528359828?= X-GMAIL-MSGID: =?utf-8?q?1747376506528359828?= From: Sagi Grimberg commit 72e3b8883a36e80ebfa41015c7b6926ce31ace05 upstream. When we revalidate paths as part of ns size change (as of commit e7d65803e2bb), it is possible that during the path revalidation, the only paths that is IO capable (i.e. optimized/non-optimized) are the ones that ns resize was not yet informed to the host, which will cause inflight requests to be requeued (as we have available paths but none are IO capable). These requests on the requeue list are waiting for someone to resubmit them at some point. The IO capable paths will eventually notify the ns resize change to the host, but there is nothing that will kick the requeue list to resubmit the queued requests. Fix this by always kicking the requeue list, and if no IO capable path exists, these requests will be queued again. A typical log that indicates that IOs are requeued: --- nvme nvme1: creating 4 I/O queues. nvme nvme1: new ctrl: "testnqn1" nvme nvme2: creating 4 I/O queues. nvme nvme2: mapped 4/0/0 default/read/poll queues. nvme nvme2: new ctrl: NQN "testnqn1", addr 127.0.0.1:8009 nvme nvme1: rescanning namespaces. nvme1n1: detected capacity change from 2097152 to 4194304 block nvme1n1: no usable path - requeuing I/O block nvme1n1: no usable path - requeuing I/O block nvme1n1: no usable path - requeuing I/O block nvme1n1: no usable path - requeuing I/O block nvme1n1: no usable path - requeuing I/O block nvme1n1: no usable path - requeuing I/O block nvme1n1: no usable path - requeuing I/O block nvme1n1: no usable path - requeuing I/O block nvme1n1: no usable path - requeuing I/O block nvme1n1: no usable path - requeuing I/O nvme nvme2: rescanning namespaces. -- Reported-by: Yogev Cohen Fixes: e7d65803e2bb ("nvme-multipath: revalidate paths during rescan") Signed-off-by: Sagi Grimberg Cc: # v5.15+ Signed-off-by: Christoph Hellwig Signed-off-by: Greg Kroah-Hartman --- drivers/nvme/host/multipath.c | 1 + 1 file changed, 1 insertion(+) --- a/drivers/nvme/host/multipath.c +++ b/drivers/nvme/host/multipath.c @@ -182,6 +182,7 @@ void nvme_mpath_revalidate_paths(struct for_each_node(node) rcu_assign_pointer(head->current_path[node], NULL); + kblockd_schedule_work(&head->requeue_work); } static bool nvme_path_is_disabled(struct nvme_ns *ns) From patchwork Sat Oct 22 07:19: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: 7192 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1089457wrr; Sat, 22 Oct 2022 00:43:27 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6fQ0T33ztwiZWmL93MSy5oXHQR4kcnAcDOQRDZ8EE0pEc9cmYCiri3dguMeX3IKviJz6ZW X-Received: by 2002:aa7:810a:0:b0:55b:674d:d123 with SMTP id b10-20020aa7810a000000b0055b674dd123mr23831011pfi.52.1666424607507; Sat, 22 Oct 2022 00:43:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666424607; cv=none; d=google.com; s=arc-20160816; b=cuV9QDRLd4UwQDSqOvhjbLGFxjWfZXtHAgqz6TwU6BCVQRprGaM/zI3WLcQamJ1eH4 8Mqqlv2ztaqfyn/KFNWORyQUsO+vCd55Ep7MCO83YG8xZSR65nPBknDFU0H+yuSY2xCl iqsg6FTGB42H7eAAJr1oNbFusECONGtK1JQvzICJrgFehyahPV1R3G1elTOkxd4spIcq DSAZlOkpQ9H0pGGGZPCmRyxln8zuAxkJPQ5wA2fRuSmNLP6p8EuohwQr1oJA2KgKXMNf FEc2nuYxDxcS2T8+sFAufRqrQPNG69md+A5DCit6RnST7/sAOZ5bBTmAAyoLxFzKgkzS 5M6w== 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=Wf2h7nM5/2WZ+cZoV0KuWoKJth6XvQPMnYZvdgIF+3w=; b=tsMI+60B0MIJnFIjnSTNgpugtUYqF4k04cUG+E8V0gxk2h4VShXLYAitNtm5cMCZ/0 nhoyA6kVT+jDXXs6t6g4nN6y4uVBWosryv6+FBkS7rQ2mZLjFBPlVnBTvi3lijeExC/f NOh4q5et5qWxHOtbCDSKp7j5OD5aPUrejYMttDHAhISAPD9t6g6M7E0t8dqglcPr7XKe MgZmvhr5F8QyHjrwwq3lnH7qa/GqJnlPm9G5YD0wY1DEK4lVkX8aQMpC4QsH87hNly5g quubJYVR5wAKxfuIetdXAhCVndlOoKtIQD1aBlf2FBxebQXkEwiNDSEEncSiu8xx6g9g 7hOw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=FpxxfuRk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 e128-20020a636986000000b00460a5961827si27651639pgc.651.2022.10.22.00.43.15; Sat, 22 Oct 2022 00:43: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=FpxxfuRk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231279AbiJVHm4 (ORCPT + 99 others); Sat, 22 Oct 2022 03:42:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43010 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231127AbiJVHmP (ORCPT ); Sat, 22 Oct 2022 03:42:15 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 58AB6192999; Sat, 22 Oct 2022 00:40: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 sin.source.kernel.org (Postfix) with ESMTPS id 107A8CE1D33; Sat, 22 Oct 2022 07:37:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2F4ACC433C1; Sat, 22 Oct 2022 07:37:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424234; bh=1YuiLaIm3NwYdhiIKtcy3eB0YOyxO/hJJ4MIYrNFV1E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FpxxfuRkmD2WYJ9HKpkgpWUbovef/NQLOcJNX+HoYwdShjBtGU7a1zvn6oBnq3uYJ GBJgKvJHDWbpXj1HAQkwIyqNhmM9PwZwiah2t2BELsyCldSm6B/iYnYvROY93I86iq bnvpUaljxgbM6acyos181mNwqhU4UGrkf13fnjQg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hamza Mahfooz , Alex Deucher Subject: [PATCH 5.19 063/717] Revert "drm/amdgpu: use dirty framebuffer helper" Date: Sat, 22 Oct 2022 09:19:02 +0200 Message-Id: <20221022072426.257868782@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747372849237370078?= X-GMAIL-MSGID: =?utf-8?q?1747372849237370078?= From: Hamza Mahfooz commit 17d819e2828cacca2e4c909044eb9798ed379cd2 upstream. This reverts commit 66f99628eb24409cb8feb5061f78283c8b65f820. Unfortunately, that commit causes performance regressions on non-PSR setups. So, just revert it until FB_DAMAGE_CLIPS support can be added. Cc: stable@vger.kernel.org Link: https://gitlab.freedesktop.org/drm/amd/-/issues/2189 Link: https://bugzilla.kernel.org/show_bug.cgi?id=216554 Fixes: 66f99628eb2440 ("drm/amdgpu: use dirty framebuffer helper") Fixes: abbc7a3dafb91b ("drm/amdgpu: don't register a dirty callback for non-atomic") Signed-off-by: Hamza Mahfooz Acked-by: Alex Deucher Signed-off-by: Alex Deucher Signed-off-by: Greg Kroah-Hartman --- drivers/gpu/drm/amd/amdgpu/amdgpu_display.c | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c @@ -35,8 +35,6 @@ #include #include #include -#include -#include #include #include #include @@ -497,12 +495,6 @@ static const struct drm_framebuffer_func .create_handle = drm_gem_fb_create_handle, }; -static const struct drm_framebuffer_funcs amdgpu_fb_funcs_atomic = { - .destroy = drm_gem_fb_destroy, - .create_handle = drm_gem_fb_create_handle, - .dirty = drm_atomic_helper_dirtyfb, -}; - uint32_t amdgpu_display_supported_domains(struct amdgpu_device *adev, uint64_t bo_flags) { @@ -1077,10 +1069,8 @@ static int amdgpu_display_gem_fb_verify_ if (ret) goto err; - if (drm_drv_uses_atomic_modeset(dev)) - ret = drm_framebuffer_init(dev, &rfb->base, &amdgpu_fb_funcs_atomic); - else - ret = drm_framebuffer_init(dev, &rfb->base, &amdgpu_fb_funcs); + ret = drm_framebuffer_init(dev, &rfb->base, &amdgpu_fb_funcs); + if (ret) goto err; From patchwork Sat Oct 22 07:19: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: 7236 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1090838wrr; Sat, 22 Oct 2022 00:48:41 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4PH1XerKb0ZC3tcH//GfQeBre7QA91CPWcvgGwpC8YI9/RPxLk/obcionITmz9JG4yUENx X-Received: by 2002:a17:903:248:b0:172:7520:db04 with SMTP id j8-20020a170903024800b001727520db04mr23478688plh.99.1666424920774; Sat, 22 Oct 2022 00:48:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666424920; cv=none; d=google.com; s=arc-20160816; b=kl/507//6eBUI40yo1OkGAExATbOe/R3hv1zJf6bJFKWpUAJ81TtV3pZN5xIysIT4c hV4pM8L+gmh9aUhfmNT5qVrPA1X3d4sbzvf/qvx03pXwroE+ppNU5CeFDCJWrsAH6aUH I4K46wO6y7OFS9Eg37Ry/ccGKxLBM7CLQW3BqsPZUMYqbvc0TdohNyceDKqnXXoUZ+IC DhUUDNSfigehcL6hYCnH6ypvRSGsCY/Mfl+638aY8fQORXqQaGt39dJGLgftJ244y4el VPCbspgNqHETV8c8621KRcMDpV791ttRuCTWWmDHnRURuM0y+RGne/sAHN4kK7DkVQgR FgeQ== 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=kXABIBFDsmyIZXBdT87jf+FURDwKlr8pTsQrKynsDIE=; b=DdTQZvsj1dYbLaMVU5T0kjS/E15PmN1jwQ+XZP1x+WxkQL07lDaGTIbZGh1k9tFU7p nNaUmvQ441Xn0iMP1GEpk0g35sLTJtWPPH3UxcbPCHnb3xQ8oDeGg3UyiXuCglYvlXcu fSPqfo+DzqTPZ0x2zoEfNbeFPat9mt6Aww9VvVrfxLCyCjalpVLsolHkA57BzqeVtqw3 kx8+2y3O7j0x3qoQtLBr+MCdYcvFviAAHBdZ+/jQtH7clClg5TodUszMoZZNB5B4Dz+0 0+rNwR5rr5DJ93gCufkkx7wkFp+9OiojMbQeK7FFmX6vJZP4liflQw7O7zOg3zdL/IJh YSfw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=UdmnLe7o; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 e14-20020a056a001a8e00b0056334b72215si31371456pfv.86.2022.10.22.00.48.28; Sat, 22 Oct 2022 00: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=UdmnLe7o; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231404AbiJVHrq (ORCPT + 99 others); Sat, 22 Oct 2022 03:47:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35676 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231362AbiJVHrQ (ORCPT ); Sat, 22 Oct 2022 03:47:16 -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 4C640237EE; Sat, 22 Oct 2022 00:44: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 CF6C560B00; Sat, 22 Oct 2022 07:37:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E3E86C433B5; Sat, 22 Oct 2022 07:37:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424264; bh=BX8VTQIPLJW77cNwpmkb/Yr53Pz0B1c4Ovk/HIEfias=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UdmnLe7oUh3DP8yaCBxrHQBTebUGzTTwhg0/Cfh9imjvchoqdiNTuiYF65x5KrPtp RtonvjJtA7A0MqcdXM+4Zs5gN6Ku77A2tXKJRDcfx5mxFMck+vz7Q+1r01DLe/9FQ0 10vREhwLx1CCCW6jEGElIoRsB92PFcmMJswrNWQk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Michael Trimarchi , Dario Binacchi , Sascha Hauer , Vinod Koul Subject: [PATCH 5.19 064/717] dmaengine: mxs: use platform_driver_register Date: Sat, 22 Oct 2022 09:19:03 +0200 Message-Id: <20221022072426.428089076@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747373178008177014?= X-GMAIL-MSGID: =?utf-8?q?1747373178008177014?= From: Dario Binacchi commit 26696d4657167112a1079f86cba1739765c1360e upstream. Driver registration fails on SOC imx8mn as its supplier, the clock control module, is probed later than subsys initcall level. This driver uses platform_driver_probe which is not compatible with deferred probing and won't be probed again later if probe function fails due to clock not being available at that time. This patch replaces the use of platform_driver_probe with platform_driver_register which will allow probing the driver later again when the clock control module will be available. The __init annotation has been dropped because it is not compatible with deferred probing. The code is not executed once and its memory cannot be freed. Fixes: a580b8c5429a ("dmaengine: mxs-dma: add dma support for i.MX23/28") Co-developed-by: Michael Trimarchi Signed-off-by: Michael Trimarchi Signed-off-by: Dario Binacchi Acked-by: Sascha Hauer Cc: stable@vger.kernel.org Signed-off-by: Greg Kroah-Hartman Link: https://lore.kernel.org/r/20220921170556.1055962-1-dario.binacchi@amarulasolutions.com Signed-off-by: Vinod Koul --- drivers/dma/mxs-dma.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) --- a/drivers/dma/mxs-dma.c +++ b/drivers/dma/mxs-dma.c @@ -670,7 +670,7 @@ static enum dma_status mxs_dma_tx_status return mxs_chan->status; } -static int __init mxs_dma_init(struct mxs_dma_engine *mxs_dma) +static int mxs_dma_init(struct mxs_dma_engine *mxs_dma) { int ret; @@ -741,7 +741,7 @@ static struct dma_chan *mxs_dma_xlate(st ofdma->of_node); } -static int __init mxs_dma_probe(struct platform_device *pdev) +static int mxs_dma_probe(struct platform_device *pdev) { struct device_node *np = pdev->dev.of_node; const struct mxs_dma_type *dma_type; @@ -839,10 +839,7 @@ static struct platform_driver mxs_dma_dr .name = "mxs-dma", .of_match_table = mxs_dma_dt_ids, }, + .probe = mxs_dma_probe, }; -static int __init mxs_dma_module_init(void) -{ - return platform_driver_probe(&mxs_dma_driver, mxs_dma_probe); -} -subsys_initcall(mxs_dma_module_init); +builtin_platform_driver(mxs_dma_driver); From patchwork Sat Oct 22 07:19: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: 7211 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1090272wrr; Sat, 22 Oct 2022 00:46:22 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7ICBhnUZM6OYdDbbCv14ceKU1ZbhUwcxm9pLcUxZaEmWpKU+rdojosro4yY2XmFIQnBs7H X-Received: by 2002:a63:2cc2:0:b0:41c:681d:60d2 with SMTP id s185-20020a632cc2000000b0041c681d60d2mr18773144pgs.502.1666424781866; Sat, 22 Oct 2022 00:46:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666424781; cv=none; d=google.com; s=arc-20160816; b=st0HuxpK3JeeRwPNwCNY/TQC+iiCN9veZSgWcDQz0DHXcQBbOi9W5h6nQDjnovsxaO mfP2pbjTlKnmZNPlUDnjMdwDaEcj0nRzO3ddqi2sZ6FHt1OiEKL84Xu23onCEWllQhwx BT99Erj2RE14mpfJlVn/EV+prxEytTtUjpIkydSYHGM3D/Qtlmk/QPatPQBPXfbpEXxK HlE50TtS4A8wgGF+2Z00PHzLP+llC69MnX+IZKdumWdXn8Uaa2lF0AFEjlvxOt5urmlw m3LzEkSQXs7d50YjPrD6LOfNsNRni11mTELHCL+lq496Ce59RueVKdh0EQK0llQmaNRA 2+xw== 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=74/Y6yyfiUViYUjoXr7LaSrahpXaQuoYJFbDU/aEk8E=; b=K3W5pRdZwqRw1g7YPSpRbgiBj1/G55MmE/3/ZuOQR/iEmuYe+X2b0Hlvbt4a6TV8cJ KXFZ9zW+MT+yqrO40R2pQY3/SP45pkhM1IGL6qjObMkTpsTInEujHnUivuPbQNtBVlOB 7c7TVRDiCyWxwgO9gi5QNV9nfzfmIttBRPh5mhSlbS1YTugaDvR0tCIpQY+O913Q4Uyz 7+B5DMdSdQHBQk0XEEf0XOUr1oE2wlLcRa7Cr7zOd6AWJ15czPE5psXfYjhtU0dqQBE/ JeCsRl3BpL196+VN5/QwltnOd5py4j/gt1h4lacyNa+oZc1gDI6eSYBYTILEGjkYOlGT b3nQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="OB2p/jap"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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-20020a170902ccd100b0017eae5cc961si27691952ple.306.2022.10.22.00.46.09; Sat, 22 Oct 2022 00:46: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="OB2p/jap"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S230355AbiJVHpx (ORCPT + 99 others); Sat, 22 Oct 2022 03:45:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47102 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231384AbiJVHoE (ORCPT ); Sat, 22 Oct 2022 03:44:04 -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 2DEAB65002; Sat, 22 Oct 2022 00:42: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 dfw.source.kernel.org (Postfix) with ESMTPS id E125460ADB; Sat, 22 Oct 2022 07:38:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0183EC433D6; Sat, 22 Oct 2022 07:38:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424294; bh=mTM8XwlixReFBR2M/bAy6NtBfzbCLFwzZaBA3O/Amjs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OB2p/japObCqWth+VM4eOx89oQx7r7fc9ZTSADbkXdvCND7VUjWxcJKA8zsuUeYEK J1vxu2xcsYru2Ww1QEs4quYOj9Hx0aaUGOxcwDqC9fpsvRjXkKrZ6iBT7rqSefTFWL AajHqapvIA+hYRjgXL2ogxhbFBZemrjU3vuIugzw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Christian Marangi , Arnd Bergmann , Dmitry Baryshkov , Vinod Koul Subject: [PATCH 5.19 065/717] dmaengine: qcom-adm: fix wrong sizeof config in slave_config Date: Sat, 22 Oct 2022 09:19:04 +0200 Message-Id: <20221022072426.574843271@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747373032250214296?= X-GMAIL-MSGID: =?utf-8?q?1747373032250214296?= From: Christian Marangi commit 7c8765308371be30f50c1b5b97618b731514b207 upstream. Fix broken slave_config function that uncorrectly compare the peripheral_size with the size of the config pointer instead of the size of the config struct. This cause the crci value to be ignored and cause a kernel panic on any slave that use adm driver. To fix this, compare to the size of the struct and NOT the size of the pointer. Fixes: 03de6b273805 ("dmaengine: qcom-adm: stop abusing slave_id config") Signed-off-by: Christian Marangi Cc: stable@vger.kernel.org # v5.17+ Reviewed-by: Arnd Bergmann Reviewed-by: Dmitry Baryshkov Link: https://lore.kernel.org/r/20220915204844.3838-1-ansuelsmth@gmail.com Signed-off-by: Vinod Koul Signed-off-by: Greg Kroah-Hartman --- drivers/dma/qcom/qcom_adm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/dma/qcom/qcom_adm.c b/drivers/dma/qcom/qcom_adm.c index facdacf8aede..c77d9de853de 100644 --- a/drivers/dma/qcom/qcom_adm.c +++ b/drivers/dma/qcom/qcom_adm.c @@ -494,7 +494,7 @@ static int adm_slave_config(struct dma_chan *chan, struct dma_slave_config *cfg) spin_lock_irqsave(&achan->vc.lock, flag); memcpy(&achan->slave, cfg, sizeof(struct dma_slave_config)); - if (cfg->peripheral_size == sizeof(config)) + if (cfg->peripheral_size == sizeof(*config)) achan->crci = config->crci; spin_unlock_irqrestore(&achan->vc.lock, flag); From patchwork Sat Oct 22 07:19: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: 7204 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1090065wrr; Sat, 22 Oct 2022 00:45:34 -0700 (PDT) X-Google-Smtp-Source: AMsMyM63eDnlqNxKqHPStG3ob0YIp9S/uK8WbqiIkZ5sbRFDGm56GMZfl8fq4Q14iaSrahBznhT2 X-Received: by 2002:a17:902:b093:b0:185:4aa1:402c with SMTP id p19-20020a170902b09300b001854aa1402cmr23424518plr.92.1666424734136; Sat, 22 Oct 2022 00:45:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666424734; cv=none; d=google.com; s=arc-20160816; b=s2Wb2UmXbDdyYj/WUNY4wXz/dHM+ldirQvkbag3u2vwsUPlREVajVG2W7k6KDE6htZ jWbDchtfKWvUPHELhnOCj5GJr6L3aDe5jvYxhmobKPMHOy2ajieu9i1+vUe9hbKMC2LZ yYjxjaG9BpsLJxY4OYMuYEzGaDxbfVYSNy0fCtAeAh2MFdrkxZ3ZKPOvAKQEHUj5RJEd wSNe7a+NUWgtV+SgUwiQLwLbPZGBaxMVfZP/fKxD50mIfFDAjp+++28ZOxLrMK5Bur/k hdlHjHFB7k2ixU5o2D/HwN8nfYhNecfZxNmlSSMHQ5okIsiYBS0cr8V9RmAxqSirxCyr coHA== 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=0Iu0U5WwratT+qC9qW/lDkrKie8f6zBk3yq+2/poxVA=; b=01uPWl9TFMYsn0fAjPdlG43/mL6TA6CJ9ncKe/KXGa+LKNLxVOdHJxHM4n5Xwtajeg SvBHGLHTkf6h6Xc8XRu27D+aCdrdHb6m/k0++n7rWlBDQ31tcCzJVP9jBNbkA1CyByEB QLnhErfNh0nUid9vQUdmI0n+Dr9SQv3H1wiY9FHoV6xwfxANr9Br8u4/Da0gztD8M5fR N+cCU+xYgldSdWhiYOzyLQPl55XojAmbWs9xuwy6x60/B3Az4oWq9bAxekugM6yAuDRX LzkrDdrU/5f9Zj8boFUg4cHwUoNKdkOu08MXSEsMKOlR/V42wqL/k/z7U7fjUByKXpTb z9fg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=c9msrEMM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 m3-20020a056a00080300b00535d7265923si31160654pfk.377.2022.10.22.00.45.21; Sat, 22 Oct 2022 00:45: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=c9msrEMM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S230450AbiJVHpO (ORCPT + 99 others); Sat, 22 Oct 2022 03:45:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41236 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231293AbiJVHnN (ORCPT ); Sat, 22 Oct 2022 03:43: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 AB03A38A00; Sat, 22 Oct 2022 00:41: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 BE866B82DE2; Sat, 22 Oct 2022 07:38:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 34B1AC433C1; Sat, 22 Oct 2022 07:38:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424305; bh=DKXEvkae9Qlu8kF9vn+0R4ngMyO0P2H39NsbsvQknGY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=c9msrEMMG0EPTjxhVZzGcVm8itRhXi6mrAc5MHcrGeRr8u3g0cCAGIcEqVJp9wp9i b9M9WXRPnt+rOa9MagtmGE1kmfX4WiZNeXCsz4n1W0QOdxBku7A7Kgqk3EdWC1zRtm 53Moy4pvXS1S62SzE5Cw9rLpI822KosvcKEwn17A= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Christian Marangi , Vinod Koul Subject: [PATCH 5.19 066/717] dmaengine: qcom-adm: fix wrong calling convention for prep_slave_sg Date: Sat, 22 Oct 2022 09:19:05 +0200 Message-Id: <20221022072426.784470704@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747372981974386308?= X-GMAIL-MSGID: =?utf-8?q?1747372981974386308?= From: Christian Marangi commit b9d2140c3badf4107973ad77c5a0ec3075705c85 upstream. The calling convention for pre_slave_sg is to return NULL on error and provide an error log to the system. Qcom-adm instead provide error pointer when an error occur. This indirectly cause kernel panic for example for the nandc driver that checks only if the pointer returned by device_prep_slave_sg is not NULL. Returning an error pointer makes nandc think the device_prep_slave_sg function correctly completed and makes the kernel panics later in the code. While nandc is the one that makes the kernel crash, it was pointed out that the real problem is qcom-adm not following calling convention for that function. To fix this, drop returning error pointer and return NULL with an error log. Fixes: 03de6b273805 ("dmaengine: qcom-adm: stop abusing slave_id config") Fixes: 5c9f8c2dbdbe ("dmaengine: qcom: Add ADM driver") Signed-off-by: Christian Marangi Cc: stable@vger.kernel.org # v5.11+ Link: https://lore.kernel.org/r/20220916041256.7104-1-ansuelsmth@gmail.com Signed-off-by: Vinod Koul Signed-off-by: Greg Kroah-Hartman --- drivers/dma/qcom/qcom_adm.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) --- a/drivers/dma/qcom/qcom_adm.c +++ b/drivers/dma/qcom/qcom_adm.c @@ -379,13 +379,13 @@ static struct dma_async_tx_descriptor *a if (blk_size < 0) { dev_err(adev->dev, "invalid burst value: %d\n", burst); - return ERR_PTR(-EINVAL); + return NULL; } crci = achan->crci & 0xf; if (!crci || achan->crci > 0x1f) { dev_err(adev->dev, "invalid crci value\n"); - return ERR_PTR(-EINVAL); + return NULL; } } @@ -403,8 +403,10 @@ static struct dma_async_tx_descriptor *a } async_desc = kzalloc(sizeof(*async_desc), GFP_NOWAIT); - if (!async_desc) - return ERR_PTR(-ENOMEM); + if (!async_desc) { + dev_err(adev->dev, "not enough memory for async_desc struct\n"); + return NULL; + } async_desc->mux = achan->mux ? ADM_CRCI_CTL_MUX_SEL : 0; async_desc->crci = crci; @@ -414,8 +416,10 @@ static struct dma_async_tx_descriptor *a sizeof(*cple) + 2 * ADM_DESC_ALIGN; async_desc->cpl = kzalloc(async_desc->dma_len, GFP_NOWAIT); - if (!async_desc->cpl) + if (!async_desc->cpl) { + dev_err(adev->dev, "not enough memory for cpl struct\n"); goto free; + } async_desc->adev = adev; @@ -437,8 +441,10 @@ static struct dma_async_tx_descriptor *a async_desc->dma_addr = dma_map_single(adev->dev, async_desc->cpl, async_desc->dma_len, DMA_TO_DEVICE); - if (dma_mapping_error(adev->dev, async_desc->dma_addr)) + if (dma_mapping_error(adev->dev, async_desc->dma_addr)) { + dev_err(adev->dev, "dma mapping error for cpl\n"); goto free; + } cple_addr = async_desc->dma_addr + ((void *)cple - async_desc->cpl); @@ -454,7 +460,7 @@ static struct dma_async_tx_descriptor *a free: kfree(async_desc); - return ERR_PTR(-ENOMEM); + return NULL; } /** From patchwork Sat Oct 22 07:19: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: 7622 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1106905wrr; Sat, 22 Oct 2022 01:39:23 -0700 (PDT) X-Google-Smtp-Source: AMsMyM78n5SIMb2aik+7YCiF3d+SQ6OLs2CfgOqbu04vRmziK3INrZK7G8ec1ROLTJULhT4tzKl9 X-Received: by 2002:aa7:d357:0:b0:45b:dab5:9789 with SMTP id m23-20020aa7d357000000b0045bdab59789mr21801720edr.222.1666427963407; Sat, 22 Oct 2022 01:39:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666427963; cv=none; d=google.com; s=arc-20160816; b=L+KgJSKnNrBp2ps7Jl/p4I+3xs0VCmT5KABbE6QZk0R855ffvXlvOoj+uzg8fhSnyx V8yQoKvXqsCdUyLpDSt7TP0uf3bsqMiftpJ9YmJy5WZvnrI50i+JBOXEPdKs3uyKChlL d2nelZT2B3V8Of5ImxHj6nYSD0K1HRzB7JmsvT5LTszrzfW/+O4DHGhnbqASo3frfqof c9UsoPSG5Cf5PKMYG3T7heMx/xPv58s9eF7wkeJ0gHwObjazopzqVgquPsQ+felO6rt6 zQ5A2mmgRq/NLzAhQUpvnYdjYpZkYcogfYuA4izJIEpClYnTZ8rqVv/6p+gcvD6wRehZ 3QAw== 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=+uH/Vo+idfz9Hmqstjcr/fdnmcXIZlAAdPf86AVkVF8=; b=dBkSNwxwB+Et64Fhp1x3N7zaPkHCyHKFP3uzOlTDM8oHCW2ledI0wcO/1s3h62eCtF q7NlncGNGi6sxm7MJGKX3tGI0xIut6tuh7dF0jx5YXQ7ZoDb2fexBW3+PxlaqsL09dfC vZQ4P7zfnBaFMc4pgQ+LtUAr5PwJHqM/lKCIOlyg/fa8yMAvBP9hV5HIFCdbS9Ohs7Mg oPhchj+P7IrY/ApQjWAOvM8UF8gHbv+DMISFakfOhKGkJPeIvf2KuV+WLQvgROiXZLaE DOGYN2EP6fBfmQ8X7uuDdoFdv2JN+3aUMYOdD1HVM7j1q77FKxr83w3FOu6g98wt8C8A Bwgg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="QtwyQed/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 cs20-20020a170906dc9400b00791bcf8aa61si10904456ejc.505.2022.10.22.01.38.55; Sat, 22 Oct 2022 01:39: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="QtwyQed/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S234367AbiJVIhh (ORCPT + 99 others); Sat, 22 Oct 2022 04:37:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58020 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233906AbiJVIbk (ORCPT ); Sat, 22 Oct 2022 04:31: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 BE0D02E532D; Sat, 22 Oct 2022 01:03: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 AE9D860AE8; Sat, 22 Oct 2022 07:38:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C6EBAC433D7; Sat, 22 Oct 2022 07:38:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424308; bh=YbETp0ie27chZJgqXsmyTni1sjbuOpVN+srHS8SvM1s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QtwyQed/zH/44PY3WYIS48QgDE1aaNgfcpGvAa1eYtdDOYZ+9Da2+WFkjYrIRpDTy FaKFtGQ2Dm6lfOw84i2FqK2k2gYBTIInkq2PpABOoK4Dq3UuvxBrzqh2kyzRETqUrK Zu9zIKp8sCfTJ+WP9WWBuOUrqActiTge3iW3LqfQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Emil Velikov , Dmitry Osipenko , Gerd Hoffmann Subject: [PATCH 5.19 067/717] drm/virtio: Check whether transferred 2D BO is shmem Date: Sat, 22 Oct 2022 09:19:06 +0200 Message-Id: <20221022072426.988879285@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376368155839795?= X-GMAIL-MSGID: =?utf-8?q?1747376368155839795?= From: Dmitry Osipenko commit e473216b42aa1fd9fc6b94b608b42c210c655908 upstream. Transferred 2D BO always must be a shmem BO. Add check for that to prevent NULL dereference if userspace passes a VRAM BO. Cc: stable@vger.kernel.org Reviewed-by: Emil Velikov Signed-off-by: Dmitry Osipenko Link: http://patchwork.freedesktop.org/patch/msgid/20220630200726.1884320-3-dmitry.osipenko@collabora.com Signed-off-by: Gerd Hoffmann Signed-off-by: Greg Kroah-Hartman --- drivers/gpu/drm/virtio/virtgpu_vq.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/gpu/drm/virtio/virtgpu_vq.c +++ b/drivers/gpu/drm/virtio/virtgpu_vq.c @@ -595,7 +595,7 @@ void virtio_gpu_cmd_transfer_to_host_2d( bool use_dma_api = !virtio_has_dma_quirk(vgdev->vdev); struct virtio_gpu_object_shmem *shmem = to_virtio_gpu_shmem(bo); - if (use_dma_api) + if (virtio_gpu_is_shmem(bo) && use_dma_api) dma_sync_sgtable_for_device(vgdev->vdev->dev.parent, shmem->pages, DMA_TO_DEVICE); From patchwork Sat Oct 22 07:19: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: 7237 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1090883wrr; Sat, 22 Oct 2022 00:48:51 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5I0lFYH7eTGpJkhS7hczHQauQjlwndDkg3UtoqoxOpDaKmKXMQIsH7uHawOZaGVNd3Nddq X-Received: by 2002:a63:e40e:0:b0:46e:acf4:628c with SMTP id a14-20020a63e40e000000b0046eacf4628cmr8898405pgi.159.1666424931002; Sat, 22 Oct 2022 00:48:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666424930; cv=none; d=google.com; s=arc-20160816; b=bT35O3XvYFjaO6DAWECmFx/7V/l86fZzM2j5bGu6ejuqFOJhnbWYUrfV8ILeDN+J36 S8pzlDQdUu5uMP2iqwdqN+fpem+vsaY5DX+vUEa5L5nrvnKFFUzT/smxiyCx3CZfZchc zBKOkWCD3yliQUq24X0Tu+XhNd7gwaUFZ2F+C0CmM7z3g4v7wcX2q7W/DN/0P78RXOvu AM+95v+SHQPPNYOFDQ5IrJ27slXU1GNZVm0a2x/wkRkCC1I4ZVf6K3IyTRmryebjWqCH A9AvjiplCfSayglJweLLdtef/JepB570CBHIdZIN1qpSG0aqb9Wnd0yuepMxHN1iBQI+ VA9A== 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=fs0www+8PA7T57IXMJKXSnpp9C1s8zgnr8gK4cYj7iY=; b=i7hZveQ3G52xr8nDHHcKXs0jzvjiaei5+0IisTi6l/+4LpvobIKGaTqbOHCoUCEqO6 mUx26JHZ20jlub5se4bZp8sr7Y9wM8lQkxzXPR8sUQKNOHgSy6tCiNVkvFe8Va7pf2FM vv2tOuRhDzTY/LCuYi4rfc64cRZYcTzSIlOc6hNJU2Me2oGGNbFWcZC+wWKpwa96wkLT aGIpMrg4oc+aBHQ1JT9on/rI7XpEyqTneIhFyKtmKzFolnc/hZvxbgE8wjnOreinPNvn 8G8IUKcLOJLasu+HZcaoLvQSJ4pXjQpVeZIxvaNAziXof3xOyeRT3AecE8tcOQANO0Sg TYhA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=cq2lKnRv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 25-20020a630a19000000b0046e9bac6d84si8136141pgk.453.2022.10.22.00.48.38; Sat, 22 Oct 2022 00:48: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=cq2lKnRv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231599AbiJVHsN (ORCPT + 99 others); Sat, 22 Oct 2022 03:48:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34322 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231579AbiJVHrq (ORCPT ); Sat, 22 Oct 2022 03:47:46 -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 C2E11645F5; Sat, 22 Oct 2022 00:45: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 8072460B1F; Sat, 22 Oct 2022 07:38:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 90437C433D6; Sat, 22 Oct 2022 07:38:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424310; bh=ZizTAglFEXVj37CKMUyIA+z7OphHdSQB1tjv3W2T0vQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cq2lKnRvqHF7ZQBEfgizfMakPYBy3aw873pMpdlP2KZ94JWuWuCmrhlWs7Yv2nByy CR4VWitAMrORgHSg5xcw3fkxed5z0j9oIEGyFyVoRSSO5dElW8D/pxTQBkRdAbG8LC aiLy3UPaHPURfhCiLU2ieOoEeq+En1Iw3FJLuRh4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Emil Velikov , Dmitry Osipenko , Gerd Hoffmann Subject: [PATCH 5.19 068/717] drm/virtio: Unlock reservations on virtio_gpu_object_shmem_init() error Date: Sat, 22 Oct 2022 09:19:07 +0200 Message-Id: <20221022072427.171090730@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747373188737199930?= X-GMAIL-MSGID: =?utf-8?q?1747373188737199930?= From: Dmitry Osipenko commit fdf0ff4d12cbcd76b53f27c96ce51ddca400884a upstream. Unlock reservations in the error code path of virtio_gpu_object_create() to silence debug warning splat produced by ww_mutex_destroy(&obj->lock) when GEM is released with the held lock. Cc: stable@vger.kernel.org Fixes: 30172efbfb84 ("drm/virtio: blob prep: refactor getting pages and attaching backing") Reviewed-by: Emil Velikov Signed-off-by: Dmitry Osipenko Link: http://patchwork.freedesktop.org/patch/msgid/20220630200726.1884320-4-dmitry.osipenko@collabora.com Signed-off-by: Gerd Hoffmann Signed-off-by: Greg Kroah-Hartman --- drivers/gpu/drm/virtio/virtgpu_object.c | 2 ++ 1 file changed, 2 insertions(+) --- a/drivers/gpu/drm/virtio/virtgpu_object.c +++ b/drivers/gpu/drm/virtio/virtgpu_object.c @@ -248,6 +248,8 @@ int virtio_gpu_object_create(struct virt ret = virtio_gpu_object_shmem_init(vgdev, bo, &ents, &nents); if (ret != 0) { + if (fence) + virtio_gpu_array_unlock_resv(objs); virtio_gpu_array_put_free(objs); virtio_gpu_free_object(&shmem_obj->base); return ret; From patchwork Sat Oct 22 07:19: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: 7215 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1090313wrr; Sat, 22 Oct 2022 00:46:33 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4OV4yXu0tngoGz2H+GtYkAq5Q9ATf8D6zZJVE66k4NCSv4z0XIB+QrshCa0yW/DiHkzswZ X-Received: by 2002:a17:902:848c:b0:17a:b4c0:a02b with SMTP id c12-20020a170902848c00b0017ab4c0a02bmr22915117plo.122.1666424793566; Sat, 22 Oct 2022 00:46:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666424793; cv=none; d=google.com; s=arc-20160816; b=ergnp2gLjuRbzbU3+sJQe3rIOj/oROMwcrzkdoq89dQwoYiQcA8ACCKuXifSNn1xOx ZqLWtdfpW5rjKTg8LjQIuXPE9rWcgXDvjmBdnXwJOoN74NUqM2S84hPzQG9yfmRv4Xjs Mi49JfWiwQFs3nZNPWVmcfGGA/gH4fYoXjJiUjkcWI9uv8IYf5gTO6dxIiZAoqs7i+fM A/qM+AoA6Agcvy0kg1/10cEsQhdF9bjZpuCxxhR/omOqMwwBWt5gG9n1tDjLVfrY+jj8 jPOXl+uAXEqN3isKEYgN6Hcb8eLdW4MIN2NhuWTAv5JpQzNsnryZ7a3mV6wJ7klRLyJa moBA== 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=MkxjeU6M3abUBCp7GZI0PK1TC043mqKPBVbpxao033c=; b=JboiAP4tXqoR+IgPZj71ELrXbLAtk27pqpZCVgoTBqKDlpUlcvwFSaPe5Twl+Him5+ YSBQN+tSKQk995PvqBNNTQkhb4Qu+S/o9xC7RC2T/5qS8msdI0mcsz+JnshAWnlSQkvJ IGJ/hoEy/+m6vUh9VAZ9b6df12MFBVUZQVn9WOJZqZEkJ0hiQ3uSo/yUuMQQpmDPyBZP u3qFqSL8l1s+rA+cw1COXA6dJabNWLIEhfn3ePmyQcQGCIq7cIop2khhHM0Q5zXPs+1I ijvMKXw3jaXjlHoZLX7tn7uUr7TOF5iw/U4WYkVpJPWcxLgxF/3Tl3skCQZrVdZusYYq VfwA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=LkA7E4+C; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 71-20020a62144a000000b00557ea69d1f6si24881113pfu.308.2022.10.22.00.46.21; Sat, 22 Oct 2022 00:46: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=LkA7E4+C; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231422AbiJVHqE (ORCPT + 99 others); Sat, 22 Oct 2022 03:46:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44840 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231443AbiJVHoL (ORCPT ); Sat, 22 Oct 2022 03:44: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 0D410244738; Sat, 22 Oct 2022 00:42: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 1EDD160AD7; Sat, 22 Oct 2022 07:38:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2E0A1C433C1; Sat, 22 Oct 2022 07:38:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424313; bh=agcjuSq3bveQHzBFdiNuBuaHvt3WmD6K+sd8Pe9wgqw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LkA7E4+CMKgfZCo13KkyP5TeU2yAxOmf6+MmwwPPlkL0NpoLShWFoSadT2qgqR+z4 5bR6vetx/c0psq7abfTxE0cwoyXZ4/0fCxCfpRJ6nNlO0UMcRy5P4VC4UDx6xHQpz6 LFVV+VIM7KNcZSpNDOOTj4ptiZnVIw03eLmO4ALE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?utf-8?q?Thomas_Hellstr=C3=B6m?= , Dmitry Osipenko , Gerd Hoffmann Subject: [PATCH 5.19 069/717] drm/virtio: Unlock reservations on dma_resv_reserve_fences() error Date: Sat, 22 Oct 2022 09:19:08 +0200 Message-Id: <20221022072427.384315035@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747373044025393586?= X-GMAIL-MSGID: =?utf-8?q?1747373044025393586?= From: Dmitry Osipenko commit 0f877398d30e1df657a31a62f7c7de1869b072b5 upstream. Unlock reservations on dma_resv_reserve_fences() error to fix recursive locking of the reservations when this error happens. Cc: stable@vger.kernel.org Fixes: c8d4c18bfbc4 ("dma-buf/drivers: make reserving a shared slot mandatory v4") Reviewed-by: Thomas Hellström Signed-off-by: Dmitry Osipenko Link: http://patchwork.freedesktop.org/patch/msgid/20220630200726.1884320-5-dmitry.osipenko@collabora.com Signed-off-by: Gerd Hoffmann Signed-off-by: Greg Kroah-Hartman --- drivers/gpu/drm/virtio/virtgpu_gem.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) --- a/drivers/gpu/drm/virtio/virtgpu_gem.c +++ b/drivers/gpu/drm/virtio/virtgpu_gem.c @@ -228,8 +228,10 @@ int virtio_gpu_array_lock_resv(struct vi for (i = 0; i < objs->nents; ++i) { ret = dma_resv_reserve_fences(objs->objs[i]->resv, 1); - if (ret) + if (ret) { + virtio_gpu_array_unlock_resv(objs); return ret; + } } return ret; } From patchwork Sat Oct 22 07:19: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: 7219 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1090393wrr; Sat, 22 Oct 2022 00:46:52 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7ApG+MGSMnuBVXsde+QPXp52zAFO8IjwwG73CUIMnaqpgm8hVE2Hbk3gfmWI83H9U1fH/2 X-Received: by 2002:a17:90b:1d03:b0:212:cd82:aa0c with SMTP id on3-20020a17090b1d0300b00212cd82aa0cmr8072112pjb.214.1666424812400; Sat, 22 Oct 2022 00:46:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666424812; cv=none; d=google.com; s=arc-20160816; b=ETIuNe+1IRP6LYNn5izf9Z0eiBD9tHUq6YkrBlV+n7P3FxYJPFNuoNlwP1N9VW7t0P qS8NBipAhV+hG8Aalk4vGqQZas+UctElo7MHBW9GaUaIOyoTVqnJMhb9mI8iTBF+tEeT 1rx7kUvgL4L4O7EjF7pSq0WcbW39XTf6+HyQD/7VgGfcAkQKV0krwcTga6Zj2+jIoUcv vy8uHgR8GjH9eQ8puE8sRzqd9LFD8ANz9hAKtq1uliNJemsC8MvMz7jnn5nzUpP/qXcM PsRXbPC4kNC08PwWRwvrdMQYsUC6hCl0b4l1sIBqI1IcS/Z2XNpi88ol2jgVpRT5L6XF +aVQ== 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=Fi7CoqUq7ZQ/iKNziBkLwqLr8c0taNoRZVPEr7KMkEs=; b=VE3Q44bzEmogmFhSmCUHWLOdESANMxWg0++3ThQq2FHabGkGN+TnhhSIjjoTOZWtBG eMkTLCtxhR/8FEkEwIvn8YXfYdiqAWi0wHsJktPbjTE690k8FM6V94m1lZY7kImwhfHX 3MX1j9xfOrOSJcb6DPvmgYWABzaAjXwhX4WpeYADS5ZNGPX+2t2dCvGjXmOAgWzh2U1r 45MicmyqmBzeTf3FXzt52+S09liSnLU+pZ3hZrFbDF/nQSPdNZtVDhzBgCuIqIQQUrWh maTssI5n+VLIaL61/G9qckBJ0MM62TEIuLfyxJIr7058ZPa8J5mkkXpAp66e/SAY0GFk PWXg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=JSXa5X+s; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 cw15-20020a056a00450f00b00563ab8e5e43si26671852pfb.77.2022.10.22.00.46.40; Sat, 22 Oct 2022 00:46: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=JSXa5X+s; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231450AbiJVHqY (ORCPT + 99 others); Sat, 22 Oct 2022 03:46:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47108 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231496AbiJVHoV (ORCPT ); Sat, 22 Oct 2022 03:44: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 A97D87295E; Sat, 22 Oct 2022 00:42: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 BCCA860ADC; Sat, 22 Oct 2022 07:38:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D4329C433D6; Sat, 22 Oct 2022 07:38:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424316; bh=MbFzbGmRV9ls7pOfhD3dBXJvQ3BbcGXsMvn+R0z7rNM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JSXa5X+sC6JG99BML+aE0MkfItc7cR+lhpj4BcxmVhMQE2Y6FsdftGbJFmwAcP30B Kro6M+9QSD/o/cRmM9a6EmNn9YAhW1AvausC0mEUYfnKAk74ec4uljRphxP6noYE/P DnY3avWJpE5tftBZpBAAgxEHK0EQFgCOJtjtrWNw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dmitry Osipenko , Gerd Hoffmann Subject: [PATCH 5.19 070/717] drm/virtio: Use appropriate atomic state in virtio_gpu_plane_cleanup_fb() Date: Sat, 22 Oct 2022 09:19:09 +0200 Message-Id: <20221022072427.601481487@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747373064075971580?= X-GMAIL-MSGID: =?utf-8?q?1747373064075971580?= From: Dmitry Osipenko commit 4656b3a26a9e9fe5f04bfd2ab55b066266ba7f4d upstream. Make virtio_gpu_plane_cleanup_fb() to clean the state which DRM core wants to clean up and not the current plane's state. Normally the older atomic state is cleaned up, but the newer state could also be cleaned up in case of aborted commits. Cc: stable@vger.kernel.org Signed-off-by: Dmitry Osipenko Link: http://patchwork.freedesktop.org/patch/msgid/20220630200726.1884320-6-dmitry.osipenko@collabora.com Signed-off-by: Gerd Hoffmann Signed-off-by: Greg Kroah-Hartman --- drivers/gpu/drm/virtio/virtgpu_plane.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) --- a/drivers/gpu/drm/virtio/virtgpu_plane.c +++ b/drivers/gpu/drm/virtio/virtgpu_plane.c @@ -266,14 +266,14 @@ static int virtio_gpu_plane_prepare_fb(s } static void virtio_gpu_plane_cleanup_fb(struct drm_plane *plane, - struct drm_plane_state *old_state) + struct drm_plane_state *state) { struct virtio_gpu_framebuffer *vgfb; - if (!plane->state->fb) + if (!state->fb) return; - vgfb = to_virtio_gpu_framebuffer(plane->state->fb); + vgfb = to_virtio_gpu_framebuffer(state->fb); if (vgfb->fence) { dma_fence_put(&vgfb->fence->f); vgfb->fence = NULL; From patchwork Sat Oct 22 07:19: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: 7213 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1090285wrr; Sat, 22 Oct 2022 00:46:25 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6WM4Iuc6sTP25srOylk30inT645MPy2lnmAGFycSRKjuRgdLT53bXb7VgmX9JBsHPbqSo3 X-Received: by 2002:a17:903:32cf:b0:185:c53f:7459 with SMTP id i15-20020a17090332cf00b00185c53f7459mr22129945plr.82.1666424775105; Sat, 22 Oct 2022 00:46:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666424775; cv=none; d=google.com; s=arc-20160816; b=tX3w/7NlMJak8R6X6Y2JF/BQOWPMFHn4uCjMGt5vPBSU/09UPMeZP7ur7JRHVJouLa CgaPqUeUX75GbwZCN57cWpoSWWmkr7C0GPRHJcMlxoIJksracKAgbFuz7FGMh1FGr2oO HfxwZ9QRoG96nn8xEhtATiqPKr25Fom6tPhdAdJg8O4+eAPbs8iQFB4P5CIBqGjbsP3p JM6MjJJoF10NtUtGf2ADl3pIQsfV09Y5yOJjtenL0BR9pMlavwxuSGiatZS6pQG+Vc+8 JgJBy7Y+vHMW9Cu1vCpoAGCUEp8511PQ7jexlTbdPfQ1HaeGFgPgLLygKmitgFiXgP55 SjXA== 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=lIr7zUBh7gEOnVYkFX4fK5I1VdldRrFJBAM1RtwXnjI=; b=fzbHD6Ge2PZQUeo+hFJqdTvt4xddup+6+siS44tiuwHybLntRHZXM7RMiWnoTY15SU cMmJc4ejYjr/L4R8LYbXOeXttZHufoxGNbxBV7yjyv1fxFyOA+tFgZn/3nPxVU1dTeJV 7YgleO/7Dy99wKjIgKjaB84TcwHIQnhEc/M7RmbX+3E+2lVISnj/WRefm2p2wRPmC8lV q/lEzHHRhlvSGem7wTaYDxYCJjQfeHLXJgxOQXSsm3QC8y76JsxcdDPsoJ7wMsTfxlQq MmF41bgXbzVxGi0xTR/D4INcCRhJQkhFjPY3qDVhZ2lySE1klnncTQLycRrB96CdXRUq Pa8A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=2s5TM+pX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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-20020a635c1d000000b0045f83f1eb56si29034985pgb.234.2022.10.22.00.46.02; Sat, 22 Oct 2022 00:46: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=2s5TM+pX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231371AbiJVHpk (ORCPT + 99 others); Sat, 22 Oct 2022 03:45:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45918 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231330AbiJVHnd (ORCPT ); Sat, 22 Oct 2022 03:43: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 DDA2A5DF20; Sat, 22 Oct 2022 00:42: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 2EC04B82DF7; Sat, 22 Oct 2022 07:38:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7C7BAC433C1; Sat, 22 Oct 2022 07:38:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424318; bh=gMan5kpbovKahV/1vwN9rBg7BvTH6IpSR+9l0CZ8VNw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=2s5TM+pXfRjAfdsEwq4m11jtx8PH+gHLg0ONSgLeD3Om70jr+hjc+I19AyjPSYaaq bL5Zdsyf+RQkst57yrY6diDlqhtvyLwISjPO5DFWjcN/oIIW7QNcWqqMqbQZ8MeHiN 8YBeQSaz3iTMGOGMmgp4VDgQXZyhxCLWPuRZz0ac= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Daniel Vetter , Takashi Iwai , Thomas Zimmermann Subject: [PATCH 5.19 071/717] drm/udl: Restore display mode on resume Date: Sat, 22 Oct 2022 09:19:10 +0200 Message-Id: <20221022072427.764692624@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747373024764519924?= X-GMAIL-MSGID: =?utf-8?q?1747373024764519924?= From: Takashi Iwai commit 6d6e732835db92e66c28dbcf258a7e3d3c71420d upstream. Restore the display mode whne resuming from suspend. Currently, the display remains dark. On resume, the CRTC's mode does not change, but the 'active' flag changes to 'true'. Taking this into account when considering a mode switch restores the display mode. The bug is reproducable by using Gnome with udl and observing the adapter's suspend/resume behavior. Actually, the whole check added in udl_simple_display_pipe_enable() about the crtc_state->mode_changed was bogus. We should drop the whole check and always apply the mode change in this function. [ tiwai -- Drop the mode_changed check entirely instead, per Daniel's suggestion ] Fixes: 997d33c35618 ("drm/udl: Inline DPMS code into CRTC enable and disable functions") Cc: Suggested-by: Daniel Vetter Reviewed-by: Daniel Vetter Signed-off-by: Takashi Iwai Signed-off-by: Thomas Zimmermann Link: https://patchwork.freedesktop.org/patch/msgid/20220908095115.23396-2-tiwai@suse.de Signed-off-by: Greg Kroah-Hartman --- drivers/gpu/drm/udl/udl_modeset.c | 3 --- 1 file changed, 3 deletions(-) --- a/drivers/gpu/drm/udl/udl_modeset.c +++ b/drivers/gpu/drm/udl/udl_modeset.c @@ -382,9 +382,6 @@ udl_simple_display_pipe_enable(struct dr udl_handle_damage(fb, &shadow_plane_state->data[0], 0, 0, fb->width, fb->height); - if (!crtc_state->mode_changed) - return; - /* enable display */ udl_crtc_write_mode_to_hw(crtc); } From patchwork Sat Oct 22 07:19: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: 7753 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1114625wrr; Sat, 22 Oct 2022 02:07:45 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4nE11IRXKrnkmrnH12jR0r4ckzZQxi9aBP4op8SnMT5WdRVnwwyTa04LNDhXAcffsrtI0j X-Received: by 2002:a17:907:161f:b0:78e:11b3:8962 with SMTP id hb31-20020a170907161f00b0078e11b38962mr19513582ejc.0.1666429665657; Sat, 22 Oct 2022 02:07:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666429665; cv=none; d=google.com; s=arc-20160816; b=t3mIlwf7IumZ83KAWdR7LMfVfTSEsNakjrpjB+EnmKjfqBUWwEf+f4i0Bh4C54HXV3 HMuwJZBBzGERdqF/ucsgB3luMwshby5dbUfqBrbZlmVoFUXZZC26OAbRhm7U9GSKF71W s28+rLW+VbOh5YigAViAbuxUtlV1B6rDCmDhTbooVg8wfCq3zau1zv0KEInIPykDDaBs P8Bs1IJUjPDxj+hr9JjVrPmafwUo0ykxWajIWcYNZquU7l4LNAdv1wPtZWj5XQcDT0zc QGmF7Bez5Lh3eQ8VEzfNrR+cudxUJUcz5d/Zu91zmFTiV7rwsee9kW0eZH70ASChOWAQ gRDg== 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=xJqDQos4qbrfnXwgiBE6tcBQkkmvpyvo4DDUNsFAVVA=; b=t8tJ3vdfLCuRcBqqBAugVDAEhEte4ijXwD6KDSIAV6wGhtRXDy/Ds97zl7RSxJykUz Dqa4AMV4dDS0Lt4IvO5YAovNtJM2ikddFcdp/rSgCaX6e6+W4HwN2SGytilqNXGfxhHE 83wRuAZk/TP1uqxKLNKewebGGfvCu8dvpa5PrVPNrGwYvzJrZ0ZGMiLjm2T6BuLeZJL0 3k5yvdUxirpAmSFN/13MMyROMVV7ZgEbdklNRt2ePgRGDVjJC0nAFPtYPsx26v1H6mnG BPvtTOcOi7kzQ8ZA40VZC4LoBiVA9MHNdcy4LNQPfN12QGMajnV1MhDb2UfHUW7qAAPB 0JkQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=uazWaS8M; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 w3-20020a05640234c300b0045acbc10e93si26688859edc.562.2022.10.22.02.07.20; Sat, 22 Oct 2022 02:07: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=uazWaS8M; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S233232AbiJVI5P (ORCPT + 99 others); Sat, 22 Oct 2022 04:57:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59888 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234979AbiJVI4a (ORCPT ); Sat, 22 Oct 2022 04:56: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 2483641515; Sat, 22 Oct 2022 01:14: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 DB44D60AE9; Sat, 22 Oct 2022 07:37:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E7AA8C433D7; Sat, 22 Oct 2022 07:37:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424237; bh=NFaMQHnoZ9KjOYZHCfJIJjOmo+xQqEzeKxhiyS9RSVI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uazWaS8MKQUHUa51toi/A+f8lf7bQNgPhr8zP0kavl0sjeEmoidvEYBDnm7avVAZk kElw5IaRthnWFS+wSw5wo70O7TOOJvYwADSZpOOkefTL9zUqSwpgAlPousBM4oFMQE Wi0UhLKE4qbm3tDAxmtBCYYn0m5z1jttplqNx+iY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Peter Collingbourne , Evgenii Stepanov , Catalin Marinas , kernel test robot Subject: [PATCH 5.19 072/717] arm64: mte: move register initialization to C Date: Sat, 22 Oct 2022 09:19:11 +0200 Message-Id: <20221022072427.951220482@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747378152988444517?= X-GMAIL-MSGID: =?utf-8?q?1747378152988444517?= From: Peter Collingbourne commit 973b9e37330656dec719ede508e4dc40e5c2d80c upstream. If FEAT_MTE2 is disabled via the arm64.nomte command line argument on a CPU that claims to support FEAT_MTE2, the kernel will use Tagged Normal in the MAIR. If we interpret arm64.nomte to mean that the CPU does not in fact implement FEAT_MTE2, setting the system register like this may lead to UNSPECIFIED behavior. Fix it by arranging for MAIR to be set in the C function cpu_enable_mte which is called based on the sanitized version of the system register. There is no need for the rest of the MTE-related system register initialization to happen from assembly, with the exception of TCR_EL1, which must be set to include at least TBI1 because the secondary CPUs access KASan-allocated data structures early. Therefore, make the TCR_EL1 initialization unconditional and move the rest of the initialization to cpu_enable_mte so that we no longer have a dependency on the unsanitized ID register value. Co-developed-by: Evgenii Stepanov Signed-off-by: Peter Collingbourne Signed-off-by: Evgenii Stepanov Suggested-by: Catalin Marinas Reported-by: kernel test robot Fixes: 3b714d24ef17 ("arm64: mte: CPU feature detection and initial sysreg configuration") Cc: # 5.10.x Link: https://lore.kernel.org/r/20220915222053.3484231-1-eugenis@google.com Signed-off-by: Catalin Marinas Signed-off-by: Greg Kroah-Hartman --- arch/arm64/include/asm/mte.h | 5 ++++ arch/arm64/kernel/cpufeature.c | 3 +- arch/arm64/kernel/mte.c | 51 +++++++++++++++++++++++++++++++++++++++++ arch/arm64/kernel/suspend.c | 2 + arch/arm64/mm/proc.S | 46 ++++-------------------------------- 5 files changed, 65 insertions(+), 42 deletions(-) --- a/arch/arm64/include/asm/mte.h +++ b/arch/arm64/include/asm/mte.h @@ -42,7 +42,9 @@ void mte_sync_tags(pte_t old_pte, pte_t void mte_copy_page_tags(void *kto, const void *kfrom); void mte_thread_init_user(void); void mte_thread_switch(struct task_struct *next); +void mte_cpu_setup(void); void mte_suspend_enter(void); +void mte_suspend_exit(void); long set_mte_ctrl(struct task_struct *task, unsigned long arg); long get_mte_ctrl(struct task_struct *task); int mte_ptrace_copy_tags(struct task_struct *child, long request, @@ -72,6 +74,9 @@ static inline void mte_thread_switch(str static inline void mte_suspend_enter(void) { } +static inline void mte_suspend_exit(void) +{ +} static inline long set_mte_ctrl(struct task_struct *task, unsigned long arg) { return 0; --- a/arch/arm64/kernel/cpufeature.c +++ b/arch/arm64/kernel/cpufeature.c @@ -1962,7 +1962,8 @@ static void bti_enable(const struct arm6 static void cpu_enable_mte(struct arm64_cpu_capabilities const *cap) { sysreg_clear_set(sctlr_el1, 0, SCTLR_ELx_ATA | SCTLR_EL1_ATA0); - isb(); + + mte_cpu_setup(); /* * Clear the tags in the zero page. This needs to be done via the --- a/arch/arm64/kernel/mte.c +++ b/arch/arm64/kernel/mte.c @@ -294,6 +294,49 @@ void mte_thread_switch(struct task_struc mte_check_tfsr_el1(); } +void mte_cpu_setup(void) +{ + u64 rgsr; + + /* + * CnP must be enabled only after the MAIR_EL1 register has been set + * up. Inconsistent MAIR_EL1 between CPUs sharing the same TLB may + * lead to the wrong memory type being used for a brief window during + * CPU power-up. + * + * CnP is not a boot feature so MTE gets enabled before CnP, but let's + * make sure that is the case. + */ + BUG_ON(read_sysreg(ttbr0_el1) & TTBR_CNP_BIT); + BUG_ON(read_sysreg(ttbr1_el1) & TTBR_CNP_BIT); + + /* Normal Tagged memory type at the corresponding MAIR index */ + sysreg_clear_set(mair_el1, + MAIR_ATTRIDX(MAIR_ATTR_MASK, MT_NORMAL_TAGGED), + MAIR_ATTRIDX(MAIR_ATTR_NORMAL_TAGGED, + MT_NORMAL_TAGGED)); + + write_sysreg_s(KERNEL_GCR_EL1, SYS_GCR_EL1); + + /* + * If GCR_EL1.RRND=1 is implemented the same way as RRND=0, then + * RGSR_EL1.SEED must be non-zero for IRG to produce + * pseudorandom numbers. As RGSR_EL1 is UNKNOWN out of reset, we + * must initialize it. + */ + rgsr = (read_sysreg(CNTVCT_EL0) & SYS_RGSR_EL1_SEED_MASK) << + SYS_RGSR_EL1_SEED_SHIFT; + if (rgsr == 0) + rgsr = 1 << SYS_RGSR_EL1_SEED_SHIFT; + write_sysreg_s(rgsr, SYS_RGSR_EL1); + + /* clear any pending tag check faults in TFSR*_EL1 */ + write_sysreg_s(0, SYS_TFSR_EL1); + write_sysreg_s(0, SYS_TFSRE0_EL1); + + local_flush_tlb_all(); +} + void mte_suspend_enter(void) { if (!system_supports_mte()) @@ -310,6 +353,14 @@ void mte_suspend_enter(void) mte_check_tfsr_el1(); } +void mte_suspend_exit(void) +{ + if (!system_supports_mte()) + return; + + mte_cpu_setup(); +} + long set_mte_ctrl(struct task_struct *task, unsigned long arg) { u64 mte_ctrl = (~((arg & PR_MTE_TAG_MASK) >> PR_MTE_TAG_SHIFT) & --- a/arch/arm64/kernel/suspend.c +++ b/arch/arm64/kernel/suspend.c @@ -43,6 +43,8 @@ void notrace __cpu_suspend_exit(void) { unsigned int cpu = smp_processor_id(); + mte_suspend_exit(); + /* * We are resuming from reset with the idmap active in TTBR0_EL1. * We must uninstall the idmap and restore the expected MMU --- a/arch/arm64/mm/proc.S +++ b/arch/arm64/mm/proc.S @@ -47,17 +47,19 @@ #ifdef CONFIG_KASAN_HW_TAGS #define TCR_MTE_FLAGS TCR_TCMA1 | TCR_TBI1 | TCR_TBID1 -#else +#elif defined(CONFIG_ARM64_MTE) /* * The mte_zero_clear_page_tags() implementation uses DC GZVA, which relies on * TBI being enabled at EL1. */ #define TCR_MTE_FLAGS TCR_TBI1 | TCR_TBID1 +#else +#define TCR_MTE_FLAGS 0 #endif /* * Default MAIR_EL1. MT_NORMAL_TAGGED is initially mapped as Normal memory and - * changed during __cpu_setup to Normal Tagged if the system supports MTE. + * changed during mte_cpu_setup to Normal Tagged if the system supports MTE. */ #define MAIR_EL1_SET \ (MAIR_ATTRIDX(MAIR_ATTR_DEVICE_nGnRnE, MT_DEVICE_nGnRnE) | \ @@ -421,46 +423,8 @@ SYM_FUNC_START(__cpu_setup) mov_q mair, MAIR_EL1_SET mov_q tcr, TCR_TxSZ(VA_BITS) | TCR_CACHE_FLAGS | TCR_SMP_FLAGS | \ TCR_TG_FLAGS | TCR_KASLR_FLAGS | TCR_ASID16 | \ - TCR_TBI0 | TCR_A1 | TCR_KASAN_SW_FLAGS - -#ifdef CONFIG_ARM64_MTE - /* - * Update MAIR_EL1, GCR_EL1 and TFSR*_EL1 if MTE is supported - * (ID_AA64PFR1_EL1[11:8] > 1). - */ - mrs x10, ID_AA64PFR1_EL1 - ubfx x10, x10, #ID_AA64PFR1_MTE_SHIFT, #4 - cmp x10, #ID_AA64PFR1_MTE - b.lt 1f - - /* Normal Tagged memory type at the corresponding MAIR index */ - mov x10, #MAIR_ATTR_NORMAL_TAGGED - bfi mair, x10, #(8 * MT_NORMAL_TAGGED), #8 + TCR_TBI0 | TCR_A1 | TCR_KASAN_SW_FLAGS | TCR_MTE_FLAGS - mov x10, #KERNEL_GCR_EL1 - msr_s SYS_GCR_EL1, x10 - - /* - * If GCR_EL1.RRND=1 is implemented the same way as RRND=0, then - * RGSR_EL1.SEED must be non-zero for IRG to produce - * pseudorandom numbers. As RGSR_EL1 is UNKNOWN out of reset, we - * must initialize it. - */ - mrs x10, CNTVCT_EL0 - ands x10, x10, #SYS_RGSR_EL1_SEED_MASK - csinc x10, x10, xzr, ne - lsl x10, x10, #SYS_RGSR_EL1_SEED_SHIFT - msr_s SYS_RGSR_EL1, x10 - - /* clear any pending tag check faults in TFSR*_EL1 */ - msr_s SYS_TFSR_EL1, xzr - msr_s SYS_TFSRE0_EL1, xzr - - /* set the TCR_EL1 bits */ - mov_q x10, TCR_MTE_FLAGS - orr tcr, tcr, x10 -1: -#endif tcr_clear_errata_bits tcr, x9, x5 #ifdef CONFIG_ARM64_VA_BITS_52 From patchwork Sat Oct 22 07:19: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: 7434 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1098284wrr; Sat, 22 Oct 2022 01:10:19 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6txPgp0JYU5eD+zK35YtFSaYUqHWJV0xnkQHHV1GnJpJ9yaO+epzoDQ0qmwawNuYKKXZZi X-Received: by 2002:a63:5d18:0:b0:462:f77b:cd29 with SMTP id r24-20020a635d18000000b00462f77bcd29mr19840270pgb.9.1666426218761; Sat, 22 Oct 2022 01:10:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666426218; cv=none; d=google.com; s=arc-20160816; b=Z3TbBO+DcdUEuu3zVa0ax8tQbxDU6Lq6tS4qE3tmAm/DElvVdy9DKIo8oi6/yrJcQK Dt5nywmWjX0JMCHOPY362h3b+e2cQb9aNMVqZvxArb6SNfoLG5jEy5Ed57A1BfWr+Mwk zv9OU20JzoVkTfj4Y9YaPE5g1rQZIvsK2J5n3sm18zF4GeTUTZIcbh8URHDSIrh/3omo yvPyyhtzldIXcK81RHIvTqQiIO975JbaWq8KBzAbYbVLEbyplgg7Aes1Ls/pezoAPOSu Lg5ibGmOVtiDbF0z0WlldhUKuhhgdhknJDhwkCFNZhfsaXEwig+BOQWT7rnK1UGAGmlr x70g== 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=JN4U2KdeOm76MpUpnRJwEJEgecSKwua3MY26ImKD6mo=; b=giuxol6ZHLVYQR+YtcXU15OsQUKE36RkWvNesQWtTFEwnIkMj6lDiBPxL2eVVANsdQ zvoOPLJhWgR06GxEQuCh4fO/VPaUWmeVNTvcuRcCVwzKU+deETLAJxDgLd9/36hpRYMP 1HfW1DKHsjicpI/QKuD25DdJrg4bXeSXsa4CoJpgI4C/sCntSvwZwLPs1m7oHMgbvfjH RuaQKv4gF5XK3Kkr9DNGfhZV5IgHISQ4Iqz6OofTKspX+M8iLKNZOhlb9rr9QEkkqYFf VeT3A9beojE3TlHftfbpbvw7BAWWyq65tA47R0qL/w6tZ7KqmABdPRQDZqwSgk6pWQuS cEew== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=oYmwdYN3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 cj19-20020a056a00299300b00561741403adsi862880pfb.182.2022.10.22.01.10.05; Sat, 22 Oct 2022 01:10: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=oYmwdYN3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S233092AbiJVIIq (ORCPT + 99 others); Sat, 22 Oct 2022 04:08:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60046 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233051AbiJVIEq (ORCPT ); Sat, 22 Oct 2022 04:04: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 25A8E2D37FF; Sat, 22 Oct 2022 00:51: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 1C57DB82DF2; Sat, 22 Oct 2022 07:37:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 84AE2C433D6; Sat, 22 Oct 2022 07:37:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424239; bh=oMix186Lse2NQD3gTlZX1UK/UVPp5ODuSEv2O/Plpw0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oYmwdYN3QKBvBRYplGtv6+yDWN6xjIU9gvPqrpOFgimEpCut3j9dc7GPHGeflWG2i o/hpKNVZGLDPAH40tTG1mtxVISVQZV7P4g0fc9Pp2RTx7+vd3xCiWuuEBR8YAOeovU jCO4bF0ZzNr5xxZXAszonZWrmLGzDhVM1LpRQAcc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, James Morse , Catalin Marinas Subject: [PATCH 5.19 073/717] arm64: errata: Add Cortex-A55 to the repeat tlbi list Date: Sat, 22 Oct 2022 09:19:12 +0200 Message-Id: <20221022072428.164381986@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747374538722109464?= X-GMAIL-MSGID: =?utf-8?q?1747374538722109464?= From: James Morse commit 171df58028bf4649460fb146a56a58dcb0c8f75a upstream. Cortex-A55 is affected by an erratum where in rare circumstances the CPUs may not handle a race between a break-before-make sequence on one CPU, and another CPU accessing the same page. This could allow a store to a page that has been unmapped. Work around this by adding the affected CPUs to the list that needs TLB sequences to be done twice. Signed-off-by: James Morse Cc: Link: https://lore.kernel.org/r/20220930131959.3082594-1-james.morse@arm.com Signed-off-by: Catalin Marinas Signed-off-by: Greg Kroah-Hartman --- Documentation/arm64/silicon-errata.rst | 2 ++ arch/arm64/Kconfig | 17 +++++++++++++++++ arch/arm64/kernel/cpu_errata.c | 5 +++++ 3 files changed, 24 insertions(+) --- a/Documentation/arm64/silicon-errata.rst +++ b/Documentation/arm64/silicon-errata.rst @@ -76,6 +76,8 @@ stable kernels. +----------------+-----------------+-----------------+-----------------------------+ | ARM | Cortex-A55 | #1530923 | ARM64_ERRATUM_1530923 | +----------------+-----------------+-----------------+-----------------------------+ +| ARM | Cortex-A55 | #2441007 | ARM64_ERRATUM_2441007 | ++----------------+-----------------+-----------------+-----------------------------+ | ARM | Cortex-A57 | #832075 | ARM64_ERRATUM_832075 | +----------------+-----------------+-----------------+-----------------------------+ | ARM | Cortex-A57 | #852523 | N/A | --- a/arch/arm64/Kconfig +++ b/arch/arm64/Kconfig @@ -629,6 +629,23 @@ config ARM64_ERRATUM_1530923 config ARM64_WORKAROUND_REPEAT_TLBI bool +config ARM64_ERRATUM_2441007 + bool "Cortex-A55: Completion of affected memory accesses might not be guaranteed by completion of a TLBI" + default y + select ARM64_WORKAROUND_REPEAT_TLBI + help + This option adds a workaround for ARM Cortex-A55 erratum #2441007. + + Under very rare circumstances, affected Cortex-A55 CPUs + may not handle a race between a break-before-make sequence on one + CPU, and another CPU accessing the same page. This could allow a + store to a page that has been unmapped. + + Work around this by adding the affected CPUs to the list that needs + TLB sequences to be done twice. + + If unsure, say Y. + config ARM64_ERRATUM_1286807 bool "Cortex-A76: Modification of the translation table for a virtual address might lead to read-after-read ordering violation" default y --- a/arch/arm64/kernel/cpu_errata.c +++ b/arch/arm64/kernel/cpu_errata.c @@ -214,6 +214,11 @@ static const struct arm64_cpu_capabiliti ERRATA_MIDR_RANGE(MIDR_QCOM_KRYO_4XX_GOLD, 0xc, 0xe, 0xf, 0xe), }, #endif +#ifdef CONFIG_ARM64_ERRATUM_2441007 + { + ERRATA_MIDR_ALL_VERSIONS(MIDR_CORTEX_A55), + }, +#endif #ifdef CONFIG_ARM64_ERRATUM_2441009 { /* Cortex-A510 r0p0 -> r1p1. Fixed in r1p2 */ From patchwork Sat Oct 22 07:19: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: 7462 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1098801wrr; Sat, 22 Oct 2022 01:11:49 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7EeoDysWmheDvwOfFmkZ8t0vHN7JDY6K15Dxx6QU0gFV8RCo2AOV7+C1cLNSpBvaxTZOqx X-Received: by 2002:a63:1e16:0:b0:430:5c4a:a3b5 with SMTP id e22-20020a631e16000000b004305c4aa3b5mr20242892pge.37.1666426308824; Sat, 22 Oct 2022 01:11:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666426308; cv=none; d=google.com; s=arc-20160816; b=UcNChjMK51uhxuVG7dyZP+/4AA77FhPwv4TRdt1tys50SE5tFQyjqchgyHXTVbkC73 PC92yVa4KvxtqNMkuijjahRVtRJA6lsNIxHJb1lqElAfE44dcDyNzMzfFddzvdeBnug4 vJCLdrht3moc8a6ALMqGL0a/a8ZgodMoaDzJKn30/hUr2RSjlTas0W1n01roJAwxb/eK Fzb0hsAxSz/zzBg9JNkG7eHkrrxyT92ke9TrzOCcUYe6lWvKBBrVwd9pTvy4lamGVq2M pJSsY0+92/lyEhI+AjnlNy5nFpfLkqoL1emsNCnNb0ndzRmu1SDrq2+zZHsogrqbJYCW gzCQ== 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=f1H1hKr2UijXs6Wuu+8G8FiM68vTXKmq9zmWrDR8tCQ=; b=uFY9Atuj+RZe69WRojiR5x/0WwIIuqF9L4Qirz/lKfH45paz6ZxOa6vnrj7KLzktaA vWOOctc4sVVCJ2v1YR2VbxyQTSHHp08ODahajPEZlJyr7ViBe3YfXbE+Nwt6l2dnwn5u 5o4MibFNf4nW+9E0Z6kgR0m25xpw1GSebqlE8KD+Tw+VBCKnB2G/FjOZd7jDbNuxfuuA yy39jKNRARvMBWwzYzdWJ+YKyRyzRodg/7sXnHP34tZTaytyNvfUyyQ4PEEJV0+W85ZL knwXyaqSCnmYtWolsVuzXfbT6MYQXH6nqjZSY3HF3lv6Jyf79nL2PUGW7Go7Z+MnSEuG GKMQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ZjIa1fr+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 y7-20020a170902700700b0017e0ca906c8si24729779plk.568.2022.10.22.01.11.36; Sat, 22 Oct 2022 01:11: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=ZjIa1fr+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S233158AbiJVILB (ORCPT + 99 others); Sat, 22 Oct 2022 04:11:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50122 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232983AbiJVIHt (ORCPT ); Sat, 22 Oct 2022 04:07:49 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AAE432CB8B4; Sat, 22 Oct 2022 00:53: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 3A65D60AE6; Sat, 22 Oct 2022 07:37:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1B5A1C433D6; Sat, 22 Oct 2022 07:37:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424242; bh=UzWcRCSCGAHYUtnLJmb+NhEh2plIKFuHU5nHeprqRTA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZjIa1fr+CNXulpRPPni7W3+cwwRGmhG2kZUyPSjb1JrFwmipLeeRVl60I9zeKbqCb ETnwRd9ZPz/ps95HB/lWz275GTI7ueOQKuin5V3WUxzua0SI3o8kaGXFfOHBnRZ8ay buITDJ4wBDvw1qjUdtaW0lLeRAMHv/0Fd0G9y5vQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Daniel Lezcano , Thomas Gleixner , Marc Zyngier , Mark Rutland , Yang Guo , Shaokun Zhang Subject: [PATCH 5.19 074/717] clocksource/drivers/arm_arch_timer: Fix CNTPCT_LO and CNTVCT_LO value Date: Sat, 22 Oct 2022 09:19:13 +0200 Message-Id: <20221022072428.368129337@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747374633480257320?= X-GMAIL-MSGID: =?utf-8?q?1747374633480257320?= From: Yang Guo commit af246cc6d0ed11318223606128bb0b09866c4c08 upstream. CNTPCT_LO and CNTVCT_LO are defined by mistake in commit '8b82c4f883a7', so fix them according to the Arm ARM DDI 0487I.a, Table I2-4 "CNTBaseN memory map" as follows: Offset Register Type Description 0x000 CNTPCT[31:0] RO Physical Count register. 0x004 CNTPCT[63:32] RO 0x008 CNTVCT[31:0] RO Virtual Count register. 0x00C CNTVCT[63:32] RO Fixes: 8b82c4f883a7 ("clocksource/drivers/arm_arch_timer: Move MMIO timer programming over to CVAL") Cc: stable@vger.kernel.org Cc: Daniel Lezcano Cc: Thomas Gleixner Cc: Marc Zyngier Cc: Mark Rutland Acked-by: Marc Zyngier Signed-off-by: Yang Guo Signed-off-by: Shaokun Zhang Link: https://lore.kernel.org/r/20220927033221.49589-1-zhangshaokun@hisilicon.com Signed-off-by: Daniel Lezcano Signed-off-by: Greg Kroah-Hartman --- drivers/clocksource/arm_arch_timer.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/drivers/clocksource/arm_arch_timer.c +++ b/drivers/clocksource/arm_arch_timer.c @@ -44,8 +44,8 @@ #define CNTACR_RWVT BIT(4) #define CNTACR_RWPT BIT(5) -#define CNTVCT_LO 0x00 -#define CNTPCT_LO 0x08 +#define CNTPCT_LO 0x00 +#define CNTVCT_LO 0x08 #define CNTFRQ 0x10 #define CNTP_CVAL_LO 0x20 #define CNTP_CTL 0x2c From patchwork Sat Oct 22 07:19: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: 7835 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1151452wrr; Sat, 22 Oct 2022 04:01:11 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6ZZAmPDZlH9j1a+wCOcwWVeWSEF9VIS1Tfpt2NnNuy+L6Ndylgj4qFmsl8qPGPR3ey2J5b X-Received: by 2002:a17:906:844f:b0:78d:8bd1:ee8c with SMTP id e15-20020a170906844f00b0078d8bd1ee8cmr20354761ejy.262.1666436471536; Sat, 22 Oct 2022 04:01:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666436471; cv=none; d=google.com; s=arc-20160816; b=E/em6t75aaF4L3xWqOmF9hyQx11+nyknMVxCjJE3U5V5Ckm75BNXrDeuyHDUBwGJIq d2VGndJ1bJKMjsD/zLCVXF6FAXh152jMnClNFV9eUJ3yuBrmlcviibihqwDun8wAmDHK W3EWpFXRDFRGRp+w15of3Rg4bQfvEMw+x1xzRrsSq0SYCSwwR6r39iCxokK/KJgLPjOO LWk1ANiEBX+/O53eAvTGU8K+j8EsLX4nVbecEa6pgtRzuzFr3gEHtvMXZnq6bMlohZiQ fW+nDdnAn5pde2CS4frnT86+66Sabq38fa+VrM3unawKm9tHCueN9q26ua4iGcF6s/3H BsPg== 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=jhIgk7uNzqM0FSskvpzwWbwrdzjmca4W8jrG0Wda5cE=; b=wrMgTUW9fEn3RjMPthPJssVHPCSy0JKc99R2e0Tfclrh5hrlyaDe0DrjWB9k0eOyKG ouodHjmo8kbjlvj/kqbQIe1OmTujpMrDdX8yO+olNzq3vTM127+ei+oSWbbmj1OA4EC5 cQuthSXcvCsWlLjeG9YXmCdYkmagGEh6Ns6l0XJj7i8BZapbu8XZ5sfn7WUBHF+0lj2b CJq94YcQg/IiR8ux4R/y9YEkvk82dZCbL1dj8jmdZvCE3gmYBoRESA1ujAjGaN5GHhks WVdZR5SomVAcSddU8lBIIwQ9T/kSFCOIPukjIEqZWUBP6csnwzIt55TIJGaH6PZ2ymPr buKg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="KYcS/q45"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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-20020a50e703000000b00458d2bdcb30si20778547edn.96.2022.10.22.04.00.46; Sat, 22 Oct 2022 04:01: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="KYcS/q45"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S230473AbiJVKvG (ORCPT + 99 others); Sat, 22 Oct 2022 06:51:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46458 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230454AbiJVKul (ORCPT ); Sat, 22 Oct 2022 06:50:41 -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 06D00285105; Sat, 22 Oct 2022 03: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 dfw.source.kernel.org (Postfix) with ESMTPS id E722260A5C; Sat, 22 Oct 2022 07:37:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 09275C433D6; Sat, 22 Oct 2022 07:37:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424245; bh=NsVJ/BIVWYCUiIPM2sLFZV0xqyU63Ea0NVA+bdB/+IU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KYcS/q455gyqXRzbZgftArqYYz2LDohCjZu7YgFEzY46YijmBNTYC6dMoCFZZJtdc XnFTTCJFwKfqucDkpgmjxYBUIrBRCZFs8BazOasxngvz8Kj7aI/gQZjYJTk06bTpR3 ymweYP+3xhstbcYKx63Fv0Mf5oJzunhiQoLZkAf0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Baolin Wang , Mike Kravetz , David Hildenbrand , Muchun Song , Andrew Morton Subject: [PATCH 5.19 075/717] mm/hugetlb: fix races when looking up a CONT-PTE/PMD size hugetlb page Date: Sat, 22 Oct 2022 09:19:14 +0200 Message-Id: <20221022072428.550961015@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 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?1747385289411210083?= X-GMAIL-MSGID: =?utf-8?q?1747385289411210083?= From: Baolin Wang commit fac35ba763ed07ba93154c95ffc0c4a55023707f upstream. On some architectures (like ARM64), it can support CONT-PTE/PMD size hugetlb, which means it can support not only PMD/PUD size hugetlb (2M and 1G), but also CONT-PTE/PMD size(64K and 32M) if a 4K page size specified. So when looking up a CONT-PTE size hugetlb page by follow_page(), it will use pte_offset_map_lock() to get the pte entry lock for the CONT-PTE size hugetlb in follow_page_pte(). However this pte entry lock is incorrect for the CONT-PTE size hugetlb, since we should use huge_pte_lock() to get the correct lock, which is mm->page_table_lock. That means the pte entry of the CONT-PTE size hugetlb under current pte lock is unstable in follow_page_pte(), we can continue to migrate or poison the pte entry of the CONT-PTE size hugetlb, which can cause some potential race issues, even though they are under the 'pte lock'. For example, suppose thread A is trying to look up a CONT-PTE size hugetlb page by move_pages() syscall under the lock, however antoher thread B can migrate the CONT-PTE hugetlb page at the same time, which will cause thread A to get an incorrect page, if thread A also wants to do page migration, then data inconsistency error occurs. Moreover we have the same issue for CONT-PMD size hugetlb in follow_huge_pmd(). To fix above issues, rename the follow_huge_pmd() as follow_huge_pmd_pte() to handle PMD and PTE level size hugetlb, which uses huge_pte_lock() to get the correct pte entry lock to make the pte entry stable. Mike said: Support for CONT_PMD/_PTE was added with bb9dd3df8ee9 ("arm64: hugetlb: refactor find_num_contig()"). Patch series "Support for contiguous pte hugepages", v4. However, I do not believe these code paths were executed until migration support was added with 5480280d3f2d ("arm64/mm: enable HugeTLB migration for contiguous bit HugeTLB pages") I would go with 5480280d3f2d for the Fixes: targe. Link: https://lkml.kernel.org/r/635f43bdd85ac2615a58405da82b4d33c6e5eb05.1662017562.git.baolin.wang@linux.alibaba.com Fixes: 5480280d3f2d ("arm64/mm: enable HugeTLB migration for contiguous bit HugeTLB pages") Signed-off-by: Baolin Wang Suggested-by: Mike Kravetz Reviewed-by: Mike Kravetz Cc: David Hildenbrand Cc: Muchun Song Cc: Signed-off-by: Andrew Morton Signed-off-by: Greg Kroah-Hartman --- include/linux/hugetlb.h | 8 ++++---- mm/gup.c | 14 +++++++++++++- mm/hugetlb.c | 27 +++++++++++++-------------- 3 files changed, 30 insertions(+), 19 deletions(-) --- a/include/linux/hugetlb.h +++ b/include/linux/hugetlb.h @@ -203,8 +203,8 @@ struct page *follow_huge_addr(struct mm_ struct page *follow_huge_pd(struct vm_area_struct *vma, unsigned long address, hugepd_t hpd, int flags, int pdshift); -struct page *follow_huge_pmd(struct mm_struct *mm, unsigned long address, - pmd_t *pmd, int flags); +struct page *follow_huge_pmd_pte(struct vm_area_struct *vma, unsigned long address, + int flags); struct page *follow_huge_pud(struct mm_struct *mm, unsigned long address, pud_t *pud, int flags); struct page *follow_huge_pgd(struct mm_struct *mm, unsigned long address, @@ -308,8 +308,8 @@ static inline struct page *follow_huge_p return NULL; } -static inline struct page *follow_huge_pmd(struct mm_struct *mm, - unsigned long address, pmd_t *pmd, int flags) +static inline struct page *follow_huge_pmd_pte(struct vm_area_struct *vma, + unsigned long address, int flags) { return NULL; } --- a/mm/gup.c +++ b/mm/gup.c @@ -531,6 +531,18 @@ static struct page *follow_page_pte(stru if (WARN_ON_ONCE((flags & (FOLL_PIN | FOLL_GET)) == (FOLL_PIN | FOLL_GET))) return ERR_PTR(-EINVAL); + + /* + * Considering PTE level hugetlb, like continuous-PTE hugetlb on + * ARM64 architecture. + */ + if (is_vm_hugetlb_page(vma)) { + page = follow_huge_pmd_pte(vma, address, flags); + if (page) + return page; + return no_page_table(vma, flags); + } + retry: if (unlikely(pmd_bad(*pmd))) return no_page_table(vma, flags); @@ -663,7 +675,7 @@ static struct page *follow_pmd_mask(stru if (pmd_none(pmdval)) return no_page_table(vma, flags); if (pmd_huge(pmdval) && is_vm_hugetlb_page(vma)) { - page = follow_huge_pmd(mm, address, pmd, flags); + page = follow_huge_pmd_pte(vma, address, flags); if (page) return page; return no_page_table(vma, flags); --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -6906,12 +6906,13 @@ follow_huge_pd(struct vm_area_struct *vm } struct page * __weak -follow_huge_pmd(struct mm_struct *mm, unsigned long address, - pmd_t *pmd, int flags) +follow_huge_pmd_pte(struct vm_area_struct *vma, unsigned long address, int flags) { + struct hstate *h = hstate_vma(vma); + struct mm_struct *mm = vma->vm_mm; struct page *page = NULL; spinlock_t *ptl; - pte_t pte; + pte_t *ptep, pte; /* * FOLL_PIN is not supported for follow_page(). Ordinary GUP goes via @@ -6921,17 +6922,15 @@ follow_huge_pmd(struct mm_struct *mm, un return NULL; retry: - ptl = pmd_lockptr(mm, pmd); - spin_lock(ptl); - /* - * make sure that the address range covered by this pmd is not - * unmapped from other threads. - */ - if (!pmd_huge(*pmd)) - goto out; - pte = huge_ptep_get((pte_t *)pmd); + ptep = huge_pte_offset(mm, address, huge_page_size(h)); + if (!ptep) + return NULL; + + ptl = huge_pte_lock(h, mm, ptep); + pte = huge_ptep_get(ptep); if (pte_present(pte)) { - page = pmd_page(*pmd) + ((address & ~PMD_MASK) >> PAGE_SHIFT); + page = pte_page(pte) + + ((address & ~huge_page_mask(h)) >> PAGE_SHIFT); /* * try_grab_page() should always succeed here, because: a) we * hold the pmd (ptl) lock, and b) we've just checked that the @@ -6947,7 +6946,7 @@ retry: } else { if (is_hugetlb_entry_migration(pte)) { spin_unlock(ptl); - __migration_entry_wait_huge((pte_t *)pmd, ptl); + __migration_entry_wait_huge(ptep, ptl); goto retry; } /* From patchwork Sat Oct 22 07:19: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: 7797 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1124552wrr; Sat, 22 Oct 2022 02:37:04 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5LAkFMKQBQhE8D6tASzMd5Jo4z5EhLZ8Dq/ekWYzMyU1ZiW8ZwHryCksVltFGyx8/udGHT X-Received: by 2002:a17:906:2a93:b0:78d:b87e:6aab with SMTP id l19-20020a1709062a9300b0078db87e6aabmr19200413eje.157.1666431424532; Sat, 22 Oct 2022 02:37:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666431424; cv=none; d=google.com; s=arc-20160816; b=zIH5PG8Iz07CwGgnf2qfTZhrQRdGeYF+Tq1IlRMgCOI0mjPf2g81w16SgePaaU6iGH oAP2sC6+wnSbXkreTxjZVQ4wVM+CJbHWtWM6dIIe1ldA66TIqtiwIP2RjRrgDp6K/LLo +gdOnoA1SSd2PJ+UdxYHqKgEScVEtgOBReY3nqIIXgIciHQJ//GCrAa5IpjGXEBLbJQz S5bpoAibFg5TJOsyaFDjiIcy6vlq7nWDEC7V20s+JoNIOU/ekIWxCnrErT3DTr0rGRkG jJB9fWwZDmVNVOrBKLKwR0P4N2L3GUEXoMU0tpR5wbExw7f4vhEFie9/NgdeTeQRbMGC ySOA== 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=RGwaLVJROyG+xukoRwaAjzO2VtOKfTbFcHqQ254I78Y=; b=Fs6eImEhcFufrEdwkiBtpTPZv7ieCzMy8PzWaOXFUzyL0If8/taOyNQZwA5ux58707 +26NiXeVJ5WdySrJ58wH96xcI+lPRC4CjeXrzHM756Dwthn7Cww8XVgW48Z0P/vwS7ez md217hUZucsQ5wf67iSitE+tHlVL9GCj3o9BD+hf8yckhadXWx//AKiRfuui8epbMV3E 9dGBPnp4l+9ovnE2ATkw6InmuZtx4NUwvuDLrdv6PHQg691zdK5zpGJ3nw9eNwOg7P8/ QYTkA+YvLn5MGzOnPviSAG3WoD1NjiFQN7mRETP+5OwCsHUq6CIjknJpRlT9PXLmNXra UrIA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=E4ag0xT2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 dp20-20020a170906c15400b0078dfe6dc4d2si23522738ejc.33.2022.10.22.02.36.39; Sat, 22 Oct 2022 02:37: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=E4ag0xT2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231240AbiJVJVl (ORCPT + 99 others); Sat, 22 Oct 2022 05:21:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33096 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231176AbiJVJVJ (ORCPT ); Sat, 22 Oct 2022 05:21: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 D896B2CC9E; Sat, 22 Oct 2022 01:34: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 dfw.source.kernel.org (Postfix) with ESMTPS id 9211060AED; Sat, 22 Oct 2022 07:37:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A032FC433C1; Sat, 22 Oct 2022 07:37:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424248; bh=I6MFGlUEj5EUaxpuOQQn/MHXXgwh2qEtqurcxmSeeuQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=E4ag0xT2Muh0ZkTFPuB+Ju1pKy1rc4Q1s3wLTnVpJFVyCSXTkAFq2M94sg3w8xUJg 8jFwEz1oztcgDSaGcYAZKSsDNTIrUYucP9PvPP6WqVySFJ/wL0HSHLv/8s8v+tacXi Pb+4K7MIvCuVhVGgYzlW+OM/tUC69jOUxuK3VLcY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Baolin Wang , SeongJae Park , Muchun Song , Mike Kravetz , Andrew Morton Subject: [PATCH 5.19 076/717] mm/damon: validate if the pmd entry is present before accessing Date: Sat, 22 Oct 2022 09:19:15 +0200 Message-Id: <20221022072428.716219684@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747379997818442118?= X-GMAIL-MSGID: =?utf-8?q?1747379997818442118?= From: Baolin Wang commit c8b9aff419303e4d4219b5ff64b1c7e062dee48e upstream. pmd_huge() is used to validate if the pmd entry is mapped by a huge page, also including the case of non-present (migration or hwpoisoned) pmd entry on arm64 or x86 architectures. This means that pmd_pfn() can not get the correct pfn number for a non-present pmd entry, which will cause damon_get_page() to get an incorrect page struct (also may be NULL by pfn_to_online_page()), making the access statistics incorrect. This means that the DAMON may make incorrect decision according to the incorrect statistics, for example, DAMON may can not reclaim cold page in time due to this cold page was regarded as accessed mistakenly if DAMOS_PAGEOUT operation is specified. Moreover it does not make sense that we still waste time to get the page of the non-present entry. Just treat it as not-accessed and skip it, which maintains consistency with non-present pte level entries. So add pmd entry present validation to fix the above issues. Link: https://lkml.kernel.org/r/58b1d1f5fbda7db49ca886d9ef6783e3dcbbbc98.1660805030.git.baolin.wang@linux.alibaba.com Fixes: 3f49584b262c ("mm/damon: implement primitives for the virtual memory address spaces") Signed-off-by: Baolin Wang Reviewed-by: SeongJae Park Reviewed-by: Muchun Song Cc: Mike Kravetz Cc: Signed-off-by: Andrew Morton Signed-off-by: Greg Kroah-Hartman --- mm/damon/vaddr.c | 10 ++++++++++ 1 file changed, 10 insertions(+) --- a/mm/damon/vaddr.c +++ b/mm/damon/vaddr.c @@ -304,6 +304,11 @@ static int damon_mkold_pmd_entry(pmd_t * if (pmd_huge(*pmd)) { ptl = pmd_lock(walk->mm, pmd); + if (!pmd_present(*pmd)) { + spin_unlock(ptl); + return 0; + } + if (pmd_huge(*pmd)) { damon_pmdp_mkold(pmd, walk->mm, addr); spin_unlock(ptl); @@ -431,6 +436,11 @@ static int damon_young_pmd_entry(pmd_t * #ifdef CONFIG_TRANSPARENT_HUGEPAGE if (pmd_huge(*pmd)) { ptl = pmd_lock(walk->mm, pmd); + if (!pmd_present(*pmd)) { + spin_unlock(ptl); + return 0; + } + if (!pmd_huge(*pmd)) { spin_unlock(ptl); goto regular_page; From patchwork Sat Oct 22 07:19: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: 7394 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1097026wrr; Sat, 22 Oct 2022 01:06:39 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5YS5wr0vSJUdYS3N12q+2Zb0B6ybVIWblOOgrbFYVxmr2m9aamb6dGeWVQrvOe7SxjXHNT X-Received: by 2002:a17:90b:1a8d:b0:210:822a:3cae with SMTP id ng13-20020a17090b1a8d00b00210822a3caemr18199419pjb.243.1666425998970; Sat, 22 Oct 2022 01:06:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666425998; cv=none; d=google.com; s=arc-20160816; b=SRfivMVZFJEbuirgcvODmSfWhoCgBZyuySejrVcKWKTwsjz/yrzm8rllcZdFgvh5pw 8yBvczlZNWFtZqfroI5A6IgFbPbUz4ipyou2QW5nx5gJ+yHLxmCtgiMTS3lLOsRzll6w BTSve2T4za3Ogtj3wPqx6ey27i3eQ40IRavnShmJdEFzi5W1b5xKqakSDwSzKeK1CkBp V5R1f4o3mpn2VFrFUzrQS+mcVdtkGjxtVo95VUvHXW5V1k18P7ik4ps9JMR5CRhNZDQJ AQ/b0JfGcnXIgwYZBzmoElxQ3KhEf1aIcPMnVfHOQh5OkDcss/IbMNHYovuEvrotLUL+ E3AA== 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=Te+Y4lI7QUYO6h6tgWxLLog9g6dQRCS/db8GJxv9zZ4=; b=tYcY5NLASlsWC0qLT0lSe0utwMS6avfdVH9A7eE4IwgTsPNmx01yX2rGOclp56zssT +aJFW49Nt95FcBetr0dDHADKVjEF7I9iqG3CcIwF4UMbeDS9fcG3niRtGkdrvm21/KID xqL/vF6xbIBLf8hPsyKxgqQpHASXGQ3TnNMIxv58KeaEQazYWj994aLfts79XOqnPh6e b8Ppw0M9ppr8BxizUbR1iVKgqzo0ahiOMk7npEv2Nc0o3Ftg2TjGZA4dPkHwCCJfSOOh aEiP8Evqr9jehcQHpwCrKnOiZjjph07zhy9DvOnuzpxJgKEChbmWvlnG+JZ1jo3RT+A/ 6Lxw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=w+PhC6HF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 u191-20020a6385c8000000b0046ec3853223si3836291pgd.1.2022.10.22.01.06.24; Sat, 22 Oct 2022 01:06: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=w+PhC6HF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S232744AbiJVIFs (ORCPT + 99 others); Sat, 22 Oct 2022 04:05:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47404 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232634AbiJVH7T (ORCPT ); Sat, 22 Oct 2022 03:59: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 E36905B13D; Sat, 22 Oct 2022 00:49: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 2895D60ADD; Sat, 22 Oct 2022 07:37:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 102DAC433D6; Sat, 22 Oct 2022 07:37:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424250; bh=cjJig+87pqcbv+kjMiMoyf8RM/C0BbUjoCrUc892frE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=w+PhC6HFR1LUVGd8CiTwD5Na87jaOZ4d4OGgBfymoFMgJBAEWeRgDDZDP7RKctugH ZfWR7VM8HUVL5DmOYwfoThGk4+C9frion3VRaDzTGPrWWRmEECMTbXB66EejNb8DGG 1yVhAnGXv7wARXPp/aOO8slN/pyRbKyNGeOtOrBI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Peter Xu , syzbot+2b9b4f0895be09a6dec3@syzkaller.appspotmail.com, Axel Rasmussen , Brian Geffon , Edward Liaw , Liu Shixin , Mike Kravetz , Andrew Morton Subject: [PATCH 5.19 077/717] mm/uffd: fix warning without PTE_MARKER_UFFD_WP compiled in Date: Sat, 22 Oct 2022 09:19:16 +0200 Message-Id: <20221022072428.861512299@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747374308596924823?= X-GMAIL-MSGID: =?utf-8?q?1747374308596924823?= From: Peter Xu commit 515778e2d790652a38a24554fdb7f21420d91efc upstream. When PTE_MARKER_UFFD_WP not configured, it's still possible to reach pte marker code and trigger an warning. Add a few CONFIG_PTE_MARKER_UFFD_WP ifdefs to make sure the code won't be reached when not compiled in. Link: https://lkml.kernel.org/r/YzeR+R6b4bwBlBHh@x1n Fixes: b1f9e876862d ("mm/uffd: enable write protection for shmem & hugetlbfs") Signed-off-by: Peter Xu Reported-by: Cc: Axel Rasmussen Cc: Brian Geffon Cc: Edward Liaw Cc: Liu Shixin Cc: Mike Kravetz Cc: Signed-off-by: Andrew Morton Signed-off-by: Greg Kroah-Hartman --- mm/hugetlb.c | 4 ++++ mm/memory.c | 2 ++ mm/mprotect.c | 2 ++ 3 files changed, 8 insertions(+) --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -5050,6 +5050,7 @@ static void __unmap_hugepage_range(struc * unmapped and its refcount is dropped, so just clear pte here. */ if (unlikely(!pte_present(pte))) { +#ifdef CONFIG_PTE_MARKER_UFFD_WP /* * If the pte was wr-protected by uffd-wp in any of the * swap forms, meanwhile the caller does not want to @@ -5061,6 +5062,7 @@ static void __unmap_hugepage_range(struc set_huge_pte_at(mm, address, ptep, make_pte_marker(PTE_MARKER_UFFD_WP)); else +#endif huge_pte_clear(mm, address, ptep, sz); spin_unlock(ptl); continue; @@ -5089,11 +5091,13 @@ static void __unmap_hugepage_range(struc tlb_remove_huge_tlb_entry(h, tlb, ptep, address); if (huge_pte_dirty(pte)) set_page_dirty(page); +#ifdef CONFIG_PTE_MARKER_UFFD_WP /* Leave a uffd-wp pte marker if needed */ if (huge_pte_uffd_wp(pte) && !(zap_flags & ZAP_FLAG_DROP_MARKER)) set_huge_pte_at(mm, address, ptep, make_pte_marker(PTE_MARKER_UFFD_WP)); +#endif hugetlb_count_sub(pages_per_huge_page(h), mm); page_remove_rmap(page, vma, true); --- a/mm/memory.c +++ b/mm/memory.c @@ -1385,10 +1385,12 @@ zap_install_uffd_wp_if_needed(struct vm_ unsigned long addr, pte_t *pte, struct zap_details *details, pte_t pteval) { +#ifdef CONFIG_PTE_MARKER_UFFD_WP if (zap_drop_file_uffd_wp(details)) return; pte_install_uffd_wp_if_needed(vma, addr, pte, pteval); +#endif } static unsigned long zap_pte_range(struct mmu_gather *tlb, --- a/mm/mprotect.c +++ b/mm/mprotect.c @@ -222,6 +222,7 @@ static unsigned long change_pte_range(st } else { /* It must be an none page, or what else?.. */ WARN_ON_ONCE(!pte_none(oldpte)); +#ifdef CONFIG_PTE_MARKER_UFFD_WP if (unlikely(uffd_wp && !vma_is_anonymous(vma))) { /* * For file-backed mem, we need to be able to @@ -233,6 +234,7 @@ static unsigned long change_pte_range(st make_pte_marker(PTE_MARKER_UFFD_WP)); pages++; } +#endif } } while (pte++, addr += PAGE_SIZE, addr != end); arch_leave_lazy_mmu_mode(); From patchwork Sat Oct 22 07:19: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: 7200 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1089658wrr; Sat, 22 Oct 2022 00:44:01 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4vM/4Rd8mQv3TsuAh1ojrwVeOvbikFmWMULhigSufj6Kgmlu3VXYZkNe/xKfumpxMwd/zd X-Received: by 2002:a17:902:cecd:b0:185:46d3:8cad with SMTP id d13-20020a170902cecd00b0018546d38cadmr22948525plg.83.1666424640909; Sat, 22 Oct 2022 00:44:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666424640; cv=none; d=google.com; s=arc-20160816; b=s5wDNzWbVS3i9DdeDqgk6+6O3qFNbxXpeFmYdhi8V0WUnhyDgMHxcdUj9B3XThBkxm EjWhRP075ko5y/gRxQDbW+PzKZNHd45JI6iPhCv2bIIg2fT12e8l01+QdA4Z4khojoXg /wEscOyGkF2Hg+Zbzd/QU8A1haPIwKAE/v6Yt4jwc1o3UvchQr2SGA4nix5guoEfjgAj Y7mobIxDdvbcOmpRDHvGs0LXrcSvKSW866gySwRgGpzctfB0PQnN1vwp8gHBOMI3gSeo qHHvVxFVjRum+iJCyIAorPzkfxR51FTN3PnGDj1KPp/juBoqCA6W1JZAzgT7rvEXr5LB sk3A== 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=VW6d+ncnIv0u8wFSUOsQBDT7Zt7mce3KkN+ZfAmEO5E=; b=KvWYyRIdtiU7tMeGo5w5bwjx4MhKyrMg6jFVfeJASU3x8LTgO0/wpMzbH8z4xcjEOB uzQa9mZRbTjyktp6qJOAbTHnOeDEmjEP/9IJbsqQyqXMvXiPQDOQuUIzxZWuhrLd8R6q OqOLyJJo22xSGSuahDZ8JfWwFhJXlwgc4/tPPOCCHEQ36x5H8q+Gx/jBYCRhPMzz0o/C 9PMZ6GML/Co72t2NDTLV977+s6KoWhcNjdPONxPHeytysoGRgpX3mL5O5hi98sMsXr0S nzV0/10VMl0r5Rp8JaaWSl4nvoLVBZNeDG4zeb8tUUiZGzW/TOVzAHygMdPcfnWR3V7c g15g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=X4tAELJ+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 z14-20020a170902d54e00b00183f6ff535dsi27324547plf.490.2022.10.22.00.43.48; Sat, 22 Oct 2022 00:44: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=X4tAELJ+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231237AbiJVHnY (ORCPT + 99 others); Sat, 22 Oct 2022 03:43:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47088 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231274AbiJVHmm (ORCPT ); Sat, 22 Oct 2022 03:42: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 C5F2D65004; Sat, 22 Oct 2022 00:41:22 -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 C136A60AFA; Sat, 22 Oct 2022 07:37:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D848AC433C1; Sat, 22 Oct 2022 07:37:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424253; bh=dJ6NpRGfTiudBlY78zUwNyNL6KxXExXZrduB0FLK+cE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=X4tAELJ+8WJa6iTPLCMBdopVPDGh6RLUAnatSSaui2wStx9H9ZFt6CRWSxr1NW3dr RzRoLlHgYO6bsxRmqe+w3BWqBE2yrnoQW8n0ghpMxec7pViVUHyz1+z+hba+ejjAMU i0e6r+feABG4vd9gbrwZC0Q75wSzmCaiAsBjUVXQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Carlos Llamas , Catalin Marinas , Andrii Nakryiko , Liam Howlett , "Christian Brauner (Microsoft)" , Michal Hocko , Suren Baghdasaryan , Andrew Morton Subject: [PATCH 5.19 078/717] mm/mmap: undo ->mmap() when arch_validate_flags() fails Date: Sat, 22 Oct 2022 09:19:17 +0200 Message-Id: <20221022072429.031061362@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747372883911056641?= X-GMAIL-MSGID: =?utf-8?q?1747372883911056641?= From: Carlos Llamas commit deb0f6562884b5b4beb883d73e66a7d3a1b96d99 upstream. Commit c462ac288f2c ("mm: Introduce arch_validate_flags()") added a late check in mmap_region() to let architectures validate vm_flags. The check needs to happen after calling ->mmap() as the flags can potentially be modified during this callback. If arch_validate_flags() check fails we unmap and free the vma. However, the error path fails to undo the ->mmap() call that previously succeeded and depending on the specific ->mmap() implementation this translates to reference increments, memory allocations and other operations what will not be cleaned up. There are several places (mainly device drivers) where this is an issue. However, one specific example is bpf_map_mmap() which keeps count of the mappings in map->writecnt. The count is incremented on ->mmap() and then decremented on vm_ops->close(). When arch_validate_flags() fails this count is off since bpf_map_mmap_close() is never called. One can reproduce this issue in arm64 devices with MTE support. Here the vm_flags are checked to only allow VM_MTE if VM_MTE_ALLOWED has been set previously. From userspace then is enough to pass the PROT_MTE flag to mmap() syscall to trigger the arch_validate_flags() failure. The following program reproduces this issue: #include #include #include #include #include int main(void) { union bpf_attr attr = { .map_type = BPF_MAP_TYPE_ARRAY, .key_size = sizeof(int), .value_size = sizeof(long long), .max_entries = 256, .map_flags = BPF_F_MMAPABLE, }; int fd; fd = syscall(__NR_bpf, BPF_MAP_CREATE, &attr, sizeof(attr)); mmap(NULL, 4096, PROT_WRITE | PROT_MTE, MAP_SHARED, fd, 0); return 0; } By manually adding some log statements to the vm_ops callbacks we can confirm that when passing PROT_MTE to mmap() the map->writecnt is off upon ->release(): With PROT_MTE flag: root@debian:~# ./bpf-test [ 111.263874] bpf_map_write_active_inc: map=9 writecnt=1 [ 111.288763] bpf_map_release: map=9 writecnt=1 Without PROT_MTE flag: root@debian:~# ./bpf-test [ 157.816912] bpf_map_write_active_inc: map=10 writecnt=1 [ 157.830442] bpf_map_write_active_dec: map=10 writecnt=0 [ 157.832396] bpf_map_release: map=10 writecnt=0 This patch fixes the above issue by calling vm_ops->close() when the arch_validate_flags() check fails, after this we can proceed to unmap and free the vma on the error path. Link: https://lkml.kernel.org/r/20220930003844.1210987-1-cmllamas@google.com Fixes: c462ac288f2c ("mm: Introduce arch_validate_flags()") Signed-off-by: Carlos Llamas Reviewed-by: Catalin Marinas Acked-by: Andrii Nakryiko Reviewed-by: Liam Howlett Cc: Christian Brauner (Microsoft) Cc: Michal Hocko Cc: Suren Baghdasaryan Cc: [5.10+] Signed-off-by: Andrew Morton Signed-off-by: Greg Kroah-Hartman --- mm/mmap.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) --- a/mm/mmap.c +++ b/mm/mmap.c @@ -1845,7 +1845,7 @@ unsigned long mmap_region(struct file *f if (!arch_validate_flags(vma->vm_flags)) { error = -EINVAL; if (file) - goto unmap_and_free_vma; + goto close_and_free_vma; else goto free_vma; } @@ -1892,6 +1892,9 @@ out: return addr; +close_and_free_vma: + if (vma->vm_ops && vma->vm_ops->close) + vma->vm_ops->close(vma); unmap_and_free_vma: fput(vma->vm_file); vma->vm_file = NULL; From patchwork Sat Oct 22 07:19: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: 7207 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1090186wrr; Sat, 22 Oct 2022 00:46:01 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6pyI5ccXmAcHG2v6I+q6BKKZcf4/ifnxlnTFbTxOWSfALWkqLbmUQUREG1xANAee3T1u4T X-Received: by 2002:a17:90b:4c92:b0:20b:a13:83c7 with SMTP id my18-20020a17090b4c9200b0020b0a1383c7mr62288649pjb.128.1666424761041; Sat, 22 Oct 2022 00:46:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666424761; cv=none; d=google.com; s=arc-20160816; b=c6yv+l/PpxWXKzHyrHozhjR98Y8o/YCxUnAg6ypKo7w4YdM3wOcgrzf3D95FlkSFwN JSi2MfRPbRTbE2GDi1Jg526u1ymsJDo6kgDNsa3QVaFcl1aE17IpUPp++8MlG75RJtHf 8j7uTr/LVmAwMATj0ZAdqaGX43nLBtr8870h2BaOdHgCyy/zyh5EqySrlG/RWFVK+d02 SmlCyY7fHQtHS/pDXbBGquSeBtUKCgVAcuQRS3PY6vxAblEGwaIr8IX5jmq3DMwFWcj6 0RIwJT4/fORPNJsgvKoaltcnF9fnKFfbjRUsRYlskBmj1hAyaQrhFKk3+H8j5VKlUPJ3 fryw== 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=fIrbt1EsO7KTJfFyiqO8JF/iBRj4/PZEuOWAzGyzza8=; b=0K+Gx4BD5jQ08rCIQ8FXUaR0ECWc1+weQneuyzm3Gws6PGtDIjZr+n9/cAQhbBere8 p7uprAx5rPfdIHkojABcTQXdY7kjxIfdIcP+pgvhzAoLjdYE6GeBWCub6yB1g8zjAQB0 DE0y+OMwYRMzI3JCNxrk4loow3eYhLcoDiYfZbHJkdq0v9eCVuRSpJjOI+qVM0MtRmoa ljr0fTUzzpuMauscz6JO22PZ6EiD5XScWunwFzbT0qSDEU0eksClpIF2YjSRCxKnU9ao gcGgfIxMqTrJwWyuDWlHdIFdULZZclWDVfy104w0NdqKJ/vTAcyF52eUZZHZ80O9D5s9 Dy+A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=yk8rxUpP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 cw15-20020a056a00450f00b00563ab8e5e43si26670351pfb.77.2022.10.22.00.45.47; Sat, 22 Oct 2022 00:46: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=yk8rxUpP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231290AbiJVHpV (ORCPT + 99 others); Sat, 22 Oct 2022 03:45:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47276 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231307AbiJVHnT (ORCPT ); Sat, 22 Oct 2022 03:43: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 6E4A76501A; Sat, 22 Oct 2022 00:42: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 B085B60AFD; Sat, 22 Oct 2022 07:37:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C3345C433D7; Sat, 22 Oct 2022 07:37:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424256; bh=z1jpo4UkD4Ly2oimtwNpPZSx9SB4oraktF/ZPcHwwwA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=yk8rxUpPkUZqEGL6uQ5mtXGeGvwBtjh8l3q4UQ0J2J4N0+v7THg0QqrEe3u8Goyiw JzfCDoC2oAKyVdTKbm9vnDkJadqYpNGi5fBfPyx9hee2oGze2n6JGv91l2OAPQlApV 7gkahhalS/GBZPSl+65wrQHvySkq551eftZLC3lk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "M. Vefa Bicakci" , Demi Marie Obenour , Juergen Gross Subject: [PATCH 5.19 079/717] xen/gntdev: Prevent leaking grants Date: Sat, 22 Oct 2022 09:19:18 +0200 Message-Id: <20221022072429.247728281@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747373010118462056?= X-GMAIL-MSGID: =?utf-8?q?1747373010118462056?= From: M. Vefa Bicakci commit 0991028cd49567d7016d1b224fe0117c35059f86 upstream. Prior to this commit, if a grant mapping operation failed partially, some of the entries in the map_ops array would be invalid, whereas all of the entries in the kmap_ops array would be valid. This in turn would cause the following logic in gntdev_map_grant_pages to become invalid: for (i = 0; i < map->count; i++) { if (map->map_ops[i].status == GNTST_okay) { map->unmap_ops[i].handle = map->map_ops[i].handle; if (!use_ptemod) alloced++; } if (use_ptemod) { if (map->kmap_ops[i].status == GNTST_okay) { if (map->map_ops[i].status == GNTST_okay) alloced++; map->kunmap_ops[i].handle = map->kmap_ops[i].handle; } } } ... atomic_add(alloced, &map->live_grants); Assume that use_ptemod is true (i.e., the domain mapping the granted pages is a paravirtualized domain). In the code excerpt above, note that the "alloced" variable is only incremented when both kmap_ops[i].status and map_ops[i].status are set to GNTST_okay (i.e., both mapping operations are successful). However, as also noted above, there are cases where a grant mapping operation fails partially, breaking the assumption of the code excerpt above. The aforementioned causes map->live_grants to be incorrectly set. In some cases, all of the map_ops mappings fail, but all of the kmap_ops mappings succeed, meaning that live_grants may remain zero. This in turn makes it impossible to unmap the successfully grant-mapped pages pointed to by kmap_ops, because unmap_grant_pages has the following snippet of code at its beginning: if (atomic_read(&map->live_grants) == 0) return; /* Nothing to do */ In other cases where only some of the map_ops mappings fail but all kmap_ops mappings succeed, live_grants is made positive, but when the user requests unmapping the grant-mapped pages, __unmap_grant_pages_done will then make map->live_grants negative, because the latter function does not check if all of the pages that were requested to be unmapped were actually unmapped, and the same function unconditionally subtracts "data->count" (i.e., a value that can be greater than map->live_grants) from map->live_grants. The side effects of a negative live_grants value have not been studied. The net effect of all of this is that grant references are leaked in one of the above conditions. In Qubes OS v4.1 (which uses Xen's grant mechanism extensively for X11 GUI isolation), this issue manifests itself with warning messages like the following to be printed out by the Linux kernel in the VM that had granted pages (that contain X11 GUI window data) to dom0: "g.e. 0x1234 still pending", especially after the user rapidly resizes GUI VM windows (causing some grant-mapping operations to partially or completely fail, due to the fact that the VM unshares some of the pages as part of the window resizing, making the pages impossible to grant-map from dom0). The fix for this issue involves counting all successful map_ops and kmap_ops mappings separately, and then adding the sum to live_grants. During unmapping, only the number of successfully unmapped grants is subtracted from live_grants. The code is also modified to check for negative live_grants values after the subtraction and warn the user. Link: https://github.com/QubesOS/qubes-issues/issues/7631 Fixes: dbe97cff7dd9 ("xen/gntdev: Avoid blocking in unmap_grant_pages()") Cc: stable@vger.kernel.org Signed-off-by: M. Vefa Bicakci Acked-by: Demi Marie Obenour Reviewed-by: Juergen Gross Link: https://lore.kernel.org/r/20221002222006.2077-2-m.v.b@runbox.com Signed-off-by: Juergen Gross Signed-off-by: Greg Kroah-Hartman --- drivers/xen/gntdev.c | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) --- a/drivers/xen/gntdev.c +++ b/drivers/xen/gntdev.c @@ -367,8 +367,7 @@ int gntdev_map_grant_pages(struct gntdev for (i = 0; i < map->count; i++) { if (map->map_ops[i].status == GNTST_okay) { map->unmap_ops[i].handle = map->map_ops[i].handle; - if (!use_ptemod) - alloced++; + alloced++; } else if (!err) err = -EINVAL; @@ -377,8 +376,7 @@ int gntdev_map_grant_pages(struct gntdev if (use_ptemod) { if (map->kmap_ops[i].status == GNTST_okay) { - if (map->map_ops[i].status == GNTST_okay) - alloced++; + alloced++; map->kunmap_ops[i].handle = map->kmap_ops[i].handle; } else if (!err) err = -EINVAL; @@ -394,8 +392,14 @@ static void __unmap_grant_pages_done(int unsigned int i; struct gntdev_grant_map *map = data->data; unsigned int offset = data->unmap_ops - map->unmap_ops; + int successful_unmaps = 0; + int live_grants; for (i = 0; i < data->count; i++) { + if (map->unmap_ops[offset + i].status == GNTST_okay && + map->unmap_ops[offset + i].handle != INVALID_GRANT_HANDLE) + successful_unmaps++; + WARN_ON(map->unmap_ops[offset + i].status != GNTST_okay && map->unmap_ops[offset + i].handle != INVALID_GRANT_HANDLE); pr_debug("unmap handle=%d st=%d\n", @@ -403,6 +407,10 @@ static void __unmap_grant_pages_done(int map->unmap_ops[offset+i].status); map->unmap_ops[offset+i].handle = INVALID_GRANT_HANDLE; if (use_ptemod) { + if (map->kunmap_ops[offset + i].status == GNTST_okay && + map->kunmap_ops[offset + i].handle != INVALID_GRANT_HANDLE) + successful_unmaps++; + WARN_ON(map->kunmap_ops[offset + i].status != GNTST_okay && map->kunmap_ops[offset + i].handle != INVALID_GRANT_HANDLE); pr_debug("kunmap handle=%u st=%d\n", @@ -411,11 +419,15 @@ static void __unmap_grant_pages_done(int map->kunmap_ops[offset+i].handle = INVALID_GRANT_HANDLE; } } + /* * Decrease the live-grant counter. This must happen after the loop to * prevent premature reuse of the grants by gnttab_mmap(). */ - atomic_sub(data->count, &map->live_grants); + live_grants = atomic_sub_return(successful_unmaps, &map->live_grants); + if (WARN_ON(live_grants < 0)) + pr_err("%s: live_grants became negative (%d) after unmapping %d pages!\n", + __func__, live_grants, successful_unmaps); /* Release reference taken by __unmap_grant_pages */ gntdev_put_map(NULL, map); From patchwork Sat Oct 22 07:19: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: 7199 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1089647wrr; Sat, 22 Oct 2022 00:43:58 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4KbmrDp1w6yavXtLch7GwkMtdYxFENs04NNn7OEGtvmdwLtt489eGfGbQfnxGxIVdg7f+X X-Received: by 2002:a17:90b:3505:b0:20d:2c35:9834 with SMTP id ls5-20020a17090b350500b0020d2c359834mr26384866pjb.122.1666424638341; Sat, 22 Oct 2022 00:43:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666424638; cv=none; d=google.com; s=arc-20160816; b=a1MFNrsjwDLunVwXVlmIVtOJ7LTXKdRulg/ntpOri1FP8uDeoLEwQTC3Ax8la72MsV qsPQFAdchQtorpVt47z1Y1oX//1Ip9RA6BSuRpRXpWky0H+CBeplw+YuzZWr3IxIwegV DJy5JOpMkDB/5fVfTziiqocSF1n58ZzsOOPP3Bdy0ORNKXc82fzVur0TG84K+AnP2CKr 6yVxOROyRFmNPsNujI+DqRk0mqAEcEbN8jLZcNhKwgYTKZcwwIku/ujvCmK69IgILyR+ DhsjRgpGQWPVTjmdii3eBHXlnFa7tGcF7D4U5BT5UOF8J0mPP3ORIj3osRDeMrsSZYaj YXnw== 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=KK9tGpzZpMc11jUUwgNCoYLmYURDSdOw5HimTocEIE8=; b=rSpgGsoyoaGis1JmR1RvOe+Zyt/QuJa3K2MQ0azRLWJ4DAUALYyiRQZ6IsAnKZ9gkD k+pSIgwOtbMKOLAV+O+LiSj8LNPIxEwZazl+HeKBWKMj39SrbIeC2f33JMlVCvW8o5zp Vu+pqIjdG6zVHKViCzs3Oz1SC4FL6APZ1/jsBppgcQ4Z5OJ1lrngvs7xEzW3ZL2odFH9 T/Y7AP/6m4TdH9wOpz1tj2SvtrID0+JDBBvMNETGeIpS164Y6zvhJJEBw/oq8JbED6TG gudkGB5YN78AU7ZVJ7eSDIHMiti8XXrzV1uykiC0wqIm5Am8wa6afmnyrkjsthlS88aB rrRQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=fxpo3Idd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 h11-20020a056a00170b00b00565cb1ebdbcsi30573200pfc.277.2022.10.22.00.43.46; Sat, 22 Oct 2022 00:43: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=fxpo3Idd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231219AbiJVHnd (ORCPT + 99 others); Sat, 22 Oct 2022 03:43:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47758 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231202AbiJVHmz (ORCPT ); Sat, 22 Oct 2022 03:42: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 EC7FD5BCAC; Sat, 22 Oct 2022 00:41:37 -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 7930060ADA; Sat, 22 Oct 2022 07:37:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 89696C433B5; Sat, 22 Oct 2022 07:37:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424258; bh=dDEgC9WFXRGUcgTqtVWIJfnABWNhCQtyM3jd2yNVvEU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fxpo3IddTtQ0nZnD818ndSBVLOnyLW2eprucbJYUxY0Wz9SbFX6xKAnfBt27H1LCG 5hjnPRQYKNXGkpvgUXQ4Yu1qSQXg7IP6FmXCo2YwXU7s78Z7fDGhKj4Uw+RJvqA8uA qzLgWYkbWLf8vye6rOxlwf/NGZR0atNQt0LG4D3o= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "M. Vefa Bicakci" , Juergen Gross Subject: [PATCH 5.19 080/717] xen/gntdev: Accommodate VMA splitting Date: Sat, 22 Oct 2022 09:19:19 +0200 Message-Id: <20221022072429.441560612@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747372881579622216?= X-GMAIL-MSGID: =?utf-8?q?1747372881579622216?= From: M. Vefa Bicakci commit 5c13a4a0291b30191eff9ead8d010e1ca43a4d0c upstream. Prior to this commit, the gntdev driver code did not handle the following scenario correctly with paravirtualized (PV) Xen domains: * User process sets up a gntdev mapping composed of two grant mappings (i.e., two pages shared by another Xen domain). * User process munmap()s one of the pages. * User process munmap()s the remaining page. * User process exits. In the scenario above, the user process would cause the kernel to log the following messages in dmesg for the first munmap(), and the second munmap() call would result in similar log messages: BUG: Bad page map in process doublemap.test pte:... pmd:... page:0000000057c97bff refcount:1 mapcount:-1 \ mapping:0000000000000000 index:0x0 pfn:... ... page dumped because: bad pte ... file:gntdev fault:0x0 mmap:gntdev_mmap [xen_gntdev] readpage:0x0 ... Call Trace: dump_stack_lvl+0x46/0x5e print_bad_pte.cold+0x66/0xb6 unmap_page_range+0x7e5/0xdc0 unmap_vmas+0x78/0xf0 unmap_region+0xa8/0x110 __do_munmap+0x1ea/0x4e0 __vm_munmap+0x75/0x120 __x64_sys_munmap+0x28/0x40 do_syscall_64+0x38/0x90 entry_SYSCALL_64_after_hwframe+0x61/0xcb ... For each munmap() call, the Xen hypervisor (if built with CONFIG_DEBUG) would print out the following and trigger a general protection fault in the affected Xen PV domain: (XEN) d0v... Attempt to implicitly unmap d0's grant PTE ... (XEN) d0v... Attempt to implicitly unmap d0's grant PTE ... As of this writing, gntdev_grant_map structure's vma field (referred to as map->vma below) is mainly used for checking the start and end addresses of mappings. However, with split VMAs, these may change, and there could be more than one VMA associated with a gntdev mapping. Hence, remove the use of map->vma and rely on map->pages_vm_start for the original start address and on (map->count << PAGE_SHIFT) for the original mapping size. Let the invalidate() and find_special_page() hooks use these. Also, given that there can be multiple VMAs associated with a gntdev mapping, move the "mmu_interval_notifier_remove(&map->notifier)" call to the end of gntdev_put_map, so that the MMU notifier is only removed after the closing of the last remaining VMA. Finally, use an atomic to prevent inadvertent gntdev mapping re-use, instead of using the map->live_grants atomic counter and/or the map->vma pointer (the latter of which is now removed). This prevents the userspace from mmap()'ing (with MAP_FIXED) a gntdev mapping over the same address range as a previously set up gntdev mapping. This scenario can be summarized with the following call-trace, which was valid prior to this commit: mmap gntdev_mmap mmap (repeat mmap with MAP_FIXED over the same address range) gntdev_invalidate unmap_grant_pages (sets 'being_removed' entries to true) gnttab_unmap_refs_async unmap_single_vma gntdev_mmap (maps the shared pages again) munmap gntdev_invalidate unmap_grant_pages (no-op because 'being_removed' entries are true) unmap_single_vma (For PV domains, Xen reports that a granted page is being unmapped and triggers a general protection fault in the affected domain, if Xen was built with CONFIG_DEBUG) The fix for this last scenario could be worth its own commit, but we opted for a single commit, because removing the gntdev_grant_map structure's vma field requires guarding the entry to gntdev_mmap(), and the live_grants atomic counter is not sufficient on its own to prevent the mmap() over a pre-existing mapping. Link: https://github.com/QubesOS/qubes-issues/issues/7631 Fixes: ab31523c2fca ("xen/gntdev: allow usermode to map granted pages") Cc: stable@vger.kernel.org Signed-off-by: M. Vefa Bicakci Reviewed-by: Juergen Gross Link: https://lore.kernel.org/r/20221002222006.2077-3-m.v.b@runbox.com Signed-off-by: Juergen Gross Signed-off-by: Greg Kroah-Hartman --- drivers/xen/gntdev-common.h | 3 +- drivers/xen/gntdev.c | 58 ++++++++++++++++++-------------------------- 2 files changed, 27 insertions(+), 34 deletions(-) --- a/drivers/xen/gntdev-common.h +++ b/drivers/xen/gntdev-common.h @@ -44,9 +44,10 @@ struct gntdev_unmap_notify { }; struct gntdev_grant_map { + atomic_t in_use; struct mmu_interval_notifier notifier; + bool notifier_init; struct list_head next; - struct vm_area_struct *vma; int index; int count; int flags; --- a/drivers/xen/gntdev.c +++ b/drivers/xen/gntdev.c @@ -286,6 +286,9 @@ void gntdev_put_map(struct gntdev_priv * */ } + if (use_ptemod && map->notifier_init) + mmu_interval_notifier_remove(&map->notifier); + if (map->notify.flags & UNMAP_NOTIFY_SEND_EVENT) { notify_remote_via_evtchn(map->notify.event); evtchn_put(map->notify.event); @@ -298,7 +301,7 @@ void gntdev_put_map(struct gntdev_priv * static int find_grant_ptes(pte_t *pte, unsigned long addr, void *data) { struct gntdev_grant_map *map = data; - unsigned int pgnr = (addr - map->vma->vm_start) >> PAGE_SHIFT; + unsigned int pgnr = (addr - map->pages_vm_start) >> PAGE_SHIFT; int flags = map->flags | GNTMAP_application_map | GNTMAP_contains_pte | (1 << _GNTMAP_guest_avail0); u64 pte_maddr; @@ -508,11 +511,7 @@ static void gntdev_vma_close(struct vm_a struct gntdev_priv *priv = file->private_data; pr_debug("gntdev_vma_close %p\n", vma); - if (use_ptemod) { - WARN_ON(map->vma != vma); - mmu_interval_notifier_remove(&map->notifier); - map->vma = NULL; - } + vma->vm_private_data = NULL; gntdev_put_map(priv, map); } @@ -540,29 +539,30 @@ static bool gntdev_invalidate(struct mmu struct gntdev_grant_map *map = container_of(mn, struct gntdev_grant_map, notifier); unsigned long mstart, mend; + unsigned long map_start, map_end; if (!mmu_notifier_range_blockable(range)) return false; + map_start = map->pages_vm_start; + map_end = map->pages_vm_start + (map->count << PAGE_SHIFT); + /* * If the VMA is split or otherwise changed the notifier is not * updated, but we don't want to process VA's outside the modified * VMA. FIXME: It would be much more understandable to just prevent * modifying the VMA in the first place. */ - if (map->vma->vm_start >= range->end || - map->vma->vm_end <= range->start) + if (map_start >= range->end || map_end <= range->start) return true; - mstart = max(range->start, map->vma->vm_start); - mend = min(range->end, map->vma->vm_end); + mstart = max(range->start, map_start); + mend = min(range->end, map_end); pr_debug("map %d+%d (%lx %lx), range %lx %lx, mrange %lx %lx\n", - map->index, map->count, - map->vma->vm_start, map->vma->vm_end, - range->start, range->end, mstart, mend); - unmap_grant_pages(map, - (mstart - map->vma->vm_start) >> PAGE_SHIFT, - (mend - mstart) >> PAGE_SHIFT); + map->index, map->count, map_start, map_end, + range->start, range->end, mstart, mend); + unmap_grant_pages(map, (mstart - map_start) >> PAGE_SHIFT, + (mend - mstart) >> PAGE_SHIFT); return true; } @@ -1042,18 +1042,15 @@ static int gntdev_mmap(struct file *flip return -EINVAL; pr_debug("map %d+%d at %lx (pgoff %lx)\n", - index, count, vma->vm_start, vma->vm_pgoff); + index, count, vma->vm_start, vma->vm_pgoff); mutex_lock(&priv->lock); map = gntdev_find_map_index(priv, index, count); if (!map) goto unlock_out; - if (use_ptemod && map->vma) - goto unlock_out; - if (atomic_read(&map->live_grants)) { - err = -EAGAIN; + if (!atomic_add_unless(&map->in_use, 1, 1)) goto unlock_out; - } + refcount_inc(&map->users); vma->vm_ops = &gntdev_vmops; @@ -1074,15 +1071,16 @@ static int gntdev_mmap(struct file *flip map->flags |= GNTMAP_readonly; } + map->pages_vm_start = vma->vm_start; + if (use_ptemod) { - map->vma = vma; err = mmu_interval_notifier_insert_locked( &map->notifier, vma->vm_mm, vma->vm_start, vma->vm_end - vma->vm_start, &gntdev_mmu_ops); - if (err) { - map->vma = NULL; + if (err) goto out_unlock_put; - } + + map->notifier_init = true; } mutex_unlock(&priv->lock); @@ -1099,7 +1097,6 @@ static int gntdev_mmap(struct file *flip */ mmu_interval_read_begin(&map->notifier); - map->pages_vm_start = vma->vm_start; err = apply_to_page_range(vma->vm_mm, vma->vm_start, vma->vm_end - vma->vm_start, find_grant_ptes, map); @@ -1128,13 +1125,8 @@ unlock_out: out_unlock_put: mutex_unlock(&priv->lock); out_put_map: - if (use_ptemod) { + if (use_ptemod) unmap_grant_pages(map, 0, map->count); - if (map->vma) { - mmu_interval_notifier_remove(&map->notifier); - map->vma = NULL; - } - } gntdev_put_map(priv, map); return err; } From patchwork Sat Oct 22 07:19: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: 7337 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1094839wrr; Sat, 22 Oct 2022 01:01:06 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6Jq6jZgLUBlArBQUaaRkNT1qAeZ/CDkUydSSIQ4ysiKzvx3s0FfKI/OGe4xMIdUEbDez2u X-Received: by 2002:a05:6a00:ac6:b0:530:3197:48b6 with SMTP id c6-20020a056a000ac600b00530319748b6mr22902480pfl.80.1666425655261; Sat, 22 Oct 2022 01:00:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666425655; cv=none; d=google.com; s=arc-20160816; b=GdXVKVK7Drf9kB+4yJXMMHsaNu7Q6ThhA/s2p1lhNHg/l43ptlb/yZHFAJtlJuEgEX DN0bXfERmkyvbh45yFjeZPwuOlGudINWeW3Omn5/fcQOTeNAIGiqTJPzFYboq5fHr+z/ W9kq1lGXs4HMU8wQuwz8wCQFBvJOdu5AeHx2tv8MKppb31dS3+5X2tciOc7O3vUuFcjo TKwSHEe/sI3KPwkEqAapsLW8U9XePwWoHLJP1iGRP19751rCC5F0WvmyI8Uk2SDrZqcD 0EkcxVoXOk8AHwrvAUnkW2v1ENn4CJheVDry1zSGHA9c4lYjpmQC1aHKaQ5jgCRvkO+m R0fg== 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=Df9u8FN84hNypRsXoyD5eqGGFY76K8WcBVsj+F67qgc=; b=OHclirPu0yK+Aj6TC5+ehJsJXVn+VcQ0kkB0d95o51jt2EIl+CgamUTrU2dK4QTHP1 KnagtX+lFmQAXoo9GwlFgEoMIG0XvaDoimOqzm2tRScXLlxpGt9M6Z0fd0A4QS9uCquh qeZ+CEikELckL2I3XuOeN1wke4GLK3JjNIBroR24MLfg1v+oVifnvVqwOlPWPWKcD7Ww FkJjC51SPLAztj/zQmNk4Vddo7AYyRDQgIQeUS7vZRtVPYtKQw1kerzk1s0kEqwKSnyD IZ7LB5KrS4dCM7UO69Oih7aTk9y9fi2FWgqhAegHrb9QASpTCfKlHWkKpy1BR9UfLwZ3 3+YA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=CF2nkY1G; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 r124-20020a632b82000000b00434d8692854si28138749pgr.541.2022.10.22.01.00.38; Sat, 22 Oct 2022 01:00: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=CF2nkY1G; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S232397AbiJVH6p (ORCPT + 99 others); Sat, 22 Oct 2022 03:58:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55602 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232114AbiJVHyG (ORCPT ); Sat, 22 Oct 2022 03:54: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 2AD7866F25; Sat, 22 Oct 2022 00:47: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 CE91AB82DF0; Sat, 22 Oct 2022 07:37:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 23F63C433C1; Sat, 22 Oct 2022 07:37:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424261; bh=14mKDapbgbuh31OpS2MIP0VbUg71zVnPdpLmFUC99dY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CF2nkY1GLdGOLz7kqgVpJp90YTaHGIe5wgjrLO0ftyuK/aPGWCtN9OtAMx1ZjdJOo 1s/Gwchawd994Px6uiNkXFnRzGdg7m7LIgd0pyaZIbAjcuiNrJoGDq4QQxwr8Ir4y4 F41/kUeh7ai/kRpDy3ZVDH1KnF7xFQV4dn7/a8dw= 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 5.19 081/717] PCI: Sanitise firmware BAR assignments behind a PCI-PCI bridge Date: Sat, 22 Oct 2022 09:19:20 +0200 Message-Id: <20221022072429.627641346@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747373947844924221?= X-GMAIL-MSGID: =?utf-8?q?1747373947844924221?= 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 @@ -214,6 +214,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 Sat Oct 22 07:19: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: 7203 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1090050wrr; Sat, 22 Oct 2022 00:45:30 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7lm0gZ5sypPGINKBYbNS4SOaM96jD1x5Geh8AFd0Kcb21F/mte3tdXxuU96hVflp/Y69TW X-Received: by 2002:a17:90a:b28d:b0:20d:6790:19fa with SMTP id c13-20020a17090ab28d00b0020d679019famr61860221pjr.68.1666424730478; Sat, 22 Oct 2022 00:45:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666424730; cv=none; d=google.com; s=arc-20160816; b=j5jhhqHy/o5aD1d8TDsVyUAiSnWxLByvg3QKycChK6TiDbjbyOjciWIvBNFQV+xE67 KQ/5OYqLYigXjUFhfYK0W76r+Y9cQ3s0YCZCROUc2vnNaSgeugatESYMMblbqzWcvexY CnFgV0NrLT2buKBvoEoNigEY88BUQmWueakRqdNnwvIqKFwzsT3MyZS1FIopPiiPZaDH aEY/FpKqEXSKYfkIe9a3uZzKZIkMqUp4bq/1vuBCLCTjhEqOzX2N/THH37Jn1+pWr6nw 51+Reo7nCW2knEc1wL5CMV5qQJbO4hukVReU36GlKkeroLq0dWTVpOwYO8CVQ+8ZD75K uqTQ== 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=JhSCCrgEMkeDeIUMI+ygNto2o9LXqzQNoXwaeAOPCsM=; b=Iwk+wuFt5KeMZxkVUZGLw4PFUlhgiUS1sRljhiOKxv2c+cmXrMHCUcheEKHWndBl06 hwPtdG+oyJdzhg+bccOS91IEKiC240X/hv+bPQIBx+rEVsYnsgZmB+MwLGxs8EkODSob yP18Tre117IXmUlX4vJ8dsOLQbXdQeXd+Qm9mFDKIWhzR0PQt0AqIL8hnS9DRPq/gWeF wdgBUoyttOLRqmM5P8gplTxp/JnRIeGe7dh4dLgKMtalFmE9ZFlpMoam77SgIwsCE//i cAI7NEW9+/iLrx2wVP2Eq4uBD8sR4uehInlZ3Jab13bGnIV8+R+6BAchicqPnA0/JwiJ /nLA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Qf55N6Ba; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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-20020a17090aa41000b0020d5c7ae3cbsi8261959pjp.38.2022.10.22.00.45.17; Sat, 22 Oct 2022 00:45: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=Qf55N6Ba; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231350AbiJVHnu (ORCPT + 99 others); Sat, 22 Oct 2022 03:43:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45922 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231262AbiJVHnL (ORCPT ); Sat, 22 Oct 2022 03:43: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 D396E5A3CD; Sat, 22 Oct 2022 00:41: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 67ED160AD9; Sat, 22 Oct 2022 07:37:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7A90FC433C1; Sat, 22 Oct 2022 07:37:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424266; bh=1rW26+ZwcA6tiLBS6hz+rgjIIBis7sdQ7KSHF1iXPo0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Qf55N6BaL/4nE5OVEDTSRDSvSagKkXkrBB0KnZwiVvDQoHje8yCuWq5ngozZOzuD/ X9r5jYUdvErB8nIeVnVIkp6QNPYTZHLXD6ndkD2Bj7BudhR1QFOZn5oljnpqO+5Ogd UF+GTinzxrGajTO8Ht3P8NtfnO7EwzSLsLEyrAyo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Christophe Leroy Subject: [PATCH 5.19 082/717] serial: cpm_uart: Dont request IRQ too early for console port Date: Sat, 22 Oct 2022 09:19:21 +0200 Message-Id: <20221022072429.827158672@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747372978184635719?= X-GMAIL-MSGID: =?utf-8?q?1747372978184635719?= From: Christophe Leroy commit 30963b2f75bfdbbcf1cc5d80bf88fec7aaba808d upstream. The following message is seen during boot and the activation of console port gets delayed until normal serial ports activation. [ 0.001346] irq: no irq domain found for pic@930 ! The console port doesn't need irq, perform irq reservation later, during cpm_uart probe. While at it, don't use NO_IRQ but 0 which is the value returned by irq_of_parse_and_map() in case of error. By chance powerpc's NO_IRQ has value 0 but on some architectures it is -1. Fixes: 14d893fc6846 ("powerpc/8xx: Convert CPM1 interrupt controller to platform_device") Cc: stable@vger.kernel.org Signed-off-by: Christophe Leroy Link: https://lore.kernel.org/r/8bed0f30c2e9ef16ae64fb1243a16d54a48eb8da.1664526717.git.christophe.leroy@csgroup.eu Signed-off-by: Greg Kroah-Hartman --- drivers/tty/serial/cpm_uart/cpm_uart_core.c | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) --- a/drivers/tty/serial/cpm_uart/cpm_uart_core.c +++ b/drivers/tty/serial/cpm_uart/cpm_uart_core.c @@ -1214,12 +1214,6 @@ static int cpm_uart_init_port(struct dev pinfo->port.fifosize = pinfo->tx_nrfifos * pinfo->tx_fifosize; spin_lock_init(&pinfo->port.lock); - pinfo->port.irq = irq_of_parse_and_map(np, 0); - if (pinfo->port.irq == NO_IRQ) { - ret = -EINVAL; - goto out_pram; - } - for (i = 0; i < NUM_GPIOS; i++) { struct gpio_desc *gpiod; @@ -1229,7 +1223,7 @@ static int cpm_uart_init_port(struct dev if (IS_ERR(gpiod)) { ret = PTR_ERR(gpiod); - goto out_irq; + goto out_pram; } if (gpiod) { @@ -1255,8 +1249,6 @@ static int cpm_uart_init_port(struct dev return cpm_uart_request_port(&pinfo->port); -out_irq: - irq_dispose_mapping(pinfo->port.irq); out_pram: cpm_uart_unmap_pram(pinfo, pram); out_mem: @@ -1436,11 +1428,17 @@ static int cpm_uart_probe(struct platfor /* initialize the device pointer for the port */ pinfo->port.dev = &ofdev->dev; + pinfo->port.irq = irq_of_parse_and_map(ofdev->dev.of_node, 0); + if (!pinfo->port.irq) + return -EINVAL; + ret = cpm_uart_init_port(ofdev->dev.of_node, pinfo); - if (ret) - return ret; + if (!ret) + return uart_add_one_port(&cpm_reg, &pinfo->port); + + irq_dispose_mapping(pinfo->port.irq); - return uart_add_one_port(&cpm_reg, &pinfo->port); + return ret; } static int cpm_uart_remove(struct platform_device *ofdev) From patchwork Sat Oct 22 07:19:22 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 7831 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1148190wrr; Sat, 22 Oct 2022 03:49:56 -0700 (PDT) X-Google-Smtp-Source: AMsMyM78ULc8KgAVpsdDCRvsexTeYjo9+ZNyWD77BIrNOGcoKOry5UIR5XSAUkripnfhP8HLgw1A X-Received: by 2002:a17:90a:b00a:b0:203:87a3:9e70 with SMTP id x10-20020a17090ab00a00b0020387a39e70mr27154354pjq.218.1666435796662; Sat, 22 Oct 2022 03:49:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666435796; cv=none; d=google.com; s=arc-20160816; b=yCb5QxNQBNUmKrf+cd1mZSpQBSgqOE4B9I482/3kjXWfq6lGtdwu0Rpx1C4IvcawJ7 /xDmlxnNqOPZEOmLwBdsY9XZZC19OoP2dng/gXnK498xuQ0zO90JLAv6EFAOcaAe/08D /n9SqGNPe6uZJvDnqTwh1+DnO4zeiEEPUbIl2R1UsmQ5IG711vQz5+soaNngR6hZZHhb pv4QqlMO6szSequHuXE/+0/tQIhiFqBia2jtBkr1vDoUVguvfgxMoTLJv5unRNSzCJEe 6BE1BdTG5OEAvB3b7AmTpMXgFhFtx8Sntdz/vpo/d+BatPKMaanSVeGVpxt1TTCMC6Y+ XadA== 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=XER5dUfEoE/M7Y9nlLyPhQerTpPsnslHbLShDqRcJvs=; b=S8Rn4KEWrsA0gQd7N/EO00ileH95T4pofmiGHpAO539rvqIxRjz2r8+Jv+clakK0oY tLWqNKipdAJhkMNnx0bHCF67s9aa1kuKMbt+GWr/HmPl05b+QkxbbxKjYmzGM0RIpXUG VzwrR8hH1VSLEYX1iaMfufpvKY0OTxiZ9UUXcJs03x7Xa6mWmjKBVJlB6dMAQbLM37l/ ohhoqdaMZCUNCFWyJ7RmrdqE10nZQNZzTmCKPJ9sg7REJbUs7YDBA95Qfvo6kJl90quS iZNOUBItyUa+KIlzKB3zxeGYaexh0X+JfrpjrcQKD+rH/h1vNY1uPQQzNKDmzkpKB/NJ v5Lg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=GzpNEQPn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 a185-20020a621ac2000000b0056177790e83si24477519pfa.170.2022.10.22.03.49.44; Sat, 22 Oct 2022 03:49: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=GzpNEQPn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S230440AbiJVKqI (ORCPT + 99 others); Sat, 22 Oct 2022 06:46:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33968 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230400AbiJVKpl (ORCPT ); Sat, 22 Oct 2022 06:45:41 -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 D7D50981F6; Sat, 22 Oct 2022 03:03: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 dfw.source.kernel.org (Postfix) with ESMTPS id 2277C60AFF; Sat, 22 Oct 2022 07:37:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3021FC433C1; Sat, 22 Oct 2022 07:37:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424269; bh=1mViT2c5UD5jcinRno6IL7qpXr7J0qcTYNSXnwD/3wk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GzpNEQPnhb+Noa+3eHorNZIFNQDEIj3qHfpBeVCPZ0d1ofZ0YdL78R9wlKctBHNfB W40o6gYlFzHc0paakyFh1s5aidDiVrR4OrHvYMPkgTp+UDeB4h0KO2u5TcjWdxWGxy eoh1L2zA833V+dE2Git/jqPp2e3bxqrsCL2MaYrQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Marek Vasut , =?utf-8?q?Ilpo_J=C3=A4rvinen?= , Lukas Wunner Subject: [PATCH 5.19 083/717] serial: stm32: Deassert Transmit Enable on ->rs485_config() Date: Sat, 22 Oct 2022 09:19:22 +0200 Message-Id: <20221022072430.021107652@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 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?1747384581737844330?= X-GMAIL-MSGID: =?utf-8?q?1747384581737844330?= From: Lukas Wunner commit adafbbf6895eb0ce41a313c6ee68870ab9aa93cd upstream. The STM32 USART can control RS-485 Transmit Enable in hardware. Since commit 7df5081cbf5e ("serial: stm32: Add RS485 RTS GPIO control"), it can alternatively be controlled in software. That was done to allow RS-485 even if the RTS pin is unavailable because it's pinmuxed to a different function. However the commit neglected to deassert Transmit Enable upon invocation of the ->rs485_config() callback. Fix it. Avoid forward declarations by moving stm32_usart_tx_empty(), stm32_usart_rs485_rts_enable() and stm32_usart_rs485_rts_disable() further up in the driver. Fixes: 7df5081cbf5e ("serial: stm32: Add RS485 RTS GPIO control") Cc: stable@vger.kernel.org # v5.9+ Cc: Marek Vasut Reviewed-by: Ilpo Järvinen Signed-off-by: Lukas Wunner Link: https://lore.kernel.org/r/6059eab35dba394468335ef640df8b0050fd9dbd.1662886616.git.lukas@wunner.de Signed-off-by: Greg Kroah-Hartman --- drivers/tty/serial/stm32-usart.c | 100 ++++++++++++++++++++------------------- 1 file changed, 53 insertions(+), 47 deletions(-) --- a/drivers/tty/serial/stm32-usart.c +++ b/drivers/tty/serial/stm32-usart.c @@ -62,6 +62,53 @@ static void stm32_usart_clr_bits(struct writel_relaxed(val, port->membase + reg); } +static unsigned int stm32_usart_tx_empty(struct uart_port *port) +{ + struct stm32_port *stm32_port = to_stm32_port(port); + const struct stm32_usart_offsets *ofs = &stm32_port->info->ofs; + + if (readl_relaxed(port->membase + ofs->isr) & USART_SR_TC) + return TIOCSER_TEMT; + + return 0; +} + +static void stm32_usart_rs485_rts_enable(struct uart_port *port) +{ + struct stm32_port *stm32_port = to_stm32_port(port); + struct serial_rs485 *rs485conf = &port->rs485; + + if (stm32_port->hw_flow_control || + !(rs485conf->flags & SER_RS485_ENABLED)) + return; + + if (rs485conf->flags & SER_RS485_RTS_ON_SEND) { + mctrl_gpio_set(stm32_port->gpios, + stm32_port->port.mctrl | TIOCM_RTS); + } else { + mctrl_gpio_set(stm32_port->gpios, + stm32_port->port.mctrl & ~TIOCM_RTS); + } +} + +static void stm32_usart_rs485_rts_disable(struct uart_port *port) +{ + struct stm32_port *stm32_port = to_stm32_port(port); + struct serial_rs485 *rs485conf = &port->rs485; + + if (stm32_port->hw_flow_control || + !(rs485conf->flags & SER_RS485_ENABLED)) + return; + + if (rs485conf->flags & SER_RS485_RTS_ON_SEND) { + mctrl_gpio_set(stm32_port->gpios, + stm32_port->port.mctrl & ~TIOCM_RTS); + } else { + mctrl_gpio_set(stm32_port->gpios, + stm32_port->port.mctrl | TIOCM_RTS); + } +} + static void stm32_usart_config_reg_rs485(u32 *cr1, u32 *cr3, u32 delay_ADE, u32 delay_DDE, u32 baud) { @@ -145,6 +192,12 @@ static int stm32_usart_config_rs485(stru stm32_usart_set_bits(port, ofs->cr1, BIT(cfg->uart_enable_bit)); + /* Adjust RTS polarity in case it's driven in software */ + if (stm32_usart_tx_empty(port)) + stm32_usart_rs485_rts_disable(port); + else + stm32_usart_rs485_rts_enable(port); + return 0; } @@ -460,42 +513,6 @@ static void stm32_usart_tc_interrupt_dis stm32_usart_clr_bits(port, ofs->cr1, USART_CR1_TCIE); } -static void stm32_usart_rs485_rts_enable(struct uart_port *port) -{ - struct stm32_port *stm32_port = to_stm32_port(port); - struct serial_rs485 *rs485conf = &port->rs485; - - if (stm32_port->hw_flow_control || - !(rs485conf->flags & SER_RS485_ENABLED)) - return; - - if (rs485conf->flags & SER_RS485_RTS_ON_SEND) { - mctrl_gpio_set(stm32_port->gpios, - stm32_port->port.mctrl | TIOCM_RTS); - } else { - mctrl_gpio_set(stm32_port->gpios, - stm32_port->port.mctrl & ~TIOCM_RTS); - } -} - -static void stm32_usart_rs485_rts_disable(struct uart_port *port) -{ - struct stm32_port *stm32_port = to_stm32_port(port); - struct serial_rs485 *rs485conf = &port->rs485; - - if (stm32_port->hw_flow_control || - !(rs485conf->flags & SER_RS485_ENABLED)) - return; - - if (rs485conf->flags & SER_RS485_RTS_ON_SEND) { - mctrl_gpio_set(stm32_port->gpios, - stm32_port->port.mctrl & ~TIOCM_RTS); - } else { - mctrl_gpio_set(stm32_port->gpios, - stm32_port->port.mctrl | TIOCM_RTS); - } -} - static void stm32_usart_transmit_chars_pio(struct uart_port *port) { struct stm32_port *stm32_port = to_stm32_port(port); @@ -738,17 +755,6 @@ static irqreturn_t stm32_usart_threaded_ return IRQ_HANDLED; } -static unsigned int stm32_usart_tx_empty(struct uart_port *port) -{ - struct stm32_port *stm32_port = to_stm32_port(port); - const struct stm32_usart_offsets *ofs = &stm32_port->info->ofs; - - if (readl_relaxed(port->membase + ofs->isr) & USART_SR_TC) - return TIOCSER_TEMT; - - return 0; -} - static void stm32_usart_set_mctrl(struct uart_port *port, unsigned int mctrl) { struct stm32_port *stm32_port = to_stm32_port(port); From patchwork Sat Oct 22 07:19: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: 7826 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1147182wrr; Sat, 22 Oct 2022 03:46:31 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5Vun+L/Xp60iuBef2przGaV6rVbCuLBk7cNZFm7wvgc8r9l0gHRi/q8VuupWHHimiG+oX6 X-Received: by 2002:aa7:cf0b:0:b0:461:2271:8559 with SMTP id a11-20020aa7cf0b000000b0046122718559mr10042400edy.92.1666435591716; Sat, 22 Oct 2022 03:46:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666435591; cv=none; d=google.com; s=arc-20160816; b=tFvRVqNCZN1pVfeiHPBs0/+3WGmmbaXjc5pO2non2WSY26jN1OeOYn5S4p0vI7kNRy d8U19+TPYYtPiZ2Fc1Q+TrNT6BtoGWbeqowJ5HwqzZqjx3JaaI99+op6u8hL1kp5e0+b 2m8pdQYLbKqLBAZt7DcHgIDEIdQbzZsS+jJg+HAbf0JdMyLp0l31b3WDwu5ERsMSaYhq w9sWm4Et15TA6jEbrGmnYHj4DG4lNNk3xODTMWZrQVrpdND77Xj7EFeB+HeL2a+3zx85 xCJ//g7Zrc18EOpSKj5XDPhyZB2pnTXjEnIt58zOLA9KhvH/TfIwwl/oFPP5WvLz4MoK DW5w== 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=MT5fLglLmvmQg0ud0fu57zeWJSmnarkoApGK6TvTKM8=; b=rXj1CwDKt4n2VgsStQZBi68f3AJ/bwwzDI0vRMadwboW6aiI7CDh9A9RvKE7paYKtp JCIvDQa7ko7b5jI6B06EPgsMMVmU8qEHhkWmlfwgUVK91NoXsVoB3SEZ2UwdcoQj9PAT Scz9tWnnJ5YFO9onw3qG6RrPh+59etAlMLW4Vbu+OsbPlqesP0mCXdaCYqMtFoDg79mQ HSM5MYE/uxkBbBg9yxzrGG53ytBFVPmbxDR7/PShjvl2TT+RBLvqNRMROiZUS0j2G3Tt QwhVnb7/4ZfS5xqlVnnrkz+6/HRSED58A2AiEUP6oCZ1gEBura1Rx4X+lkqAAJVXfNar H2vQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Mynq8NWP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 u20-20020a17090617d400b0078d93325645si20231688eje.405.2022.10.22.03.46.07; Sat, 22 Oct 2022 03:46: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=Mynq8NWP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S230254AbiJVKjm (ORCPT + 99 others); Sat, 22 Oct 2022 06:39:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50280 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230015AbiJVKjQ (ORCPT ); Sat, 22 Oct 2022 06:39: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 6D97156BBB; Sat, 22 Oct 2022 02:56: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 ams.source.kernel.org (Postfix) with ESMTPS id 6B987B82DF4; Sat, 22 Oct 2022 07:37:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D6EACC433C1; Sat, 22 Oct 2022 07:37:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424272; bh=q+8IZv14OH8z7nHWlSQwAYSMLSmzzRxf767zndaIaCM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Mynq8NWPVt8bXR6JOMsTmXEKSNNR9NumMm4V/U8ErMNo1e0KOyFzCIBD6BAj/d+Dd EgX+BSrFsnz57h+ekRORAHU3x5nzWhm5nuPuZAgK4yllbfuq176JQjXODMrQ35gkJ/ P0LC1JeI/ZrjrPYu4nuy5Jr7pwjL51ysdLibrOJ4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Anders Blomdell , "Maciej W. Rozycki" Subject: [PATCH 5.19 084/717] serial: 8250: Let drivers request full 16550A feature probing Date: Sat, 22 Oct 2022 09:19:23 +0200 Message-Id: <20221022072430.217746516@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 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?1747384367055233032?= X-GMAIL-MSGID: =?utf-8?q?1747384367055233032?= From: Maciej W. Rozycki commit 9906890c89e4dbd900ed87ad3040080339a7f411 upstream. A SERIAL_8250_16550A_VARIANTS configuration option has been recently defined that lets one request the 8250 driver not to probe for 16550A device features so as to reduce the driver's device startup time in virtual machines. Some actual hardware devices require these features to have been fully determined however for their driver to work correctly, so define a flag to let drivers request full 16550A feature probing on a device-by-device basis if required regardless of the SERIAL_8250_16550A_VARIANTS option setting chosen. Fixes: dc56ecb81a0a ("serial: 8250: Support disabling mdelay-filled probes of 16550A variants") Cc: stable@vger.kernel.org # v5.6+ Reported-by: Anders Blomdell Signed-off-by: Maciej W. Rozycki Link: https://lore.kernel.org/r/alpine.DEB.2.21.2209202357520.41633@angie.orcam.me.uk Signed-off-by: Greg Kroah-Hartman --- drivers/tty/serial/8250/8250_port.c | 3 ++- include/linux/serial_core.h | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) --- a/drivers/tty/serial/8250/8250_port.c +++ b/drivers/tty/serial/8250/8250_port.c @@ -1029,7 +1029,8 @@ static void autoconfig_16550a(struct uar up->port.type = PORT_16550A; up->capabilities |= UART_CAP_FIFO; - if (!IS_ENABLED(CONFIG_SERIAL_8250_16550A_VARIANTS)) + if (!IS_ENABLED(CONFIG_SERIAL_8250_16550A_VARIANTS) && + !(up->port.flags & UPF_FULL_PROBE)) return; /* --- a/include/linux/serial_core.h +++ b/include/linux/serial_core.h @@ -101,7 +101,7 @@ struct uart_icount { __u32 buf_overrun; }; -typedef unsigned int __bitwise upf_t; +typedef u64 __bitwise upf_t; typedef unsigned int __bitwise upstat_t; struct uart_port { @@ -208,6 +208,7 @@ struct uart_port { #define UPF_FIXED_PORT ((__force upf_t) (1 << 29)) #define UPF_DEAD ((__force upf_t) (1 << 30)) #define UPF_IOREMAP ((__force upf_t) (1 << 31)) +#define UPF_FULL_PROBE ((__force upf_t) (1ULL << 32)) #define __UPF_CHANGE_MASK 0x17fff #define UPF_CHANGE_MASK ((__force upf_t) __UPF_CHANGE_MASK) From patchwork Sat Oct 22 07:19: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: 7317 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1093526wrr; Sat, 22 Oct 2022 00:57:35 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5A+ClYCnHXgqn0wmrAKhtb9wv54w3H0ZhSP6Yjz+LEOer+M0Mpy4kShgkVBPGui12c7Luq X-Received: by 2002:a17:902:bcc4:b0:181:899a:ac9c with SMTP id o4-20020a170902bcc400b00181899aac9cmr23164171pls.124.1666425455147; Sat, 22 Oct 2022 00:57:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666425455; cv=none; d=google.com; s=arc-20160816; b=S6ZV1r0kKyuwjLmJ3IhB5yCSJ3GaJbFxHtkAw3/lwCHmR6UifPZaoD8sHzYC+1+7uF QzYAfHPPJOAOsonwex/KFZS4p/akHasbhTiPf/MdWnEsI5R2RtBfEc9W9y5zdyPMed3K tKD9L1hX4nO7yfdYK8I90hDXe2JzoX+yOj3Ju7IzqP/4g6d3BKstlNjS/xwvfhxP3Hez +C2q+1FU4qeY5fsBDfrUvpnF0PZyzRiNeuWMyM2kNrnVxtWHM76gLYjC13MKB03bEZYI 1gwGoFYMCLXbmtGk0pVw5QyUm54rytLpNJsPZJJ4e/JiCNU2TySzriNOZWr8B2Y+oCCm zvzA== 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=35nkcKqg/djFkP+ku/hANpLWIdFwCEvViUVnXhUKETQ=; b=CYmYkxIvh67J2JJbWxN+efBtj6YdvHYxWn+fCqrAQmjbqU+lmPlA+mp9vljtO694r/ eLwG0hPzz1MdPfuOBOx8Qu9YxDiu/Ljt1vuHz8QmcSYDgMF/C0JVIDnA9w1memNgMNFV HXgFZ/JXxfp5NeSu+Q8EVaPnL90OiDKkFl/xOeAhv3NFjbJEUb6Ov3GuRzbxC4KGIPrG DaS2xdI8MeiA2j08/XmaH/rJN1tvMb0oApE20U01G0hooRdPtlGriyQ8zNUOeGay2CfL ZPlky3OlHoMXsxODDH2T61I2IQVyOPfmPtImZVwuR/I84tl3OkKGkt2tLnnsYODvKihG ZIpg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=vahydwHK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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-20020a170902b70500b0017f7e1387easi26464602pls.217.2022.10.22.00.57.22; Sat, 22 Oct 2022 00:57: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=vahydwHK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S230349AbiJVH5F (ORCPT + 99 others); Sat, 22 Oct 2022 03:57:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54772 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231986AbiJVHxS (ORCPT ); Sat, 22 Oct 2022 03:53: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 AFB0E66F0D; Sat, 22 Oct 2022 00:47: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 93EF2B82DF1; Sat, 22 Oct 2022 07:37:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0279CC433D6; Sat, 22 Oct 2022 07:37:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424275; bh=4utioZOXlyo9oAiwlzw67riLL6LaXsoNJjJMJzcvKEs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vahydwHKt+tKAaC1cVTTHKhc9h6xfbq9Ib9EMYCfi2AwGYKTzxGkao8VQpLi44EtN aAtC+/bOwAeWjh68EZdNcUMH/9ulRDe/8VM5zjDhFsudyIoibAh+gslpV4tcaCvSZD fb0xthaUELhYFstUQ8AMt28B5yh4wBG7Aney6ddk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Anders Blomdell , "Maciej W. Rozycki" Subject: [PATCH 5.19 085/717] serial: 8250: Request full 16550A feature probing for OxSemi PCIe devices Date: Sat, 22 Oct 2022 09:19:24 +0200 Message-Id: <20221022072430.414870964@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747373738386630894?= X-GMAIL-MSGID: =?utf-8?q?1747373738386630894?= From: Maciej W. Rozycki commit 00b7a4d4ee42be1c515e56cb1e8ba0f25e271d8e upstream. Oxford Semiconductor PCIe (Tornado) 950 serial port devices need to operate in the enhanced mode via the EFR register for the Divide-by-M N/8 baud rate generator prescaler to be used in their native UART mode. Otherwise the prescaler is fixed at 1 causing grossly incorrect baud rates to be programmed. Accessing the EFR register requires 16550A features to have been probed for, so request this to happen regardless of SERIAL_8250_16550A_VARIANTS by setting UPF_FULL_PROBE in port flags. Fixes: 366f6c955d4d ("serial: 8250: Add proper clock handling for OxSemi PCIe devices") Cc: stable@vger.kernel.org # v5.19+ Reported-by: Anders Blomdell Signed-off-by: Maciej W. Rozycki Link: https://lore.kernel.org/r/alpine.DEB.2.21.2209210005040.41633@angie.orcam.me.uk Signed-off-by: Greg Kroah-Hartman --- drivers/tty/serial/8250/8250_pci.c | 5 +++++ 1 file changed, 5 insertions(+) --- a/drivers/tty/serial/8250/8250_pci.c +++ b/drivers/tty/serial/8250/8250_pci.c @@ -1232,6 +1232,10 @@ static void pci_oxsemi_tornado_set_mctrl serial8250_do_set_mctrl(port, mctrl); } +/* + * We require EFR features for clock programming, so set UPF_FULL_PROBE + * for full probing regardless of CONFIG_SERIAL_8250_16550A_VARIANTS setting. + */ static int pci_oxsemi_tornado_setup(struct serial_private *priv, const struct pciserial_board *board, struct uart_8250_port *up, int idx) @@ -1239,6 +1243,7 @@ static int pci_oxsemi_tornado_setup(stru struct pci_dev *dev = priv->dev; if (pci_oxsemi_tornado_p(dev)) { + up->port.flags |= UPF_FULL_PROBE; up->port.get_divisor = pci_oxsemi_tornado_get_divisor; up->port.set_divisor = pci_oxsemi_tornado_set_divisor; up->port.set_mctrl = pci_oxsemi_tornado_set_mctrl; From patchwork Sat Oct 22 07:19: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: 7206 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1090116wrr; Sat, 22 Oct 2022 00:45:45 -0700 (PDT) X-Google-Smtp-Source: AMsMyM545eztdMuWLIfyrzfjsCBVVL8vREkMkV+KNZbjKPtKDeEY4A5FJ0efP7eK000Ar/CQbe81 X-Received: by 2002:a17:90b:1b4d:b0:20d:7bbf:46f0 with SMTP id nv13-20020a17090b1b4d00b0020d7bbf46f0mr26694547pjb.77.1666424744887; Sat, 22 Oct 2022 00:45:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666424744; cv=none; d=google.com; s=arc-20160816; b=Bf5PGODfEUzXFsgJ6hqJSM8H4xJCDG9yqlWjZM8PWZMQZfRyk4pNNH7VOg2LKldWX2 iTBM/VJV9q+vvGK2kiG4oooiKAsUXnUrzJc0jNH67qCV8uK900JCZJppidNVEZRZBNBw rGzPjY8hG8TsgUh2IM8tQodyIhFwFJUTI5M3ss+1w5lDRzl+jJmfgTiYBppYjpbh6w50 8utThlIJKF57oYl3hOsN99/9QDiiQCmKiFQWfsTCzph9rKTD2okvoNQ+V+hWM7Nit1Nh HhsqEAuNNRyi5IzQLhvAA9xCHjRAhheXfWFzYrTqI0MjpokIfxzjb3scQsHfcOtjirxw 1MpQ== 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=rQ1u1pFzgizaSGSACi1FtFXj6guKHfA/oRVGL+h0AeU=; b=mrJ1H/txbLDK2/ktyu3ZUZ85ryhsTRJAjkCll/lbiSKT6e/XxasRTvlsUaKxNXrLU9 tsc7IFKyy3AtEP44s2rYk2f1OOEwHM4eZxr4tND6CTcbS/cB9elD3A8B/kf697VrsVAC DamuBNoqolFKXoeupHsSOCix8oSckmrzCQtkWgbTCRvHpgVFxz+yAGBT+evulBEZheD+ aYZN6ElPgRf9EmRh+kX540oyI0YVNtbkQ6apC40o4cQA5++FgMo4qJi1XEJCPDfixDjw H+gW7znsaXhsi6E3tNch4loUuLjAqfiAgADEdtjc7ci9JoO9cywlMmSX+YVkUlaqx5Dg UQjg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=04F9mXp6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 y13-20020a17090a474d00b0020a880cf1cbsi2045511pjg.134.2022.10.22.00.45.32; Sat, 22 Oct 2022 00:45: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=04F9mXp6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231256AbiJVHpS (ORCPT + 99 others); Sat, 22 Oct 2022 03:45:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42986 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231304AbiJVHnT (ORCPT ); Sat, 22 Oct 2022 03:43: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 30F6359EAA; Sat, 22 Oct 2022 00:42: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 86FE960B0C; Sat, 22 Oct 2022 07:37:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9B8FEC433C1; Sat, 22 Oct 2022 07:37:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424278; bh=A0Is1PxUY7niWdj5FSPHk6NtkiTu3ukWWosmSK3qcpU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=04F9mXp6CQJDaL39HbMzd+3TTHS18NobWCA5wkeqA3rvKbFdbitKO4wViGpuVYzQK udV2sWye7w4EloXpAIBdnaKA9UjDpQtFdU27yb3Nlizk0UROjXQ+sp4OtU0r/V2o1U t5esxEY56tiidRp9rwZuFqrH6gdHmTgufQY4m/Us= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ben Ronallo , Chuck Lever , Jeff Layton Subject: [PATCH 5.19 086/717] NFSD: Protect against send buffer overflow in NFSv3 READDIR Date: Sat, 22 Oct 2022 09:19:25 +0200 Message-Id: <20221022072430.597616922@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747372993020567073?= X-GMAIL-MSGID: =?utf-8?q?1747372993020567073?= From: Chuck Lever commit 640f87c190e0d1b2a0fcb2ecf6d2cd53b1c41991 upstream. Since before the git era, NFSD has conserved the number of pages held by each nfsd thread by combining the RPC receive and send buffers into a single array of pages. This works because there are no cases where an operation needs a large RPC Call message and a large RPC Reply message at the same time. Once an RPC Call has been received, svc_process() updates svc_rqst::rq_res to describe the part of rq_pages that can be used for constructing the Reply. This means that the send buffer (rq_res) shrinks when the received RPC record containing the RPC Call is large. A client can force this shrinkage on TCP by sending a correctly- formed RPC Call header contained in an RPC record that is excessively large. The full maximum payload size cannot be constructed in that case. Thanks to Aleksi Illikainen and Kari Hulkko for uncovering this issue. Reported-by: Ben Ronallo Cc: Signed-off-by: Chuck Lever Reviewed-by: Jeff Layton Signed-off-by: Chuck Lever Signed-off-by: Greg Kroah-Hartman --- fs/nfsd/nfs3proc.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) --- a/fs/nfsd/nfs3proc.c +++ b/fs/nfsd/nfs3proc.c @@ -550,13 +550,14 @@ static void nfsd3_init_dirlist_pages(str { struct xdr_buf *buf = &resp->dirlist; struct xdr_stream *xdr = &resp->xdr; - - count = clamp(count, (u32)(XDR_UNIT * 2), svc_max_payload(rqstp)); + unsigned int sendbuf = min_t(unsigned int, rqstp->rq_res.buflen, + svc_max_payload(rqstp)); memset(buf, 0, sizeof(*buf)); /* Reserve room for the NULL ptr & eof flag (-2 words) */ - buf->buflen = count - XDR_UNIT * 2; + buf->buflen = clamp(count, (u32)(XDR_UNIT * 2), sendbuf); + buf->buflen -= XDR_UNIT * 2; buf->pages = rqstp->rq_next_page; rqstp->rq_next_page += (buf->buflen + PAGE_SIZE - 1) >> PAGE_SHIFT; From patchwork Sat Oct 22 07:19: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: 7209 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1090260wrr; Sat, 22 Oct 2022 00:46:18 -0700 (PDT) X-Google-Smtp-Source: AMsMyM56X6erDJ6Q8+FlEcINE0da16yy9X0jE4DT5ONzsCkssrZR/hOVtgVRl/6zvV/HG5hlkeSA X-Received: by 2002:a17:90a:5e04:b0:20b:1f20:5069 with SMTP id w4-20020a17090a5e0400b0020b1f205069mr60518892pjf.126.1666424767597; Sat, 22 Oct 2022 00:46:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666424767; cv=none; d=google.com; s=arc-20160816; b=CadysKycPcOGPeLlc0edgMEBaSwo39XvwJN/CsAKOAqmQnGtqTi4M6JjAKOP7gpT18 cIl16O9GSPtQFO697qv5tdWiI3y0Zy/zXGIC0qogJSWZTn4fyVA/4GMzFcJbaYyzCaCk k9DBc8UdjngRTA7f4y+bder2U5Z3toO4Y0w/4sOPLBvdlXeVVwSdt1nuoaEmRhtpAKvk EpC8XnetX6n9/NFloS2aHQP72B/WnuOYuuHSOxtmuonpyGnvJV+kvAgTa/uDozWHYHu6 r8JMyuv6M0bn1QS005/1f5GOfyPf5gqQqNt+kUOEuXgIUGOi3Pxe5eM6Q2Be/FsXpkWg e37g== 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=cqqhAVY5XnobQzNjuE/ei5PeH3LehoS0nfzqcPccOUw=; b=OkflGyc04aOxAiulgmvVlCMrNQA3MEhWTG6P7UbVBBs7012T+VHWwkFEzDA7bWI9pb PrnBjPsIDTliaT1v5TaXD+MY58GzArzh/3poWLWKJUfOGfMo27KuFZJBq2rdnX7jl8Pe EBKBxPTqsav8d2trUsOa0OBKj4k7p5eJ3MQ75IDBb62hGWHx7NIrBRR6pAgK6ZZS5zks OCLTomJ2j995zRoDvrjihAe0E+A4kk90QY7G/CRu/gQxRBhx1zxf+gK9HNCkRFiJ5Jk5 8/t+ADqhHimHvOtqu/oYBsLNbxgfo7vNJEAQWS13MeqGIPUM4KYIUS/eFwni77uculLh xmqQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=imByZEzX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 y4-20020a63ad44000000b0043cb5d08908si28678676pgo.138.2022.10.22.00.45.53; Sat, 22 Oct 2022 00:46: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=imByZEzX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231307AbiJVHpX (ORCPT + 99 others); Sat, 22 Oct 2022 03:45:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44772 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231281AbiJVHnb (ORCPT ); Sat, 22 Oct 2022 03:43: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 0EF841EF054; Sat, 22 Oct 2022 00:42: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 6A04760B09; Sat, 22 Oct 2022 07:38:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 591BEC433C1; Sat, 22 Oct 2022 07:38:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424280; bh=SemBgwVN8OON6vFrEY8Oc1HWbiubQeH0TdHVV1OIaQw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=imByZEzX/uc/3YMDZKdCaRpvA3Lwd8JGKVlgXlayi8ZhbRjam6ACdXKonbSHrDMyW XlYEu/63i4JOc1qPQaoyuyZGtqHn2s7kVDXtqqH4pgdstRPS6iXo4IOSLIFSulwsxO AIrNnP4N0u2a8Sq3/tgISlwywJgkb/VXmqYCn8dc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Chuck Lever , Jeff Layton Subject: [PATCH 5.19 087/717] NFSD: Protect against send buffer overflow in NFSv2 READ Date: Sat, 22 Oct 2022 09:19:26 +0200 Message-Id: <20221022072430.760983577@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747373017195409888?= X-GMAIL-MSGID: =?utf-8?q?1747373017195409888?= From: Chuck Lever commit 401bc1f90874280a80b93f23be33a0e7e2d1f912 upstream. Since before the git era, NFSD has conserved the number of pages held by each nfsd thread by combining the RPC receive and send buffers into a single array of pages. This works because there are no cases where an operation needs a large RPC Call message and a large RPC Reply at the same time. Once an RPC Call has been received, svc_process() updates svc_rqst::rq_res to describe the part of rq_pages that can be used for constructing the Reply. This means that the send buffer (rq_res) shrinks when the received RPC record containing the RPC Call is large. A client can force this shrinkage on TCP by sending a correctly- formed RPC Call header contained in an RPC record that is excessively large. The full maximum payload size cannot be constructed in that case. Cc: Signed-off-by: Chuck Lever Reviewed-by: Jeff Layton Signed-off-by: Chuck Lever Signed-off-by: Greg Kroah-Hartman --- fs/nfsd/nfsproc.c | 1 + 1 file changed, 1 insertion(+) --- a/fs/nfsd/nfsproc.c +++ b/fs/nfsd/nfsproc.c @@ -182,6 +182,7 @@ nfsd_proc_read(struct svc_rqst *rqstp) argp->count, argp->offset); argp->count = min_t(u32, argp->count, NFSSVC_MAXBLKSIZE_V2); + argp->count = min_t(u32, argp->count, rqstp->rq_res.buflen); v = 0; len = argp->count; From patchwork Sat Oct 22 07:19: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: 7832 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1150010wrr; Sat, 22 Oct 2022 03:56:27 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6hflgA+oWBgaoVhTnIjD0AeOqJCAuGwsqrepY5YJfHUwBTqX6khiXewTqVPQeDR4JYXGwW X-Received: by 2002:a17:907:1b24:b0:76d:7b9d:2f8b with SMTP id mp36-20020a1709071b2400b0076d7b9d2f8bmr18537339ejc.414.1666436187237; Sat, 22 Oct 2022 03:56:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666436187; cv=none; d=google.com; s=arc-20160816; b=weFjLsO8Zko4KVT/mZr0AAxUPotg0+mU5TKx+3WVBfl3KFn3ez8OiMl5t2prVF6Wny ahEnZpZSjccWxdRIrt6802lM/M6Dc7jSRNQMdlvmoNE59s6HDZkWd1L9uFzjkLilOy22 QN37iVwiP60vkigyq0ZLvgdMmyOoN5i9ZNS25yFoYVkMFgJPhux3raBGKf+gqrTLoYbI oeSr1lTGXyff+hAr3O75W2D2GFTuQffyG6upHdonOTbHDM6xrC6iek8R+I+V2uScs27I ZpzfyX9jkM/dt4+voJUbry17R0JtXmkIkIXuFT4mBdrH3wL3J10LRbEagLFZOEYOk1hC 85hw== 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=sEXeLXM5zo1sRs80lMyeuLBf7pTPyn2dfyEJ0npXIy8=; b=fXCQm0Pq5TDc2kPuEwQOQj/+XWkNc2Gfua/RHCgvo02kdDLr17GK9XhmJessRjChrs M03XdURrwikMg8LPmeNKITVxQL7NqFm0qZpy83qKHb8VOTeJwiml7SjxD9uPAkuSo1SX xFsBhA78/B8SDMTiashlB1cEn6mq/4rkmIbxn0fIF+CIuaC7Z9UjH2DukQWa7JHSFqC+ a5m5tcKvEbTYHZXNnRVCEpSC816kkcTgxNuRC+VVHeObtDL+FUMJscj9UfewDRH7L7iW +I+YO2hDOcFYQRTcRLTXA+iWauwoahZy/LGdYNReddlzc1RkN05TOatNX8NW2YlaDhV/ dSAw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=1gxTK2iB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 y14-20020aa7ce8e000000b00458f6e66baesi19990052edv.278.2022.10.22.03.56.01; Sat, 22 Oct 2022 03:56: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=1gxTK2iB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S229944AbiJVKqL (ORCPT + 99 others); Sat, 22 Oct 2022 06:46:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33986 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230358AbiJVKpl (ORCPT ); Sat, 22 Oct 2022 06:45:41 -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 D8D0529F119; Sat, 22 Oct 2022 03:03: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 dfw.source.kernel.org (Postfix) with ESMTPS id 220F160B07; Sat, 22 Oct 2022 07:38:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 39551C433D6; Sat, 22 Oct 2022 07:38:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424283; bh=vj+c+klnG/XyjchScAUrWaGSDcH9xzhtSiLQpU4pB3k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1gxTK2iBBxRK6m6bbjIBj1oB+R2dIDKOi/kA90rmc0vlhhWlAUcx9El5oD60Hj6TY EhJSWuwTH9gRNXxJFFJzswIY1Foh7lTrxwFFR7yxShsalVr4oQT5ZSTlhAhZG4RKiK w1OGg08CD3qhYxa3bbOUcqKHH1U7969UeuLq6l8M= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Chuck Lever , Jeff Layton Subject: [PATCH 5.19 088/717] NFSD: Protect against send buffer overflow in NFSv3 READ Date: Sat, 22 Oct 2022 09:19:27 +0200 Message-Id: <20221022072430.934420268@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 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?1747384991632747649?= X-GMAIL-MSGID: =?utf-8?q?1747384991632747649?= From: Chuck Lever commit fa6be9cc6e80ec79892ddf08a8c10cabab9baf38 upstream. Since before the git era, NFSD has conserved the number of pages held by each nfsd thread by combining the RPC receive and send buffers into a single array of pages. This works because there are no cases where an operation needs a large RPC Call message and a large RPC Reply at the same time. Once an RPC Call has been received, svc_process() updates svc_rqst::rq_res to describe the part of rq_pages that can be used for constructing the Reply. This means that the send buffer (rq_res) shrinks when the received RPC record containing the RPC Call is large. A client can force this shrinkage on TCP by sending a correctly- formed RPC Call header contained in an RPC record that is excessively large. The full maximum payload size cannot be constructed in that case. Cc: Signed-off-by: Chuck Lever Reviewed-by: Jeff Layton Signed-off-by: Chuck Lever Signed-off-by: Greg Kroah-Hartman --- fs/nfsd/nfs3proc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/fs/nfsd/nfs3proc.c +++ b/fs/nfsd/nfs3proc.c @@ -147,7 +147,6 @@ nfsd3_proc_read(struct svc_rqst *rqstp) { struct nfsd3_readargs *argp = rqstp->rq_argp; struct nfsd3_readres *resp = rqstp->rq_resp; - u32 max_blocksize = svc_max_payload(rqstp); unsigned int len; int v; @@ -156,7 +155,8 @@ nfsd3_proc_read(struct svc_rqst *rqstp) (unsigned long) argp->count, (unsigned long long) argp->offset); - argp->count = min_t(u32, argp->count, max_blocksize); + argp->count = min_t(u32, argp->count, svc_max_payload(rqstp)); + argp->count = min_t(u32, argp->count, rqstp->rq_res.buflen); if (argp->offset > (u64)OFFSET_MAX) argp->offset = (u64)OFFSET_MAX; if (argp->offset + argp->count > (u64)OFFSET_MAX) From patchwork Sat Oct 22 07:19: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: 7333 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1094748wrr; Sat, 22 Oct 2022 01:00:55 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5ehGpCwGVOggVkOwUXpWdTxPYalt7qyob0dlehiUQUc2FMFicTv6OIDzSkKB1ig7yFKdmn X-Received: by 2002:a05:6a00:cc4:b0:566:87c:53de with SMTP id b4-20020a056a000cc400b00566087c53demr22906528pfv.19.1666425655278; Sat, 22 Oct 2022 01:00:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666425655; cv=none; d=google.com; s=arc-20160816; b=DZmye4zagQJTnTkFjF1O4Dft13fHC2fzRejgPmMbsuSoQZE7sNyAbz3S483rkO7d6f CrHW1joZ5KJlUHq4c77hH2WdhV5XSOAhYrrD79kOrvVNeXvOUA6f2fw8pwWNWNr3I9yg mEcqtowUIMYL+2FHEquxE+xL5mR7zgKpiP6xK1ZPwAE1KPDCdG+fnBez6dkECZVi0IjL Fr+X6WoRUzTzEWW1fC8w38V4304nEgupxuq5tWsozqpmGHywlUGPBMnuLj3x3pkCAXHd 7FwLkl2TJFBANclkCBEaGv7agtmCRi0E/bVRPMUIwRMGO5+mqCsrOGI0DjM/bzOtpgH4 +cTw== 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=PkjOYu1sRZ41cM2ftc84bFIHzzBc7KizG0WnOCs4x7I=; b=FFbA938na6f2XONyySzNJCEEbrByRoJkuK2Ff3WmSdzB93jyo8l+ezyTdfq0vVui6a K9UIEZ5+zKLo2GINeIQ2jukDjaBabj0AiebiqThi90aIZOj3wOt3+3PTwnkR8tkU55oj dYy9FhVGTsJM+6XAceCYrO8KfqPWbvxF35WKAnDG50PYL9DlwItOwOjKzt14Z5CHdoki wirBV9e+NbBimqSgVSmUzXT9vH073CgMKlFlE32cyuiqzH6FF622edEAHt2TGVzAJtPm piJSVkj6ztNzcJ0uLO8+T+4YCD3eazCo/nJwbbEI1rrZubLn72avl5ch9aAPXHH39teR 3DiA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=LoxpChLb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 u10-20020a170903124a00b001780ba83636si34270932plh.612.2022.10.22.01.00.39; Sat, 22 Oct 2022 01:00: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=LoxpChLb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S232418AbiJVH66 (ORCPT + 99 others); Sat, 22 Oct 2022 03:58:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39696 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232126AbiJVHyH (ORCPT ); Sat, 22 Oct 2022 03:54:07 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A3DB7951C5; Sat, 22 Oct 2022 00:47:22 -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 sin.source.kernel.org (Postfix) with ESMTPS id C78BCCE2C98; Sat, 22 Oct 2022 07:38:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C5A78C433C1; Sat, 22 Oct 2022 07:38:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424286; bh=zhPUD++s41ALFKJlkWcRVcaro7JOAzgATab/HtGbOz8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LoxpChLbtaq9P/LtSTQ8SUWX76tJkN3fAcCSRY0RJUlVQbMEfMepBVxP83ZgfESbp lRK+I0OVJ6q/0eHh0SCBOuMlwK/WMzaGuftPwYaCtTpKJPNYn7T4FmL2MI5PRy3FQm pzVWGTC0UU/hxwckCLZ0ZWN2BCwRnyz7OVo6/wHc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, kernel test robot , Dan Carpenter , Neil Armstrong , Viresh Kumar Subject: [PATCH 5.19 089/717] cpufreq: qcom-cpufreq-hw: Fix uninitialized throttled_freq warning Date: Sat, 22 Oct 2022 09:19:28 +0200 Message-Id: <20221022072431.091471458@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747373947450930499?= X-GMAIL-MSGID: =?utf-8?q?1747373947450930499?= From: Viresh Kumar commit 91dc90fdb8b8199519a3aac9c46a433b02223c5b upstream. Commit 6240aaad75e1 was supposed to drop the reference count to the OPP, instead it avoided more stuff if the OPP isn't found. This isn't entirely correct. We already have a frequency value available, we just couldn't align it with an OPP in case of IS_ERR(opp). Lets continue with updating thermal pressure, etc, even if we aren't able to find an OPP here. This fixes warning generated by the 'smatch' tool. Fixes: 6240aaad75e1 ("cpufreq: qcom-hw: fix the opp entries refcounting") Cc: v5.18+ # v5.18+ Reported-by: kernel test robot Reported-by: Dan Carpenter Reviewed-by: Neil Armstrong Signed-off-by: Viresh Kumar Signed-off-by: Greg Kroah-Hartman --- drivers/cpufreq/qcom-cpufreq-hw.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) --- a/drivers/cpufreq/qcom-cpufreq-hw.c +++ b/drivers/cpufreq/qcom-cpufreq-hw.c @@ -317,14 +317,14 @@ static void qcom_lmh_dcvs_notify(struct if (IS_ERR(opp)) { dev_warn(dev, "Can't find the OPP for throttling: %pe!\n", opp); } else { - throttled_freq = freq_hz / HZ_PER_KHZ; - - /* Update thermal pressure (the boost frequencies are accepted) */ - arch_update_thermal_pressure(policy->related_cpus, throttled_freq); - dev_pm_opp_put(opp); } + throttled_freq = freq_hz / HZ_PER_KHZ; + + /* Update thermal pressure (the boost frequencies are accepted) */ + arch_update_thermal_pressure(policy->related_cpus, throttled_freq); + /* * In the unlikely case policy is unregistered do not enable * polling or h/w interrupt From patchwork Sat Oct 22 07:19: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: 7208 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1090238wrr; Sat, 22 Oct 2022 00:46:13 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6UjK5KT+8L8DQQN+vv5yb7luGn7PTIXzd3zrp0XHQeGFcDHZe84nBZBBHUzEs7eW5Oe3gc X-Received: by 2002:a05:6a00:114c:b0:528:2c7a:630e with SMTP id b12-20020a056a00114c00b005282c7a630emr22941596pfm.86.1666424773038; Sat, 22 Oct 2022 00:46:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666424773; cv=none; d=google.com; s=arc-20160816; b=sZ17kma0p2HFmpwkwvXDSEFjlAf1wPGOMbvdA9VqZs6+vZP0Zsq/3BKP7sn791FKFl hGS7Qq/V23dRBfpjIyI018IhwkIWbJDxpMFrvJqmOTLOSUg+w4Fta3t4DelNOpQltJtO tK8Ndn5QsOuOd37HVb4Z4VNE79nT2bRLEG+emgB8HOqeg5fs52rusj5IGWpeIaO/ge+q E0Ph6hO7chN99WhtOk8YLxnL6KZ47QTdAq1lWXriQDBKh2+1oQcYf4g+OZGQQ9lIBz19 do5VZfAMTXxhAtZYnTWd04y0cf5awCecnNTzwZ9nskRw3jjqpHTVSfmRK/JPSNTf0G5k 5AbQ== 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=pbR5Iq2QNzQXZ3bhiHLKQ7yyMXCbZ850s6WlML3zi+A=; b=nfKurIHdLMroLylAyzWsTCr//LfxWAhAEiDSPyMabBviVaUqOG+7QdtMyt89A+iSjm hROP9EFKueuf2y9OltZ/s7XYLv1Z86dAYq+1MAdqcD3pRJOPd/Pv6Cv0jYUCw5vmLpP9 DN5yTKFejRpBuwxcq2DpqWtwHtiHxuuNP5x0wyacV9BdrCFE8O50TwNA1iCovTB7Zv3A ++bdYfDXvI+0feJfGpNJMibL6LTA21U5ShwfU0WFGW1JLdDJO7DuozA5NbK8k2eK5ybK 9rzO2ryNximE4VutIjmJaFZm7Y9E+yg2/4jnbS/bKZfPSwnQ/7V4UnjrLzKpVKN2KRBh Ku6Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Ym7djM2h; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 u15-20020a170902e5cf00b00172f237cd04si32374700plf.108.2022.10.22.00.46.00; Sat, 22 Oct 2022 00:46: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=Ym7djM2h; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231335AbiJVHpd (ORCPT + 99 others); Sat, 22 Oct 2022 03:45:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45402 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231287AbiJVHnc (ORCPT ); Sat, 22 Oct 2022 03:43:32 -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 0EE6F1EB552; Sat, 22 Oct 2022 00:42: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 7A6F660AC7; Sat, 22 Oct 2022 07:38:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8872EC433D6; Sat, 22 Oct 2022 07:38:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424288; bh=60PZ+RY33//MRdOs+d0W6qXIbeFiZGLYctjbhfQDJfs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ym7djM2hC6N0M8LjFFoyoxCsiNE2ZZ8JMmApLPpImmmP4qQdjTK5rGA0M0PLqAP7t Ysg0t6sTwl+r97LwYE+U9/dbsa4Z4RaegiIkl0oauGHN8Et1XQr7pOY3MIXJdxAzKD WAjO4doPbq1lalGfFEiEXJ/VzwOdhRLUrCQTR4Jo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zhang Rui , Wang Wendy , "Rafael J. Wysocki" Subject: [PATCH 5.19 090/717] powercap: intel_rapl: Use standard Energy Unit for SPR Dram RAPL domain Date: Sat, 22 Oct 2022 09:19:29 +0200 Message-Id: <20221022072431.304446345@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747373022419519148?= X-GMAIL-MSGID: =?utf-8?q?1747373022419519148?= From: Zhang Rui commit 4c081324df5608b73428662ca54d5221ea03a6bd upstream. Intel Xeon servers used to use a fixed energy resolution (15.3uj) for Dram RAPL domain. But on SPR, Dram RAPL domain follows the standard energy resolution as described in MSR_RAPL_POWER_UNIT. Remove the SPR dram_domain_energy_unit quirk. Fixes: 2d798d9f5967 ("powercap: intel_rapl: add support for Sapphire Rapids") Signed-off-by: Zhang Rui Tested-by: Wang Wendy Cc: 5.9+ # 5.9+ Signed-off-by: Rafael J. Wysocki Signed-off-by: Greg Kroah-Hartman --- drivers/powercap/intel_rapl_common.c | 1 - 1 file changed, 1 deletion(-) --- a/drivers/powercap/intel_rapl_common.c +++ b/drivers/powercap/intel_rapl_common.c @@ -1035,7 +1035,6 @@ static const struct rapl_defaults rapl_d .check_unit = rapl_check_unit_core, .set_floor_freq = set_floor_freq_default, .compute_time_window = rapl_compute_time_window_core, - .dram_domain_energy_unit = 15300, .psys_domain_energy_unit = 1000000000, .spr_psys_bits = true, }; From patchwork Sat Oct 22 07:19: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: 7464 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1098869wrr; Sat, 22 Oct 2022 01:12:01 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7F2n6hWgogd0HNdWjoGuv5NeOoX1nGbvfOl7axMkOKoGdbIMpkTeymomZw9ugZwc+z08vR X-Received: by 2002:a17:902:ce90:b0:185:47af:a0d3 with SMTP id f16-20020a170902ce9000b0018547afa0d3mr23110194plg.153.1666426321674; Sat, 22 Oct 2022 01:12:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666426321; cv=none; d=google.com; s=arc-20160816; b=Z5u7vjXaVmb/JODeRg0wM83cZn1k9a6o4+m6eKhdJx2X7oEr4ekjHxgjrgSt2G/shL TSFcSgMHddh0HFPR7wlQT7G9+N6WItsWuaBxEkwRxHymz2T9aSDNWk0rDkt8cDgvQPZf iNhTzF+Qvth8yN2MLLRZ4wer2NoUkaWsSDV7dahfDhYldDOIwdsOHc8hpmYHM5ml2hcr 1Gw7VxPg0dMSn9s0sseSLrsEVSC30jw+dnORCPc98hrGHyaHqqTLliquj7Lge9tlBeb9 yUcpki1Vk6gD0wr+tP732grrXW3oL3JNG1nCrkUHU5PAbieaC7Pxlbepx8jaUKwzU1zw hPDw== 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=GoCuuyGtLRGZPqurKoQQxnv0qLk7XlNt5TJvVDGSY80=; b=isTrbL+NQEUVI+soxVjkRtHJlIajZFx332/1h8oxCnCEIhchNaSPBVREQSzc1i+x/k uWFHiMP93eBNVcc1B2dXdMuncGYem2VdFlgaAfEDK5yLyGsMKWAxTMwRDTTX8pDCyfbZ +aKMdtqOARRlVE1Q4zSSWWYXKI4rhDGo0bbY8145XjpBooBIXaPFWmG7wEb/fP5bOnW3 e97wF8ebtzAPQ6wdabQZSLCSUPy40dXSUe4VEFD6/W5Ue1Q7ou+NZrdcTmJfpuNl8FkK GsWWjPL/Z7nFJz8Is540GxpKKOYXo13iUvi9LyWMc9qGJJyw9M5EuEbTIiHIas6Ow+YP xPWA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=0ZGe8hYv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 c10-20020a63ea0a000000b00438b79bcf26si28222164pgi.151.2022.10.22.01.11.48; Sat, 22 Oct 2022 01:12: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=0ZGe8hYv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S233267AbiJVILK (ORCPT + 99 others); Sat, 22 Oct 2022 04:11:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35456 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232870AbiJVII2 (ORCPT ); Sat, 22 Oct 2022 04:08:28 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EA3C92C6EB2; Sat, 22 Oct 2022 00:53: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 dfw.source.kernel.org (Postfix) with ESMTPS id 3B26A60AF8; Sat, 22 Oct 2022 07:38:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4107BC433D6; Sat, 22 Oct 2022 07:38:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424291; bh=tbVGBnUCnP64Ww9zk4cCKvbF8v6NfhXrIq0FiPXcUcQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0ZGe8hYvaUAwQZZ304SIKYwMjDkghNwVIAG9hMryET0iSV2lUzsd1bU5TVYsAKQCf d5i/Rbcfm9r14Amtv93z2wTxrauduuyJIZ6ZfTMnBcDvurGlk6O0P/ZurFISuUraP9 858EaS7qV0TIxonfagjGrKjqc40SSNcwSnuvX2uU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Christophe Leroy , Michael Ellerman Subject: [PATCH 5.19 091/717] powerpc/Kconfig: Fix non existing CONFIG_PPC_FSL_BOOKE Date: Sat, 22 Oct 2022 09:19:30 +0200 Message-Id: <20221022072431.484486070@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747374646701007746?= X-GMAIL-MSGID: =?utf-8?q?1747374646701007746?= From: Christophe Leroy commit d1203f32d86987a3ccd7de9ba2448ba12d86d125 upstream. CONFIG_PPC_FSL_BOOKE doesn't exist. Should be CONFIG_FSL_BOOKE. Fixes: 49e3d8ea6248 ("powerpc/fsl_booke: Enable STRICT_KERNEL_RWX") Cc: stable@vger.kernel.org Signed-off-by: Christophe Leroy Signed-off-by: Michael Ellerman Link: https://lore.kernel.org/r/828f6a64eeb51ce9abfa1d4e84c521a02fecebb8.1663606875.git.christophe.leroy@csgroup.eu Signed-off-by: Greg Kroah-Hartman --- arch/powerpc/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/arch/powerpc/Kconfig +++ b/arch/powerpc/Kconfig @@ -817,7 +817,7 @@ config DATA_SHIFT default 24 if STRICT_KERNEL_RWX && PPC64 range 17 28 if (STRICT_KERNEL_RWX || DEBUG_PAGEALLOC || KFENCE) && PPC_BOOK3S_32 range 19 23 if (STRICT_KERNEL_RWX || DEBUG_PAGEALLOC || KFENCE) && PPC_8xx - range 20 24 if (STRICT_KERNEL_RWX || DEBUG_PAGEALLOC || KFENCE) && PPC_FSL_BOOKE + range 20 24 if (STRICT_KERNEL_RWX || DEBUG_PAGEALLOC || KFENCE) && FSL_BOOKE default 22 if STRICT_KERNEL_RWX && PPC_BOOK3S_32 default 18 if (DEBUG_PAGEALLOC || KFENCE) && PPC_BOOK3S_32 default 23 if STRICT_KERNEL_RWX && PPC_8xx From patchwork Sat Oct 22 07:19:31 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 7238 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1090929wrr; Sat, 22 Oct 2022 00:49:00 -0700 (PDT) X-Google-Smtp-Source: AMsMyM66XxDHLqxE5LIE1ydxRYjf1mHvXPUoOHAYCZKrfITE8Z7X4vAujEF6WoQi6JJC+v6BS8gq X-Received: by 2002:a62:4c6:0:b0:55f:c739:51e0 with SMTP id 189-20020a6204c6000000b0055fc73951e0mr22986140pfe.49.1666424940553; Sat, 22 Oct 2022 00:49:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666424940; cv=none; d=google.com; s=arc-20160816; b=owM9B0t7x9/M8v21ut029T4Xmg0+XepQ7EaHRfgQMHzbQG1OSLo5CSA2XtfdpVHhMH 4+YSaYevxz5pzOOVLgmQsFrI+7a82wsDAugg9/1Bj1R+HzzROe17lFANa0ZmTqaL1tSz QMtoqGOlTeee1EJpYqZXJxMkLGR4djgubqH/r8G3hCGQNHxk1IozynVfYfsz9TZzLyta ro6KT/Z52v8+PL+XdC2p+x5IM0N3rsKWAvUj0uAJ2o9KZrbvS4d2LTbQg+g6zb3fiTKY wAsaIJfrnJklZvkAiH5MIsphzJEDM22+pMNPk9XWz0JIh7OxMTMb20vUOBeDosRMIMTO jNXw== 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=4GLxZbz3PZ4hR5ukritfiOK4AXC4/UWZG8QprTeCQz8=; b=svGbQ5nvGjXtnYwSos/ltjSZIK6OfgVTg2PsKZTYwhb+UMsanMiSSlDrdKvF4RQfdb E92ns+3pJRG1mfutnL8SY8lusjxa72/BFM77YOlZiFRg8vaYGwXZx59cyOqsG49cnMVZ fk4nMXrllchlPaSfKcBTjr9pQQ7u5OhuxyZVHbRpLk9ir4TOd20+VwQ93kWcN6+QNxQP 3JDpoxIhLPqAZqIfX620fIb63/dafDFxFBwBKdjnsCmjwQcBBrsY/8/Fjy0Q6xux4Zej wqJyXpgnDSwGNS0IOHVRCBIHR39j67yRewYqExsJoLM+TYXhVF8qOpWCtKdM7yHnd05B nS7Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=C3KvlSgu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 q12-20020a170902eb8c00b00186748fe8e8si4949614plg.188.2022.10.22.00.48.47; Sat, 22 Oct 2022 00:49: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=C3KvlSgu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231421AbiJVHsQ (ORCPT + 99 others); Sat, 22 Oct 2022 03:48:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43214 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231582AbiJVHrr (ORCPT ); Sat, 22 Oct 2022 03:47:47 -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 7661048E9F; Sat, 22 Oct 2022 00:44: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 1AF8D60B1B; Sat, 22 Oct 2022 07:38:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B8FAFC433D6; Sat, 22 Oct 2022 07:38:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424297; bh=tdIxaMXshIpDgKMPQUIn1JKQxwzuc+FAbzhb3VjbmOg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=C3KvlSgueoNP/NOWS334O3KEveDhKXz0uf+29Zr/brkNg79WrBzJzUBnW719VP0c1 qrsGITHA5fWK7J38U54Y5o1rXE2+VuZSItUQG14Sy6HG5Gdaig6gMzcaM71g0ltka/ E8F3DW3aolSmniKM6NnwBe7sKoSzk2POTyUi3tR4= 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 Subject: [PATCH 5.19 092/717] powerpc/boot: Explicitly disable usage of SPE instructions Date: Sat, 22 Oct 2022 09:19:31 +0200 Message-Id: <20221022072431.642839091@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747373198176329547?= X-GMAIL-MSGID: =?utf-8?q?1747373198176329547?= From: Pali Rohár commit 110a58b9f91c66f743c01a2c217243d94c899c23 upstream. uImage boot wrapper should not use SPE instructions, like kernel itself. Boot wrapper has already disabled Altivec and VSX instructions but not SPE. Options -mno-spe and -mspe=no already set when compilation of kernel, but not when compiling uImage wrapper yet. Fix it. Cc: stable@vger.kernel.org Signed-off-by: Pali Rohár Signed-off-by: Michael Ellerman Link: https://lore.kernel.org/r/20220827134454.17365-1-pali@kernel.org Signed-off-by: Greg Kroah-Hartman --- arch/powerpc/boot/Makefile | 1 + 1 file changed, 1 insertion(+) --- a/arch/powerpc/boot/Makefile +++ b/arch/powerpc/boot/Makefile @@ -34,6 +34,7 @@ endif BOOTCFLAGS := -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \ -fno-strict-aliasing -O2 -msoft-float -mno-altivec -mno-vsx \ + $(call cc-option,-mno-spe) $(call cc-option,-mspe=no) \ -pipe -fomit-frame-pointer -fno-builtin -fPIC -nostdinc \ $(LINUXINCLUDE) From patchwork Sat Oct 22 07:19: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: 7428 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1097843wrr; Sat, 22 Oct 2022 01:08:54 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7sFGhAwX63ACpmJjqEmDVpUNChjTOlvPxz4ruVjOpgWamteS5feK5JrGT507q3+Km5xtk9 X-Received: by 2002:a17:90b:4f4a:b0:20c:64e2:2bf1 with SMTP id pj10-20020a17090b4f4a00b0020c64e22bf1mr27986001pjb.30.1666426134557; Sat, 22 Oct 2022 01:08:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666426134; cv=none; d=google.com; s=arc-20160816; b=vsjPZv/UfJoheAJ3AoZiKmPDdCT4bHT8Mh2NxwOSrLn78LtdEY+5M/5ddoxMwVk3zF d7he4EjB5lpvaQdJSf6GfUFhA6ijyLMlrXY34urCyzjkAWReEygOcd275dO0tdTjpA9l I1yD03SJwgC2bXztozgrZUxSrMly43Exwm2ZE2Kt4Dws+YDby56Xiv6LytTlCozPwRNb ZZSPxQjVIVaQnEWhXYjf8OLjh5JysBLukUlmw9RGdN64+oBsjL+QyNqaXKoLiJ+qIc/b D2Ibbifacf/v82xgBHiPRLYPKxheQsWUbFP2LB4d76wd/t0HnCI2oGxMrQecARLS12pQ 2n9A== 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=gfxxX0aUX/pg6s0PohU/GMlYSATe2edQ4rb60JFnBQ4=; b=H3qH2T5/NUY/iKoJczaajHnhk43DUlgMwdDXMmoMw2HzdhCF1hF1DUjRNJsgIE5dD3 J8sn498aFAbvcruMyWhDP16muer7pn66JjWJdsDoqrY3F+16LuJWkLf9i07WlqrfiJun dzouq0WszPwMNk+u/eygf2tKa8HIkz1JDAncS/7ciHY9Fz6n1U3uoFcgKPKi3/7b1ofn NIP1O7773OF/hugNQ5dDUyKp5IL0EwRBpOs33H75c8eqW8RsHuDA2d2fNQOvAX4oAjlD FNdgmBpZhd3SruyOABiBINgZ7X9GAqCj+M67yvcP6NtYAbbyY+9jt1dAlRfB1QJNHtRA TA/w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=xWEU3kBE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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-20020a170902d50600b00182b78df2f8si33166637plg.495.2022.10.22.01.08.41; Sat, 22 Oct 2022 01:08: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=xWEU3kBE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S233061AbiJVIIX (ORCPT + 99 others); Sat, 22 Oct 2022 04:08:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42308 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232990AbiJVIEe (ORCPT ); Sat, 22 Oct 2022 04:04: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 592832C5688; Sat, 22 Oct 2022 00:52: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 696CDB82D9F; Sat, 22 Oct 2022 07:38:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D0161C433C1; Sat, 22 Oct 2022 07:38:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424300; bh=D2jgQwQo364439T549ihHR/3+u5XK1iy4v8lN4klREE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xWEU3kBEhi7L0QPEJbjDbrz532+zo7C/pYSAbdmbnX5BZamM2y2hLGbuGjZpeu691 z9V6ZGBaXgi78rZgxG5iaKcRZ7rMwQv51HiwOtQmJxj8sabpqjQNx0nBJ4baUXGRdL fmkrCjFbYZVxXx50htks9V3K2k1vuOBV+cuVIyKE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Krzysztof Kozlowski , Srinivas Kandagatla Subject: [PATCH 5.19 093/717] slimbus: qcom-ngd: use correct error in message of pdr_add_lookup() failure Date: Sat, 22 Oct 2022 09:19:32 +0200 Message-Id: <20221022072431.844276021@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747374450487707080?= X-GMAIL-MSGID: =?utf-8?q?1747374450487707080?= From: Krzysztof Kozlowski commit 5038d21dde818fe74ba1fcb6f2cee35b8c2ebbf2 upstream. Use correct error code, instead of previous 'ret' value, when printing error from pdr_add_lookup() failure. Fixes: e1ae85e1830e ("slimbus: qcom-ngd-ctrl: add Protection Domain Restart Support") Cc: Signed-off-by: Krzysztof Kozlowski Signed-off-by: Srinivas Kandagatla Link: https://lore.kernel.org/r/20220916122910.170730-2-srinivas.kandagatla@linaro.org Signed-off-by: Greg Kroah-Hartman --- drivers/slimbus/qcom-ngd-ctrl.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/drivers/slimbus/qcom-ngd-ctrl.c +++ b/drivers/slimbus/qcom-ngd-ctrl.c @@ -1581,8 +1581,9 @@ static int qcom_slim_ngd_ctrl_probe(stru pds = pdr_add_lookup(ctrl->pdr, "avs/audio", "msm/adsp/audio_pd"); if (IS_ERR(pds) && PTR_ERR(pds) != -EALREADY) { + ret = PTR_ERR(pds); dev_err(dev, "pdr add lookup failed: %d\n", ret); - return PTR_ERR(pds); + return ret; } platform_driver_register(&qcom_slim_ngd_driver); From patchwork Sat Oct 22 07:19: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: 7218 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1090374wrr; Sat, 22 Oct 2022 00:46:49 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7cW9Nm/EaAZbL4GpssQgNZ7kvGz7qOVn91MsUpqZEHyc4DpCflcmE3Jx5OyNHnN8v54Oe9 X-Received: by 2002:a17:903:3293:b0:186:867b:e24 with SMTP id jh19-20020a170903329300b00186867b0e24mr4075284plb.127.1666424809163; Sat, 22 Oct 2022 00:46:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666424809; cv=none; d=google.com; s=arc-20160816; b=iO9ecWMq5pUTWg6B5Uq+OqMi86g7WJHJ1sO1fKV4LnvaZ0dE4I9wu0/fHrUmqB4fvx aZ9ybUXEU8RJo6zgWhPGgNYRWnL8yt8Karqas0CtBMX4O3riuqPqWRsX1bj8Jvl1KSZ7 GkXXUo3jqtyLgCHn3qtHB2kGcAdr+aN+ac91jQv29oYM2gkBs9ge34nTvcTrXXUpVrzP Iy3Zf1i+9W+x+VFVxkt5rqvUUWaxf31f7RAzE/pkYwICJnAQUTuE2mclRGJO9Yv95tct u07/cPrGtQ/IinfvqdGHmLEJ0R+2ZpnXm5aBtBF491WM/3dhEobNuA8mtD8JtKBzCPNI NIpg== 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=WaELeuUaIETpvupQo2MMCFvLN6d3Wv7/9CW3249WKas=; b=Akd9vC8Z1GVOrOgHwQS8kCrhgMHGummfyG+fmACWm6453NCU0LrDxB8yh88bKR029r 86rhnzaZQU/I+WFLXkrQ8ZJ4BVvsxDi6LRGh8Q8+jH6U6P1Z6/dbLIjzTKCy7yqkVkz1 F54f+5scEl1ynClwtR8IbLU/lIqY+BnUWz7A0d3NyakMURHv6f6qgHGQspsRLq0gcl1r 3bvnp7KsURqUuNAFdnKDIwr9f1Uh+iL8LLhPUYojA98R/Jd3x6n6yjBeiRSx//iygjml UcHS2FeBDgwvzI233zt162Ndql5I45VLW2T9TogAv3zvq3hL2vLM7G+OPyheZgakk0LD afeA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=obv6sulY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 il11-20020a17090b164b00b001fb3040753fsi10706995pjb.64.2022.10.22.00.46.36; Sat, 22 Oct 2022 00:46: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=obv6sulY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231444AbiJVHqT (ORCPT + 99 others); Sat, 22 Oct 2022 03:46:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45920 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231470AbiJVHoS (ORCPT ); Sat, 22 Oct 2022 03:44: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 0726B62A5B; Sat, 22 Oct 2022 00:42: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 dfw.source.kernel.org (Postfix) with ESMTPS id 5DFD260AC3; Sat, 22 Oct 2022 07:38:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6FE8BC433C1; Sat, 22 Oct 2022 07:38:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424302; bh=oIZz2kCGl4WXF7IUGUkjXWSCBViv/dAcbheVseTAqUw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=obv6sulYRd84kOP2RIHSxLZo/D3VnsTHW6/hVVhD4BuxSqECPrvJVzZJbQCkTLo5m dS/D8JHiDrweiy2YX7TTT38710MUzIixD+FgKboGQlvqDG0fBxgvhngdbZtKBt68OV Ch+iTi0sh+mernHMA3rpoczfxPBF9A8lkbNS5T4A= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Krzysztof Kozlowski , Srinivas Kandagatla Subject: [PATCH 5.19 094/717] slimbus: qcom-ngd: cleanup in probe error path Date: Sat, 22 Oct 2022 09:19:33 +0200 Message-Id: <20221022072432.030870879@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747373060539435646?= X-GMAIL-MSGID: =?utf-8?q?1747373060539435646?= From: Krzysztof Kozlowski commit 16f14551d0df9e7cd283545d7d748829594d912f upstream. Add proper error path in probe() to cleanup resources previously acquired/allocated to fix warnings visible during probe deferral: notifier callback qcom_slim_ngd_ssr_notify already registered WARNING: CPU: 6 PID: 70 at kernel/notifier.c:28 notifier_chain_register+0x5c/0x90 Modules linked in: CPU: 6 PID: 70 Comm: kworker/u16:1 Not tainted 6.0.0-rc3-next-20220830 #380 Call trace: notifier_chain_register+0x5c/0x90 srcu_notifier_chain_register+0x44/0x90 qcom_register_ssr_notifier+0x38/0x4c qcom_slim_ngd_ctrl_probe+0xd8/0x400 platform_probe+0x6c/0xe0 really_probe+0xbc/0x2d4 __driver_probe_device+0x78/0xe0 driver_probe_device+0x3c/0x12c __device_attach_driver+0xb8/0x120 bus_for_each_drv+0x78/0xd0 __device_attach+0xa8/0x1c0 device_initial_probe+0x18/0x24 bus_probe_device+0xa0/0xac deferred_probe_work_func+0x88/0xc0 process_one_work+0x1d4/0x320 worker_thread+0x2cc/0x44c kthread+0x110/0x114 ret_from_fork+0x10/0x20 Fixes: e1ae85e1830e ("slimbus: qcom-ngd-ctrl: add Protection Domain Restart Support") Cc: Signed-off-by: Krzysztof Kozlowski Signed-off-by: Srinivas Kandagatla Link: https://lore.kernel.org/r/20220916122910.170730-3-srinivas.kandagatla@linaro.org Signed-off-by: Greg Kroah-Hartman --- drivers/slimbus/qcom-ngd-ctrl.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) --- a/drivers/slimbus/qcom-ngd-ctrl.c +++ b/drivers/slimbus/qcom-ngd-ctrl.c @@ -1576,18 +1576,27 @@ static int qcom_slim_ngd_ctrl_probe(stru ctrl->pdr = pdr_handle_alloc(slim_pd_status, ctrl); if (IS_ERR(ctrl->pdr)) { dev_err(dev, "Failed to init PDR handle\n"); - return PTR_ERR(ctrl->pdr); + ret = PTR_ERR(ctrl->pdr); + goto err_pdr_alloc; } pds = pdr_add_lookup(ctrl->pdr, "avs/audio", "msm/adsp/audio_pd"); if (IS_ERR(pds) && PTR_ERR(pds) != -EALREADY) { ret = PTR_ERR(pds); dev_err(dev, "pdr add lookup failed: %d\n", ret); - return ret; + goto err_pdr_lookup; } platform_driver_register(&qcom_slim_ngd_driver); return of_qcom_slim_ngd_register(dev, ctrl); + +err_pdr_alloc: + qcom_unregister_ssr_notifier(ctrl->notifier, &ctrl->nb); + +err_pdr_lookup: + pdr_handle_release(ctrl->pdr); + + return ret; } static int qcom_slim_ngd_ctrl_remove(struct platform_device *pdev) From patchwork Sat Oct 22 07:19: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: 7752 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1113818wrr; Sat, 22 Oct 2022 02:04:49 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7jzLGpod1fnqrISkxxkM5NYkVvqkzfxs+F2HpwFB4kwlyUsPfTufS7088Au93oJLF+AIyz X-Received: by 2002:a17:90b:3b43:b0:211:2d33:685d with SMTP id ot3-20020a17090b3b4300b002112d33685dmr16198488pjb.93.1666429488750; Sat, 22 Oct 2022 02:04:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666429488; cv=none; d=google.com; s=arc-20160816; b=ix2hq8QuAfS4CL0pqGkg/8+VBWVGz0ubr7tvrU8sU9e0Dt31MwLrv6NoC6NssxXk/K RQlzSs/8vuhN4DYxkIqwmLNLcvw+oCbunpr6lBccp4PEGhqsTLvHnsdE1ZVV/r5KW0vy mPtpsyzXOi245TYsh9sGp1ofkchzW8K1WJqiBf82pDVPMkU/wjikmLKHaooX7CFEJnAU CJWarleaD23jO2Jru8mS08XPDsv/IEfbdSIVE+hALxqhgJHoB0EPUSVB4jL4ZP/8CVo8 G+Z5TzcAc4eVf4wjdSivmwMI8KsYqaQEsP5vOPx/fXTutk+mUFuOMdHigvNIvKyYqUII ZQ7w== 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=Key07bgII9189iVjrTXVsdbcPEjcoV5/SOUMMmWzJg4=; b=hgfYbhMqIFi2yD93KnJrG7kqVkl6vVZs6tAQpbjsOH/V9j4wCxFdwc607lhzOmp0Ix vz5srEQxfXv2ACY5ywOYsMOJzFUCClwbjTZN7tSkQnkM+4DbvKOLOXSKIiJsGfbK0I1g LNuUCBgIIm2Osletx4yBPQXhNxGuGT1OpbApCRwGxiuB/AeQabAqOOn0Aa0bjRbafdPR D3ukkTIjWT/on1hjQtn3Rffv3iZQt3VdZ+Kr1H4XGSZRX/BK525p32A9wKBkuVnlOan7 CQoOpdPlxlOYsANCYE0K48XcHkyaFLncNRWF8gXLlM1tOPapTqgMDu7nc7xWXscrpVPJ ampQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=o2Yu6Mcw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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-20020a639306000000b00461f10556b9si27073596pge.319.2022.10.22.02.04.36; Sat, 22 Oct 2022 02:04: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=o2Yu6Mcw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S234134AbiJVJAB (ORCPT + 99 others); Sat, 22 Oct 2022 05:00:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34612 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235075AbiJVI7B (ORCPT ); Sat, 22 Oct 2022 04:59: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 8DBFC2A0409; Sat, 22 Oct 2022 01:16: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 8E3C560B6F; Sat, 22 Oct 2022 07:40:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 98441C433C1; Sat, 22 Oct 2022 07:40:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424413; bh=xwiTXxztq7vdfxdpCHRaIneLQ3ClkNUCk9DyezKyNXQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=o2Yu6McwrwWmMAOIos2Eux6AEOm9uBMTlYEUizn+UhKEjfdM8RthePGsiSWsiZJlJ KMuGl6955aymjXF+Y1Z5GcElk0XuwxZRd3hxUX8jMd20voyG2lecnW7EUUHkaTVAIV fWh+cDSxorANlY30GZDneiDh1Rqu6gDTzkjF7fdw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Justin Tee , James Smart , "Martin K. Petersen" Subject: [PATCH 5.19 095/717] scsi: lpfc: Rework MIB Rx Monitor debug info logic Date: Sat, 22 Oct 2022 09:19:34 +0200 Message-Id: <20221022072432.185623568@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747377967898369998?= X-GMAIL-MSGID: =?utf-8?q?1747377967898369998?= From: James Smart commit bd269188ea94e40ab002cad7b0df8f12b8f0de54 upstream. The kernel test robot reported the following sparse warning: arch/arm64/include/asm/cmpxchg.h:88:1: sparse: sparse: cast truncates bits from constant value (369 becomes 69) On arm64, atomic_xchg only works on 8-bit byte fields. Thus, the macro usage of LPFC_RXMONITOR_TABLE_IN_USE can be unintentionally truncated leading to all logic involving the LPFC_RXMONITOR_TABLE_IN_USE macro to not work properly. Replace the Rx Table atomic_t indexing logic with a new lpfc_rx_info_monitor structure that holds a circular ring buffer. For locking semantics, a spinlock_t is used. Link: https://lore.kernel.org/r/20220819011736.14141-4-jsmart2021@gmail.com Fixes: 17b27ac59224 ("scsi: lpfc: Add rx monitoring statistics") Cc: # v5.15+ Co-developed-by: Justin Tee Signed-off-by: Justin Tee Signed-off-by: James Smart Signed-off-by: Martin K. Petersen Signed-off-by: Greg Kroah-Hartman --- drivers/scsi/lpfc/lpfc.h | 14 +- drivers/scsi/lpfc/lpfc_crtn.h | 8 + drivers/scsi/lpfc/lpfc_debugfs.c | 59 ++---------- drivers/scsi/lpfc/lpfc_debugfs.h | 2 drivers/scsi/lpfc/lpfc_init.c | 83 ++++------------- drivers/scsi/lpfc/lpfc_mem.c | 9 + drivers/scsi/lpfc/lpfc_sli.c | 190 +++++++++++++++++++++++++++++++++++++-- 7 files changed, 240 insertions(+), 125 deletions(-) --- a/drivers/scsi/lpfc/lpfc.h +++ b/drivers/scsi/lpfc/lpfc.h @@ -1576,10 +1576,7 @@ struct lpfc_hba { u32 cgn_acqe_cnt; /* RX monitor handling for CMF */ - struct rxtable_entry *rxtable; /* RX_monitor information */ - atomic_t rxtable_idx_head; -#define LPFC_RXMONITOR_TABLE_IN_USE (LPFC_MAX_RXMONITOR_ENTRY + 73) - atomic_t rxtable_idx_tail; + struct lpfc_rx_info_monitor *rx_monitor; atomic_t rx_max_read_cnt; /* Maximum read bytes */ uint64_t rx_block_cnt; @@ -1628,7 +1625,7 @@ struct lpfc_hba { #define LPFC_MAX_RXMONITOR_ENTRY 800 #define LPFC_MAX_RXMONITOR_DUMP 32 -struct rxtable_entry { +struct rx_info_entry { uint64_t cmf_bytes; /* Total no of read bytes for CMF_SYNC_WQE */ uint64_t total_bytes; /* Total no of read bytes requested */ uint64_t rcv_bytes; /* Total no of read bytes completed */ @@ -1643,6 +1640,13 @@ struct rxtable_entry { uint32_t timer_interval; }; +struct lpfc_rx_info_monitor { + struct rx_info_entry *ring; /* info organized in a circular buffer */ + u32 head_idx, tail_idx; /* index to head/tail of ring */ + spinlock_t lock; /* spinlock for ring */ + u32 entries; /* storing number entries/size of ring */ +}; + static inline struct Scsi_Host * lpfc_shost_from_vport(struct lpfc_vport *vport) { --- a/drivers/scsi/lpfc/lpfc_crtn.h +++ b/drivers/scsi/lpfc/lpfc_crtn.h @@ -92,6 +92,14 @@ void lpfc_cgn_dump_rxmonitor(struct lpfc void lpfc_cgn_update_stat(struct lpfc_hba *phba, uint32_t dtag); void lpfc_unblock_requests(struct lpfc_hba *phba); void lpfc_block_requests(struct lpfc_hba *phba); +int lpfc_rx_monitor_create_ring(struct lpfc_rx_info_monitor *rx_monitor, + u32 entries); +void lpfc_rx_monitor_destroy_ring(struct lpfc_rx_info_monitor *rx_monitor); +void lpfc_rx_monitor_record(struct lpfc_rx_info_monitor *rx_monitor, + struct rx_info_entry *entry); +u32 lpfc_rx_monitor_report(struct lpfc_hba *phba, + struct lpfc_rx_info_monitor *rx_monitor, char *buf, + u32 buf_len, u32 max_read_entries); void lpfc_mbx_cmpl_local_config_link(struct lpfc_hba *, LPFC_MBOXQ_t *); void lpfc_mbx_cmpl_reg_login(struct lpfc_hba *, LPFC_MBOXQ_t *); --- a/drivers/scsi/lpfc/lpfc_debugfs.c +++ b/drivers/scsi/lpfc/lpfc_debugfs.c @@ -5531,7 +5531,7 @@ lpfc_rx_monitor_open(struct inode *inode if (!debug) goto out; - debug->buffer = vmalloc(MAX_DEBUGFS_RX_TABLE_SIZE); + debug->buffer = vmalloc(MAX_DEBUGFS_RX_INFO_SIZE); if (!debug->buffer) { kfree(debug); goto out; @@ -5552,57 +5552,18 @@ lpfc_rx_monitor_read(struct file *file, struct lpfc_rx_monitor_debug *debug = file->private_data; struct lpfc_hba *phba = (struct lpfc_hba *)debug->i_private; char *buffer = debug->buffer; - struct rxtable_entry *entry; - int i, len = 0, head, tail, last, start; - head = atomic_read(&phba->rxtable_idx_head); - while (head == LPFC_RXMONITOR_TABLE_IN_USE) { - /* Table is getting updated */ - msleep(20); - head = atomic_read(&phba->rxtable_idx_head); + if (!phba->rx_monitor) { + scnprintf(buffer, MAX_DEBUGFS_RX_INFO_SIZE, + "Rx Monitor Info is empty.\n"); + } else { + lpfc_rx_monitor_report(phba, phba->rx_monitor, buffer, + MAX_DEBUGFS_RX_INFO_SIZE, + LPFC_MAX_RXMONITOR_ENTRY); } - tail = atomic_xchg(&phba->rxtable_idx_tail, head); - if (!phba->rxtable || head == tail) { - len += scnprintf(buffer + len, MAX_DEBUGFS_RX_TABLE_SIZE - len, - "Rxtable is empty\n"); - goto out; - } - last = (head > tail) ? head : LPFC_MAX_RXMONITOR_ENTRY; - start = tail; - - len += scnprintf(buffer + len, MAX_DEBUGFS_RX_TABLE_SIZE - len, - " MaxBPI Tot_Data_CMF Tot_Data_Cmd " - "Tot_Data_Cmpl Lat(us) Avg_IO Max_IO " - "Bsy IO_cnt Info BWutil(ms)\n"); -get_table: - for (i = start; i < last; i++) { - entry = &phba->rxtable[i]; - len += scnprintf(buffer + len, MAX_DEBUGFS_RX_TABLE_SIZE - len, - "%3d:%12lld %12lld %12lld %12lld " - "%7lldus %8lld %7lld " - "%2d %4d %2d %2d(%2d)\n", - i, entry->max_bytes_per_interval, - entry->cmf_bytes, - entry->total_bytes, - entry->rcv_bytes, - entry->avg_io_latency, - entry->avg_io_size, - entry->max_read_cnt, - entry->cmf_busy, - entry->io_cnt, - entry->cmf_info, - entry->timer_utilization, - entry->timer_interval); - } - - if (head != last) { - start = 0; - last = head; - goto get_table; - } -out: - return simple_read_from_buffer(buf, nbytes, ppos, buffer, len); + return simple_read_from_buffer(buf, nbytes, ppos, buffer, + strlen(buffer)); } static int --- a/drivers/scsi/lpfc/lpfc_debugfs.h +++ b/drivers/scsi/lpfc/lpfc_debugfs.h @@ -282,7 +282,7 @@ struct lpfc_idiag { void *ptr_private; }; -#define MAX_DEBUGFS_RX_TABLE_SIZE (128 * LPFC_MAX_RXMONITOR_ENTRY) +#define MAX_DEBUGFS_RX_INFO_SIZE (128 * LPFC_MAX_RXMONITOR_ENTRY) struct lpfc_rx_monitor_debug { char *i_private; char *buffer; --- a/drivers/scsi/lpfc/lpfc_init.c +++ b/drivers/scsi/lpfc/lpfc_init.c @@ -5571,38 +5571,12 @@ lpfc_async_link_speed_to_read_top(struct void lpfc_cgn_dump_rxmonitor(struct lpfc_hba *phba) { - struct rxtable_entry *entry; - int cnt = 0, head, tail, last, start; - - head = atomic_read(&phba->rxtable_idx_head); - tail = atomic_read(&phba->rxtable_idx_tail); - if (!phba->rxtable || head == tail) { - lpfc_printf_log(phba, KERN_ERR, LOG_CGN_MGMT, - "4411 Rxtable is empty\n"); - return; - } - last = tail; - start = head; - - /* Display the last LPFC_MAX_RXMONITOR_DUMP entries from the rxtable */ - while (start != last) { - if (start) - start--; - else - start = LPFC_MAX_RXMONITOR_ENTRY - 1; - entry = &phba->rxtable[start]; + if (!phba->rx_monitor) { lpfc_printf_log(phba, KERN_INFO, LOG_CGN_MGMT, - "4410 %02d: MBPI %lld Xmit %lld Cmpl %lld " - "Lat %lld ASz %lld Info %02d BWUtil %d " - "Int %d slot %d\n", - cnt, entry->max_bytes_per_interval, - entry->total_bytes, entry->rcv_bytes, - entry->avg_io_latency, entry->avg_io_size, - entry->cmf_info, entry->timer_utilization, - entry->timer_interval, start); - cnt++; - if (cnt >= LPFC_MAX_RXMONITOR_DUMP) - return; + "4411 Rx Monitor Info is empty.\n"); + } else { + lpfc_rx_monitor_report(phba, phba->rx_monitor, NULL, 0, + LPFC_MAX_RXMONITOR_DUMP); } } @@ -6009,9 +5983,8 @@ lpfc_cmf_timer(struct hrtimer *timer) { struct lpfc_hba *phba = container_of(timer, struct lpfc_hba, cmf_timer); - struct rxtable_entry *entry; + struct rx_info_entry entry; uint32_t io_cnt; - uint32_t head, tail; uint32_t busy, max_read; uint64_t total, rcv, lat, mbpi, extra, cnt; int timer_interval = LPFC_CMF_INTERVAL; @@ -6131,40 +6104,30 @@ lpfc_cmf_timer(struct hrtimer *timer) } /* Save rxmonitor information for debug */ - if (phba->rxtable) { - head = atomic_xchg(&phba->rxtable_idx_head, - LPFC_RXMONITOR_TABLE_IN_USE); - entry = &phba->rxtable[head]; - entry->total_bytes = total; - entry->cmf_bytes = total + extra; - entry->rcv_bytes = rcv; - entry->cmf_busy = busy; - entry->cmf_info = phba->cmf_active_info; + if (phba->rx_monitor) { + entry.total_bytes = total; + entry.cmf_bytes = total + extra; + entry.rcv_bytes = rcv; + entry.cmf_busy = busy; + entry.cmf_info = phba->cmf_active_info; if (io_cnt) { - entry->avg_io_latency = div_u64(lat, io_cnt); - entry->avg_io_size = div_u64(rcv, io_cnt); + entry.avg_io_latency = div_u64(lat, io_cnt); + entry.avg_io_size = div_u64(rcv, io_cnt); } else { - entry->avg_io_latency = 0; - entry->avg_io_size = 0; + entry.avg_io_latency = 0; + entry.avg_io_size = 0; } - entry->max_read_cnt = max_read; - entry->io_cnt = io_cnt; - entry->max_bytes_per_interval = mbpi; + entry.max_read_cnt = max_read; + entry.io_cnt = io_cnt; + entry.max_bytes_per_interval = mbpi; if (phba->cmf_active_mode == LPFC_CFG_MANAGED) - entry->timer_utilization = phba->cmf_last_ts; + entry.timer_utilization = phba->cmf_last_ts; else - entry->timer_utilization = ms; - entry->timer_interval = ms; + entry.timer_utilization = ms; + entry.timer_interval = ms; phba->cmf_last_ts = 0; - /* Increment rxtable index */ - head = (head + 1) % LPFC_MAX_RXMONITOR_ENTRY; - tail = atomic_read(&phba->rxtable_idx_tail); - if (head == tail) { - tail = (tail + 1) % LPFC_MAX_RXMONITOR_ENTRY; - atomic_set(&phba->rxtable_idx_tail, tail); - } - atomic_set(&phba->rxtable_idx_head, head); + lpfc_rx_monitor_record(phba->rx_monitor, &entry); } if (phba->cmf_active_mode == LPFC_CFG_MONITOR) { --- a/drivers/scsi/lpfc/lpfc_mem.c +++ b/drivers/scsi/lpfc/lpfc_mem.c @@ -344,9 +344,12 @@ lpfc_mem_free_all(struct lpfc_hba *phba) phba->cgn_i = NULL; } - /* Free RX table */ - kfree(phba->rxtable); - phba->rxtable = NULL; + /* Free RX Monitor */ + if (phba->rx_monitor) { + lpfc_rx_monitor_destroy_ring(phba->rx_monitor); + kfree(phba->rx_monitor); + phba->rx_monitor = NULL; + } /* Free the iocb lookup array */ kfree(psli->iocbq_lookup); --- a/drivers/scsi/lpfc/lpfc_sli.c +++ b/drivers/scsi/lpfc/lpfc_sli.c @@ -7955,6 +7955,172 @@ static void lpfc_sli4_dip(struct lpfc_hb } /** + * lpfc_rx_monitor_create_ring - Initialize ring buffer for rx_monitor + * @rx_monitor: Pointer to lpfc_rx_info_monitor object + * @entries: Number of rx_info_entry objects to allocate in ring + * + * Return: + * 0 - Success + * ENOMEM - Failure to kmalloc + **/ +int lpfc_rx_monitor_create_ring(struct lpfc_rx_info_monitor *rx_monitor, + u32 entries) +{ + rx_monitor->ring = kmalloc_array(entries, sizeof(struct rx_info_entry), + GFP_KERNEL); + if (!rx_monitor->ring) + return -ENOMEM; + + rx_monitor->head_idx = 0; + rx_monitor->tail_idx = 0; + spin_lock_init(&rx_monitor->lock); + rx_monitor->entries = entries; + + return 0; +} + +/** + * lpfc_rx_monitor_destroy_ring - Free ring buffer for rx_monitor + * @rx_monitor: Pointer to lpfc_rx_info_monitor object + **/ +void lpfc_rx_monitor_destroy_ring(struct lpfc_rx_info_monitor *rx_monitor) +{ + spin_lock(&rx_monitor->lock); + kfree(rx_monitor->ring); + rx_monitor->ring = NULL; + rx_monitor->entries = 0; + rx_monitor->head_idx = 0; + rx_monitor->tail_idx = 0; + spin_unlock(&rx_monitor->lock); +} + +/** + * lpfc_rx_monitor_record - Insert an entry into rx_monitor's ring + * @rx_monitor: Pointer to lpfc_rx_info_monitor object + * @entry: Pointer to rx_info_entry + * + * Used to insert an rx_info_entry into rx_monitor's ring. Note that this is a + * deep copy of rx_info_entry not a shallow copy of the rx_info_entry ptr. + * + * This is called from lpfc_cmf_timer, which is in timer/softirq context. + * + * In cases of old data overflow, we do a best effort of FIFO order. + **/ +void lpfc_rx_monitor_record(struct lpfc_rx_info_monitor *rx_monitor, + struct rx_info_entry *entry) +{ + struct rx_info_entry *ring = rx_monitor->ring; + u32 *head_idx = &rx_monitor->head_idx; + u32 *tail_idx = &rx_monitor->tail_idx; + spinlock_t *ring_lock = &rx_monitor->lock; + u32 ring_size = rx_monitor->entries; + + spin_lock(ring_lock); + memcpy(&ring[*tail_idx], entry, sizeof(*entry)); + *tail_idx = (*tail_idx + 1) % ring_size; + + /* Best effort of FIFO saved data */ + if (*tail_idx == *head_idx) + *head_idx = (*head_idx + 1) % ring_size; + + spin_unlock(ring_lock); +} + +/** + * lpfc_rx_monitor_report - Read out rx_monitor's ring + * @phba: Pointer to lpfc_hba object + * @rx_monitor: Pointer to lpfc_rx_info_monitor object + * @buf: Pointer to char buffer that will contain rx monitor info data + * @buf_len: Length buf including null char + * @max_read_entries: Maximum number of entries to read out of ring + * + * Used to dump/read what's in rx_monitor's ring buffer. + * + * If buf is NULL || buf_len == 0, then it is implied that we want to log the + * information to kmsg instead of filling out buf. + * + * Return: + * Number of entries read out of the ring + **/ +u32 lpfc_rx_monitor_report(struct lpfc_hba *phba, + struct lpfc_rx_info_monitor *rx_monitor, char *buf, + u32 buf_len, u32 max_read_entries) +{ + struct rx_info_entry *ring = rx_monitor->ring; + struct rx_info_entry *entry; + u32 *head_idx = &rx_monitor->head_idx; + u32 *tail_idx = &rx_monitor->tail_idx; + spinlock_t *ring_lock = &rx_monitor->lock; + u32 ring_size = rx_monitor->entries; + u32 cnt = 0; + char tmp[DBG_LOG_STR_SZ] = {0}; + bool log_to_kmsg = (!buf || !buf_len) ? true : false; + + if (!log_to_kmsg) { + /* clear the buffer to be sure */ + memset(buf, 0, buf_len); + + scnprintf(buf, buf_len, "\t%-16s%-16s%-16s%-16s%-8s%-8s%-8s" + "%-8s%-8s%-8s%-16s\n", + "MaxBPI", "Tot_Data_CMF", + "Tot_Data_Cmd", "Tot_Data_Cmpl", + "Lat(us)", "Avg_IO", "Max_IO", "Bsy", + "IO_cnt", "Info", "BWutil(ms)"); + } + + /* Needs to be _bh because record is called from timer interrupt + * context + */ + spin_lock_bh(ring_lock); + while (*head_idx != *tail_idx) { + entry = &ring[*head_idx]; + + /* Read out this entry's data. */ + if (!log_to_kmsg) { + /* If !log_to_kmsg, then store to buf. */ + scnprintf(tmp, sizeof(tmp), + "%03d:\t%-16llu%-16llu%-16llu%-16llu%-8llu" + "%-8llu%-8llu%-8u%-8u%-8u%u(%u)\n", + *head_idx, entry->max_bytes_per_interval, + entry->cmf_bytes, entry->total_bytes, + entry->rcv_bytes, entry->avg_io_latency, + entry->avg_io_size, entry->max_read_cnt, + entry->cmf_busy, entry->io_cnt, + entry->cmf_info, entry->timer_utilization, + entry->timer_interval); + + /* Check for buffer overflow */ + if ((strlen(buf) + strlen(tmp)) >= buf_len) + break; + + /* Append entry's data to buffer */ + strlcat(buf, tmp, buf_len); + } else { + lpfc_printf_log(phba, KERN_INFO, LOG_CGN_MGMT, + "4410 %02u: MBPI %llu Xmit %llu " + "Cmpl %llu Lat %llu ASz %llu Info %02u " + "BWUtil %u Int %u slot %u\n", + cnt, entry->max_bytes_per_interval, + entry->total_bytes, entry->rcv_bytes, + entry->avg_io_latency, + entry->avg_io_size, entry->cmf_info, + entry->timer_utilization, + entry->timer_interval, *head_idx); + } + + *head_idx = (*head_idx + 1) % ring_size; + + /* Don't feed more than max_read_entries */ + cnt++; + if (cnt >= max_read_entries) + break; + } + spin_unlock_bh(ring_lock); + + return cnt; +} + +/** * lpfc_cmf_setup - Initialize idle_stat tracking * @phba: Pointer to HBA context object. * @@ -8128,19 +8294,29 @@ no_cmf: phba->cmf_interval_rate = LPFC_CMF_INTERVAL; /* Allocate RX Monitor Buffer */ - if (!phba->rxtable) { - phba->rxtable = kmalloc_array(LPFC_MAX_RXMONITOR_ENTRY, - sizeof(struct rxtable_entry), - GFP_KERNEL); - if (!phba->rxtable) { + if (!phba->rx_monitor) { + phba->rx_monitor = kzalloc(sizeof(*phba->rx_monitor), + GFP_KERNEL); + + if (!phba->rx_monitor) { lpfc_printf_log(phba, KERN_ERR, LOG_INIT, "2644 Failed to alloc memory " "for RX Monitor Buffer\n"); return -ENOMEM; } + + /* Instruct the rx_monitor object to instantiate its ring */ + if (lpfc_rx_monitor_create_ring(phba->rx_monitor, + LPFC_MAX_RXMONITOR_ENTRY)) { + kfree(phba->rx_monitor); + phba->rx_monitor = NULL; + lpfc_printf_log(phba, KERN_ERR, LOG_INIT, + "2645 Failed to alloc memory " + "for RX Monitor's Ring\n"); + return -ENOMEM; + } } - atomic_set(&phba->rxtable_idx_head, 0); - atomic_set(&phba->rxtable_idx_tail, 0); + return 0; } From patchwork Sat Oct 22 07:19: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: 7187 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1089221wrr; Sat, 22 Oct 2022 00:42:33 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4Klpo5EBzA2lzJFpOdlcqsRofWRTVkcX+JDCOhUb0Ki2JK7mJyKUQKnTJvWEmhtITmKkZs X-Received: by 2002:a17:90a:b00b:b0:203:a6de:5b0f with SMTP id x11-20020a17090ab00b00b00203a6de5b0fmr26312625pjq.134.1666424553677; Sat, 22 Oct 2022 00:42:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666424553; cv=none; d=google.com; s=arc-20160816; b=Izmmw0VpZ3NLsVUhG3Vsqtq0I/5OwO2PwP5DV9IdA9J0ZjYmg1sHHPWSrYiUDOiJEK fU25ChSqEhXFVOfK1cuzopa0RD0DB3P2LVgU3NPef6BohX1PrZmHwa/vYd/qYHZfB2t3 WhuGXpmLwL2S2DCXHPOglg29FSphM0pgYRk6WFklMzZNQMELZVI4tk1EREwFi6ePkDtj hxlqdmWGwxZHMZZt8C7tF7/dzL1G4paM3E3tY7x2bagVgJAjL7xq47L7EBt1+FLYIvG8 VwKEyCYOq+dCc05CodGYn403VT41q+Nh78DYPdCAWNPMk9e4GqGXUGAoO1S4tDB+dZ9h D1dQ== 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=1unh5gNOM//0lURzWdG+dqOhsOfQoCT5wRTk73W49Es=; b=ijtKDuxVEia5DS5sFXyeNnwbVAQg5og0FO5HvOKSW39ixdqB8IDIqGDDuySdetqqlQ iEAQFQ7dM/ozcNtRT+JWpS1oSOIjvEJQCLPUl5zVqKv8LuNS3KP7RNhp8UID/npx5Ms2 vNB9fjCMpR/GLzzqELbOi6TbfKoyHuBb0bmHaLSj4MVmFVGOtN3c2r+Igb4wg2YR/CRF S5uU8wVGQVi4NVUul6U/8jG4a9mtl/kd69zWiwcEI1mK/cvaxtUL99kCc8pLuf7+9s+D /38RQrJ4BSMEK8fMLajm6o8DDkTUWGIqfzB07eragXz8sj1fq9dEL+5rbLK0P20KQ66v MTFQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=GMsJVDNu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 ik19-20020a170902ab1300b00176934d4f3dsi23943265plb.468.2022.10.22.00.42.21; Sat, 22 Oct 2022 00: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=GMsJVDNu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231236AbiJVHmF (ORCPT + 99 others); Sat, 22 Oct 2022 03:42:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46264 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231228AbiJVHlo (ORCPT ); Sat, 22 Oct 2022 03:41:44 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9858A31EE9; Sat, 22 Oct 2022 00:39: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 4E58BB82DF9; Sat, 22 Oct 2022 07:38:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BA311C433D6; Sat, 22 Oct 2022 07:38:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424324; bh=5dmX0BxH8ERt9C6w6xHEfRy2uRICDLXXIjsgURNzIo4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GMsJVDNuQGkLxooE2l/mKD0S4lI4bx6cmqDCXDufqpfTXArvC42RSbXUATVRoUOHq gkB3HWdOlw946emZYg+hzWjyZYULu2+6FefRxp/4/lYFnHczwtjoN5WC5OiTKPfkQI gqH7iLjDEH/MPLOIqKXAxKRipo6IIfofMZRFU/K4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Guangwu Zhang , John Meneghini , Saurav Kashyap , Nilesh Javali , "Martin K. Petersen" Subject: [PATCH 5.19 096/717] scsi: qedf: Populate sysfs attributes for vport Date: Sat, 22 Oct 2022 09:19:35 +0200 Message-Id: <20221022072432.361102673@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747372792915745259?= X-GMAIL-MSGID: =?utf-8?q?1747372792915745259?= From: Saurav Kashyap commit 592642e6b11e620e4b43189f8072752429fc8dc3 upstream. Few vport parameters were displayed by systool as 'Unknown' or 'NULL'. Copy speed, supported_speed, frame_size and update port_type for NPIV port. Link: https://lore.kernel.org/r/20220919134434.3513-1-njavali@marvell.com Cc: stable@vger.kernel.org Tested-by: Guangwu Zhang Reviewed-by: John Meneghini Signed-off-by: Saurav Kashyap Signed-off-by: Nilesh Javali Signed-off-by: Martin K. Petersen Signed-off-by: Greg Kroah-Hartman --- drivers/scsi/qedf/qedf_main.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) --- a/drivers/scsi/qedf/qedf_main.c +++ b/drivers/scsi/qedf/qedf_main.c @@ -1921,6 +1921,27 @@ static int qedf_vport_create(struct fc_v fc_vport_setlink(vn_port); } + /* Set symbolic node name */ + if (base_qedf->pdev->device == QL45xxx) + snprintf(fc_host_symbolic_name(vn_port->host), 256, + "Marvell FastLinQ 45xxx FCoE v%s", QEDF_VERSION); + + if (base_qedf->pdev->device == QL41xxx) + snprintf(fc_host_symbolic_name(vn_port->host), 256, + "Marvell FastLinQ 41xxx FCoE v%s", QEDF_VERSION); + + /* Set supported speed */ + fc_host_supported_speeds(vn_port->host) = n_port->link_supported_speeds; + + /* Set speed */ + vn_port->link_speed = n_port->link_speed; + + /* Set port type */ + fc_host_port_type(vn_port->host) = FC_PORTTYPE_NPIV; + + /* Set maxframe size */ + fc_host_maxframe_size(vn_port->host) = n_port->mfs; + QEDF_INFO(&(base_qedf->dbg_ctx), QEDF_LOG_NPIV, "vn_port=%p.\n", vn_port); From patchwork Sat Oct 22 07:19: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: 7420 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1097637wrr; Sat, 22 Oct 2022 01:08:20 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6ADbHTM/xqUb573shoDtrfTUIiZXM/Kdv+urLIOqbDjy0z14vEhJdFbUKtj2gAVjAp29Sr X-Received: by 2002:a17:90b:4ac1:b0:20a:de32:3650 with SMTP id mh1-20020a17090b4ac100b0020ade323650mr61293710pjb.142.1666426100502; Sat, 22 Oct 2022 01:08:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666426100; cv=none; d=google.com; s=arc-20160816; b=w1/S2OjJoz5d62aGLo8hIoaYIuVEObIEN24j5dL8vhOnsZa6BvohjQ0O7vL+o7Fyap TvzwacAVupfDnOePg54FX2obrFpEAqmH1qPINczz+4HXOzKb8bwg4zg0yZR28Vo56r77 Ft6h4ziFHsZz/HN0ON90dvbhumQrsZ1rlUg1wOSayr54otCRvmtpvCT3emiZ0eISybDi 0l/dvu+i3LQZTVCybV38oxr8okquclwlld4NY4xffpdOYUFFvrNCbQ7vpYI41iVXKByF nY2LbCFD3+AgUeOUWvwrcc/HuU+D5Zsg8BnYya8QPc1YeA73bKxy5tat9PXb79GDSSIg YulQ== 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=VXhm7WL+3AoG+23+r9DZGW76eDPQv926olFbWZNqIV4=; b=FdCMXiEI0A6Cf8Uvv0ujarJbC2edRVoaQOW+vqNGPT+dCSSawV3A89WR9FKTv8H3Lx DRvC+wVcYj1xm/cHFfhaJ6RrM7iBbB4WArjZLVa8upUGkp/OzLqsExj4a2uJcoRboEwC +w3QLrvwArUp001hxsczf72VF99ht1/e39E4kA8wXHNHqD0Tn492J9IShjLE++6XFrJV RuusTTQrXmekCDmFcji0bzmu7QoL/z12w6V/jAREAaIvQ96CRn6CsXEXLDFIP24277d2 RvV5MeIeW2TANb6Zr8r2WHMN3UBtTPd9vwPWN+JPD3hxV+6VMbv7FPnBddGQVdecOVxJ XLZg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=CeobZHUJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 bk13-20020a056a02028d00b0045fff5bceaasi27585534pgb.587.2022.10.22.01.08.07; Sat, 22 Oct 2022 01:08: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=CeobZHUJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S232988AbiJVIHw (ORCPT + 99 others); Sat, 22 Oct 2022 04:07:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43830 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232781AbiJVIEL (ORCPT ); Sat, 22 Oct 2022 04:04: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 ADE592C1721; Sat, 22 Oct 2022 00:51: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 57647B82E00; Sat, 22 Oct 2022 07:39:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BE0A7C433D6; Sat, 22 Oct 2022 07:39:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424354; bh=lA0JoAyBfqKQ2fpj8FNAGAyuZ3ZEHwQ7RpJkvR7YOiM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CeobZHUJQUvU/B9F9PTDGzQc16ztUZkp4gPCy+KiQjVzRL8QWo0wG3uFNCpjwvh0E i0KgwY0J0bzCBY/El5OlKHR1dljr2m2y1l0w4fLrd8OnPom5GNmlZ6XzfoP+16vz4+ PlLJMY6Xy6CcU7StsHZh/wTV6yHk80/FylX46YA0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Heiko Stuebner , Quentin Schulz , Linus Walleij Subject: [PATCH 5.19 097/717] gpio: rockchip: request GPIO mux to pinctrl when setting direction Date: Sat, 22 Oct 2022 09:19:36 +0200 Message-Id: <20221022072432.541382124@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747374414480782716?= X-GMAIL-MSGID: =?utf-8?q?1747374414480782716?= From: Quentin Schulz commit 8ea8af6c8469156ac2042d83d73f6b74eb4b4b45 upstream. Before the split of gpio and pinctrl sections in their own driver, rockchip_set_mux was called in pinmux_ops.gpio_set_direction for configuring a pin in its GPIO function. This is essential for cases where pinctrl is "bypassed" by gpio consumers otherwise the GPIO function is not configured for the pin and it does not work. Such was the case for the sysfs/libgpiod userspace GPIO handling. Let's call pinctrl_gpio_direction_input/output when setting the direction of a GPIO so that the pinctrl core requests from the rockchip pinctrl driver to put the pin in its GPIO function. Fixes: 9ce9a02039de ("pinctrl/rockchip: drop the gpio related codes") Fixes: 936ee2675eee ("gpio/rockchip: add driver for rockchip gpio") Cc: stable@vger.kernel.org Reviewed-by: Heiko Stuebner Signed-off-by: Quentin Schulz Link: https://lore.kernel.org/r/20220930132033.4003377-3-foss+kernel@0leil.net Signed-off-by: Linus Walleij Signed-off-by: Greg Kroah-Hartman --- drivers/gpio/gpio-rockchip.c | 7 +++++++ 1 file changed, 7 insertions(+) --- a/drivers/gpio/gpio-rockchip.c +++ b/drivers/gpio/gpio-rockchip.c @@ -19,6 +19,7 @@ #include #include #include +#include #include #include @@ -155,6 +156,12 @@ static int rockchip_gpio_set_direction(s unsigned long flags; u32 data = input ? 0 : 1; + + if (input) + pinctrl_gpio_direction_input(bank->pin_base + offset); + else + pinctrl_gpio_direction_output(bank->pin_base + offset); + raw_spin_lock_irqsave(&bank->slock, flags); rockchip_gpio_writel_bit(bank, offset, data, bank->gpio_regs->port_ddr); raw_spin_unlock_irqrestore(&bank->slock, flags); From patchwork Sat Oct 22 07:19: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: 7239 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1090942wrr; Sat, 22 Oct 2022 00:49:04 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6YnNuTARfltN/oiEFSDJ6acWoY86Z6boItMkLPZXtWpAEYomIQg+SyuBJkYFT9AOjE0ef4 X-Received: by 2002:a17:90a:4588:b0:205:d605:8bcc with SMTP id v8-20020a17090a458800b00205d6058bccmr26924996pjg.205.1666424944219; Sat, 22 Oct 2022 00:49:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666424944; cv=none; d=google.com; s=arc-20160816; b=0endhiHMvoD1yxrnuiLzuMYDNDCDv1kP3yl3UFJPcVc32ap2uroh/sGJzrNH0qsbUU hZD+JDT8lmoV9KfhYAXz0D7J6NP48gSgKCOCu72c40PzeWSuDBKoamA2VlqkKw6lBOLt l0QutZ1wU++6xwRdpSe97lTRV43sMAcoNjibf/cGniT6JIzyNmZuMOMGkNCkPQuZj4O0 YykCiC6voIITR9kSwU83n54EG4pufP1ojzA6i8EL9H0d81VKLYKJZ6Qf4NDhr0STqL1T Dgz7cKIZ1I1PKkfx1twhl16kOsXUwZ9NOIhwBnOhgQiEkESZZpXo+xbiQAVcUavpK/V7 4XOg== 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=8h+KKfeYENO2/kWguJvSk42DXK3gyeApSnH0SCTLTCY=; b=NbDj0hGh5VVHiyu1Uv8YBfGdcADMDvoFAomA18q/IjdAETdRpLzNkJHbPk/WcGPDpo 8TJ3WfhnIaIZrzl6vyeV1Rt0SwtNcRnluhQUEe9pIKeM981Lhzk9Ga/ZS6jLdQEWB7Qo ZWz6KsVjxlmeLQZhZkqz3su5lWUj3kIiGTUIkO0dDlCuKWIY/+SIjJ40sSOi0LPkOodo icQQzMwGshAbd43WoDSwaM2063PD+IQLL1EAlK/p/IYSpQiHM7oMOezoAUzB4OVG7ljj S1yGvFp3Sb+o5nFQgS568osLpqioNzx6RCh9SETZWZMj7qR3fD5x3lnu3mUkaxzcBU0P 0y6w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Yxb3AyAC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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-20020a6306d7000000b00460dd0eed0csi29285469pgg.176.2022.10.22.00.48.51; Sat, 22 Oct 2022 00:49: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=Yxb3AyAC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231611AbiJVHsY (ORCPT + 99 others); Sat, 22 Oct 2022 03:48:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47412 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231564AbiJVHsC (ORCPT ); Sat, 22 Oct 2022 03:48:02 -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 CE63D474C5; Sat, 22 Oct 2022 00:44: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 E812860B28; Sat, 22 Oct 2022 07:39:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0741AC433C1; Sat, 22 Oct 2022 07:39:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424383; bh=2W+EnrEqw1ZdduKBQk6+8YZEHNmfS8U/NiyiLPhgklc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Yxb3AyAC1T+EzRM/Wm9+juEjfu6Ed+Z2dVaDOH2KplrmVz4XT3nsTVEhJ/Av6ny8c LzzcZkiMuVMKITsLQEGMOJ9/qXL/aMbY7Wi6OUjowKxnsclaIcEHa1Mu2CTdpkoTGn LJdsqC3I+1RaYaYR5VXWpAebTu42oqPCXXPACyrA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Heiko Stuebner , Quentin Schulz , Linus Walleij Subject: [PATCH 5.19 098/717] pinctrl: rockchip: add pinmux_ops.gpio_set_direction callback Date: Sat, 22 Oct 2022 09:19:37 +0200 Message-Id: <20221022072432.717806457@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747373202393386204?= X-GMAIL-MSGID: =?utf-8?q?1747373202393386204?= From: Quentin Schulz commit 4635c0e2a7f7f3568cbfccae70121f9835efa62c upstream. Before the split of gpio and pinctrl sections in their own driver, rockchip_set_mux was called in pinmux_ops.gpio_set_direction for configuring a pin in its GPIO function. This is essential for cases where pinctrl is "bypassed" by gpio consumers otherwise the GPIO function is not configured for the pin and it does not work. Such was the case for the sysfs/libgpiod userspace GPIO handling. Let's re-implement the pinmux_ops.gpio_set_direction callback so that the gpio subsystem can request from the pinctrl driver to put the pin in its GPIO function. Fixes: 9ce9a02039de ("pinctrl/rockchip: drop the gpio related codes") Cc: stable@vger.kernel.org Reviewed-by: Heiko Stuebner Signed-off-by: Quentin Schulz Link: https://lore.kernel.org/r/20220930132033.4003377-2-foss+kernel@0leil.net Signed-off-by: Linus Walleij Signed-off-by: Greg Kroah-Hartman --- drivers/pinctrl/pinctrl-rockchip.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) --- a/drivers/pinctrl/pinctrl-rockchip.c +++ b/drivers/pinctrl/pinctrl-rockchip.c @@ -2393,11 +2393,24 @@ static int rockchip_pmx_set(struct pinct return 0; } +static int rockchip_pmx_gpio_set_direction(struct pinctrl_dev *pctldev, + struct pinctrl_gpio_range *range, + unsigned offset, + bool input) +{ + struct rockchip_pinctrl *info = pinctrl_dev_get_drvdata(pctldev); + struct rockchip_pin_bank *bank; + + bank = pin_to_bank(info, offset); + return rockchip_set_mux(bank, offset - bank->pin_base, RK_FUNC_GPIO); +} + static const struct pinmux_ops rockchip_pmx_ops = { .get_functions_count = rockchip_pmx_get_funcs_count, .get_function_name = rockchip_pmx_get_func_name, .get_function_groups = rockchip_pmx_get_groups, .set_mux = rockchip_pmx_set, + .gpio_set_direction = rockchip_pmx_gpio_set_direction, }; /* From patchwork Sat Oct 22 07:19: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: 7305 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1093219wrr; Sat, 22 Oct 2022 00:56:29 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5tRTGle+01HmDQeTaYnkfEkrZ3JihzLy0lLqQzXG1rG/z+jSySZjnZ8yKLOiUda1/od/yY X-Received: by 2002:a05:6a00:1ace:b0:565:f52a:d998 with SMTP id f14-20020a056a001ace00b00565f52ad998mr23203434pfv.25.1666425388970; Sat, 22 Oct 2022 00:56:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666425388; cv=none; d=google.com; s=arc-20160816; b=HFEGiTeMbVCywOgv0np9iBPv2/jAAD8vSGZVDoa2kauj6C9YcxmCEl+YiZF+AymHTZ iI1lvHHhQ/xJBmd9KpGr/2CelC4nYVJNud7jiCiN84FDmKo5RinrFqAG1EssjjpoVMdL Fipn3MfI2i8hxerVVcIVmo3XHJT5altsu5Lv3C+33WglQGRC/R+/O8/b06y1ObtaXcS9 h+TprOdAYXv85tFOTAnoBtrL60gxhUTGbydlEtpV9egRVjVk1Q+RIoCc25Eaciag4AiK xQapHCA8RbZsa+w/dOysn70NlAYqWypQ8laIRkjADfkw3cyx+wc9XjkGnwwEmLJ/mvCn 8yzA== 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=PV4g9GkHPMStXQq4RaBQAvlc8UkY57kOOWttNC1fAgo=; b=Iz+Aav3JxKzOw/1KysJEyZG6FWOjZdfKSipw5zbDu0/eINConBubZC7+qgKlTkqcUa pm+tRDZxHeSzBhKbR3LEW7oN+BlgS1NfOiLmwxi7O9PxmijXG54a1zRs/pgvDNHPdL6t 9hkxvdJoQK7q9jAbZkyHdNyLCv7CHKH2Cr4J5ifIeFwvQ6gP8Q/tNA5fQf+I/uBrhpE7 ekqDx2UNGmMTq2YJXG4gir6cPan6sBg652prIHBRB6KfJUi0hVJW2wYm/4SHcKv6zEFV szO59DHlmxhow+RYH+q5OtzsOstyTiMKiHcx+Zqcr6wKB7+KDI9zw5cW1XN9oM7TRkGg QILg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=cRWEdXUs; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 h6-20020a17090aa88600b001fe30c193c1si8056668pjq.185.2022.10.22.00.56.15; Sat, 22 Oct 2022 00:56: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=cRWEdXUs; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S232198AbiJVHz7 (ORCPT + 99 others); Sat, 22 Oct 2022 03:55:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42300 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231760AbiJVHwi (ORCPT ); Sat, 22 Oct 2022 03:52:38 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CF0A12CA7C1; Sat, 22 Oct 2022 00:46: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 9F66F60B36; Sat, 22 Oct 2022 07:39:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A4BE4C433C1; Sat, 22 Oct 2022 07:39:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424397; bh=dGaokMN2ZM66MraQW54O4r/eFRtqHnwl58/YQQQdXYg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cRWEdXUs4zgUuA7Z36N8RF+DjrlYRgSZiP46g5AmS4Jun+SEUuN/HYQ36hRFi0/a3 sFhmlVV7gUQ03vV66sy62e/JTkuoOiLrDMljyq8tJi1H9L5SDQNC/Tfi1Dcv4Aatt+ owUHajaonDaEtKlDhVf1da4WDdH9ap9LaLL4J5d0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hyunwoo Kim , Helge Deller Subject: [PATCH 5.19 099/717] fbdev: smscufx: Fix use-after-free in ufx_ops_open() Date: Sat, 22 Oct 2022 09:19:38 +0200 Message-Id: <20221022072432.894878650@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747373668437386864?= X-GMAIL-MSGID: =?utf-8?q?1747373668437386864?= 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 @@ -137,6 +137,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) { @@ -1071,9 +1073,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++; @@ -1097,6 +1103,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; } @@ -1741,6 +1749,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"); @@ -1761,6 +1771,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 Sat Oct 22 07:19: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: 7244 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1091288wrr; Sat, 22 Oct 2022 00:50:06 -0700 (PDT) X-Google-Smtp-Source: AMsMyM51kDPhksKFp1Myz2nnwmTNy3UXpWxxp6rgfJ+pPiKK+eGK1oSp1fQYC4PzgsttDvUHIGG9 X-Received: by 2002:a17:903:120d:b0:179:d027:66f0 with SMTP id l13-20020a170903120d00b00179d02766f0mr23057087plh.61.1666425006019; Sat, 22 Oct 2022 00:50:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666425006; cv=none; d=google.com; s=arc-20160816; b=HYDgYFt97VQv7DDZILn6+JLn/e+2u3akPWvRACENeJjmndFGWHy0stTfOfJmxSwRN0 pvhN3lHinY9kD2EI/oouIieEMldndYhtrp2iwu5yGq/d0cB915Yoo731p1eR3dt366xQ X7QYOCLeqcmAHifJAzJsp9PGi+A4M3tjV4d7TehxU89TbyomxfZKgSm5DS+ap9Vp3ppM 5GqcA0k8As0Sm4sTeBSEEyEksyVVa96Z3fTvYPAWtk3Nyku02FwS3qt1hFvNMqVTV87X gRUzBc0Jpc26CDfOqJtSp3jC7ZiI465ff4JzTm+/ScLZRntb9XmbnvZvRwEZEazUyLQR Z9wQ== 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=j9mh0H5j2EdPkvUTccQrbrR3jhPTy5fCpQHren0feLQ=; b=INQTz1weMQX+SAnPsAoc98QosWs0kl/+p5m0hs9DwH671cTkavRzcjnP+LMXph+9od QVTAaKTrC4X8neo6DWHAwPgIc5o4tzRJ7k6ggA7AacgGSsCKmYK20naYW2cQcux8Ql0X hz0hhdJg9Fnb8GAOKJDSzL6mgY5htus4ifMqgt0B7/hM4Vr/w+y8eFlF/l5CZQSdOgW6 oJcUQR7A4PZi+DnHVzY1CaHMfote4c/IqceNIMMcHg+sb+XmWUnIuPoFigkrgZ5Qzlg5 VfUxOp2fzmaTtW4PPM9Apzv6rocIkcrulwh8iUADRNHY+M59vUXuXo1IGMWTxC+CF+BW 0R2A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=yLImz9eI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 f7-20020a056a0022c700b00537e88da121si29949291pfj.35.2022.10.22.00.49.53; Sat, 22 Oct 2022 00: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=yLImz9eI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231726AbiJVHtD (ORCPT + 99 others); Sat, 22 Oct 2022 03:49:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34306 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231553AbiJVHsM (ORCPT ); Sat, 22 Oct 2022 03:48: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 637378E71C; Sat, 22 Oct 2022 00:45: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 4B6BA60B43; Sat, 22 Oct 2022 07:40:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5EBB0C433D6; Sat, 22 Oct 2022 07:39:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424399; bh=sumF9jSIAwLWOBXw3XHL70zVFByn7CzTizXm4g1/AXw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=yLImz9eIL4vjcp1amR8CpBejOYFJf3fNCZVtHGgNJgWRrIDr5/+s6X3G/6GhZX8/D zP8jMXBAX7+C0CHVMDGz21Jw9YEmfsYeKSamZ5QXe1K7cH8VMFyD4A/ZffYUZw9ZNZ Nzetz9ebajvECMtGKntFCQng7o3txc05M1HaTlAQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Gregory Erwin , "Jason A. Donenfeld" , Herbert Xu , =?utf-8?q?Toke_H=C3=B8iland-J?= =?utf-8?q?=C3=B8rgensen?= , Kalle Valo Subject: [PATCH 5.19 100/717] hwrng: core - let sleep be interrupted when unregistering hwrng Date: Sat, 22 Oct 2022 09:19:39 +0200 Message-Id: <20221022072433.091400265@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747373266673765774?= X-GMAIL-MSGID: =?utf-8?q?1747373266673765774?= From: Jason A. Donenfeld commit 36cb6494429bd64b27b7ff8b4af56f8e526da2b4 upstream. There are two deadlock scenarios that need addressing, which cause problems when the computer goes to sleep, the interface is set down, and hwrng_unregister() is called. When the deadlock is hit, sleep is delayed for tens of seconds, causing it to fail. These scenarios are: 1) The hwrng kthread can't be stopped while it's sleeping, because it uses msleep_interruptible() which does not react to kthread_stop. 2) A normal user thread can't be interrupted by hwrng_unregister() while it's sleeping, because hwrng_unregister() is called from elsewhere. We solve both issues by add a completion object called dying that fulfils waiters once we have started the process in hwrng_unregister. At the same time, we should cleanup a common and useless dmesg splat in the same area. Cc: Reported-by: Gregory Erwin Fixes: fcd09c90c3c5 ("ath9k: use hw_random API instead of directly dumping into random.c") Link: https://lore.kernel.org/all/CAO+Okf6ZJC5-nTE_EJUGQtd8JiCkiEHytGgDsFGTEjs0c00giw@mail.gmail.com/ Link: https://lore.kernel.org/lkml/CAO+Okf5k+C+SE6pMVfPf-d8MfVPVq4PO7EY8Hys_DVXtent3HA@mail.gmail.com/ Link: https://bugs.archlinux.org/task/75138 Signed-off-by: Jason A. Donenfeld Signed-off-by: Herbert Xu Acked-by: Toke Høiland-Jørgensen Acked-by: Kalle Valo Signed-off-by: Herbert Xu Signed-off-by: Greg Kroah-Hartman --- drivers/char/hw_random/core.c | 19 +++++++++++++++---- drivers/net/wireless/ath/ath9k/rng.c | 3 ++- include/linux/hw_random.h | 3 +++ 3 files changed, 20 insertions(+), 5 deletions(-) diff --git a/drivers/char/hw_random/core.c b/drivers/char/hw_random/core.c index 16f227b995e8..d7045dfaf16c 100644 --- a/drivers/char/hw_random/core.c +++ b/drivers/char/hw_random/core.c @@ -507,16 +507,17 @@ static int hwrng_fillfn(void *unused) rng->quality = current_quality; /* obsolete */ quality = rng->quality; mutex_unlock(&reading_mutex); + + if (rc <= 0) + hwrng_msleep(rng, 10000); + put_rng(rng); if (!quality) break; - if (rc <= 0) { - pr_warn("hwrng: no data available\n"); - msleep_interruptible(10000); + if (rc <= 0) continue; - } /* If we cannot credit at least one bit of entropy, * keep track of the remainder for the next iteration @@ -570,6 +571,7 @@ int hwrng_register(struct hwrng *rng) init_completion(&rng->cleanup_done); complete(&rng->cleanup_done); + init_completion(&rng->dying); if (!current_rng || (!cur_rng_set_by_user && rng->quality > current_rng->quality)) { @@ -617,6 +619,7 @@ void hwrng_unregister(struct hwrng *rng) old_rng = current_rng; list_del(&rng->list); + complete_all(&rng->dying); if (current_rng == rng) { err = enable_best_rng(); if (err) { @@ -685,6 +688,14 @@ void devm_hwrng_unregister(struct device *dev, struct hwrng *rng) } EXPORT_SYMBOL_GPL(devm_hwrng_unregister); +long hwrng_msleep(struct hwrng *rng, unsigned int msecs) +{ + unsigned long timeout = msecs_to_jiffies(msecs) + 1; + + return wait_for_completion_interruptible_timeout(&rng->dying, timeout); +} +EXPORT_SYMBOL_GPL(hwrng_msleep); + static int __init hwrng_modinit(void) { int ret; diff --git a/drivers/net/wireless/ath/ath9k/rng.c b/drivers/net/wireless/ath/ath9k/rng.c index cb5414265a9b..58c0ab01771b 100644 --- a/drivers/net/wireless/ath/ath9k/rng.c +++ b/drivers/net/wireless/ath/ath9k/rng.c @@ -83,7 +83,8 @@ static int ath9k_rng_read(struct hwrng *rng, void *buf, size_t max, bool wait) if (!wait || !max || likely(bytes_read) || fail_stats > 110) break; - msleep_interruptible(ath9k_rng_delay_get(++fail_stats)); + if (hwrng_msleep(rng, ath9k_rng_delay_get(++fail_stats))) + break; } if (wait && !bytes_read && max) diff --git a/include/linux/hw_random.h b/include/linux/hw_random.h index aa1d4da03538..77c2885c4c13 100644 --- a/include/linux/hw_random.h +++ b/include/linux/hw_random.h @@ -50,6 +50,7 @@ struct hwrng { struct list_head list; struct kref ref; struct completion cleanup_done; + struct completion dying; }; struct device; @@ -61,4 +62,6 @@ extern int devm_hwrng_register(struct device *dev, struct hwrng *rng); extern void hwrng_unregister(struct hwrng *rng); extern void devm_hwrng_unregister(struct device *dve, struct hwrng *rng); +extern long hwrng_msleep(struct hwrng *rng, unsigned int msecs); + #endif /* LINUX_HWRANDOM_H_ */ From patchwork Sat Oct 22 07:19: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: 7352 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1095399wrr; Sat, 22 Oct 2022 01:02:36 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5EmuJ/oMsGknAGXBbUuNQjqMHbhpja9HzqW4F41fzoAc+Mk72H1N2+7z3JRxpvFh6tUuiE X-Received: by 2002:a17:902:f552:b0:17f:92d7:98f5 with SMTP id h18-20020a170902f55200b0017f92d798f5mr22502941plf.143.1666425756198; Sat, 22 Oct 2022 01:02:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666425756; cv=none; d=google.com; s=arc-20160816; b=n/U208tYItK5/9Bnov8r77TJDJYhb+R/RlhPwKPSljEeM7W/H/Htx4GdIvbw0OR30b Clqdh3+ObH4nP63XpggP2/v+9vQBbVX5AZQtCqUZ52Gb2CxbG7tdC4w3ZaRUpjQGZsET gtupzcKKg5karx9nN/UAYWj9HDAnd2i7j95AlJFA83IC/5aPV4tRD/ycZel6jmaEnHot jPPDqr6DKHKije10woog4CQ2tsZDBEcuz6C/A7qlzEV4JPg7upVqCp4d3k1TD+kdiWbM WuHL6tOvlCsJEZPZvpJkgQiZ2xEAmGAlYq15B4AVgmpIF2u2rzLmzZhZe1nU6xG6Vvdv R5Tg== 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=NZE3t0lv0c8apM3E3tIiBsi/ch0S8D0XvC6yZyXaCTM=; b=b8CzewFfV3Sj7AY3+6S4Ab45tpd4SoWsT1KJOvyDOoNHRlEKGN7lK32YJZDRfkKiym uRA74PFTrIUkm4NIoTp79Rg9qGIu+AJMRJZdelOtDPv8WEeqAjc6kHj/+HdJ6E4euS3X 1w95oBR/TrUbyEMRDPLT+C58G0cGPiippIB4wFwBa1Fz2Arn8JeuIc58ckkXZwnfdxj6 gC7DYe28WVKBB34BjAcfBz3sEc1O3IFK9VH9KJB5C8KBQfk3lQBYD2s0eTb7FbR7HvhK QJPsM09LzhndtdQaJQX5+pSy6ngOZrazlWBLBG4muQRacgCKinzCLHA846PVnFKyv4x1 1/4Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ltPkDYxy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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-20020a17090302c900b0017f5ea214a8si27819107plk.462.2022.10.22.01.02.02; Sat, 22 Oct 2022 01:02: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=ltPkDYxy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S232426AbiJVIBg (ORCPT + 99 others); Sat, 22 Oct 2022 04:01:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42706 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232209AbiJVHyY (ORCPT ); Sat, 22 Oct 2022 03:54:24 -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 13FAC66F33; Sat, 22 Oct 2022 00:47: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 EACE460B45; Sat, 22 Oct 2022 07:40:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0531EC433B5; Sat, 22 Oct 2022 07:40:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424402; bh=6eiZPDlPDFL9lPpruiqEd6DS7gA4Z9UNc9hLlk9WAvg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ltPkDYxy8d00zeFpLfTolBhw0JMDIGxsrVY8bvdV69fBCPVmimLZLvQHnPm7HdKI8 A3Xc4sNKTuEHJPjpdzsCbrs6rQl+tpCy5xB9CbhWf6l6sNr5d2cFtK+GzfBnN3LwYj fLxKa55HER9GpkZ0rb/1JN/fHgQFFKE/7ZOnfSL8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Paulo Alcantara (SUSE)" , Steve French Subject: [PATCH 5.19 101/717] smb3: do not log confusing message when server returns no network interfaces Date: Sat, 22 Oct 2022 09:19:40 +0200 Message-Id: <20221022072433.276045308@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747374053978133101?= X-GMAIL-MSGID: =?utf-8?q?1747374053978133101?= From: Steve French commit 4659f01e3cd94f64d9bd06764ace2ef8fe1b6227 upstream. Some servers can return an empty network interface list so, unless multichannel is requested, no need to log an error for this, and when multichannel is requested on mount but no interfaces, log something less confusing. For this case change parse_server_interfaces: malformed interface info to empty network interface list returned by server localhost Also do not relog this error every ten minutes (only log on mount, once) Cc: Reviewed-by: Paulo Alcantara (SUSE) Signed-off-by: Steve French Signed-off-by: Greg Kroah-Hartman --- fs/cifs/cifsproto.h | 2 +- fs/cifs/connect.c | 2 +- fs/cifs/smb2ops.c | 23 ++++++++++++++++++----- 3 files changed, 20 insertions(+), 7 deletions(-) --- a/fs/cifs/cifsproto.h +++ b/fs/cifs/cifsproto.h @@ -642,7 +642,7 @@ cifs_chan_is_iface_active(struct cifs_se int cifs_chan_update_iface(struct cifs_ses *ses, struct TCP_Server_Info *server); int -SMB3_request_interfaces(const unsigned int xid, struct cifs_tcon *tcon); +SMB3_request_interfaces(const unsigned int xid, struct cifs_tcon *tcon, bool in_mount); void extract_unc_hostname(const char *unc, const char **h, size_t *len); int copy_path_name(char *dst, const char *src); --- a/fs/cifs/connect.c +++ b/fs/cifs/connect.c @@ -155,7 +155,7 @@ static void smb2_query_server_interfaces /* * query server network interfaces, in case they change */ - rc = SMB3_request_interfaces(0, tcon); + rc = SMB3_request_interfaces(0, tcon, false); if (rc) { cifs_dbg(FYI, "%s: failed to query server interfaces: %d\n", __func__, rc); --- a/fs/cifs/smb2ops.c +++ b/fs/cifs/smb2ops.c @@ -511,8 +511,7 @@ smb3_negotiate_rsize(struct cifs_tcon *t static int parse_server_interfaces(struct network_interface_info_ioctl_rsp *buf, - size_t buf_len, - struct cifs_ses *ses) + size_t buf_len, struct cifs_ses *ses, bool in_mount) { struct network_interface_info_ioctl_rsp *p; struct sockaddr_in *addr4; @@ -542,6 +541,20 @@ parse_server_interfaces(struct network_i } spin_unlock(&ses->iface_lock); + /* + * Samba server e.g. can return an empty interface list in some cases, + * which would only be a problem if we were requesting multichannel + */ + if (bytes_left == 0) { + /* avoid spamming logs every 10 minutes, so log only in mount */ + if ((ses->chan_max > 1) && in_mount) + cifs_dbg(VFS, + "empty network interface list returned by server %s\n", + ses->server->hostname); + rc = -EINVAL; + goto out; + } + while (bytes_left >= sizeof(*p)) { memset(&tmp_iface, 0, sizeof(tmp_iface)); tmp_iface.speed = le64_to_cpu(p->LinkSpeed); @@ -672,7 +685,7 @@ out: } int -SMB3_request_interfaces(const unsigned int xid, struct cifs_tcon *tcon) +SMB3_request_interfaces(const unsigned int xid, struct cifs_tcon *tcon, bool in_mount) { int rc; unsigned int ret_data_len = 0; @@ -692,7 +705,7 @@ SMB3_request_interfaces(const unsigned i goto out; } - rc = parse_server_interfaces(out_buf, ret_data_len, ses); + rc = parse_server_interfaces(out_buf, ret_data_len, ses, in_mount); if (rc) goto out; @@ -1022,7 +1035,7 @@ smb3_qfs_tcon(const unsigned int xid, st if (rc) return; - SMB3_request_interfaces(xid, tcon); + SMB3_request_interfaces(xid, tcon, true /* called during mount */); SMB2_QFS_attr(xid, tcon, fid.persistent_fid, fid.volatile_fid, FS_ATTRIBUTE_INFORMATION); From patchwork Sat Oct 22 07:19: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: 7245 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1091326wrr; Sat, 22 Oct 2022 00:50:13 -0700 (PDT) X-Google-Smtp-Source: AMsMyM49dil5wvZJpiNE4ug6RRbCgG9PVye/CmuhF0kwcFfXQDJ7NjQ4UYiGLZDenAYa6X4kLLag X-Received: by 2002:a05:6a00:124a:b0:563:55ba:a6f8 with SMTP id u10-20020a056a00124a00b0056355baa6f8mr23560551pfi.2.1666425013428; Sat, 22 Oct 2022 00:50:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666425013; cv=none; d=google.com; s=arc-20160816; b=yIIRbV+hV2Fl2bUr6hIhn0T5RR/nQ18DCUBJJy+q4qKPr1h3P8exHSERFSbcApWoyq Jnnq45CO+8N0NIAGm16fQXwhwikMuUEw9AW8ddoeq637iDOEhFA5ZlEYX5umjO4s1ISo BSxAF1n4MF9QCg7gp3lOvR3xmrlTAEaxAJBsyXnfPwJIIxXunjaTVi2/AlYfamc7lYBY PJ2KtZtPacR77xk5qvnPRNcgOwAYn5NtCvzM7nDVOqew8i2pFJKfGgY8/IFTA1bJUbvg ka7qf1oDq3b+vWJqODoHJaDst3uHCeojy7jcYSeGPn4hreKnUYi4c/8bk3RJkkuZjV24 MwRA== 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=5qxlKD239SAObHbe+oQ5t/YT3p6LsO/5eHwdsOHzIqg=; b=rfpqAWsqCSh39xgFfmh0aR9M5KNzUJWBXIEA1vyfcA0eahzCDce/VzUcNt5sTAWrto 2CKTHtZz1SJT6gyJx2HRhcOIcJKK7QGMngZEgo00wpAFZ3LxT3V+NNZSAl/lnmfuSmg+ USU6z17sCZVZo+fFqAEu2m/OVpp3SdKOlu71SekYC8jOWXg/IicgH42C9JIOC/8mo4pc Hg743Toayd5QEGCtCSvYfyLAga7bgvwH/qKJpXa5fK206oqYpPHxQMM0RIbdYY8/awQr XCyAyIHk/XcEdWVR4S2PPaultGp8ZrdZwyXbywtlOSQAjnz66riUO4TcfV2/099c9r8e 10+A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=B3upmPbI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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-20020a056a000a8600b005637366edb8si30833342pfl.9.2022.10.22.00.49.59; Sat, 22 Oct 2022 00:50: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=B3upmPbI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231154AbiJVHtp (ORCPT + 99 others); Sat, 22 Oct 2022 03:49:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47176 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231464AbiJVHsW (ORCPT ); Sat, 22 Oct 2022 03:48: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 6DA091162E8; Sat, 22 Oct 2022 00:45: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 9301160B7B; Sat, 22 Oct 2022 07:40:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A8D8BC433D6; Sat, 22 Oct 2022 07:40:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424405; bh=YM3SqOcd6qfQDxgru8hP2ZRk2JPDBV2YiiP87EKq/UA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=B3upmPbIg6/CZ+wrdDvUJbUoJpKkP6xT87KsRbR5cBpwZ5dNhfASOP9io5QBL6T1k h7T9cwVJTlpoTq6yHlmhdydZk3un+YWSZ45oXTELYKEvsWvZdQ5r/vy2KzpSaa+HgX oW/Sc9p4yAFPu4s8ZvSPuprKnNT10oD0a4af2l9w= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hyunchul Lee , Namjae Jeon , Steve French Subject: [PATCH 5.19 102/717] ksmbd: fix incorrect handling of iterate_dir Date: Sat, 22 Oct 2022 09:19:41 +0200 Message-Id: <20221022072433.424389283@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747373274876650810?= X-GMAIL-MSGID: =?utf-8?q?1747373274876650810?= From: Namjae Jeon commit 88541cb414b7a2450c45fc9c131b37b5753b7679 upstream. if iterate_dir() returns non-negative value, caller has to treat it as normal and check there is any error while populating dentry information. ksmbd doesn't have to do anything because ksmbd already checks too small OutputBufferLength to store one file information. And because ctx->pos is set to file->f_pos when iterative_dir is called, remove restart_ctx(). And if iterate_dir() return -EIO, which mean directory entry is corrupted, return STATUS_FILE_CORRUPT_ERROR error response. This patch fixes some failure of SMB2_QUERY_DIRECTORY, which happens when ntfs3 is local filesystem. Fixes: e2f34481b24d ("cifsd: add server-side procedures for SMB3") Cc: stable@vger.kernel.org Signed-off-by: Hyunchul Lee Signed-off-by: Namjae Jeon Signed-off-by: Steve French Signed-off-by: Greg Kroah-Hartman --- fs/ksmbd/smb2pdu.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) --- a/fs/ksmbd/smb2pdu.c +++ b/fs/ksmbd/smb2pdu.c @@ -3798,11 +3798,6 @@ static int __query_dir(struct dir_contex return 0; } -static void restart_ctx(struct dir_context *ctx) -{ - ctx->pos = 0; -} - static int verify_info_level(int info_level) { switch (info_level) { @@ -3911,7 +3906,6 @@ int smb2_query_dir(struct ksmbd_work *wo if (srch_flag & SMB2_REOPEN || srch_flag & SMB2_RESTART_SCANS) { ksmbd_debug(SMB, "Restart directory scan\n"); generic_file_llseek(dir_fp->filp, 0, SEEK_SET); - restart_ctx(&dir_fp->readdir_data.ctx); } memset(&d_info, 0, sizeof(struct ksmbd_dir_info)); @@ -3958,11 +3952,9 @@ int smb2_query_dir(struct ksmbd_work *wo */ if (!d_info.out_buf_len && !d_info.num_entry) goto no_buf_len; - if (rc == 0) - restart_ctx(&dir_fp->readdir_data.ctx); - if (rc == -ENOSPC) + if (rc > 0 || rc == -ENOSPC) rc = 0; - if (rc) + else if (rc) goto err_out; d_info.wptr = d_info.rptr; @@ -4019,6 +4011,8 @@ err_out2: rsp->hdr.Status = STATUS_NO_MEMORY; else if (rc == -EFAULT) rsp->hdr.Status = STATUS_INVALID_INFO_CLASS; + else if (rc == -EIO) + rsp->hdr.Status = STATUS_FILE_CORRUPT_ERROR; if (!rsp->hdr.Status) rsp->hdr.Status = STATUS_UNEXPECTED_IO_ERROR; From patchwork Sat Oct 22 07:19: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: 7194 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1089514wrr; Sat, 22 Oct 2022 00:43:33 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4Kdz19s+7WywIfaUPLf3F+gTT3UBGCSYyN67YRotWOpz8gBXur+SLBljIsxhRr4A3sejvA X-Received: by 2002:a05:6a00:10c8:b0:563:1bd1:2ce4 with SMTP id d8-20020a056a0010c800b005631bd12ce4mr23205768pfu.6.1666424613327; Sat, 22 Oct 2022 00:43:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666424613; cv=none; d=google.com; s=arc-20160816; b=xOhXIXksgWh/ehHO86DvYvJQmHTuHZO/kTWzeRmSLoYRxYQEDSd68Vkvt1ZkgPgCY/ j3J+45q93Ld4RMXVK0CsA2DYd3dy/C8X7vAJk9kVpJjApN8kfDpYmvzGU11MVXAFyRFb OOcQ1csvUE/s40ZEfOKK9ZgwSjbYkKj24OW1OFfmvcF1OLvj4lLtnN+473de/+jho11W P4QpHnedT2tI0S6aO5kiWU2DjwyVLd32v6dn9a0KtEsS+YDm89bQmiq40BiLqnpewWHz Nl8aFYKo8LDuVKk34/GxzW8P/bSB3yT3ob3qSY2dm7U0cmooFiq8Gz+qhU0wHaxFeJxh SrAQ== 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=iJS7MwxQ9hIcrf6M5uMCoLuKq8Zs+DwMksVPZEeRhzQ=; b=I8psp80/IQurd0AzoOr0+WE6Nkmrb8cBcjtVO+6hw5l2V5Lg/Nz/FMN8H74NbRiVIj +SHafg9OLkcdXyP2ZQzKEBLdFFHOHrQ5JYGQWSkAZhDERKr2pwXm2JLBd/jCcj/5DExS OO0F8oTUsJSLEx6Wcmij4pQ1ZkkI/LR++qp3kYGr+KxXhyELZsdtwvWJMtFLUuFrBqut 6tF150vHrEdmOHtL0v8Ha71hYWgjj32+elRrobty7V1ey4gYxQNGJ6s9yNeL6+eqxk1w dtFs37K/m4rsNJtrzZTwwIzuT+RBcCkyWc4cXVJ62YeTWCxL3kMIo+BdNx+MFm18FKJ3 VCfw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=FLNN7coL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 y24-20020a17090a8b1800b002031441a918si1854276pjn.175.2022.10.22.00.43.21; Sat, 22 Oct 2022 00: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=FLNN7coL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231284AbiJVHm7 (ORCPT + 99 others); Sat, 22 Oct 2022 03:42:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47796 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231215AbiJVHmg (ORCPT ); Sat, 22 Oct 2022 03:42:36 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0F1F9B49; Sat, 22 Oct 2022 00:41: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 001AAB82DFB; Sat, 22 Oct 2022 07:40:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 58542C433C1; Sat, 22 Oct 2022 07:40:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424407; bh=wQtvt0pQYSjjl8y2IQ9Sln7QvAgF+4ZI5oQv0B0dNBc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FLNN7coLmCdU9TLkHohiDCahQFKlLFrHpA1SCp22u/OFgCAJUSKSSzh6/SZGrZYV+ EePWI4423Os9u6dakrUsVAEXIRaMoKczedtHSLA053GcYEfixFrPm0Cw2nuD5QMiRU 54gqHR5HB95Jr0/EB8bHyhrQCNvWaotoP+L5N96I= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Namjae Jeon , Steve French Subject: [PATCH 5.19 103/717] ksmbd: fix endless loop when encryption for response fails Date: Sat, 22 Oct 2022 09:19:42 +0200 Message-Id: <20221022072433.621452811@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747372855359714531?= X-GMAIL-MSGID: =?utf-8?q?1747372855359714531?= From: Namjae Jeon commit 360c8ee6fefdb496fffd2c18bb9a96a376a1a804 upstream. If ->encrypt_resp return error, goto statement cause endless loop. It send an error response immediately after removing it. Fixes: 0626e6641f6b ("cifsd: add server handler for central processing and tranport layers") Cc: stable@vger.kernel.org Signed-off-by: Namjae Jeon Signed-off-by: Steve French Signed-off-by: Greg Kroah-Hartman --- fs/ksmbd/server.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) --- a/fs/ksmbd/server.c +++ b/fs/ksmbd/server.c @@ -235,10 +235,8 @@ send: if (work->sess && work->sess->enc && work->encrypted && conn->ops->encrypt_resp) { rc = conn->ops->encrypt_resp(work); - if (rc < 0) { + if (rc < 0) conn->ops->set_rsp_status(work, STATUS_DATA_ERROR); - goto send; - } } ksmbd_conn_write(work); From patchwork Sat Oct 22 07:19: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: 7361 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1095664wrr; Sat, 22 Oct 2022 01:03:15 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6tCLQcdh/ELC9Fk87gdyl9Aevk8at36ioelUWMVqwGx0OKrVFS/6mIsBvR9Vo7RTJH5LSG X-Received: by 2002:a17:903:228a:b0:186:7383:dd5d with SMTP id b10-20020a170903228a00b001867383dd5dmr9426548plh.121.1666425795342; Sat, 22 Oct 2022 01:03:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666425795; cv=none; d=google.com; s=arc-20160816; b=Vhi6mJsTiJTIuRaIcCovbg9AK+oO7ygGbOsuf3tfHHIwIkRu+7GaxCg/k9ljcE2K/6 Q9CeUSAd41jkPEBkmhWxawnFaGRiPOLIzw1xWyn7BYMNZmbPFfxqEFCjTjD35XdkTHZI dWgwLVUWThY2aG2squAgBqY18Ju2jrvm4J011Xr9p1VJuDsCnYcS7luZidYrQmJGHbNj xUcsgrlCNKqpbdOkeuaFp7YcQOz3qliBIhFBYJYLKSoYiDKNkpaCdqnQbKQPnsHcElU6 Ue+oVuPTomFYZQTj1ObsELeRG+Op3Ka63u8YP8fVz5fTDTIj256NJxLh4Gxg5zY9hATS 2DRw== 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=EtTHJ5O7C4RilcIIpLBhWdMIrp1ESfuEeqEYD72H94s=; b=sLV3YXW8nSv7EgQRQTExigwaOqdTSHb+0zxj9GfqG+4y9QpZGW26QOMJCHBa/wBHJs o0dXTYtHeUBh4oXnHBfjnP8Gxin+5uQL2s47KROEJ2aj3kud+47m49HDEgSvuHXTsVVA uRCWYDu0tRnhR3SnIgaNrQPwoKjbC2ch7gpBYNq0WdomQBGR0suKh0uDFsJpt7jlEP4E gzglJwUVSggw/6UfFiApgJ/xcs/rRMIuM66hZzysdWt5jiD2y3om8azaS/Ia7TflzWOk dr7gyvHqcN4Pe+ic2JZjU2ckK1N8bxC1h1g0VFusS3DmOUar5M2zhnEDZ2L1U5sZeWd8 1n7Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Fy9x5EOE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 m4-20020a170902db0400b0017a0fe2e1fdsi33997032plx.450.2022.10.22.01.03.01; Sat, 22 Oct 2022 01:03: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=Fy9x5EOE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S232300AbiJVICo (ORCPT + 99 others); Sat, 22 Oct 2022 04:02:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42478 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232290AbiJVHyj (ORCPT ); Sat, 22 Oct 2022 03:54:39 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A947C951ED; Sat, 22 Oct 2022 00:47: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 E541A60B79; Sat, 22 Oct 2022 07:40:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 051C0C4314B; Sat, 22 Oct 2022 07:40:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424410; bh=dnR68S+GglvsGCWDNsJlZ6XYUD/v8mulvUWGGeDe8KI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Fy9x5EOENK3T34j5pt0Gkp78wcu79rxwyt/aAcoWbP/dxQdK5J/DxYJmg2fOiDgoz EAvZTN+WaGBJeA9t2YQN49HcMX4wbzzrIpN3El6ZOK8E1aHqkQo/zEbUyTrtWXoENx vKrYp6goZ2kqF+xwNg7sRE7fCyd8L/eMCd47KUOQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zhang Xiaoxu , Namjae Jeon , Steve French Subject: [PATCH 5.19 104/717] ksmbd: Fix wrong return value and message length check in smb2_ioctl() Date: Sat, 22 Oct 2022 09:19:43 +0200 Message-Id: <20221022072433.802029429@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747374094820516752?= X-GMAIL-MSGID: =?utf-8?q?1747374094820516752?= From: Zhang Xiaoxu commit b1763d265af62800ec96eeb79803c4c537dcef3a upstream. Commit c7803b05f74b ("smb3: fix ksmbd bigendian bug in oplock break, and move its struct to smbfs_common") use the defination of 'struct validate_negotiate_info_req' in smbfs_common, the array length of 'Dialects' changed from 1 to 4, but the protocol does not require the client to send all 4. This lead the request which satisfied with protocol and server to fail. So just ensure the request payload has the 'DialectCount' in smb2_ioctl(), then fsctl_validate_negotiate_info() will use it to validate the payload length and each dialect. Also when the {in, out}_buf_len is less than the required, should goto out to initialize the status in the response header. Fixes: f7db8fd03a4b ("ksmbd: add validation in smb2_ioctl") Cc: stable@vger.kernel.org Signed-off-by: Zhang Xiaoxu Acked-by: Namjae Jeon Signed-off-by: Steve French Signed-off-by: Greg Kroah-Hartman --- fs/ksmbd/smb2pdu.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) --- a/fs/ksmbd/smb2pdu.c +++ b/fs/ksmbd/smb2pdu.c @@ -7627,11 +7627,16 @@ int smb2_ioctl(struct ksmbd_work *work) goto out; } - if (in_buf_len < sizeof(struct validate_negotiate_info_req)) - return -EINVAL; + if (in_buf_len < offsetof(struct validate_negotiate_info_req, + Dialects)) { + ret = -EINVAL; + goto out; + } - if (out_buf_len < sizeof(struct validate_negotiate_info_rsp)) - return -EINVAL; + if (out_buf_len < sizeof(struct validate_negotiate_info_rsp)) { + ret = -EINVAL; + goto out; + } ret = fsctl_validate_negotiate_info(conn, (struct validate_negotiate_info_req *)&req->Buffer[0], From patchwork Sat Oct 22 07:19:44 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 7223 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1090453wrr; Sat, 22 Oct 2022 00:47:10 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5ST9VQoujwWUU0Hy7QfXYIomq9w919hIEutMKp0VyAI/Kq6PPcSHPpnLVyfdUs6tqHBlhZ X-Received: by 2002:a17:903:2307:b0:181:e618:b4c5 with SMTP id d7-20020a170903230700b00181e618b4c5mr22291641plh.172.1666424830434; Sat, 22 Oct 2022 00:47:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666424830; cv=none; d=google.com; s=arc-20160816; b=0x4nyc5cRik0W5i4ctemlrYZTyWNZeanL2aORwWspRcnNwO6+3M9A2GEU+gSj8R3K1 PJmhuHBqmmCqmVIQXrGtNUlKyLijHZhdw7ux4FES3ILykbZhBrlX2QLiqowWFiaEnH3V 4NnnbqqGExIldBcvgnfXkfg1DKigzXPkfpPiVeKtXVFNkLsA6MqlSff6oxF920NrYyUX p48aGTZn7T9TiPaig4U7TpwAjRSktkFOvoFmkKAwDenuIvt4xupliOF0GesbdKP1XUiq XYmb73GxbEql6w6XHDaGvSdpu92lMQGsfjotAvctjY/CJqoPmLoe6Vl8GcS0Oz/q7xQS DCrQ== 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=YQY9nhnTBw4kViPNm7NRI6QgE4+DWnEhqy0h21WYqik=; b=HFDp5Ud5RRipgtoyeDMZTy4aIoUA2TcfMKRf4AUQ0LrBFRSBpkVHB0Zj4EPlEFjx14 hGXDjvmLEU91hyv4Zr9bhZgG9BTr0w1a6cui08432M2NohOUlOlE3h967bsaigTQA48a OOwGwvhDXLuJMK9ASmT1c8P6kgp9aPMBrg/KQvpyxQgWy6jiaRSABs9MShzxg+g0/vNP Mn5ruHwBssjLVAVKG3WEA6DDemYRnpI3uhNguIl8psz8CxrGQ90n85c/JlgZCGvm4jGi F0KfQE3JoLFpRIzTX+dTm93YZIh2dj8C/sZTlk4LUIXTEw8uCMZHlWZzZ7oN0zjsENZ9 /nyA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ii4l+zDW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 b1-20020a170902b60100b0017ebdf9ca1bsi24795715pls.464.2022.10.22.00.46.57; Sat, 22 Oct 2022 00:47: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=ii4l+zDW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231496AbiJVHqi (ORCPT + 99 others); Sat, 22 Oct 2022 03:46:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45480 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231583AbiJVHoc (ORCPT ); Sat, 22 Oct 2022 03:44:32 -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 A414924A545; Sat, 22 Oct 2022 00:43: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 44E3860B0A; Sat, 22 Oct 2022 07:38:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5B2BAC433C1; Sat, 22 Oct 2022 07:38:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424326; bh=zRbI9r4T8ATwG60e0stmIJjCAwfIsLK3ZdgJqhNquO4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ii4l+zDWMPIpPYV7+e0fNwt7RNV/69ajgBee83m7BMbuPScZOK8qIyya/BQ/1amMK cSOsD63Cqpoz1RhhTcSkIn8A8ghTogioiyKph8qMgnwxjFAVC0rMGcCkcbkXP/FQWj BrW3pc1sEPfkSqW+/+4mSjDJWUymL6s69mVUQkmI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hyunchul Lee , Steve French , =?utf-8?q?Micka=C3=ABl_Sala=C3=BCn?= , "Christian Brauner (Microsoft)" , Namjae Jeon , Steve French Subject: [PATCH 5.19 105/717] ksmbd: Fix user namespace mapping Date: Sat, 22 Oct 2022 09:19:44 +0200 Message-Id: <20221022072433.991111363@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747373082955453947?= X-GMAIL-MSGID: =?utf-8?q?1747373082955453947?= From: Mickaël Salaün commit 7c88c1e0ab1704bacb751341ee6431c3be34b834 upstream. A kernel daemon should not rely on the current thread, which is unknown and might be malicious. Before this security fix, ksmbd_override_fsids() didn't correctly override FS UID/GID which means that arbitrary user space threads could trick the kernel to impersonate arbitrary users or groups for file system access checks, leading to file system access bypass. This was found while investigating truncate support for Landlock: https://lore.kernel.org/r/CAKYAXd8fpMJ7guizOjHgxEyyjoUwPsx3jLOPZP=wPYcbhkVXqA@mail.gmail.com Fixes: e2f34481b24d ("cifsd: add server-side procedures for SMB3") Cc: Hyunchul Lee Cc: Steve French Cc: stable@vger.kernel.org Signed-off-by: Mickaël Salaün Link: https://lore.kernel.org/r/20220929100447.108468-1-mic@digikod.net Acked-by: Christian Brauner (Microsoft) Acked-by: Namjae Jeon Signed-off-by: Steve French Signed-off-by: Greg Kroah-Hartman --- fs/ksmbd/smb_common.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) --- a/fs/ksmbd/smb_common.c +++ b/fs/ksmbd/smb_common.c @@ -4,6 +4,8 @@ * Copyright (C) 2018 Namjae Jeon */ +#include + #include "smb_common.h" #include "server.h" #include "misc.h" @@ -625,8 +627,8 @@ int ksmbd_override_fsids(struct ksmbd_wo if (!cred) return -ENOMEM; - cred->fsuid = make_kuid(current_user_ns(), uid); - cred->fsgid = make_kgid(current_user_ns(), gid); + cred->fsuid = make_kuid(&init_user_ns, uid); + cred->fsgid = make_kgid(&init_user_ns, gid); gi = groups_alloc(0); if (!gi) { From patchwork Sat Oct 22 07:19: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: 7309 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1093358wrr; Sat, 22 Oct 2022 00:57:00 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7qgG2UOLWD1y3yDUpKA+4MukczHjR3oo2mFhKJN+mICSsK8xbdsvf9Uglah9s0Tlrb0plI X-Received: by 2002:a05:6a00:1707:b0:566:15a1:8b07 with SMTP id h7-20020a056a00170700b0056615a18b07mr23072566pfc.34.1666425409181; Sat, 22 Oct 2022 00:56:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666425409; cv=none; d=google.com; s=arc-20160816; b=0winf/ZwVysJYi/JDIH8KeiKDnyA32e+4uCIPlKRSfBdABExWumc3tt6kCATNR5RtI F8jNejAcYstgbymiMV3E9OKzrlNDZT7yjM8JeKH2waLMgRuYE5SwHCt8LpC4H/TLE8qG nbpQYSG8NxkimpCbnAUktn4aKypYGdX/f45Isn0cQ7MWJ0BtLLEeTNjDij6d94M5sEj/ wVZewPA1cjHsFSDVUe0WiD3QoM73Z6KT5wv8LRMkpfjVe3AqTWE/qNn3SvN7pyKB1TDl hasBhp4nP7Eb6Cx0jmOWSS/I9oYGxqi/XpJIMEvOk1oENnmW6B244xoL84qBNR8HkDPB xfqg== 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=FgCpfSP1CKvVI9oR6vVQ5YrNl4WjCu7l6RxGcmvU4XI=; b=DpzJczAyOCzO/BRarNWsMzBLz7LnuZGW/tgsEN41TarAioMyEIw3WkbtNT0S/iW13S LJODPzmk8O2JYgL//laoVMOhnDC5d/ii9QCHoBbtfWHMAzPFvvje6E9sjO5DPDNmhEoL egk7bRhaw/cBD9d82yLjO97m1IjK+netD7jn35aNOa+zPS4F+Ke56J7AnbSPnKhI/Umo pZvQv7ax3x8eTqjYEAdq7AWXYszRU3SJaTMC/X1izoiRwaC9VIPFaqnrAZLgl0SYvQaH NRy4sd9KfFpYYnQKkqcy0Tqax5Akbgg0tAvynWd0F/uvfPhnroGPnYNuHeIhgK46XPlT yYcQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=sj7cu+Rv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 v16-20020a631510000000b004386a1ebe70si27467985pgl.43.2022.10.22.00.56.37; Sat, 22 Oct 2022 00: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=sj7cu+Rv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S232258AbiJVH4Q (ORCPT + 99 others); Sat, 22 Oct 2022 03:56:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42382 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231666AbiJVHwj (ORCPT ); Sat, 22 Oct 2022 03:52:39 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5246486811; Sat, 22 Oct 2022 00:46: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 sin.source.kernel.org (Postfix) with ESMTPS id 3B7CECE2CA4; Sat, 22 Oct 2022 07:38:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1A83CC433D6; Sat, 22 Oct 2022 07:38:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424329; bh=KFZDHCr5VatjNoLsuJLsKBNtpw+3u3h/VovKkhXL+MA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sj7cu+RvEtRHEp/h8bEULRdAfn0p/V3DsmRCBQQxRoWIPwtWlUeYSW5cU5xfFmfad jko4ORfOD5DxT7p7fr2WqpMTijqRk+tEJwySNk/P0YV4NPF3jrzcytzTZm/BPHO9LF IPqqwI+RKQrG2uoElCLW9dz5w4JsYogLlnSRgVb4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dave Chinner , Christoph Hellwig , stable@kernel.org, Lukas Czerner , Jan Kara , Theodore Tso Subject: [PATCH 5.19 106/717] fs: record I_DIRTY_TIME even if inode already has I_DIRTY_INODE Date: Sat, 22 Oct 2022 09:19:45 +0200 Message-Id: <20221022072434.191098893@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747373689935920546?= X-GMAIL-MSGID: =?utf-8?q?1747373689935920546?= From: Lukas Czerner commit cbfecb927f429a6fa613d74b998496bd71e4438a upstream. Currently the I_DIRTY_TIME will never get set if the inode already has I_DIRTY_INODE with assumption that it supersedes I_DIRTY_TIME. That's true, however ext4 will only update the on-disk inode in ->dirty_inode(), not on actual writeback. As a result if the inode already has I_DIRTY_INODE state by the time we get to __mark_inode_dirty() only with I_DIRTY_TIME, the time was already filled into on-disk inode and will not get updated until the next I_DIRTY_INODE update, which might never come if we crash or get a power failure. The problem can be reproduced on ext4 by running xfstest generic/622 with -o iversion mount option. Fix it by allowing I_DIRTY_TIME to be set even if the inode already has I_DIRTY_INODE. Also make sure that the case is properly handled in writeback_single_inode() as well. Additionally changes in xfs_fs_dirty_inode() was made to accommodate for I_DIRTY_TIME in flag. Thanks Jan Kara for suggestions on how to make this work properly. Cc: Dave Chinner Cc: Christoph Hellwig Cc: stable@kernel.org Signed-off-by: Lukas Czerner Suggested-by: Jan Kara Reviewed-by: Jan Kara Link: https://lore.kernel.org/r/20220825100657.44217-1-lczerner@redhat.com Signed-off-by: Theodore Ts'o Signed-off-by: Greg Kroah-Hartman --- Documentation/filesystems/vfs.rst | 3 +++ fs/fs-writeback.c | 37 +++++++++++++++++++++++++------------ fs/xfs/xfs_super.c | 10 ++++++++-- include/linux/fs.h | 9 +++++---- 4 files changed, 41 insertions(+), 18 deletions(-) --- a/Documentation/filesystems/vfs.rst +++ b/Documentation/filesystems/vfs.rst @@ -274,6 +274,9 @@ or bottom half). This is specifically for the inode itself being marked dirty, not its data. If the update needs to be persisted by fdatasync(), then I_DIRTY_DATASYNC will be set in the flags argument. + I_DIRTY_TIME will be set in the flags in case lazytime is enabled + and struct inode has times updated since the last ->dirty_inode + call. ``write_inode`` this method is called when the VFS needs to write an inode to --- a/fs/fs-writeback.c +++ b/fs/fs-writeback.c @@ -1718,9 +1718,14 @@ static int writeback_single_inode(struct */ if (!(inode->i_state & I_DIRTY_ALL)) inode_cgwb_move_to_attached(inode, wb); - else if (!(inode->i_state & I_SYNC_QUEUED) && - (inode->i_state & I_DIRTY)) - redirty_tail_locked(inode, wb); + else if (!(inode->i_state & I_SYNC_QUEUED)) { + if ((inode->i_state & I_DIRTY)) + redirty_tail_locked(inode, wb); + else if (inode->i_state & I_DIRTY_TIME) { + inode->dirtied_when = jiffies; + inode_io_list_move_locked(inode, wb, &wb->b_dirty_time); + } + } spin_unlock(&wb->list_lock); inode_sync_complete(inode); @@ -2370,6 +2375,20 @@ void __mark_inode_dirty(struct inode *in if (flags & I_DIRTY_INODE) { /* + * Inode timestamp update will piggback on this dirtying. + * We tell ->dirty_inode callback that timestamps need to + * be updated by setting I_DIRTY_TIME in flags. + */ + if (inode->i_state & I_DIRTY_TIME) { + spin_lock(&inode->i_lock); + if (inode->i_state & I_DIRTY_TIME) { + inode->i_state &= ~I_DIRTY_TIME; + flags |= I_DIRTY_TIME; + } + spin_unlock(&inode->i_lock); + } + + /* * Notify the filesystem about the inode being dirtied, so that * (if needed) it can update on-disk fields and journal the * inode. This is only needed when the inode itself is being @@ -2378,7 +2397,8 @@ void __mark_inode_dirty(struct inode *in */ trace_writeback_dirty_inode_start(inode, flags); if (sb->s_op->dirty_inode) - sb->s_op->dirty_inode(inode, flags & I_DIRTY_INODE); + sb->s_op->dirty_inode(inode, + flags & (I_DIRTY_INODE | I_DIRTY_TIME)); trace_writeback_dirty_inode(inode, flags); /* I_DIRTY_INODE supersedes I_DIRTY_TIME. */ @@ -2399,21 +2419,15 @@ void __mark_inode_dirty(struct inode *in */ smp_mb(); - if (((inode->i_state & flags) == flags) || - (dirtytime && (inode->i_state & I_DIRTY_INODE))) + if ((inode->i_state & flags) == flags) return; spin_lock(&inode->i_lock); - if (dirtytime && (inode->i_state & I_DIRTY_INODE)) - goto out_unlock_inode; if ((inode->i_state & flags) != flags) { const int was_dirty = inode->i_state & I_DIRTY; inode_attach_wb(inode, NULL); - /* I_DIRTY_INODE supersedes I_DIRTY_TIME. */ - if (flags & I_DIRTY_INODE) - inode->i_state &= ~I_DIRTY_TIME; inode->i_state |= flags; /* @@ -2486,7 +2500,6 @@ void __mark_inode_dirty(struct inode *in out_unlock: if (wb) spin_unlock(&wb->list_lock); -out_unlock_inode: spin_unlock(&inode->i_lock); } EXPORT_SYMBOL(__mark_inode_dirty); --- a/fs/xfs/xfs_super.c +++ b/fs/xfs/xfs_super.c @@ -650,7 +650,7 @@ xfs_fs_destroy_inode( static void xfs_fs_dirty_inode( struct inode *inode, - int flag) + int flags) { struct xfs_inode *ip = XFS_I(inode); struct xfs_mount *mp = ip->i_mount; @@ -658,7 +658,13 @@ xfs_fs_dirty_inode( if (!(inode->i_sb->s_flags & SB_LAZYTIME)) return; - if (flag != I_DIRTY_SYNC || !(inode->i_state & I_DIRTY_TIME)) + + /* + * Only do the timestamp update if the inode is dirty (I_DIRTY_SYNC) + * and has dirty timestamp (I_DIRTY_TIME). I_DIRTY_TIME can be passed + * in flags possibly together with I_DIRTY_SYNC. + */ + if ((flags & ~I_DIRTY_TIME) != I_DIRTY_SYNC || !(flags & I_DIRTY_TIME)) return; if (xfs_trans_alloc(mp, &M_RES(mp)->tr_fsyncts, 0, 0, 0, &tp)) --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -2241,13 +2241,14 @@ static inline void kiocb_clone(struct ki * don't have to write inode on fdatasync() when only * e.g. the timestamps have changed. * I_DIRTY_PAGES Inode has dirty pages. Inode itself may be clean. - * I_DIRTY_TIME The inode itself only has dirty timestamps, and the + * I_DIRTY_TIME The inode itself has dirty timestamps, and the * lazytime mount option is enabled. We keep track of this * separately from I_DIRTY_SYNC in order to implement * lazytime. This gets cleared if I_DIRTY_INODE - * (I_DIRTY_SYNC and/or I_DIRTY_DATASYNC) gets set. I.e. - * either I_DIRTY_TIME *or* I_DIRTY_INODE can be set in - * i_state, but not both. I_DIRTY_PAGES may still be set. + * (I_DIRTY_SYNC and/or I_DIRTY_DATASYNC) gets set. But + * I_DIRTY_TIME can still be set if I_DIRTY_SYNC is already + * in place because writeback might already be in progress + * and we don't want to lose the time update * I_NEW Serves as both a mutex and completion notification. * New inodes set I_NEW. If two processes both create * the same inode, one of them will release its inode and From patchwork Sat Oct 22 07:19: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: 7189 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1089307wrr; Sat, 22 Oct 2022 00:42:49 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7lGYzBFgLPeOMup3KHKlv03zdG2IfBkU7IHhJbFdZMUt4zMVKg2Xf/BWa561YX8Cd56D8K X-Received: by 2002:a17:90a:e7cd:b0:20a:c658:c185 with SMTP id kb13-20020a17090ae7cd00b0020ac658c185mr27305893pjb.114.1666424569217; Sat, 22 Oct 2022 00:42:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666424569; cv=none; d=google.com; s=arc-20160816; b=E42+jWCzV4xkUtivF/gO4vssUVbOONw3AySlZ41qYiy961P6+HTisdzTMEmkWrqteb 78qW9cBN/MbTCmoEXRIN36XpNxyCHIWVynlcl/V8R4hvpc6ZDknbQZ+dCOotJUzOj9ih BbaabNs+QGMfTSClDzWP4qjUwONrlMg4Whvhj1wLYE7cgInn1zhi4v5u6KEgmVRCYLPX n8rYAwhxQED0Hf5orwvxOyxqn9mACjJ0Ajsza5c3Ln2bnobpXv0RtxXuD607Z1Qcpfgm Wprh1Ea9JjgH8EDf1rnXT32ONtdIM1c5vd7mshLolljjbJJlrTQtddcAOMiayw/e5bWL PJgw== 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=4fsNrMzV8MFRc5f3fJOQf8AIgom40b2LkD9bVgo6Ajs=; b=f/1GBxwlAHef469wz6bgiCC3EqQSDbmoQxwGYXxwCTgkhp41pB/iwieufmtS6BW5FN ZLcfubyLFMivOpbPhop1LrZr7UcJtZOmem+6PFYjYOVkEXwHUQfFy5I2CUnqKbL+2Xqj eKG45zUp26oQ8honwVGiSdELMCASZ+Yv71srSVILOxvIihxHvKH4kvlvZwNEwqM9cO+8 G/KdQziC/UG5QDMBQ6WoA3FFr7J8/vb0ZXU2jtT9kRVACuhy9fHeFyi0QTVjoS+k4Gcq 0hcoXHnMxqF0z2WleAabL+E1xqB4IQXc3L7iXq8PFZHDySYNZ6hI7REEaOQxqwwfu2df byqQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=iEzGLTg8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 h2-20020a056a001a4200b005453554828bsi30891442pfv.204.2022.10.22.00.42.37; Sat, 22 Oct 2022 00: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=iEzGLTg8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231248AbiJVHmR (ORCPT + 99 others); Sat, 22 Oct 2022 03:42:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47094 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231126AbiJVHls (ORCPT ); Sat, 22 Oct 2022 03:41:48 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8C127543E2; Sat, 22 Oct 2022 00:39:52 -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 5D460B82DFA; Sat, 22 Oct 2022 07:38:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B2E19C433C1; Sat, 22 Oct 2022 07:38:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424332; bh=ecbJtZtbTxTy0Xaol6OENYdH2Dt+6dzVljS18GKzyfU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iEzGLTg8kNz3MxHKDmfd2im+pD9sb3wh3MI45pdB0xljEmpFUtgpGqTI/CcEFCtmj n3AiuxKJxxk+8hP/Api/AR9RQWaKgxRUGVN6qZdvbQ/AyCuZV9V7+SzgoLhR4nuCVD iJAb00Mzed5I0lJzGam1FvQyoQK+QrX/WaGh+h18= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alexander Zhu , David Sterba Subject: [PATCH 5.19 107/717] btrfs: fix alignment of VMA for memory mapped files on THP Date: Sat, 22 Oct 2022 09:19:46 +0200 Message-Id: <20221022072434.370971359@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747372809026746324?= X-GMAIL-MSGID: =?utf-8?q?1747372809026746324?= From: Alexander Zhu commit b0c582233a8563f3c4228df838cdc67a8807ec78 upstream. With CONFIG_READ_ONLY_THP_FOR_FS, the Linux kernel supports using THPs for read-only mmapped files, such as shared libraries. However, the kernel makes no attempt to actually align those mappings on 2MB boundaries, which makes it impossible to use those THPs most of the time. This issue applies to general file mapping THP as well as existing setups using CONFIG_READ_ONLY_THP_FOR_FS. This is easily fixed by using thp_get_unmapped_area for the unmapped_area function in btrfs, which is what ext2, ext4, fuse, and xfs all use. Initially btrfs had been left out in commit 8c07fc452ac0 ("btrfs: fix alignment of VMA for memory mapped files on THP") as btrfs does not support DAX. However, commit 1854bc6e2420 ("mm/readahead: Align file mappings for non-DAX") removed the DAX requirement. We should now be able to call thp_get_unmapped_area() for btrfs. The problem can be seen in /proc/PID/smaps where THPeligible is set to 0 on mappings to eligible shared object files as shown below. Before this patch: 7fc6a7e18000-7fc6a80cc000 r-xp 00000000 00:1e 199856 /usr/lib64/libcrypto.so.1.1.1k Size: 2768 kB THPeligible: 0 VmFlags: rd ex mr mw me With this patch the library is mapped at a 2MB aligned address: fbdfe200000-7fbdfe4b4000 r-xp 00000000 00:1e 199856 /usr/lib64/libcrypto.so.1.1.1k Size: 2768 kB THPeligible: 1 VmFlags: rd ex mr mw me This fixes the alignment of VMAs for any mmap of a file that has the rd and ex permissions and size >= 2MB. The VMA alignment and THPeligible field for anonymous memory is handled separately and is thus not effected by this change. CC: stable@vger.kernel.org # 5.18+ Signed-off-by: Alexander Zhu Reviewed-by: David Sterba Signed-off-by: David Sterba Signed-off-by: Greg Kroah-Hartman --- fs/btrfs/file.c | 1 + 1 file changed, 1 insertion(+) diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c index 5a3f6e0d9688..8dfce1c40b5f 100644 --- a/fs/btrfs/file.c +++ b/fs/btrfs/file.c @@ -3810,6 +3810,7 @@ const struct file_operations btrfs_file_operations = { .mmap = btrfs_file_mmap, .open = btrfs_file_open, .release = btrfs_release_file, + .get_unmapped_area = thp_get_unmapped_area, .fsync = btrfs_sync_file, .fallocate = btrfs_fallocate, .unlocked_ioctl = btrfs_ioctl, From patchwork Sat Oct 22 07:19: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: 7221 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1090442wrr; Sat, 22 Oct 2022 00:47:07 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7EQzzfQ2SEiAwZPujZzSHCWviG26fPpgnOqeSXAMs6oQvMZwo7HlZ1IuxV606occ3+Xtn7 X-Received: by 2002:a63:8349:0:b0:46b:2bd4:f291 with SMTP id h70-20020a638349000000b0046b2bd4f291mr19572185pge.75.1666424827259; Sat, 22 Oct 2022 00:47:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666424827; cv=none; d=google.com; s=arc-20160816; b=Z3ApqlF2042JjAdIgT8rXXlcbcVRzrfzMpoNPaqKNCK58PwTbpkRtwlr11OZZJHbi9 zBsm4COEM9pLDOomtRnOJGw3vNA0gKyajSE6fc6Zpbcg1opwjdZ42W5nQa+7ZNhOYx+o GOvpuYvMOo/S7b4mQAAQVIqraaQkYXJyiS/wdbj0hhb1160COUXTiYf3JS/z7Zo+v/N6 YD3YnFuG1DNyWi3NbJMOheRFmTv9m8os9Gl+nQfq3Lfr8HBOiOq+FbJnSdyFIKVqkjML 4Szzo893/yPGZp1L4goS8GBwN4zYlmI99hVuCvN+185f/pn98JHQSvtFHyd9nZTQ9Lgm oC1Q== 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=2w+KEqjQkyj2+GPQASTIqG8O/MZ5vynYiinlfMNNjUg=; b=KcWbQg/FzJd5bFynLW37hfG4HsCcJG1OLyB7SrWPYqWxR9zxXGLkR/EJE2Q2MEuAJH 5zsAVz7tlty7lbbLaEWv5xg6Cf/IKcEFsrP0rkmrZK/wzUSWCWa9/Ka+xumAEhAQdexq tkUJ558UK+OiMmSU5xpyXH/ppHMVnoX4d2XYo35WoqmMoNAt+BeDnLNwFaBnRoiE+97B gzSg6VEopF/Lpn+SN/eLZyyHL+DfUbQlyE18ScNCE+7lC1IqTSaJjeQOBAmcFK+4kVCk 6arXwaAM8BigiBV7gh3KmJ5yvBg7W4WUXPiDKbvSjhzNCrrqBDpdt7qECyMZ9yRDilt/ Rb6Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=yxdwsd29; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 ng13-20020a17090b1a8d00b00205fb99a5fesi11085254pjb.136.2022.10.22.00.46.54; Sat, 22 Oct 2022 00:47: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=yxdwsd29; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S230388AbiJVHqf (ORCPT + 99 others); Sat, 22 Oct 2022 03:46:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34372 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231561AbiJVHoa (ORCPT ); Sat, 22 Oct 2022 03:44: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 C3520625EA; Sat, 22 Oct 2022 00:43: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 526F160B27; Sat, 22 Oct 2022 07:38:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 54109C433C1; Sat, 22 Oct 2022 07:38:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424334; bh=zSw86Kfl/43rpUiQkO8CuqcSTmXOw99N9G+BtcjPwjA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=yxdwsd29PcmCABdETN0Fzm96sE29aCMV+8vCOmKMWV1rq8rZ8jvhKExNkcuyrYFYH x+xgUeh/yrdiiZE1zaFb0KJMAERIHq8urhrbNhDKxX6oPtrFvGyfv+F+fRWSlYYxf6 NqxISR4pk4e/AajXpuaFLuKN+Zcg5Src9ZR7Xy6I= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Nikolay Borisov , Qu Wenruo , David Sterba Subject: [PATCH 5.19 108/717] btrfs: enhance unsupported compat RO flags handling Date: Sat, 22 Oct 2022 09:19:47 +0200 Message-Id: <20221022072434.561112249@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747373079366901761?= X-GMAIL-MSGID: =?utf-8?q?1747373079366901761?= From: Qu Wenruo commit 81d5d61454c365718655cfc87d8200c84e25d596 upstream. Currently there are two corner cases not handling compat RO flags correctly: - Remount We can still mount the fs RO with compat RO flags, then remount it RW. We should not allow any write into a fs with unsupported RO flags. - Still try to search block group items In fact, behavior/on-disk format change to extent tree should not need a full incompat flag. And since we can ensure fs with unsupported RO flags never got any writes (with above case fixed), then we can even skip block group items search at mount time. This patch will enhance the unsupported RO compat flags by: - Reject read-write remount if there are unsupported RO compat flags - Go dummy block group items directly for unsupported RO compat flags In fact, only changes to chunk/subvolume/root/csum trees should go incompat flags. The latter part should allow future change to extent tree to be compat RO flags. Thus this patch also needs to be backported to all stable trees. CC: stable@vger.kernel.org # 4.9+ Reviewed-by: Nikolay Borisov Signed-off-by: Qu Wenruo Reviewed-by: David Sterba Signed-off-by: David Sterba Signed-off-by: Greg Kroah-Hartman --- fs/btrfs/block-group.c | 11 ++++++++++- fs/btrfs/super.c | 9 +++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) --- a/fs/btrfs/block-group.c +++ b/fs/btrfs/block-group.c @@ -2191,7 +2191,16 @@ int btrfs_read_block_groups(struct btrfs int need_clear = 0; u64 cache_gen; - if (!root) + /* + * Either no extent root (with ibadroots rescue option) or we have + * unsupported RO options. The fs can never be mounted read-write, so no + * need to waste time searching block group items. + * + * This also allows new extent tree related changes to be RO compat, + * no need for a full incompat flag. + */ + if (!root || (btrfs_super_compat_ro_flags(info->super_copy) & + ~BTRFS_FEATURE_COMPAT_RO_SUPP)) return fill_dummy_bgs(info); key.objectid = 0; --- a/fs/btrfs/super.c +++ b/fs/btrfs/super.c @@ -2113,6 +2113,15 @@ static int btrfs_remount(struct super_bl ret = -EINVAL; goto restore; } + if (btrfs_super_compat_ro_flags(fs_info->super_copy) & + ~BTRFS_FEATURE_COMPAT_RO_SUPP) { + btrfs_err(fs_info, + "can not remount read-write due to unsupported optional flags 0x%llx", + btrfs_super_compat_ro_flags(fs_info->super_copy) & + ~BTRFS_FEATURE_COMPAT_RO_SUPP); + ret = -EINVAL; + goto restore; + } if (fs_info->fs_devices->rw_devices == 0) { ret = -EACCES; goto restore; From patchwork Sat Oct 22 07:19: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: 7331 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1093979wrr; Sat, 22 Oct 2022 00:59:00 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5pLn+uP5a46BVID2lIVXhgijePuEQbmVqkW0BMEp0rCZKTaG6djpGVlLLVuMFWy8I5La29 X-Received: by 2002:a17:903:200b:b0:186:892f:9f0b with SMTP id s11-20020a170903200b00b00186892f9f0bmr2457496pla.56.1666425539874; Sat, 22 Oct 2022 00:58:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666425539; cv=none; d=google.com; s=arc-20160816; b=PmptsRPrvwZ7vKsvNZJ97NGw6EeUXZ/w/DVgSDHGcHS+ylgsnFamtpIi+Gs8ht2fNt xYB87eFV3rxckQeNIj1yzoXfZw4BuzD5F3hp/VmsiPeOv2z93KS8s+npFlP7hyZ9DG6W dxZybb8sp77evB65/gBZgonQvIWwyusV/To82WwC+WIf9t0I1qBv3rk16O5hS5HabVCz E7IKGumdKWurmyshjyqYNLvCTGWLYH5mBjM7j4Y3+07j0/hN5KpvOTth5I5q7zXw81bC wEZcs9ZdRna5MLl0EX2RFd98J1x/YBjZaRwPogC60isTIwVSSfWiKKCr2w2LLvp8XdWy u1Qw== 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=bo/eZhqN7ddbxQAWAgRCEo+12zdQ1aGVpJ+QWM5IQu0=; b=DTijTO8T8XhCZX1hCeCiCo4fPbDB4yjRYZsjZTe7wq6tmLyB/39VT3F9bY++NEYcgK FML50BnXfDO1JU+dU3XOT7sSn8FsmrWOpw0/mRHt8MfGnVtGDET+FxyszHIJbZLGw1PK ANwFXfFk8rD2OrUGFxAORiIGKGTKK+Zk1qN/9GzxdYNNluZO8w5WiQ+4eEu4C2hBscQ3 n5O9hhRdZ0HnIuetd+ZRkF82OjtdWZmboDyCoTpAlZ3JfAoeUNREZ/7KR6xDcNUR/DgN Ei9r1A9JiHQeFYoMvp49eratyv4Cd6430kGAOPr3Pv02ammZGPeH3IrXpsiJzvPez3hS PEBA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=uh1K5F2A; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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-20020a056a00178700b0056b4349b767si4005439pfg.16.2022.10.22.00.58.47; Sat, 22 Oct 2022 00:58: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=uh1K5F2A; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S232374AbiJVH6b (ORCPT + 99 others); Sat, 22 Oct 2022 03:58:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55592 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232087AbiJVHyA (ORCPT ); Sat, 22 Oct 2022 03:54:00 -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 C947B2CA7E2; Sat, 22 Oct 2022 00:46: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 B9614B82DFE; Sat, 22 Oct 2022 07:38:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 155CAC433D6; Sat, 22 Oct 2022 07:38:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424337; bh=J3hY5Ke9dVOuH+qLSGit5n24qZH/9BcKbPIcxeJC+gA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uh1K5F2AcHc6tGdq4BwVzNoEGLan4/HDbGIO7A6hjqPGDoUuJOAgbTrPht+uaUNxK fEG8rj1j1se0B5Bt3J8Cpc9xMbTyc2dWJVrmq4XWc4dGzuSXXA3j8pRH0N5Rbqo8OR dPjsEPzA60nBsWIdlxdU0ZRX8BnqJuH/9plNEQQw= 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 5.19 109/717] btrfs: fix race between quota enable and quota rescan ioctl Date: Sat, 22 Oct 2022 09:19:48 +0200 Message-Id: <20221022072434.704677757@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747373826659257380?= X-GMAIL-MSGID: =?utf-8?q?1747373826659257380?= 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 @@ -1174,6 +1174,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 Sat Oct 22 07:19: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: 7811 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1140159wrr; Sat, 22 Oct 2022 03:24:37 -0700 (PDT) X-Google-Smtp-Source: AMsMyM54ZelYfTVqq7loY4suncNUqHmgMaeClZveQ9u0EBs2ZsNyY2K3SEGcOBrtyLX0IPXJKcqM X-Received: by 2002:a17:907:9625:b0:78d:bb0c:4a40 with SMTP id gb37-20020a170907962500b0078dbb0c4a40mr18666683ejc.339.1666434277610; Sat, 22 Oct 2022 03:24:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666434277; cv=none; d=google.com; s=arc-20160816; b=OSv5PYD9q2SklWx9xvZZqCNZ4cZPNJq5AZtN7+AvNY/4/OTBJRSvIbrNklLnYDtGeo jRhAQtlKL7xC2yPdU2LmQCDqa3p/VlOEOKIcSaPSanexVfjMnwX79gkTQMxQdElRzE4E 7LcTTWT5IHA/5EKNekYDuZWhHL/88mGy3JCoakvnwIDoBvH1+XEbHmkYeYtH8watJFZV 72jQf2REyh3na4qX4ACEgnAN/PwpDYX6rSPRCEMIH+6HieDLpjcPiMZkoCZdPlmbObBm jFoKGHO4gYUiBvvBdE+0ntifyb/QbYs+x7lMfbSSfhoVlPgt8+ra8UY2dQCl+JmvSELu wGSA== 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=Z7lgocCDar6/txiSTxb8mPxLHtZbl2ewLQ8mcmp0cpQ=; b=w3KA+kH1i+JiMsnLpvWBhUvEEXu1jc/RkviQVDZxp+mkWVbTiuobq3JJcL5sSmwPPD KRuQ1rjL/b0GuIkmT/nxomG1TqfG+psCgfOUQDij5j7R1wPJF/I4Eg+HWmBNUh5bgxxB S4yIRondUdJFzIYlg0zHjUCfwnur2DXoBzRa3dqFzrYWnQlSXx9K4lBwcxeUA0zwfHkH 56xCBIg5ylmB+WEjHdCP0AgmRwdrLzJ8o671pA10hhQatVCP5E7r3G3TWaInM5xnMedy BJftO9dfeVeBgRh3b34MZAhvgIQfB200mTc88bARoJcZDFSBa7TJoo2lysify0PKCQM4 xr4Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=CpL+Mp3F; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 s5-20020a17090699c500b0078d878d8fb7si22980776ejn.920.2022.10.22.03.24.12; Sat, 22 Oct 2022 03:24: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=CpL+Mp3F; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S230233AbiJVKOc (ORCPT + 99 others); Sat, 22 Oct 2022 06:14:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35594 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230321AbiJVKOE (ORCPT ); Sat, 22 Oct 2022 06:14:04 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C02BF317299; Sat, 22 Oct 2022 02:31: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 sin.source.kernel.org (Postfix) with ESMTPS id B2768CE2CA6; Sat, 22 Oct 2022 07:39:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C8047C433C1; Sat, 22 Oct 2022 07:38:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424340; bh=C7SHB9m12+F+97uOtCFgWNKJoOeJQG/0FiMeEt8/F4A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CpL+Mp3FrbgqAW97tQCJ1Zv6QIKjxjzI3WCoII7WAKWkVIH3w8R10Soq6m2g/klaY CmpRJ8vekQHX+Q6IteJsJfwX/wyopoYUIZjN5s3Lk7WNdhydNtSnLXDjEYvKLb4Jjs lmHb0dMw3XoyrmAM5qhpTnOROHyQDk5KwkLcWUpo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Anand Jain , Filipe Manana , David Sterba Subject: [PATCH 5.19 110/717] btrfs: fix missed extent on fsync after dropping extent maps Date: Sat, 22 Oct 2022 09:19:49 +0200 Message-Id: <20221022072434.890936378@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 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?1747382989366784049?= X-GMAIL-MSGID: =?utf-8?q?1747382989366784049?= From: Filipe Manana commit cef7820d6abf8d61f8e1db411eae3c712f6d72a2 upstream. When dropping extent maps for a range, through btrfs_drop_extent_cache(), if we find an extent map that starts before our target range and/or ends before the target range, and we are not able to allocate extent maps for splitting that extent map, then we don't fail and simply remove the entire extent map from the inode's extent map tree. This is generally fine, because in case anyone needs to access the extent map, it can just load it again later from the respective file extent item(s) in the subvolume btree. However, if that extent map is new and is in the list of modified extents, then a fast fsync will miss the parts of the extent that were outside our range (that needed to be split), therefore not logging them. Fix that by marking the inode for a full fsync. This issue was introduced after removing BUG_ON()s triggered when the split extent map allocations failed, done by commit 7014cdb49305ed ("Btrfs: btrfs_drop_extent_cache should never fail"), back in 2012, and the fast fsync path already existed but was very recent. Also, in the case where we could allocate extent maps for the split operations but then fail to add a split extent map to the tree, mark the inode for a full fsync as well. This is not supposed to ever fail, and we assert that, but in case assertions are disabled (CONFIG_BTRFS_ASSERT is not set), it's the correct thing to do to make sure a fast fsync will not miss a new extent. CC: stable@vger.kernel.org # 5.15+ Reviewed-by: Anand Jain Signed-off-by: Filipe Manana Signed-off-by: David Sterba Signed-off-by: Greg Kroah-Hartman --- fs/btrfs/file.c | 58 ++++++++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 46 insertions(+), 12 deletions(-) --- a/fs/btrfs/file.c +++ b/fs/btrfs/file.c @@ -523,6 +523,7 @@ void btrfs_drop_extent_cache(struct btrf testend = 0; } while (1) { + bool ends_after_range = false; int no_splits = 0; modified = false; @@ -539,10 +540,12 @@ void btrfs_drop_extent_cache(struct btrf write_unlock(&em_tree->lock); break; } + if (testend && em->start + em->len > start + len) + ends_after_range = true; flags = em->flags; gen = em->generation; if (skip_pinned && test_bit(EXTENT_FLAG_PINNED, &em->flags)) { - if (testend && em->start + em->len >= start + len) { + if (ends_after_range) { free_extent_map(em); write_unlock(&em_tree->lock); break; @@ -592,7 +595,7 @@ void btrfs_drop_extent_cache(struct btrf split = split2; split2 = NULL; } - if (testend && em->start + em->len > start + len) { + if (ends_after_range) { u64 diff = start + len - em->start; split->start = start + len; @@ -630,14 +633,42 @@ void btrfs_drop_extent_cache(struct btrf } else { ret = add_extent_mapping(em_tree, split, modified); - ASSERT(ret == 0); /* Logic error */ + /* Logic error, shouldn't happen. */ + ASSERT(ret == 0); + if (WARN_ON(ret != 0) && modified) + btrfs_set_inode_full_sync(inode); } free_extent_map(split); split = NULL; } next: - if (extent_map_in_tree(em)) + if (extent_map_in_tree(em)) { + /* + * If the extent map is still in the tree it means that + * either of the following is true: + * + * 1) It fits entirely in our range (doesn't end beyond + * it or starts before it); + * + * 2) It starts before our range and/or ends after our + * range, and we were not able to allocate the extent + * maps for split operations, @split and @split2. + * + * If we are at case 2) then we just remove the entire + * extent map - this is fine since if anyone needs it to + * access the subranges outside our range, will just + * load it again from the subvolume tree's file extent + * item. However if the extent map was in the list of + * modified extents, then we must mark the inode for a + * full fsync, otherwise a fast fsync will miss this + * extent if it's new and needs to be logged. + */ + if ((em->start < start || ends_after_range) && modified) { + ASSERT(no_splits); + btrfs_set_inode_full_sync(inode); + } remove_extent_mapping(em_tree, em); + } write_unlock(&em_tree->lock); /* once for us */ @@ -2202,14 +2233,6 @@ int btrfs_sync_file(struct file *file, l atomic_inc(&root->log_batch); /* - * Always check for the full sync flag while holding the inode's lock, - * to avoid races with other tasks. The flag must be either set all the - * time during logging or always off all the time while logging. - */ - full_sync = test_bit(BTRFS_INODE_NEEDS_FULL_SYNC, - &BTRFS_I(inode)->runtime_flags); - - /* * Before we acquired the inode's lock and the mmap lock, someone may * have dirtied more pages in the target range. We need to make sure * that writeback for any such pages does not start while we are logging @@ -2234,6 +2257,17 @@ int btrfs_sync_file(struct file *file, l } /* + * Always check for the full sync flag while holding the inode's lock, + * to avoid races with other tasks. The flag must be either set all the + * time during logging or always off all the time while logging. + * We check the flag here after starting delalloc above, because when + * running delalloc the full sync flag may be set if we need to drop + * extra extent map ranges due to temporary memory allocation failures. + */ + full_sync = test_bit(BTRFS_INODE_NEEDS_FULL_SYNC, + &BTRFS_I(inode)->runtime_flags); + + /* * We have to do this here to avoid the priority inversion of waiting on * IO of a lower priority task while holding a transaction open. * From patchwork Sat Oct 22 07:19: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: 7304 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1093199wrr; Sat, 22 Oct 2022 00:56:22 -0700 (PDT) X-Google-Smtp-Source: AMsMyM72HYz89rsIsTWuJMEZ7u7CIwz3J6QmlcLBdnU1mk+UMbVMQ1osu0vMefM53jgga/+Y5peY X-Received: by 2002:a65:6cce:0:b0:439:49b5:48b8 with SMTP id g14-20020a656cce000000b0043949b548b8mr19714761pgw.514.1666425382422; Sat, 22 Oct 2022 00:56:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666425382; cv=none; d=google.com; s=arc-20160816; b=1JlnXBZFAKN6cG5q0bfLdx2QiZ4YKHZqsZKi2bTy467IHsB2oChr0vEy2iQaflB6pT xCsmMyNnogEyctEaK1n9Deoa4XxANg6xwNBnPCAFeTfVJ3bZR6zxib9Gt1M1i1r3qDcO HLgt0OCezg+TlrvYiQthZkcCRO+n2UfyKZVCCwk8fwLdf8vdZS5z3RRwyIMipJWQo5ka pLwnoVck1qCUiPEcRA+AN7yeu9244+Ub2HiivkKrEGDBpqifCOsH5/1ZC869bQUXhzpU jQXkjP11HabkK6HfvlqAWfJpGxWSfDsrGVNmMxSNsPF0bhZCKPZtuoJb0ph6sPybL/jB oCcg== 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=LmzziNrKWYOAxOxdGrFlM4VUdGsJoAaaP7lHN+IzUuY=; b=YC5JN310q+0iJznuBjliXQaYU67A0BNmCbhphGBgyeJwJnCcwS7gMM477WWtKMVBUQ EACoi4z8Ky3u6sd6Z4MBAjb6QStqkQnsvo3pa6n0Jl767k9gJo+kt8FvQwmXoxj1RMM+ SC6ZzWLZa11+NKbOEdhtj2QCMtyp9IqrGsF2sfCU7qGXEpVrO/PCOnV/SJj7V8D81ncM f88HuXWI6pacL1VJxhoQAXFDzlU4LpCR+/HjdmXCFDw5TwpskYEvNvzDpmJ53Wn5Nx3q sybGXDWpwQWQLIXiQx3KJ5f/N47875ctan+8+IefntWRb64e6VK8/5fVNisyk/mFat8x /0Qw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=1R+QU5Ql; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 rm3-20020a17090b3ec300b0020dbb8f3695si2252718pjb.172.2022.10.22.00.56.10; Sat, 22 Oct 2022 00:56: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=1R+QU5Ql; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S232180AbiJVHzx (ORCPT + 99 others); Sat, 22 Oct 2022 03:55:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54870 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231706AbiJVHwi (ORCPT ); Sat, 22 Oct 2022 03:52: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 17560AC297; Sat, 22 Oct 2022 00:46: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 6790FB82DF6; Sat, 22 Oct 2022 07:39:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A54DCC433D7; Sat, 22 Oct 2022 07:39:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424343; bh=51YjOXF7uUIpZAbLElBdbO797UG/6ZCUOY1Q/ovFfzc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1R+QU5QlqQOdXaZlu3FqBCt0jAZPRtqQCDAqLYlkj2L+x9V/Li6IZQqGEZRASguKL W94tfRELVzXeAF2BpoWy4wfsIcQWQfdaRXEIPLRpZwjxwbWWdm1Pc9cigjN85fnFU9 dWSPmxEKKkneFjNS2/LeSrCf4QN2cEUYYdRgl8qs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, syzbot , Tetsuo Handa , David Sterba Subject: [PATCH 5.19 111/717] btrfs: set generation before calling btrfs_clean_tree_block in btrfs_init_new_buffer Date: Sat, 22 Oct 2022 09:19:50 +0200 Message-Id: <20221022072435.073175744@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747373662037942040?= X-GMAIL-MSGID: =?utf-8?q?1747373662037942040?= From: Tetsuo Handa commit cbddcc4fa3443fe8cfb2ff8e210deb1f6a0eea38 upstream. syzbot is reporting uninit-value in btrfs_clean_tree_block() [1], for commit bc877d285ca3dba2 ("btrfs: Deduplicate extent_buffer init code") missed that btrfs_set_header_generation() in btrfs_init_new_buffer() must not be moved to after clean_tree_block() because clean_tree_block() is calling btrfs_header_generation() since commit 55c69072d6bd5be1 ("Btrfs: Fix extent_buffer usage when nodesize != leafsize"). Since memzero_extent_buffer() will reset "struct btrfs_header" part, we can't move btrfs_set_header_generation() to before memzero_extent_buffer(). Just re-add btrfs_set_header_generation() before btrfs_clean_tree_block(). Link: https://syzkaller.appspot.com/bug?extid=fba8e2116a12609b6c59 [1] Reported-by: syzbot Fixes: bc877d285ca3dba2 ("btrfs: Deduplicate extent_buffer init code") CC: stable@vger.kernel.org # 4.19+ Signed-off-by: Tetsuo Handa Signed-off-by: David Sterba Signed-off-by: Greg Kroah-Hartman --- fs/btrfs/extent-tree.c | 3 +++ 1 file changed, 3 insertions(+) --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c @@ -4904,6 +4904,9 @@ btrfs_init_new_buffer(struct btrfs_trans !test_bit(BTRFS_ROOT_RESET_LOCKDEP_CLASS, &root->state)) lockdep_owner = BTRFS_FS_TREE_OBJECTID; + /* btrfs_clean_tree_block() accesses generation field. */ + btrfs_set_header_generation(buf, trans->transid); + /* * This needs to stay, because we could allocate a freed block from an * old tree into a new tree, so we need to make sure this new block is From patchwork Sat Oct 22 07:19: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: 7631 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1107513wrr; Sat, 22 Oct 2022 01:41:08 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6wgHLnhMTXgpUUvz9iOOuBiQFzc/cTaKmH1xRP5L1GWu18gVhPvxh9aH6KMWyJuXF5ufyB X-Received: by 2002:a17:906:cc5c:b0:7a0:a52:8c05 with SMTP id mm28-20020a170906cc5c00b007a00a528c05mr2731740ejb.686.1666428067960; Sat, 22 Oct 2022 01:41:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666428067; cv=none; d=google.com; s=arc-20160816; b=YBX+P2lt44fc4/cqL7CXLGy5tdPJg7qxq8ixPt7DYEyF/K/P0u4XR0RO4F44GJaBf/ XIPgdqAn1Ls5quqkIUsJMos7W8/1qw8O9IX3GqbPSwmJd4U4fTZOCLHpw+FhJx5yu6qq MqjTe12TTLCAXX0axL31xyfcpyz+MeFo4yvZiJrmsZZA5SM+SwE3+YxywstpPh3sOB/O 6PWpCMFSiY9h3cxbx9Yw9Ku6VQtXeh3t1wsfaeWQdJD4peM+hGK4ojpa4W38htl0Ahe7 hqv6r6YhjkpgonwkQSSoq2OsIR8rA6cm6kYDYi3w7zta9TBLCaVAO5rvwPpRp5PqsuGo jaAA== 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=DX3U+c259M7FwvA56ZM842lsr9RQWobeOcEvJ6E9bFc=; b=cZ3m3JEr6fqkz+cImN4rlJPgEaAUC3QFfdAZViJpJe9C8J7MVaj7gwCPXX5jWFOuGj SnQqIYT3YKCS3fMCADCrhVbXi7OgBImNX2LrUYo3SOMcBBCOjetVYV1IMYFDs53JKjP8 BJ7CIarDbpVZ50aouL5WTLyZUw1LHKjd2G53XGWV4xwNq+5SfFvkndWJ4jj5nxnYxjWs P7mHJGvWcp9m4v++HUSckSCGfRXELxkPA5XUPV49F+OS+Ksn1NJudMMdfz+kL1B3MFpY w5k+xPirOaQFyr/3JNICzrvOpe9ZS5XAUMFWCm6qaS4f3r7DTrmJm7ixu+xiUhQsZMnL q8hg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=K4rgI4k7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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-20020a1709064cc600b0078fcfc5d24esi14875675ejt.618.2022.10.22.01.40.38; Sat, 22 Oct 2022 01:41: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=K4rgI4k7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S234065AbiJVIiL (ORCPT + 99 others); Sat, 22 Oct 2022 04:38:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59146 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234048AbiJVIc3 (ORCPT ); Sat, 22 Oct 2022 04:32: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 6D6332D12A5; Sat, 22 Oct 2022 01:03: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 550C260B23; Sat, 22 Oct 2022 07:39:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 626E4C433D7; Sat, 22 Oct 2022 07:39:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424345; bh=KzHqx2mfIHoyi1WiueYBo5GyvE9Q9Y8B+TZngBTNrwY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=K4rgI4k7gh2A3Sbwh5MYDQGzhlYplNKetmTJCE0dUsdd0NlXhWt2hOleKEsNUHZ75 nyvvPRnc405rkpgYb1C202HUbTk4es8+nlyvu0HOWXlaPYGmwQIAet9T9HjuuGRhZN X2OpG+jPXezb2SoGBB9C2KuaDTEGEeIQAgd7rQuM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Chao Yu , Jaegeuk Kim Subject: [PATCH 5.19 112/717] f2fs: fix wrong continue condition in GC Date: Sat, 22 Oct 2022 09:19:51 +0200 Message-Id: <20221022072435.271034123@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376477751667304?= X-GMAIL-MSGID: =?utf-8?q?1747376477751667304?= From: Jaegeuk Kim commit 605b0a778aa2599aa902ae639b8e9937c74b869b upstream. We should decrease the frozen counter. Cc: stable@vger.kernel.org Fixes: 325163e9892b ("f2fs: add gc_urgent_high_remaining sysfs node") Reviewed-by: Chao Yu Signed-off-by: Jaegeuk Kim Signed-off-by: Greg Kroah-Hartman --- fs/f2fs/gc.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) --- a/fs/f2fs/gc.c +++ b/fs/f2fs/gc.c @@ -97,14 +97,10 @@ static int gc_thread_func(void *data) */ if (sbi->gc_mode == GC_URGENT_HIGH) { spin_lock(&sbi->gc_urgent_high_lock); - if (sbi->gc_urgent_high_limited) { - if (!sbi->gc_urgent_high_remaining) { - sbi->gc_urgent_high_limited = false; - spin_unlock(&sbi->gc_urgent_high_lock); - sbi->gc_mode = GC_NORMAL; - continue; - } - sbi->gc_urgent_high_remaining--; + if (sbi->gc_urgent_high_limited && + !sbi->gc_urgent_high_remaining--) { + sbi->gc_urgent_high_limited = false; + sbi->gc_mode = GC_NORMAL; } spin_unlock(&sbi->gc_urgent_high_lock); } From patchwork Sat Oct 22 07:19: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: 7190 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1089337wrr; Sat, 22 Oct 2022 00:42:53 -0700 (PDT) X-Google-Smtp-Source: AMsMyM77mKXJQDX7htQEC0uxIMOhhVznx8jDTpn8n/8lhUWDVeNfz2lNq5O1mQ4oH5JXkKl8WGPg X-Received: by 2002:a17:902:c946:b0:183:4bdf:9478 with SMTP id i6-20020a170902c94600b001834bdf9478mr22344641pla.139.1666424573677; Sat, 22 Oct 2022 00:42:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666424573; cv=none; d=google.com; s=arc-20160816; b=yHquhHLKwVMdgFx8CWUF2ja2e0ICpv9XBVEONvVawsuJ2+55oc9zHyR0M/mtuBu+E3 K9Bezm/7mOjxzG87Ch3L9KJOM6KczYd6w5Sfnq28zZ+3NLPTNCJZ09V7VTc9VQPyuIHe JYfduEktde27HROCNNieVXQiKeLxlNwIF1azTXhLuksIu6UbjXuCauvqs9r9Z+6LNFfy dhNYViUDDBeTWAGgPftcVzZuVRJ8VeZvHw1An61oZEZA68Ocz18v8wArItOvzOlR5+ti v7fgqW3ULJIQaRHux9huOmewOG+203G5uXYx4eEZjIphqmJcGdMBjyb7pqEQJQ6RCtUr F9gg== 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=Unwc5Vt5rhQBFnJZTwZST7xepFxWWO2PORxyh0x4Uxk=; b=NTglCT6vI1Vg5MlarfeXuvjMJawhxMEtUGukdFi4RmbVEeC+Y0vN2FGu3nVpu4T97T y4NIolvuRy7LxsmyYQmuCRfNKMp+PTP5TzYB8HFz2bwtolEKpa6vj0rYpeEHsMD1X4TD TGK04bXipWzg7YOOKrbCChQnz7EcwLLJceXM7ZvTuzUFuzVl0zG7VA6tnYRB1SLNwzBu sFCpTSD4rd5j5/smcsN1D+ygEQKxOWDGjrOovHGJ5kiKyyAn+s4AigB2+tlX5T9GdbwC Lw4UDva7hWz6qP9prSgkJL/4r/Lu5UysNyaz5ATRS4vas4nanCpdAEvzae11P1+qcgtM VtJg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Bga8eJdB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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-20020a170902d50600b00182b78df2f8si33094526plg.495.2022.10.22.00.42.41; Sat, 22 Oct 2022 00: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=Bga8eJdB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231252AbiJVHmZ (ORCPT + 99 others); Sat, 22 Oct 2022 03:42:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43026 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231191AbiJVHlt (ORCPT ); Sat, 22 Oct 2022 03:41:49 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4DC99CABC2; Sat, 22 Oct 2022 00:40: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 E8F64B82DF8; Sat, 22 Oct 2022 07:39:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3F2E3C433B5; Sat, 22 Oct 2022 07:39:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424348; bh=/rlIOwq1/D8lcgHiDoBRaXjaRMN4FAVegRTcoeZ6J7k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Bga8eJdBMmpTbLz/AvTj7L96JqyxuRHdV8Q4Ob/dFyV48lYNOtJyPc9Y+EHf24ILw 05nuw9L/tbhiBHun9cIEDcZDV65CyHnVasOkTFohIz418hhD+1K0c5Dq3vNFCMdkpA +o5LRD2EWPFeyuxUzIhPTjPZUr4xqkZyRC+l7hjs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Chao Yu , Jaegeuk Kim Subject: [PATCH 5.19 113/717] f2fs: complete checkpoints during remount Date: Sat, 22 Oct 2022 09:19:52 +0200 Message-Id: <20221022072435.432970377@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747372813562531859?= X-GMAIL-MSGID: =?utf-8?q?1747372813562531859?= From: Jaegeuk Kim commit 4f99484d27961cb194cebcd917176fa038a5025f upstream. Otherwise, pending checkpoints can contribute a race condition to give a quota warning. - Thread - checkpoint thread add checkpoints to the list do_remount() down_write(&sb->s_umount); f2fs_remount() block_operations() down_read_trylock(&sb->s_umount) = 0 up_write(&sb->s_umount); f2fs_quota_sync() dquot_writeback_dquots() WARN_ON_ONCE(!rwsem_is_locked(&sb->s_umount)); Or, do_remount() down_write(&sb->s_umount); f2fs_remount() create a ckpt thread f2fs_enable_checkpoint() adds checkpoints wait for f2fs_sync_fs() trigger another pending checkpoint block_operations() down_read_trylock(&sb->s_umount) = 0 up_write(&sb->s_umount); f2fs_quota_sync() dquot_writeback_dquots() WARN_ON_ONCE(!rwsem_is_locked(&sb->s_umount)); Cc: stable@vger.kernel.org Reviewed-by: Chao Yu Signed-off-by: Jaegeuk Kim Signed-off-by: Greg Kroah-Hartman --- fs/f2fs/super.c | 6 ++++++ 1 file changed, 6 insertions(+) --- a/fs/f2fs/super.c +++ b/fs/f2fs/super.c @@ -2146,6 +2146,9 @@ static void f2fs_enable_checkpoint(struc f2fs_up_write(&sbi->gc_lock); f2fs_sync_fs(sbi->sb, 1); + + /* Let's ensure there's no pending checkpoint anymore */ + f2fs_flush_ckpt_thread(sbi); } static int f2fs_remount(struct super_block *sb, int *flags, char *data) @@ -2311,6 +2314,9 @@ static int f2fs_remount(struct super_blo f2fs_stop_ckpt_thread(sbi); need_restart_ckpt = true; } else { + /* Flush if the prevous checkpoint, if exists. */ + f2fs_flush_ckpt_thread(sbi); + err = f2fs_start_ckpt_thread(sbi); if (err) { f2fs_err(sbi, From patchwork Sat Oct 22 07:19: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: 7227 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1090531wrr; Sat, 22 Oct 2022 00:47:27 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7SASQmSDyLpgxypHf2ImOhv68k8+F7MRjZUZBebAj6RGiK0rPPGaevb89rM1lse+gx4LmJ X-Received: by 2002:a17:902:d34d:b0:17f:9018:6 with SMTP id l13-20020a170902d34d00b0017f90180006mr23796089plk.112.1666424846900; Sat, 22 Oct 2022 00:47:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666424846; cv=none; d=google.com; s=arc-20160816; b=CnPcePDWHG2CW8rEJgVpFpzyg6POOXoXTukORbRpVarUq+spahgpRN4T3PzVOescDN NMeBO2hCm5tRluzv07HfpBknf05KPGgQk+fkUPoFTTYPgJlIjhu9t5EBdjWn0CK+k6d4 PQeyKaR8nA6KzTf8YPlSheMMqJr1YL3phYF5xxGpoocFObN5UXKNnbWCUb6kS2IjDPLi CGlcO4OoqsYfv6K/kDHzFfccdYG8ycCWyVs4WzEX+FakKWyPrwrQ/tasHztQmCoBq75m Dz1fpoRfVcWFtjZAi2T/yxF19W5k/ZpjjSNZqne5r3uGZ5UD0fI/obt2NlOvswzI3Eji /OJA== 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=wlvBRqNQ5SxFgV3Szr4DZ3ymUcnrE/MSrqah9LdGyz4=; b=yMuip/1QbD3QOhXo2kEhTmLN1NC8qaj79Gq4eT8Pohbe1KyYpfIb7WRHOEbjDDEyQZ aQRZF1VZvf4Ve7BWX3/kN6Sp+Nv4AqP3VyoVkXL6J63BEn9iAhFDBO/17ZC6HmEiNLVD mX+I3vfuZ/QubSV7E6lQNf6X/ExVdTuBAyyD0jRd7i6mxuwg9HrmMmzw/X7ibIQDqR/e yP/IeL0sYEf5opE7w5nxVLiD+/JYbXP3OO6cLoIlmmIcpPEV0x0/apBDQrHXkXuJPVmF Pmoe/kmSR+AyWcrEFQloeAbZZNUSYLWWiSq1Ate9JvhRxfODAhUaNvafWh2qKoWhdNj6 uNTg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="Ap/Mb7tk"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 lb5-20020a17090b4a4500b0020dcf30338fsi2513793pjb.96.2022.10.22.00.47.14; Sat, 22 Oct 2022 00:47: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="Ap/Mb7tk"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231519AbiJVHq4 (ORCPT + 99 others); Sat, 22 Oct 2022 03:46:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35564 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231633AbiJVHop (ORCPT ); Sat, 22 Oct 2022 03:44: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 EE18329F67A; Sat, 22 Oct 2022 00:43:25 -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 0FFAA60B21; Sat, 22 Oct 2022 07:39:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E2B23C433D6; Sat, 22 Oct 2022 07:39:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424351; bh=AKjqxU4F0WI3D5+Ca3cuRol5AchGUdnutzPQA42eCZI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ap/Mb7tk6Sjo+Vc1LA2agIil8jsib/C6L7FT+nKZsF2C/76Nr+lFudruWNkNOT8QQ M8SOtroED5NEIY8Wx18Gx3kaWgHziTHv0ybHQawiSnth0So9J/0Oi7ux7ml9SWxxgL YtWf/gh1+qC6i3xk8r7wq6g60ZqqzahHWQMTyT0w= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Chao Yu , Jaegeuk Kim Subject: [PATCH 5.19 114/717] f2fs: flush pending checkpoints when freezing super Date: Sat, 22 Oct 2022 09:19:53 +0200 Message-Id: <20221022072435.577636339@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747373100558963802?= X-GMAIL-MSGID: =?utf-8?q?1747373100558963802?= From: Jaegeuk Kim commit c7b58576370147833999fd4cc874d0f918bdf9ca upstream. This avoids -EINVAL when trying to freeze f2fs. Cc: stable@vger.kernel.org Reviewed-by: Chao Yu Signed-off-by: Jaegeuk Kim Signed-off-by: Greg Kroah-Hartman --- fs/f2fs/checkpoint.c | 24 ++++++++++++++++++------ fs/f2fs/f2fs.h | 1 + fs/f2fs/super.c | 5 ++--- 3 files changed, 21 insertions(+), 9 deletions(-) --- a/fs/f2fs/checkpoint.c +++ b/fs/f2fs/checkpoint.c @@ -1894,15 +1894,27 @@ int f2fs_start_ckpt_thread(struct f2fs_s void f2fs_stop_ckpt_thread(struct f2fs_sb_info *sbi) { struct ckpt_req_control *cprc = &sbi->cprc_info; + struct task_struct *ckpt_task; - if (cprc->f2fs_issue_ckpt) { - struct task_struct *ckpt_task = cprc->f2fs_issue_ckpt; + if (!cprc->f2fs_issue_ckpt) + return; - cprc->f2fs_issue_ckpt = NULL; - kthread_stop(ckpt_task); + ckpt_task = cprc->f2fs_issue_ckpt; + cprc->f2fs_issue_ckpt = NULL; + kthread_stop(ckpt_task); - flush_remained_ckpt_reqs(sbi, NULL); - } + f2fs_flush_ckpt_thread(sbi); +} + +void f2fs_flush_ckpt_thread(struct f2fs_sb_info *sbi) +{ + struct ckpt_req_control *cprc = &sbi->cprc_info; + + flush_remained_ckpt_reqs(sbi, NULL); + + /* Let's wait for the previous dispatched checkpoint. */ + while (atomic_read(&cprc->queued_ckpt)) + io_schedule_timeout(DEFAULT_IO_TIMEOUT); } void f2fs_init_ckpt_req_control(struct f2fs_sb_info *sbi) --- a/fs/f2fs/f2fs.h +++ b/fs/f2fs/f2fs.h @@ -3676,6 +3676,7 @@ static inline bool f2fs_need_rand_seg(st * checkpoint.c */ void f2fs_stop_checkpoint(struct f2fs_sb_info *sbi, bool end_io); +void f2fs_flush_ckpt_thread(struct f2fs_sb_info *sbi); struct page *f2fs_grab_meta_page(struct f2fs_sb_info *sbi, pgoff_t index); struct page *f2fs_get_meta_page(struct f2fs_sb_info *sbi, pgoff_t index); struct page *f2fs_get_meta_page_retry(struct f2fs_sb_info *sbi, pgoff_t index); --- a/fs/f2fs/super.c +++ b/fs/f2fs/super.c @@ -1637,9 +1637,8 @@ static int f2fs_freeze(struct super_bloc if (is_sbi_flag_set(F2FS_SB(sb), SBI_IS_DIRTY)) return -EINVAL; - /* ensure no checkpoint required */ - if (!llist_empty(&F2FS_SB(sb)->cprc_info.issue_list)) - return -EINVAL; + /* Let's flush checkpoints and stop the thread. */ + f2fs_flush_ckpt_thread(F2FS_SB(sb)); /* to avoid deadlock on f2fs_evict_inode->SB_FREEZE_FS */ set_sbi_flag(F2FS_SB(sb), SBI_IS_FREEZING); From patchwork Sat Oct 22 07:19: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: 7191 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1089383wrr; Sat, 22 Oct 2022 00:43:07 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6g/TiZ1+4LKWF8Yi1Hk1aqoOCJrhL70oDydE0fKmYgiu/KTMYhq19i7YGhaKPVkqDUgfsZ X-Received: by 2002:a63:e755:0:b0:46e:c2ac:5fd1 with SMTP id j21-20020a63e755000000b0046ec2ac5fd1mr4782333pgk.184.1666424586778; Sat, 22 Oct 2022 00:43:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666424586; cv=none; d=google.com; s=arc-20160816; b=RACU3KoOUOZT7kS0AUgzcbjzAAH3ZiPYQWzPz58fATPvLi0DoIDR/1p4EIRyIZHXX2 SkSpxT1wondvR+EjJZnGKJe+CL7Oa7S+v+LkuTq7y6LatYgQlXmyhY9K1QxlTmPt4rkG UuJNrqnq9tfun4yWyahmmJatvTWijORQwDXtUAU20iwxSXXxyHHgSTw8FKAYQI7dj5mr MBNnmLxzQfweaeV8bME7CpAv3W0APqJS0MRE7iRf67YIEGMcPqVmmwVImMjikplRr4MB X/q9rXapoJ57+mgjqzIfcmq8rKjoRzIUtVwTP9Yimp1d9ymyIJiNyq2zdvhDsJeSbOhj RpmQ== 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=i09F9aK61i18uWrWDv3q6OXvh4OA70meTBawwoC0/9Q=; b=sHZszs3SVYTjMak4iTR0nxOpzkLe9jC3csfPAhKromVhqL3bU6DcEyXipiIE5PwFx1 Ui4hn/5jgAcLKNfYsy2zE7lZyzFTQPtOxC4UBtX9sv9jW/RBEQ7GnddcycWKtNA6myHJ j3eK301pKTzfKKR8O0KoFgcEMq4YIFS9pQqsb3rqxQ45TfwC1fExcExkeOiGYW4IJWEk OBsfsYxGr/QeREYZqpALlUcQwF1AMcrw7+6z/QkrYaIO+lxHEMPh+disZttXcnavv5wt PvJbdFzb6CP4cyqzFn0dHsVrhrKdCBRNuPwAY78kZlf9rMji9axSGvzYgJFT9oUUx3cl 9wEA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=GlhTD63G; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 y31-20020a056a00181f00b00562a1693523si28846156pfa.20.2022.10.22.00.42.54; Sat, 22 Oct 2022 00:43: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=GlhTD63G; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231261AbiJVHmi (ORCPT + 99 others); Sat, 22 Oct 2022 03:42:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44772 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231139AbiJVHlz (ORCPT ); Sat, 22 Oct 2022 03:41:55 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AEF55EF5B6; Sat, 22 Oct 2022 00:40: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 3E18AB82E01; Sat, 22 Oct 2022 07:39:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 87438C433D6; Sat, 22 Oct 2022 07:39:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424356; bh=LUCqnL0CpNQQy7m2QqQFuPp6xdW28Ne5xn1QZwADrrY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GlhTD63GR/dN/saezdaWREv9yiwUnHW3BSxEmj1lur/TJG0J6X0xCnyTj7jMM9Qr5 dTTPjea/6ykYVQtq3O7z83+epPzz2F9i25aUKd2CTqbfF6rDPn7K53XRRVehjFOsiJ HK/m7F2dUvNWOgzAcsad26POhjCUpKQVvRdaKZ4Y= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Aran Dalton , Chao Yu , Jaegeuk Kim Subject: [PATCH 5.19 115/717] f2fs: increase the limit for reserve_root Date: Sat, 22 Oct 2022 09:19:54 +0200 Message-Id: <20221022072435.740997775@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747372827561719193?= X-GMAIL-MSGID: =?utf-8?q?1747372827561719193?= From: Jaegeuk Kim commit da35fe96d12d15779f3cb74929b7ed03941cf983 upstream. This patch increases the threshold that limits the reserved root space from 0.2% to 12.5% by using simple shift operation. Typically Android sets 128MB, but if the storage capacity is 32GB, 0.2% which is around 64MB becomes too small. Let's relax it. Cc: stable@vger.kernel.org Reported-by: Aran Dalton Reviewed-by: Chao Yu Signed-off-by: Jaegeuk Kim Signed-off-by: Greg Kroah-Hartman --- fs/f2fs/super.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/fs/f2fs/super.c +++ b/fs/f2fs/super.c @@ -298,10 +298,10 @@ static void f2fs_destroy_casefold_cache( static inline void limit_reserve_root(struct f2fs_sb_info *sbi) { - block_t limit = min((sbi->user_block_count << 1) / 1000, + block_t limit = min((sbi->user_block_count >> 3), sbi->user_block_count - sbi->reserved_blocks); - /* limit is 0.2% */ + /* limit is 12.5% */ if (test_opt(sbi, RESERVE_ROOT) && F2FS_OPTION(sbi).root_reserved_blocks > limit) { F2FS_OPTION(sbi).root_reserved_blocks = limit; From patchwork Sat Oct 22 07:19: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: 7222 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1090452wrr; Sat, 22 Oct 2022 00:47:10 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4Qj+DMHOX8BMLgcSeSqRkc5TJNor93ADSlbwV/PoE0LRfN6nyVIuNC+TYz/hZdK3Q8C4Fk X-Received: by 2002:a63:fb53:0:b0:46e:e210:f026 with SMTP id w19-20020a63fb53000000b0046ee210f026mr608547pgj.29.1666424830443; Sat, 22 Oct 2022 00:47:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666424830; cv=none; d=google.com; s=arc-20160816; b=ds1QyJz1dnfyaoP8IMqQKOn6BLgVkCagoGueITi+zRzQUwG57iTXmaqTIZBVLBvrgw E0kZ6Jy8IGi9eSze7Np8P4DpDuTO+N1r5Q2xQvbXc1hx9uRyEnr7wxrTxGR8zAx79WQ6 vQk4u+8bVtX6Z/zYEd+4HqKIiVblzdzpiCMvWUdM3xeKUmmNIsJK1TMfWQzStmuGIg1U 0HQzTTLC9Pa9D8VTSGlfzfZxs7WnHQwG1PI38jbS71tRsvz3Pxz14P4nL6oSWq1V2Hkg NqvrdqBat1olJXl7WGlRpbrALERsMkpMYpy7fpLAiqDpguBji0w9EeMsoYk9F3TecVg+ sCcA== 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=Z1LUxC1GxUaLN1WsJpGAHofNiM0KrFEAwdXfQsI0wS0=; b=RLhH3ifK/Jt2gw5bCyyCR+i5nuzlvAw7t5BE75OqOp6YJ88+hdZ0FpZKW5+4FcLO2F 31yFvkzcdvG3nAeDBPhSYZFzEvSLegNAtX80ZH5rbFdKQfjNRqSl5trAcpJsvlqxL22R kQanLQab8ugzJ0+QenGEOF2OwlUwy7dZQRGc5ssT8x4JOWX/jPI127Sd2RpY7lvVIGIe F19zG12rVKjeEPDslqay1lGpupaNv6EQJ84u6QqaMMmasi+P4kQ2CsMv2vAxNMcm10ds N3a5VNML/KYdMhX5SG9bPuKMCXy2fnQ/B7f3xgbOFTMUzGGkCoC4CNa+OXyVkr4XTsFK TCyA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=HSrupPQb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 l4-20020a170902f68400b001746ff6ee6dsi21727316plg.413.2022.10.22.00.46.57; Sat, 22 Oct 2022 00:47: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=HSrupPQb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231162AbiJVHqm (ORCPT + 99 others); Sat, 22 Oct 2022 03:46:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45922 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231598AbiJVHoh (ORCPT ); Sat, 22 Oct 2022 03:44: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 5BF742A9355; Sat, 22 Oct 2022 00:43: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 0C23160B3D; Sat, 22 Oct 2022 07:39:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1D944C433C1; Sat, 22 Oct 2022 07:39:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424359; bh=DGwsmplE8Vkby6OIoLLT0zxoXaCbmjiNeby20xr9kEg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HSrupPQbIBK4us2n5dtjSvSxIoKYZsTJOG7EZATQT57v9gAuh7ZpI8zPV8iUa13ZQ iJI5tw3uty1MdsEwZqD5zvvv58SY/EXOkF2SuUfVD/me88wwdoOLUnqH+GWm957GXL P0P/Vw8MIKb96KRjv7eTsssFxaoFa14DhfJN3plE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Wenqing Liu , Chao Yu , Jaegeuk Kim Subject: [PATCH 5.19 116/717] f2fs: fix to do sanity check on destination blkaddr during recovery Date: Sat, 22 Oct 2022 09:19:55 +0200 Message-Id: <20221022072435.970907619@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747373082907646838?= X-GMAIL-MSGID: =?utf-8?q?1747373082907646838?= From: Chao Yu commit 0ef4ca04a3f9223ff8bc440041c524b2123e09a3 upstream. As Wenqing Liu reported in bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=216456 loop5: detected capacity change from 0 to 131072 F2FS-fs (loop5): recover_inode: ino = 6, name = hln, inline = 1 F2FS-fs (loop5): recover_data: ino = 6 (i_size: recover) err = 0 F2FS-fs (loop5): recover_inode: ino = 6, name = hln, inline = 1 F2FS-fs (loop5): recover_data: ino = 6 (i_size: recover) err = 0 F2FS-fs (loop5): recover_inode: ino = 6, name = hln, inline = 1 F2FS-fs (loop5): recover_data: ino = 6 (i_size: recover) err = 0 F2FS-fs (loop5): Bitmap was wrongly set, blk:5634 ------------[ cut here ]------------ WARNING: CPU: 3 PID: 1013 at fs/f2fs/segment.c:2198 RIP: 0010:update_sit_entry+0xa55/0x10b0 [f2fs] Call Trace: f2fs_do_replace_block+0xa98/0x1890 [f2fs] f2fs_replace_block+0xeb/0x180 [f2fs] recover_data+0x1a69/0x6ae0 [f2fs] f2fs_recover_fsync_data+0x120d/0x1fc0 [f2fs] f2fs_fill_super+0x4665/0x61e0 [f2fs] mount_bdev+0x2cf/0x3b0 legacy_get_tree+0xed/0x1d0 vfs_get_tree+0x81/0x2b0 path_mount+0x47e/0x19d0 do_mount+0xce/0xf0 __x64_sys_mount+0x12c/0x1a0 do_syscall_64+0x38/0x90 entry_SYSCALL_64_after_hwframe+0x63/0xcd If we enable CONFIG_F2FS_CHECK_FS config, it will trigger a kernel panic instead of warning. The root cause is: in fuzzed image, SIT table is inconsistent with inode mapping table, result in triggering such warning during SIT table update. This patch introduces a new flag DATA_GENERIC_ENHANCE_UPDATE, w/ this flag, data block recovery flow can check destination blkaddr's validation in SIT table, and skip f2fs_replace_block() to avoid inconsistent status. Cc: stable@vger.kernel.org Reported-by: Wenqing Liu Signed-off-by: Chao Yu Signed-off-by: Jaegeuk Kim Signed-off-by: Greg Kroah-Hartman --- fs/f2fs/checkpoint.c | 10 +++++++++- fs/f2fs/f2fs.h | 4 ++++ fs/f2fs/recovery.c | 8 ++++++++ 3 files changed, 21 insertions(+), 1 deletion(-) --- a/fs/f2fs/checkpoint.c +++ b/fs/f2fs/checkpoint.c @@ -140,7 +140,7 @@ static bool __is_bitmap_valid(struct f2f unsigned int segno, offset; bool exist; - if (type != DATA_GENERIC_ENHANCE && type != DATA_GENERIC_ENHANCE_READ) + if (type == DATA_GENERIC) return true; segno = GET_SEGNO(sbi, blkaddr); @@ -148,6 +148,13 @@ static bool __is_bitmap_valid(struct f2f se = get_seg_entry(sbi, segno); exist = f2fs_test_bit(offset, se->cur_valid_map); + if (exist && type == DATA_GENERIC_ENHANCE_UPDATE) { + f2fs_err(sbi, "Inconsistent error blkaddr:%u, sit bitmap:%d", + blkaddr, exist); + set_sbi_flag(sbi, SBI_NEED_FSCK); + return exist; + } + if (!exist && type == DATA_GENERIC_ENHANCE) { f2fs_err(sbi, "Inconsistent error blkaddr:%u, sit bitmap:%d", blkaddr, exist); @@ -185,6 +192,7 @@ bool f2fs_is_valid_blkaddr(struct f2fs_s case DATA_GENERIC: case DATA_GENERIC_ENHANCE: case DATA_GENERIC_ENHANCE_READ: + case DATA_GENERIC_ENHANCE_UPDATE: if (unlikely(blkaddr >= MAX_BLKADDR(sbi) || blkaddr < MAIN_BLKADDR(sbi))) { f2fs_warn(sbi, "access invalid blkaddr:%u", --- a/fs/f2fs/f2fs.h +++ b/fs/f2fs/f2fs.h @@ -266,6 +266,10 @@ enum { * condition of read on truncated area * by extent_cache */ + DATA_GENERIC_ENHANCE_UPDATE, /* + * strong check on range and segment + * bitmap for update case + */ META_GENERIC, }; --- a/fs/f2fs/recovery.c +++ b/fs/f2fs/recovery.c @@ -698,6 +698,14 @@ retry_prev: goto err; } + if (f2fs_is_valid_blkaddr(sbi, dest, + DATA_GENERIC_ENHANCE_UPDATE)) { + f2fs_err(sbi, "Inconsistent dest blkaddr:%u, ino:%lu, ofs:%u", + dest, inode->i_ino, dn.ofs_in_node); + err = -EFSCORRUPTED; + goto err; + } + /* write dummy data page */ f2fs_replace_block(sbi, &dn, src, dest, ni.version, false, false); From patchwork Sat Oct 22 07:19: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: 7458 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1098746wrr; Sat, 22 Oct 2022 01:11:38 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6ZW+TcyoUAcpKVfUnYZ9wgebQnGuhlYThCAcHfKn9xqZ2nz6yI90NZWzIYhtM/BXMP3a/F X-Received: by 2002:a63:1e0f:0:b0:44b:796c:bc14 with SMTP id e15-20020a631e0f000000b0044b796cbc14mr19030366pge.563.1666426297768; Sat, 22 Oct 2022 01:11:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666426297; cv=none; d=google.com; s=arc-20160816; b=wugCtT4Q38dK2Eqo7QqeWzUJQHcGWqGTt7cnRm2N763RBU5pvW4M9O4zyyadevLWVl gOqDx9yxtIaYHFI7egxMxzq4v6plUCyFwonR4JrdCJHEOsatqFxatPs8P8uV+CZ6xb9+ 9gxRRR8IdUrkG4rrxEbrcXuxK/hWyfa70zlhEBkvYVUq/yL4M6Ml+XiaMq/8porMVPRo +6BZ5cWsPf6mK4rCavaCa9OsEdahii9hdotYAF6eQ3MLZWiq8Fk3tOg5b7hf96vr8sH+ iP0mpuRbBwX05j2SfDvW2VzdJ0fLnBJlRkcguNyPUUUJ0E/w7srz3JlPT7c4JWorKCdH VvWA== 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=eULPQN30CZEmq8ui2V+yL93Ok2SbLiSsDZ6iuM/Gkgc=; b=XcZRjihwwpUjzhb77JzkZwXjuUvUivr87rwaOa0h5K4ysV1e0MnpwH51O21Ly+SIim jnE9QoBR1tri/EoUjDafDv69sgX3RIMYXFokKdTrnfeu92FvM5YZTOuhjSlw85u40e8C heZpRWFPu0ONxf7M5PPa6YZfRZ78WwJGHSwqQFLS0vfsJWuqDsEukV+XHmXU05BF6f1U OKcfqrm3MBrakTpiUzUqekCSTymttigJ1pCf02otwm+l1BaptfjAiO18I3ksLVnz0dkr MZZFKV02dUsPhZiN9UUazrWEqjYWPVXnYmskrvqha1hXm6t8dq3KwIIZdXmzwAj1PRYT U3ZA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="tln/kr5d"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 oc11-20020a17090b1c0b00b0020291c96b13si10078106pjb.121.2022.10.22.01.11.25; Sat, 22 Oct 2022 01:11: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="tln/kr5d"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S233131AbiJVIKt (ORCPT + 99 others); Sat, 22 Oct 2022 04:10:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60050 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232771AbiJVIHp (ORCPT ); Sat, 22 Oct 2022 04:07:45 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 999BB2D6576; Sat, 22 Oct 2022 00:53: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 dfw.source.kernel.org (Postfix) with ESMTPS id A450C60B30; Sat, 22 Oct 2022 07:39:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B6D22C433C1; Sat, 22 Oct 2022 07:39:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424362; bh=FKcer7iqG3pjjh8Mqy7mqnp9+S4lrlnqwhK1fOOY7P4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tln/kr5dWVL/gqf07W9jxY+ohl5SHhaQtuZxCM4LaLTcSleVKX3TGa4qlZh2K7Z+X wpbSLyJbxmhLo8FC/fYLewQDBL7iKBxTY8zn7zkTEdfmpq1pH5PV7X9yOc00yXxluL tENQoWLUyyMWIJUxl6qNDzAUOOziO4c+5mxefoj0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Wenqing Liu , Chao Yu , Jaegeuk Kim Subject: [PATCH 5.19 117/717] f2fs: fix to do sanity check on summary info Date: Sat, 22 Oct 2022 09:19:56 +0200 Message-Id: <20221022072436.134372033@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747374621303277938?= X-GMAIL-MSGID: =?utf-8?q?1747374621303277938?= From: Chao Yu commit c6ad7fd16657ebd34a87a97d9588195aae87597d upstream. As Wenqing Liu reported in bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=216456 BUG: KASAN: use-after-free in recover_data+0x63ae/0x6ae0 [f2fs] Read of size 4 at addr ffff8881464dcd80 by task mount/1013 CPU: 3 PID: 1013 Comm: mount Tainted: G W 6.0.0-rc4 #1 Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.15.0-1 04/01/2014 Call Trace: dump_stack_lvl+0x45/0x5e print_report.cold+0xf3/0x68d kasan_report+0xa8/0x130 recover_data+0x63ae/0x6ae0 [f2fs] f2fs_recover_fsync_data+0x120d/0x1fc0 [f2fs] f2fs_fill_super+0x4665/0x61e0 [f2fs] mount_bdev+0x2cf/0x3b0 legacy_get_tree+0xed/0x1d0 vfs_get_tree+0x81/0x2b0 path_mount+0x47e/0x19d0 do_mount+0xce/0xf0 __x64_sys_mount+0x12c/0x1a0 do_syscall_64+0x38/0x90 entry_SYSCALL_64_after_hwframe+0x63/0xcd The root cause is: in fuzzed image, SSA table is corrupted: ofs_in_node is larger than ADDRS_PER_PAGE(), result in out-of-range access on 4k-size page. - recover_data - do_recover_data - check_index_in_prev_nodes - f2fs_data_blkaddr This patch adds sanity check on summary info in recovery and GC flow in where the flows rely on them. After patch: [ 29.310883] F2FS-fs (loop0): Inconsistent ofs_in_node:65286 in summary, ino:0, nid:6, max:1018 Cc: stable@vger.kernel.org Reported-by: Wenqing Liu Signed-off-by: Chao Yu Signed-off-by: Jaegeuk Kim Signed-off-by: Greg Kroah-Hartman --- fs/f2fs/gc.c | 10 +++++++++- fs/f2fs/recovery.c | 15 ++++++++++++--- 2 files changed, 21 insertions(+), 4 deletions(-) --- a/fs/f2fs/gc.c +++ b/fs/f2fs/gc.c @@ -1075,7 +1075,7 @@ static bool is_alive(struct f2fs_sb_info { struct page *node_page; nid_t nid; - unsigned int ofs_in_node; + unsigned int ofs_in_node, max_addrs; block_t source_blkaddr; nid = le32_to_cpu(sum->nid); @@ -1101,6 +1101,14 @@ static bool is_alive(struct f2fs_sb_info return false; } + max_addrs = IS_INODE(node_page) ? DEF_ADDRS_PER_INODE : + DEF_ADDRS_PER_BLOCK; + if (ofs_in_node >= max_addrs) { + f2fs_err(sbi, "Inconsistent ofs_in_node:%u in summary, ino:%u, nid:%u, max:%u", + ofs_in_node, dni->ino, dni->nid, max_addrs); + return false; + } + *nofs = ofs_of_node(node_page); source_blkaddr = data_blkaddr(NULL, node_page, ofs_in_node); f2fs_put_page(node_page, 1); --- a/fs/f2fs/recovery.c +++ b/fs/f2fs/recovery.c @@ -474,7 +474,7 @@ static int check_index_in_prev_nodes(str struct dnode_of_data tdn = *dn; nid_t ino, nid; struct inode *inode; - unsigned int offset; + unsigned int offset, ofs_in_node, max_addrs; block_t bidx; int i; @@ -501,15 +501,24 @@ static int check_index_in_prev_nodes(str got_it: /* Use the locked dnode page and inode */ nid = le32_to_cpu(sum.nid); + ofs_in_node = le16_to_cpu(sum.ofs_in_node); + + max_addrs = ADDRS_PER_PAGE(dn->node_page, dn->inode); + if (ofs_in_node >= max_addrs) { + f2fs_err(sbi, "Inconsistent ofs_in_node:%u in summary, ino:%lu, nid:%u, max:%u", + ofs_in_node, dn->inode->i_ino, nid, max_addrs); + return -EFSCORRUPTED; + } + if (dn->inode->i_ino == nid) { tdn.nid = nid; if (!dn->inode_page_locked) lock_page(dn->inode_page); tdn.node_page = dn->inode_page; - tdn.ofs_in_node = le16_to_cpu(sum.ofs_in_node); + tdn.ofs_in_node = ofs_in_node; goto truncate_out; } else if (dn->nid == nid) { - tdn.ofs_in_node = le16_to_cpu(sum.ofs_in_node); + tdn.ofs_in_node = ofs_in_node; goto truncate_out; } From patchwork Sat Oct 22 07:19: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: 7833 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1150274wrr; Sat, 22 Oct 2022 03:57:28 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5CjVMGWAQDPpmMeksFoueQG2zLGsb8hbIlQAPM2JYdpobwqrYiJbI3RuE/9IhiF+ncVJuV X-Received: by 2002:a05:6402:c4d:b0:457:99ec:1837 with SMTP id cs13-20020a0564020c4d00b0045799ec1837mr21418826edb.86.1666436247966; Sat, 22 Oct 2022 03:57:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666436247; cv=none; d=google.com; s=arc-20160816; b=h6Ue3MEfbrILLz1iMOpYVwQaL9aWUjEj9R1vpaMasKUzoPwbEiTPgjFl9ycARNff0b Ss82alp2oTcFjWbhmITDNn44gVdlLvrcZLheJAoqLh5eePZO/vg3OwgogrJHvw9ex4ut WdTilW5frKdUnKqd6aCDpJwKRPW77CREIV6pW9P+y5dn+QnYMhC1f4PmxKdlhRL9f1qJ YflKPHfIa+jttO0BCS6xL4ObxlvW51x6mZE1zLwzF5PoNzlcm/hSsGCOKtb51YfYkED0 ZZWBQfRcHgIqswTUbpbGkpTa4DymCB33WfqLZnul2BAK+c/LAyK5Y55MDvN5CVJA5+42 CumA== 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=/ALK7Sz9ovxgnCUBKau6ehXDCCAg6GA5X/r3UhmtKFQ=; b=OGhNQI1rKWXDRXDbotxF1SRuDsiZHYV3oRmtySPyKRKN2uKLDdBD2Vdgz5lZaYcvBf QNQpiiVIaS2N6to/cz4KIMZuF9KF2ow0v8FfxzwWbaQaCn8dAI+lY1t7vfgp++ZrlPMB KX3BUP+iOOjB642c4j6Kh3emm1Il6L7WMZzrnjkaf8o8Tn8VBB6NZ/SwGntB45raSvtf Yv/nBucUHx2LaWAwJifdrihKjGHgSAZ/3fJYH2HAUqVLCrtbnLPZeUXQN8cFEuZgoF8Q q/gJKEHbgr8p7SQIL666LV2XeyqOTGjYrISOzdx387HkV6zY2UkgRDfqcYxdZVRXgwik Krgw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=1DLftlsd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 u12-20020a170906b10c00b00787abcb1ce0si20961077ejy.679.2022.10.22.03.57.03; Sat, 22 Oct 2022 03:57: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=1DLftlsd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S230010AbiJVKsG (ORCPT + 99 others); Sat, 22 Oct 2022 06:48:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33266 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230242AbiJVKrs (ORCPT ); Sat, 22 Oct 2022 06:47:48 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4AE4F2B7326; Sat, 22 Oct 2022 03:05:25 -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 sin.source.kernel.org (Postfix) with ESMTPS id 908E1CE2CA9; Sat, 22 Oct 2022 07:39:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6C209C433C1; Sat, 22 Oct 2022 07:39:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424364; bh=ShO28mfr568YysBoAVb2B7fppYLdFHUTzMnQl/bF2BE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1DLftlsd54Nl1s+BNpUd3FEbs5D6BUwbZQ+lbH4Dx7FDxW8AcdMrJTPrM/way3LD0 +ksluEFnZANYTBTCasJHQ4mpIQU0AoDrgQDvJ69lJA/fw7D2aH5CxrL0jWBNFzlLMx GLDOWXFyY9RhAEjxH4ys06saTKtnmT40QlIZCNNc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, stable@kernel.org, Alexey Lyashkov , "Ritesh Harjani (IBM)" , Theodore Tso Subject: [PATCH 5.19 118/717] jbd2: wake up journal waiters in FIFO order, not LIFO Date: Sat, 22 Oct 2022 09:19:57 +0200 Message-Id: <20221022072436.348390186@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 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?1747385054982851605?= X-GMAIL-MSGID: =?utf-8?q?1747385054982851605?= From: Andrew Perepechko commit 34fc8768ec6089565d6d73bad26724083cecf7bd upstream. LIFO wakeup order is unfair and sometimes leads to a journal user not being able to get a journal handle for hundreds of transactions in a row. FIFO wakeup can make things more fair. Cc: stable@kernel.org Signed-off-by: Alexey Lyashkov Reviewed-by: Ritesh Harjani (IBM) Link: https://lore.kernel.org/r/20220907165959.1137482-1-alexey.lyashkov@gmail.com Signed-off-by: Theodore Ts'o Signed-off-by: Greg Kroah-Hartman --- fs/jbd2/commit.c | 2 +- fs/jbd2/transaction.c | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) --- a/fs/jbd2/commit.c +++ b/fs/jbd2/commit.c @@ -570,7 +570,7 @@ void jbd2_journal_commit_transaction(jou journal->j_running_transaction = NULL; start_time = ktime_get(); commit_transaction->t_log_start = journal->j_head; - wake_up(&journal->j_wait_transaction_locked); + wake_up_all(&journal->j_wait_transaction_locked); write_unlock(&journal->j_state_lock); jbd_debug(3, "JBD2: commit phase 2a\n"); --- a/fs/jbd2/transaction.c +++ b/fs/jbd2/transaction.c @@ -168,7 +168,7 @@ static void wait_transaction_locked(jour int need_to_start; tid_t tid = journal->j_running_transaction->t_tid; - prepare_to_wait(&journal->j_wait_transaction_locked, &wait, + prepare_to_wait_exclusive(&journal->j_wait_transaction_locked, &wait, TASK_UNINTERRUPTIBLE); need_to_start = !tid_geq(journal->j_commit_request, tid); read_unlock(&journal->j_state_lock); @@ -194,7 +194,7 @@ static void wait_transaction_switching(j read_unlock(&journal->j_state_lock); return; } - prepare_to_wait(&journal->j_wait_transaction_locked, &wait, + prepare_to_wait_exclusive(&journal->j_wait_transaction_locked, &wait, TASK_UNINTERRUPTIBLE); read_unlock(&journal->j_state_lock); /* @@ -920,7 +920,7 @@ void jbd2_journal_unlock_updates (journa write_lock(&journal->j_state_lock); --journal->j_barrier_count; write_unlock(&journal->j_state_lock); - wake_up(&journal->j_wait_transaction_locked); + wake_up_all(&journal->j_wait_transaction_locked); } static void warn_dirty_buffer(struct buffer_head *bh) From patchwork Sat Oct 22 07:19:58 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 7504 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1104955wrr; Sat, 22 Oct 2022 01:33:46 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5F+bBmhizrplZv4Nojdmypxw8+/sOS7+u1aP2UqfxwPmkk/bDYJWo9R07sXtHSa9IzKOzG X-Received: by 2002:a17:907:2bec:b0:78d:8bd0:61ee with SMTP id gv44-20020a1709072bec00b0078d8bd061eemr19772789ejc.669.1666427626736; Sat, 22 Oct 2022 01:33:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666427626; cv=none; d=google.com; s=arc-20160816; b=zAHGYiRsW96BIA/GRBFUsWu4VjbxSwHgyFn5Pb6NE6vuFuR1zO2PtbZoutgKWoFNYF eadxOCnCUgqpIfy47lRtRIScfblFEXiVR4ogX3QgXBcbIMfG6/VuoYHh+oQNsQ2CP0ap HLLq4INiyn+Uq0VwvatV8tVGsYfCQME13vmgsQY5ZQxlZyl+KXkyD9R+NB/JupXZRviC Lxc8V29a/0f6CDxDfIUBrZbV7wfZDfYWdYa/gd1Vlr0Ghv0r5VKDdUciRW77m1Bi5kk7 /XtrmZlhJeuNIUUb0VgRDS9r9eHg7D41eJXLnjoHolN9ud9CaTDctSPP4bZbhl2iC3m1 CSnQ== 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=RNagROcgDu/dojmhtOodwK0ZsOBRZMRPNP/q9GWLOQE=; b=ktHdrEHAef5ljSnOkwDQEwHvycPE5s+Nv5gu05VY4lK8pXcafL/ESqfmYRB71ZnWAs NzN257p+8zcRo5Omp47MPZvEJNAxJtBORrLOilMpYLjD3ZXntLYfrpPBDsihKjKXTAEJ mkLGARZpfL3ytUYejX/0D+pHTtqVwxKITTUjUPtHAYu08t/xh3tXYaiY1AYU3SoD/TUc ln6w8blJxq1sRRfVRVhkhFTfRLDlUHPsAtkmHveIXQwc0D/qhcbT8jqBeI3d4pGDigUu HfCuC1UGi4q6Ezg8LeI8wyhD9O9edZW6rZKNp5YhVK4ClL1UdwJa1N8QLpK/Mh+MixEc 04Yg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=p2242QZP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 gb22-20020a170907961600b0072fc714c92fsi23793233ejc.902.2022.10.22.01.33.16; Sat, 22 Oct 2022 01:33: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=p2242QZP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S230100AbiJVIR5 (ORCPT + 99 others); Sat, 22 Oct 2022 04:17:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54234 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234025AbiJVIP5 (ORCPT ); Sat, 22 Oct 2022 04:15: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 4B5622DA77C; Sat, 22 Oct 2022 00:56: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 94C4CB82DFF; Sat, 22 Oct 2022 07:39:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 065A4C433C1; Sat, 22 Oct 2022 07:39:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424367; bh=YyovKfh64J2vVKnjYCaTUDTLnH484OFH/4MnSywZ+Mo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=p2242QZP4WJzOPLMT5AFAFHsbgA7MrV+TrPTlD6QFEYOicqW2DNKwJ6R0iBaZV6wy 0qO0qYJCSXTluvk+0aRNXNXtxb4i4iXryedgfkqAPDPBVBGqibu1kznTLG7TArrv1V R8gX6umqorGjdiwkCLe6JwCGY9RnhH0UkAan/qh8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, stable@kernel.org, Ye Bin , Jan Kara , Theodore Tso Subject: [PATCH 5.19 119/717] jbd2: fix potential buffer head reference count leak Date: Sat, 22 Oct 2022 09:19:58 +0200 Message-Id: <20221022072436.531163324@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376015029135457?= X-GMAIL-MSGID: =?utf-8?q?1747376015029135457?= From: Ye Bin commit e0d5fc7a6d80ac2406c7dfc6bb625201d0250a8a upstream. As in 'jbd2_fc_wait_bufs' if buffer isn't uptodate, will return -EIO without update 'journal->j_fc_off'. But 'jbd2_fc_release_bufs' will release buffer head from ‘j_fc_off - 1’ if 'bh' is NULL will terminal release which will lead to buffer head buffer head reference count leak. To solve above issue, update 'journal->j_fc_off' before return -EIO. Cc: stable@kernel.org Signed-off-by: Ye Bin Reviewed-by: Jan Kara Link: https://lore.kernel.org/r/20220914100812.1414768-2-yebin10@huawei.com Signed-off-by: Theodore Ts'o Signed-off-by: Greg Kroah-Hartman --- fs/jbd2/journal.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) --- a/fs/jbd2/journal.c +++ b/fs/jbd2/journal.c @@ -928,8 +928,14 @@ int jbd2_fc_wait_bufs(journal_t *journal wait_on_buffer(bh); put_bh(bh); journal->j_fc_wbuf[i] = NULL; - if (unlikely(!buffer_uptodate(bh))) + /* + * Update j_fc_off so jbd2_fc_release_bufs can release remain + * buffer head. + */ + if (unlikely(!buffer_uptodate(bh))) { + journal->j_fc_off = i; return -EIO; + } } return 0; From patchwork Sat Oct 22 07:19: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: 7240 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1091230wrr; Sat, 22 Oct 2022 00:49:55 -0700 (PDT) X-Google-Smtp-Source: AMsMyM61hmE0IkiSIAHQSCXuBGxboUQzQvVhJgfOZvRnErTxMVui2YfQSvO0R7wW2M0h0X1KlBLc X-Received: by 2002:a05:6a00:1488:b0:563:9d96:660f with SMTP id v8-20020a056a00148800b005639d96660fmr23252247pfu.0.1666424994914; Sat, 22 Oct 2022 00:49:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666424994; cv=none; d=google.com; s=arc-20160816; b=yT8q2xwqr5ugkkjzZ4d4D4l0G7jaNmYnDI1jL/H1RZAMSRCT0UXY4xGD+1kbeERmOz 3iLAeCcqzL3MvkZgwBVcOIjxED4XFYMEj/9AZfduUt0fjs8uyHq5+5ztKkjBo9GVj9i1 xl5BtaaKqKXbYlU2LFZ1CqSnxEaxPz73fIIJEecR359LuxV9zvDoEPBsFPgGTOSDIDOH Ljl3lq5RutTQLxOCQSnxjeRxi4QJG8Xu6lKkiR/UnMGlOhTHOe17trdrZnPjtFHw/YGj 3bvcPvUllM4DitHjbJSolQy8fB6UsLIYDf1Sqo10BevHYdjiZWqptxce/0ZaMVl9CkPb tiCg== 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=tiuMrmZuJFU9VY7nKf8ziLvyHCU1+6c2DpjDW1iAi/Q=; b=lZwbrjvY/WwTWzsOm8PxBYs9/2/9LRwZqpd11jhPw2Jnq/0jwMek4C+6Xvv7KRWrku gjRHwWV2VnHFg6MlpxkB67aOQ3eUSh9Qjdll6bZovViHUS4tHbKOF5h6oYAbq+rugetj 3NHUCXLiDeKzp7UjNPZYIirlQcH8lkCh0kO2QjkXq/W+yFWaZ8BEwHtN5jNn8v70rve1 X+RlQwm6QQ5APJAXXm4/fMv/lvKwqSmc73FSLL2XWkyp98IKctNm3ZWKhhxP/ZAi+g+8 ReqJ//VBokFCc4zjuwryRbiE9dNpzdSg3hY5uM7Fh5TcLVyltPfTGEQpksy1SZeSY3rm r0tA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=mjxEVSTR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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-20020a056a0024c800b005257035371bsi30023929pfv.108.2022.10.22.00.49.41; Sat, 22 Oct 2022 00:49: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=mjxEVSTR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231633AbiJVHsr (ORCPT + 99 others); Sat, 22 Oct 2022 03:48:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34298 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231552AbiJVHsM (ORCPT ); Sat, 22 Oct 2022 03:48: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 E7B8DCD5DC; Sat, 22 Oct 2022 00:45: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 9D8A560B24; Sat, 22 Oct 2022 07:39:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B0037C433C1; Sat, 22 Oct 2022 07:39:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424370; bh=AEncgBZqnzHKq0T0S/CKCWLF1y28DmqfUPSmO+kiz2U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mjxEVSTRQcHRN8JzjYmchhqtLKaTUB8nE3DlzCBYXxtGQi/3tNY2hYgN/3uUR/m5l O6x4xKQoZzgHkTr50FFj7f1J/4fCP7X2M5cjZhJjzu3vBqihhsOyk2w6i/3t6FUeIc Fi0/Tnuh/vtLmbjzp2LMt8OKAHALFqN4yeszTZc0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, stable@kernel.org, Ye Bin , Jan Kara , Theodore Tso Subject: [PATCH 5.19 120/717] jbd2: fix potential use-after-free in jbd2_fc_wait_bufs Date: Sat, 22 Oct 2022 09:19:59 +0200 Message-Id: <20221022072436.737549980@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747373255487510343?= X-GMAIL-MSGID: =?utf-8?q?1747373255487510343?= From: Ye Bin commit 243d1a5d505d0b0460c9af0ad56ed4a56ef0bebd upstream. In 'jbd2_fc_wait_bufs' use 'bh' after put buffer head reference count which may lead to use-after-free. So judge buffer if uptodate before put buffer head reference count. Cc: stable@kernel.org Signed-off-by: Ye Bin Reviewed-by: Jan Kara Link: https://lore.kernel.org/r/20220914100812.1414768-3-yebin10@huawei.com Signed-off-by: Theodore Ts'o Signed-off-by: Greg Kroah-Hartman --- fs/jbd2/journal.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) --- a/fs/jbd2/journal.c +++ b/fs/jbd2/journal.c @@ -926,16 +926,16 @@ int jbd2_fc_wait_bufs(journal_t *journal for (i = j_fc_off - 1; i >= j_fc_off - num_blks; i--) { bh = journal->j_fc_wbuf[i]; wait_on_buffer(bh); - put_bh(bh); - journal->j_fc_wbuf[i] = NULL; /* * Update j_fc_off so jbd2_fc_release_bufs can release remain * buffer head. */ if (unlikely(!buffer_uptodate(bh))) { - journal->j_fc_off = i; + journal->j_fc_off = i + 1; return -EIO; } + put_bh(bh); + journal->j_fc_wbuf[i] = NULL; } return 0; From patchwork Sat Oct 22 07:20: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: 7195 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1089517wrr; Sat, 22 Oct 2022 00:43:34 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7natU0oESq8YGgm8AreDbedbX5qnDF8AvObCj+2UMj7TCtwL5iYzGfGURxWQomr2upMXEN X-Received: by 2002:a17:90a:5915:b0:20a:d6d5:31bd with SMTP id k21-20020a17090a591500b0020ad6d531bdmr26530268pji.15.1666424603024; Sat, 22 Oct 2022 00:43:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666424603; cv=none; d=google.com; s=arc-20160816; b=q8w6wjVDhpCNnpn5Hw5dBZchai3NvZbOIieavmNzWXdCDyiUf4B3lCFxOcJJ7ExQjo ReOGCnREJr9+h/OPx6t2dKW2YVYAzMNHKMWPAy5xPzVJxhf4q8dbKTyhoLVu4rdQ5B3+ iER/yydhomK5yV5A9nYiwU+KEexcmRVdoKlmtgeU8o4Aajw708oJLX62benfDpWEeU+v 0DGwpkjiTlKBDPKj2FgUudD9+N6i3xFFZ1tEe5M4xJw+hI7tEUljK960stdA57mCxmSV f6qSK8uwKgTQe5CDvhBT9bICpDu4ZU2C0a0V3GBt2lhmIUDuozIrknddurw/KyGIUoTy C4YQ== 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+VM+zBZxb3Vn8CGSa1yNCzIUpKgdkvXVHvjiENLezo=; b=Vl2RN7bNoC5z48v7PPNxS+lhH0LCQEbT2lYQhxtZDcox2HnQuOAlBh6zhQPtslt3zD Qq4gHEhrG0eDjdfhiKdPsRz8BaDMGwoGQp1WHfFKBPlurdEa2w5mDCSc380WBQYz/Alg h+w9ZFrCW4No0Lu9d8PQgr7ypa0TrQkqQYZJzEMOLxXlDwrlLhznNmVfVKcosGamROdc yVYwH+bMy48q43sb4jT5rVixfMuDXjypdetL6Kjh5Zm9WiRf9HegYO/XxVArnqoH4ct6 gWr/OaxJga+rRUlulZ0Tcnvj+SYgqGaCefdWdD6a7Sgdv8FsuVPC58QQxpwjSaJ5dsKf xyHw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=rRS426XH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 ob15-20020a17090b390f00b00205b268cd58si2354835pjb.181.2022.10.22.00.43.11; Sat, 22 Oct 2022 00:43: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=rRS426XH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S230513AbiJVHmn (ORCPT + 99 others); Sat, 22 Oct 2022 03:42:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45862 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231144AbiJVHl5 (ORCPT ); Sat, 22 Oct 2022 03:41:57 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A8B8C15ECD8; Sat, 22 Oct 2022 00:40: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 D9F4FB82E04; Sat, 22 Oct 2022 07:39:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4C188C433D6; Sat, 22 Oct 2022 07:39:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424372; bh=uVz+BDY/wMcdakK3a2zAGCIAkzkiJQgDSwU4vNQtw5o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rRS426XHt2OZLw+Vi0xjGY+iRYU91EzEPTe5eFFuwtyRuw0PrYRcX4jaTdXq1SNyx hGkgys9Pd7HprdR3t8fd7bibipCftX4MD4fbg6Di0X9WAhIMIT9lo1vIhDrq03W/1J oTRLTRHL/ceWzsuDUp0q4QIQ4DQ2CFT1dc2Ars60= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, stable@kernel.org, Ye Bin , Jan Kara , Theodore Tso Subject: [PATCH 5.19 121/717] jbd2: add miss release buffer head in fc_do_one_pass() Date: Sat, 22 Oct 2022 09:20:00 +0200 Message-Id: <20221022072436.918799318@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747372844165058871?= X-GMAIL-MSGID: =?utf-8?q?1747372844165058871?= From: Ye Bin commit dfff66f30f66b9524b661f311bbed8ff3d2ca49f upstream. In fc_do_one_pass() miss release buffer head after use which will lead to reference count leak. Cc: stable@kernel.org Signed-off-by: Ye Bin Reviewed-by: Jan Kara Link: https://lore.kernel.org/r/20220917093805.1782845-1-yebin10@huawei.com Signed-off-by: Theodore Ts'o Signed-off-by: Greg Kroah-Hartman --- fs/jbd2/recovery.c | 1 + 1 file changed, 1 insertion(+) --- a/fs/jbd2/recovery.c +++ b/fs/jbd2/recovery.c @@ -256,6 +256,7 @@ static int fc_do_one_pass(journal_t *jou err = journal->j_fc_replay_callback(journal, bh, pass, next_fc_block - journal->j_fc_first, expected_commit_id); + brelse(bh); next_fc_block++; if (err < 0 || err == JBD2_FC_REPLAY_STOP) break; From patchwork Sat Oct 22 07:20: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: 7242 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1091257wrr; Sat, 22 Oct 2022 00:49:58 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5eLt/vUk7xyiVqkgdqXWGzjfmYHhfoK76ZjuUb4uePPOg44GslhWL+7WqgWsT7fnIzQXfh X-Received: by 2002:a17:90b:380b:b0:20b:8dd:4f5f with SMTP id mq11-20020a17090b380b00b0020b08dd4f5fmr63375438pjb.158.1666424998544; Sat, 22 Oct 2022 00:49:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666424998; cv=none; d=google.com; s=arc-20160816; b=oalMOjk7+N6XyESUj7L4CQLOzNODPn1/DywRpjK0DOQ2T1ayfrNPGKvQsOfofNW/0/ dgfQVJJjkFrW6Q3LFrGHYDAOvwUNHNP3ramNYye25XJfEyIZkHwHJb5AmGeWkqwzv0tU 49ljlRi7R+hMrZwo7RuhqrLCAsynA2nzbKkgND/mDL9mVf4ecgjRxLJlkuBCFEeQggE3 jJ3YruQp+rhNk18Prc33mLtQtWmEdCyZEg+ECm9B5aWnA6DQCik36iDucvfdyXa1tyUE os4ewN01kMMMJb6lZh1mF01OgTt7FJhN8GNK7NhEZdEa0/0+px4oSlt0hI/9bMK+ooSj nybg== 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=9AfLRHZtRj8pgRqcSvSLqpzbZSJTQsete1aWr5bu5XM=; b=VfvDxETIreegbPseFTMbfB6jWbTGWrpGs21a0r3eIX1DMuiKZNvQkHWdfKHrz0v7dk I74RuS+iIFuK9z0+kell8LwLcYEW1vrKGDx1RnbK9JA3pveELtwtP7UmyeCXokreVpDC UoRx5v5BkIVIExd+AsxjWKt4GRGlVlnG8fE7SniQgxSuxAIb/snLMON1gUPaWVrFWa9U RFkCmG3pkaeDKBd3Z4Ujcyp5PwXSqRgLiMn9o0DO/AVdVLAnZMY2eUHt1bBdgWdXobzU 5q1jhJd92eNdDQoZCMs/7re+Za7t1pRJz6SU+s3l70qbTCH75vuIjJQhW+kBfvToYCIS GjQw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=wojyhm6z; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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-20020a170902b08200b001747ed48ee8si24256767plr.150.2022.10.22.00.49.45; Sat, 22 Oct 2022 00:49: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=wojyhm6z; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231663AbiJVHs6 (ORCPT + 99 others); Sat, 22 Oct 2022 03:48:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34350 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231362AbiJVHsN (ORCPT ); Sat, 22 Oct 2022 03:48: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 124E1D03A8; Sat, 22 Oct 2022 00:45: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 D2C7B60B1A; Sat, 22 Oct 2022 07:39:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E841BC433D6; Sat, 22 Oct 2022 07:39:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424375; bh=JTa2qbkLTgeScZF6zKMRi8KfrP9jYtmRVYT8mvc0nDY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wojyhm6zr82CzO9sBrvipgtEMiZTSw1rOVFhTC3dBAGYDUhYRZhf7MYqr+oZgXUJG hZWHih0ch3raVnRBPixTvGUznrTi4DUqGE3YdPGnOc+UNng/5QFJiFpHkNDW2MrJwY uQIwrorEkP90nHcXjTQYGbisCqNqU+BJS44K0HIg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, syzbot+0f2f7e65a3007d39539f@syzkaller.appspotmail.com, Jan Kara , kernel test robot Subject: [PATCH 5.19 122/717] ext2: Add sanity checks for group and filesystem size Date: Sat, 22 Oct 2022 09:20:01 +0200 Message-Id: <20221022072437.081515062@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747373259353596331?= X-GMAIL-MSGID: =?utf-8?q?1747373259353596331?= From: Jan Kara commit d766f2d1e3e3bd44024a7f971ffcf8b8fbb7c5d2 upstream. Add sanity check that filesystem size does not exceed the underlying device size and that group size is big enough so that metadata can fit into it. This avoid trying to mount some crafted filesystems with extremely large group counts. Reported-by: syzbot+0f2f7e65a3007d39539f@syzkaller.appspotmail.com Reported-by: kernel test robot # Test fixup CC: stable@vger.kernel.org Signed-off-by: Jan Kara Signed-off-by: Greg Kroah-Hartman --- fs/ext2/super.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) --- a/fs/ext2/super.c +++ b/fs/ext2/super.c @@ -1053,6 +1053,13 @@ static int ext2_fill_super(struct super_ sbi->s_blocks_per_group); goto failed_mount; } + /* At least inode table, bitmaps, and sb have to fit in one group */ + if (sbi->s_blocks_per_group <= sbi->s_itb_per_group + 3) { + ext2_msg(sb, KERN_ERR, + "error: #blocks per group smaller than metadata size: %lu <= %lu", + sbi->s_blocks_per_group, sbi->s_inodes_per_group + 3); + goto failed_mount; + } if (sbi->s_frags_per_group > sb->s_blocksize * 8) { ext2_msg(sb, KERN_ERR, "error: #fragments per group too big: %lu", @@ -1066,9 +1073,14 @@ static int ext2_fill_super(struct super_ sbi->s_inodes_per_group); goto failed_mount; } + if (sb_bdev_nr_blocks(sb) < le32_to_cpu(es->s_blocks_count)) { + ext2_msg(sb, KERN_ERR, + "bad geometry: block count %u exceeds size of device (%u blocks)", + le32_to_cpu(es->s_blocks_count), + (unsigned)sb_bdev_nr_blocks(sb)); + goto failed_mount; + } - if (EXT2_BLOCKS_PER_GROUP(sb) == 0) - goto cantfind_ext2; sbi->s_groups_count = ((le32_to_cpu(es->s_blocks_count) - le32_to_cpu(es->s_first_data_block) - 1) / EXT2_BLOCKS_PER_GROUP(sb)) + 1; From patchwork Sat Oct 22 07:20: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: 7247 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1091352wrr; Sat, 22 Oct 2022 00:50:21 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6MUkZ5rO+ippYXiXQqKV/0PZg2Jk3zYFGF9FdN2RoIoX1hCcgGVe/GqMbFW0UOQgCC1gv9 X-Received: by 2002:a17:90b:1d0d:b0:20d:5c1c:5fbb with SMTP id on13-20020a17090b1d0d00b0020d5c1c5fbbmr62393298pjb.196.1666425021544; Sat, 22 Oct 2022 00:50:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666425021; cv=none; d=google.com; s=arc-20160816; b=EM+z1IhDpbHkS+mX7SZ+0U+oHUjDaQ/VMovtO87Ca24n4GKmQpu9x0Fu+WxYz01W0n ijoNcySjUBGRRqTrKk/0SXQAXa/U/XleeHAM5EYygoSLtSQ9bX9zZ5et5QNgtNnMnc7/ 8hWOYT194DF/PI6UmKm/v4HQ948JvjQXYKA0N5qOC1yxM51UG8/JY6rnJA2vwJBGXYiY NLhfsl7hsMyR6u4pyqYJ3cuW28V9txrvobmff0dcEOD13mlqhzOrWvAZsKJ3gd9MHVu7 Q36Hrl0o6+V+OT+jSRK8QeZ5lzgFd+EiisWmW32C+lxvJycL5AvSZYhZU+cBUU0NvhRS wCww== 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=m49jpakqcS+pMsfs+2HIGT8CfiFY26dem++jhC8McOw=; b=KXp2wIcoSaZKpLgcg2LqXhirLQ3d03zZ8KqvaiblP6fWfDYhDxNUkUzZKErUXm+rlc WgL3WBKNKzpDFQUwNW8sAHzgtdDlfdpgH2eue3WxyKb7ZXcd7QBjwFr5ZiiyC7eZmy4W 4A3Au3wFVFvuMRriMeqVkEYMBGcZxVW1D3zhh5GjlTpNe9yOfUBPh96XNoAxGniRAvjZ iKeMyUotxgQb29pwujI5kw2leAljGpq/KYI5DGOcXw+8tkrOzo8vwMFOPL1JlL51yNtf wImZaAAP221N0A5XLR5iwg+ck0hQ9x7dOGUL+C9U6Z6tfo+BwbXBJ/d+pXPugusvKh2D vNdg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=KCw6a0ya; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 rj11-20020a17090b3e8b00b0020f8385ca87si10381061pjb.94.2022.10.22.00.50.06; Sat, 22 Oct 2022 00:50: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=KCw6a0ya; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231758AbiJVHtF (ORCPT + 99 others); Sat, 22 Oct 2022 03:49:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34322 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231569AbiJVHsM (ORCPT ); Sat, 22 Oct 2022 03:48:12 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B15279F76D; Sat, 22 Oct 2022 00:45: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 dfw.source.kernel.org (Postfix) with ESMTPS id 976BB60B39; Sat, 22 Oct 2022 07:39:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A867AC433C1; Sat, 22 Oct 2022 07:39:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424378; bh=VuYyMPGk/XiYhf3Eu9DcvuFVQbCk7pNap3RucA1IkF0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KCw6a0yaCHk9vrhJH3ena1Fv9q2qyBDbQ4ywfL4oLEwFIs6dyZq/K+a2OkHoNhwFh sCm3eHIIStzsHjL8NH0JWWnmravFmRLffGMa6FD6R5fJw3IHub0KyBazxS7XYzakOe WeRQdKeE4711HG/4E32WYEpzuSgRfFDn3HE2Dg4c= 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 5.19 123/717] ext4: avoid crash when inline data creation follows DIO write Date: Sat, 22 Oct 2022 09:20:02 +0200 Message-Id: <20221022072437.268215448@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747373283812425143?= X-GMAIL-MSGID: =?utf-8?q?1747373283812425143?= 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 @@ -528,6 +528,12 @@ static ssize_t ext4_dio_write_iter(struc ret = -EAGAIN; goto out; } + /* + * 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); offset = iocb->ki_pos; count = ret; From patchwork Sat Oct 22 07:20: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: 7235 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1090821wrr; Sat, 22 Oct 2022 00:48:37 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5+QZC8pqISIyaJ/OA+4BFGCONO2ULP+5ibEgMWlkmN83M34EUdMKshpoF/G4TIX0DGiX69 X-Received: by 2002:a17:90a:2bc9:b0:212:8210:c92d with SMTP id n9-20020a17090a2bc900b002128210c92dmr13178067pje.38.1666424917573; Sat, 22 Oct 2022 00:48:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666424917; cv=none; d=google.com; s=arc-20160816; b=TWkk405RfkbFEddMiW54S1YfJqbhNiGgxPCvUryzU5hHNGDnKSFqRMZtxXY/4SAnjf Iy+6a9AknwTV/X5DRrLUz+xLmZM7691r0Ipld8jymq5Aj9wayvEbXj/XB933vAr6rPQS FlwSgdEhNQBGLfBKuJ/VlONn6BPZQnURnxfiRWrBsXsc3h3CK/+NhoO4UD61zB/Zm3dH pbwjN/1xVfxZEDfAqU4RA4NHJ4TTv/KtLx4i7GmFvU+XnSSS2T7GnX/U6yCNcZ8swtpD JzzERT/eTMgJLYhJ4pLXjpnpyjNOq35ZukiD9TAaNJsRIdlEoeAJdEOGKCwlzqlYBBIb lMKA== 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=4+raWCaszlUdsTJ4RnK+FXdhcGlLxtTl9Nu3upv688k=; b=j5Mj6VrfGy/kJSqklQPai443Xh2F6Ds+bKnH3aq6K3852pT65kP1RHgtVC0ilVhh7p XcMM3xey6ZIl3y9rViIkO0I4tXKhhI30/ueEmFi7NqQh/O+ebMaAFmukfFbM7f0ssICm atCkeeSqrNfhtD2UtAGmY0PPfT9ypBA60VA07jBZOTK7xUYBd53ujpVyufr/iMWo0/vp rjHpW87kWDgrXHYrdJNjZB13mu1E/Xg3TXziWlEiXeqhuoVkvVd62hf0PC/e48u304hk 5lz3MfDpe098uJFKjmD/qO/83eD7ycYDPVNcyLrpc15yubYCUhBRC+zUZMHcAli6OAX8 l34A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=yD20IUMB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 k14-20020a170902ce0e00b00176c9015627si27443656plg.94.2022.10.22.00.48.25; Sat, 22 Oct 2022 00:48: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=yD20IUMB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231473AbiJVHsD (ORCPT + 99 others); Sat, 22 Oct 2022 03:48:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38300 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231447AbiJVHrd (ORCPT ); Sat, 22 Oct 2022 03:47: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 A7B5D37F9F; Sat, 22 Oct 2022 00:44: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 481B860B3B; Sat, 22 Oct 2022 07:39:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 53BD5C433D6; Sat, 22 Oct 2022 07:39:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424380; bh=KR9RihcwnwYiB/HtvfaHbTy/ZWvpYl/I0Y7UHaFuZMM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=yD20IUMBy0D+apAlofvfXqx7NkgYcrZNg3nF38yBvFN+OBpK4Yd2hLZj3OQ1dY0mh xgG2eRwTEhuATXGLxauephhj+kdtO86J7BN+y8Yvi0Onyu0kIsVJL2TYSC2Oug+2q8 +d6/5G2ZzkQiIarzZVtVMwl1oX63U1tUcJ6UTuPI= 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 5.19 124/717] ext4: fix null-ptr-deref in ext4_write_info Date: Sat, 22 Oct 2022 09:20:03 +0200 Message-Id: <20221022072437.431554663@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747373174606656596?= X-GMAIL-MSGID: =?utf-8?q?1747373174606656596?= 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 @@ -6643,7 +6643,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 Sat Oct 22 07:20: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: 7283 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1092228wrr; Sat, 22 Oct 2022 00:53:27 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4TtY8q9zo/3c636yCpdzb2aHqll4PBUvxYUV0fmxWSjR5aFVV1EcL3BzDH2P296/cy8uCw X-Received: by 2002:aa7:84c1:0:b0:563:d2c:c37c with SMTP id x1-20020aa784c1000000b005630d2cc37cmr22550037pfn.24.1666425207209; Sat, 22 Oct 2022 00:53:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666425207; cv=none; d=google.com; s=arc-20160816; b=mhIZOhCAtsO5KORiAhC+z0Cid/xXVsYnstmbBfbK0MfREq6O0lKbl4BrJlH7PCWVHR a6BpuFtBXbFlZyVnS46kw03kYWP5D0PVWQzaDh7dCa8k9F8uaY3WJXZlTVysv/mfRTsf f+8kpGIj9iZPdrS10GGcfivAArioC+ZfJQVvDQ+6GjFQtW0U4jvvNFUBMgTSnoLlLVhq aLGsBoIWroQV+DEF3F1LMMDbW6bN85f5vE2ZDdofazt16ajaAJEZec9n0GliKVQiX5DZ If00YrKY2T/3KFnSJk1pfKumQmHzY9UNd2FUU7AYeYITDenE+a+TTIi/BetXDmkktz8l pFbA== 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=UUegYTILBeNMJePcZrN/m5Vkl9/l3KkjS/idS0p1nhg=; b=qVM7VBF1mDu6u12H3JRzCifXOMFzzaNzUCPAvtOH+BIpMVRzoaP1w/TIyR2nZoeP76 wUBv3aJlRUKoTXVLiadYsOrqRh0po1HyKkohhFtYSq3mnKKdTmNVo+KRAgqEB0jDtn50 h8XVm+wvlEYkJZIShWafuQi9aFxklN8Z4l3I1Ef5PcxlLzVIJtE3WASJGCpCCuayacCj EuhzETa04+i2Xp7aR8EKruN9VummYQIkEUqZlZJYt6GtM7uhn9ro2Ctl+6kbxoaQyahn kbuYLc54EY5KU0Nk/X+8h2lC9ld/k8hoZdjeX8hro8/SAEROE/QRqvBaxqfDuZmHGYaj yTVg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=UTV2Gidt; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 j18-20020a63ec12000000b0046ed62f820dsi2417865pgh.288.2022.10.22.00.53.15; Sat, 22 Oct 2022 00:53: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=UTV2Gidt; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231895AbiJVHw4 (ORCPT + 99 others); Sat, 22 Oct 2022 03:52:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56534 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231493AbiJVHtt (ORCPT ); Sat, 22 Oct 2022 03:49:49 -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 900092B76BA; Sat, 22 Oct 2022 00:46: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 97A9260B40; Sat, 22 Oct 2022 07:39:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AA4F7C433D6; Sat, 22 Oct 2022 07:39:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424386; bh=/T5WIT+OJWxhYMw+OGtb645cRypYMAjjAnkcyWWRik8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UTV2GidtferzF5sNR95OaZs0uODL6E+Kpu0A6yNQigSyrI3amz8WShpgWATxMk3Fu SjgE6ulTA2Q+G/XoE5/i1gh24CtjWu+EMMlK4cJ5kU4/TNJK7snspw5/VPScDCcINS stQhtY5Mztf9iArkQDS4sRg+IKfyJg7IFvf6s7e8= 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 5.19 125/717] ext4: make ext4_lazyinit_thread freezable Date: Sat, 22 Oct 2022 09:20:04 +0200 Message-Id: <20221022072437.577812816@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747373477903400039?= X-GMAIL-MSGID: =?utf-8?q?1747373477903400039?= 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 @@ -3758,6 +3758,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 Sat Oct 22 07:20: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: 7241 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1091231wrr; Sat, 22 Oct 2022 00:49:55 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4gwM9PrU+/xLaEjFTyzHeNVeCQLU8zi26rJ2emVFzI2gVkYVexs/oyVxtklM8QtRoa8exe X-Received: by 2002:a63:5063:0:b0:46e:cd36:ce0c with SMTP id q35-20020a635063000000b0046ecd36ce0cmr3846248pgl.617.1666424995241; Sat, 22 Oct 2022 00:49:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666424995; cv=none; d=google.com; s=arc-20160816; b=wrlRwlF9Z3Y/GW8Hd7KB8qu2vQ+Qop3oV2TTiBCKa0If3wxEos5r7UzKH1q2+xI2S+ 2pA8nUtcWfgaXg4e7GhrxjtCO05bMYqWrDOe4dwdumTxjoQZBOW7i5tIJ6mII+xO3A6x UI013o3qWqbya8BIUpg5Fr0WlWQtAedBRhOSOo+oHHJDVlF01RtkEc3F8qDEC1k+ID64 4l+Pmx1/frXrClShU4KIrsGVXmIHxBJ22nGSkAA8LZXr/QYH5ROQ+p+h85L/e5jmVx3g ijQ8Ybeibf7j5TJ84Z85gC6zi5BmAdqJvBkHKeFRHigT1W18doDiWmdAq4KWvnmdQLHm u5Jg== 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=do6Y+uq814wMAU3HzzFU+uzCSKN5Pu7AXEOOKnWguvw=; b=0Ay0AFzwO/sxVeXPB+CCsta566KKcq9dEe6QpLuX11vJ5eY/g95cWBQTdie6s+n969 rmVdLJp5BV6JaIGZZf8Y3wVJI1modJg5Rc2psCqqJ6I5GzlmeAqWHDGTBEzyfBnoAhVs QXtQmSdFpANDN+zZGYeCBPr8nAIdau4g6J/SGmz3JMVbO3UzHXZey/4nwkKFIFJxHBQQ HvuTuWHTBBb49CUitB+9N4CIgpZTIGkazMRN87rg98bZIQ4OyZ8X/r/18oi5nJRm/nCk Hr+VoaBHLYgEGsfj/j5QpsDcs5Wm/ItorynXcJelxJYOp+1mENgOBovbm/t2ep9NLXft latw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=WQIY5iPz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 11-20020a17090a194b00b001fdd4a9fd3fsi2208690pjh.146.2022.10.22.00.49.43; Sat, 22 Oct 2022 00:49: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=WQIY5iPz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231613AbiJVHsw (ORCPT + 99 others); Sat, 22 Oct 2022 03:48:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34328 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231575AbiJVHsN (ORCPT ); Sat, 22 Oct 2022 03:48: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 9158E8A6F0; Sat, 22 Oct 2022 00:45: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 39AE460B46; Sat, 22 Oct 2022 07:39:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4A433C433D6; Sat, 22 Oct 2022 07:39:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424388; bh=mGqmo0S/cZ1DZJ0WQ/Bt9WjSLdXTjqMxohIkX6GdePo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WQIY5iPz9de/wT9voHE5RUo/Ut5f14sBUjJcReYitRfo94YYi2o1V2yuFz0G0/u7/ 3zXuEFh4JKzsPY98mjrm2jVRwx+bCYULwNH5EBwbDX5LZFr1GdrCrVvT+T7V5MiE2K Mgvz3QzrXwE2PKM4rNB/d2PmO2vYCb9U6EMcjTLU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jan Kara , Lukas Czerner , Theodore Tso Subject: [PATCH 5.19 126/717] ext4: fix check for block being out of directory size Date: Sat, 22 Oct 2022 09:20:05 +0200 Message-Id: <20221022072437.773984046@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747373255662467895?= X-GMAIL-MSGID: =?utf-8?q?1747373255662467895?= From: Jan Kara commit 61a1d87a324ad5e3ed27c6699dfc93218fcf3201 upstream. The check in __ext4_read_dirblock() for block being outside of directory size was wrong because it compared block number against directory size in bytes. Fix it. Fixes: 65f8ea4cd57d ("ext4: check if directory block is within i_size") CVE: CVE-2022-1184 CC: stable@vger.kernel.org Signed-off-by: Jan Kara Reviewed-by: Lukas Czerner Link: https://lore.kernel.org/r/20220822114832.1482-1-jack@suse.cz Signed-off-by: Theodore Ts'o Signed-off-by: Greg Kroah-Hartman --- fs/ext4/namei.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/fs/ext4/namei.c +++ b/fs/ext4/namei.c @@ -126,7 +126,7 @@ static struct buffer_head *__ext4_read_d struct ext4_dir_entry *dirent; int is_dx_block = 0; - if (block >= inode->i_size) { + if (block >= inode->i_size >> inode->i_blkbits) { ext4_error_inode(inode, func, line, block, "Attempting to read directory block (%u) that is past i_size (%llu)", block, inode->i_size); From patchwork Sat Oct 22 07:20: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: 7499 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1104899wrr; Sat, 22 Oct 2022 01:33:39 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5PBhzznxFbK8cGSMTWUTUN1++/OyUIPmzzo46bQOoN0VWyP/P7w3Lpht+Tkm4FCmi1yOnz X-Received: by 2002:a17:902:7c11:b0:178:a6ca:4850 with SMTP id x17-20020a1709027c1100b00178a6ca4850mr24098543pll.111.1666427619268; Sat, 22 Oct 2022 01:33:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666427619; cv=none; d=google.com; s=arc-20160816; b=oh5DiM5XgbXU/daSDYooiA9gytZEKxUvjWX7WG/7URzv/jyzWQ+zje3fRJhkjG8gwx MIBfXJhUcsNadvg5e9a8jBQDKERXuV5aIa/8Yh0qy3RXVmSI8TnvSXwCTN7wfYmib2/6 TIHpGKRiAiKKgw/pb5L8+vcp8M4Fqiy5BMUnxY6D7DHILB2Fvm+wmXT76TyO+qFfcBz+ reIiCXJOz4Qyq/O7ZPKgrut0Eefj8bSGOwCWuCRD1ghqf1M+UF99DL6IjuLb+tIiYkcf lc0Ryw5icAnX5f70BAXDOAtEf3Zt2owZNEwhq+frZ0HjIlt9e3Pt/4BIw6hVJD/GmPu1 DP8Q== 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=R6uHFraa2OSjPf2EcUleJpx/5BXtLzWBU5RXifaJ0Gg=; b=GmdCMb3hIwBxvMRUJqb5iQpyBpztvMM/4LOTP5L02Dg0tQn+nTQNWWUnXilGixVSl4 YVx8USY/1qEJfO6UYazt1zC+5zBGy9EbwewWb3P8h3auCkOeR53NrBP+5aAn8OtlNJxy V69l6/XWOPH9X/1XZOcXHizVxhW6mmBi0uFTW1waPOz9mIUcyzKjby5spIp+sA74BQcw y6as93NnpZUNGmdRmEBKPwaqZGknz1/FFzF1/COsCf8lIKRQcGg/KuW+pCR72Bx3PQua GlLmsOOdHHMyo3MkQQWmrUVP6lgslO3CJs/k020hweZiGD0yA3fdy/HpXNl9VJB06oaX TJUQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=tM1EbFO1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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-20020a17090a728800b00205daac38absi5274471pjg.59.2022.10.22.01.33.24; Sat, 22 Oct 2022 01:33: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=tM1EbFO1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S233626AbiJVIS6 (ORCPT + 99 others); Sat, 22 Oct 2022 04:18:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50248 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232976AbiJVIQ0 (ORCPT ); Sat, 22 Oct 2022 04:16: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 A72E62DAC1B; Sat, 22 Oct 2022 00:57: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 E2B8BB82E02; Sat, 22 Oct 2022 07:39:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 105E3C433C1; Sat, 22 Oct 2022 07:39:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424391; bh=6BEkaoCyr1a3B8J21YBWZZrVNR7enMef3nl7AAJ8oEM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tM1EbFO1QJDqKj5aDywwCaP8Sn44XTQmjb5t0nxiJwbMaIdiNAjSTvKO7jSEttAQB zfBjCRPxhFfz7tk65cn5gwaMio4uK+l5LyNtzEQgoasJTq3fCDVcXW9FqLlm/f9D/2 PVzgqWrLA2if+pSpfcwFIVHqc0lJ/VZo+1zEDD5c= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, stable@kernel.org, Lukas Czerner , Jan Kara , Jeff Layton , "Christian Brauner (Microsoft)" , Theodore Tso Subject: [PATCH 5.19 127/717] ext4: dont increase iversion counter for ea_inodes Date: Sat, 22 Oct 2022 09:20:06 +0200 Message-Id: <20221022072437.958359393@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376006940984086?= X-GMAIL-MSGID: =?utf-8?q?1747376006940984086?= From: Lukas Czerner commit 50f094a5580e6297bf10a807d16f0ee23fa576cf upstream. ea_inodes are using i_version for storing part of the reference count so we really need to leave it alone. The problem can be reproduced by xfstest ext4/026 when iversion is enabled. Fix it by not calling inode_inc_iversion() for EXT4_EA_INODE_FL inodes in ext4_mark_iloc_dirty(). Cc: stable@kernel.org Signed-off-by: Lukas Czerner Reviewed-by: Jan Kara Reviewed-by: Jeff Layton Reviewed-by: Christian Brauner (Microsoft) Link: https://lore.kernel.org/r/20220824160349.39664-1-lczerner@redhat.com Signed-off-by: Theodore Ts'o Signed-off-by: Greg Kroah-Hartman --- fs/ext4/inode.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c @@ -5731,7 +5731,12 @@ int ext4_mark_iloc_dirty(handle_t *handl } ext4_fc_track_inode(handle, inode); - if (IS_I_VERSION(inode)) + /* + * ea_inodes are using i_version for storing reference count, don't + * mess with it + */ + if (IS_I_VERSION(inode) && + !(EXT4_I(inode)->i_flags & EXT4_EA_INODE_FL)) inode_inc_iversion(inode); /* the do_update_inode consumes one bh->b_count */ From patchwork Sat Oct 22 07:20: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: 7193 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1089507wrr; Sat, 22 Oct 2022 00:43:31 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6UJCqAFIa0bKeNxjtwUka/f2d5qN3F97VFFmxL9klEZ5gmcpetOZPEVdWVvPLPBVo47dsN X-Received: by 2002:a17:902:8a97:b0:178:1939:c721 with SMTP id p23-20020a1709028a9700b001781939c721mr23429596plo.108.1666424611128; Sat, 22 Oct 2022 00:43:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666424611; cv=none; d=google.com; s=arc-20160816; b=v5LTft7ktuBkPrHV20HJJjMpJJGMRoXVRqPa+qALr/RUdmZt5SJJpV2rX2rORFmfpg CdK/1T1pXJqW+X3PIsuFY8zgCWRmvuA4OFixZX5ZwH3AO3/InisXpYV8bTtQSXS8p6lw 82md6q2nOdzYgPNRrhZfpeft7qTyiTS6ITtL6BG9qoAkww9xKZnyIiO/3NOlRW/2yurx RPWLUEgTtrq2I3RT8Asj8K/QX9rI35BmS7F0Rpp4KRg4mi/nwMPBpMwnU9qkigpSSibs etdK5k8XRq2mMAUampL6II4skbpHbr+8QcIrE70Dy7XoSzjg894mLfhemWmUCfY/0Egh bkQQ== 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=Wr4tvOHydMt15RLQxF11BjwOutoPS2EPEwgFSjQOsjs=; b=oHvFEae+MNSkPFi46enuc+8XzdboB7V9+TZCJBx5Rd3Tg8g1b4bosQY4ATNnd9Kb0d +PU8a0Uf/NmhuH6C8uHFeYNzSQF5OT6unl0pA1TNHceV+bR8H2Q/gDA9SDoss8fi7usM Z26Ma59iN0ozcU1ZUTj0tJAkRrGDGHqxaRfHI8MjQXtC+Ey452S2E9dBs35O2vta7Gsa p12wzrjLK59wWf9CrWbqMlNgOlDY+j9nWjbLR9XU2nG7q+pjS7WHWEoOEydu/Irt1Dm/ bn92W84oXVkiB77rFuAvpVDnA1fBphT8qCSk5x4hEn7or5QrweOMlUVdocMuixePeZCn WkRA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=uyd8xgUz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 u41-20020a056a0009a900b0052f9293affcsi30579412pfg.335.2022.10.22.00.43.18; Sat, 22 Oct 2022 00:43: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=uyd8xgUz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231245AbiJVHmx (ORCPT + 99 others); Sat, 22 Oct 2022 03:42:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47090 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230525AbiJVHmH (ORCPT ); Sat, 22 Oct 2022 03:42:07 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 585AF45F48; Sat, 22 Oct 2022 00:40: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 919A3B82E03; Sat, 22 Oct 2022 07:39:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C261EC43142; Sat, 22 Oct 2022 07:39:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424394; bh=bbFpRihJWwhXIesk1QCoyltPVOvk8RcBygayX4+sTF0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uyd8xgUzSTdIxCqV/Ag66QvSXTKmbRiVmwxEykKsIP/Ol+1XJAIBdn2z4smEeQTpS V3vxirf9CEfLCeXz3HPiC0qmZGa8V02946RL+r2qNFpyECEo3ybdytSu0pYY+TVRyd E4Ght+7Elb3dIsRtjVbDHhjRppsi3aQO6VnFYx2o= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, stable@kernel.org, Dave Chinner , Benjamin Coddington , Christoph Hellwig , "Darrick J. Wong" , Jeff Layton , Lukas Czerner , "Christian Brauner (Microsoft)" , Jan Kara , Theodore Tso Subject: [PATCH 5.19 128/717] ext4: unconditionally enable the i_version counter Date: Sat, 22 Oct 2022 09:20:07 +0200 Message-Id: <20221022072438.137591238@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747372853245105838?= X-GMAIL-MSGID: =?utf-8?q?1747372853245105838?= From: Jeff Layton commit 1ff20307393e17dc57fde62226df625a3a3c36e9 upstream. The original i_version implementation was pretty expensive, requiring a log flush on every change. Because of this, it was gated behind a mount option (implemented via the MS_I_VERSION mountoption flag). Commit ae5e165d855d (fs: new API for handling inode->i_version) made the i_version flag much less expensive, so there is no longer a performance penalty from enabling it. xfs and btrfs already enable it unconditionally when the on-disk format can support it. Have ext4 ignore the SB_I_VERSION flag, and just enable it unconditionally. While we're in here, mark the i_version mount option Opt_removed. [ Removed leftover bits of i_version from ext4_apply_options() since it now can't ever be set in ctx->mask_s_flags -- lczerner ] Cc: stable@kernel.org Cc: Dave Chinner Cc: Benjamin Coddington Cc: Christoph Hellwig Cc: Darrick J. Wong Signed-off-by: Jeff Layton Signed-off-by: Lukas Czerner Reviewed-by: Christian Brauner (Microsoft) Reviewed-by: Jan Kara Link: https://lore.kernel.org/r/20220824160349.39664-3-lczerner@redhat.com Signed-off-by: Theodore Ts'o Signed-off-by: Greg Kroah-Hartman --- fs/ext4/inode.c | 5 ++--- fs/ext4/super.c | 22 +++++----------------- 2 files changed, 7 insertions(+), 20 deletions(-) --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c @@ -5425,7 +5425,7 @@ int ext4_setattr(struct user_namespace * return -EINVAL; } - if (IS_I_VERSION(inode) && attr->ia_size != inode->i_size) + if (attr->ia_size != inode->i_size) inode_inc_iversion(inode); if (shrink) { @@ -5735,8 +5735,7 @@ int ext4_mark_iloc_dirty(handle_t *handl * ea_inodes are using i_version for storing reference count, don't * mess with it */ - if (IS_I_VERSION(inode) && - !(EXT4_I(inode)->i_flags & EXT4_EA_INODE_FL)) + if (!(EXT4_I(inode)->i_flags & EXT4_EA_INODE_FL)) inode_inc_iversion(inode); /* the do_update_inode consumes one bh->b_count */ --- a/fs/ext4/super.c +++ b/fs/ext4/super.c @@ -1585,7 +1585,7 @@ enum { Opt_inlinecrypt, Opt_usrjquota, Opt_grpjquota, Opt_quota, Opt_noquota, Opt_barrier, Opt_nobarrier, Opt_err, - Opt_usrquota, Opt_grpquota, Opt_prjquota, Opt_i_version, + Opt_usrquota, Opt_grpquota, Opt_prjquota, Opt_dax, Opt_dax_always, Opt_dax_inode, Opt_dax_never, Opt_stripe, Opt_delalloc, Opt_nodelalloc, Opt_warn_on_error, Opt_nowarn_on_error, Opt_mblk_io_submit, Opt_debug_want_extra_isize, @@ -1694,7 +1694,7 @@ static const struct fs_parameter_spec ex fsparam_flag ("barrier", Opt_barrier), fsparam_u32 ("barrier", Opt_barrier), fsparam_flag ("nobarrier", Opt_nobarrier), - fsparam_flag ("i_version", Opt_i_version), + fsparam_flag ("i_version", Opt_removed), fsparam_flag ("dax", Opt_dax), fsparam_enum ("dax", Opt_dax_type, ext4_param_dax), fsparam_u32 ("stripe", Opt_stripe), @@ -2140,11 +2140,6 @@ static int ext4_parse_param(struct fs_co case Opt_abort: ctx_set_mount_flag(ctx, EXT4_MF_FS_ABORTED); return 0; - case Opt_i_version: - ext4_msg(NULL, KERN_WARNING, deprecated_msg, param->key, "5.20"); - ext4_msg(NULL, KERN_WARNING, "Use iversion instead\n"); - ctx_set_flags(ctx, SB_I_VERSION); - return 0; case Opt_inlinecrypt: #ifdef CONFIG_FS_ENCRYPTION_INLINE_CRYPT ctx_set_flags(ctx, SB_INLINECRYPT); @@ -2814,14 +2809,6 @@ static void ext4_apply_options(struct fs sb->s_flags &= ~ctx->mask_s_flags; sb->s_flags |= ctx->vals_s_flags; - /* - * i_version differs from common mount option iversion so we have - * to let vfs know that it was set, otherwise it would get cleared - * on remount - */ - if (ctx->mask_s_flags & SB_I_VERSION) - fc->sb_flags |= SB_I_VERSION; - #define APPLY(X) ({ if (ctx->spec & EXT4_SPEC_##X) sbi->X = ctx->X; }) APPLY(s_commit_interval); APPLY(s_stripe); @@ -2970,8 +2957,6 @@ static int _ext4_show_options(struct seq SEQ_OPTS_PRINT("min_batch_time=%u", sbi->s_min_batch_time); if (nodefs || sbi->s_max_batch_time != EXT4_DEF_MAX_BATCH_TIME) SEQ_OPTS_PRINT("max_batch_time=%u", sbi->s_max_batch_time); - if (sb->s_flags & SB_I_VERSION) - SEQ_OPTS_PUTS("i_version"); if (nodefs || sbi->s_stripe) SEQ_OPTS_PRINT("stripe=%lu", sbi->s_stripe); if (nodefs || EXT4_MOUNT_DATA_FLAGS & @@ -4631,6 +4616,9 @@ static int __ext4_fill_super(struct fs_c sb->s_flags = (sb->s_flags & ~SB_POSIXACL) | (test_opt(sb, POSIX_ACL) ? SB_POSIXACL : 0); + /* i_version is always enabled now */ + sb->s_flags |= SB_I_VERSION; + if (le32_to_cpu(es->s_rev_level) == EXT4_GOOD_OLD_REV && (ext4_has_compat_features(sb) || ext4_has_ro_compat_features(sb) || From patchwork Sat Oct 22 07:20: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: 7217 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1090365wrr; Sat, 22 Oct 2022 00:46:46 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5i1K7nPIgWBJOAii2QokiJB4yv+sljsNogbBLlZA0prfoOGoH1dWNaKU/eOOVhdUPITk69 X-Received: by 2002:a17:902:e952:b0:17c:2eee:c0ce with SMTP id b18-20020a170902e95200b0017c2eeec0cemr23034250pll.145.1666424806278; Sat, 22 Oct 2022 00:46:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666424806; cv=none; d=google.com; s=arc-20160816; b=ghYprCP8Cf1x8vZZULLcuFrsdfeclKg/9vonvWs8EGcoijmgjtP8AT+TiIbT3CGyuE IFpxII0b+TfBn9D5oeH1+dLqxHWYvDuJkyis20wkE1lQ0Gb4ebXyz58TBGIGylUohkj8 wXXAjsXraMFbdutvmudLZNBVI15GycecFb+9rdPELaCokiSThhqGxRrW+VBpZ5I7/XjJ qWHcVb7w9jzE9jyy4itfoWP7KrB/MDDfHu1OjtXrbHPDjHDDB2i8VbcX6H6pXN2p0ZnT z/hVPyERJwdSHvYiXdHJH06wMsz7OANlpVAmghwjlSWTtaotov3pZTg9HrV0pkDvXTdd qyxg== 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=Nc5vlEjdTntFXkrlb310EoyhXfe22dMMtjbYtb8YbMM=; b=fBtLI/zE0bp5RM2e4sSdkpmOcv0F1bOFtOqb4YrsKsM6hIJ3I6gIN7MCSEt0ed2tH+ w5XG51PG9x8N6AJIGOplOSSlR62FcaQjF5B7kGxQPVryonUqLqVqquSVBw1pz8kwCXSt 2wABfg5/TteJ3EECj8+ittaEKfVV3UQ4v7xlpkFa7wzUPeDd6CNK/aUd5Qoz/md4ywOe RjXg1BQgv3ubs1kSH2UVzUpvd48kfhVwEhSjgj0uPOjxO9J1PBAVVFgY3LNAcMxOEQlw o4ka/nToW6SxE27gvdQEVMwgjto1ic8Z92PqqgLi3Ibezmjjnk4poOTq1jQHezsShXZB 7vtA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=HV12Najm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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-20020a654bc1000000b0045cc8781244si29783312pgr.220.2022.10.22.00.46.33; Sat, 22 Oct 2022 00:46: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=HV12Najm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231436AbiJVHqP (ORCPT + 99 others); Sat, 22 Oct 2022 03:46:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45810 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231459AbiJVHoN (ORCPT ); Sat, 22 Oct 2022 03:44: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 535C724AE1A; Sat, 22 Oct 2022 00:42: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 37FDAB82E0D; Sat, 22 Oct 2022 07:41:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9CD22C433C1; Sat, 22 Oct 2022 07:41:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424501; bh=tw+UBshdv0m1AQJam6LuXaGvrETW6SixtDSWoDGHBTg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HV12NajmX6KxwBqjZ3vfNdrbgQEci/lI/oNPn74aTC2xt8iRLHs6OFtk7Lz6/+MXS Pf0gpl4u+yG6vpwai+IgDf4/eagESxBzUsTwvQZ477OEr7FidrG+3WTa/tXXHdmbyl dgdoil7V+n/nkvCBT5t9JTIQiDFiZb7agvd+qLcY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, stable@kernel.org, Zhang Yi , Jan Kara , Theodore Tso Subject: [PATCH 5.19 129/717] ext4: ext4_read_bh_lock() should submit IO if the buffer isnt uptodate Date: Sat, 22 Oct 2022 09:20:08 +0200 Message-Id: <20221022072438.308293706@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747373057607360367?= X-GMAIL-MSGID: =?utf-8?q?1747373057607360367?= From: Zhang Yi commit 0b73284c564d3ae4feef4bc920292f004acf4980 upstream. Recently we notice that ext4 filesystem would occasionally fail to read metadata from disk and report error message, but the disk and block layer looks fine. After analyse, we lockon commit 88dbcbb3a484 ("blkdev: avoid migration stalls for blkdev pages"). It provide a migration method for the bdev, we could move page that has buffers without extra users now, but it lock the buffers on the page, which breaks the fragile metadata read operation on ext4 filesystem, ext4_read_bh_lock() was copied from ll_rw_block(), it depends on the assumption of that locked buffer means it is under IO. So it just trylock the buffer and skip submit IO if it lock failed, after wait_on_buffer() we conclude IO error because the buffer is not uptodate. This issue could be easily reproduced by add some delay just after buffer_migrate_lock_buffers() in __buffer_migrate_folio() and do fsstress on ext4 filesystem. EXT4-fs error (device pmem1): __ext4_find_entry:1658: inode #73193: comm fsstress: reading directory lblock 0 EXT4-fs error (device pmem1): __ext4_find_entry:1658: inode #75334: comm fsstress: reading directory lblock 0 Fix it by removing the trylock logic in ext4_read_bh_lock(), just lock the buffer and submit IO if it's not uptodate, and also leave over readahead helper. Cc: stable@kernel.org Signed-off-by: Zhang Yi Reviewed-by: Jan Kara Link: https://lore.kernel.org/r/20220831074629.3755110-1-yi.zhang@huawei.com Signed-off-by: Theodore Ts'o Signed-off-by: Greg Kroah-Hartman --- fs/ext4/super.c | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) --- a/fs/ext4/super.c +++ b/fs/ext4/super.c @@ -205,19 +205,12 @@ int ext4_read_bh(struct buffer_head *bh, int ext4_read_bh_lock(struct buffer_head *bh, int op_flags, bool wait) { - if (trylock_buffer(bh)) { - if (wait) - return ext4_read_bh(bh, op_flags, NULL); + lock_buffer(bh); + if (!wait) { ext4_read_bh_nowait(bh, op_flags, NULL); return 0; } - if (wait) { - wait_on_buffer(bh); - if (buffer_uptodate(bh)) - return 0; - return -EIO; - } - return 0; + return ext4_read_bh(bh, op_flags, NULL); } /* @@ -264,7 +257,8 @@ void ext4_sb_breadahead_unmovable(struct struct buffer_head *bh = sb_getblk_gfp(sb, block, 0); if (likely(bh)) { - ext4_read_bh_lock(bh, REQ_RAHEAD, false); + if (trylock_buffer(bh)) + ext4_read_bh_nowait(bh, REQ_RAHEAD, NULL); brelse(bh); } } From patchwork Sat Oct 22 07:20: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: 7321 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1093608wrr; Sat, 22 Oct 2022 00:57:50 -0700 (PDT) X-Google-Smtp-Source: AMsMyM77GSrDMm5YM5/XyPMNORkgSPkHPgoSkiEXqUfP0yRvf7ySMtPO+ADV5/dhKLu5GaxHKjEm X-Received: by 2002:a17:903:32d0:b0:17f:9224:6e1f with SMTP id i16-20020a17090332d000b0017f92246e1fmr23253808plr.126.1666425470507; Sat, 22 Oct 2022 00:57:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666425470; cv=none; d=google.com; s=arc-20160816; b=D5LNPuPSe8F21EzkEstVtoiBHC+SArEYNt5jjgsRVkyBdRFs7ieEmyDUbmc+WA2yrq Ig3cXCLkn/cAggJwzTlW50aJDOxFJKOKK+CuFjcW4rmEY4OyWTSZk7dofB/EoZslGb4n QetZbTk3nA/2eB3qlVnd9Ja1zoSP7yzyZCL/XiJz76QT7X3XnnZuWuyByCXJ/JKDMmyR s76PeNkp/Dwomm08PbdtvWfHtNgsR5Sdp6oTwDv0oZHDliejCPaWjXZxvjKhZthF1v8U Ty9siOKrk3qwGuPrHnfenDhFdeu50HMwdZfOgFgItwOKZVUXh54PQPdnwY3OE+WJdres KGrQ== 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=zg+v+Gl5dyw2REddJ1ixjdeL+pks3AHEObS0bRzHaPU=; b=jm+WeB0RzOAex6juZTCX8g3nVZBk0YtS6KaeBNJvtzPFhBTo8flqy6orIchhBicGJE 6n7VBIaeq3esI/zL30ZqLd+5n107/FMD7IXhVJlbLp45yANV7BANuO0cyPXx58IitMPT RGxXPXxINjGtSsNXJ+Zf0bmkwOSv20aDY/jpEKRvS+5qU0vJLAQ9lfd0g/bEy71LxUQX qaWOGWxOpyeTkAmEEBGWi0r/b0RtGc5aYTeHq0AU+rUjD28dUhcBRVXn8sDJwDoVqQHM YfdS9lrqJO4a1GbrDJLQ1OGcP3I/lQF6lKD9cOJe5VdiYM+xtyp1PjvRNePdRuCAhYLb n8qQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=vD7ZVQVZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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-20020a656d96000000b0046eda1a483csi1319526pgb.420.2022.10.22.00.57.38; Sat, 22 Oct 2022 00:57: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=vD7ZVQVZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231985AbiJVH5V (ORCPT + 99 others); Sat, 22 Oct 2022 03:57:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34414 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232011AbiJVHxd (ORCPT ); Sat, 22 Oct 2022 03:53:33 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4D6C82CA7EA; Sat, 22 Oct 2022 00:46: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 dfw.source.kernel.org (Postfix) with ESMTPS id 52A3260B4D; Sat, 22 Oct 2022 07:40:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 665A8C433C1; Sat, 22 Oct 2022 07:40:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424415; bh=VtFKGsLaErRVzOB9Z09DPYXE6t91wddQ7M2ZiRFgHpo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vD7ZVQVZsjP6YZJ7OdY4yS28R6z9DnKkjDJlp18MoI7TpU+7DCSC8n/NCdF/a2l6g VTA+xUmpa13cWqjK4SguPRYthyMUE3O2iDRYN8+DdRKEs9Jnsk5s4qXxU8yE3T7oKZ Msg85GJzIx8eLpBDt2RFOlYVsDKAkKH8US7tkUtA= 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 5.19 130/717] ext4: place buffer head allocation before handle start Date: Sat, 22 Oct 2022 09:20:09 +0200 Message-Id: <20221022072438.491425100@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747373754136295857?= X-GMAIL-MSGID: =?utf-8?q?1747373754136295857?= 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 @@ -1188,6 +1188,13 @@ retry_grab: page = grab_cache_page_write_begin(mapping, index); 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 Sat Oct 22 07:20: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: 7205 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1090111wrr; Sat, 22 Oct 2022 00:45:44 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4KHbZsovb2DoWdRk53nfjzegogUiiK8xR8pEWFq3o9exZQBEwEuCN+MyVLHm/4LlSESHgb X-Received: by 2002:a05:6a00:805:b0:563:6e88:896 with SMTP id m5-20020a056a00080500b005636e880896mr23276034pfk.57.1666424744531; Sat, 22 Oct 2022 00:45:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666424744; cv=none; d=google.com; s=arc-20160816; b=aMxoOT0rx0pd1rg3LpbChnAnMOq1U2GHnFCqDoolmmCf/HIIpN7YImqKb7ZZeu5M2Q HIaBhYfnqNnTReTLPv8ZinDIFgYbARqzi+J5nKcBrmazlFX09RZFwqrD0uzg5wRagm5u nQcsTiIXJjJouuohVYu3nLF3apiRnOKjIdeUMyqSkHm4khTYMNhjEGPTiKCEwdH6KzzF 5eGSYZ+TQUMTnuGgjopIuLO+lYnvWbW0fV/K0IKne8yvU1gKrWGtIIMqu7knfP3oZIsy 0xvghVXWUH41z6qqsMJDVd2wgRnrX9rITpPnM0eMLZHHVmHBBPyOXHfG89Y7hVsBNDHW GtkA== 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=k0mIHbVQHAhpsXGeajzPJH0+72jTq3y1govzRNubHOs=; b=EeWvIcBr4qEXzoVp9+CYfrKKVIPiIMspgA7C0vt4Z0uMdgkdI33FmhhZ5oki/P7RRG Hx92xZ8SbN/NR5Z/JnjX7oJl0w4DUBdnSIAAPMRPqJFcxyyLeqm9A/mZHEz2j0QKEvTP qiZnM/U/wd40ugt1e3IGdMMk3wMR7+xLnEdKU1gSoFtinO/lVQGyKAKjTc4Afbkle9cE p3P2KQiXBanOfeZXYbI8+RdoAhR/841okODw0YC3wDnpkY4ULEFiIl/QjOdFW/2S/9kP P6adCFOYmA2qF2jfKysy4n0K4G7KoU4LBhmvcsXxwvCxavPrNp0z4BwVZ8n0DxrXWK3g td2g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=fTCviPkx; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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-20020a170902f78800b0015f4370afbdsi9294321pln.516.2022.10.22.00.45.26; Sat, 22 Oct 2022 00:45: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=fTCviPkx; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231289AbiJVHnm (ORCPT + 99 others); Sat, 22 Oct 2022 03:43:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45810 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231222AbiJVHnK (ORCPT ); Sat, 22 Oct 2022 03:43:10 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B8C1331EDA; Sat, 22 Oct 2022 00:41: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 ams.source.kernel.org (Postfix) with ESMTPS id 73445B82E04; Sat, 22 Oct 2022 07:40:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E200DC433D6; Sat, 22 Oct 2022 07:40:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424445; bh=NS33k9Fq8UbXUaEYHOZnnctppulOBDEjbGE76ZCXTRM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fTCviPkxw1HFuKqPHmiN2JVUng6vDtsoFWx2BtXqZHKiJVqVTcsAdWYsnI5dTH07+ LGCPzMkBulJabzuK576uoOK1PC9pycPaztvDGTZAOXgslm8DAeXptcp2rCb2h5OPSF f22xolkGbI2ViOkcLBVlItV7nmlJZfeOe6P+bsUM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, stable@kernel.org, Lukas Czerner , Jan Kara , "Christian Brauner (Microsoft)" , Jeff Layton , Theodore Tso Subject: [PATCH 5.19 131/717] ext4: fix i_version handling in ext4 Date: Sat, 22 Oct 2022 09:20:10 +0200 Message-Id: <20221022072438.681248294@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747372993035191608?= X-GMAIL-MSGID: =?utf-8?q?1747372993035191608?= From: Jeff Layton commit a642c2c0827f5604a93f9fa1e5701eecdce4ae22 upstream. ext4 currently updates the i_version counter when the atime is updated during a read. This is less than ideal as it can cause unnecessary cache invalidations with NFSv4 and unnecessary remeasurements for IMA. The increment in ext4_mark_iloc_dirty is also problematic since it can corrupt the i_version counter for ea_inodes. We aren't bumping the file times in ext4_mark_iloc_dirty, so changing the i_version there seems wrong, and is the cause of both problems. Remove that callsite and add increments to the setattr, setxattr and ioctl codepaths, at the same times that we update the ctime. The i_version bump that already happens during timestamp updates should take care of the rest. In ext4_move_extents, increment the i_version on both inodes, and also add in missing ctime updates. [ Some minor updates since we've already enabled the i_version counter unconditionally already via another patch series. -- TYT ] Cc: stable@kernel.org Cc: Lukas Czerner Reviewed-by: Jan Kara Reviewed-by: Christian Brauner (Microsoft) Signed-off-by: Jeff Layton Link: https://lore.kernel.org/r/20220908172448.208585-3-jlayton@kernel.org Signed-off-by: Theodore Ts'o Signed-off-by: Greg Kroah-Hartman --- fs/ext4/inode.c | 14 +++++--------- fs/ext4/ioctl.c | 4 ++++ fs/ext4/xattr.c | 1 + 3 files changed, 10 insertions(+), 9 deletions(-) --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c @@ -5347,6 +5347,7 @@ int ext4_setattr(struct user_namespace * int error, rc = 0; int orphan = 0; const unsigned int ia_valid = attr->ia_valid; + bool inc_ivers = true; if (unlikely(ext4_forced_shutdown(EXT4_SB(inode->i_sb)))) return -EIO; @@ -5432,8 +5433,8 @@ int ext4_setattr(struct user_namespace * return -EINVAL; } - if (attr->ia_size != inode->i_size) - inode_inc_iversion(inode); + if (attr->ia_size == inode->i_size) + inc_ivers = false; if (shrink) { if (ext4_should_order_data(inode)) { @@ -5535,6 +5536,8 @@ out_mmap_sem: } if (!error) { + if (inc_ivers) + inode_inc_iversion(inode); setattr_copy(mnt_userns, inode, attr); mark_inode_dirty(inode); } @@ -5738,13 +5741,6 @@ int ext4_mark_iloc_dirty(handle_t *handl } ext4_fc_track_inode(handle, inode); - /* - * ea_inodes are using i_version for storing reference count, don't - * mess with it - */ - if (!(EXT4_I(inode)->i_flags & EXT4_EA_INODE_FL)) - inode_inc_iversion(inode); - /* the do_update_inode consumes one bh->b_count */ get_bh(iloc->bh); --- a/fs/ext4/ioctl.c +++ b/fs/ext4/ioctl.c @@ -442,6 +442,7 @@ static long swap_inode_boot_loader(struc swap_inode_data(inode, inode_bl); inode->i_ctime = inode_bl->i_ctime = current_time(inode); + inode_inc_iversion(inode); inode->i_generation = prandom_u32(); inode_bl->i_generation = prandom_u32(); @@ -655,6 +656,7 @@ static int ext4_ioctl_setflags(struct in ext4_set_inode_flags(inode, false); inode->i_ctime = current_time(inode); + inode_inc_iversion(inode); err = ext4_mark_iloc_dirty(handle, inode, &iloc); flags_err: @@ -765,6 +767,7 @@ static int ext4_ioctl_setproject(struct EXT4_I(inode)->i_projid = kprojid; inode->i_ctime = current_time(inode); + inode_inc_iversion(inode); out_dirty: rc = ext4_mark_iloc_dirty(handle, inode, &iloc); if (!err) @@ -1178,6 +1181,7 @@ static long __ext4_ioctl(struct file *fi err = ext4_reserve_inode_write(handle, inode, &iloc); if (err == 0) { inode->i_ctime = current_time(inode); + inode_inc_iversion(inode); inode->i_generation = generation; err = ext4_mark_iloc_dirty(handle, inode, &iloc); } --- a/fs/ext4/xattr.c +++ b/fs/ext4/xattr.c @@ -2412,6 +2412,7 @@ retry_inode: if (!error) { ext4_xattr_update_super_block(handle, inode->i_sb); inode->i_ctime = current_time(inode); + inode_inc_iversion(inode); if (!value) no_expand = 0; error = ext4_mark_iloc_dirty(handle, inode, &is.iloc); From patchwork Sat Oct 22 07:20: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: 7427 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1097840wrr; Sat, 22 Oct 2022 01:08:53 -0700 (PDT) X-Google-Smtp-Source: AMsMyM77osbr6K75uIKLXDYQLMMzqHSVGK9stmO9v8otT3YKkzHskSiWFLVhg6i2gmnVhUlYzeQZ X-Received: by 2002:a17:902:7408:b0:186:88be:1cca with SMTP id g8-20020a170902740800b0018688be1ccamr2864259pll.155.1666426133586; Sat, 22 Oct 2022 01:08:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666426133; cv=none; d=google.com; s=arc-20160816; b=eY1/orrnC2a5fSmDrAzrsYxBAblfCQ8psPb0InRdw7RNO5863hTaUb7Ql/5l9E/T83 5jvZTETSRqyskNv+4G2W1d/jq4yee2JeWkdJoDxhyEicQsF+lrbhxkLsNKVQIjSmry6g X6Ingc00FF4xofBASCwYC16A7xOqVo9yiBAXj2q0kZ7LbTQuqUYuZLEREYJIOCEipIgh a9j/Gb7ypgxV/EK0+c8Ubqa+P7g/Ym2H300WKADSCYt9wlbYe83OqqnYHcFcrgqwabKf UXIoY0q+nKT5J9wVsy8oW6yhzChyDeEON9t0SZULfOUgeGG+C561aEE3I272QFJbJR5/ bRKA== 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=01QJ14LeMpd1FNFss190nAQVI4dAt+8gXh5aDxGKpRk=; b=csDCSph8excfCiP7rIB+pIzxwdcNwj+Bu6WK0Nru08Onl8KJANWHA13zydEo5PRgmm 0G61zgbRGsXAl3mcPMy6ZruIOXY6GaIfyfU+67ynCvtxiXlZkp9ukACzLC+mX3kvDVH0 D8ZB/OrPq8twfVZ1N2IStRcGIzRscqW7Zqvf0TMi63NtWFuQOY4JxDnRiUlIiEyTkRi8 PBPY9iYNcgsmFwoCImMnO5P+FXNRYAlSL7U3/W9sAY0ptrTpY6n7MSAZJs7amjSf8m6f T6JgOqXf5jOpnsazcCik3qfvkSRsNgzRPf9VP4KKqpb0EEZM5YN0kuncmFEW9uRBJlFz +tJQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=HRWv8JX6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 16-20020aa79150000000b0055f35357a40si24397289pfi.122.2022.10.22.01.08.41; Sat, 22 Oct 2022 01:08: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=HRWv8JX6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S233040AbiJVIIL (ORCPT + 99 others); Sat, 22 Oct 2022 04:08:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57476 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232862AbiJVIET (ORCPT ); Sat, 22 Oct 2022 04:04: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 478ED2D2C1B; Sat, 22 Oct 2022 00:51: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 9663AB82DFB; Sat, 22 Oct 2022 07:41:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0E2BBC433C1; Sat, 22 Oct 2022 07:41:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424474; bh=HJEF7endQpM+60VPzFKP7f1JvxvvavZo44m56jkX12A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HRWv8JX6/w93BX/QkPwAvqqocsg7JKqVIw77VNmerIEkFlnuE1uPyQBnQFGPpIwrH Tn6Lv6GXEP4x2fqpGXXGYeHnJ3C2D3GcnUgFtlo0asE90pkmV0UhnCbfTX8QvguEZZ QLYtY+DIfSQ03MYmZegRHK4YyFIpws1vC5mrm5io= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zhihao Cheng , Jan Kara , Theodore Tso Subject: [PATCH 5.19 132/717] ext4: fix dir corruption when ext4_dx_add_entry() fails Date: Sat, 22 Oct 2022 09:20:11 +0200 Message-Id: <20221022072438.874019929@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747374449874404231?= X-GMAIL-MSGID: =?utf-8?q?1747374449874404231?= From: Zhihao Cheng commit 7177dd009c7c04290891e9a534cd47d1b620bd04 upstream. Following process may lead to fs corruption: 1. ext4_create(dir/foo) ext4_add_nondir ext4_add_entry ext4_dx_add_entry a. add_dirent_to_buf ext4_mark_inode_dirty ext4_handle_dirty_metadata // dir inode bh is recorded into journal b. ext4_append // dx_get_count(entries) == dx_get_limit(entries) ext4_bread(EXT4_GET_BLOCKS_CREATE) ext4_getblk ext4_map_blocks ext4_ext_map_blocks ext4_mb_new_blocks dquot_alloc_block dquot_alloc_space_nodirty inode_add_bytes // update dir's i_blocks ext4_ext_insert_extent ext4_ext_dirty // record extent bh into journal ext4_handle_dirty_metadata(bh) // record new block into journal inode->i_size += inode->i_sb->s_blocksize // new size(in mem) c. ext4_handle_dirty_dx_node(bh2) // record dir's new block(dx_node) into journal d. ext4_handle_dirty_dx_node((frame - 1)->bh) e. ext4_handle_dirty_dx_node(frame->bh) f. do_split // ret err! g. add_dirent_to_buf ext4_mark_inode_dirty(dir) // update raw_inode on disk(skipped) 2. fsck -a /dev/sdb drop last block(dx_node) which beyonds dir's i_size. /dev/sdb: recovering journal /dev/sdb contains a file system with errors, check forced. /dev/sdb: Inode 12, end of extent exceeds allowed value (logical block 128, physical block 3938, len 1) 3. fsck -fn /dev/sdb dx_node->entry[i].blk > dir->i_size Pass 2: Checking directory structure Problem in HTREE directory inode 12 (/dir): bad block number 128. Clear HTree index? no Problem in HTREE directory inode 12: block #3 has invalid depth (2) Problem in HTREE directory inode 12: block #3 has bad max hash Problem in HTREE directory inode 12: block #3 not referenced Fix it by marking inode dirty directly inside ext4_append(). Fetch a reproducer in [Link]. Link: https://bugzilla.kernel.org/show_bug.cgi?id=216466 Cc: stable@vger.kernel.org Signed-off-by: Zhihao Cheng Reviewed-by: Jan Kara Link: https://lore.kernel.org/r/20220911045204.516460-1-chengzhihao1@huawei.com Signed-off-by: Theodore Ts'o Signed-off-by: Greg Kroah-Hartman --- fs/ext4/namei.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) --- a/fs/ext4/namei.c +++ b/fs/ext4/namei.c @@ -85,15 +85,20 @@ static struct buffer_head *ext4_append(h return bh; inode->i_size += inode->i_sb->s_blocksize; EXT4_I(inode)->i_disksize = inode->i_size; + err = ext4_mark_inode_dirty(handle, inode); + if (err) + goto out; BUFFER_TRACE(bh, "get_write_access"); err = ext4_journal_get_write_access(handle, inode->i_sb, bh, EXT4_JTR_NONE); - if (err) { - brelse(bh); - ext4_std_error(inode->i_sb, err); - return ERR_PTR(err); - } + if (err) + goto out; return bh; + +out: + brelse(bh); + ext4_std_error(inode->i_sb, err); + return ERR_PTR(err); } static int ext4_dx_csum_verify(struct inode *inode, From patchwork Sat Oct 22 07:20: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: 7212 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1090282wrr; Sat, 22 Oct 2022 00:46:24 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7rNRzMHdWuVq6H3wL1fcOr8yIymxgs5W56EYZxuIjSZgA9BNwo57vz7GSoAuAcfFR/rN9s X-Received: by 2002:a17:902:e552:b0:179:e795:71c5 with SMTP id n18-20020a170902e55200b00179e79571c5mr23018062plf.57.1666424783932; Sat, 22 Oct 2022 00:46:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666424783; cv=none; d=google.com; s=arc-20160816; b=LILxiWU7x3lC733UpmkUvAgpzeQExvACpL2Fq49wb1ORzSW5RL7FQYryhqLYngKWhZ 2l1dGdf3f4imrcnKgrsxg3iLO422bvt4d8cCdmjKpnoR2dlJWJk2/P9sFNKvAM1Jbh4P 6AGEOmO/d+x2S2ddYOmq8NakYPG9PMJBvellWM9bjQ8F+pgIcwL08kWmlSBiNnKoUAvu Zd3tK0EbzEQXKAdOh19TZCg2I+lTinb8Yca2hbtiwtEGahkNlO24Gh8nvcksQNlje1xT xj2Q+JFUt3xJ/JwPpzvdF3nu22gW9so2uKpVAOC5O9M55Si0oMbYEBQJGICZScHcenHu 4DUQ== 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=U9rzKormMlT8leH8LAAQxWwGQPYSDsvBAJ4mHm9d0TE=; b=wIA8zdokj9CAYn7lB0HNX7oSuAdj9Ekopx2BwvQu3EpwFVKHMhiZkGAoSkjBGmd4ZG Lqg2W5NVM97IFZ/Kf3Ee502Fdn2EuCuyn2dPpfYHEnNcTAqp/w+b3Aqj9fSNbPU9WFwa gIXCd94OnM5YVPhVK3W5XkxdC1gRHILv807LtD+GNWx7Yov5wUWkhDu0NWetix6N3vI9 znIRbU0afwpjkHdQPeu7M4BHdPglpmPDGFJPlL8CTJIAVJKBgB6PUwOHnU20mnIPqwul A8sjo0/Cv7xNCpnvZw5PYE1h39NAkjzLULTZsDMn+ZW5OAZlsAv991jVhkJGqlId1PLH sGMQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=1vjdEjvQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 i186-20020a626dc3000000b0053e67522538si25615979pfc.331.2022.10.22.00.46.11; Sat, 22 Oct 2022 00:46: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=1vjdEjvQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231359AbiJVHp5 (ORCPT + 99 others); Sat, 22 Oct 2022 03:45:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47278 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231393AbiJVHoF (ORCPT ); Sat, 22 Oct 2022 03:44: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 267B163D35; Sat, 22 Oct 2022 00:42: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 7F817B82E0E; Sat, 22 Oct 2022 07:41:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D0EB7C433D6; Sat, 22 Oct 2022 07:41:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424485; bh=C620LoJ1iYClQH8UWros1PqqPG0tOj5qGlc2syb/41g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1vjdEjvQbJr8fEg79OAL/tVahuG6j+uUHIH6JvGnv9qQCcB367ASIvkaoj1ELospn MLcofFC6PduVzk3Go5XjY3FAt0XVfhVkXPhNf2NXSukY6VuQvOuAyRlrjH2rOxlPmd Hom3c40R7FIJXhck9b+lGgQsyKk5sW4KEHSkgBBM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, stable@kernel.org, Ye Bin , Jan Kara , Theodore Tso Subject: [PATCH 5.19 133/717] ext4: fix miss release buffer head in ext4_fc_write_inode Date: Sat, 22 Oct 2022 09:20:12 +0200 Message-Id: <20221022072439.057846523@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747373034573595608?= X-GMAIL-MSGID: =?utf-8?q?1747373034573595608?= From: Ye Bin commit ccbf8eeb39f2ff00b54726a2b20b35d788c4ecb5 upstream. In 'ext4_fc_write_inode' function first call 'ext4_get_inode_loc' get 'iloc', after use it miss release 'iloc.bh'. So just release 'iloc.bh' before 'ext4_fc_write_inode' return. Cc: stable@kernel.org Signed-off-by: Ye Bin Reviewed-by: Jan Kara Link: https://lore.kernel.org/r/20220914100859.1415196-1-yebin10@huawei.com Signed-off-by: Theodore Ts'o Signed-off-by: Greg Kroah-Hartman --- fs/ext4/fast_commit.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) --- a/fs/ext4/fast_commit.c +++ b/fs/ext4/fast_commit.c @@ -874,22 +874,25 @@ static int ext4_fc_write_inode(struct in tl.fc_tag = cpu_to_le16(EXT4_FC_TAG_INODE); tl.fc_len = cpu_to_le16(inode_len + sizeof(fc_inode.fc_ino)); + ret = -ECANCELED; dst = ext4_fc_reserve_space(inode->i_sb, sizeof(tl) + inode_len + sizeof(fc_inode.fc_ino), crc); if (!dst) - return -ECANCELED; + goto err; if (!ext4_fc_memcpy(inode->i_sb, dst, &tl, sizeof(tl), crc)) - return -ECANCELED; + goto err; dst += sizeof(tl); if (!ext4_fc_memcpy(inode->i_sb, dst, &fc_inode, sizeof(fc_inode), crc)) - return -ECANCELED; + goto err; dst += sizeof(fc_inode); if (!ext4_fc_memcpy(inode->i_sb, dst, (u8 *)ext4_raw_inode(&iloc), inode_len, crc)) - return -ECANCELED; - - return 0; + goto err; + ret = 0; +err: + brelse(iloc.bh); + return ret; } /* From patchwork Sat Oct 22 07:20: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: 7214 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1090297wrr; Sat, 22 Oct 2022 00:46:29 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4x1Neu6ptmy70vUGwJ/3QRVFvJUBRzZzY6m94anuRkt+v560ibxrYwN5aGIJrT9bpLZ/e5 X-Received: by 2002:a17:90b:1d03:b0:212:cd82:aa0c with SMTP id on3-20020a17090b1d0300b00212cd82aa0cmr8070849pjb.214.1666424789633; Sat, 22 Oct 2022 00:46:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666424789; cv=none; d=google.com; s=arc-20160816; b=Fd2MUYXwXgHQ2UhnAH9i8ip7DnhJl4cOC6njRPW+YXWbhZ4Gd1DmuFAuJuFHPiSAy/ ajJa7P9Zgk4QddSpa5NzsSai34TNFD5NKQuDs09Dv5isoEr/JRB0dacWJYSxJFpIQ4qM k0qQiVA2wd0X+STdSjo4wU7BjR9w4R37Isubs+503UziuwLc4lc1ggdSY3v5P2nhUPc/ 4sa1bCnh5/ITZQKwt4M2noJ3SfokiVSBZrhk2q6KyTnHDbFzvPPBUFL0/uglJoEEwkPW p/6O5xNNrJ/jES185rL+iRCdmfsX6eRtpc7QnoJyplRXnMOCXDFYc5X8T9TwoUSBI3N9 8Cjw== 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=MtZArkGlv5buEWRZ/YUpKagsJinPtiWhFfZbrZL4mb8=; b=PUcsWTrkG6qWKJ7pq0f4FyyK8ZcqQ/5e8GalNCt8xrw3d3yNCniP/uSOiieaxAGbUz 7C1PveRXDNnOM+2i6HLrOFY8qF38hU4vvsXxXkaCpfiv14BLClpuCkxtr3ssKLlsfcUG 8bZeHnITehwy5FPzF32PEpsTkpO4wyHrTjKzvug3oNEsiPsyc8ubfJdp+LtcK98daLMu Sk9zNdsPrPSAE99HuThvOEIxwKqM8alEy1Sya4ykLZIuJd7EP28ihAutm7nqGrpbIRFy BHOY/u+VQ8v0plVJodHBRbfKKIdVwBuGbbB/WDpx3scbe3T4bOSNPkQ6Xau7/eL3Zv26 /sCg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=dSUy7VI6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 gk8-20020a17090b118800b00211780dcde8si7665609pjb.124.2022.10.22.00.46.17; Sat, 22 Oct 2022 00:46: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=dSUy7VI6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231266AbiJVHqB (ORCPT + 99 others); Sat, 22 Oct 2022 03:46:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43030 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231394AbiJVHoF (ORCPT ); Sat, 22 Oct 2022 03:44: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 47D41DD886; Sat, 22 Oct 2022 00:42: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 22CEEB82E07; Sat, 22 Oct 2022 07:41:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6F789C433D7; Sat, 22 Oct 2022 07:41:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424487; bh=A/EfSodavLN3vkOq7yofx8nSRK5ew/SrXZ7YRPbEBvs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dSUy7VI6H0yeaa9ULhvNIvWPP6gman5pvBaKiOZwXVor+hQ6LCiO4f/65M6BT9Sk8 EE48Ds1Y5yp+9kw2KiNvhHFpOw+W6WlvSwm2619mCJt2cOA1Rw3bY7W+1tjIqyPw3e 5XEeyQl8/RP1sOFwFmx0lM6cArJ4SB0YJ7lmWGws= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, stable@kernel.org, Ye Bin , Jan Kara , Theodore Tso Subject: [PATCH 5.19 134/717] ext4: fix potential memory leak in ext4_fc_record_modified_inode() Date: Sat, 22 Oct 2022 09:20:13 +0200 Message-Id: <20221022072439.237269256@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747373040436336991?= X-GMAIL-MSGID: =?utf-8?q?1747373040436336991?= From: Ye Bin commit 9305721a309fa1bd7c194e0d4a2335bf3b29dca4 upstream. As krealloc may return NULL, in this case 'state->fc_modified_inodes' may not be freed by krealloc, but 'state->fc_modified_inodes' already set NULL. Then will lead to 'state->fc_modified_inodes' memory leak. Cc: stable@kernel.org Signed-off-by: Ye Bin Reviewed-by: Jan Kara Link: https://lore.kernel.org/r/20220921064040.3693255-2-yebin10@huawei.com Signed-off-by: Theodore Ts'o Signed-off-by: Greg Kroah-Hartman --- fs/ext4/fast_commit.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) --- a/fs/ext4/fast_commit.c +++ b/fs/ext4/fast_commit.c @@ -1494,13 +1494,15 @@ static int ext4_fc_record_modified_inode if (state->fc_modified_inodes[i] == ino) return 0; if (state->fc_modified_inodes_used == state->fc_modified_inodes_size) { - state->fc_modified_inodes = krealloc( - state->fc_modified_inodes, + int *fc_modified_inodes; + + fc_modified_inodes = krealloc(state->fc_modified_inodes, sizeof(int) * (state->fc_modified_inodes_size + EXT4_FC_REPLAY_REALLOC_INCREMENT), GFP_KERNEL); - if (!state->fc_modified_inodes) + if (!fc_modified_inodes) return -ENOMEM; + state->fc_modified_inodes = fc_modified_inodes; state->fc_modified_inodes_size += EXT4_FC_REPLAY_REALLOC_INCREMENT; } From patchwork Sat Oct 22 07:20: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: 7358 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1095586wrr; Sat, 22 Oct 2022 01:03:03 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5cFhyNfqEdTPRv3pT/I2QexTDNdvLAdsqFK8XFjEqoQejsasE9rgOPe+50dflvf/NJIHTJ X-Received: by 2002:a17:903:2351:b0:181:68a8:9f9c with SMTP id c17-20020a170903235100b0018168a89f9cmr23312058plh.115.1666425783493; Sat, 22 Oct 2022 01:03:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666425783; cv=none; d=google.com; s=arc-20160816; b=UsxqeZZ2ZtARVHH6EVEOhw83plS/jy7SruYxgym1oz5TNF7EiI/6kw40be93sI1r0t QUhT2znGr3zKwZ+mYveJRYVj44MiaK9MnDy37v/nxkw2Vj8Th5kRUSUMhkJ3cd811nNk /pjdlGo+RfgkDGI8a7f4GVFKbtoZPrIY05BGOAqzRxZF3zfedc3/ZnjWqM9Yfu6USzmU Azu90NV/5iPrf9GO1RqJaXfLgjTxH4OtD/vIa7u0FSXGdLkXcy8Qo0W1dmMy3rlrBCfZ xM0gh12en3Btlf4DeFS3AJFPz/alaA9sNarg4QCY0jZm7rCtjEA9+pTGeXLhWp070yqg MC4Q== 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=r+Q/URr8hJeUs+c7Md1YfY+258tj0MaGOnHuf0dUwdY=; b=MTSkU0rxwjaNICrrA63cNWBiUBqUR8SPZAcSZ6WVI9I7yNpnaWQrSxkob624/R+CaL UC+0BvD8YGQ48QI3HFKTvBYfZ9SmgqXLL+EXDYtO54R51OLJbyCc4O7AMGmCvBqYQN8l zYykUv+zIG11VehmX8yeiwZUz38LbDlLJsGuvAHTThUtkaH0lvF5XMbSXkV7j9l2etJH 2WuOUb4k5FtHg1BJot81QcNMvA9FaY25K1MbHLJNe7BZxCbnD8Qfs5zrSMbZFfDhimme rMV5HDkUlV2T7KSfjH+TDA/+ISfsdi8qpRB9WhzpQdnMz9oAs6yKlm4PclUtSkq2p2tW RkxQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=bDDd90nn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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-20020a056a00164600b0055fe250267dsi23857808pfc.124.2022.10.22.01.02.50; Sat, 22 Oct 2022 01:03: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=bDDd90nn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S232574AbiJVICc (ORCPT + 99 others); Sat, 22 Oct 2022 04:02:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47458 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232316AbiJVHyj (ORCPT ); Sat, 22 Oct 2022 03:54: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 D500DD6B92; Sat, 22 Oct 2022 00:48: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 0716B60B88; Sat, 22 Oct 2022 07:41:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1DB8EC433D6; Sat, 22 Oct 2022 07:41:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424490; bh=H2f0utUE260eE+Vd88zICS6WI0lF7gGGbPGRjwWNoew=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bDDd90nnDTW3/93qJyiTSm7JiLWZPdxwBW3oiSSCLyAhMmEp7SmMS5CDidBRT7EJG jrXIVSqnwZVAba4PNSpORIoKdhav0mZS4ZvY6HxMD7JMseHys1icBoUbHxF9xjwDrQ I7/PXqQF0bnqshJAX9jmXq0a78+IGhnSw40xq7z4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, stable@kernel.org, Ye Bin , Jan Kara , Theodore Tso Subject: [PATCH 5.19 135/717] ext4: fix potential memory leak in ext4_fc_record_regions() Date: Sat, 22 Oct 2022 09:20:14 +0200 Message-Id: <20221022072439.424419076@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747374082628472688?= X-GMAIL-MSGID: =?utf-8?q?1747374082628472688?= From: Ye Bin commit 7069d105c1f15c442b68af43f7fde784f3126739 upstream. As krealloc may return NULL, in this case 'state->fc_regions' may not be freed by krealloc, but 'state->fc_regions' already set NULL. Then will lead to 'state->fc_regions' memory leak. Cc: stable@kernel.org Signed-off-by: Ye Bin Reviewed-by: Jan Kara Link: https://lore.kernel.org/r/20220921064040.3693255-3-yebin10@huawei.com Signed-off-by: Theodore Ts'o Signed-off-by: Greg Kroah-Hartman --- fs/ext4/fast_commit.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) --- a/fs/ext4/fast_commit.c +++ b/fs/ext4/fast_commit.c @@ -1687,15 +1687,17 @@ int ext4_fc_record_regions(struct super_ if (replay && state->fc_regions_used != state->fc_regions_valid) state->fc_regions_used = state->fc_regions_valid; if (state->fc_regions_used == state->fc_regions_size) { + struct ext4_fc_alloc_region *fc_regions; + state->fc_regions_size += EXT4_FC_REPLAY_REALLOC_INCREMENT; - state->fc_regions = krealloc( - state->fc_regions, - state->fc_regions_size * - sizeof(struct ext4_fc_alloc_region), - GFP_KERNEL); - if (!state->fc_regions) + fc_regions = krealloc(state->fc_regions, + state->fc_regions_size * + sizeof(struct ext4_fc_alloc_region), + GFP_KERNEL); + if (!fc_regions) return -ENOMEM; + state->fc_regions = fc_regions; } region = &state->fc_regions[state->fc_regions_used++]; region->ino = ino; From patchwork Sat Oct 22 07:20: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: 7336 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1094783wrr; Sat, 22 Oct 2022 01:00:58 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6ulAbqkI5+Ty0XZ3gx/EDThXcbPkA2zKzBZTHwKsVedLdnKanB47hu5ehekKEGDSpVmzOT X-Received: by 2002:a17:90b:1d8c:b0:20d:3180:3e8a with SMTP id pf12-20020a17090b1d8c00b0020d31803e8amr26681172pjb.68.1666425657665; Sat, 22 Oct 2022 01:00:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666425657; cv=none; d=google.com; s=arc-20160816; b=HoFEv+05osH8MLRqcy2M1PL39I25GA27OQ3+EI208U62UjctvvwipudkQQ1eL1yxwI X2ForP0H/se/vcyuVSRT4WaU+qmc0WBaW9CkDd6esfql0xAaGx5Cg0M3c0faJ/6WA+xW ZuzE45lbC0b8eX/FVMIkkJtv78IpPHbCcw2QInN3Gk5kxDFR4bG9CO5fJOl32SSgTCcl 0x1y+eyooT1BQKyYN9b1DmJ8+7tFIcYIty9LVbgmbfgucTeSJ+uec1gZFFBDTD+qI6JZ C/EPtH4o7lYWJU15WfmXEMvK/4cPAmC6p0DCcY5kAfzxXTVEhmSH5cY/qMHPsotOmdDw 0udA== 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=gE1FL/73tnX4zr3Q83H8ZP7oSujxVaiQXOeqwFyp5OU=; b=yPIBXABU/grs4Zgo5r7FhtFCxRNbAPM4d+UFSeEdS0EE0o8p2sYIl/PQPX+om6Togn 2oMg+yR9iuqMhS4vG216IaSmuceSoW9jK0ngxCL8mCOKYqOJQWX4FP793WmyEEwUtJZK PZsSWPvqU8cRSGxrP0Yoir3MZzXUMYucop0ICLVyGlDYlONTO0A8esegTR5lUGLEh9XN Q6UafqB70EZUvgfvADrdQOdgT6lh4MH83j3teAzOUiuwDNOYDZAjHzdQL66kSQdU39ui rtUdz7x3/fTbAE1oMV2nRMRwLXR/91UyDSl16zC/8hIsZTt3hjlpv3D84hW40bM4bfWf M7ag== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=yUndkd4H; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 f9-20020a056a00228900b00562f2ff1579si28227917pfe.60.2022.10.22.01.00.44; Sat, 22 Oct 2022 01:00: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=yUndkd4H; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S232448AbiJVH7A (ORCPT + 99 others); Sat, 22 Oct 2022 03:59:00 -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 S232131AbiJVHyH (ORCPT ); Sat, 22 Oct 2022 03:54:07 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5583566F19; Sat, 22 Oct 2022 00:47: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 9EBF360B85; Sat, 22 Oct 2022 07:41:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B362CC433D6; Sat, 22 Oct 2022 07:41:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424493; bh=pEMmLSxLkhJ7Q0G0EGdPJvux2Lqx48XdeRTTspi2RpU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=yUndkd4HcluQiG4mSMRcso4B3oAWkjuENJN1FUkp6dQH+kD6tRqUCCL/LXXDjyE8Y +cvySZfbHibLNKpZXTqMc97Nz6nTf5YfKUzjwaZIZCqcS0CoMbOODU0mbW5RSvkpYz aLyr9txU8gfXlsaO+baCd9Kz+hgo0sfFsxUZqo3M= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, stable@kernel.org, Ye Bin , Jan Kara , Theodore Tso Subject: [PATCH 5.19 136/717] ext4: update state->fc_regions_size after successful memory allocation Date: Sat, 22 Oct 2022 09:20:15 +0200 Message-Id: <20221022072439.601141995@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747373950260234013?= X-GMAIL-MSGID: =?utf-8?q?1747373950260234013?= From: Ye Bin commit 27cd49780381c6ccbf248798e5e8fd076200ffba upstream. To avoid to 'state->fc_regions_size' mismatch with 'state->fc_regions' when fail to reallocate 'fc_reqions',only update 'state->fc_regions_size' after 'state->fc_regions' is allocated successfully. Cc: stable@kernel.org Signed-off-by: Ye Bin Reviewed-by: Jan Kara Link: https://lore.kernel.org/r/20220921064040.3693255-4-yebin10@huawei.com Signed-off-by: Theodore Ts'o Signed-off-by: Greg Kroah-Hartman --- fs/ext4/fast_commit.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) --- a/fs/ext4/fast_commit.c +++ b/fs/ext4/fast_commit.c @@ -1689,14 +1689,15 @@ int ext4_fc_record_regions(struct super_ if (state->fc_regions_used == state->fc_regions_size) { struct ext4_fc_alloc_region *fc_regions; - state->fc_regions_size += - EXT4_FC_REPLAY_REALLOC_INCREMENT; fc_regions = krealloc(state->fc_regions, - state->fc_regions_size * - sizeof(struct ext4_fc_alloc_region), + sizeof(struct ext4_fc_alloc_region) * + (state->fc_regions_size + + EXT4_FC_REPLAY_REALLOC_INCREMENT), GFP_KERNEL); if (!fc_regions) return -ENOMEM; + state->fc_regions_size += + EXT4_FC_REPLAY_REALLOC_INCREMENT; state->fc_regions = fc_regions; } region = &state->fc_regions[state->fc_regions_used++]; From patchwork Sat Oct 22 07:20: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: 7612 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1106751wrr; Sat, 22 Oct 2022 01:38:52 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4y+bGbB4t3ih0ivIrb/JgTdgtgxGbcKVEzgtq5cM3pYxEEtajRXY+7zbp/BVgRQAMDhT2p X-Received: by 2002:a17:907:e93:b0:78d:b8ff:9b5f with SMTP id ho19-20020a1709070e9300b0078db8ff9b5fmr19417752ejc.12.1666427932679; Sat, 22 Oct 2022 01:38:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666427932; cv=none; d=google.com; s=arc-20160816; b=hNwdfbgqlCPVBocmOUVwtbkz/ytTjbcCc86B0fjCNTY3/8bTXFcsSbBguUhzVqWb1d yEPIQXviZNmSMWzs58zrg2YBASgFacMArDiENI1DJFto1JQadWLflgvATZlWO9laBTP0 eTD4ywU4wfO6vDjLwPOzJIvFsyd35N2PVuerusIQp+K/riaFLdAvMwT9+ht6QKImJBKK QpsBtya3MFOT6uVp39qeq3nth6qFOjyY3nKCTTC6W7uF5laUHG36jDyTOk3xXr2Ahl7m CpAFn36Pi4xRQIM02hpOYHgUzt3KGd4pE8vB/IdCjmEMXxFDiK5533RyJ8Il7z3Gx7gE AqRA== 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=NdJFjoiW/atX5bteV+PLDwjBGvX9amQkkYKPtpVOFqE=; b=wHwSsYCUayr9VFsH7+yvw7+zWlPV4Y+VnaejrCT5RGGfkOM0Q5ipcygIglHfxSI0Ip KjntcZjEt+KIw3x7WNQMtOP0dHjCvVsIJVOBfXtKb/nn2q5rFjAVQLPqp2Pb6ED+LZIz Be09dSmJa0wscJ+NbSlYH5m6g8sgv5CwIFZX5vjiQzCn+vOm2ThwSv0l+l0FYPrhR3Ha ZGd1qDoPlHB9zKkm7eo3/R+uoPTgId4BQSXREydKWPGi6jurRuMKZCKZ8i1IHlbH+uDj oyPnwkR8SiloTR1FeuG0CI34tsoy86nOj/BNL/qYYf3FSdZwRPKONtVvfM93d/7PA9gL 2o5g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=L+hTERTZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 n1-20020a17090625c100b007417c6edb0asi18822808ejb.402.2022.10.22.01.38.25; Sat, 22 Oct 2022 01:38: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=L+hTERTZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S233698AbiJVIWc (ORCPT + 99 others); Sat, 22 Oct 2022 04:22:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43656 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233681AbiJVIUn (ORCPT ); Sat, 22 Oct 2022 04:20:43 -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 B03B82DF46A; Sat, 22 Oct 2022 00:58: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 16664B82DFA; Sat, 22 Oct 2022 07:41:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6252EC433D7; Sat, 22 Oct 2022 07:41:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424495; bh=muXk5+zb//UYPKqFzeIirwUDgkQcWmRmo0xZyDuWdZY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=L+hTERTZQICsM2vA6xZLGGfoMIQ6rbYg5N69M/QI7+T2lpNCOD0+mVQ73/I86TmCK NxDNzaXK9/NnUYam2Vb9UfZ6Jw32YM9fZAGm1FSv0v9bxVeyClqXlA1VwhonF6BH9l nlCXIPf28d8touhuIXZRxL5BprYxGTDbpdiLNfPk= 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 5.19 137/717] livepatch: fix race between fork and KLP transition Date: Sat, 22 Oct 2022 09:20:16 +0200 Message-Id: <20221022072439.781084021@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376335633599860?= X-GMAIL-MSGID: =?utf-8?q?1747376335633599860?= 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 @@ -610,9 +610,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 Sat Oct 22 07:20: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: 7250 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1091484wrr; Sat, 22 Oct 2022 00:50:48 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4RgtSLWgBqQDik/ZI/G0XWmdr8V0iGsRrY3R/umY9hf6utH4TDjCLS3nockFh+OjuWCdVH X-Received: by 2002:a17:90b:38d1:b0:212:510b:e5e6 with SMTP id nn17-20020a17090b38d100b00212510be5e6mr14073888pjb.116.1666425047818; Sat, 22 Oct 2022 00:50:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666425047; cv=none; d=google.com; s=arc-20160816; b=qO6YHrCxWkcRnkWxD3FZ3s9M08XLZDBB2Qp0elsddL7VUW4oU91gm29vLfB+nHGspq HrDpmyGWPV5I4ysqPM0ycTYMN/MZH8Z5bsx+fW2bnck6e4eIAUcn74sgdSDNzoLbykqZ lQpQVQbdjha01u2Rd2XIfm8ye8Tc0gOpCYz9QF0UJi6ySxP3Y9dU2yoQXfMuExpB1ZP+ 1NhOyX/21tZTGV3tWT2ZI2MyTOkZ6ZHX9uMsrLAol0pcSfdKAZH1Z6ypY4pWzDg3dOag g45gJnayQkd82MY03KaSyTUY2MI7FweQ5cBFGNZ2Cyft4ogfEjjyoaHbgGHzPT8TmGQ2 /JYw== 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=Ht4lAs2HD0gBAYk79TKdPrvWP51ndiBagm2a8trD7Gk=; b=YZ3m7dzLtnQfngvbRtsCRy7mNUFCLnJjm6Q5nJ7QIwHxCkdQMAe/3T260+w0tWA0cd hlJ81ILsArHEv9hUpNvYdJ/hrV8qIXl0eJx1/XmUaGw93V1rh0f+7XwcQ5MwVmPxVyyx zvFJgf9ERFvwud4fyDX2EVyJWT4Fsr3NWKJkQxfpElxz9lNhCIHzztYPrOCFI2cVbemS LBHgI/O8YNWpEZEZ+pcv9sMx7iXJ+r+ElVLj82wbw/bze3vh95tRMHi5CsJ0xjZ83Gno oDSF0EyQ6q2F+z4xLgi66M5KF7juuTBE0XFPXwEvxHuP7DqeM3fs6g5aNB7r2RRD/S/n MbDQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=hTGBxYbg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 q24-20020a635c18000000b004589dfd10e2si26549989pgb.38.2022.10.22.00.50.35; Sat, 22 Oct 2022 00:50: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=hTGBxYbg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231651AbiJVHuI (ORCPT + 99 others); Sat, 22 Oct 2022 03:50:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34360 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231397AbiJVHso (ORCPT ); Sat, 22 Oct 2022 03:48: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 F35ED1D4DD0; Sat, 22 Oct 2022 00:45: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 E863D60AFA; Sat, 22 Oct 2022 07:41:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0AA41C433D6; Sat, 22 Oct 2022 07:41:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424498; bh=APosRWLMWXRR23CdEQKkKNR6lfRUIpIXd8OHjaqegVg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hTGBxYbgJoKS99uLqaMAdKTWeMuwDj5x0vFkxlR/YD3Q9/eFp47/0IRlEIllRb3aW uO+tJATFa4zYeI/mfWLpeBcNqUj7F+l3PJLEM3Xc+Y7mBTGpCS3VIVOfxeNwCVn6CK bzrt6PcG/1+eyBTSyR7vL/NM6V1SQ1YHX6du7VLk= 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 5.19 138/717] ftrace: Properly unset FTRACE_HASH_FL_MOD Date: Sat, 22 Oct 2022 09:20:17 +0200 Message-Id: <20221022072439.964516610@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747373310819507988?= X-GMAIL-MSGID: =?utf-8?q?1747373310819507988?= 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 @@ -6037,8 +6037,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 Sat Oct 22 07:20: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: 7196 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1089554wrr; Sat, 22 Oct 2022 00:43:42 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5GsLIwf7fr8u7x9/0QdJFZmk1BD5uMSOOwNrP2vYNFMTLrE53e30ycVSAjvsRdsXCFJaIF X-Received: by 2002:a05:6a00:3406:b0:55c:e661:6d31 with SMTP id cn6-20020a056a00340600b0055ce6616d31mr23266592pfb.42.1666424622364; Sat, 22 Oct 2022 00:43:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666424622; cv=none; d=google.com; s=arc-20160816; b=PxykX+67aQGR6eBG6khr2qSVFCF+LOcp+hyryIaOWZfCGfEwmqR9vM0Nq+c5Z+mq9i YKqINyi0225CCnC9yYaTeqZx6dU5VpQJpqGfJIdK1z3rbqnUnzysctynSD7ZT5eLwTAH 0LrotZ+dYRDahWxim1Rd8PlxmoO2wg/ORQCvyHlH0vMQ45oTf4Qw6dJ5Kxt85fszq0+m vJBXEa8Yf7QqDGQdz11A1rXHp7sEMN6YmJQOQyhoAZbD5SpyAxIsC8C2iYHDRVgUdXyY JZ+aMhtix8qjjMJY05449jb5d8R8Z8q7LC7mIHa1NJjARPMkxUm+TCDbyqQyYUyvgGA1 T79w== 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=n0VOmqLfP13QpEzVp6ALI2kerjJp6DLi0eGBMFlxU0U=; b=wJT6usGnglFJA1Ge64I5FiFV17hi8lSvb+HcLAjLEEGyOw0YC7rUViXrX/IDQ4UxRA PlBfUtX7MzCgmxiIfdweUAyQ6P2y0FPHVaY0d5P5yffqseCgqizjk4wn7axkj0kzelNh dNOV8b+jRE4N+ckHvUillcLp1RpmD4QBssiYbYPxVdsmdOKy/eaub6PgXo/4CWB/oaWq d9ZIXogldMzFxDLknxi8eHqcYnxfHZ4bkD/2kg8bcS1mrcreF9kd4y2WolExLKbHdzbt sHap8n6kyJ6JKTV2lq4iJbPhnkDE6oecO8eFjba9z+TeLcFLhdMkf0etOWsqAbu4Xcut 0s8w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=XtPcmWPL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 h190-20020a6383c7000000b0044155d195dfsi4417844pge.477.2022.10.22.00.43.30; Sat, 22 Oct 2022 00: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=XtPcmWPL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231297AbiJVHnP (ORCPT + 99 others); Sat, 22 Oct 2022 03:43:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46264 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230423AbiJVHml (ORCPT ); Sat, 22 Oct 2022 03:42:41 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B1E7E2AF664; Sat, 22 Oct 2022 00:41: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 D696DB82DFA; Sat, 22 Oct 2022 07:40:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 297F1C433C1; Sat, 22 Oct 2022 07:40:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424418; bh=n0fGfRBiT9uOih5KFRg5N8AxE8nZsfp4iCYMC7KBs8g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XtPcmWPL0lpmEDGSY4jr7pHxo2P2oZAhKnmaa7g4EV6nfcDM+t5lU9vqEn02LpOAu bJcthNXfN/+Rc+rKCqv63Ye6vmbDhFBPyIXf0ZWjmbPt37XofmXZEWEC6YgiphX93T qmp5+acZSClgi1YIIslYetf83JlYeylIboIYMNlU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Masami Hiramatsu , Andrew Morton , "Steven Rostedt (Google)" Subject: [PATCH 5.19 139/717] ftrace: Still disable enabled records marked as disabled Date: Sat, 22 Oct 2022 09:20:18 +0200 Message-Id: <20221022072440.144700622@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747372864614192981?= X-GMAIL-MSGID: =?utf-8?q?1747372864614192981?= From: Steven Rostedt (Google) commit cf04f2d5df0037741207382ac8fe289e8bf84ced upstream. Weak functions started causing havoc as they showed up in the "available_filter_functions" and this confused people as to why some functions marked as "notrace" were listed, but when enabled they did nothing. This was because weak functions can still have fentry calls, and these addresses get added to the "available_filter_functions" file. kallsyms is what converts those addresses to names, and since the weak functions are not listed in kallsyms, it would just pick the function before that. To solve this, there was a trick to detect weak functions listed, and these records would be marked as DISABLED so that they do not get enabled and are mostly ignored. As the processing of the list of all functions to figure out what is weak or not can take a long time, this process is put off into a kernel thread and run in parallel with the rest of start up. Now the issue happens whet function tracing is enabled via the kernel command line. As it starts very early in boot up, it can be enabled before the records that are weak are marked to be disabled. This causes an issue in the accounting, as the weak records are enabled by the command line function tracing, but after boot up, they are not disabled. The ftrace records have several accounting flags and a ref count. The DISABLED flag is just one. If the record is enabled before it is marked DISABLED it will get an ENABLED flag and also have its ref counter incremented. After it is marked for DISABLED, neither the ENABLED flag nor the ref counter is cleared. There's sanity checks on the records that are performed after an ftrace function is registered or unregistered, and this detected that there were records marked as ENABLED with ref counter that should not have been. Note, the module loading code uses the DISABLED flag as well to keep its functions from being modified while its being loaded and some of these flags may get set in this process. So changing the verification code to ignore DISABLED records is a no go, as it still needs to verify that the module records are working too. Also, the weak functions still are calling a trampoline. Even though they should never be called, it is dangerous to leave these weak functions calling a trampoline that is freed, so they should still be set back to nops. There's two places that need to not skip records that have the ENABLED and the DISABLED flags set. That is where the ftrace_ops is processed and sets the records ref counts, and then later when the function itself is to be updated, and the ENABLED flag gets removed. Add a helper function "skip_record()" that returns true if the record has the DISABLED flag set but not the ENABLED flag. Link: https://lkml.kernel.org/r/20221005003809.27d2b97b@gandalf.local.home Cc: Masami Hiramatsu Cc: Andrew Morton Cc: stable@vger.kernel.org Fixes: b39181f7c6907 ("ftrace: Add FTRACE_MCOUNT_MAX_OFFSET to avoid adding weak function") Signed-off-by: Steven Rostedt (Google) Signed-off-by: Greg Kroah-Hartman --- kernel/trace/ftrace.c | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) --- a/kernel/trace/ftrace.c +++ b/kernel/trace/ftrace.c @@ -1644,6 +1644,18 @@ ftrace_find_tramp_ops_any_other(struct d static struct ftrace_ops * ftrace_find_tramp_ops_next(struct dyn_ftrace *rec, struct ftrace_ops *ops); +static bool skip_record(struct dyn_ftrace *rec) +{ + /* + * At boot up, weak functions are set to disable. Function tracing + * can be enabled before they are, and they still need to be disabled now. + * If the record is disabled, still continue if it is marked as already + * enabled (this is needed to keep the accounting working). + */ + return rec->flags & FTRACE_FL_DISABLED && + !(rec->flags & FTRACE_FL_ENABLED); +} + static bool __ftrace_hash_rec_update(struct ftrace_ops *ops, int filter_hash, bool inc) @@ -1693,7 +1705,7 @@ static bool __ftrace_hash_rec_update(str int in_hash = 0; int match = 0; - if (rec->flags & FTRACE_FL_DISABLED) + if (skip_record(rec)) continue; if (all) { @@ -2090,7 +2102,7 @@ static int ftrace_check_record(struct dy ftrace_bug_type = FTRACE_BUG_UNKNOWN; - if (rec->flags & FTRACE_FL_DISABLED) + if (skip_record(rec)) return FTRACE_UPDATE_IGNORE; /* @@ -2205,7 +2217,7 @@ static int ftrace_check_record(struct dy if (update) { /* If there's no more users, clear all flags */ if (!ftrace_rec_count(rec)) - rec->flags = 0; + rec->flags &= FTRACE_FL_DISABLED; else /* * Just disable the record, but keep the ops TRAMP @@ -2599,7 +2611,7 @@ void __weak ftrace_replace_code(int mod_ do_for_each_ftrace_rec(pg, rec) { - if (rec->flags & FTRACE_FL_DISABLED) + if (skip_record(rec)) continue; failed = __ftrace_replace_code(rec, enable); From patchwork Sat Oct 22 07:20: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: 7519 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1105142wrr; Sat, 22 Oct 2022 01:34:13 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5Jpn/LfblFhehyhTi554AORqXFoOC93HufY9drG6SSYW/PqClWzw3fqbYWu88BcdPR9lTo X-Received: by 2002:aa7:96aa:0:b0:566:5057:3fdf with SMTP id g10-20020aa796aa000000b0056650573fdfmr23094728pfk.35.1666427653059; Sat, 22 Oct 2022 01:34:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666427653; cv=none; d=google.com; s=arc-20160816; b=DzHje+OtYG+05FiUYXrnB4VrKporSYe49ki6iEmw8SWESw/Jm6263XrCxu9felXiYa Vyfe21HAMycxynwdTjPV8zWi4ecLo75+AnyJAEqBQDuSxYmUM52jwTrg/6WTa1+BPc4N Kga1lraPIsOTHBDT2b6Kr06bKT1rUUKnLwkloVGKW88b+8O4yww/maBtk1uvsgn5dYuD 8Y3GHck5d/OPvCb6rlx/0xS2/b1K+Zi5CD8GSHbXH8t8Eh1C+mtp30TPogdOOmM7fLsv aEoIu8yZYdkS/sYNg5FazD/WIiYMB8VGhSxIL2dRAeDKGG68GRaEm9/AkOYh8rf4ySlh q52w== 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=iAcpwmqtvMsWnBA1wKY6nqifE/qZlcrQLqQuTj1uuPc=; b=QIP31VHvoYcSjQuGrvTKwOPb4MHzZAbgOZ0OMM47MpQ2zMTf8RfHH46KhotK/k0kPl pQJvRTR97ha70TRdDfuJIW/keMteKuNoxA9xFRf4DBpJXfXLJiLCpwYYawjdk1pXdi/d vXnaF4nWyprkrduPN6LHPTGilnFWePWjcRlYNb/REOYU5Mji2crFkFQZQt9aC6jJn8x8 R027MQjx0NCwlRsI+ytzIpu55UwEbVxC4hSGYPjbdVtmZdLTab2CvXisa4gVtwvHgcPY azyyPWcKP29DjRO/4cOFMuzVenFcBZbtTol1+/v9LtVm0iZn6AGEOyIVZVjEnAbLv9t6 t5DQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=gNGLmX8+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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-20020a632c03000000b00460c67afbd9si3498256pgs.771.2022.10.22.01.33.56; Sat, 22 Oct 2022 01:34: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=gNGLmX8+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S233185AbiJVIVU (ORCPT + 99 others); Sat, 22 Oct 2022 04:21:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52120 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233805AbiJVITq (ORCPT ); Sat, 22 Oct 2022 04:19: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 856E52DF44E; Sat, 22 Oct 2022 00:58: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 A708FB82DF9; Sat, 22 Oct 2022 07:40:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F118AC433C1; Sat, 22 Oct 2022 07:40:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424421; bh=FBSqfGdqenbLRx3kzmze2zovm+J2vRZ3J4A4qSTPPVo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gNGLmX8+Fo6ekLPDvG3Ib7p6Pv9vaoPLHPupPEpBC9BXKA2I3cE/rHG/o6OqSf+3k bUKEmQmbsNYmscT/IDnpIbXJGekLJwCJWXp86nmhlAWPzKfqXFjEDpWgHhwLedVA3d wi+MMzcqlmU37s8vMi/nCD6ZiwQUwL/Vh8unYUvE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Steven Rostedt (Google)" Subject: [PATCH 5.19 140/717] ring-buffer: Allow splice to read previous partially read pages Date: Sat, 22 Oct 2022 09:20:19 +0200 Message-Id: <20221022072440.357709319@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376042496565835?= X-GMAIL-MSGID: =?utf-8?q?1747376042496565835?= 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 @@ -5616,7 +5616,15 @@ int ring_buffer_read_page(struct trace_b 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 Sat Oct 22 07:20: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: 7197 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1089570wrr; Sat, 22 Oct 2022 00:43:46 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6pSE5VbMpZ2TqKLERYSE/1QBJwG2o6gTwqIYrAQ4jLDCr8kBCWiBoL55u/peUCTy3qi9Y1 X-Received: by 2002:a05:6a00:1581:b0:563:36e1:38a8 with SMTP id u1-20020a056a00158100b0056336e138a8mr23883816pfk.80.1666424625645; Sat, 22 Oct 2022 00:43:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666424625; cv=none; d=google.com; s=arc-20160816; b=UUdcj9HQWqmmAUGBnj7XJeGKwPS0MBHOzerbeQ5kaY/NoOs8rV14W+rTfeppeJEs7u Ay938Q7Pm/0Deq0D0lzaRwK1qsPoHK6jvsQK47XI6NYap47OU0SiJyD6W33q4vr3p5ej ZLWTMwpK/ZU6K6nV0fxo4heSGMb5hzwJfFCRCwA55WQkJQFI5cLtuFFQ7mGapvrK2uVq TFrJSvFs1VPMbg/fTZ92r5J6XQ8T4Q+VrwqBva60l55XrynZUy4Onxk1YnGYXmah4pRS xHu7GZYpBQ05UZIcc1ZdrygHZ6k4NLBUNCbxaIlhuZOj8UbA0iXXo42U3ajrs+eyyQtk 0/Yg== 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=PNiAGidTY8HZy9wJ3VBB7riwl6/X15zvaN92xDtqPZg=; b=csB/h6ZA6wGDschDN/cZZkyjzWZ+3FIHthq1my/078bJll17Mwi3FjiNBgPKtjwM+t F1iYnxwYVbQQ+5aO2D2m0n2IRXHZKBnBrDRhMavgkQLrk+/BqnRr+zHZX/9tRmtprXYX ekcOJQhPO/LRo1sWK8Ppor5dnbTKm/WY35EpmrpN0J/lQSy0+5k/q3J4WlnJc404F09I 8ZmovCFoeY15wadE9qCBA7AKCGJJ2l3yb56myuBmPnbivG5v0+Zg593AdetrBSEpXvqb 95OmnjCXC7ZrfBNxnNSrHnLmm9KGLghyZHxbD+zQnThaEx0vRehOiBTcqUge0xKj5hl6 fDfg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=F5g1rnGA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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-20020a17090aee8700b0020d67aeb299si1963520pjz.53.2022.10.22.00.43.33; Sat, 22 Oct 2022 00:43: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=F5g1rnGA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231240AbiJVHnU (ORCPT + 99 others); Sat, 22 Oct 2022 03:43:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41766 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230499AbiJVHmm (ORCPT ); Sat, 22 Oct 2022 03:42:42 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 46336625F3; Sat, 22 Oct 2022 00:41: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 32636B82DB2; Sat, 22 Oct 2022 07:40:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9A99DC433C1; Sat, 22 Oct 2022 07:40:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424424; bh=TPb/yB1MCUdUFLId2liiAjLSSp0M8QMyY8PRDvoLSwg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=F5g1rnGA8vevLb4LfwG3yPsLG/IBnd2z6fZS1DwMh1SMiP02B76M961320ZAvmnb6 OVJpnhaD7SUhWhgzPfz02LYtqP8kJgLHBGmOSFOPlXtzv5DzHfM8sKGkOrRgE/bZXD YJSlMl2qVo7NaQAszVsIT+M7WneiB2PogQtPg5sw= 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 5.19 141/717] ring-buffer: Have the shortest_full queue be the shortest not longest Date: Sat, 22 Oct 2022 09:20:20 +0200 Message-Id: <20221022072440.524799436@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747372867907447024?= X-GMAIL-MSGID: =?utf-8?q?1747372867907447024?= From: Steven Rostedt (Google) commit 3b19d614b61b93a131f463817e08219c9ce1fee3 upstream. The logic to know when the shortest waiters on the ring buffer should be woken up or not has uses a less than instead of a greater than compare, which causes the shortest_full to actually be the longest. Link: https://lkml.kernel.org/r/20220927231823.718039222@goodmis.org Cc: stable@vger.kernel.org Cc: Ingo Molnar Cc: Andrew Morton Fixes: 2c2b0a78b3739 ("ring-buffer: Add percentage of ring buffer full to wake up reader") Signed-off-by: Steven Rostedt (Google) Signed-off-by: Greg Kroah-Hartman --- kernel/trace/ring_buffer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/kernel/trace/ring_buffer.c +++ b/kernel/trace/ring_buffer.c @@ -1011,7 +1011,7 @@ int ring_buffer_wait(struct trace_buffer nr_pages = cpu_buffer->nr_pages; dirty = ring_buffer_nr_dirty_pages(buffer, cpu); if (!cpu_buffer->shortest_full || - cpu_buffer->shortest_full < full) + cpu_buffer->shortest_full > full) cpu_buffer->shortest_full = full; raw_spin_unlock_irqrestore(&cpu_buffer->reader_lock, flags); if (!pagebusy && From patchwork Sat Oct 22 07:20: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: 7426 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1097828wrr; Sat, 22 Oct 2022 01:08:51 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6pUG9PgsoZoA7Qhq0AZrY5pNe+Ma5cCMTHnPpU0ByBtiW8lu2YQvNnT4FQ8suqYUgACEvw X-Received: by 2002:a17:90a:1197:b0:212:cfa7:8388 with SMTP id e23-20020a17090a119700b00212cfa78388mr8009648pja.4.1666426130875; Sat, 22 Oct 2022 01:08:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666426130; cv=none; d=google.com; s=arc-20160816; b=Eq3Wz4CdcFpul88mGlndk8PBoNH3hEb5M9g3HHMSCRbFAZS9vcLSaN+E0fYFUWgwYt bmE2lynSRaQUv7C42jthmDg71V6Ubkm9wlal4cAS0OYpbH6ygQXPJku2vln9StyC1dW0 ovSgb2rj8xKauhtKflOwD0LbU3KEsO05abUJl168s3ZIaoulLMHiU5NI4cdZV7B3rrB1 CsIqKO3WaIDxAe9jdyUbuPnoq4X9U06z4ACNT0OmgvJsRwq4n3lIJGF9A1Ts+BsCYspB 5dPhurz5UKchRfUw+XInh13jvzgrzESXXJQtJzI0q0QW0h0qmE4VrulJ5T+qe9eunfjZ ejEg== 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=tg3zZCik7o/KSYcmfzFiaDMuKBEp8A7+YAOkoZleivE=; b=FpIugCPimaQyH+dpRm9CRLcZFd1UCczkCWQXsCehVS70Z1J+yusY5sQu/jA62+KXUS dZgN2/EC/79SZ4Aia930VAk0Oy4UR1X8lnYDT//jZAp6gbzhuiAuCiE+dPNrWVxRLqQy Fzq5OVOwkOOg7Hlu2eE9AhvgKQ+ebdGpXR4OcQF3p0hQ+hwQGd71AZhcG6YQq1wwCdj8 v3THNmBSG4oeksi5Ck4sE5qhFNP0i5UUoM30kzHY+qoprA36fEWkWYYDbOqRKMGLqPiP ouDL30hCgCRdN/4FPfhkm5g+npVm/eT3Jvy278t3eRcbyJ5BzSmujFkuwLP3ILWGJYI+ YoLw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=eP3soSCH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 18-20020a630d52000000b0046af0960898si25686514pgn.625.2022.10.22.01.08.37; Sat, 22 Oct 2022 01:08: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=eP3soSCH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S233057AbiJVIIT (ORCPT + 99 others); Sat, 22 Oct 2022 04:08:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59036 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232954AbiJVIEb (ORCPT ); Sat, 22 Oct 2022 04:04:31 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 691722D37D9; Sat, 22 Oct 2022 00:51: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 C84AEB82DFD; Sat, 22 Oct 2022 07:40:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 46305C433D6; Sat, 22 Oct 2022 07:40:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424426; bh=lqz+c27qLgPZikG/yh+pME2iMkbgYwjlbdPKAFUv/fY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eP3soSCHr8WlSh7UPDnmzk+cndNC5RtMnTGcvwEuigMBcaQK31q0DCRpaW0rZtEJu q7hxrdjSunC//zQXpZjk16DcPYoyFIhXRZuGlGKrVn2CdXowktEtoy2/FQxx9h2gM0 X9IuI4z73fv9I4/aMH0yPGijH4oFeu/RhTYsmwE0= 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 5.19 142/717] ring-buffer: Check pending waiters when doing wake ups as well Date: Sat, 22 Oct 2022 09:20:21 +0200 Message-Id: <20221022072440.676346757@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747374446200473461?= X-GMAIL-MSGID: =?utf-8?q?1747374446200473461?= 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 @@ -917,8 +917,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 Sat Oct 22 07:20: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: 7198 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1089608wrr; Sat, 22 Oct 2022 00:43:54 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7ZYXCw/dOL0Wi3navMayINPYil8qq0LgpV2tc1Z8+eXVyJtv+cUSDI0WBbH5rcw9DHijyv X-Received: by 2002:a05:6a00:998:b0:563:3428:65a0 with SMTP id u24-20020a056a00099800b00563342865a0mr22958228pfg.22.1666424634362; Sat, 22 Oct 2022 00:43:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666424634; cv=none; d=google.com; s=arc-20160816; b=WtnZJwqoG3Ud296Hcth9qFDetu2K7F5p1kgFqxM2c+UdjeD1sjqu1oOkVkEZ0r8zi8 eM8djZu1uSAq03JQYO0MwsBiq2t1Nn3WJYLigzb4rsshAUxoPboLFgFrVyTXLUobrEAV YUlsp2OSu1ANWzwx0Mv7sVYhAINBuXOazt92kZhuLqpeKKANpkgX6B3HqzZ8Ugqw8du6 fXL2FwfTRTEQ5dozWr+cdKdG8b7jPZ3PiGHW8ihtNSNrd4Cx5by4oEzvVuuls/FQxTST QZyWY1ncWzhUTTQt385oMZcyQ5GMX5/AesbFTYEjKtIP9ycGQaCSH2HmXHQKM3188S4r jykw== 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=y9yzAIWNNuhVv5FuC4VJWtp6Cz4kMPKpUnXBWUB+jP0=; b=HhSldMdZuoAEjdBxeBovQv2bbqJ58sLmK2Yc/1sIY9l6L7GsPq/NPINe4QjZTKsXZY 8eeElm27UPIsRG7usDBB0dzr2WOlMtBXFJalO/TCXi464okYRHbvk8Kg+nGEx3vJSGkq 0ZUvjWtdwCH9esndmT31MIwcxiFuX+iQOlDNKOUviEsCHdhyD6qXaCRveulZxM6gSKU7 BBNY8qesD7qMRfreUFjO0kWb0i+vYAXmmNzUCb+3skpNaP/P109wME7btPTHbbydmkpk DJxE8I8iod4fRv8GBo3ZhHHacPPnC0UmPpp59CcGWgzYIF/CtWsa46tcbL1FF2+KwsHS el1A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=st18SdsI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 q75-20020a632a4e000000b0046ec98eaae4si3356996pgq.451.2022.10.22.00.43.42; Sat, 22 Oct 2022 00:43: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=st18SdsI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231191AbiJVHna (ORCPT + 99 others); Sat, 22 Oct 2022 03:43:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47756 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231197AbiJVHmy (ORCPT ); Sat, 22 Oct 2022 03:42:54 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5CB106C12D; Sat, 22 Oct 2022 00:41: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 9ED70B82DF8; Sat, 22 Oct 2022 07:40:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0486FC433B5; Sat, 22 Oct 2022 07:40:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424429; bh=b8MlR2uiSgcn2sfEO2O+eztyP0E+QW2yZ9/nitKtF8o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=st18SdsIZBwgGo2YSLBQx/XfeU0LcgfySB9ie/oOVJicX6fHxbEJilaNTeF3J4Ml3 w22zRnna0DmA9FztSzizbYTybJvklBqZhfiGZ0018pxSeKeq72DumNOPFMYuBuGLJo 06m7V6GlY9a1x0Yl1HZoTdr1Wlhzugu7YNY2V0vo= 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 5.19 143/717] ring-buffer: Add ring_buffer_wake_waiters() Date: Sat, 22 Oct 2022 09:20:22 +0200 Message-Id: <20221022072440.827755451@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747372877256726909?= X-GMAIL-MSGID: =?utf-8?q?1747372877256726909?= From: Steven Rostedt (Google) commit 7e9fbbb1b776d8d7969551565bc246f74ec53b27 upstream. On closing of a file that represents a ring buffer or flushing the file, there may be waiters on the ring buffer that needs to be woken up and exit the ring_buffer_wait() function. Add ring_buffer_wake_waiters() to wake up the waiters on the ring buffer and allow them to exit the wait loop. Link: https://lkml.kernel.org/r/20220928133938.28dc2c27@gandalf.local.home 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 --- include/linux/ring_buffer.h | 2 +- kernel/trace/ring_buffer.c | 39 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+), 1 deletion(-) --- a/include/linux/ring_buffer.h +++ b/include/linux/ring_buffer.h @@ -101,7 +101,7 @@ __ring_buffer_alloc(unsigned long size, int ring_buffer_wait(struct trace_buffer *buffer, int cpu, int full); __poll_t ring_buffer_poll_wait(struct trace_buffer *buffer, int cpu, struct file *filp, poll_table *poll_table); - +void ring_buffer_wake_waiters(struct trace_buffer *buffer, int cpu); #define RING_BUFFER_ALL_CPUS -1 --- a/kernel/trace/ring_buffer.c +++ b/kernel/trace/ring_buffer.c @@ -413,6 +413,7 @@ struct rb_irq_work { struct irq_work work; wait_queue_head_t waiters; wait_queue_head_t full_waiters; + long wait_index; bool waiters_pending; bool full_waiters_pending; bool wakeup_full; @@ -925,6 +926,37 @@ static void rb_wake_up_waiters(struct ir } /** + * ring_buffer_wake_waiters - wake up any waiters on this ring buffer + * @buffer: The ring buffer to wake waiters on + * + * In the case of a file that represents a ring buffer is closing, + * it is prudent to wake up any waiters that are on this. + */ +void ring_buffer_wake_waiters(struct trace_buffer *buffer, int cpu) +{ + struct ring_buffer_per_cpu *cpu_buffer; + struct rb_irq_work *rbwork; + + if (cpu == RING_BUFFER_ALL_CPUS) { + + /* Wake up individual ones too. One level recursion */ + for_each_buffer_cpu(buffer, cpu) + ring_buffer_wake_waiters(buffer, cpu); + + rbwork = &buffer->irq_work; + } else { + cpu_buffer = buffer->buffers[cpu]; + rbwork = &cpu_buffer->irq_work; + } + + rbwork->wait_index++; + /* make sure the waiters see the new index */ + smp_wmb(); + + rb_wake_up_waiters(&rbwork->work); +} + +/** * ring_buffer_wait - wait for input to the ring buffer * @buffer: buffer to wait on * @cpu: the cpu buffer to wait on @@ -939,6 +971,7 @@ int ring_buffer_wait(struct trace_buffer struct ring_buffer_per_cpu *cpu_buffer; DEFINE_WAIT(wait); struct rb_irq_work *work; + long wait_index; int ret = 0; /* @@ -957,6 +990,7 @@ int ring_buffer_wait(struct trace_buffer work = &cpu_buffer->irq_work; } + wait_index = READ_ONCE(work->wait_index); while (true) { if (full) @@ -1021,6 +1055,11 @@ int ring_buffer_wait(struct trace_buffer } schedule(); + + /* Make sure to see the new wait index */ + smp_rmb(); + if (wait_index != work->wait_index) + break; } if (full) From patchwork Sat Oct 22 07:20: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: 7246 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1091346wrr; Sat, 22 Oct 2022 00:50:18 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5ZVWKneWrOPhtXix7F86EtOm4sfjJxgudVJMnSnHuNJiMT2IAzpvZD2uo46lkvBsQXWNQP X-Received: by 2002:a63:4753:0:b0:462:b3f0:a984 with SMTP id w19-20020a634753000000b00462b3f0a984mr18908310pgk.501.1666425018568; Sat, 22 Oct 2022 00:50:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666425018; cv=none; d=google.com; s=arc-20160816; b=y643okSlIfM+l7h9tdMe6fRV7N6s52+Fh7Xd6vEBOvQm4gDOG8ldPdkYwxko4Fboej uqHMrrlIA46jyimznWe3tLv9KdOO9+jtS6m+nsg1cFibs0JFbGQkWBomlFVC2t/WzYb8 C3nZxNrxFb2/6BqsUfHA3ql2pzFWtk5Nwy3Wkb8r0cxzZ1RMhWLso1efAsm1MiPjPLvF 7A8xmZMQ5kEqddGXKfI1bTGNjjAYrSAgEfv1vdFOhFqEOTMc5blRhD2dJ77oaw0Xz32N MAAZhUICSy1swbsxIvC8AcrLmdHZrcNDUdLwZYIX3N+X2ye9qVi4A3AfEYTtxCJuAPJP qFvg== 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=UOt1WGDQxSQW2xTtDRjuisOPSSSCAy5xQFVvh0cBWS4=; b=ujO4oi57Mp0V11QyS/5NpPsH8F/IFHVzHEpmgfRNdqO/2GLUU/scnLNhZD653pftbc +3J1Xnl/0cmSuQsFlk0hMb9QTfkUcv5UdpbiyWBoCtyUCs0kERLbqWhJ5pE158Pe76zQ KPxsjilQkRH7Ake3W1LYUPbJgCOzQ3LJThrsnfUK4eEN2iLnsXrXh/mnDdoDRM6Jf1ww uSh7UvE5zhIfPi/PJ2i+bEyLqHsDGlTbKBzq75zubGNgcV2U83Yyi1yU4CFfY7pnadS1 s7ciAdyk0ip4b6OvL0aAF7QOZlj0ErpJ4e4qmUudPYr+JnURTrdu87FbRjnL9S2/Na6n hhag== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=dfNykANV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 i184-20020a6387c1000000b0046ec91a400asi3224921pge.70.2022.10.22.00.50.03; Sat, 22 Oct 2022 00:50: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=dfNykANV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231522AbiJVHtu (ORCPT + 99 others); Sat, 22 Oct 2022 03:49:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49394 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231487AbiJVHsh (ORCPT ); Sat, 22 Oct 2022 03:48: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 4681A107ABB; Sat, 22 Oct 2022 00:45: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 A49AA60B83; Sat, 22 Oct 2022 07:40:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B68CCC4347C; Sat, 22 Oct 2022 07:40:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424432; bh=tWoOO/LZBB6eOZofEyhGg+yRNm/CjZobcH/Luks7w2M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dfNykANVLZJLR9JrwTD9siKUBRAojC0TYRoAZXCHHxrrO7RgqiIYgVh7gYuMiqMkw Qofv4X85ds5mhvenZgJmpTfazH5S7S79zhGF4bd+BU4lKR7lhuNSEUA4UFQfiqceuO CnCiWDNja8UM8MIKiKZ4+MltqY4gi1OQJJkkRWfE= 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 5.19 144/717] ring-buffer: Fix race between reset page and reading page Date: Sat, 22 Oct 2022 09:20:23 +0200 Message-Id: <20221022072440.986037834@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747373280436767361?= X-GMAIL-MSGID: =?utf-8?q?1747373280436767361?= 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 @@ -2648,6 +2648,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; @@ -2659,6 +2662,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); @@ -4627,6 +4633,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 Sat Oct 22 07:20: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: 7592 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1106324wrr; Sat, 22 Oct 2022 01:37:31 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4sBc/5FcbJWotqAuRqpNZnAZN+KleWNYHJWJEQyZRXHcBS0VwfLJnZkowAE7l98MmsH/xw X-Received: by 2002:a17:902:db09:b0:184:ba4f:af28 with SMTP id m9-20020a170902db0900b00184ba4faf28mr23001523plx.145.1666427851298; Sat, 22 Oct 2022 01:37:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666427851; cv=none; d=google.com; s=arc-20160816; b=ek49njmsexC+cpEH/VPUev4CigCdY5aPIRQu7e6HPfWleXy8GXsmJjr3fAIqgur+X0 uygayHOFjXNMkc2QBBTULpNO9SCCec6V08qUwYc+/lY1pdylx/Jvqs4rxm5J9X+e8hIV AoK/Cd4PkNukqj/UcrC/d0H5RxymeFBP5YCvsZ41wL9/GVBBdKYK1nOHX1NFA67lyABG VjoUEBqIL21/U1Ekk68u6MIsNjPkW7/OheAadIt8FJG9JDthrfjsunp8GUaPu24IfVF3 VCQo5E4M5EsO5H1S+cbxQJHF0fwaejrndfjQshsCh2VBHKEJCEUUfWGig6KZFGoa2LeX k5gw== 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/npWSUVRZlLb9Df+tuvItHwazs/tdMHZLW5QO4s0qE=; b=QQ4LgTq6xwX0z4EFEzDbn0e1GF0gtqMZ9RQplM3BCQyA0IZo8sc6oLlv8c9KJsTfVZ LLP1Rt/n5Etmx1i4VnNdL8D88bK48oEj443YuSf7Jf8xVeVznZSF/5JpfU1Gt3eaEaoa hjhkRgO7PRSlQh+F9Hiydm1i0SQpLHJN/PArd/b7G940HIvjwdQkUX5DpYJm/I75PFe0 /w9KG14TOCiByRk0s2fy5mDHflmK13o/TONXaPym43pel9PSQWcMqv2JziZ5dvRtIE+2 RZAsH6wciovxeB8Br5tzwZRadQbqnXjUrT5S2hVsv38zu9K0c4cd9NToHsnD8V6J6eVN WaEA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=uS89cP5T; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 h19-20020a056a00231300b00563b702a8e5si31912860pfh.10.2022.10.22.01.37.17; Sat, 22 Oct 2022 01:37: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=uS89cP5T; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S233790AbiJVIXS (ORCPT + 99 others); Sat, 22 Oct 2022 04:23:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53268 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233803AbiJVIVP (ORCPT ); Sat, 22 Oct 2022 04:21: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 0EECF2E042D; Sat, 22 Oct 2022 00:58: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 ams.source.kernel.org (Postfix) with ESMTPS id E887CB82E06; Sat, 22 Oct 2022 07:40:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6450DC433C1; Sat, 22 Oct 2022 07:40:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424434; bh=esuUoapq9T1x4Pi6HRqvIWsZGok3j+U9rcfDo7+hQDw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uS89cP5T4AuOM3e4RlSnX8xw0klfSrkn8Gepz/XmJqi81XRjqC2W+rLRbf8SGHw/f k2F+llwf4HofrOozo/+f8DTSR5mubb/dZwDkmKC3HmRcmMf/dR+bv0IEWRlStxOL0F iRJD+gC9X4ADYgBu+0DKUpX6r7ZVQfdmM1Yi38xA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Peter Zijlstra , Ingo Molnar , Will Deacon , Boqun Feng , Steven Rostedt , Waiman Long Subject: [PATCH 5.19 145/717] tracing: Disable interrupt or preemption before acquiring arch_spinlock_t Date: Sat, 22 Oct 2022 09:20:24 +0200 Message-Id: <20221022072441.159420706@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376250724847818?= X-GMAIL-MSGID: =?utf-8?q?1747376250724847818?= From: Waiman Long commit c0a581d7126c0bbc96163276f585fd7b4e4d8d0e upstream. It was found that some tracing functions in kernel/trace/trace.c acquire an arch_spinlock_t with preemption and irqs enabled. An example is the tracing_saved_cmdlines_size_read() function which intermittently causes a "BUG: using smp_processor_id() in preemptible" warning when the LTP read_all_proc test is run. That can be problematic in case preemption happens after acquiring the lock. Add the necessary preemption or interrupt disabling code in the appropriate places before acquiring an arch_spinlock_t. The convention here is to disable preemption for trace_cmdline_lock and interupt for max_lock. Link: https://lkml.kernel.org/r/20220922145622.1744826-1-longman@redhat.com Cc: Peter Zijlstra Cc: Ingo Molnar Cc: Will Deacon Cc: Boqun Feng Cc: stable@vger.kernel.org Fixes: a35873a0993b ("tracing: Add conditional snapshot") Fixes: 939c7a4f04fc ("tracing: Introduce saved_cmdlines_size file") Suggested-by: Steven Rostedt Signed-off-by: Waiman Long Signed-off-by: Steven Rostedt (Google) Signed-off-by: Greg Kroah-Hartman --- kernel/trace/trace.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) --- a/kernel/trace/trace.c +++ b/kernel/trace/trace.c @@ -1193,12 +1193,14 @@ void *tracing_cond_snapshot_data(struct { void *cond_data = NULL; + local_irq_disable(); arch_spin_lock(&tr->max_lock); if (tr->cond_snapshot) cond_data = tr->cond_snapshot->cond_data; arch_spin_unlock(&tr->max_lock); + local_irq_enable(); return cond_data; } @@ -1334,9 +1336,11 @@ int tracing_snapshot_cond_enable(struct goto fail_unlock; } + local_irq_disable(); arch_spin_lock(&tr->max_lock); tr->cond_snapshot = cond_snapshot; arch_spin_unlock(&tr->max_lock); + local_irq_enable(); mutex_unlock(&trace_types_lock); @@ -1363,6 +1367,7 @@ int tracing_snapshot_cond_disable(struct { int ret = 0; + local_irq_disable(); arch_spin_lock(&tr->max_lock); if (!tr->cond_snapshot) @@ -1373,6 +1378,7 @@ int tracing_snapshot_cond_disable(struct } arch_spin_unlock(&tr->max_lock); + local_irq_enable(); return ret; } @@ -2200,6 +2206,11 @@ static size_t tgid_map_max; #define SAVED_CMDLINES_DEFAULT 128 #define NO_CMDLINE_MAP UINT_MAX +/* + * Preemption must be disabled before acquiring trace_cmdline_lock. + * The various trace_arrays' max_lock must be acquired in a context + * where interrupt is disabled. + */ static arch_spinlock_t trace_cmdline_lock = __ARCH_SPIN_LOCK_UNLOCKED; struct saved_cmdlines_buffer { unsigned map_pid_to_cmdline[PID_MAX_DEFAULT+1]; @@ -2412,7 +2423,11 @@ static int trace_save_cmdline(struct tas * the lock, but we also don't want to spin * nor do we want to disable interrupts, * so if we miss here, then better luck next time. + * + * This is called within the scheduler and wake up, so interrupts + * had better been disabled and run queue lock been held. */ + lockdep_assert_preemption_disabled(); if (!arch_spin_trylock(&trace_cmdline_lock)) return 0; @@ -5890,9 +5905,11 @@ tracing_saved_cmdlines_size_read(struct char buf[64]; int r; + preempt_disable(); arch_spin_lock(&trace_cmdline_lock); r = scnprintf(buf, sizeof(buf), "%u\n", savedcmd->cmdline_num); arch_spin_unlock(&trace_cmdline_lock); + preempt_enable(); return simple_read_from_buffer(ubuf, cnt, ppos, buf, r); } @@ -5917,10 +5934,12 @@ static int tracing_resize_saved_cmdlines return -ENOMEM; } + preempt_disable(); arch_spin_lock(&trace_cmdline_lock); savedcmd_temp = savedcmd; savedcmd = s; arch_spin_unlock(&trace_cmdline_lock); + preempt_enable(); free_saved_cmdlines_buffer(savedcmd_temp); return 0; @@ -6373,10 +6392,12 @@ int tracing_set_tracer(struct trace_arra #ifdef CONFIG_TRACER_SNAPSHOT if (t->use_max_tr) { + local_irq_disable(); arch_spin_lock(&tr->max_lock); if (tr->cond_snapshot) ret = -EBUSY; arch_spin_unlock(&tr->max_lock); + local_irq_enable(); if (ret) goto out; } @@ -7436,10 +7457,12 @@ tracing_snapshot_write(struct file *filp goto out; } + local_irq_disable(); arch_spin_lock(&tr->max_lock); if (tr->cond_snapshot) ret = -EBUSY; arch_spin_unlock(&tr->max_lock); + local_irq_enable(); if (ret) goto out; From patchwork Sat Oct 22 07:20: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: 7201 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1089731wrr; Sat, 22 Oct 2022 00:44:16 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4Xd3xk5ozw/BFSioIeiSWqcqcDZP0mYybJGGL2VzPDIwWDfVJVFeT5TKQNA0v0Nv86Z9l+ X-Received: by 2002:a05:6a00:1a16:b0:56a:afb4:2b53 with SMTP id g22-20020a056a001a1600b0056aafb42b53mr6479602pfv.35.1666424656488; Sat, 22 Oct 2022 00:44:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666424656; cv=none; d=google.com; s=arc-20160816; b=rv5cR4tomDgPz1/A29eu5a27ECMUbJ1E7lHxrMSgp5k9Xo/zhccHUAtxDY75AJO6kB 6hjVauQuQsrJxiuMFFvWj+bgCOO0Tw+PW3kp17qBkAm5tnMOu0yrl8ku3kgHtc5Pmnrh JtqNQbLCm8ZmSy7IwScCDyTOGQ1krJx48o3s6WCzcoIpgsX7qTZyz2vP7gsHFHehdCyK cTHFxzIDEs0vL8pjGVO1jfdWupeQG0QGVMjngx8E+IqQUTCQEl1sUNhLK88iFuVcl1q0 GkA84qAlZ6TzdYQqDIXhkvdKfwmlgfu10SYQiIIyGJUNdmOiuGHAE7WNDEzNOqKLH0kS 7Vlg== 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=EEjdHCiy3VT3zNZ9qREpPsxlzbLPsv/9VD9RXYm5H2w=; b=R7/uCupZUtIGdRfO/6gEgKRsGM2zVZeS0SZNLw4Ls1GgOQ33AyV8gPTXz9EbRI0VAo EycnWvjNtY96cHCHxSKo81vp+x4T95NgEzSF5pwzAH2PbXajNfSwcNXhhacexn4qSR+N o+oFEZzt/2XoHvi2LFg1U3xdLPO3K2wmu8yMU92EYqKwSsEsZxXIVNdE7HslHeHz0SlL e1NrptqIjHFNKS93X44MmmXf16nSTq0SMWzyuhEkvtafqk07Rtrh3Mupb4ZQk8i6t6rY G1IyxPPPsmb32N32+y5K9jhai50Nrqck4qpx7Y7S2jVcfcALeGHBgCiOPSTuNBqVdTNC s/VA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=cB1a8U7M; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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-20020a17090b1e5000b0020d47757829si2480036pjb.144.2022.10.22.00.44.04; Sat, 22 Oct 2022 00:44: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=cB1a8U7M; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231332AbiJVHnh (ORCPT + 99 others); Sat, 22 Oct 2022 03:43:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44084 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231208AbiJVHm4 (ORCPT ); Sat, 22 Oct 2022 03:42:56 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 22DC762A5A; Sat, 22 Oct 2022 00:41: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 A79C7B82E05; Sat, 22 Oct 2022 07:40:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 03D10C433D6; Sat, 22 Oct 2022 07:40:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424437; bh=mnc13TlevMeVJzlX+brpL19d8f7IuIS8B6nuN0+yHxE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cB1a8U7M7XX6enPk8/IleCek8VX1HXiIVwe9OSj0O7iPi49PGpE/Cd3H68k1JyaEy 05kIV5PlsJth0tvSUaWZsFyxv51RSO9z5eXBEZUfYijHDTp4zKtjbCeXuASlITBuIS +U3F5dPBPLmYgCSc2Io8BRAXUfFt8Q4IseteRSE4= 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 5.19 146/717] tracing: Wake up ring buffer waiters on closing of the file Date: Sat, 22 Oct 2022 09:20:25 +0200 Message-Id: <20221022072441.334683004@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747372900917586433?= X-GMAIL-MSGID: =?utf-8?q?1747372900917586433?= From: Steven Rostedt (Google) commit f3ddb74ad0790030c9592229fb14d8c451f4e9a8 upstream. When the file that represents the ring buffer is closed, there may be waiters waiting on more input from the ring buffer. Call ring_buffer_wake_waiters() to wake up any waiters when the file is closed. Link: https://lkml.kernel.org/r/20220927231825.182416969@goodmis.org Cc: stable@vger.kernel.org Cc: Ingo Molnar Cc: Andrew Morton Fixes: e30f53aad2202 ("tracing: Do not busy wait in buffer splice") Signed-off-by: Steven Rostedt (Google) Signed-off-by: Greg Kroah-Hartman --- include/linux/trace_events.h | 1 + kernel/trace/trace.c | 15 +++++++++++++++ 2 files changed, 16 insertions(+) --- a/include/linux/trace_events.h +++ b/include/linux/trace_events.h @@ -92,6 +92,7 @@ struct trace_iterator { unsigned int temp_size; char *fmt; /* modified format holder */ unsigned int fmt_size; + long wait_index; /* trace_seq for __print_flags() and __print_symbolic() etc. */ struct trace_seq tmp_seq; --- a/kernel/trace/trace.c +++ b/kernel/trace/trace.c @@ -8160,6 +8160,12 @@ static int tracing_buffers_release(struc __trace_array_put(iter->tr); + iter->wait_index++; + /* Make sure the waiters see the new wait_index */ + smp_wmb(); + + ring_buffer_wake_waiters(iter->array_buffer->buffer, iter->cpu_file); + if (info->spare) ring_buffer_free_read_page(iter->array_buffer->buffer, info->spare_cpu, info->spare); @@ -8313,6 +8319,8 @@ tracing_buffers_splice_read(struct file /* did we read anything? */ if (!spd.nr_pages) { + long wait_index; + if (ret) goto out; @@ -8320,10 +8328,17 @@ tracing_buffers_splice_read(struct file if ((file->f_flags & O_NONBLOCK) || (flags & SPLICE_F_NONBLOCK)) goto out; + wait_index = READ_ONCE(iter->wait_index); + ret = wait_on_pipe(iter, iter->tr->buffer_percent); if (ret) goto out; + /* Make sure we see the new wait_index */ + smp_rmb(); + if (wait_index != iter->wait_index) + goto out; + goto again; } From patchwork Sat Oct 22 07:20: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: 7249 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1091477wrr; Sat, 22 Oct 2022 00:50:46 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5kSNktiwX2KvCIFDksr6P8Bz09WWv+i15fFJVHZJDP7Fmg4QTNxF9jQMXA17G5u7xixvOf X-Received: by 2002:a17:90b:3b50:b0:20d:93f3:9c8d with SMTP id ot16-20020a17090b3b5000b0020d93f39c8dmr60497821pjb.150.1666425045871; Sat, 22 Oct 2022 00:50:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666425045; cv=none; d=google.com; s=arc-20160816; b=LWDXuWmEnYjKznO/vxGou0R5o4Qh6woFYfykFNwEsMZXFlQil1yBycN6vQbmNpJlNl XGRtdF6XHMERxdZaNMRNuYO8GwK5MzPUyge1bDgYqcM9Or52rLRn6VCpFyOARaoZd3ao pEKUC5tSKDl3mt/WQPsPwYjtO6AMAUgnvp9qw+Og0FzZ+4DIeaEkAW+RA9nics8/bfvN 0oFElSPTWeAj/Z/crJbX9mPRxZFSQuRfgMsAnGEWABlRfUSVyVI7rBzOZy8SZ7O4R0Nm nCTSvsnbTlGnrELuapzWcmeX4Ltidfm7x28F5V9QDGFQM0rJY4Euu9gufUv6SqazwxgG KbNg== 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=6Sm4xBGn13BnTHb/GXr5N9tQIwthy5VIZ/YGbjFkvSQ=; b=ChgzniLiTMyQtUwsQasKFH/UEfMdrANxMVLBLB1KzBIkP4eIyJyceegpdL67I2hOkl SR3TjvC8MM4mU6JCAzgXC96xXWLfoWyio3dNE5xEDODe+9MUTVLZJaldgF/aLGkbJuVF dk1Bi+4/s/h2h04+yT936lDCX+7FGzX822RzjvvcAPbJp2tFA33X/g0b5yUFFLi72zt7 H5szqft+k2W4h0jm8VnrTfD3OliImmDzB23NdLaTTBF4JPQSE+UGx8944nYhU8eLyyyI 6Law/87KD5eVbz6IVYIEEMzjE3yu0ybfCRdjH0o6z95a9jF/oa8cjPAxCgHbDjXk/tAB xFPg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=QxYycTCX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 q24-20020a635c18000000b0045a8b142a48si26498347pgb.657.2022.10.22.00.50.31; Sat, 22 Oct 2022 00:50: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=QxYycTCX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231607AbiJVHt6 (ORCPT + 99 others); Sat, 22 Oct 2022 03:49:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50524 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231319AbiJVHsm (ORCPT ); Sat, 22 Oct 2022 03:48:42 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4695A161FEB; Sat, 22 Oct 2022 00:45: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 90EBB60B76; Sat, 22 Oct 2022 07:40:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A239FC433C1; Sat, 22 Oct 2022 07:40:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424440; bh=Sv+gMvx7ElIgs69dRSsTjaWSf4VxBR1l6ktaoWCiT5I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QxYycTCXIYkIBCbYe1BRB6exMMXC9qx8j4776W+r3U87pDqYKjvQ3AqUo8Y/Dguc1 a8OqBtYutShmnxMfPdeIOUI0PaHAI9eLxUs8CHQxeC46a/0441h93ZTB9fyoFsDBWZ CO2AH5EcI4Fv8ten2KFvtqZC9U3m/kzc9E0MsjR8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Steven Rostedt (Google)" Subject: [PATCH 5.19 147/717] tracing: Wake up waiters when tracing is disabled Date: Sat, 22 Oct 2022 09:20:26 +0200 Message-Id: <20221022072441.504416845@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747373308559221138?= X-GMAIL-MSGID: =?utf-8?q?1747373308559221138?= From: Steven Rostedt (Google) commit 2b0fd9a59b7990c161fa1cb7b79edb22847c87c2 upstream. When tracing is disabled, there's no reason that waiters should stay waiting, wake them up, otherwise tasks get stuck when they should be flushing the buffers. Cc: stable@vger.kernel.org Fixes: e30f53aad2202 ("tracing: Do not busy wait in buffer splice") Signed-off-by: Steven Rostedt (Google) Signed-off-by: Greg Kroah-Hartman --- kernel/trace/trace.c | 6 ++++++ 1 file changed, 6 insertions(+) --- a/kernel/trace/trace.c +++ b/kernel/trace/trace.c @@ -8334,6 +8334,10 @@ tracing_buffers_splice_read(struct file if (ret) goto out; + /* No need to wait after waking up when tracing is off */ + if (!tracer_tracing_is_on(iter->tr)) + goto out; + /* Make sure we see the new wait_index */ smp_rmb(); if (wait_index != iter->wait_index) @@ -9043,6 +9047,8 @@ rb_simple_write(struct file *filp, const tracer_tracing_off(tr); if (tr->current_trace->stop) tr->current_trace->stop(tr); + /* Wake up any waiters */ + ring_buffer_wake_waiters(buffer, RING_BUFFER_ALL_CPUS); } mutex_unlock(&trace_types_lock); } From patchwork Sat Oct 22 07:20: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: 7706 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1109437wrr; Sat, 22 Oct 2022 01:48:32 -0700 (PDT) X-Google-Smtp-Source: AMsMyM53p59i2Myqsh2LFEbhR1xDKLXrbzrPlwnSvHtHZUj10tXI2ONliGSWLhFauggb1Ks0pH5B X-Received: by 2002:a17:907:9625:b0:78d:bb06:9072 with SMTP id gb37-20020a170907962500b0078dbb069072mr19177363ejc.472.1666428512031; Sat, 22 Oct 2022 01:48:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666428512; cv=none; d=google.com; s=arc-20160816; b=q/GzOngXn8sWCSPXwDxgacDbCgzKMqdLcWrR5sMXsQigbV6BnEMvg0qZ06MnGbD/Cx YLyGtxEBqyuL+HAiUuo5C28ujsVr332IzhS1C1XzEmKutZAZNtREulpTnr6OyUOr6Wht +CerWGjVyaaXuOHkZWpfbXrHjNzNSJrFy/zJ2J4/EcNR3DPlIp7dY7bTSfIvUejxMThr Zs7wne3e4e6ty8akmQjsssSfaYkjWtfPDv4K4/aj9uTdfExCoDl5wDRRU7u2AfzO2EXW dKR5KmoZ0uQM7SI8DlSS3g5trTUe+uw3bXkHjIHxy2u94hvSzjDxu/CoxHPrvLAIeOS8 3Lbw== 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=3LNgrQpDWQc9P23FLs/W3M4C7K+AnTH8yKu7xsG1MDA=; b=Q+bBlnuQArDC5WEw2aOfxEgoNBwxm0CkxwQYBy9IspqHm8i37V4XDKkzKPLdgqnIKK el5ExPXSzFD3PtdpkNX5NjvtHkv0Cby4++xTEsd6tvJq55DllSpSjWCeJLpZbd8DBw8r gXXMoyrjlIZrBtOEeZCaZUTgRcbg8zqGUgnCZPD8/X0FY8IFHn1QVbC1PWxltyleI1wB EDsRqL1FuysgwPL3ql7mWevxsSV0xzpwWd0mvjjR1pqSg1uNYm51cRpPxCQyGRO9GZz5 ssBMdWooTwxlwEeU1oQKBFpS5pcqw5NcEKC6sBm7LT4cYCR2ptOc7B9Gfr26Vt6Lf2Tk 38hg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=CH5b3lYW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 b26-20020a05640202da00b004608c0b9a8asi6102879edx.201.2022.10.22.01.48.08; Sat, 22 Oct 2022 01:48: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=CH5b3lYW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S234406AbiJVIrk (ORCPT + 99 others); Sat, 22 Oct 2022 04:47:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42174 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235219AbiJVIo4 (ORCPT ); Sat, 22 Oct 2022 04:44: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 439752C6372; Sat, 22 Oct 2022 01:08: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 ams.source.kernel.org (Postfix) with ESMTPS id EFEC0B82E01; Sat, 22 Oct 2022 07:40:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4F411C433D6; Sat, 22 Oct 2022 07:40:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424442; bh=4wnaODor8D624RR9nMhH13dQqwy3N+A65TEwwd7SL/M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CH5b3lYW0om3R6s1de7VIsJjWvjmtdjrSpDBHnCfsFgMi7Y12ALW5yWFWDjbVD1SH yQWypXnWUzgHxJ0yfBTPSbQS9RjAU6NX2xNeUJTlrq9cQKARzc6giG931RGylWgJ6D cZLWwoyx6k4WRf4aFYOFJ91e/jzWwzsPF/IJU2Wo= 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 5.19 148/717] tracing: Add ioctl() to force ring buffer waiters to wake up Date: Sat, 22 Oct 2022 09:20:27 +0200 Message-Id: <20221022072441.711031138@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376943337295726?= X-GMAIL-MSGID: =?utf-8?q?1747376943337295726?= From: Steven Rostedt (Google) commit 01b2a52171735c6eea80ee2f355f32bea6c41418 upstream. If a process is waiting on the ring buffer for data, there currently isn't a clean way to force it to wake up. Add an ioctl call that will force any tasks that are waiting on the trace_pipe_raw file to wake up. Link: https://lkml.kernel.org/r/20220929095029.117f913f@gandalf.local.home Cc: stable@vger.kernel.org Cc: Ingo Molnar Cc: Andrew Morton Fixes: e30f53aad2202 ("tracing: Do not busy wait in buffer splice") Signed-off-by: Steven Rostedt (Google) Signed-off-by: Greg Kroah-Hartman --- kernel/trace/trace.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) --- a/kernel/trace/trace.c +++ b/kernel/trace/trace.c @@ -8353,12 +8353,34 @@ out: return ret; } +/* An ioctl call with cmd 0 to the ring buffer file will wake up all waiters */ +static long tracing_buffers_ioctl(struct file *file, unsigned int cmd, unsigned long arg) +{ + struct ftrace_buffer_info *info = file->private_data; + struct trace_iterator *iter = &info->iter; + + if (cmd) + return -ENOIOCTLCMD; + + mutex_lock(&trace_types_lock); + + iter->wait_index++; + /* Make sure the waiters see the new wait_index */ + smp_wmb(); + + ring_buffer_wake_waiters(iter->array_buffer->buffer, iter->cpu_file); + + mutex_unlock(&trace_types_lock); + return 0; +} + static const struct file_operations tracing_buffers_fops = { .open = tracing_buffers_open, .read = tracing_buffers_read, .poll = tracing_buffers_poll, .release = tracing_buffers_release, .splice_read = tracing_buffers_splice_read, + .unlocked_ioctl = tracing_buffers_ioctl, .llseek = no_llseek, }; From patchwork Sat Oct 22 07:20: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: 7467 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1098944wrr; Sat, 22 Oct 2022 01:12:13 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5qhwtXZG3p9UARHRGKwvIXaG+jf+6/HQT39ZQeu5xEKHqDjfsEinrvz/wyKgrYF5FhAa2K X-Received: by 2002:a63:1c43:0:b0:45e:1e2b:291d with SMTP id c3-20020a631c43000000b0045e1e2b291dmr19228385pgm.204.1666426332988; Sat, 22 Oct 2022 01:12:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666426332; cv=none; d=google.com; s=arc-20160816; b=zSFo0VqfjXdJJCc8DRUf2ps6aAZ481fkGlqR/iGdbTwfL4OHwxkK1r9MSzUTvBb6NJ altBjMtgp0ocjjqvRqIDnnwc2aTrehdoHYaR7OrfL5JLhCCDHPWdS21ImS5RX56Bdois VRYV1r1IKTBNv6qLwo0u1Vg+4SvRrI8KCUu9/cyQj/aIPPisuLGKtLucl0iuGGtAZtNp 0IAjkHgplRHBo891lZC+3sF7dGFvyXuK46YyvJWedCVuZYTG1mJMO0+j7mL2QthDcyTp RdxA71+OufUvKCIqRyw5q+GplSnQxzA8t22cITQL0Ia2NqQj7Mm/CVsOJkhnt+jLny7J bFiw== 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=YhZfn5Z1PAb+XjaJBe5poyH99Jd6/5FRay5v1WwD3RY=; b=e1tpEtJ2NnnUCtKZz3PJLGxTK1pSWnSEgKljq6pZU80v0NT19ceOc1lNMc5Wlrk/sy UPPx1VEh/4XUKIfSIvG6XoosV0TYckxBrw1WRGuQYrhMhHJ1P3CLsgMZytuIs0Pgs1zR F0xq8FSX3HfL2UoNPbAay3dLqyZPQqvaACsbc1Sde5Ua9oIIIaQAfL+g/IFzIFEpQAAA NqeeuOuY87HDsVIYdVkwrp9DUM10xN8rLRh4NdPfzoxXjDFuC2O4ErxXDOPoxTx1A+XC bACskLyf2Fl1+tXEtunHR4DvU7U1+irvtwFnWAc/BfnP9EbidY5oWhTOJWWn0IRtBXGR bSVw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=CR0hlwxN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 d16-20020a170903231000b0017f762e2dc6si32166880plh.613.2022.10.22.01.12.00; Sat, 22 Oct 2022 01:12: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=CR0hlwxN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S233327AbiJVIL0 (ORCPT + 99 others); Sat, 22 Oct 2022 04:11:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35456 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233315AbiJVIJe (ORCPT ); Sat, 22 Oct 2022 04:09:34 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1D8DC2CA7C9; Sat, 22 Oct 2022 00:54: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 37ADBB82E09; Sat, 22 Oct 2022 07:40:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8331DC433C1; Sat, 22 Oct 2022 07:40:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424447; bh=c9ygUptf6V7bC9GOUoGrIQJL+pvol/TW/5HDxSDa1cA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CR0hlwxNVkUO+Ra9qEqBY5tYmb04RA2XuwglLJUbNgYOMEORUyJd72NxDHHRkGFra 69FSQ59Q1qor4Wt2k/HOoYfFC7wpcaxLBZAh8RVNEumQyaAteWTJtzaHeSl+vo8I35 4WmtGXb3u1i4GrUGk6webIAfJLNE2COWltlwLI5I= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Masami Hiramatsu , Andrew Morton , Ross Zwisler , "Steven Rostedt (Google)" Subject: [PATCH 5.19 149/717] tracing: Do not free snapshot if tracer is on cmdline Date: Sat, 22 Oct 2022 09:20:28 +0200 Message-Id: <20221022072441.851172081@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747374658503800791?= X-GMAIL-MSGID: =?utf-8?q?1747374658503800791?= From: Steven Rostedt (Google) commit a541a9559bb0a8ecc434de01d3e4826c32e8bb53 upstream. The ftrace_boot_snapshot and alloc_snapshot cmdline options allocate the snapshot buffer at boot up for use later. The ftrace_boot_snapshot in particular requires the snapshot to be allocated because it will take a snapshot at the end of boot up allowing to see the traces that happened during boot so that it's not lost when user space takes over. When a tracer is registered (started) there's a path that checks if it requires the snapshot buffer or not, and if it does not and it was allocated it will do a synchronization and free the snapshot buffer. This is only required if the previous tracer was using it for "max latency" snapshots, as it needs to make sure all max snapshots are complete before freeing. But this is only needed if the previous tracer was using the snapshot buffer for latency (like irqoff tracer and friends). But it does not make sense to free it, if the previous tracer was not using it, and the snapshot was allocated by the cmdline parameters. This basically takes away the point of allocating it in the first place! Note, the allocated snapshot worked fine for just trace events, but fails when a tracer is enabled on the cmdline. Further investigation, this goes back even further and it does not require a tracer on the cmdline to fail. Simply enable snapshots and then enable a tracer, and it will remove the snapshot. Link: https://lkml.kernel.org/r/20221005113757.041df7fe@gandalf.local.home Cc: Masami Hiramatsu Cc: Andrew Morton Cc: stable@vger.kernel.org Fixes: 45ad21ca5530 ("tracing: Have trace_array keep track if snapshot buffer is allocated") Reported-by: Ross Zwisler Tested-by: Ross Zwisler Signed-off-by: Steven Rostedt (Google) Signed-off-by: Greg Kroah-Hartman --- kernel/trace/trace.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) --- a/kernel/trace/trace.c +++ b/kernel/trace/trace.c @@ -6428,12 +6428,12 @@ int tracing_set_tracer(struct trace_arra if (tr->current_trace->reset) tr->current_trace->reset(tr); +#ifdef CONFIG_TRACER_MAX_TRACE + had_max_tr = tr->current_trace->use_max_tr; + /* Current trace needs to be nop_trace before synchronize_rcu */ tr->current_trace = &nop_trace; -#ifdef CONFIG_TRACER_MAX_TRACE - had_max_tr = tr->allocated_snapshot; - if (had_max_tr && !t->use_max_tr) { /* * We need to make sure that the update_max_tr sees that @@ -6446,11 +6446,13 @@ int tracing_set_tracer(struct trace_arra free_snapshot(tr); } - if (t->use_max_tr && !had_max_tr) { + if (t->use_max_tr && !tr->allocated_snapshot) { ret = tracing_alloc_snapshot_instance(tr); if (ret < 0) goto out; } +#else + tr->current_trace = &nop_trace; #endif if (t->init) { From patchwork Sat Oct 22 07:20: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: 7253 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1091527wrr; Sat, 22 Oct 2022 00:50:58 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4rGBT6WsI0/2ynipHgdv5rWsppb8yZcqFPqhrRMeJEFA0ie86+UDADK8cNo1XG3iHIPJcR X-Received: by 2002:a63:db42:0:b0:45c:9c73:d72e with SMTP id x2-20020a63db42000000b0045c9c73d72emr19061531pgi.181.1666425058446; Sat, 22 Oct 2022 00:50:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666425058; cv=none; d=google.com; s=arc-20160816; b=fV0gfdMvxXNHkDgjhpeQubbW0duK7KedEgT5bAaHUMpqmLp7AAOjjWfKHP4HqPFhx5 rG1xB96Va4DO9z8KZnTKf6RrCgyk6kkd7id9+IwFLsKgDo5XmRLhpmc1TMTT4hpyYa9A MAiZop8t71WZnx4YurMyG2SL2MtCpyhThu46By27Nwp2S/AQv4j+AJpTefIDhRkCz0AI BvYQCLC3DIwb7Tuxjej5CXCc4Ujn0SrID+MOC+LiXdV8q2Jm+vPJTC+IBJqLH3VmRCVF pU+wRNZPNbCDy8xBWN3c+El4PM7ftVIVnS9fXexZfFBI+ZXkKoHMMyw+VZ2qPZhDi7H6 moJA== 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=8SLnyO2roRkL0z/Ya1MvDSYB0OO38vPhGMLP7ohskAs=; b=hOBEogIjQisF0Sy9/NVDim68N100ykNaNcEaoA+pGiVZEZVmDK3t2fgPQmTCVP4sU9 LNBqSU/fJQu923RK4BMjxt+EsGbH60zPrT4mU/pFkew6kCQpIRQDoC7W4NQzcUUBY37w MCZmIcxsaYqfm/0ImBImP15efHHT9RSrDBqsTpUClFsnKMcUmFEX1HdTQ6oB3qWZlcOU ht7vlGvnLIb7DY7BNdNGz5BWQZj1/kfLKD9z0NS7V9DG99mzvZp/JDJgjHZ31J3g762O 95nXvV3ehI6vggEkwv3x+8P7ntE0nbJ5aHe5mTjKLojqtsg1Ce5R+YYbo39WzUazL0ju UxvQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=HAL21IIk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 a10-20020a63d20a000000b00461bf5f86fdsi27756022pgg.403.2022.10.22.00.50.44; Sat, 22 Oct 2022 00:50: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=HAL21IIk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231686AbiJVHuW (ORCPT + 99 others); Sat, 22 Oct 2022 03:50:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38194 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231406AbiJVHsr (ORCPT ); Sat, 22 Oct 2022 03:48:47 -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 8C22C167F5B; Sat, 22 Oct 2022 00:45: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 43B6A60B84; Sat, 22 Oct 2022 07:40:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 29BF7C433C1; Sat, 22 Oct 2022 07:40:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424450; bh=rA4gQhD1vlVIuOg+qDE2RA9EQNMcPflJeXMhQw7nZmY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HAL21IIkoATmg96WmQmf9Xm3ARGyCSrIHP5alIpKJZQCGDA0KYOGQFXChnxvYp1Ys McQLfwEs9DXVPfVNVF8+gK0ErkAG4B1ytH/d5cTizeuZQ6ckUHVaEP42q41j00vzHN 3VzjJqwXSVWnOE6qsANhS5y/HyPEwR8tlAzdloKI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Andrew Morton , Tom Zanussi , "Masami Hiramatsu (Google)" , "Steven Rostedt (Google)" Subject: [PATCH 5.19 150/717] tracing: Move duplicate code of trace_kprobe/eprobe.c into header Date: Sat, 22 Oct 2022 09:20:29 +0200 Message-Id: <20221022072442.014195241@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747373322172410995?= X-GMAIL-MSGID: =?utf-8?q?1747373322172410995?= From: Steven Rostedt (Google) commit f1d3cbfaafc10464550c6d3a125f4fc802bbaed5 upstream. The functions: fetch_store_strlen_user() fetch_store_strlen() fetch_store_string_user() fetch_store_string() are identical in both trace_kprobe.c and trace_eprobe.c. Move them into a new header file trace_probe_kernel.h to share it. This code will later be used by the synthetic events as well. Marked for stable as a fix for a crash in synthetic events requires it. Link: https://lkml.kernel.org/r/20221012104534.467668078@goodmis.org Cc: stable@vger.kernel.org Cc: Andrew Morton Cc: Tom Zanussi Acked-by: Masami Hiramatsu (Google) Reviewed-by: Tom Zanussi Fixes: bd82631d7ccdc ("tracing: Add support for dynamic strings to synthetic events") Signed-off-by: Steven Rostedt (Google) Signed-off-by: Greg Kroah-Hartman --- kernel/trace/trace_eprobe.c | 60 +---------------------- kernel/trace/trace_kprobe.c | 60 +---------------------- kernel/trace/trace_probe_kernel.h | 96 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 106 insertions(+), 110 deletions(-) create mode 100644 kernel/trace/trace_probe_kernel.h --- a/kernel/trace/trace_eprobe.c +++ b/kernel/trace/trace_eprobe.c @@ -16,6 +16,7 @@ #include "trace_dynevent.h" #include "trace_probe.h" #include "trace_probe_tmpl.h" +#include "trace_probe_kernel.h" #define EPROBE_EVENT_SYSTEM "eprobes" @@ -452,29 +453,14 @@ NOKPROBE_SYMBOL(process_fetch_insn) static nokprobe_inline int fetch_store_strlen_user(unsigned long addr) { - const void __user *uaddr = (__force const void __user *)addr; - - return strnlen_user_nofault(uaddr, MAX_STRING_SIZE); + return kern_fetch_store_strlen_user(addr); } /* Return the length of string -- including null terminal byte */ static nokprobe_inline int fetch_store_strlen(unsigned long addr) { - int ret, len = 0; - u8 c; - -#ifdef CONFIG_ARCH_HAS_NON_OVERLAPPING_ADDRESS_SPACE - if (addr < TASK_SIZE) - return fetch_store_strlen_user(addr); -#endif - - do { - ret = copy_from_kernel_nofault(&c, (u8 *)addr + len, 1); - len++; - } while (c && ret == 0 && len < MAX_STRING_SIZE); - - return (ret < 0) ? ret : len; + return kern_fetch_store_strlen(addr); } /* @@ -484,21 +470,7 @@ fetch_store_strlen(unsigned long addr) static nokprobe_inline int fetch_store_string_user(unsigned long addr, void *dest, void *base) { - const void __user *uaddr = (__force const void __user *)addr; - int maxlen = get_loc_len(*(u32 *)dest); - void *__dest; - long ret; - - if (unlikely(!maxlen)) - return -ENOMEM; - - __dest = get_loc_data(dest, base); - - ret = strncpy_from_user_nofault(__dest, uaddr, maxlen); - if (ret >= 0) - *(u32 *)dest = make_data_loc(ret, __dest - base); - - return ret; + return kern_fetch_store_string_user(addr, dest, base); } /* @@ -508,29 +480,7 @@ fetch_store_string_user(unsigned long ad static nokprobe_inline int fetch_store_string(unsigned long addr, void *dest, void *base) { - int maxlen = get_loc_len(*(u32 *)dest); - void *__dest; - long ret; - -#ifdef CONFIG_ARCH_HAS_NON_OVERLAPPING_ADDRESS_SPACE - if ((unsigned long)addr < TASK_SIZE) - return fetch_store_string_user(addr, dest, base); -#endif - - if (unlikely(!maxlen)) - return -ENOMEM; - - __dest = get_loc_data(dest, base); - - /* - * Try to get string again, since the string can be changed while - * probing. - */ - ret = strncpy_from_kernel_nofault(__dest, (void *)addr, maxlen); - if (ret >= 0) - *(u32 *)dest = make_data_loc(ret, __dest - base); - - return ret; + return kern_fetch_store_string(addr, dest, base); } static nokprobe_inline int --- a/kernel/trace/trace_kprobe.c +++ b/kernel/trace/trace_kprobe.c @@ -20,6 +20,7 @@ #include "trace_kprobe_selftest.h" #include "trace_probe.h" #include "trace_probe_tmpl.h" +#include "trace_probe_kernel.h" #define KPROBE_EVENT_SYSTEM "kprobes" #define KRETPROBE_MAXACTIVE_MAX 4096 @@ -1219,29 +1220,14 @@ static const struct file_operations kpro static nokprobe_inline int fetch_store_strlen_user(unsigned long addr) { - const void __user *uaddr = (__force const void __user *)addr; - - return strnlen_user_nofault(uaddr, MAX_STRING_SIZE); + return kern_fetch_store_strlen_user(addr); } /* Return the length of string -- including null terminal byte */ static nokprobe_inline int fetch_store_strlen(unsigned long addr) { - int ret, len = 0; - u8 c; - -#ifdef CONFIG_ARCH_HAS_NON_OVERLAPPING_ADDRESS_SPACE - if (addr < TASK_SIZE) - return fetch_store_strlen_user(addr); -#endif - - do { - ret = copy_from_kernel_nofault(&c, (u8 *)addr + len, 1); - len++; - } while (c && ret == 0 && len < MAX_STRING_SIZE); - - return (ret < 0) ? ret : len; + return kern_fetch_store_strlen(addr); } /* @@ -1251,21 +1237,7 @@ fetch_store_strlen(unsigned long addr) static nokprobe_inline int fetch_store_string_user(unsigned long addr, void *dest, void *base) { - const void __user *uaddr = (__force const void __user *)addr; - int maxlen = get_loc_len(*(u32 *)dest); - void *__dest; - long ret; - - if (unlikely(!maxlen)) - return -ENOMEM; - - __dest = get_loc_data(dest, base); - - ret = strncpy_from_user_nofault(__dest, uaddr, maxlen); - if (ret >= 0) - *(u32 *)dest = make_data_loc(ret, __dest - base); - - return ret; + return kern_fetch_store_string_user(addr, dest, base); } /* @@ -1275,29 +1247,7 @@ fetch_store_string_user(unsigned long ad static nokprobe_inline int fetch_store_string(unsigned long addr, void *dest, void *base) { - int maxlen = get_loc_len(*(u32 *)dest); - void *__dest; - long ret; - -#ifdef CONFIG_ARCH_HAS_NON_OVERLAPPING_ADDRESS_SPACE - if ((unsigned long)addr < TASK_SIZE) - return fetch_store_string_user(addr, dest, base); -#endif - - if (unlikely(!maxlen)) - return -ENOMEM; - - __dest = get_loc_data(dest, base); - - /* - * Try to get string again, since the string can be changed while - * probing. - */ - ret = strncpy_from_kernel_nofault(__dest, (void *)addr, maxlen); - if (ret >= 0) - *(u32 *)dest = make_data_loc(ret, __dest - base); - - return ret; + return kern_fetch_store_string(addr, dest, base); } static nokprobe_inline int --- /dev/null +++ b/kernel/trace/trace_probe_kernel.h @@ -0,0 +1,96 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef __TRACE_PROBE_KERNEL_H_ +#define __TRACE_PROBE_KERNEL_H_ + +/* + * This depends on trace_probe.h, but can not include it due to + * the way trace_probe_tmpl.h is used by trace_kprobe.c and trace_eprobe.c. + * Which means that any other user must include trace_probe.h before including + * this file. + */ +/* Return the length of string -- including null terminal byte */ +static nokprobe_inline int +kern_fetch_store_strlen_user(unsigned long addr) +{ + const void __user *uaddr = (__force const void __user *)addr; + + return strnlen_user_nofault(uaddr, MAX_STRING_SIZE); +} + +/* Return the length of string -- including null terminal byte */ +static nokprobe_inline int +kern_fetch_store_strlen(unsigned long addr) +{ + int ret, len = 0; + u8 c; + +#ifdef CONFIG_ARCH_HAS_NON_OVERLAPPING_ADDRESS_SPACE + if (addr < TASK_SIZE) + return kern_fetch_store_strlen_user(addr); +#endif + + do { + ret = copy_from_kernel_nofault(&c, (u8 *)addr + len, 1); + len++; + } while (c && ret == 0 && len < MAX_STRING_SIZE); + + return (ret < 0) ? ret : len; +} + +/* + * Fetch a null-terminated string from user. Caller MUST set *(u32 *)buf + * with max length and relative data location. + */ +static nokprobe_inline int +kern_fetch_store_string_user(unsigned long addr, void *dest, void *base) +{ + const void __user *uaddr = (__force const void __user *)addr; + int maxlen = get_loc_len(*(u32 *)dest); + void *__dest; + long ret; + + if (unlikely(!maxlen)) + return -ENOMEM; + + __dest = get_loc_data(dest, base); + + ret = strncpy_from_user_nofault(__dest, uaddr, maxlen); + if (ret >= 0) + *(u32 *)dest = make_data_loc(ret, __dest - base); + + return ret; +} + +/* + * Fetch a null-terminated string. Caller MUST set *(u32 *)buf with max + * length and relative data location. + */ +static nokprobe_inline int +kern_fetch_store_string(unsigned long addr, void *dest, void *base) +{ + int maxlen = get_loc_len(*(u32 *)dest); + void *__dest; + long ret; + +#ifdef CONFIG_ARCH_HAS_NON_OVERLAPPING_ADDRESS_SPACE + if ((unsigned long)addr < TASK_SIZE) + return kern_fetch_store_string_user(addr, dest, base); +#endif + + if (unlikely(!maxlen)) + return -ENOMEM; + + __dest = get_loc_data(dest, base); + + /* + * Try to get string again, since the string can be changed while + * probing. + */ + ret = strncpy_from_kernel_nofault(__dest, (void *)addr, maxlen); + if (ret >= 0) + *(u32 *)dest = make_data_loc(ret, __dest - base); + + return ret; +} + +#endif /* __TRACE_PROBE_KERNEL_H_ */ From patchwork Sat Oct 22 07:20: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: 7363 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1095735wrr; Sat, 22 Oct 2022 01:03:24 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5Vzm8BrPzSQhDfrYrCo+Rrte4P1hU/VenjzCCK2Tkqgf19swuSj+HARqz3tsHKV0oJHEQG X-Received: by 2002:a17:90a:d397:b0:20c:7a28:8834 with SMTP id q23-20020a17090ad39700b0020c7a288834mr62423278pju.153.1666425804294; Sat, 22 Oct 2022 01:03:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666425804; cv=none; d=google.com; s=arc-20160816; b=MXi121koZtWuU4s2RMvo+bxAJrWD+bptra3Kt9cFVnDh7qai55XWCQ1XUjymjX1flg Y3tn5tfHGoHVuoTTnMJALG45/QnkcsivPr0PFQtUwNtG9ameeU3YQGQ89EVCAndDAlc0 EeXabrQg8w9uR7roWG93xlIREou+kS3fywfFW9hQQ+PlBA08QyN21JOtY8TNZ0HXrCwR kZO68sYIXTc6nbqeNQjlCsTtt4us3I0SPvH1cwfwEeTcdQb0D4nixzVLZNXoCM9HTnXU KfTWLUMQzMtfyGqpRZbpvIax90fnMIfkeQGxX3i3EuhDnxOgHVyUfv5SphOg/liaR9z3 BP9A== 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=ih/K2NUmVLF3iW/uqIxyeNeXFamF3KjqXdHGTKCImpE=; b=uWBFTPilyP93c0xiXM9dQuSaRI+M7bbhlC0NduO7vxzblStlpetG7zl+WeljiKZK4K u44WYPYmq5RTVkNjlUQ3vtM7lopQbya1vQsTDmQ7RRd1uWWBfm3KNztSVO70I3XYJBiW hmeP5Eflj5w6kWa2L0auyFxafbQUNehNGfGJQ/sOcIfY713pvXJDigmlgjxa4CnAS29O pRKyITwSWvTUwnGG+Y0fNG3qGn0KS4xDkjiK3I3F4EQmR2kESHBUX4j4tVPoNyH6RD71 dYsBPcbi1Y3XXSdSTKtGKzknD2Gkt232bvWC4so96/MBkGd5IwSgcFnViXyIgTPDLv4N z8GQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=clXgU8gf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 h185-20020a6383c2000000b00461515e9706si26248004pge.654.2022.10.22.01.03.11; Sat, 22 Oct 2022 01:03: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=clXgU8gf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S232611AbiJVICw (ORCPT + 99 others); Sat, 22 Oct 2022 04:02:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38542 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232324AbiJVHyk (ORCPT ); Sat, 22 Oct 2022 03:54: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 5AD992C500F; Sat, 22 Oct 2022 00:47: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 CE13B60B8C; Sat, 22 Oct 2022 07:40:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E4302C433C1; Sat, 22 Oct 2022 07:40:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424453; bh=a6b1NSqvH/b6gAlJZYFh0Q5qf/RCTEE7cuX29pmcyhM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=clXgU8gfLFw35OCd/ydkPh4ali+3CmLvxEVnESrFTv1pPOQAy71IljC7R2SvCH0la ew9moy1CBnDn0D4Tn0b9/Mvh5Y9GBpNkDiQrd2Mx9JdYBUzwwHSnNrfHWT1ecv+Poe pByMPprxXFVwrNP5g/up3uYdsZRkfMeL2I2mlRLg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Andrew Morton , Tom Zanussi , "Masami Hiramatsu (Google)" , "Steven Rostedt (Google)" Subject: [PATCH 5.19 151/717] tracing: Add "(fault)" name injection to kernel probes Date: Sat, 22 Oct 2022 09:20:30 +0200 Message-Id: <20221022072442.154265885@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747374103866683812?= X-GMAIL-MSGID: =?utf-8?q?1747374103866683812?= From: Steven Rostedt (Google) commit 2e9906f84fc7c99388bb7123ade167250d50f1c0 upstream. Have the specific functions for kernel probes that read strings to inject the "(fault)" name directly. trace_probes.c does this too (for uprobes) but as the code to read strings are going to be used by synthetic events (and perhaps other utilities), it simplifies the code by making sure those other uses do not need to implement the "(fault)" name injection as well. Link: https://lkml.kernel.org/r/20221012104534.644803645@goodmis.org Cc: stable@vger.kernel.org Cc: Andrew Morton Cc: Tom Zanussi Acked-by: Masami Hiramatsu (Google) Reviewed-by: Tom Zanussi Fixes: bd82631d7ccdc ("tracing: Add support for dynamic strings to synthetic events") Signed-off-by: Steven Rostedt (Google) Signed-off-by: Greg Kroah-Hartman --- kernel/trace/trace_probe_kernel.h | 31 +++++++++++++++++++++++++------ 1 file changed, 25 insertions(+), 6 deletions(-) --- a/kernel/trace/trace_probe_kernel.h +++ b/kernel/trace/trace_probe_kernel.h @@ -2,6 +2,8 @@ #ifndef __TRACE_PROBE_KERNEL_H_ #define __TRACE_PROBE_KERNEL_H_ +#define FAULT_STRING "(fault)" + /* * This depends on trace_probe.h, but can not include it due to * the way trace_probe_tmpl.h is used by trace_kprobe.c and trace_eprobe.c. @@ -13,8 +15,16 @@ static nokprobe_inline int kern_fetch_store_strlen_user(unsigned long addr) { const void __user *uaddr = (__force const void __user *)addr; + int ret; - return strnlen_user_nofault(uaddr, MAX_STRING_SIZE); + ret = strnlen_user_nofault(uaddr, MAX_STRING_SIZE); + /* + * strnlen_user_nofault returns zero on fault, insert the + * FAULT_STRING when that occurs. + */ + if (ret <= 0) + return strlen(FAULT_STRING) + 1; + return ret; } /* Return the length of string -- including null terminal byte */ @@ -34,7 +44,18 @@ kern_fetch_store_strlen(unsigned long ad len++; } while (c && ret == 0 && len < MAX_STRING_SIZE); - return (ret < 0) ? ret : len; + /* For faults, return enough to hold the FAULT_STRING */ + return (ret < 0) ? strlen(FAULT_STRING) + 1 : len; +} + +static nokprobe_inline void set_data_loc(int ret, void *dest, void *__dest, void *base, int len) +{ + if (ret >= 0) { + *(u32 *)dest = make_data_loc(ret, __dest - base); + } else { + strscpy(__dest, FAULT_STRING, len); + ret = strlen(__dest) + 1; + } } /* @@ -55,8 +76,7 @@ kern_fetch_store_string_user(unsigned lo __dest = get_loc_data(dest, base); ret = strncpy_from_user_nofault(__dest, uaddr, maxlen); - if (ret >= 0) - *(u32 *)dest = make_data_loc(ret, __dest - base); + set_data_loc(ret, dest, __dest, base, maxlen); return ret; } @@ -87,8 +107,7 @@ kern_fetch_store_string(unsigned long ad * probing. */ ret = strncpy_from_kernel_nofault(__dest, (void *)addr, maxlen); - if (ret >= 0) - *(u32 *)dest = make_data_loc(ret, __dest - base); + set_data_loc(ret, dest, __dest, base, maxlen); return ret; } From patchwork Sat Oct 22 07:20: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: 7459 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1098760wrr; Sat, 22 Oct 2022 01:11:40 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4PULFkrbKY78iSHJ37+CucYY72FjCnDv4yY39m8FpwK9JsN4cY5mAs6YKAXLQTwOAIHC1p X-Received: by 2002:a17:902:e845:b0:184:8078:be88 with SMTP id t5-20020a170902e84500b001848078be88mr22890381plg.99.1666426299977; Sat, 22 Oct 2022 01:11:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666426299; cv=none; d=google.com; s=arc-20160816; b=rNbC4pbCl3qT5htepz2QQQv6kZvJahd9dm8ByqbKGK5HcUkaw976GtatQ9SUxpQMo0 JL3IcZ9UGPBC6tRV2pWs95lb/VYIK50tC5wGWYBjxJ5VDoRFjvzlxWBXKQZlCzFxqEtF jnvise1DlEt79qZv3N5IBmB9G6zxai7xnIJQhjiLwvECcxFjU4PU7JVTK05dN14Q/Kqa 1gCfLw4VEUxSJzPi+PNbuZP3f1Fa+/jczeNq5UODZBMbdhuk+zMayl9nwKjl+2EBTUpJ /0bkvFf1UYjDEWzg5hzlnsfvzAmGFZ0kAdJZWdtsaoAKvxm/YI7yJnccs6/ewbOwMWBH hQAw== 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=r8jefCc5omYODzIdGSyaJkR+hbn0RbXEHSNFppjjWcE=; b=mAlxveCzsJ7u3Cl7BlKSHGhIqxzbwRauG5IWTVc1V6H+Lj6nt95XK4yq+Daji9n0Wz /3TpnZ/bCtEo+bXG+6M8YA9HabV4NoLIdIs/O1wIw6PBKKEKNHtaX7okv0IeJoIKUFor 0SHqvNBxryZqmTQMfEGhWDrP3f57rFAiy1IFIfV3KGUVRDhafFlZWlP+1KtK8uViU0LX OizKlTLX+Q+qLy7sK0AYwKGDZU8YWGJ/nWNcyvcVUOArFELBuB3Px+qcqHwwgKB+tYwB S5OGjT7EGLxxH3u4Q265IAxNKUAy/Z+eUxYz8zsL7VKUfE0UQzi9Nj8E/0VbtmSDXwCo T51w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=GK8evJ0F; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 l15-20020a056a0016cf00b00563856be5a9si30393488pfc.351.2022.10.22.01.11.27; Sat, 22 Oct 2022 01:11: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=GK8evJ0F; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S233140AbiJVIKw (ORCPT + 99 others); Sat, 22 Oct 2022 04:10:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60216 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232796AbiJVIHt (ORCPT ); Sat, 22 Oct 2022 04:07:49 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E90B92D6579; Sat, 22 Oct 2022 00:53: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 dfw.source.kernel.org (Postfix) with ESMTPS id 76D4F60B26; Sat, 22 Oct 2022 07:40:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8CC58C433C1; Sat, 22 Oct 2022 07:40:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424455; bh=YDvdxWfV1FcnbZUuL8IYRGcSN1JzkaRyWuTjHwTihzY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GK8evJ0FDUeP4Jhudn9t76zU7vJSLzkjFbF5Vx4intRfW2oK01fTF008U4Z4ywTHq iL8vjDRVTCYxZlfbn4PtsnH7p2cBa4ioxgff2E+WqgryOzn3bAGVeEwMUmyPHIkesY dj1/sKLpiYI0eKunNoxO6Oc54dYCwZa6MA+uAT/k= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Andrew Morton , Tom Zanussi , "Masami Hiramatsu (Google)" , "Steven Rostedt (Google)" Subject: [PATCH 5.19 152/717] tracing: Fix reading strings from synthetic events Date: Sat, 22 Oct 2022 09:20:31 +0200 Message-Id: <20221022072442.334611786@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747374624274251699?= X-GMAIL-MSGID: =?utf-8?q?1747374624274251699?= From: Steven Rostedt (Google) commit 0934ae9977c27133449b6dd8c6213970e7eece38 upstream. The follow commands caused a crash: # cd /sys/kernel/tracing # echo 's:open char file[]' > dynamic_events # echo 'hist:keys=common_pid:file=filename:onchange($file).trace(open,$file)' > events/syscalls/sys_enter_openat/trigger' # echo 1 > events/synthetic/open/enable BOOM! The problem is that the synthetic event field "char file[]" will read the value given to it as a string without any memory checks to make sure the address is valid. The above example will pass in the user space address and the sythetic event code will happily call strlen() on it and then strscpy() where either one will cause an oops when accessing user space addresses. Use the helper functions from trace_kprobe and trace_eprobe that can read strings safely (and actually succeed when the address is from user space and the memory is mapped in). Now the above can show: packagekitd-1721 [000] ...2. 104.597170: open: file=/usr/lib/rpm/fileattrs/cmake.attr in:imjournal-978 [006] ...2. 104.599642: open: file=/var/lib/rsyslog/imjournal.state.tmp packagekitd-1721 [000] ...2. 104.626308: open: file=/usr/lib/rpm/fileattrs/debuginfo.attr Link: https://lkml.kernel.org/r/20221012104534.826549315@goodmis.org Cc: stable@vger.kernel.org Cc: Andrew Morton Cc: Tom Zanussi Acked-by: Masami Hiramatsu (Google) Reviewed-by: Tom Zanussi Fixes: bd82631d7ccdc ("tracing: Add support for dynamic strings to synthetic events") Signed-off-by: Steven Rostedt (Google) Signed-off-by: Greg Kroah-Hartman --- kernel/trace/trace_events_synth.c | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) --- a/kernel/trace/trace_events_synth.c +++ b/kernel/trace/trace_events_synth.c @@ -17,6 +17,8 @@ /* for gfp flag names */ #include #include +#include "trace_probe.h" +#include "trace_probe_kernel.h" #include "trace_synth.h" @@ -409,6 +411,7 @@ static unsigned int trace_string(struct { unsigned int len = 0; char *str_field; + int ret; if (is_dynamic) { u32 data_offset; @@ -417,19 +420,27 @@ static unsigned int trace_string(struct data_offset += event->n_u64 * sizeof(u64); data_offset += data_size; - str_field = (char *)entry + data_offset; - - len = strlen(str_val) + 1; - strscpy(str_field, str_val, len); + len = kern_fetch_store_strlen((unsigned long)str_val); data_offset |= len << 16; *(u32 *)&entry->fields[*n_u64] = data_offset; + ret = kern_fetch_store_string((unsigned long)str_val, &entry->fields[*n_u64], entry); + (*n_u64)++; } else { str_field = (char *)&entry->fields[*n_u64]; - strscpy(str_field, str_val, STR_VAR_LEN_MAX); +#ifdef CONFIG_ARCH_HAS_NON_OVERLAPPING_ADDRESS_SPACE + if ((unsigned long)str_val < TASK_SIZE) + ret = strncpy_from_user_nofault(str_field, str_val, STR_VAR_LEN_MAX); + else +#endif + ret = strncpy_from_kernel_nofault(str_field, str_val, STR_VAR_LEN_MAX); + + if (ret < 0) + strcpy(str_field, FAULT_STRING); + (*n_u64) += STR_VAR_LEN_MAX / sizeof(u64); } @@ -462,7 +473,7 @@ static notrace void trace_event_raw_even val_idx = var_ref_idx[field_pos]; str_val = (char *)(long)var_ref_vals[val_idx]; - len = strlen(str_val) + 1; + len = kern_fetch_store_strlen((unsigned long)str_val); fields_size += len; } From patchwork Sat Oct 22 07:20: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: 7248 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1091368wrr; Sat, 22 Oct 2022 00:50:24 -0700 (PDT) X-Google-Smtp-Source: AMsMyM41IovdUN2DZrv5+v8rn/XNuEAvzKr7KbqMItvD9wwpj1gAKwv4oWJFGON3ecUmfXoz7s8K X-Received: by 2002:a17:902:c612:b0:186:8376:208d with SMTP id r18-20020a170902c61200b001868376208dmr5104541plr.89.1666425024564; Sat, 22 Oct 2022 00:50:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666425024; cv=none; d=google.com; s=arc-20160816; b=h1C9s5zdfC5gaWiyFkpId0snCYsyoG8GfoKy09bEBUitPU+RxkPymtGMfGvBv2gUH7 3LjpELbaUeftSGZbMvvcHJPM0oZy0ZlOieXaalxMqYRkkBUB2VTaW/gmixSg+EuzSJHi nqcLsplawm+SbK2Ff2rQMn7sH7WEhiZTjL4EeeFKLyvKFNex70MMxyynBMU72zQRXHP+ 9y/HCl17fkcAys3m72kF2aer5oZOXQEs14t/R/iWQUAWZFYpLfIF4WnlBuMZF1q36+up sha/4B2/azzDnoFLnvNb20T9VX0oM7PBtuUToyxEHJFmeAduXACGw6br3/w/9Bla/fhQ AIYQ== 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=QZKNLBwoFHC2sEhBNc6rWUygaOHlhYxYFQiN1k42kHw=; b=rKd2TsogiHC/ckbZSmYb60y8YLmHhl1XHHH0mgQzZmkoxK1k6IRF5EFFLw4Be5Y2Vo Tew2cEHT8Uo+TyUkGMKX1KfkkKq2lkmaDl8fApLlb+WN23K2ctXQcJUo72jCYqqM4cy8 c37/+ntfp27oAFuJUi+w0Psxqb21MbFuRJiWIhhcDAoETplx+HxbAN92cK4NTHP3LscJ DPg90lEmio3yujG54qRjTVI/76MLRsjMdpQHdNFtqWaZ8g5TRoEstoY4L1zqAGCJJdnJ 0ymSP4934+tHKS2fV3jQsuYtoa2wKDcgDERjFeSvNuZ/VZuqgUptjg+ZzpmmWudH3QiJ a49g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=dZASHyKY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 m1-20020a170902db0100b0017840d9d42esi28136728plx.582.2022.10.22.00.50.11; Sat, 22 Oct 2022 00: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=dZASHyKY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231557AbiJVHtx (ORCPT + 99 others); Sat, 22 Oct 2022 03:49:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35562 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231528AbiJVHsk (ORCPT ); Sat, 22 Oct 2022 03:48: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 5C0B1170DEE; Sat, 22 Oct 2022 00:45: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 1FFCB60B81; Sat, 22 Oct 2022 07:40:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2FE78C433D6; Sat, 22 Oct 2022 07:40:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424458; bh=v/ymPpgTxvo03kcno91Ec+SWdJWekcA1Tf7hofUOme4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dZASHyKYh38l+fHIRIsbIwv4G4/GwxI77btu0Jr4FsJx4YD4nlbKBq6W+r6Yo10LK Conf41P4RiNEnSMK/1KCW845jPlAUAcjAdvUWFi6FX1JnEEgoUKLUY4YqzzC0qmoxT nDj6cwTXrCNp17tMw0ekOVWWKD7GNMPmM6SnpemA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Shengjiu Wang , Arnaud Pouliquen , Peng Fan , Mathieu Poirier Subject: [PATCH 5.19 153/717] rpmsg: char: Avoid double destroy of default endpoint Date: Sat, 22 Oct 2022 09:20:32 +0200 Message-Id: <20221022072442.508885436@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747373286944096907?= X-GMAIL-MSGID: =?utf-8?q?1747373286944096907?= From: Shengjiu Wang commit 467233a4ac29b215d492843d067a9f091e6bf0c5 upstream. The rpmsg_dev_remove() in rpmsg_core is the place for releasing this default endpoint. So need to avoid destroying the default endpoint in rpmsg_chrdev_eptdev_destroy(), this should be the same as rpmsg_eptdev_release(). Otherwise there will be double destroy issue that ept->refcount report warning: refcount_t: underflow; use-after-free. Call trace: refcount_warn_saturate+0xf8/0x150 virtio_rpmsg_destroy_ept+0xd4/0xec rpmsg_dev_remove+0x60/0x70 The issue can be reproduced by stopping remoteproc before closing the /dev/rpmsgX. Fixes: bea9b79c2d10 ("rpmsg: char: Add possibility to use default endpoint of the rpmsg device") Signed-off-by: Shengjiu Wang Reviewed-by: Arnaud Pouliquen Reviewed-by: Peng Fan Cc: stable Link: https://lore.kernel.org/r/1663725523-6514-1-git-send-email-shengjiu.wang@nxp.com Signed-off-by: Mathieu Poirier Signed-off-by: Greg Kroah-Hartman --- drivers/rpmsg/rpmsg_char.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) --- a/drivers/rpmsg/rpmsg_char.c +++ b/drivers/rpmsg/rpmsg_char.c @@ -76,7 +76,9 @@ int rpmsg_chrdev_eptdev_destroy(struct d mutex_lock(&eptdev->ept_lock); if (eptdev->ept) { - rpmsg_destroy_ept(eptdev->ept); + /* The default endpoint is released by the rpmsg core */ + if (!eptdev->default_ept) + rpmsg_destroy_ept(eptdev->ept); eptdev->ept = NULL; } mutex_unlock(&eptdev->ept_lock); From patchwork Sat Oct 22 07:20: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: 7251 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1091486wrr; Sat, 22 Oct 2022 00:50:48 -0700 (PDT) X-Google-Smtp-Source: AMsMyM62TazfDQT6E4fL4RzqDoHyLLCPdLpjbKAchJlq020fqFvMrl0rAq/PNcQvwMwmnSR95dJr X-Received: by 2002:a65:6bcb:0:b0:44c:3e11:a7ac with SMTP id e11-20020a656bcb000000b0044c3e11a7acmr19975401pgw.274.1666425048095; Sat, 22 Oct 2022 00:50:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666425048; cv=none; d=google.com; s=arc-20160816; b=iqkD5vY5JREidiqRPg+/to51qfY47+mtcMfbY/Xbe1RaTJdcD11SCILhevR4+GwEhw ErBtK3bIhwPeRqJcMfyfzNdiJ+Y1QwWniDiy0HQfFNqboSCx9RQZM7Z5rcn3EHaZpmWB PJSwrMBO+krfhhb4puzBjw3+TjqDH69DHUoWqTZeyCpFC2rCceDqMBgbvc2dLSoUwywK L9PKTng+EzDCw9fxk5HZqfa5M2WSQ6sUVlBN4LVWKRWtIK3DpXI8mEGcS9Jaidsmq9sY p4priKheLZpouO6p7GWPH0JNL7Sro1hxfcaEbywUUKaCEdcvGIBU79LhH+65cAnAgFCa Fl3A== 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=zm4pR7X8KEtiEFOyqVODlcpUl39LkWPoDM6e3Roxevk=; b=UnFDHBFM+qh0nlsicsA6oqv0haa2S3fBGZS3wp6/boQD+A23w8SXpMfrzqKY0D50B0 I8VHhpn0ID1f5hf+V1aNCDbeNnqVypx1Phjp9bpwHoS/eTWIb98iKvXEK0fkan2T0cjK ZogmdVO1lfEvKCwNdkiYaIU/PezsaPKkn6wjGxaq6KpfWKMSgUT1qkBGGe9UaHICe4D8 IoZzZ87B/AbfJgE0TWBTXXdsjmvSBwmgiuUVAxjOuEbo/PvWQ63DfQaqzho+EYFx6NN2 jUGuafjKLuZfDQ0DYMhYk9ETR8ezM6DpP6beInKQpXeyVzaKK9XMRvIVOAkjCYYKt5em vFJg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=lIJVNRKs; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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-20020a1709029a0a00b001768452d4d0si26599364plp.30.2022.10.22.00.50.35; Sat, 22 Oct 2022 00:50: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=lIJVNRKs; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231635AbiJVHuB (ORCPT + 99 others); Sat, 22 Oct 2022 03:50:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35674 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231532AbiJVHsm (ORCPT ); Sat, 22 Oct 2022 03:48: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 17AA616D56C; Sat, 22 Oct 2022 00:45: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 BD5AD60B49; Sat, 22 Oct 2022 07:41:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CCF2FC433D6; Sat, 22 Oct 2022 07:41:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424461; bh=e6EujxveYGGxtCmLnZxMjQZJohrw+5FNgNJh9TVA5Bk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lIJVNRKs2zCavZTrjxxO1cQZOx01g+nTxmVAVzjY50FNxE0MXXdhkBQCO4WE/oycJ JZfxHxvwB+6fgfEc8SU0J1G9azusrNcjLLGg29YSYKGj1pkrjKH+IWd1YMgn+WW499 /dedqbNwe1dhdazyzC5WvL1bNxQbq5bcOa1k8+mk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mario Limonciello , Mika Westerberg Subject: [PATCH 5.19 154/717] thunderbolt: Explicitly enable lane adapter hotplug events at startup Date: Sat, 22 Oct 2022 09:20:33 +0200 Message-Id: <20221022072442.694867562@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747373311537528395?= X-GMAIL-MSGID: =?utf-8?q?1747373311537528395?= From: Mario Limonciello commit 5d2569cb4a65c373896ec0217febdf88739ed295 upstream. Software that has run before the USB4 CM in Linux runs may have disabled hotplug events for a given lane adapter. Other CMs such as that one distributed with Windows 11 will enable hotplug events. Do the same thing in the Linux CM which fixes hotplug events on "AMD Pink Sardine". Cc: stable@vger.kernel.org Signed-off-by: Mario Limonciello Signed-off-by: Mika Westerberg Signed-off-by: Greg Kroah-Hartman --- drivers/thunderbolt/switch.c | 24 ++++++++++++++++++++++++ drivers/thunderbolt/tb.h | 1 + drivers/thunderbolt/tb_regs.h | 1 + drivers/thunderbolt/usb4.c | 20 ++++++++++++++++++++ 4 files changed, 46 insertions(+) --- a/drivers/thunderbolt/switch.c +++ b/drivers/thunderbolt/switch.c @@ -2822,6 +2822,26 @@ static void tb_switch_credits_init(struc tb_sw_info(sw, "failed to determine preferred buffer allocation, using defaults\n"); } +static int tb_switch_port_hotplug_enable(struct tb_switch *sw) +{ + struct tb_port *port; + + if (tb_switch_is_icm(sw)) + return 0; + + tb_switch_for_each_port(sw, port) { + int res; + + if (!port->cap_usb4) + continue; + + res = usb4_port_hotplug_enable(port); + if (res) + return res; + } + return 0; +} + /** * tb_switch_add() - Add a switch to the domain * @sw: Switch to add @@ -2891,6 +2911,10 @@ int tb_switch_add(struct tb_switch *sw) return ret; } + ret = tb_switch_port_hotplug_enable(sw); + if (ret) + return ret; + ret = device_add(&sw->dev); if (ret) { dev_err(&sw->dev, "failed to add device: %d\n", ret); --- a/drivers/thunderbolt/tb.h +++ b/drivers/thunderbolt/tb.h @@ -1170,6 +1170,7 @@ int usb4_switch_add_ports(struct tb_swit void usb4_switch_remove_ports(struct tb_switch *sw); int usb4_port_unlock(struct tb_port *port); +int usb4_port_hotplug_enable(struct tb_port *port); int usb4_port_configure(struct tb_port *port); void usb4_port_unconfigure(struct tb_port *port); int usb4_port_configure_xdomain(struct tb_port *port); --- a/drivers/thunderbolt/tb_regs.h +++ b/drivers/thunderbolt/tb_regs.h @@ -302,6 +302,7 @@ struct tb_regs_port_header { #define ADP_CS_5 0x05 #define ADP_CS_5_LCA_MASK GENMASK(28, 22) #define ADP_CS_5_LCA_SHIFT 22 +#define ADP_CS_5_DHP BIT(31) /* TMU adapter registers */ #define TMU_ADP_CS_3 0x03 --- a/drivers/thunderbolt/usb4.c +++ b/drivers/thunderbolt/usb4.c @@ -1046,6 +1046,26 @@ int usb4_port_unlock(struct tb_port *por return tb_port_write(port, &val, TB_CFG_PORT, ADP_CS_4, 1); } +/** + * usb4_port_hotplug_enable() - Enables hotplug for a port + * @port: USB4 port to operate on + * + * Enables hot plug events on a given port. This is only intended + * to be used on lane, DP-IN, and DP-OUT adapters. + */ +int usb4_port_hotplug_enable(struct tb_port *port) +{ + int ret; + u32 val; + + ret = tb_port_read(port, &val, TB_CFG_PORT, ADP_CS_5, 1); + if (ret) + return ret; + + val &= ~ADP_CS_5_DHP; + return tb_port_write(port, &val, TB_CFG_PORT, ADP_CS_5, 1); +} + static int usb4_port_set_configured(struct tb_port *port, bool configured) { int ret; From patchwork Sat Oct 22 07:20: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: 7202 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1090040wrr; Sat, 22 Oct 2022 00:45:29 -0700 (PDT) X-Google-Smtp-Source: AMsMyM60ExowFjDHxe5lJt57aaZsbgUIhpe1hizBqr0mPj6T32m2Ugip8ILRSZ0kUdchY506vMmm X-Received: by 2002:a63:5a63:0:b0:42f:e143:80d4 with SMTP id k35-20020a635a63000000b0042fe14380d4mr19828772pgm.456.1666424728999; Sat, 22 Oct 2022 00:45:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666424728; cv=none; d=google.com; s=arc-20160816; b=TWAiiQAv1jtevXkly1L6QQVAAFIJD5yC0OvDhGWiE8g2Y5VxlybhPoTcSbFqtugPcH HLms3Tpka2DL3ZfxZEPxskZMwnvDTxvmtfpeccpQTXSfcTuP/toNnTyVezW6mU/ZLVJl y0e1FTFKTgH+4jBA+DVp66WXKvUngZXFCGeJaXl0dhEpTUh/Ph8tetaGQa3CLVraNj2F BT3kbMNmfea7cT1MuEUCZMliTsCDF8ivDI2rXBD3D41X0Fjj1j1+2ApwC1ViBbDXsuT7 8iFrCxr1a/J+tjcmEodhBKDK+sUDQBjnrE21MEGUjobBqH/O++bqcBSNvG5qWsRkdWz5 prxQ== 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=s2gKcQ/IDsP1dabzlcd7EszbvivbP0MKCvj4h22jt40=; b=Piq7fuOKTxlgEJU8xN3Dt8qblAaj84X8TYDwZFdbmyxyO5fTwbxF89/JurmB11Jqur 1IVJEV37P1lbLNwqc/7mXkcsSNxCYZQfJlIRjHmcBzScYODX7SU5PGXrAb8dgXJIVyw+ c93rvNswOPs48H/LASf9SZcV4Ad+fn8zel0mIlBxtaU7nMxfa2/EiPqyGXXC4I6k+y3O wH/erobo6HkR4wBfouWGxQJnZcPpqsVeVsTeOdH9t3Ai3hxOQrMCiaMqA/roFwMOH1hi BaWFEIOpS+Sp4hG/e3BJwRm9jNQPXYIew+cD233ylzgDETM7XugtKHRoyT2Y6PXQfbg6 0NdQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=dbwJOVkW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 bm10-20020a656e8a000000b0046afc3948c4si29970640pgb.707.2022.10.22.00.45.15; Sat, 22 Oct 2022 00:45: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=dbwJOVkW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231345AbiJVHnp (ORCPT + 99 others); Sat, 22 Oct 2022 03:43:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56818 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230476AbiJVHnL (ORCPT ); Sat, 22 Oct 2022 03:43:11 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C993D1B94F6; Sat, 22 Oct 2022 00:42: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 F1FBCB82E0B; Sat, 22 Oct 2022 07:41:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6A24CC4347C; Sat, 22 Oct 2022 07:41:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424463; bh=nFCeWBlb71nzHFatGST1sfWN1nDJByc2HnNY5OXQHfM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dbwJOVkWdpkoC/SJvgTDsXwIll5nz4FMenygmLIYawln52KnI9pCDd0WD31MNk+Vg RrtCMQYWVDrgJsdB5fh6GICqWdEO61BpYHpYVcxeBbPTmGa8/c7JKmRLchtysKtcez 7G+z+qJG88hGVRzS2bauSmELsRwDbj3hV023TYX4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ard Biesheuvel Subject: [PATCH 5.19 155/717] efi: libstub: drop pointless get_memory_map() call Date: Sat, 22 Oct 2022 09:20:34 +0200 Message-Id: <20221022072442.871548970@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747372976434996608?= X-GMAIL-MSGID: =?utf-8?q?1747372976434996608?= 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 @@ -280,14 +280,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(&map); - if (status != EFI_SUCCESS) - goto fail_free_new_fdt; - status = update_fdt((void *)fdt_addr, fdt_size, (void *)*new_fdt_addr, MAX_FDT_SIZE, cmdline_ptr, initrd_addr, initrd_size); From patchwork Sat Oct 22 07:20: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: 7365 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1095829wrr; Sat, 22 Oct 2022 01:03:36 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4zqf8ooQxkp8Y0NKh+ltggeP4iHdNBtkh8uNrq3q6GK/2oEEIKOaJFxndvF3BtMcvTcjvE X-Received: by 2002:a17:90a:7c47:b0:212:ea80:8b02 with SMTP id e7-20020a17090a7c4700b00212ea808b02mr903197pjl.60.1666425816675; Sat, 22 Oct 2022 01:03:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666425816; cv=none; d=google.com; s=arc-20160816; b=J2il3QMrEN8N1x40wvFaHdr7vT6xBlYLrtNH/h47bZuYd/6TGH5Ih8Qj1zdaLo1j10 xTJTxQWrhjkZd+ANufTnr3IRxlw9AVqGu/vcwj+l5cFMF5c/Gx4AyRX10YdheO8Y0fdT QWwzblhkfvgsnciZoiza16I5zQfrLklM2eQjmeviIrXc4JqyqXnQUVBfiKltW0UNVu7d injPV9StBzusVUsvlb6yU44eSw9Iu8jv3UAcxn8PzbJQ5bawEMvXmgZUXUhK6r0FgBNZ 7mNpXZWuPZV5OCKfwKuMEcwx6mqS5CICs/o9YptvWPgbRe5QJKkaVPGBcjqsUahACR8U Q6ag== 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/XWI/r91UXBR2OOaY3Ku8PUeov57qvXoRyLStnAO2c=; b=ALGGKrhZVvtz0cZNuzxN0BOlNG0rFD4NRQqInXSmd0R/7FlMZoGJlOg857aRFg/DSL L0m5/WhxbJAQew84E0qolQrVeqm+CBF7+UL8lm+N9j0rfC+CgMINh8wXHbASi1m7joe7 2VgaOAMv5FOkJLddhShUDWvB5dX6537safQlv9C/XzA1+TwWtTEw6/qdN9m+icDUy5l4 CEOKZO7wMN6qS8Rmz/+01DKy/GBFcj9d80V8oBPY27HOgulmDXw0CJTmLYveDj4WpFlz UOsobF4NPH9MXhDH8yWMhLgjQHdm9H9MpO7niyTW16ccoEdCZOXoOfWbbmMSmPV6YH1d Zz7Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=bPRgF89v; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 pq8-20020a17090b3d8800b0020382775a6fsi8176781pjb.149.2022.10.22.01.03.23; Sat, 22 Oct 2022 01:03: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=bPRgF89v; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S232624AbiJVIDB (ORCPT + 99 others); Sat, 22 Oct 2022 04:03:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42398 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232383AbiJVHyw (ORCPT ); Sat, 22 Oct 2022 03:54: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 1CF412CA7E5; Sat, 22 Oct 2022 00:47: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 EC29360B80; Sat, 22 Oct 2022 07:41:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0D519C433D6; Sat, 22 Oct 2022 07:41:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424466; bh=7Xwy95C2E5ageYfL4Q4GKPlKhQLwTN2ZgccIzHpijL0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bPRgF89v7WGnfNYGplHhZY5tQdaXBFAGH++YJOJppqMKqgmuRR3/XWL7cMsa3DLfW STxIbBSAE5y4uj+JGs4u0fYZVREIH56vqYwDLa17hFsIQTGLNCwGX42QD+VEgvXmTU JqhOXjry37N2UBWJGRqdysVndJEe7bXK7Ny3MuKs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dmitry Osipenko , Nicolas Dufresne , Samuel Holland , Paul Kocialkowski , Hans Verkuil , Mauro Carvalho Chehab Subject: [PATCH 5.19 156/717] media: cedrus: Set the platform driver data earlier Date: Sat, 22 Oct 2022 09:20:35 +0200 Message-Id: <20221022072443.055235337@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747374117438611977?= X-GMAIL-MSGID: =?utf-8?q?1747374117438611977?= From: Dmitry Osipenko commit 708938f8495147fe2e77a9a3e1015d8e6899323e upstream. The cedrus_hw_resume() crashes with NULL deference on driver probe if runtime PM is disabled because it uses platform data that hasn't been set up yet. Fix this by setting the platform data earlier during probe. Cc: stable@vger.kernel.org Fixes: 50e761516f2b (media: platform: Add Cedrus VPU decoder driver) Signed-off-by: Dmitry Osipenko Signed-off-by: Nicolas Dufresne Reviewed-by: Samuel Holland Acked-by: Paul Kocialkowski Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Greg Kroah-Hartman --- drivers/staging/media/sunxi/cedrus/cedrus.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/drivers/staging/media/sunxi/cedrus/cedrus.c +++ b/drivers/staging/media/sunxi/cedrus/cedrus.c @@ -422,6 +422,8 @@ static int cedrus_probe(struct platform_ if (!dev) return -ENOMEM; + platform_set_drvdata(pdev, dev); + dev->vfd = cedrus_video_device; dev->dev = &pdev->dev; dev->pdev = pdev; @@ -495,8 +497,6 @@ static int cedrus_probe(struct platform_ goto err_m2m_mc; } - platform_set_drvdata(pdev, dev); - return 0; err_m2m_mc: From patchwork Sat Oct 22 07:20: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: 7267 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1091831wrr; Sat, 22 Oct 2022 00:51:59 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5gDqduB2qynjA+XlFoAy8+teiGDGoPrY0FE5UXfxYWTTPzsubTgsSdnaMYsvHyQDKCnv0L X-Received: by 2002:a63:5f54:0:b0:462:1149:f3b3 with SMTP id t81-20020a635f54000000b004621149f3b3mr19792417pgb.445.1666425119746; Sat, 22 Oct 2022 00:51:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666425119; cv=none; d=google.com; s=arc-20160816; b=TZAQB6iKB9QUY/BQ25mAfz2EzlDjbkTTX4ofmEZHxdj24h9ATBtqWe/GrX6edQWHZv y1jZi6wmsOq5dNzbrOMGhSQ52bD+7tAUM8/TCfGOC1TpJVETt73lMH5hUjgyDcVQazwI IlXwILqGSacELEor0fgP2KEy4cokkTFlPO3fM3OwnClo8CE7vugE203LfdIThQBBrjxv WWbkSdF7lLx4lru5+lBMerdCMPhFIPSnRNfm7lNjQ67w1ghOb/oLUHUN5N8qU8d0w0p3 1TbJJIHD3fhQxVEoq2Bjh315v1Mg3TgrSzLnfkGVP0n+6pCi+sCpGiFyPq97GMgnv4o5 c8+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=9NV/ihc0Uh1gmyJpr61Y3yKDSmVXX5AfKL+sPrj3NMw=; b=xW1dFKYdxgTi+9DkjLze26EJBG75Y2iEAan1ax/0AAvn2sWzerWIMmNZcAqdj89Rrh Jj9UxQYEhjLau9yXDweqJ/6xRxJUtNw69u87fQuB7iGLddddc/d+nA0kmrrfcxAw/EWs pTISVhzXwJpI6xrNsY2RSYiGcz6NmBY2jxunYY1NBQ1OagKHSmhmz+rXHD/rsvywqUcQ 6nFgDBZDASZCfZiZnYPqdYx4tCBrUu24uPxJFvNL6dgUO+6iMCPhoHT0kbtoc6AbrkOM Ov+WmKGuGl5ExwqNb+FJp7yPskqpZ9K9wY+zdgDOiox26noPTo5mYmgESr3U2BLI2wCk e8rQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=mzblqz1c; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 cp8-20020a056a00348800b005668645daebsi24062554pfb.111.2022.10.22.00.51.47; Sat, 22 Oct 2022 00:51: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=mzblqz1c; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231916AbiJVHve (ORCPT + 99 others); Sat, 22 Oct 2022 03:51:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49478 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231565AbiJVHsl (ORCPT ); Sat, 22 Oct 2022 03:48:41 -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 5C93C199F6B; Sat, 22 Oct 2022 00:45: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 D0D0660B90; Sat, 22 Oct 2022 07:41:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AB3E9C433C1; Sat, 22 Oct 2022 07:41:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424469; bh=BMhRM4nqWbjmRpKYBjSHNb+WOA6zO/H96SN3tqK7YGs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mzblqz1cmdf6/pW4s7ZSdzBrX2jRSMu7u5ZmQN2EXgK7nZM0Js6CoK1oxt8PPUWAv oMpAH2J3uIb0uLTAaOiuKvqyY3fottfxNRKckoq8gx1loxI3b6bAO92Qn1ahpaguhE BNvtZ8LWFTMI9cVrCrL2XBIkzSXSfjORL1Q9OTug= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Nicolas Dufresne , Dmitry Osipenko , Hans Verkuil , Mauro Carvalho Chehab Subject: [PATCH 5.19 157/717] media: cedrus: Fix endless loop in cedrus_h265_skip_bits() Date: Sat, 22 Oct 2022 09:20:36 +0200 Message-Id: <20221022072443.234474692@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747373386102799440?= X-GMAIL-MSGID: =?utf-8?q?1747373386102799440?= From: Dmitry Osipenko commit 91db7a3fc7fe670cf1770a398a43bb4a1f776bf1 upstream. The busy status bit may never de-assert if number of programmed skip bits is incorrect, resulting in a kernel hang because the bit is polled endlessly in the code. Fix it by adding timeout for the bit-polling. This problem is reproducible by setting the data_bit_offset field of the HEVC slice params to a wrong value by userspace. Cc: stable@vger.kernel.org Fixes: 7678c5462680 (media: cedrus: Fix decoding for some HEVC videos) Reported-by: Nicolas Dufresne Signed-off-by: Dmitry Osipenko Signed-off-by: Nicolas Dufresne Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Greg Kroah-Hartman --- drivers/staging/media/sunxi/cedrus/cedrus_h265.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) --- a/drivers/staging/media/sunxi/cedrus/cedrus_h265.c +++ b/drivers/staging/media/sunxi/cedrus/cedrus_h265.c @@ -234,8 +234,9 @@ static void cedrus_h265_skip_bits(struct cedrus_write(dev, VE_DEC_H265_TRIGGER, VE_DEC_H265_TRIGGER_FLUSH_BITS | VE_DEC_H265_TRIGGER_TYPE_N_BITS(tmp)); - while (cedrus_read(dev, VE_DEC_H265_STATUS) & VE_DEC_H265_STATUS_VLD_BUSY) - udelay(1); + + if (cedrus_wait_for(dev, VE_DEC_H265_STATUS, VE_DEC_H265_STATUS_VLD_BUSY)) + dev_err_ratelimited(dev->dev, "timed out waiting to skip bits\n"); count += tmp; } From patchwork Sat Oct 22 07:20: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: 7425 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1097787wrr; Sat, 22 Oct 2022 01:08:44 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7Srg78DDtP9v7Ep+GkkCT471Bxcn7j86PtaBFaXD1qxMTYOG6pC0C+OkUiO/+t24k25HP7 X-Received: by 2002:a17:90b:1a91:b0:20d:268b:eab with SMTP id ng17-20020a17090b1a9100b0020d268b0eabmr26322650pjb.177.1666426124266; Sat, 22 Oct 2022 01:08:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666426124; cv=none; d=google.com; s=arc-20160816; b=reVhosAXVZL6nrRIvGE3PGq2d/UY3e1Qu9FkBIcsuN2O8zTx+IrWi+TYwkC4vtd6WE wK779fJUssmccSstQfhF1AbLsd9tvvLzxdUV73iK4UK+WLWxiY2KoHfvewsFXT1tbg8k 7m1Unxrl+LydX0mtGLoAQqtMYiFIekhU7kloRytwrC/ywGDbuBNd7CpXaq3OmS6/zUvu 6mIUCUmmyzcN1Ka8QJvuOrheRITs5OCRqckqFYKISqTEqdJV5ebHVUV4Mj2qnIbdsFRD gfNd79IVYqrpQSQ1lsFzyAflkCs6FTxakNYjmAAkoKtKxOwGFQaY9EhJkHeZpTnqzqUo UNOg== 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=77/ZRwgruNRQxdWJ+5XMUJBPIG4VpvnLfO+uxNyrM1Q=; b=M8cUOJFDGLSMyHFKM/EzNNe/8gMxMQRk4qAu9ZgLrVivscqi+d+DeYm5wiOS91pmRl luOhnaNlAP93p8eJqhOp+FdLAJht0jSHtiNI4o8EbNcVK8Pn81lghyQRqT8CKS16G6BD +moxgvIOikOvIL07BNep8aXDtdtcLDH8PY+7jRjdB5lLgWZt7bfNwXpO2maTW4OKngGn jxI2y4bk7E+UQEmB+j4lwtCTvaPfkuV2wNepCvOgv1WZBmIzr2IAIg/kXKd3/nBelXpr e5Q6QXhm+ifWBbjeVc2nhjhPTHPXB3G6boyL3MavZCDBfuigZjcTLneGCtjR96iu+SrI v3oA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=c2Q00ifC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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-20020a056a00000700b0056770143950si12722139pfk.33.2022.10.22.01.08.31; Sat, 22 Oct 2022 01:08: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=c2Q00ifC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S233046AbiJVIIP (ORCPT + 99 others); Sat, 22 Oct 2022 04:08:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40988 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232875AbiJVIEU (ORCPT ); Sat, 22 Oct 2022 04:04:20 -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 6238E2D2C24; Sat, 22 Oct 2022 00:51: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 3C22CB82E03; Sat, 22 Oct 2022 07:41:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 97E50C433C1; Sat, 22 Oct 2022 07:41:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424471; bh=tQocI4AX+Xkhb6aZXEHJleSRliEKDtndK6ghaeMogRU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=c2Q00ifCBe8r1fbckqdPW6/ttlvnTDDN+YULJBhhIanTZKifGdQTySNIQEZ3iP92L qd8sP4SGWY2UFuBDcPOtydIqngABVkr7zqI9Z5Y2XrxQDnuV4/l8QSy9UXN+PJuznt 5ty/Og7rV25G0uLaDDo7moig0g6waZ0jVXlgknJs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Yu Kuai , Tejun Heo , Jens Axboe Subject: [PATCH 5.19 158/717] blk-throttle: fix that io throttle can only work for single bio Date: Sat, 22 Oct 2022 09:20:37 +0200 Message-Id: <20221022072443.408341338@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747374439663742163?= X-GMAIL-MSGID: =?utf-8?q?1747374439663742163?= From: Yu Kuai commit 320fb0f91e55ba248d4bad106b408e59099cfa89 upstream. Test scripts: cd /sys/fs/cgroup/blkio/ echo "8:0 1024" > blkio.throttle.write_bps_device echo $$ > cgroup.procs dd if=/dev/zero of=/dev/sda bs=10k count=1 oflag=direct & dd if=/dev/zero of=/dev/sda bs=10k count=1 oflag=direct & Test result: 10240 bytes (10 kB, 10 KiB) copied, 10.0134 s, 1.0 kB/s 10240 bytes (10 kB, 10 KiB) copied, 10.0135 s, 1.0 kB/s The problem is that the second bio is finished after 10s instead of 20s. Root cause: 1) second bio will be flagged: __blk_throtl_bio while (true) { ... if (sq->nr_queued[rw]) -> some bio is throttled already break }; bio_set_flag(bio, BIO_THROTTLED); -> flag the bio 2) flagged bio will be dispatched without waiting: throtl_dispatch_tg tg_may_dispatch tg_with_in_bps_limit if (bps_limit == U64_MAX || bio_flagged(bio, BIO_THROTTLED)) *wait = 0; -> wait time is zero return true; commit 9f5ede3c01f9 ("block: throttle split bio in case of iops limit") support to count split bios for iops limit, thus it adds flagged bio checking in tg_with_in_bps_limit() so that split bios will only count once for bps limit, however, it introduce a new problem that io throttle won't work if multiple bios are throttled. In order to fix the problem, handle iops/bps limit in different ways: 1) for iops limit, there is no flag to record if the bio is throttled, and iops is always applied. 2) for bps limit, original bio will be flagged with BIO_BPS_THROTTLED, and io throttle will ignore bio with the flag. Noted this patch also remove the code to set flag in __bio_clone(), it's introduced in commit 111be8839817 ("block-throttle: avoid double charge"), and author thinks split bio can be resubmited and throttled again, which is wrong because split bio will continue to dispatch from caller. Fixes: 9f5ede3c01f9 ("block: throttle split bio in case of iops limit") Cc: Signed-off-by: Yu Kuai Acked-by: Tejun Heo Link: https://lore.kernel.org/r/20220829022240.3348319-2-yukuai1@huaweicloud.com Signed-off-by: Jens Axboe Signed-off-by: Greg Kroah-Hartman --- block/bio.c | 2 -- block/blk-throttle.c | 20 ++++++-------------- block/blk-throttle.h | 2 +- include/linux/bio.h | 2 +- include/linux/blk_types.h | 2 +- 5 files changed, 9 insertions(+), 19 deletions(-) --- a/block/bio.c +++ b/block/bio.c @@ -760,8 +760,6 @@ EXPORT_SYMBOL(bio_put); static int __bio_clone(struct bio *bio, struct bio *bio_src, gfp_t gfp) { bio_set_flag(bio, BIO_CLONED); - if (bio_flagged(bio_src, BIO_THROTTLED)) - bio_set_flag(bio, BIO_THROTTLED); bio->bi_ioprio = bio_src->bi_ioprio; bio->bi_iter = bio_src->bi_iter; --- a/block/blk-throttle.c +++ b/block/blk-throttle.c @@ -811,7 +811,7 @@ static bool tg_with_in_bps_limit(struct unsigned int bio_size = throtl_bio_data_size(bio); /* no need to throttle if this bio's bytes have been accounted */ - if (bps_limit == U64_MAX || bio_flagged(bio, BIO_THROTTLED)) { + if (bps_limit == U64_MAX || bio_flagged(bio, BIO_BPS_THROTTLED)) { if (wait) *wait = 0; return true; @@ -921,22 +921,13 @@ static void throtl_charge_bio(struct thr unsigned int bio_size = throtl_bio_data_size(bio); /* Charge the bio to the group */ - if (!bio_flagged(bio, BIO_THROTTLED)) { + if (!bio_flagged(bio, BIO_BPS_THROTTLED)) { tg->bytes_disp[rw] += bio_size; tg->last_bytes_disp[rw] += bio_size; } tg->io_disp[rw]++; tg->last_io_disp[rw]++; - - /* - * BIO_THROTTLED is used to prevent the same bio to be throttled - * more than once as a throttled bio will go through blk-throtl the - * second time when it eventually gets issued. Set it when a bio - * is being charged to a tg. - */ - if (!bio_flagged(bio, BIO_THROTTLED)) - bio_set_flag(bio, BIO_THROTTLED); } /** @@ -1026,6 +1017,7 @@ static void tg_dispatch_one_bio(struct t sq->nr_queued[rw]--; throtl_charge_bio(tg, bio); + bio_set_flag(bio, BIO_BPS_THROTTLED); /* * If our parent is another tg, we just need to transfer @bio to @@ -2159,8 +2151,10 @@ again: qn = &tg->qnode_on_parent[rw]; sq = sq->parent_sq; tg = sq_to_tg(sq); - if (!tg) + if (!tg) { + bio_set_flag(bio, BIO_BPS_THROTTLED); goto out_unlock; + } } /* out-of-limit, queue to @tg */ @@ -2189,8 +2183,6 @@ again: } out_unlock: - bio_set_flag(bio, BIO_THROTTLED); - #ifdef CONFIG_BLK_DEV_THROTTLING_LOW if (throttled || !td->track_bio_latency) bio->bi_issue.value |= BIO_ISSUE_THROTL_SKIP_LATENCY; --- a/block/blk-throttle.h +++ b/block/blk-throttle.h @@ -175,7 +175,7 @@ static inline bool blk_throtl_bio(struct struct throtl_grp *tg = blkg_to_tg(bio->bi_blkg); /* no need to throttle bps any more if the bio has been throttled */ - if (bio_flagged(bio, BIO_THROTTLED) && + if (bio_flagged(bio, BIO_BPS_THROTTLED) && !(tg->flags & THROTL_TG_HAS_IOPS_LIMIT)) return false; --- a/include/linux/bio.h +++ b/include/linux/bio.h @@ -509,7 +509,7 @@ static inline void bio_set_dev(struct bi { bio_clear_flag(bio, BIO_REMAPPED); if (bio->bi_bdev != bdev) - bio_clear_flag(bio, BIO_THROTTLED); + bio_clear_flag(bio, BIO_BPS_THROTTLED); bio->bi_bdev = bdev; bio_associate_blkg(bio); } --- a/include/linux/blk_types.h +++ b/include/linux/blk_types.h @@ -323,7 +323,7 @@ enum { BIO_QUIET, /* Make BIO Quiet */ BIO_CHAIN, /* chained bio, ->bi_remaining in effect */ BIO_REFFED, /* bio has elevated ->bi_cnt */ - BIO_THROTTLED, /* This bio has already been subjected to + BIO_BPS_THROTTLED, /* This bio has already been subjected to * throttling rules. Don't do it again. */ BIO_TRACE_COMPLETION, /* bio_endio() should trace the final completion * of this bio. */ From patchwork Sat Oct 22 07:20: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: 7489 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1104790wrr; Sat, 22 Oct 2022 01:33:24 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4fgr00ald3UeMuOGESGq5vTGwi7suS64EGPdWS67kp8G5UqYr9LwiKoLb6THBXot/yPaRZ X-Received: by 2002:a17:90b:3c88:b0:20d:9724:95dc with SMTP id pv8-20020a17090b3c8800b0020d972495dcmr26721091pjb.56.1666427604072; Sat, 22 Oct 2022 01:33:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666427604; cv=none; d=google.com; s=arc-20160816; b=MjKkPaKb9gNfRbch608DqYZutZv8d6jwD8LkkGg9RKllD9QCDL2jRoVxKrdHp7TXe5 6IeDIGvIV2cjIqi3h5kZ/x0Wiy+sEXEMpcB5wo/isiVX6YBx1RHagTKxABETtSyeB1Ng jT23jmquVocejRMdmE0mSAlkpomvn+Cm41DnejTfHiiOXY95t5z9CcKHz+GhO6HM2InG CtjuWEMV8aoLvnQgfj/ZaAHpyMesAl1qfhO7ha3L65gunziFhOmzzZ0PjC0NPN/05zbv 2fqUtzqesWPu/k5s5HNsXPfUxtHRA7IWfWfmPJUWvRTm/uVV75H3CD9PfxbFVGofg2vk d3yg== 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=TIfJNZGQBLnfMFOQY80t4LIwutfA4bvGJOnU3XFk4fs=; b=GK0rVtx4yS5dzKP+IzBdD+t9l6L9qyUL9lvpbyZlNZPy4g7fUAcMPdn45PCbMPqEzJ y6Hy50YdERXfHf9nDDqu+gbsMl6qyVp/kFp/uRulobc2QrLnsC+ZwX5z8kyrAJyxHy1I rB6ysTMj7vOk2jcUST7EHuWvhLeROagWO0HWB2hocsRqoSW8S0aPYKp3xoJbnuQ//cxP eu7elBfYkkxZCysWl0vS4ieb5wZOwJ3sYwkwl4QVaYqQVwRLF3bB8XL2Aa5W1Zm4lYHg FeameVWoMCSIUs3cRHRAgVVekJ6ol/TA8mGP6ptEk2FTtym91PpUMY6ociJnXdzToH2Y MA/A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Ts5QmW25; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 8-20020a630408000000b0043090081d69si5172713pge.82.2022.10.22.01.33.07; Sat, 22 Oct 2022 01:33: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=Ts5QmW25; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S233507AbiJVIRG (ORCPT + 99 others); Sat, 22 Oct 2022 04:17:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60300 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233843AbiJVIPW (ORCPT ); Sat, 22 Oct 2022 04:15: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 1263C2C6EA3; Sat, 22 Oct 2022 00:56: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 5C89EB82E08; Sat, 22 Oct 2022 07:41:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C66B6C433C1; Sat, 22 Oct 2022 07:41:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424477; bh=cNt7T6RmL3y/9iiO0cyR9PT7nxKXSZDGJ+iSkvgxvIQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ts5QmW25qpVUWv5PL6jYpACpazI3FQXg2Vz6uOJq9g6gxRMSBPJQoOrESeLEIhSX1 6qiYP+jJoKJ20yg826/D8qTmU6L7xSBDimFVoTDjVpoEWPdsm1W681fuYZF27PpP2K HoeIsZTfkx/0Sho/z4GAd73r3dC6ejoMpFdU8mFM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Yu Kuai , Jens Axboe Subject: [PATCH 5.19 159/717] blk-wbt: call rq_qos_add() after wb_normal is initialized Date: Sat, 22 Oct 2022 09:20:38 +0200 Message-Id: <20221022072443.637691100@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747375991317051702?= X-GMAIL-MSGID: =?utf-8?q?1747375991317051702?= From: Yu Kuai commit 8c5035dfbb9475b67c82b3fdb7351236525bf52b upstream. Our test found a problem that wbt inflight counter is negative, which will cause io hang(noted that this problem doesn't exist in mainline): t1: device create t2: issue io add_disk blk_register_queue wbt_enable_default wbt_init rq_qos_add // wb_normal is still 0 /* * in mainline, disk can't be opened before * bdev_add(), however, in old kernels, disk * can be opened before blk_register_queue(). */ blkdev_issue_flush // disk size is 0, however, it's not checked submit_bio_wait submit_bio blk_mq_submit_bio rq_qos_throttle wbt_wait bio_to_wbt_flags rwb_enabled // wb_normal is 0, inflight is not increased wbt_queue_depth_changed(&rwb->rqos); wbt_update_limits // wb_normal is initialized rq_qos_track wbt_track rq->wbt_flags |= bio_to_wbt_flags(rwb, bio); // wb_normal is not 0,wbt_flags will be set t3: io completion blk_mq_free_request rq_qos_done wbt_done wbt_is_tracked // return true __wbt_done wbt_rqw_done atomic_dec_return(&rqw->inflight); // inflight is decreased commit 8235b5c1e8c1 ("block: call bdev_add later in device_add_disk") can avoid this problem, however it's better to fix this problem in wbt: 1) Lower kernel can't backport this patch due to lots of refactor. 2) Root cause is that wbt call rq_qos_add() before wb_normal is initialized. Fixes: e34cbd307477 ("blk-wbt: add general throttling mechanism") Cc: Signed-off-by: Yu Kuai Link: https://lore.kernel.org/r/20220913105749.3086243-1-yukuai1@huaweicloud.com Signed-off-by: Jens Axboe Signed-off-by: Greg Kroah-Hartman --- block/blk-wbt.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) --- a/block/blk-wbt.c +++ b/block/blk-wbt.c @@ -843,6 +843,10 @@ int wbt_init(struct request_queue *q) rwb->enable_state = WBT_STATE_ON_DEFAULT; rwb->wc = 1; rwb->rq_depth.default_depth = RWB_DEF_DEPTH; + rwb->min_lat_nsec = wbt_default_latency_nsec(q); + + wbt_queue_depth_changed(&rwb->rqos); + wbt_set_write_cache(q, test_bit(QUEUE_FLAG_WC, &q->queue_flags)); /* * Assign rwb and add the stats callback. @@ -853,11 +857,6 @@ int wbt_init(struct request_queue *q) blk_stat_add_callback(q, rwb->cb); - rwb->min_lat_nsec = wbt_default_latency_nsec(q); - - wbt_queue_depth_changed(&rwb->rqos); - wbt_set_write_cache(q, test_bit(QUEUE_FLAG_WC, &q->queue_flags)); - return 0; err_free: From patchwork Sat Oct 22 07:20: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: 7210 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1090267wrr; Sat, 22 Oct 2022 00:46:20 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6feF7K5pBxzzKIAMvzuvxdcxdjbxCRSjYJH3ylwVRUQyuMukzWtKy2b0ou9KgemHFrBMaB X-Received: by 2002:a63:2402:0:b0:460:99af:331c with SMTP id k2-20020a632402000000b0046099af331cmr19027263pgk.460.1666424779920; Sat, 22 Oct 2022 00:46:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666424779; cv=none; d=google.com; s=arc-20160816; b=DUu/v2bpmuEFuISjLY/VTZBrqfv3mxQTVoovRc4QQ2S0fEFg8/ab1PDqhF5SqIgRgy usbC6vPu7MDcL2rVK/2YwwW+C1TyYNimHDpWdtF9aVqlsasigp8IFlzf6KXWB6SXPVL6 EWmSZy4nFZ9S1Tr5dGcCtgrFYES8rOUKM+/8C1LfC7BriYeymkK0h66DEDLWTmlpvsyy qV18y4rFn2xVIsvijYFD8neCuhIXHGRD3oZT6hmTUU7DHNBzaQFZfDVDQuEuMaeBSUbX 1XO1ZZD0x7oh6hGB8YRGvCwxTl3GrdwC3vYsXmIU+XtbwMYebfYMxr9EYw4DkO2Xi+nL F93Q== 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=vaE8nSSzT0ZpTCJ1JYSxB0280kcEsvv+iNtSXS1cJ3k=; b=fl4Ihb1DIaorTex6y+BvQhMn1JVDU8MDRxzHGrnXNO/HquB3LdshfzjzZtCPHQuq16 1cJLP5SNz+CZzBKZwvEB4F9byHzp8xSOC6mV50YyESlOg3cQcuipWa4ETkpZEcz9cpGO sdwuE7L9LwDmzTKG/rIag7rl8Xk0q2CI6m1Y7BIbE4gC1cBWg0t4vzTk0bxzPfos9krr N7uZjV73BUAs0dqbaFpruthyRA1ubVYnSSweJrPJE1FEYGq6OWK+ykUNUXBSAA9nDGT4 hiy2bdkznBYWdXRbvxYe0cgCcNojzXCoM0v79OSX9fci1v/Pqm2Xlzh1OJKq3dzC/Isx gh+g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=XZyYmiy6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 iz1-20020a170902ef8100b00179f1584540si293675plb.564.2022.10.22.00.46.06; Sat, 22 Oct 2022 00:46: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=XZyYmiy6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231268AbiJVHpp (ORCPT + 99 others); Sat, 22 Oct 2022 03:45:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45798 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231329AbiJVHnd (ORCPT ); Sat, 22 Oct 2022 03:43: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 84A9C57884; Sat, 22 Oct 2022 00:42: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 1C705B82E0A; Sat, 22 Oct 2022 07:41:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 76AABC433C1; Sat, 22 Oct 2022 07:41:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424479; bh=06sUnyiUUf5pAI439nFvDLqDo5NANVTJ7UYdi7Hv6zs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XZyYmiy6Nx3dbOYaJCgYfPvdI+dDOrGIp8eIoDY+FIKxnnfniTziJ/6dRgO81mr4C dj0vRhYPAWS2PG/tSes02tz+C4wyXRjZ5VTa+HcyJxjDJ66ASwy6wtXDN32atdP7Hb TBEz6L4w0I7t11BLarZ0V0nNW+9BIlRRM3hyQ7mU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Michal Luczaj , Sean Christopherson Subject: [PATCH 5.19 160/717] KVM: x86/emulator: Fix handing of POP SS to correctly set interruptibility Date: Sat, 22 Oct 2022 09:20:39 +0200 Message-Id: <20221022072443.800987816@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747373030410712225?= X-GMAIL-MSGID: =?utf-8?q?1747373030410712225?= 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 @@ -1955,7 +1955,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 Sat Oct 22 07:20: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: 7422 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1097702wrr; Sat, 22 Oct 2022 01:08:30 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7UGnuBPnWXFQCUd19vdZSJmrud6q++jA2RezgPETGFxMruj9aCmFgKiOnOyG0V94OVwShP X-Received: by 2002:a17:90a:2fc7:b0:212:e22a:5ba9 with SMTP id n7-20020a17090a2fc700b00212e22a5ba9mr2644022pjm.70.1666426110121; Sat, 22 Oct 2022 01:08:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666426110; cv=none; d=google.com; s=arc-20160816; b=H50drzufqWj3IwjPaRstXXbEX9IuOd/8FagwSWkqWsGC8O+K9f38HSpnCiD+vZK6Ap 1dOIir4/iVWfcYU+mpP7fH88pzbFIOxFqwCCVH/e6ffkF/t9IYHvg8y/IJ5iBdH1H3pg dEXZ1cAU84tHkoq8LMp4zaeY9P+bDfhp4Mjp/y+C/WrG3VB/ma3wtnWEC5HYU8htDUkE O4DKSJA6R4i82i7wP0UvWxig0G44QjKQTxvoiyVZ4y9VCa3ynjYNUg+RIvjG0Ao1uLlS 1XEEcBXOPZNZmBDwRly7E5cqOwFsQS+Xda4F6aVNDkVMrGtyGOmI8HDCRW6JbeFtvlzA ln4A== 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=dqrjGNoiwbfuYnKGCG7SEaWhL6f65uXbyh6QMdoMhcM=; b=VdFmX+yUpU5YUPiAOmsjn+5SzrjkpGJyd+5tv2uyKUcsTB79Sc0D0WZAty1WDfEBjq k2PQ16uLTBifWDwkoNqrD95InUCjwMu0duDT70CZUdZbQU7C0SxLb2oQUMV+h2lVNPs5 jzLbdIZvIm5bfZwFzt0YZKXot4cZVxy38N4bk4VgIlxAt6QBBG3iX5QkPToktQRB8mtA rUAb5JqkilUfbdZ2JFPphCVEJSFyy+BwxDvbiPA3pY4Ugrlt9rvZUIwfaEk77pZUFS00 bLdSXfCLnY8ToOcK06sotGrlJOAhNF/XH5QJPETSVcGTHK5fmkFSTU0blHsbqrHYp4tK d2oQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="DQPlK/dA"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 y11-20020a056a001c8b00b00562c5e2a99bsi22010904pfw.163.2022.10.22.01.08.17; Sat, 22 Oct 2022 01:08: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="DQPlK/dA"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S233009AbiJVIH5 (ORCPT + 99 others); Sat, 22 Oct 2022 04:07:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39922 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232789AbiJVIEM (ORCPT ); Sat, 22 Oct 2022 04:04:12 -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 A901B2C172D; Sat, 22 Oct 2022 00:51: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 D26C2B82E10; Sat, 22 Oct 2022 07:41:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2D52AC433C1; Sat, 22 Oct 2022 07:41:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424482; bh=R13yed14VpFlurbv9KTJhuYBznnXpn9hlLiQROjkOXo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DQPlK/dAOYnk/wNXbNp3LCJd+dnr1qzQL938GR6GSV8WZpFH+yRFELnhSzRMzK9Ae 6YI+EycKnkAkBHyHwW3QWCAkXUUDv5Zs9uwUAjixEQUt6qZiJjTncQo6HcjX1uQ+gw dRVJQ6pMEjj+wkIPWSTar8C0/MxDy0ShJQlq/vag= 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 5.19 161/717] KVM: nVMX: Unconditionally purge queued/injected events on nested "exit" Date: Sat, 22 Oct 2022 09:20:40 +0200 Message-Id: <20221022072443.957543312@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747374425093900129?= X-GMAIL-MSGID: =?utf-8?q?1747374425093900129?= 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/nested.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) --- a/arch/x86/kvm/vmx/nested.c +++ b/arch/x86/kvm/vmx/nested.c @@ -4264,14 +4264,6 @@ static void prepare_vmcs12(struct kvm_vc nested_vmx_abort(vcpu, VMX_ABORT_SAVE_GUEST_MSR_FAIL); } - - /* - * 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); } /* @@ -4611,6 +4603,17 @@ void nested_vmx_vmexit(struct kvm_vcpu * WARN_ON_ONCE(nested_early_check); } + /* + * 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); /* Update any VMCS fields that might have changed while L2 ran */ From patchwork Sat Oct 22 07:20: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: 7424 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1097749wrr; Sat, 22 Oct 2022 01:08:36 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6a7kPjs5EthPuDC+EOXmp1pMpNaM3u4QLlskvN5esxx1SsF78SztzSIXuQsHQygL2ae5rK X-Received: by 2002:a05:6a00:4192:b0:563:5e95:1db3 with SMTP id ca18-20020a056a00419200b005635e951db3mr23507613pfb.14.1666426116524; Sat, 22 Oct 2022 01:08:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666426116; cv=none; d=google.com; s=arc-20160816; b=ezFvJSSaoPnVLQI4EpV+h3Xqb8NN0ajCh0wKW1RjYNeojGpfusFkKB+U8vOywySzb8 HPJtabhthx/pDuCY/SewyG8XhMrESk8G3Brn3VIlbTjeCIN5mfqhX5Dp3AJlSovFt2ar F+0llpbX1X59gykosc7Uvrmh9COq+pW7r7/OdVXWsjsTNwAM+lZlcOUOMjOE45ZOZ7rI ctucdjqd3uXcWR5ji5T/WHDKt0ewwR6WMwsvgpySl/GPOS/HYjtFehO5uKHBN3/sa9fm rTjTZCsY4xoz1y39p6+AbffeXrrmqfsRCWe/jIiq4355EdN1RpMOVt5dIPJkiTTua4jJ 9mtw== 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=nbdpIwOTd+3hQC/ZXLxoAWUZeeIQV3xkMoJmIPj9VKI=; b=Dy07r3keCOIAmQETjGNZwe8rDRoZLpGI1n2GmQnh9BzPiKReU+9RzEb12FgGFAnVm0 Q6payWHnOC7IauOLqa2WGAb7WRyMwr7FUo3+aubn5UHHQ2TBJOZnMu9MiacQQQt/MZbo r032dEr489KAq+sPN6oWpHWGMydoccQmrQ23N/2BYNGgyX3EkFkURbddPRxiGSQ4SIaf 8Ll+C5gYaMuzfXLQJ7+g/53g9tqIE7ZnfgektuhMnY/1q0DiwVvhlc3FD7u1QC0tH0oJ RO+82qwkw7G6L0tneiWCj8A/QOYbpybDwPNlHhj9ajYzv3z/+rptD+TisF0yLENKw4Mm 99Xg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="gZ/uv0kV"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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-20020a17090302c900b0017f5ea214a8si27835044plk.462.2022.10.22.01.08.23; Sat, 22 Oct 2022 01:08: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="gZ/uv0kV"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S233025AbiJVIIF (ORCPT + 99 others); Sat, 22 Oct 2022 04:08:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57152 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232837AbiJVIER (ORCPT ); Sat, 22 Oct 2022 04:04:17 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2D78B213469; Sat, 22 Oct 2022 00:51: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 C4F3DB82E16; Sat, 22 Oct 2022 07:43:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1F28EC433D6; Sat, 22 Oct 2022 07:43:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424589; bh=tGmVrJk+gjBfAMLrT91eA5xLi5kGZV2ZSL7JKmMaxAg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gZ/uv0kVi7gsXW1/JrN435rVSiNJXot6FQptbe2iJX80Vgj9oZMUJn4fgqlo2Hptr +aruEZpLVO5uOm0fi7a0sQ+GN8J+Y7XdIG7RidS3fiqyRfAtqGc4BVrmP/1DNnFv72 3lCVwdxJPgDFxk5aiProtcOL5GOcWM4/u3bLHUac= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sean Christopherson , Vitaly Kuznetsov , Paolo Bonzini Subject: [PATCH 5.19 162/717] KVM: nVMX: Dont propagate vmcs12s PERF_GLOBAL_CTRL settings to vmcs02 Date: Sat, 22 Oct 2022 09:20:41 +0200 Message-Id: <20221022072444.133355302@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747374431283598197?= X-GMAIL-MSGID: =?utf-8?q?1747374431283598197?= From: Sean Christopherson commit def9d705c05eab3fdedeb10ad67907513b12038e upstream. Don't propagate vmcs12's VM_ENTRY_LOAD_IA32_PERF_GLOBAL_CTRL to vmcs02. KVM doesn't disallow L1 from using VM_ENTRY_LOAD_IA32_PERF_GLOBAL_CTRL even when KVM itself doesn't use the control, e.g. due to the various CPU errata that where the MSR can be corrupted on VM-Exit. Preserve KVM's (vmcs01) setting to hopefully avoid having to toggle the bit in vmcs02 at a later point. E.g. if KVM is loading PERF_GLOBAL_CTRL when running L1, then odds are good KVM will also load the MSR when running L2. Fixes: 8bf00a529967 ("KVM: VMX: add support for switching of PERF_GLOBAL_CTRL") Cc: stable@vger.kernel.org Signed-off-by: Sean Christopherson Signed-off-by: Vitaly Kuznetsov Link: https://lore.kernel.org/r/20220830133737.1539624-18-vkuznets@redhat.com Signed-off-by: Paolo Bonzini Signed-off-by: Greg Kroah-Hartman --- arch/x86/kvm/vmx/nested.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) --- a/arch/x86/kvm/vmx/nested.c +++ b/arch/x86/kvm/vmx/nested.c @@ -2322,9 +2322,14 @@ static void prepare_vmcs02_early(struct * are emulated by vmx_set_efer() in prepare_vmcs02(), but speculate * on the related bits (if supported by the CPU) in the hope that * we can avoid VMWrites during vmx_set_efer(). + * + * Similarly, take vmcs01's PERF_GLOBAL_CTRL in the hope that if KVM is + * loading PERF_GLOBAL_CTRL via the VMCS for L1, then KVM will want to + * do the same for L2. */ exec_control = __vm_entry_controls_get(vmcs01); - exec_control |= vmcs12->vm_entry_controls; + exec_control |= (vmcs12->vm_entry_controls & + ~VM_ENTRY_LOAD_IA32_PERF_GLOBAL_CTRL); exec_control &= ~(VM_ENTRY_IA32E_MODE | VM_ENTRY_LOAD_IA32_EFER); if (cpu_has_load_ia32_efer()) { if (guest_efer & EFER_LMA) From patchwork Sat Oct 22 07:20: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: 7257 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1091599wrr; Sat, 22 Oct 2022 00:51:14 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7t+mYPlZf0U9omvaST8g8DqVTmufndxgyv+vlSS32dRxLdT+IymqFBXm634EVb2ZwyGTq+ X-Received: by 2002:a05:6a00:1349:b0:563:654d:ce3f with SMTP id k9-20020a056a00134900b00563654dce3fmr23449832pfu.32.1666425074292; Sat, 22 Oct 2022 00:51:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666425074; cv=none; d=google.com; s=arc-20160816; b=VaWAJNuIwbEY1CzFOfpjyqg8kvI8bdGTVCTbq7mWNbwShYxlSBxljSFOJthi2O7RqG c/EffSE+rXK0Tu5DGilC0L8EKzXh8v1Zybw1zze8BuGimjouqpz70VugEg0rUdDVTB/d SMujkRbnqZEMow05JeTf6wCm1YoeDJyJ90BFrkKbsZJ88CXvp4FVTnp66Ayvh9nw9r/x Ro6skkC3qSHHZLeVNQ8GKmPF/hTkjvRJ9u0xwLITnaaz17f+xK3CG9J18vvMn8PaEp2Q f++3UyXhoIDMv8HKghfqPmbz6TUZilMp9Aj5GA9zi0TXX6b0vJguPX59iL9jUAOiMcIf C7Ag== 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=FAGnRwHG0pysocHU3NR6q1lqf1Nu6WgLzrgc1rKE49Y=; b=Y8oVeUVQH61ASRW+0qGqkbdmO550tZRYSNpHLp2vkkTQ2/sxOa9BKcZqzkqB7/OR9g za5oAP4SqJNJckuzLSyCmDCGesCjeUqiyMC6pw9lbCcG68LcQES6uuQUKC013QByDT7y oCaLIuy/hDfY0pBtgUb+sGkqQDo34WHVSmL+TfVgd7tzLbiubtnU05tM19rSkIUhmZkr W8oulfbA14UxdGQIihetlfO9VKFWna9wsZ54V1GsZp3aUAm5Uj4g/wi5/Zc71qrjdwmx xHL23dDQy6vLw5VXtBI+cs/r08zxAK2qZ+9Solu5iBZeZdNt47rFmNt59JVNdOpXyuLB euXw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=TSCZeDdy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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-20020a63ff61000000b0042be0a584cfsi3482690pgk.698.2022.10.22.00.51.01; Sat, 22 Oct 2022 00:51: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=TSCZeDdy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231696AbiJVHu0 (ORCPT + 99 others); Sat, 22 Oct 2022 03:50:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35550 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231654AbiJVHs4 (ORCPT ); Sat, 22 Oct 2022 03:48:56 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F37021D8F00; Sat, 22 Oct 2022 00:45: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 4135860B89; Sat, 22 Oct 2022 07:41:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 52D61C433C1; Sat, 22 Oct 2022 07:41:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424503; bh=8OPJ/E2siWg3Jv6ZeX2QBTMFA8a9q7dFLzoDaRqiBWo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TSCZeDdyCxKvSdRt/BqubYuCIeLsB+Y91R8GluW/oTrt6IomGexr2RhfhA8+yVz9f uF/UFdLypNk+YbQ71s7S9eA1fL4HOUiYzrstDjQ+8+gzv28otNGfObhVGi1sJPI1ps aO0OZJ9MX390ssly80KZYiAi+b9QD2JOpW3fiXG0= 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 5.19 163/717] KVM: VMX: Drop bits 31:16 when shoving exception error code into VMCS Date: Sat, 22 Oct 2022 09:20:42 +0200 Message-Id: <20221022072444.312351160@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747373338951448192?= X-GMAIL-MSGID: =?utf-8?q?1747373338951448192?= From: Sean Christopherson commit eba9799b5a6efe2993cf92529608e4aa8163d73b upstream. Deliberately truncate the exception error code when shoving it into the VMCS (VM-Entry field for vmcs01 and vmcs02, VM-Exit field for vmcs12). Intel CPUs are incapable of handling 32-bit error codes and will never generate an error code with bits 31:16, but userspace can provide an arbitrary error code via KVM_SET_VCPU_EVENTS. Failure to drop the bits on exception injection results in failed VM-Entry, as VMX disallows setting bits 31:16. Setting the bits on VM-Exit would at best confuse L1, and at worse induce a nested VM-Entry failure, e.g. if L1 decided to reinject the exception back into L2. 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-3-seanjc@google.com Signed-off-by: Paolo Bonzini Signed-off-by: Greg Kroah-Hartman --- arch/x86/kvm/vmx/nested.c | 11 ++++++++++- arch/x86/kvm/vmx/vmx.c | 12 +++++++++++- 2 files changed, 21 insertions(+), 2 deletions(-) --- a/arch/x86/kvm/vmx/nested.c +++ b/arch/x86/kvm/vmx/nested.c @@ -3839,7 +3839,16 @@ static void nested_vmx_inject_exception_ u32 intr_info = nr | INTR_INFO_VALID_MASK; if (vcpu->arch.exception.has_error_code) { - vmcs12->vm_exit_intr_error_code = vcpu->arch.exception.error_code; + /* + * Intel CPUs do not generate error codes with bits 31:16 set, + * and more importantly VMX disallows setting bits 31:16 in the + * injected error code for VM-Entry. Drop the bits to mimic + * hardware and avoid inducing failure on nested VM-Entry if L1 + * chooses to inject the exception back to L2. AMD CPUs _do_ + * generate "full" 32-bit error codes, so KVM allows userspace + * to inject exception error codes with bits 31:16 set. + */ + vmcs12->vm_exit_intr_error_code = (u16)vcpu->arch.exception.error_code; intr_info |= INTR_INFO_DELIVER_CODE_MASK; } --- a/arch/x86/kvm/vmx/vmx.c +++ b/arch/x86/kvm/vmx/vmx.c @@ -1687,7 +1687,17 @@ static void vmx_queue_exception(struct k kvm_deliver_exception_payload(vcpu); if (has_error_code) { - vmcs_write32(VM_ENTRY_EXCEPTION_ERROR_CODE, error_code); + /* + * Despite the error code being architecturally defined as 32 + * bits, and the VMCS field being 32 bits, Intel CPUs and thus + * VMX don't actually supporting setting bits 31:16. Hardware + * will (should) never provide a bogus error code, but AMD CPUs + * do generate error codes with bits 31:16 set, and so KVM's + * ABI lets userspace shove in arbitrary 32-bit values. Drop + * the upper bits to avoid VM-Fail, losing information that + * does't really exist is preferable to killing the VM. + */ + vmcs_write32(VM_ENTRY_EXCEPTION_ERROR_CODE, (u16)error_code); intr_info |= INTR_INFO_DELIVER_CODE_MASK; } From patchwork Sat Oct 22 07:20: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: 7550 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1105906wrr; Sat, 22 Oct 2022 01:36:29 -0700 (PDT) X-Google-Smtp-Source: AMsMyM43LWj4qIXbZR3LwScSlJclSLJejAHyWPOKAZyCcv2vR4l92EQPHquNt3NUMUHerd0Nfjhf X-Received: by 2002:a17:902:8a88:b0:17f:8642:7c9a with SMTP id p8-20020a1709028a8800b0017f86427c9amr23962669plo.13.1666427788970; Sat, 22 Oct 2022 01:36:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666427788; cv=none; d=google.com; s=arc-20160816; b=pKQpjXTgtM0m8lpnOd/mdXadqKidBdPnKuZkC3tzp4CXF5aYYdFjuupD3/Ib3jeJ8h lphBWCDYrffSi0swfDjFwS5qRMIFZWXXyatG0IY4eAqw1sO5wgyLoBOpUY76rBBZYOFV N1BTuvAh2A28Nj9yMm4RW3zu93ezeO01AfMhuaQuS+egk+kFxfVZkRWEYKcPQrzyM+k2 82+gPM3ftZ5y2dMdD3Dnia8oBFcCflSu5W5E/4iaTPLMaXg7/H7eyr2CUtgjmLh6pxiY Vb7m30RzjQlfBQS9qnIHocXqHTB+jFeucDgC5qysU+oEoeWQiQTgHCzXh4d78Fgk8Rwb JcQw== 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=K/uOf0SUzijjEeSOOrVTXr5R6N7cfa3tA6My4fiILe0=; b=U/f9KYrQ+DMWS4X23mMQtSYvbVR5lIn4pA3ZZWQrsSR8kiN6zmB+hA5PhSY8g903WY ciD7UApDZLtiMj5Ur6bRRJYNT0i645K23BuAXs0JEM3Vn4barMWeN7xuS+1mUxwOJiWj loj6yD9dL3PoqTQEOrvN0TxsZ1iitwvnP0IXDbVxyMHegDdprtsW6Kym7E+Jq78vH2hg AH6miSVbpLaKThHpf5N3MY90084p0J4bNe+LHxpGAMxMqp3jICTqSFkFnjmLn+DfsHLS CAcqu/1AoWeQHkfLDjRDn04PUSV+0wmzAqeOr5oxMUuBwJqU4UuSRviaIfvQLkaS2C2O oBpw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=LEXdAFJa; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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-20020a170902ba8300b00176e4ac448esi9162418pls.224.2022.10.22.01.36.13; Sat, 22 Oct 2022 01:36: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=LEXdAFJa; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S233530AbiJVIUM (ORCPT + 99 others); Sat, 22 Oct 2022 04:20:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35142 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233630AbiJVIS7 (ORCPT ); Sat, 22 Oct 2022 04:18: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 532962CCA2E; Sat, 22 Oct 2022 00:57: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 70F67B82E0F; Sat, 22 Oct 2022 07:42:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 95192C433C1; Sat, 22 Oct 2022 07:42:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424533; bh=yMjsvMrwdteaqkm298N96x25owWkPZMp9jiYpvA0zcQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LEXdAFJaoxPt/KzXnu989Z4E/Kr6g5yXLuSeG3FzRP/AbobYKlcrYvEbhPbN3ulJH uUphkDxofe8yxpuBcOcm6IqGBizr0xsbKJCkBVjhAyEnD4yrr/k2Tx5erizOE79Sqx 9HKFyvTf8RuCk/dbuFdTkB6Dxdznb+smsARu1osA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Johan Hovold , Alex Elder , stable Subject: [PATCH 5.19 164/717] staging: greybus: audio_helper: remove unused and wrong debugfs usage Date: Sat, 22 Oct 2022 09:20:43 +0200 Message-Id: <20221022072444.515361630@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376185310325937?= X-GMAIL-MSGID: =?utf-8?q?1747376185310325937?= From: Greg Kroah-Hartman commit d517cdeb904ddc0cbebcc959d43596426cac40b0 upstream. In the greybus audio_helper code, the debugfs file for the dapm has the potential to be removed and memory will be leaked. There is also the very real potential for this code to remove ALL debugfs entries from the system, and it seems like this is what will really happen if this code ever runs. This all is very wrong as the greybus audio driver did not create this debugfs file, the sound core did and controls the lifespan of it. So remove all of the debugfs logic from the audio_helper code as there's no way it could be correct. If this really is needed, it can come back with a fixup for the incorrect usage of the debugfs_lookup() call which is what caused this to be noticed at all. Cc: Johan Hovold Cc: Alex Elder Cc: Greg Kroah-Hartman Cc: stable Link: https://lore.kernel.org/r/20220902143715.320500-1-gregkh@linuxfoundation.org Signed-off-by: Greg Kroah-Hartman --- drivers/staging/greybus/audio_helper.c | 11 ----------- 1 file changed, 11 deletions(-) --- a/drivers/staging/greybus/audio_helper.c +++ b/drivers/staging/greybus/audio_helper.c @@ -3,7 +3,6 @@ * Greybus Audio Sound SoC helper APIs */ -#include #include #include #include @@ -116,10 +115,6 @@ int gbaudio_dapm_free_controls(struct sn { int i; struct snd_soc_dapm_widget *w, *next_w; -#ifdef CONFIG_DEBUG_FS - struct dentry *parent = dapm->debugfs_dapm; - struct dentry *debugfs_w = NULL; -#endif mutex_lock(&dapm->card->dapm_mutex); for (i = 0; i < num; i++) { @@ -139,12 +134,6 @@ int gbaudio_dapm_free_controls(struct sn continue; } widget++; -#ifdef CONFIG_DEBUG_FS - if (!parent) - debugfs_w = debugfs_lookup(w->name, parent); - debugfs_remove(debugfs_w); - debugfs_w = NULL; -#endif gbaudio_dapm_free_widget(w); } mutex_unlock(&dapm->card->dapm_mutex); From patchwork Sat Oct 22 07:20: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: 7243 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1091267wrr; Sat, 22 Oct 2022 00:50:01 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5C9IEfVv/Fkh2YB71PynEJpEo8BLOHLqSiA5DrKVUtTGL2luEWWaQT/C+CJionExSa4KT1 X-Received: by 2002:a17:903:32ce:b0:17f:75dd:de88 with SMTP id i14-20020a17090332ce00b0017f75ddde88mr23196616plr.5.1666425001478; Sat, 22 Oct 2022 00:50:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666425001; cv=none; d=google.com; s=arc-20160816; b=KrgmWjQvacEjmi+zl9clm1zvVqSsEJPrFrEbbwnePkZVksdvh4t+TGyWWHKBZLey3K A9gFw24HUTw+uyvEi7xcozAYmrwEZkmbqEfYNwO1x9GC/Z96PadBaJ8WubOvvcZ3PF7H dgyeSlzHqLiCafoa/5PglDrh1z3ZLa7Cupf1FkPi9Zzp70buZCSpuTmaDuhDZMriC28R 2zYiR+988yXv22KJGS0KYvg/rqYA5V+IEtu1XH7ySzJICycgkZB8lgeX4fynpBtn1Dlx FL+P/mdEBFZkHOpdP4iVreHQFJx4LY7B9y7rmgBJgjAKd3ebh7JxgRuBgrZE68aiKUlQ 3rvw== 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=ZvTI9bvNoKHsyFgiuzWKp14KnT6xFE5GhdT5g4Pt3Lk=; b=KOxOj4+Ws7CFJy0LOMshsfGgjJfNq+jGppl6ovYG7FATvYbKfZE4bwxxPvvW9YBA1L +yAQM03jKXOBCGvsjy0+UHM0TTKbt3C1uFX+Uxl42QgoE2gziAlXYglirVNRt8F0yJMP E6sG0mPm2DpQApSpIE2K/6QOSPRqrIrY5GfQOs8M94A+M+HAZdwTeHK1rYsnq4/iKDhg 8VOKBZ56fwFZaxb5bFpt4pcFqtRINLo3J1AuB19TJCX6MzfZJeehwE/OpN+3rtaVrgaj ls8bS8cvctqVinq8du9xMddXh7TNVuS2Wex/71TfNM22k4JsK44Jzae2HXAv3496qNFX eWDw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ZVnPlWlZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 c4-20020a17090a8d0400b0020038eb8b5asi8627203pjo.21.2022.10.22.00.49.48; Sat, 22 Oct 2022 00:50: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=ZVnPlWlZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231693AbiJVHtA (ORCPT + 99 others); Sat, 22 Oct 2022 03:49:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34360 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231415AbiJVHsO (ORCPT ); Sat, 22 Oct 2022 03:48:14 -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 0F436844D3; Sat, 22 Oct 2022 00:45: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 41FA4B82E17; Sat, 22 Oct 2022 07:42:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AF4B7C43144; Sat, 22 Oct 2022 07:42:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424563; bh=hkN++V+EZziRXwAqDFEpFocfj0LhpT6OEj3yMchgpAk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZVnPlWlZJC1VhSe9LrNFVAsfNDn82o+8H63b2IqCNk2ZAUtNeAoAKMMEnCFy9EXn8 cpFY6sKymhV4iP6cAv76AeLZHk2U8DISLfW4+xiI0glTCxbGM5f5Yw3df7/uLUMNag EFgyQPoVTo3G/5Qu4lDOo4XSiB3W6d8fzcrvT72Q= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Lyude Paul , Karol Herbst Subject: [PATCH 5.19 165/717] drm/nouveau/kms/nv140-: Disable interlacing Date: Sat, 22 Oct 2022 09:20:44 +0200 Message-Id: <20221022072444.681003556@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747373262137879078?= X-GMAIL-MSGID: =?utf-8?q?1747373262137879078?= From: Lyude Paul commit 8ba9249396bef37cb68be9e8dee7847f1737db9d upstream. As it turns out: while Nvidia does actually have interlacing knobs on their GPU still pretty much no current GPUs since Volta actually support it. Trying interlacing on these GPUs will result in NVDisplay being quite unhappy like so: nouveau 0000:1f:00.0: disp: chid 0 stat 00004802 reason 4 [INVALID_ARG] mthd 2008 data 00000001 code 00080000 nouveau 0000:1f:00.0: disp: chid 0 stat 10005080 reason 5 [INVALID_STATE] mthd 0200 data 00000001 code 00000001 So let's fix this by following the same behavior Nvidia's driver does and disable interlacing entirely. Signed-off-by: Lyude Paul Cc: stable@vger.kernel.org Reviewed-by: Karol Herbst Link: https://patchwork.freedesktop.org/patch/msgid/20220816180436.156310-1-lyude@redhat.com Signed-off-by: Greg Kroah-Hartman --- drivers/gpu/drm/nouveau/nouveau_connector.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/drivers/gpu/drm/nouveau/nouveau_connector.c +++ b/drivers/gpu/drm/nouveau/nouveau_connector.c @@ -503,7 +503,8 @@ nouveau_connector_set_encoder(struct drm connector->interlace_allowed = nv_encoder->caps.dp_interlace; else - connector->interlace_allowed = true; + connector->interlace_allowed = + drm->client.device.info.family < NV_DEVICE_INFO_V0_VOLTA; connector->doublescan_allowed = true; } else if (nv_encoder->dcb->type == DCB_OUTPUT_LVDS || From patchwork Sat Oct 22 07:20: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: 7275 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1092045wrr; Sat, 22 Oct 2022 00:52:48 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5+Qd74VHWazE/zrCnwN3wWN+O0BV327m7EXLTQoc8YqBh3C4ZnegVv1/Fe+GnctbOWDVv6 X-Received: by 2002:a17:90a:540e:b0:210:1e26:9422 with SMTP id z14-20020a17090a540e00b002101e269422mr18264591pjh.100.1666425167925; Sat, 22 Oct 2022 00:52:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666425167; cv=none; d=google.com; s=arc-20160816; b=0UwnXJGz7ZjhOqVebXC1dm4uJJkanZCMKSvUJtwCFXwiJLBufSsE9HBsQEM4Hvb96O AubxVIb1TZf+OuwkdYcyDitRhnCd5C4XlN5bMQp4IVbOn/7nftdWf7COjQkCnCp94Aws vwQ/+YyzTUrlTTK8nZ3FiMWt5vzBQXc9q91OmMJzWAGvLVP5F11zIdjXjbkvVLI/hA4f VL813duPx7CS8ygdBjt3hDcJenZPg/gPLa5gRyH/zuyWZho/HOsQ7GiQ5SaJaZeOFFDv Ryeahxc4WMjrfIi8OJDZsgYEsL6FfWuPyDu/uiuTtWUzJElWmVTksBVee+S3dS1bD7nE aBGg== 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=ywnzyajHVH5P4coVgM62eanHHKFBJKO0DVFgQNg3oTM=; b=J0y0DLj8PT3VMm3PyVNwHFX4myayZqemRFTwLazEJVWKBL6VtbjHIoR1w08KzAp/lP x1TpVKrx5Pvr+1n2bOMXqbKz9Rl6HVzji7VTUSVXp0w/PoB6A/NvTQqd7i9qq2+0I70S pePoccjUbYtkJXZpLprVz4UUcKOLUe8ayXTHbRGa2T2+oKTu6Rkzb90WH7y3pcTc7AoK ettLiuquHg1rWbR8YXDH9+hd38ecTwnHzT9qo56XS1Ey8HippAYFhP9NAF36rQtmKJ1y 7wouwFbt6fXErgCsMC/m9wdWTXwJrSf6JhpjCAzol4kMfDVDztGCwu706QFW27TihGJd EtpQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=dOz2zUuV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 8-20020a630408000000b0043090081d69si5064694pge.82.2022.10.22.00.52.35; Sat, 22 Oct 2022 00:52: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=dOz2zUuV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231732AbiJVHwQ (ORCPT + 99 others); Sat, 22 Oct 2022 03:52:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55036 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231897AbiJVHtf (ORCPT ); Sat, 22 Oct 2022 03:49:35 -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 650672ACBE1; Sat, 22 Oct 2022 00:46: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 6655360B95; Sat, 22 Oct 2022 07:42:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 79CCAC433C1; Sat, 22 Oct 2022 07:42:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424573; bh=KqCEdkhPcHZPtHS5XUueyb73weNWSVVYIaiahVplhzQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dOz2zUuVoAHgieaTu9lB28yF3OskU6GqEKbgU+VE39OXN54ffSzVRRzx1c88BjrDb e7hbFrmeS9nN97ZePN7nw12ogHJbrhWg2QPj9/wW7W3Ib6ur6Of8hlz5pz44jq0XxV CmpsSYxZXh3hZoQb/8F88cm0SdzhxdVNYsUk6ERQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jianglei Nie , Lyude Paul , Thierry Reding Subject: [PATCH 5.19 166/717] drm/nouveau: fix a use-after-free in nouveau_gem_prime_import_sg_table() Date: Sat, 22 Oct 2022 09:20:45 +0200 Message-Id: <20221022072444.854325770@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747373437141628541?= X-GMAIL-MSGID: =?utf-8?q?1747373437141628541?= From: Jianglei Nie commit 540dfd188ea2940582841c1c220bd035a7db0e51 upstream. nouveau_bo_init() is backed by ttm_bo_init() and ferries its return code back to the caller. On failures, ttm will call nouveau_bo_del_ttm() and free the memory.Thus, when nouveau_bo_init() returns an error, the gem object has already been released. Then the call to nouveau_bo_ref() will use the freed "nvbo->bo" and lead to a use-after-free bug. We should delete the call to nouveau_bo_ref() to avoid the use-after-free. Signed-off-by: Jianglei Nie Reviewed-by: Lyude Paul Signed-off-by: Lyude Paul Fixes: 019cbd4a4feb ("drm/nouveau: Initialize GEM object before TTM object") Cc: Thierry Reding Cc: # v5.4+ Link: https://patchwork.freedesktop.org/patch/msgid/20220705132546.2247677-1-niejianglei2021@163.com Signed-off-by: Greg Kroah-Hartman --- drivers/gpu/drm/nouveau/nouveau_prime.c | 1 - 1 file changed, 1 deletion(-) --- a/drivers/gpu/drm/nouveau/nouveau_prime.c +++ b/drivers/gpu/drm/nouveau/nouveau_prime.c @@ -71,7 +71,6 @@ struct drm_gem_object *nouveau_gem_prime ret = nouveau_bo_init(nvbo, size, align, NOUVEAU_GEM_DOMAIN_GART, sg, robj); if (ret) { - nouveau_bo_ref(NULL, &nvbo); obj = ERR_PTR(ret); goto unlock; } From patchwork Sat Oct 22 07:20:46 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 7232 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1090665wrr; Sat, 22 Oct 2022 00:48:01 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6EjMsAcWB4yOB1litYNZ5+fNJx7xPLTpUZGPAjDIXNUO884zOtS7ZyHvdHdXDLfgpzerR0 X-Received: by 2002:a17:902:8a97:b0:178:1939:c721 with SMTP id p23-20020a1709028a9700b001781939c721mr23442169plo.108.1666424881225; Sat, 22 Oct 2022 00:48:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666424881; cv=none; d=google.com; s=arc-20160816; b=BcPxTIR3N51p4XIrGfMFA/eQl5HcT5EfBaHK5EPItb1HLlJXp+0uE3i9yiVWrma6rc lkssm47qZ8bWj4c2ep1vk6hFtndpprPt2rKAYoApM7jFQxDbIZv1sQ3MiOAG7Qys22Fr 9t7zqHtjfkgOTjCWMcZWLhCK5v/9fz87MelUKC/MdHoLfYz0kYvHHfOkg2zMW0y2kMeC 68u1+V/8fzgvpWfMLScFwGtSHmDOTyDjhXpTyLsHJXMyQxN8rd/15wAJhIYw5ttBg7TJ Jk2tvj1iEl4J1cZZJEj2k7GpaIO41ZPo2m39U+K6aQDJxUIv4+xjf3pWWQJcvD1U4nGd qAjA== 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=YQU4/J89nvx8QNpX2gM38jVsZiNr5+cXX9/Xqo2Q49c=; b=fOgsddedsOGHvFKxt8ynhAM7RTeE6PioRpx8tCEQsd3zMkPxOVGC5L8sTy80clkLlP /RK//s3ws7Hl2oKE8fg2UEx1vCv4OeDiQl84osD8IKGA8MFO32KSt8PZTw1btQTOGP7B uq5ZK953IcEpXt+GctUbH3YqZEEe2OlzgbqyqwO3D/lAEBlk5kCGiZyrOwIiKUzB25kd dJeWxmAkCNNzSdIWDkUFEBNxTTQMulWvGSqEfOHQsPTK6YZrytCtRharpy7NQhd5wflv 26oWSU/gDIvy2OWih3R6Rp6yFWSx9OBKVog7Z9fmCyu8hZcpXF4iVWzaN61sHlRxuyWW 4jhg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=KY69y8oq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 1-20020a631241000000b00434df5a8524si29716772pgs.396.2022.10.22.00.47.48; Sat, 22 Oct 2022 00:48: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=KY69y8oq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S230488AbiJVHrZ (ORCPT + 99 others); Sat, 22 Oct 2022 03:47:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34302 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230245AbiJVHpz (ORCPT ); Sat, 22 Oct 2022 03:45: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 80387CABC2; Sat, 22 Oct 2022 00:43: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 C1760B82E1B; Sat, 22 Oct 2022 07:42:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1D78DC433C1; Sat, 22 Oct 2022 07:42:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424576; bh=Z5u/4kskGVbcyMVpAm9IC/je4fIBuE6fauWq6ihOXDY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KY69y8oqXuGaJ4uVoqc4M9FABU+NR5hqu9+Dp2Pt7XBtSQ4DqAHwx6JbB7mtdxaf/ ulxde7aXOVHFQZsVDuxvL9DTnvVcl2/rlFsHZ7fQ8h6XhCu03HIFdqmDWGrPBXG50E f2j25VITooTxGi7Z59feMlXHgVYinukRX43qybv4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Chris Wilson , =?utf-8?q?Thomas_Hellstr=C3=B6m?= , Matthew Auld , Tvrtko Ursulin Subject: [PATCH 5.19 167/717] drm/i915/gt: Use i915_vm_put on ppgtt_create error paths Date: Sat, 22 Oct 2022 09:20:46 +0200 Message-Id: <20221022072445.054445928@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747373136394428244?= X-GMAIL-MSGID: =?utf-8?q?1747373136394428244?= From: Chris Wilson commit 20e377e7b2e7c327039f10db80ba5bcc1f6c882d upstream. Now that the scratch page and page directories have a reference back to the i915_address_space, we cannot do an immediate free of the ppgtt upon error as those buffer objects will perform a later i915_vm_put in their deferred frees. The downside is that by replacing the onion unwind along the error paths, the ppgtt cleanup must handle a partially constructed vm. This includes ensuring that the vm->cleanup is set prior to the error path. Closes: https://gitlab.freedesktop.org/drm/intel/-/issues/6900 Signed-off-by: Chris Wilson Fixes: 4d8151ae5329 ("drm/i915: Don't free shared locks while shared") Cc: Thomas Hellström Cc: Matthew Auld Cc: # v5.14+ Reviewed-by: Matthew Auld Signed-off-by: Matthew Auld Link: https://patchwork.freedesktop.org/patch/msgid/20220926153333.102195-1-matthew.auld@intel.com (cherry picked from commit c286558f58535cf97b717b946d6c96d774a09d17) Signed-off-by: Tvrtko Ursulin Signed-off-by: Greg Kroah-Hartman --- drivers/gpu/drm/i915/gt/gen6_ppgtt.c | 16 ++++----- drivers/gpu/drm/i915/gt/gen8_ppgtt.c | 58 ++++++++++++++++++----------------- drivers/gpu/drm/i915/gt/intel_gtt.c | 3 + 3 files changed, 41 insertions(+), 36 deletions(-) --- a/drivers/gpu/drm/i915/gt/gen6_ppgtt.c +++ b/drivers/gpu/drm/i915/gt/gen6_ppgtt.c @@ -247,6 +247,7 @@ err_scratch1: i915_gem_object_put(vm->scratch[1]); err_scratch0: i915_gem_object_put(vm->scratch[0]); + vm->scratch[0] = NULL; return ret; } @@ -268,9 +269,10 @@ static void gen6_ppgtt_cleanup(struct i9 gen6_ppgtt_free_pd(ppgtt); free_scratch(vm); - mutex_destroy(&ppgtt->flush); + if (ppgtt->base.pd) + free_pd(&ppgtt->base.vm, ppgtt->base.pd); - free_pd(&ppgtt->base.vm, ppgtt->base.pd); + mutex_destroy(&ppgtt->flush); } static void pd_vma_bind(struct i915_address_space *vm, @@ -449,19 +451,17 @@ struct i915_ppgtt *gen6_ppgtt_create(str err = gen6_ppgtt_init_scratch(ppgtt); if (err) - goto err_free; + goto err_put; ppgtt->base.pd = gen6_alloc_top_pd(ppgtt); if (IS_ERR(ppgtt->base.pd)) { err = PTR_ERR(ppgtt->base.pd); - goto err_scratch; + goto err_put; } return &ppgtt->base; -err_scratch: - free_scratch(&ppgtt->base.vm); -err_free: - kfree(ppgtt); +err_put: + i915_vm_put(&ppgtt->base.vm); return ERR_PTR(err); } --- a/drivers/gpu/drm/i915/gt/gen8_ppgtt.c +++ b/drivers/gpu/drm/i915/gt/gen8_ppgtt.c @@ -196,7 +196,10 @@ static void gen8_ppgtt_cleanup(struct i9 if (intel_vgpu_active(vm->i915)) gen8_ppgtt_notify_vgt(ppgtt, false); - __gen8_ppgtt_cleanup(vm, ppgtt->pd, gen8_pd_top_count(vm), vm->top); + if (ppgtt->pd) + __gen8_ppgtt_cleanup(vm, ppgtt->pd, + gen8_pd_top_count(vm), vm->top); + free_scratch(vm); } @@ -803,8 +806,10 @@ static int gen8_init_scratch(struct i915 struct drm_i915_gem_object *obj; obj = vm->alloc_pt_dma(vm, I915_GTT_PAGE_SIZE_4K); - if (IS_ERR(obj)) + if (IS_ERR(obj)) { + ret = PTR_ERR(obj); goto free_scratch; + } ret = map_pt_dma(vm, obj); if (ret) { @@ -823,7 +828,8 @@ static int gen8_init_scratch(struct i915 free_scratch: while (i--) i915_gem_object_put(vm->scratch[i]); - return -ENOMEM; + vm->scratch[0] = NULL; + return ret; } static int gen8_preallocate_top_level_pdp(struct i915_ppgtt *ppgtt) @@ -901,6 +907,7 @@ err_pd: struct i915_ppgtt *gen8_ppgtt_create(struct intel_gt *gt, unsigned long lmem_pt_obj_flags) { + struct i915_page_directory *pd; struct i915_ppgtt *ppgtt; int err; @@ -946,21 +953,7 @@ struct i915_ppgtt *gen8_ppgtt_create(str ppgtt->vm.alloc_scratch_dma = alloc_pt_dma; } - err = gen8_init_scratch(&ppgtt->vm); - if (err) - goto err_free; - - ppgtt->pd = gen8_alloc_top_pd(&ppgtt->vm); - if (IS_ERR(ppgtt->pd)) { - err = PTR_ERR(ppgtt->pd); - goto err_free_scratch; - } - - if (!i915_vm_is_4lvl(&ppgtt->vm)) { - err = gen8_preallocate_top_level_pdp(ppgtt); - if (err) - goto err_free_pd; - } + ppgtt->vm.pte_encode = gen8_pte_encode; ppgtt->vm.bind_async_flags = I915_VMA_LOCAL_BIND; ppgtt->vm.insert_entries = gen8_ppgtt_insert; @@ -971,22 +964,31 @@ struct i915_ppgtt *gen8_ppgtt_create(str ppgtt->vm.allocate_va_range = gen8_ppgtt_alloc; ppgtt->vm.clear_range = gen8_ppgtt_clear; ppgtt->vm.foreach = gen8_ppgtt_foreach; + ppgtt->vm.cleanup = gen8_ppgtt_cleanup; - ppgtt->vm.pte_encode = gen8_pte_encode; + err = gen8_init_scratch(&ppgtt->vm); + if (err) + goto err_put; + + pd = gen8_alloc_top_pd(&ppgtt->vm); + if (IS_ERR(pd)) { + err = PTR_ERR(pd); + goto err_put; + } + ppgtt->pd = pd; + + if (!i915_vm_is_4lvl(&ppgtt->vm)) { + err = gen8_preallocate_top_level_pdp(ppgtt); + if (err) + goto err_put; + } if (intel_vgpu_active(gt->i915)) gen8_ppgtt_notify_vgt(ppgtt, true); - ppgtt->vm.cleanup = gen8_ppgtt_cleanup; - return ppgtt; -err_free_pd: - __gen8_ppgtt_cleanup(&ppgtt->vm, ppgtt->pd, - gen8_pd_top_count(&ppgtt->vm), ppgtt->vm.top); -err_free_scratch: - free_scratch(&ppgtt->vm); -err_free: - kfree(ppgtt); +err_put: + i915_vm_put(&ppgtt->vm); return ERR_PTR(err); } --- a/drivers/gpu/drm/i915/gt/intel_gtt.c +++ b/drivers/gpu/drm/i915/gt/intel_gtt.c @@ -405,6 +405,9 @@ void free_scratch(struct i915_address_sp { int i; + if (!vm->scratch[0]) + return; + for (i = 0; i <= vm->top; i++) i915_gem_object_put(vm->scratch[i]); } From patchwork Sat Oct 22 07:20:47 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 7231 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1090656wrr; Sat, 22 Oct 2022 00:47:59 -0700 (PDT) X-Google-Smtp-Source: AMsMyM756cmjfj5X7S0HTAiKVuJmDkPMteyBn0j9BPuFkSX/uy8yuJAImuG5A3KSqL6FKY0tVFiC X-Received: by 2002:a17:902:e54b:b0:186:5fba:13a5 with SMTP id n11-20020a170902e54b00b001865fba13a5mr14096478plf.173.1666424878884; Sat, 22 Oct 2022 00:47:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666424878; cv=none; d=google.com; s=arc-20160816; b=ansLy4e/DaC43lzqf5Uq9mICR+0MNWdOhj2xJdqNJzkQMzhfOf0tOAZ/RK4W03ugB2 zdiLTI/15uBbbb84q5E33aE7p+pMBElQae+HBCSxhTaXT24zIm1yWNBPRbLO/OYLU33H B/ECTSLQZhlcud0Wbgi4Xar5VC9Yzaiv/M8jaP2YLdup1QuBGVh6/n2Q4JUS7gxI0R6q dCSFUC0rvQvMYQzoUq0LFa2cvluVfHWryi8Rsr8ghO4qNKzQ1Pg987RIT9vCw2DbpcHP LkivTpv5hcbe9eLHM4S5V6gQN0ikTtgnKIrDCmBF54aLKW6A4xysr+R+cnPClT0XEYHm De5w== 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=YoDlSgOYdnKkVbgtp9dY3J0vjArN/7g6Bs0IlRuLaow=; b=IYrHaVt+elsLBskAWbOEhGRyT+kPFSCHFnT/9qIqZoY2sKmi8VapjWsoUP6lC0q4c9 qySWdoDVvcGhRSOIu2fnKbm7uge5Ca3AFQwmX7gkqVe2Ce2oAJzkgBREwSHgz07v1PnG vGRk+iqosZfxRPrDOZSnhVmuEL7QS6k6aau1ck5jVfc/Tt1vLU/BQt3Pxc3CrzRqqiSF REu4xbNaSjzdQSy+oIhRS8bVwvKN91DlUSKO2SssUuJgJJQIdEBry6ted+PNpb+uVwT2 Zbh9KNtz7AE8KM/vcDcWF6G8MuRwFiXOiY6xV2ej07GwjH3WbdqVT7CBhlanpwwOBtAl 0rvw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=AC9W0ZDR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 f2-20020a655902000000b004599da2b2b6si31016325pgu.716.2022.10.22.00.47.45; Sat, 22 Oct 2022 00:47: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=AC9W0ZDR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231555AbiJVHrN (ORCPT + 99 others); Sat, 22 Oct 2022 03:47:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47100 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231262AbiJVHpS (ORCPT ); Sat, 22 Oct 2022 03:45: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 145D625CD82; Sat, 22 Oct 2022 00:43: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 36298B82E04; Sat, 22 Oct 2022 07:43:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 86F65C433C1; Sat, 22 Oct 2022 07:42:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424578; bh=DvEyzZ9sfH9VpHDOP+FLW9z4h1snXVO5eAxm/oX/Vt4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AC9W0ZDRQahtqcW7dxKrGXfp4oenfeHbps1Ln4ADeqDSTUqKtYrRw1qXpEfu4mhzE +xYo1CuhSM7XmmKvqJeAquzb4nU4BiDdSHeLb0PJA16tkOxTrKX4f58YNiuIN2PLo4 HfKISg5ZDdp3imgTM5FvN3lAfQDBr1xTO26kYm70= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Juha-Pekka Heikkila , =?utf-8?b?VmlsbGUgU3ly?= =?utf-8?b?asOkbMOk?= , Tvrtko Ursulin Subject: [PATCH 5.19 168/717] drm/i915: Fix watermark calculations for gen12+ RC CCS modifier Date: Sat, 22 Oct 2022 09:20:47 +0200 Message-Id: <20221022072445.244267403@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747373133969865384?= X-GMAIL-MSGID: =?utf-8?q?1747373133969865384?= From: Ville Syrjälä commit c56453a00f19ccddee302f5f9fe96b80e0b47fd3 upstream. Take the gen12+ RC CCS modifier into account when calculating the watermarks. Othwerwise we'll calculate the watermarks thinking this Y-tiled modifier is linear. The rc_surface part is actually a nop since that is not used for any glk+ platform. v2: Split RC CCS vs. MC CCS to separate patches Cc: stable@vger.kernel.org Fixes: b3e57bccd68a ("drm/i915/tgl: Gen-12 render decompression") Reviewed-by: Juha-Pekka Heikkila Signed-off-by: Ville Syrjälä Link: https://patchwork.freedesktop.org/patch/msgid/20221003111544.8007-2-ville.syrjala@linux.intel.com (cherry picked from commit a89a96a586114f67598c6391c75678b4dba5c2da) Signed-off-by: Tvrtko Ursulin Signed-off-by: Greg Kroah-Hartman --- drivers/gpu/drm/i915/intel_pm.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) --- a/drivers/gpu/drm/i915/intel_pm.c +++ b/drivers/gpu/drm/i915/intel_pm.c @@ -5307,10 +5307,12 @@ skl_compute_wm_params(const struct intel modifier == I915_FORMAT_MOD_4_TILED || modifier == I915_FORMAT_MOD_Yf_TILED || modifier == I915_FORMAT_MOD_Y_TILED_CCS || - modifier == I915_FORMAT_MOD_Yf_TILED_CCS; + modifier == I915_FORMAT_MOD_Yf_TILED_CCS || + modifier == I915_FORMAT_MOD_Y_TILED_GEN12_RC_CCS; wp->x_tiled = modifier == I915_FORMAT_MOD_X_TILED; wp->rc_surface = modifier == I915_FORMAT_MOD_Y_TILED_CCS || - modifier == I915_FORMAT_MOD_Yf_TILED_CCS; + modifier == I915_FORMAT_MOD_Yf_TILED_CCS || + modifier == I915_FORMAT_MOD_Y_TILED_GEN12_RC_CCS; wp->is_planar = intel_format_info_is_yuv_semiplanar(format, modifier); wp->width = width; From patchwork Sat Oct 22 07:20:48 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 7268 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1091870wrr; Sat, 22 Oct 2022 00:52:05 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6kf+S5LCFmRnXaCkMsvOya2Ca/tsD/xWlKk4oBNll+PBTYEuaGn+B7IoU/GCYxgXqMKk8D X-Received: by 2002:a63:4042:0:b0:43b:ddc8:235 with SMTP id n63-20020a634042000000b0043bddc80235mr19739362pga.498.1666425125363; Sat, 22 Oct 2022 00:52:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666425125; cv=none; d=google.com; s=arc-20160816; b=nhWb4Eta3E9az6nuQx1S7iLMPGqIDbt22ApA8OZFE0U2VysP/a9t8wjpBIuFfSgQ6x JjG5QvjgplTLlk2L3/azlJAoTmoxeY5qfZrPbciRrUn4DTBV4OgyC8vbwWLxxsVPdJ2q aL0NnWkXNK4KIe36IoAli9hxIB5PQxVSz8iSsWiMCTsGfh6TfsGWVN3ok0czDUY5/+EZ lRQNieK3/c2v7/jbvCPlfDyo5UMicxpshVj5NayFGnA7M9VzPl9hI7Mk09W4Lz48QL7y sAPFmkoA+VtPi7N+kZXfTUNfcZGkmt/IsjHuUjj+mBBl+9vUq9qxZdKbP/J/c7xR0sXm q4FA== 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=w0FY3vWom5k6wRs68EOn3mFjR3cFdX6TjpkYt8Qgb5w=; b=pwEPOsilUhy/7+CwCVYZcxt6U0uwnt3lmeLrO5MhrHOZ7ui9JkFvpjm0OF5pltLsRs 1C83eiPsn137UI0sgAUvSEzF1sdEspTL7bavxZbSOcKLtquLDGZD37hVh1/AJrWD/UI6 wRBb47DNJliAbTu2If/p03amq0UymzotMFff3PQ8ZM53n0QWf/wl9A6Q5CULwRNH1QtW S/sL4VTa4v7+gWooudrCgdSRaOxUu20/ToHw8TQCF62u/epAFeCDCbQRChi9k6yLq8XN 3kehl8MkSBWhM6G/liq21Ua2nWZs6Tarl8Es2BLSMhbHYkA7iQjO6nacCcJju3I7+kt5 v39A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Bi3yPnJX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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-20020a6300c7000000b0045ec918ad31si26203827pga.544.2022.10.22.00.51.52; Sat, 22 Oct 2022 00:52: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=Bi3yPnJX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231886AbiJVHvY (ORCPT + 99 others); Sat, 22 Oct 2022 03:51:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35676 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231836AbiJVHtU (ORCPT ); Sat, 22 Oct 2022 03:49:20 -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 BC8382B4EAE; Sat, 22 Oct 2022 00:46: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 0D47A60B9D; Sat, 22 Oct 2022 07:43:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 225A8C433C1; Sat, 22 Oct 2022 07:43:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424581; bh=TdOSGO9Ccl+FvN9iBcVOLWtEUIl7cDbZqMnC7k3x+jw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Bi3yPnJXv1fN8MX9t0ryROMv79NfjMXhwdaRBl7s0F5y2/Hf/YPtSEUgqCqOQ4TJ0 tvXR+blUExaGBxuub8ADuD3YwWxygEjPUqbq1Ryx1RZl7/0aiKzmBX3Oa7L20A8kfC W4G9jmCxDb0UjukkX0Y9Ayb00CE2osZ5VE61bxvc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Juha-Pekka Heikkila , =?utf-8?b?VmlsbGUgU3ly?= =?utf-8?b?asOkbMOk?= , Tvrtko Ursulin Subject: [PATCH 5.19 169/717] drm/i915: Fix watermark calculations for gen12+ MC CCS modifier Date: Sat, 22 Oct 2022 09:20:48 +0200 Message-Id: <20221022072445.427693683@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747373392144256969?= X-GMAIL-MSGID: =?utf-8?q?1747373392144256969?= From: Ville Syrjälä commit 484b2b9281000274ef7c5cb0a9ebc5da6f5c281c upstream. Take the gen12+ MC CCS modifier into account when calculating the watermarks. Othwerwise we'll calculate the watermarks thinking this Y-tiled modifier is linear. The rc_surface part is actually a nop since that is not used for any glk+ platform. v2: Split RC CCS vs. MC CCS to separate patches Cc: stable@vger.kernel.org Fixes: 2dfbf9d2873a ("drm/i915/tgl: Gen-12 display can decompress surfaces compressed by the media engine") Reviewed-by: Juha-Pekka Heikkila Signed-off-by: Ville Syrjälä Link: https://patchwork.freedesktop.org/patch/msgid/20221003111544.8007-3-ville.syrjala@linux.intel.com (cherry picked from commit 91c9651425fe955b1387f3637607dda005f3f710) Signed-off-by: Tvrtko Ursulin Signed-off-by: Greg Kroah-Hartman --- drivers/gpu/drm/i915/intel_pm.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) --- a/drivers/gpu/drm/i915/intel_pm.c +++ b/drivers/gpu/drm/i915/intel_pm.c @@ -5308,11 +5308,13 @@ skl_compute_wm_params(const struct intel modifier == I915_FORMAT_MOD_Yf_TILED || modifier == I915_FORMAT_MOD_Y_TILED_CCS || modifier == I915_FORMAT_MOD_Yf_TILED_CCS || - modifier == I915_FORMAT_MOD_Y_TILED_GEN12_RC_CCS; + modifier == I915_FORMAT_MOD_Y_TILED_GEN12_RC_CCS || + modifier == I915_FORMAT_MOD_Y_TILED_GEN12_MC_CCS; wp->x_tiled = modifier == I915_FORMAT_MOD_X_TILED; wp->rc_surface = modifier == I915_FORMAT_MOD_Y_TILED_CCS || modifier == I915_FORMAT_MOD_Yf_TILED_CCS || - modifier == I915_FORMAT_MOD_Y_TILED_GEN12_RC_CCS; + modifier == I915_FORMAT_MOD_Y_TILED_GEN12_RC_CCS || + modifier == I915_FORMAT_MOD_Y_TILED_GEN12_MC_CCS; wp->is_planar = intel_format_info_is_yuv_semiplanar(format, modifier); wp->width = width; From patchwork Sat Oct 22 07:20:49 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 7281 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1092186wrr; Sat, 22 Oct 2022 00:53:17 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7SrIA4WtMT9o0UdBpYs/Qs+xbeQT3w8Uw0wS0vstpz42qBiDfqs3AYOV2i1Hase62j7E/Q X-Received: by 2002:a17:90b:4f8e:b0:20c:c3a8:38b with SMTP id qe14-20020a17090b4f8e00b0020cc3a8038bmr27236523pjb.10.1666425197312; Sat, 22 Oct 2022 00:53:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666425197; cv=none; d=google.com; s=arc-20160816; b=Aevh+oomjOz5UTarG8m5ToETZyk7e71e6l3wPzrSTGjluZtz+6hgNPrGiqRFAqv0XM DEQQ1geRvCtc9RceqdNuHBOLsgZDdQcahz8EtX4WT3Ojke1ZqQAP/PgY2ZqfvoDsaSaT 1b9+hKHklRoi91vbUNYTyHgh5C2gh6rsT3CifhYayNFNdSDod4xYlCtpeCnb6OEOSw7L fxt0rQPiWH42K5DYxT94u/ZidjAH4oi9X2ISxMe5zdn7IohZHtegSHXL7a6GleWG4I/r AVLYqJyHIGC4yL2i/y6Z0xbpIuQT+tLjBGA2mVEim5W1m3YP/m87w2Oxo2SBpsVrfaYi uHhQ== 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=8Q5BEf2U9duu+/iD2L1OpROessPTyAyvDiV+pnQhCII=; b=wf5E23zd24DZBU0ZvMXOLFraDfFsTUMh1WEeUJm2+T5ONDDZZ1VX/ZgyhS883IZOC4 nccUwGwmGhSFGY0fjmS+w/icGKR2jzEaDp7bIiBzl7FVh/pn+lvQqbad+/zw54I34gMn kLCOYo9rbINdfqDR4TsyTRQiFLYTcaHfN8GtuiNC0OFG74xrb8qAjLaLffmm6HBawkVw aFY3eIisWtjWqnHxNrtuoYIF5k90ooK6fIDzIWHq29lb3LwFgrx1igWEiTt8bBRqqouU SEnnREtRWcboI4om6zqEg55MsB88xPM+N8l4c6QdqCxF/eBcu/PdQd3EaGhjbTtUvTj5 Td4g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=P1T9xaAm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 v64-20020a632f43000000b0046b041e1408si26873193pgv.744.2022.10.22.00.53.05; Sat, 22 Oct 2022 00:53: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=P1T9xaAm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231842AbiJVHwp (ORCPT + 99 others); Sat, 22 Oct 2022 03:52:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49560 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231362AbiJVHtm (ORCPT ); Sat, 22 Oct 2022 03:49: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 EEC5AA3BAF; Sat, 22 Oct 2022 00:46: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 AD7B460AD7; Sat, 22 Oct 2022 07:43:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C0C90C433C1; Sat, 22 Oct 2022 07:43:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424584; bh=3PR6sUObPij7sEd4A9yXYTD7viHJGZI8dn9CQg8XTVw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=P1T9xaAmWYKQT6mNc3MjKSvmfXEJcbBKiMA2bGnsMsjBNXzrFzJhMfwxF0DGs2il2 lTPcJEjNdDwJB6GkRwkJs9lcEcChA2CmHZ9use8Jw0tH1WapR5RRI20jf2foZgpwWr xr13ziZDrUb2fWD8XKc38ycOEWZzQVe0v2nHwGGE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Juha-Pekka Heikkila , =?utf-8?b?VmlsbGUgU3ly?= =?utf-8?b?asOkbMOk?= , Tvrtko Ursulin Subject: [PATCH 5.19 170/717] drm/i915: Fix watermark calculations for gen12+ CCS+CC modifier Date: Sat, 22 Oct 2022 09:20:49 +0200 Message-Id: <20221022072445.587997579@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747373467675787874?= X-GMAIL-MSGID: =?utf-8?q?1747373467675787874?= From: Ville Syrjälä commit 070a2855900de17b1e11a0dc35af9794e80f1a28 upstream. Take the gen12+ CCS+CC modifier into account when calculating the watermarks. Othwerwise we'll calculate the watermarks thinking this Y-tiled modifier is linear. The rc_surface part is actually a nop since that is not used for any glk+ platform. Cc: stable@vger.kernel.org Fixes: d1e2775e9b96 ("drm/i915/tgl: Add Clear Color support for TGL Render Decompression") Reviewed-by: Juha-Pekka Heikkila Signed-off-by: Ville Syrjälä Link: https://patchwork.freedesktop.org/patch/msgid/20221003111544.8007-4-ville.syrjala@linux.intel.com (cherry picked from commit a627455bbe50a111475d7a42beb58fa64bd96c83) Signed-off-by: Tvrtko Ursulin Signed-off-by: Greg Kroah-Hartman --- drivers/gpu/drm/i915/intel_pm.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) --- a/drivers/gpu/drm/i915/intel_pm.c +++ b/drivers/gpu/drm/i915/intel_pm.c @@ -5309,12 +5309,14 @@ skl_compute_wm_params(const struct intel modifier == I915_FORMAT_MOD_Y_TILED_CCS || modifier == I915_FORMAT_MOD_Yf_TILED_CCS || modifier == I915_FORMAT_MOD_Y_TILED_GEN12_RC_CCS || - modifier == I915_FORMAT_MOD_Y_TILED_GEN12_MC_CCS; + modifier == I915_FORMAT_MOD_Y_TILED_GEN12_MC_CCS || + modifier == I915_FORMAT_MOD_Y_TILED_GEN12_RC_CCS_CC; wp->x_tiled = modifier == I915_FORMAT_MOD_X_TILED; wp->rc_surface = modifier == I915_FORMAT_MOD_Y_TILED_CCS || modifier == I915_FORMAT_MOD_Yf_TILED_CCS || modifier == I915_FORMAT_MOD_Y_TILED_GEN12_RC_CCS || - modifier == I915_FORMAT_MOD_Y_TILED_GEN12_MC_CCS; + modifier == I915_FORMAT_MOD_Y_TILED_GEN12_MC_CCS || + modifier == I915_FORMAT_MOD_Y_TILED_GEN12_RC_CCS_CC; wp->is_planar = intel_format_info_is_yuv_semiplanar(format, modifier); wp->width = width; From patchwork Sat Oct 22 07:20:50 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 7507 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1104964wrr; Sat, 22 Oct 2022 01:33:48 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5ZkOSuff6/ral9YAPBNy5oiTDiuTdHlMG1yv8ViL+kyIuEy9mL6FuYXAQBz/ZgFuYgZiW8 X-Received: by 2002:a17:907:75e5:b0:78d:95d3:255d with SMTP id jz5-20020a17090775e500b0078d95d3255dmr18097238ejc.495.1666427628089; Sat, 22 Oct 2022 01:33:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666427628; cv=none; d=google.com; s=arc-20160816; b=k2wG1ax6EpBU8rMHP6r0UQ28ceSEqpyHr5HWzOK6fKHlYI977k38oSEY2Rp9xAVFBm SEnnPG5eEyGL6MwVf/CZOP25QePPp8GdsGC+u3DqbpGKlUO0cU6pAQHpKNu7hrlffuwy LHuJSh1SVmQQInHYnc7t5Us4Ud2326UaId//3vzZcafcOam5BXxkSzVlmkTOkk5w0v8N Outi/xTeB3XJLq/C36vM9GK/rIymJ/yx+dNHxk6vle+UpU+7rroaDsbXgZhHV3iREeIX M1Xq+0LyOxn5xNqYj1dilu8MVJ0sB1XUxFl3CjRVXdgARJEYtR5dvmTN8IGyX4I/1q2L UWUQ== 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=hAqdH878FVurY/1FLDKvYbqsEuehY4RYf5EEnIWYqTw=; b=npV2qi4U1+XPPvcr4MhZorzn1CcZE74VitOigKDxKHy0wVGWV2PcRkwWnoCDmq3yF5 Jm7QjpP5AOJhlMZb2EU9k49Kk7T54x4oSQ1fROapjCnVmEaZ2KVP3fJcFzdVLyxrxy6m o7eaVP3ZqpcW6IMRRTeJPiZhJDoUrVAgsyWMVyMOToaqkRNfUsfamik8B5vKNlZv0oPF IeogRBChMKj/+s0hjOeAOzYuTlwOspd7SVI8WSZZ0Xua7CWYRRa4EBhh5o5RAA9p7iow bXJSNmd6BQg1a0r9/AophlZBo5EIvjMD3LiOzEzXdntqCFuhrCoPCe/3IUBNkGipfewX KDXQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=fdvH9ykY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 bv16-20020a170906b1d000b007809c50fd78si18859557ejb.262.2022.10.22.01.33.19; Sat, 22 Oct 2022 01:33: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=fdvH9ykY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S233572AbiJVISP (ORCPT + 99 others); Sat, 22 Oct 2022 04:18:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50010 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234049AbiJVIQD (ORCPT ); Sat, 22 Oct 2022 04:16: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 6BB6A625FF; Sat, 22 Oct 2022 00:57: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 49267B82E12; Sat, 22 Oct 2022 07:43:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6E1D8C433D6; Sat, 22 Oct 2022 07:43:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424586; bh=AQyPOa2XBCeGULnZKJoPc0UF3DJNyZXGL295k86aygc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fdvH9ykYaxM8FGs5d9I8Wo4EKWZw+4Pp9kWgC9sZJ8qNH0+HMmgsLh7NiMqRp0EUc 8yOwlk0xyu5MfeXPoKB7E9MNIiz/yM88O5mU/HkGFA+eEacgSwvv07bYEPAsEaEVu7 Pdim6+2ub69XMHe86WXuYBfvIj1a6DGGovyySlic= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Juha-Pekka Heikkila , =?utf-8?b?VmlsbGUgU3ly?= =?utf-8?b?asOkbMOk?= , Tvrtko Ursulin Subject: [PATCH 5.19 171/717] drm/i915: Fix watermark calculations for DG2 CCS modifiers Date: Sat, 22 Oct 2022 09:20:50 +0200 Message-Id: <20221022072445.784429696@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376016711840575?= X-GMAIL-MSGID: =?utf-8?q?1747376016711840575?= From: Ville Syrjälä commit ccfa6d35f9233702c924316cdf40c05b6ce88113 upstream. Take the DG2 CCS modifiers into account when calculating the watermarks. Othwerwise we'll calculate the watermarks thinking these tile-4 modifiers are linear. The rc_surface part is actually a nop since that is not used for any glk+ platform. Cc: stable@vger.kernel.org Fixes: 4c3afa72138c ("drm/i915/dg2: Add support for DG2 render and media compression") Reviewed-by: Juha-Pekka Heikkila Signed-off-by: Ville Syrjälä Link: https://patchwork.freedesktop.org/patch/msgid/20221003111544.8007-5-ville.syrjala@linux.intel.com (cherry picked from commit f25d9f81a8e09ace4f04106995550bae1f522143) Signed-off-by: Tvrtko Ursulin Signed-off-by: Greg Kroah-Hartman --- drivers/gpu/drm/i915/intel_pm.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) --- a/drivers/gpu/drm/i915/intel_pm.c +++ b/drivers/gpu/drm/i915/intel_pm.c @@ -5310,13 +5310,17 @@ skl_compute_wm_params(const struct intel modifier == I915_FORMAT_MOD_Yf_TILED_CCS || modifier == I915_FORMAT_MOD_Y_TILED_GEN12_RC_CCS || modifier == I915_FORMAT_MOD_Y_TILED_GEN12_MC_CCS || - modifier == I915_FORMAT_MOD_Y_TILED_GEN12_RC_CCS_CC; + modifier == I915_FORMAT_MOD_Y_TILED_GEN12_RC_CCS_CC || + modifier == I915_FORMAT_MOD_4_TILED_DG2_RC_CCS || + modifier == I915_FORMAT_MOD_4_TILED_DG2_MC_CCS; wp->x_tiled = modifier == I915_FORMAT_MOD_X_TILED; wp->rc_surface = modifier == I915_FORMAT_MOD_Y_TILED_CCS || modifier == I915_FORMAT_MOD_Yf_TILED_CCS || modifier == I915_FORMAT_MOD_Y_TILED_GEN12_RC_CCS || modifier == I915_FORMAT_MOD_Y_TILED_GEN12_MC_CCS || - modifier == I915_FORMAT_MOD_Y_TILED_GEN12_RC_CCS_CC; + modifier == I915_FORMAT_MOD_Y_TILED_GEN12_RC_CCS_CC || + modifier == I915_FORMAT_MOD_4_TILED_DG2_RC_CCS || + modifier == I915_FORMAT_MOD_4_TILED_DG2_MC_CCS; wp->is_planar = intel_format_info_is_yuv_semiplanar(format, modifier); wp->width = width; From patchwork Sat Oct 22 07:20:51 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 7216 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1090350wrr; Sat, 22 Oct 2022 00:46:43 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4VtC2BLSEV6ZeemTpaVEzZQQeLrAU5SYDyASo8piXmdpfQycq6boA2svi8aWY1crvw/VMe X-Received: by 2002:a05:6a00:1414:b0:563:ae66:3103 with SMTP id l20-20020a056a00141400b00563ae663103mr22786996pfu.17.1666424802780; Sat, 22 Oct 2022 00:46:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666424802; cv=none; d=google.com; s=arc-20160816; b=tMGC0fcFr0WrMFUbl30A1f0RWUDWtcwJE0GV2J2OWiZdZUs/846pooqtMq7QQ3sSuy 9N3jPGQUcqtVZTVBM9bwtMkL3lI/UkhMP1r1la/sFOUtpaMmoUeT9KFLa6EV+pFvRn5I MchnMLWbu2xpiiL37rQH3ijXZXcdpodL0n0mfViLMcBXmr3VMurbDjiPIRQbMH/p54Su AId9CRzcAyMz5P+92njBvwzQOMZ9u44OaId1amS5TTe6wvQBtzT5qgv5EeILbI2ujx3G zir4y6tB/0EmG/4BNsJl/npKX+peFYsTsM/h6hHZwJQqJn1ucjaTi5jcwm9dpnC9jEl8 XupA== 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=X3aFyGMB7j/oADFaZNI4FxmP60Ldw5BRUmiL3biwm24=; b=KmRxZXTxkfp6deZQ2EUVh5wyquYat5MkNEWHAASAyRKNdYDdnp76pTtzMnvjp+ado2 68ZHkdZ+B/Tb9MiWqtMvttfQIfYCDUkrtusa/QKCGvWtAOVbf81hRXT0FXVwIvko22PW 2KuTz3/Vfh2JaJKXbVD+8ZjbmkR8YF8F6qK6L+3cOYC7R4715grCZsEgD2aWW4/cFtPe F2fNvN6HZS9i2//zBD4H1ntq/D/HbfO00b14lEAgbNDenIZA56L9rw3Vfyqk+8gyqyNq 5Z5fF4MHKrugasNTAwfyBkXHz6waGoM6d2+LLoOF/3UKWzXFmlF8boIe8mdr5R+DWgn/ oYWA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=M0EFJcci; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 x22-20020a63fe56000000b0046eb96a9955si4687520pgj.576.2022.10.22.00.46.30; Sat, 22 Oct 2022 00:46: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=M0EFJcci; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231430AbiJVHqK (ORCPT + 99 others); Sat, 22 Oct 2022 03:46:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45918 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231461AbiJVHoN (ORCPT ); Sat, 22 Oct 2022 03:44: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 E29C024E41E; Sat, 22 Oct 2022 00:42: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 8ACC3B82E11; Sat, 22 Oct 2022 07:41:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 01325C433C1; Sat, 22 Oct 2022 07:41:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424506; bh=vDh+4og9bBnPj3fOvVgtxmdHkxQfnDXV9tv1ixuoxjo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=M0EFJcciNZPZurLKtKHJLA+wgQbm0zqErRdvc8bR5ro39mP8BZ6BdPSGVv/W0o3ra OHd6wJrvfxISBEg7ywKWTWfhmR7cFkE41Z9erClLbRikchw0GbQUb++OSuulyfPYaj 3GpGXTbZgpwUJh9BccZI6F2BceS8/9oF2ZcrzfKo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Juha-Pekka Heikkila , =?utf-8?b?VmlsbGUgU3ly?= =?utf-8?b?asOkbMOk?= , Tvrtko Ursulin Subject: [PATCH 5.19 172/717] drm/i915: Fix watermark calculations for DG2 CCS+CC modifier Date: Sat, 22 Oct 2022 09:20:51 +0200 Message-Id: <20221022072445.967040206@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747373053949192786?= X-GMAIL-MSGID: =?utf-8?q?1747373053949192786?= From: Ville Syrjälä commit b2e3a1af8cce4117de06ff1a4eab0749753ede27 upstream. Take the DG2 CCS+CC modifier into account when calculating the watermarks. Othwerwise we'll calculate the watermarks thinking this tile-4 modifier is linear. The rc_surface part is actually a nop since that is not used for any glk+ platform. Cc: stable@vger.kernel.org Fixes: 680025dcc400 ("drm/i915/dg2: Add support for DG2 clear color compression") Reviewed-by: Juha-Pekka Heikkila Signed-off-by: Ville Syrjälä Link: https://patchwork.freedesktop.org/patch/msgid/20221003111544.8007-6-ville.syrjala@linux.intel.com (cherry picked from commit 334810f82024815283a6e7febd3d2de1fed6c232) Signed-off-by: Tvrtko Ursulin Signed-off-by: Greg Kroah-Hartman --- drivers/gpu/drm/i915/intel_pm.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) --- a/drivers/gpu/drm/i915/intel_pm.c +++ b/drivers/gpu/drm/i915/intel_pm.c @@ -5312,7 +5312,8 @@ skl_compute_wm_params(const struct intel modifier == I915_FORMAT_MOD_Y_TILED_GEN12_MC_CCS || modifier == I915_FORMAT_MOD_Y_TILED_GEN12_RC_CCS_CC || modifier == I915_FORMAT_MOD_4_TILED_DG2_RC_CCS || - modifier == I915_FORMAT_MOD_4_TILED_DG2_MC_CCS; + modifier == I915_FORMAT_MOD_4_TILED_DG2_MC_CCS || + modifier == I915_FORMAT_MOD_4_TILED_DG2_RC_CCS_CC; wp->x_tiled = modifier == I915_FORMAT_MOD_X_TILED; wp->rc_surface = modifier == I915_FORMAT_MOD_Y_TILED_CCS || modifier == I915_FORMAT_MOD_Yf_TILED_CCS || @@ -5320,7 +5321,8 @@ skl_compute_wm_params(const struct intel modifier == I915_FORMAT_MOD_Y_TILED_GEN12_MC_CCS || modifier == I915_FORMAT_MOD_Y_TILED_GEN12_RC_CCS_CC || modifier == I915_FORMAT_MOD_4_TILED_DG2_RC_CCS || - modifier == I915_FORMAT_MOD_4_TILED_DG2_MC_CCS; + modifier == I915_FORMAT_MOD_4_TILED_DG2_MC_CCS || + modifier == I915_FORMAT_MOD_4_TILED_DG2_RC_CCS_CC; wp->is_planar = intel_format_info_is_yuv_semiplanar(format, modifier); wp->width = width; From patchwork Sat Oct 22 07:20: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: 7252 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1091503wrr; Sat, 22 Oct 2022 00:50:52 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7rCOTo9oQZ+KbU6AdmjD7tDp9u47bwKIsDbXy9+sMiI8tD1TBXroCfRHmU4GKx8a8ceclY X-Received: by 2002:a17:90b:2306:b0:212:533:3188 with SMTP id mt6-20020a17090b230600b0021205333188mr14479307pjb.210.1666425051926; Sat, 22 Oct 2022 00:50:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666425051; cv=none; d=google.com; s=arc-20160816; b=uOPt/mn8luZfiyIF9OxyitYSGFJskj5ViZ0BWJhZVdxyNAdEmDEKNvmridbIuVXqAC S+ivwNBZ4Sb9uXtYq46AjiP2K9WTEAP2oys6s2GcLj6Bvuf+mxfa/M24VycT+XthWMyA OJOfHPxI0KdXeK3GKK56yNkDgL+UxSNsO1759PUH6UlBD3M0KSe/NvqJ4nhWGvNMhD1J Z+uGPM044973lGrufFvDyemh0TIkn5WN12i7uwbeqJ81760hijlTw9Y41FoJQ/siSiVU Luxl4rd+iFqNV12QJSln/2MiBGjaWEugKi5pLnzPTMO0tmJMEA8GSwEiGfp7/pbQDA/E jBvQ== 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=6i2Dj/GuxNTw1oqb9VPhzcSrGJb4Lq0yfd7KyAKZqQk=; b=GJ+7R//uGBfwHwt6tox9ELFUYny3e0wNwstdyscTnoEweWVtaowaUPvkVsOFswBdiC UhFAecQlObQYvw5EnxngByhuDlGMGQ7HMkQgSumL91sEJCfmWERc9kmvYlUADHnXsAx3 2eiV+fWyPtlv5+SbbKviys9D2BoImJLAYkLQAKpASoAbx4ppZASF412kDVkygrQUmHrU hxmO8a+xQtuI9UEIVrMGKTxMBlbYyknQsjNCCdVy/9RVMMW3qb/xzjQCoa4x1JWfg7le wSH1ajjWMXVVTpWkF0E2Ptfr0irY15EyYWZKOzOLUepHBi1ihhAXBWNd3TifTJVh+HWg 93WA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=frJJm0BM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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-20020a1709029a0a00b001768452d4d0si26599496plp.30.2022.10.22.00.50.39; Sat, 22 Oct 2022 00:50: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=frJJm0BM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S230153AbiJVHuQ (ORCPT + 99 others); Sat, 22 Oct 2022 03:50:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34358 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231621AbiJVHso (ORCPT ); Sat, 22 Oct 2022 03:48: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 DC45D1EF075; Sat, 22 Oct 2022 00:45: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 86C4A60B82; Sat, 22 Oct 2022 07:41:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8EA9BC433D6; Sat, 22 Oct 2022 07:41:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424509; bh=B9/5WzG7VmvisZ35bxicFFxNTPqdrMbAcqvJCyyI0FU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=frJJm0BMFAyXUuXAp5+v6x7CnUh2/N+izHyfxwcfaUhZB6xTfT/IwyitDqtwkx6c9 pZhFCjp/9AS3XPPLEzTiUU6mLeCUEjq+CX0OcBdT+a0HfIBvU99dqYXjP/9FrrL0nR Vwf0+zE8me8ehOmWa8EiWMk9/QNxqc1xXTGfZGjc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Daniel Wheeler , Rodrigo Siqueira , Yunxiang Li , Alex Deucher Subject: [PATCH 5.19 173/717] drm/amd/display: Fix vblank refcount in vrr transition Date: Sat, 22 Oct 2022 09:20:52 +0200 Message-Id: <20221022072446.142164857@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747373315186143886?= X-GMAIL-MSGID: =?utf-8?q?1747373315186143886?= From: Yunxiang Li commit 8799c0be89ebb99a16098bdf618f49f817bef76a upstream. manage_dm_interrupts disable/enable vblank using drm_crtc_vblank_off/on which causes drm_crtc_vblank_get in vrr_transition to fail, and later when drm_crtc_vblank_put is called the refcount on vblank will be messed up. Therefore move the call to after manage_dm_interrupts. Bug: https://gitlab.freedesktop.org/drm/amd/-/issues/1247 Bug: https://gitlab.freedesktop.org/drm/amd/-/issues/1380 Tested-by: Daniel Wheeler Reviewed-by: Rodrigo Siqueira Signed-off-by: Yunxiang Li Signed-off-by: Rodrigo Siqueira Signed-off-by: Alex Deucher Cc: stable@vger.kernel.org Signed-off-by: Greg Kroah-Hartman --- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 55 ++++++++++------------ 1 file changed, 26 insertions(+), 29 deletions(-) --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c @@ -9157,15 +9157,15 @@ static void amdgpu_dm_handle_vrr_transit * We also need vupdate irq for the actual core vblank handling * at end of vblank. */ - dm_set_vupdate_irq(new_state->base.crtc, true); - drm_crtc_vblank_get(new_state->base.crtc); + WARN_ON(dm_set_vupdate_irq(new_state->base.crtc, true) != 0); + WARN_ON(drm_crtc_vblank_get(new_state->base.crtc) != 0); DRM_DEBUG_DRIVER("%s: crtc=%u VRR off->on: Get vblank ref\n", __func__, new_state->base.crtc->base.id); } else if (old_vrr_active && !new_vrr_active) { /* Transition VRR active -> inactive: * Allow vblank irq disable again for fixed refresh rate. */ - dm_set_vupdate_irq(new_state->base.crtc, false); + WARN_ON(dm_set_vupdate_irq(new_state->base.crtc, false) != 0); drm_crtc_vblank_put(new_state->base.crtc); DRM_DEBUG_DRIVER("%s: crtc=%u VRR on->off: Drop vblank ref\n", __func__, new_state->base.crtc->base.id); @@ -9916,23 +9916,6 @@ static void amdgpu_dm_atomic_commit_tail mutex_unlock(&dm->dc_lock); } - /* Count number of newly disabled CRTCs for dropping PM refs later. */ - for_each_oldnew_crtc_in_state(state, crtc, old_crtc_state, - new_crtc_state, i) { - if (old_crtc_state->active && !new_crtc_state->active) - crtc_disable_count++; - - dm_new_crtc_state = to_dm_crtc_state(new_crtc_state); - dm_old_crtc_state = to_dm_crtc_state(old_crtc_state); - - /* For freesync config update on crtc state and params for irq */ - update_stream_irq_parameters(dm, dm_new_crtc_state); - - /* Handle vrr on->off / off->on transitions */ - amdgpu_dm_handle_vrr_transition(dm_old_crtc_state, - dm_new_crtc_state); - } - /** * Enable interrupts for CRTCs that are newly enabled or went through * a modeset. It was intentionally deferred until after the front end @@ -9942,16 +9925,29 @@ static void amdgpu_dm_atomic_commit_tail for_each_oldnew_crtc_in_state(state, crtc, old_crtc_state, new_crtc_state, i) { struct amdgpu_crtc *acrtc = to_amdgpu_crtc(crtc); #ifdef CONFIG_DEBUG_FS - bool configure_crc = false; enum amdgpu_dm_pipe_crc_source cur_crc_src; #if defined(CONFIG_DRM_AMD_SECURE_DISPLAY) - struct crc_rd_work *crc_rd_wrk = dm->crc_rd_wrk; + struct crc_rd_work *crc_rd_wrk; +#endif +#endif + /* Count number of newly disabled CRTCs for dropping PM refs later. */ + if (old_crtc_state->active && !new_crtc_state->active) + crtc_disable_count++; + + dm_new_crtc_state = to_dm_crtc_state(new_crtc_state); + dm_old_crtc_state = to_dm_crtc_state(old_crtc_state); + + /* For freesync config update on crtc state and params for irq */ + update_stream_irq_parameters(dm, dm_new_crtc_state); + +#ifdef CONFIG_DEBUG_FS +#if defined(CONFIG_DRM_AMD_SECURE_DISPLAY) + crc_rd_wrk = dm->crc_rd_wrk; #endif spin_lock_irqsave(&adev_to_drm(adev)->event_lock, flags); cur_crc_src = acrtc->dm_irq_params.crc_src; spin_unlock_irqrestore(&adev_to_drm(adev)->event_lock, flags); #endif - dm_new_crtc_state = to_dm_crtc_state(new_crtc_state); if (new_crtc_state->active && (!old_crtc_state->active || @@ -9959,16 +9955,19 @@ static void amdgpu_dm_atomic_commit_tail dc_stream_retain(dm_new_crtc_state->stream); acrtc->dm_irq_params.stream = dm_new_crtc_state->stream; manage_dm_interrupts(adev, acrtc, true); + } + /* Handle vrr on->off / off->on transitions */ + amdgpu_dm_handle_vrr_transition(dm_old_crtc_state, dm_new_crtc_state); #ifdef CONFIG_DEBUG_FS + if (new_crtc_state->active && + (!old_crtc_state->active || + drm_atomic_crtc_needs_modeset(new_crtc_state))) { /** * Frontend may have changed so reapply the CRC capture * settings for the stream. */ - dm_new_crtc_state = to_dm_crtc_state(new_crtc_state); - if (amdgpu_dm_is_valid_crc_source(cur_crc_src)) { - configure_crc = true; #if defined(CONFIG_DRM_AMD_SECURE_DISPLAY) if (amdgpu_dm_crc_window_is_activated(crtc)) { spin_lock_irqsave(&adev_to_drm(adev)->event_lock, flags); @@ -9980,12 +9979,10 @@ static void amdgpu_dm_atomic_commit_tail spin_unlock_irqrestore(&adev_to_drm(adev)->event_lock, flags); } #endif - } - - if (configure_crc) if (amdgpu_dm_crtc_configure_crc_source( crtc, dm_new_crtc_state, cur_crc_src)) DRM_DEBUG_DRIVER("Failed to configure crc source"); + } #endif } } From patchwork Sat Oct 22 07:20: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: 7254 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1091562wrr; Sat, 22 Oct 2022 00:51:07 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7zUAacOweZIhnXj5Pqc2/p17QK2DFX0gJ96BxX6WmzPtpgm7F72KN/yz27aYeGHrRsGtvP X-Received: by 2002:a17:90a:65c7:b0:20f:8385:cc18 with SMTP id i7-20020a17090a65c700b0020f8385cc18mr26571756pjs.235.1666425067032; Sat, 22 Oct 2022 00:51:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666425067; cv=none; d=google.com; s=arc-20160816; b=mhFuMLu5weei4lm3liQdQP+HvefymO8rzvm2pnraMoapcQyvL0F2IQDDhySfAZX6U8 QeR9SxSg87wCaly/EwJp0cKQLrguH1BgDh6TZsDMs1nooGski9T5b496bYWCYHyeBYr5 86dvU7T6xqaQTPtXizXU//o73XzWKf0JWz0UHKYgwIdq5yN1ImZjVmUppOHARO/QEojt toC2fhCGpLRAnwiweZkbYcdwyuKI54v06syhzHoTKts1UKzFhao9EoHH5ErpBw5Z+4xQ C4kX0BezCIyiXOLJ8ieQ8laFO+oczDmbVeoTymI58JQ8Rbhoj63K3qyOK4A6zpYMHXzB 0Qbw== 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=AJufPZK/Qe3ChuD6tChIt811wUzZfnUexvrLSLyNhjI=; b=VjxtpeoXE0jGL17wnHdRvbcEDU4hI1mAIlWJednx+Q9X1hxWkYd56pTJDX67G4dq/m XtiRYBoZ7SUWq3doDzqpm26MMerTJIJ/mnxp9wF4WkZSuZHRyqIgy4lmCZq4UHiQw8KH 3vwNLzy0/sE5TODWNkuagRa8VR2sqPbi4SuAAEs2+7qlwuf8+GHsH7/eAYHr0igEamyS YKDRLRVhI9H1miPX5/Xa2R6itIcjCj5ANm9X6UORQ0N9IUpoe7wPoPX69W+ySDpaa38P VtxPfXhuy2l0UgiMo9/+DLBmvI0Jln/oA1TlJeuHXWrA35TpkPwCigq/NJOu9NbFfqPw fV2g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=vUs+wuBo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 r5-20020a63ce45000000b0045a3e1d1a77si26114732pgi.111.2022.10.22.00.50.54; Sat, 22 Oct 2022 00:51: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=vUs+wuBo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231713AbiJVHuc (ORCPT + 99 others); Sat, 22 Oct 2022 03:50:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35564 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231671AbiJVHs7 (ORCPT ); Sat, 22 Oct 2022 03:48: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 DAD4A209FB3; Sat, 22 Oct 2022 00:45: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 dfw.source.kernel.org (Postfix) with ESMTPS id 3C5EF60B8A; Sat, 22 Oct 2022 07:41:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4A843C433C1; Sat, 22 Oct 2022 07:41:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424511; bh=E8K2O0dMkobnDwehst82URM/QgRsMeOSGBHxTus3uzE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vUs+wuBoXYSQviq7zhGv+Nt0sKr8mfSQKKpaniFAR/eD0plsfxFFvC4gKqlpoSNMu C2X8KCHjuBdyelw7P7d+/2eseowvo99LhvZbzjDo9JO1K1EquCBXxiuaxLV0kS3j+S Wwh1f9jIaMMVJG1+Hi7/LWZ4zjbGSXrDoh7GfCbo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Shirish S , Leo Li , Mario Limonciello , Alex Deucher Subject: [PATCH 5.19 174/717] drm/amd/display: explicitly disable psr_feature_enable appropriately Date: Sat, 22 Oct 2022 09:20:53 +0200 Message-Id: <20221022072446.314280756@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747373331399378517?= X-GMAIL-MSGID: =?utf-8?q?1747373331399378517?= From: Shirish S commit 6094b9136ca9038b61e9c4b5d25cd5512ce50b34 upstream. [Why] If psr_feature_enable is set to true by default, it continues to be enabled for non capable links. [How] explicitly disable the feature on links that are not capable of the same. Fixes: 8c322309e48e9 ("drm/amd/display: Enable PSR") Signed-off-by: Shirish S Reviewed-by: Leo Li Reviewed-by: Mario Limonciello Signed-off-by: Alex Deucher Cc: stable@vger.kernel.org # 5.15+ Signed-off-by: Greg Kroah-Hartman --- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_psr.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_psr.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_psr.c @@ -60,11 +60,15 @@ static bool link_supports_psrsu(struct d */ void amdgpu_dm_set_psr_caps(struct dc_link *link) { - if (!(link->connector_signal & SIGNAL_TYPE_EDP)) + if (!(link->connector_signal & SIGNAL_TYPE_EDP)) { + link->psr_settings.psr_feature_enabled = false; return; + } - if (link->type == dc_connection_none) + if (link->type == dc_connection_none) { + link->psr_settings.psr_feature_enabled = false; return; + } if (link->dpcd_caps.psr_info.psr_version == 0) { link->psr_settings.psr_version = DC_PSR_VERSION_UNSUPPORTED; From patchwork Sat Oct 22 07:20: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: 7521 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1105154wrr; Sat, 22 Oct 2022 01:34:14 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6xbstaJxF+8eKyVd4mXfX//gQoQNHDwYuK89C/h6VuEZZN9IB7VzM6nB1EhuIPclaRCrcW X-Received: by 2002:a17:902:d510:b0:185:480a:85d3 with SMTP id b16-20020a170902d51000b00185480a85d3mr23672620plg.4.1666427654310; Sat, 22 Oct 2022 01:34:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666427654; cv=none; d=google.com; s=arc-20160816; b=CZAZ6Pb7TQ25dL/yHfxNSfqYstX2MCNYAnFcjyfNyLGk44RBnwOYQrTP+nzvZngqg6 0ZM11nJMUga4fahWdARWkDz0YzEQxe5xDH/m6xX2X6AaFrSHf2ZtmQDvT7jvNihPPFat rKU8wirs8SOiIL5F3rp5sY1kIA2FIn6OlpgzE5S6C6wLif/yabYr9JSkNC5tR1GHV+Xn 9ZfKxp8g93dZ7LmR5K3JHL3cctLREMvCYbA69JNNURLt3rMBKjOuklENxdOr4Kcq7WBI LbZGxFasxfVPEorApDSzlGaGhinEzptxV0IV4W+pC3YRq1vhmbfN5zrh5fMXq0y1JvRN MLTQ== 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=caZv2F3XZ7YiFftApURP3v8Hb8wkQdgV4fVM45uNOgA=; b=ynKXuQDKvVuXERoZdnEAJ4TOWW6pUq/WeSwMtYAwzBrGZreINXqkmNEHdjyuccOCyS BBX0Z2ZUdKHy8110ipv0LhG6JiEYh8k6PIraiEqhxYgUTr2pCjBiRBEMcJdcfs+WWRoF A/c5uPCmdehh1cRzioNr/0jok7SAvR4AArk/3H7Z2hi0/lUOEFvXQjECsrSZGr5h3cKW fdD3vZ9LZFw9PVA03SSgHOzbEfFLGslWPBfVu7LkaoFa9S4RyrDLdo3SsGcWV/82F8hU pYwyKbGq6wZfR+PlfH2fs+ofG6ejpmIiNYfYSN7s97l5A31a7i1dKioohlHuwbpbuJHn LEFg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=DgAL44du; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 d19-20020a056a0024d300b0056362152f8fsi28549753pfv.253.2022.10.22.01.33.58; Sat, 22 Oct 2022 01: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=DgAL44du; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S233520AbiJVIRQ (ORCPT + 99 others); Sat, 22 Oct 2022 04:17:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49156 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233861AbiJVIPZ (ORCPT ); Sat, 22 Oct 2022 04:15: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 CC6832DA1AB; Sat, 22 Oct 2022 00:56: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 B530AB82DF8; Sat, 22 Oct 2022 07:41:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F00BFC433C1; Sat, 22 Oct 2022 07:41:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424514; bh=RaCY5RAb8ZerKeM1IclPcawvKRfJOaSZ/TtnUxatBTc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DgAL44duOAbi1WTf6l/lcecDXlKI0Lycu55PIxukf1D1AyjU5tVtN9p0M0/NLS3/S W/L0Ax0gIiUcbi3PC5WhmVWS48KTOf7b+V0A8B5JAPiojZvf2TF4UaTZ25OnnNPe83 FHv71ttCrzle88Pqmg9katWNdBfrSka0UZNlXfBI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Paulo Alcantara (SUSE)" , Steve French Subject: [PATCH 5.19 175/717] smb3: must initialize two ACL struct fields to zero Date: Sat, 22 Oct 2022 09:20:54 +0200 Message-Id: <20221022072446.511064179@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376044315248344?= X-GMAIL-MSGID: =?utf-8?q?1747376044315248344?= From: Steve French commit f09bd695af3b8ab46fc24e5d6954a24104c38387 upstream. Coverity spotted that we were not initalizing Stbz1 and Stbz2 to zero in create_sd_buf. Addresses-Coverity: 1513848 ("Uninitialized scalar variable") Cc: Reviewed-by: Paulo Alcantara (SUSE) Signed-off-by: Steve French Signed-off-by: Greg Kroah-Hartman --- fs/cifs/smb2pdu.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/fs/cifs/smb2pdu.c +++ b/fs/cifs/smb2pdu.c @@ -2410,7 +2410,7 @@ create_sd_buf(umode_t mode, bool set_own unsigned int acelen, acl_size, ace_count; unsigned int owner_offset = 0; unsigned int group_offset = 0; - struct smb3_acl acl; + struct smb3_acl acl = {}; *len = roundup(sizeof(struct crt_sd_ctxt) + (sizeof(struct cifs_ace) * 4), 8); @@ -2483,6 +2483,7 @@ create_sd_buf(umode_t mode, bool set_own acl.AclRevision = ACL_REVISION; /* See 2.4.4.1 of MS-DTYP */ acl.AclSize = cpu_to_le16(acl_size); acl.AceCount = cpu_to_le16(ace_count); + /* acl.Sbz1 and Sbz2 MBZ so are not set here, but initialized above */ memcpy(aclptr, &acl, sizeof(struct smb3_acl)); buf->ccontext.DataLength = cpu_to_le32(ptr - (__u8 *)&buf->sd); From patchwork Sat Oct 22 07:20: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: 7224 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1090465wrr; Sat, 22 Oct 2022 00:47:14 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5subS9xrJtJONhJZwzJHNwfVU5yDMS0DbqLXgxP/sNp64U+woNcJUiNSBqNgoofzhDNXbJ X-Received: by 2002:a17:902:b907:b0:178:9d11:c978 with SMTP id bf7-20020a170902b90700b001789d11c978mr23178933plb.90.1666424833860; Sat, 22 Oct 2022 00:47:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666424833; cv=none; d=google.com; s=arc-20160816; b=swn/+5t9He3j1tSPwJWMLtTB8AbR3MriKaibrWm06inKRqjyH1wfMkr10FKQRcLxpP 8EuWRN5/s+3+ppnJ69b6MH3+LLLtBnrPCZEItV6dgVt3ai/A66VFubjMKWJaSPxtuIZR rM3dDWf2kFbYphVizcLkUx6QGlEGBncw0PrX4n9Kca19H/cjSstiU5soQUjvb6vImP+M uatNB0WO1UW0ZLziVxo2d6QpK7kQgWJQ1TDp0QtabWa+/wYVin5WnVGcMXXHbVW+xml4 Q3sRf4qAGGpZtZNq2rtRE3VWGBUaQCW+QOYNHwHNaV+MRFMD+h2cfRZ8Ie4n9pjS96Tf agrQ== 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=YCRKJCfcbu79sBq4qIZn4FIjwAspe2hJvwsrrGU6Z2c=; b=grU/8GaROrYZL/m2Nl73lUr0IcamOMxyJ8PvThjmXFp8epUMeVpGpTLZiTsIoajnbm sGaOvn95PhkB/Yn4dq3K3+QHy5V5yV+hBXALYFp7bGW4tkmmRiYstJORoMSq/JqH5vNy y54x3dsu7+xbk4v2wSrCuJ+djpvrJVoPdCDHRtB3ILV3tch0HMuY+s6XpvRO19JyQwcY DpocTF4Q8B/8+wCch6fQlgEYgy0iwQzrSLcR7VvyjDOtXZppvLxRar46MM1gm3TrtGAZ rMWxAsUP4RasM9M10b+6S30FbciMpE+jnj36HY2vEv8ONcSikjxQYNQpxk5UqKw8RK72 LAUQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=kTB7Coq+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 w23-20020a17090a8a1700b0020afcf3baeasi8488351pjn.83.2022.10.22.00.47.01; Sat, 22 Oct 2022 00:47: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=kTB7Coq+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231479AbiJVHqc (ORCPT + 99 others); Sat, 22 Oct 2022 03:46:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47744 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231534AbiJVHoa (ORCPT ); Sat, 22 Oct 2022 03:44:30 -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 599F8253BD0; Sat, 22 Oct 2022 00:43: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 3EA85B82DB2; Sat, 22 Oct 2022 07:41:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AF17FC433D6; Sat, 22 Oct 2022 07:41:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424517; bh=QOgwnGXtJ5WnEebGLcaB/JmKLZooNWI4me6Yyig3MGY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kTB7Coq+cCptmTFDhM/lC0tCQ1sogRKv5VKiUe8H2zt7Q/hsDOitOFFb0HEJ0Tfqh Bn/9LauPGNhBFxRmysHUaHlSJA9QNSWcMeggK6wxs23foRq0O0nBk5F2SYpG1DEzn9 sbmZKtKevVLcorh6EjagJJqYP3GCqv1530x5htC0= 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 5.19 176/717] selinux: use "grep -E" instead of "egrep" Date: Sat, 22 Oct 2022 09:20:55 +0200 Message-Id: <20221022072446.704393717@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747373086783940398?= X-GMAIL-MSGID: =?utf-8?q?1747373086783940398?= 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 @@ -78,7 +78,7 @@ cd /etc/selinux/dummy/contexts/files $SF -F file_contexts / mounts=`cat /proc/$$/mounts | \ - egrep "ext[234]|jfs|xfs|reiserfs|jffs2|gfs2|btrfs|f2fs|ocfs2" | \ + grep -E "ext[234]|jfs|xfs|reiserfs|jffs2|gfs2|btrfs|f2fs|ocfs2" | \ awk '{ print $2 '}` $SF -F file_contexts $mounts From patchwork Sat Oct 22 07:20: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: 7220 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1090414wrr; Sat, 22 Oct 2022 00:46:57 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6zltsJR+luioOOgN7VwK656HpmY4KGjHlWRU7GjMUPAVzk1qjNTWFjR5NMilx22XQ5wpju X-Received: by 2002:a17:90b:4d90:b0:20d:9ded:4144 with SMTP id oj16-20020a17090b4d9000b0020d9ded4144mr26491821pjb.90.1666424817386; Sat, 22 Oct 2022 00:46:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666424817; cv=none; d=google.com; s=arc-20160816; b=ialEAXokzWnVN25xhhM6bYb5OtN7DGcxegONjYtIsMjYqTyXka8y07HJXZW7snU4Ko B/WEzUUnS1qU6EU1vs7dDBIIKJQe2Y/kgii6XByZtnb6mV7ZjxY/DESFu8vbL9BifF5Y SrZR0ime92CGU05JJswcqAecU18UZqDoVRTpz/nZU6FhFmTcuam1E/fHy/5XfHajnMaZ gJJNMCJq/2iBNMJAsnc1q5ODF2ygl8nK9yE9WPwFM+/nagVtPUcI+8ZKtR97PR5ZYQOF QLvG4gslKiU75GuRQ8DQyTeDoTYaf2YGSn7Hf0q6I404t1uEHfThr9EwTAWC8v2Iaodo XKdQ== 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/+gog64ttEPELBpFAxYHgbWKBe4ovNezxJhgAKnCU=; b=mzDpRvN31PckybhUAxSpcxFtTnRVBiajCh/Lr1RjHnB+pDDe5ZlbZaFVKLgQXDnpyn com5+fARAtxlzPGF6CH2b5LSCY7N71YBe78xtk4L0m+BpynhqRImm87aBxoo9vewFcW0 gXL7VavZOiGvzd/eV+bxKlHz/hQMkfxtuirhOnjLSVzkf7X1iRV85dH0gnqnydZHXd1O BUucQ1ehCq3b025Ut0RBDWgo6/vibIXt9/xAxDn1kHpLznfi0hwcT7qNMejsT0Y2RcUu /vL8LJkrHt7o5Drwo7gyT+m47BMXBjsazWP2YvyCjAvbS/lLQH89lRI+nP/pe8rDDhDp ecBA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Acyx54Ii; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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-20020a170902bcc800b00182c510591asi25097248pls.246.2022.10.22.00.46.44; Sat, 22 Oct 2022 00:46: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=Acyx54Ii; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231462AbiJVHq3 (ORCPT + 99 others); Sat, 22 Oct 2022 03:46:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34302 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231529AbiJVHoa (ORCPT ); Sat, 22 Oct 2022 03:44:30 -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 1928625B254; Sat, 22 Oct 2022 00:43: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 CD78BB82E05; Sat, 22 Oct 2022 07:42:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4C136C433C1; Sat, 22 Oct 2022 07:41:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424519; bh=7Q6MPwhmrr5duWhaJn7LPUnD03iMIW/ggf8M3L2Dfm0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Acyx54IiQQjNTIqUny4gXPQaOLMLf33wZt0uIz0RBzmhilTMV9wrlDC5xi93RTc9v Qa9jLjf3hGtTbbf0sHR7mqs3MeUW7qSqKtPFjoO1XQ/S0Ny+VmJv9j/VwgQQzurIHa FD/fnJdiLVlODzgDlOqbpFRE6qRjJhWGNHE1rmqw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Christian Brauner , Mimi Zohar , Sasha Levin Subject: [PATCH 5.19 177/717] ima: fix blocking of security.ima xattrs of unsupported algorithms Date: Sat, 22 Oct 2022 09:20:56 +0200 Message-Id: <20221022072446.904520536@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747373069221397680?= X-GMAIL-MSGID: =?utf-8?q?1747373069221397680?= From: Mimi Zohar [ Upstream commit 5926586f291b53cb8a0c9631fc19489be1186e2d ] Limit validating the hash algorithm to just security.ima xattr, not the security.evm xattr or any of the protected EVM security xattrs, nor posix acls. Fixes: 50f742dd9147 ("IMA: block writes of the security.ima xattr with unsupported algorithms") Reported-by: Christian Brauner Acked-by: Christian Brauner (Microsoft) Signed-off-by: Mimi Zohar Signed-off-by: Sasha Levin --- security/integrity/ima/ima_appraise.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/security/integrity/ima/ima_appraise.c b/security/integrity/ima/ima_appraise.c index bde74fcecee3..3e0fbbd99534 100644 --- a/security/integrity/ima/ima_appraise.c +++ b/security/integrity/ima/ima_appraise.c @@ -750,22 +750,26 @@ int ima_inode_setxattr(struct dentry *dentry, const char *xattr_name, const struct evm_ima_xattr_data *xvalue = xattr_value; int digsig = 0; int result; + int err; result = ima_protect_xattr(dentry, xattr_name, xattr_value, xattr_value_len); if (result == 1) { if (!xattr_value_len || (xvalue->type >= IMA_XATTR_LAST)) return -EINVAL; + + err = validate_hash_algo(dentry, xvalue, xattr_value_len); + if (err) + return err; + digsig = (xvalue->type == EVM_IMA_XATTR_DIGSIG); } else if (!strcmp(xattr_name, XATTR_NAME_EVM) && xattr_value_len > 0) { digsig = (xvalue->type == EVM_XATTR_PORTABLE_DIGSIG); } if (result == 1 || evm_revalidate_status(xattr_name)) { - result = validate_hash_algo(dentry, xvalue, xattr_value_len); - if (result) - return result; - ima_reset_appraise_flags(d_backing_inode(dentry), digsig); + if (result == 1) + result = 0; } return result; } From patchwork Sat Oct 22 07:20: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: 7229 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1090586wrr; Sat, 22 Oct 2022 00:47:39 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6u6qV2eFX/HbBIiPH+0vHlm59wvsViruzGWWaJD77fXyZJSWrsyOG0W160z3T0/083yaiZ X-Received: by 2002:a17:90a:2fc7:b0:212:e22a:5ba9 with SMTP id n7-20020a17090a2fc700b00212e22a5ba9mr2560904pjm.70.1666424859245; Sat, 22 Oct 2022 00:47:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666424859; cv=none; d=google.com; s=arc-20160816; b=P0fG/WncUOK1UPwa4ehG7NechXTu3H5jMzvVe+dfCpd+JDOh9qGgE9bEb/7D3v2cOf I5WYS3pE/Mc36MtVdysBHLuDLpNo0SV0yZpPHPgKbRlcd+3m31++JRpYNIUJGNZLkX0E fnO5wfh54L17tjSogU1yj2EjbPSfLhLLipxgu+OU55mE4XBKyUoWKWgNcuyz6b9XTD21 oMUqzO2tlDqIVUTrWOAmpO4awG+ZX901JenzAjDe8BXDwPSEWalYsjAHchG/3aLU/ubo wtVwVY40CW+3Ja8T/Sw35ExawaLJy/aD1MOMxWIFlF/dxKtet3EX0OMvK3zCZF53EE++ PIpA== 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=IlZLaypbjwCRja7PjmrTTl1NJxqwdxrNBGqUZT7rM6s=; b=AZkp6PLQwKnlYmEL9PoQi2IabHLviVXn9pn9NqLbEYq6LodjAcu4OM6TLthTCuOzMk TnyWRTphuG+LL6j1WKzMmMKO9C2uztOajlalnr1yoLfRddcR9bXoO4LcDD2onMdElLkR xyu1SOZ1pVCA9U5/GoXOi0f4zGTx0+v0uqy3MRTLnmad6dEAjcYxP8KPpJKVrel9/ZXZ /L0Z3kQlQ2I/ElxFupk1/QUIQY0bZzp7/WbaIwc3Rlw7FuADSaFKnN3oFM3P4RIHR1B2 aanNlrAWdyC1r1HjTcR4kvnCx0BZI/m2S/LTV4OGYThrkma/9qvNBJJeTjk4G8V+RolC 5Qpg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Dp2cPbiI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 b3-20020a655783000000b00439f026cf5dsi29101246pgr.612.2022.10.22.00.47.27; Sat, 22 Oct 2022 00:47: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=Dp2cPbiI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231534AbiJVHrE (ORCPT + 99 others); Sat, 22 Oct 2022 03:47:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34368 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231696AbiJVHpJ (ORCPT ); Sat, 22 Oct 2022 03:45:09 -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 A71BA13F7D; Sat, 22 Oct 2022 00:43: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 9636FB82E0C; Sat, 22 Oct 2022 07:42:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EBC81C433D7; Sat, 22 Oct 2022 07:42:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424522; bh=AoD7+dTTk9jFcrmi68nzi+Pl5BVo8xV9UUy1UM1JpqY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Dp2cPbiI6kVo9txPvU1CGMmerGi2mziYtq69ey+yaSRx9+vzR+HgX+DeBz+XSx8ld 1x7pPGNGpoik0ffovnp4vmKzb5HGzCinM+WfCEOp6Dl3N7UWkb+epZZKLjTSKddl3o MyP4PoBonwu0Y3WfbvupCSD01UVnRscemZdv0o8s= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Robert OCallahan , Ondrej Mosnacek , Peter Xu , "Christian Brauner (Microsoft)" , Paul Moore , Sasha Levin Subject: [PATCH 5.19 178/717] userfaultfd: open userfaultfds with O_RDONLY Date: Sat, 22 Oct 2022 09:20:57 +0200 Message-Id: <20221022072447.079288900@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747373113624236268?= X-GMAIL-MSGID: =?utf-8?q?1747373113624236268?= From: Ondrej Mosnacek [ Upstream commit abec3d015fdfb7c63105c7e1c956188bf381aa55 ] Since userfaultfd doesn't implement a write operation, it is more appropriate to open it read-only. When userfaultfds are opened read-write like it is now, and such fd is passed from one process to another, SELinux will check both read and write permissions for the target process, even though it can't actually do any write operation on the fd later. Inspired by the following bug report, which has hit the SELinux scenario described above: https://bugzilla.redhat.com/show_bug.cgi?id=1974559 Reported-by: Robert O'Callahan Fixes: 86039bd3b4e6 ("userfaultfd: add new syscall to provide memory externalization") Signed-off-by: Ondrej Mosnacek Acked-by: Peter Xu Acked-by: Christian Brauner (Microsoft) Signed-off-by: Paul Moore Signed-off-by: Sasha Levin --- fs/userfaultfd.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/userfaultfd.c b/fs/userfaultfd.c index ab0576d372d6..fa0a2fa5debb 100644 --- a/fs/userfaultfd.c +++ b/fs/userfaultfd.c @@ -991,7 +991,7 @@ static int resolve_userfault_fork(struct userfaultfd_ctx *new, int fd; fd = anon_inode_getfd_secure("[userfaultfd]", &userfaultfd_fops, new, - O_RDWR | (new->flags & UFFD_SHARED_FCNTL_FLAGS), inode); + O_RDONLY | (new->flags & UFFD_SHARED_FCNTL_FLAGS), inode); if (fd < 0) return fd; @@ -2096,7 +2096,7 @@ SYSCALL_DEFINE1(userfaultfd, int, flags) mmgrab(ctx->mm); fd = anon_inode_getfd_secure("[userfaultfd]", &userfaultfd_fops, ctx, - O_RDWR | (flags & UFFD_SHARED_FCNTL_FLAGS), NULL); + O_RDONLY | (flags & UFFD_SHARED_FCNTL_FLAGS), NULL); if (fd < 0) { mmdrop(ctx->mm); kmem_cache_free(userfaultfd_ctx_cachep, ctx); From patchwork Sat Oct 22 07:20: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: 7255 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1091574wrr; Sat, 22 Oct 2022 00:51:09 -0700 (PDT) X-Google-Smtp-Source: AMsMyM746CPxuYcDQBwJhhVQchcvxpYKbCf7rzw0qjYK/lo0PBbdoKoFV06NbHyMO8v2RqEsDrQg X-Received: by 2002:a63:4656:0:b0:457:523c:57ad with SMTP id v22-20020a634656000000b00457523c57admr19899390pgk.318.1666425068951; Sat, 22 Oct 2022 00:51:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666425068; cv=none; d=google.com; s=arc-20160816; b=HNRuwilBA1snblbCcLZubjxGd0RqAu1bzO0QY6eH5tIq/Ppuk6l7bLVSSQsv2421gO Ezl0xCGRy1aBS3jk0huFTF+Rnmes7klbIzns3UXyhVbzAyC2AIl3u40cbR6ecC53RQOi wGuIvrMuz9HpuK12Db4+wiCGUDkbAGKdcfcFflCTH4qFvEHE2x2XJlNwpoKifIn9WRYa rewPZR9u5FG8OFA/vWSNOHufCvZFKQ28S0vCb8lS5r4NPRev4voxpqf+sTcJqW4Q7aBZ Z2+txO29KUqTsqFjPPpyKV9WIAXg5aJv922/DDdPia3bcPR7uYnfrndxa98y+6ETd7CK LEug== 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=leiy5ol3PMJlxLIRMHcwve9OsPCw5eYFlNjV4iw54Js=; b=m6iuogM77wNwUgCp6F5+MNBJiGUI5j1eVUeprxCBYRUa7URWP53jach0hiA2RDWBLy 581VGpB4KjCnKRIhLqSsK12DuQCGytcVjysy5pLUcvAy4+ESOYptH3jBYiN4gXqkoFlX VvZVl8bM6INA6zw2AFAhXFbTHrcTfUiScEIMQPZo7td9KdAn2SG9nFBWoumQ2wRtAUqw gtSE313yBf2PEy9ueRHH0iyw3WrNYjsEAi3qOSjR8+GpWfe81qh1xusVgZAABWhq6Yf3 IflNdR0M0vttmn1GkkKBNHZNHOvKSdvtd8eMk6t7NzOQXsToBA8C3JwGVQVe5b1UB8cO jeNg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=q9uUtLtn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 g4-20020a170902868400b0017d2c45e8ffsi26318964plo.171.2022.10.22.00.50.56; Sat, 22 Oct 2022 00:51: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=q9uUtLtn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231724AbiJVHui (ORCPT + 99 others); Sat, 22 Oct 2022 03:50:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49562 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231683AbiJVHs7 (ORCPT ); Sat, 22 Oct 2022 03:48: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 DBDF920B109; Sat, 22 Oct 2022 00:45: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 dfw.source.kernel.org (Postfix) with ESMTPS id 7998260AD9; Sat, 22 Oct 2022 07:42:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8965AC433C1; Sat, 22 Oct 2022 07:42:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424524; bh=EdvmEvgLC/BcJJ495YvPMTi0CYghNIjjTCg4DPI5gko=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=q9uUtLtn/H9+xCvgkhRmbHJka+ayUddCX2gQ3674XOUpNw9eSpJy56UYZuIHlWmk3 z5j8HmAntZvlAwiY1OZlzHBHHH7ct2BKN9erxshz7/fDSuVz7h1XNF1lEi9eDThxqi 31ATDIbnQ0uzrvEVrmOCu5RxScHuCqw858kXry7g= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Christian Brauner (Microsoft)" , Sasha Levin , Seth Forshee Subject: [PATCH 5.19 179/717] ntfs3: rework xattr handlers and switch to POSIX ACL VFS helpers Date: Sat, 22 Oct 2022 09:20:58 +0200 Message-Id: <20221022072447.251114074@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747373332681246295?= X-GMAIL-MSGID: =?utf-8?q?1747373332681246295?= From: Christian Brauner [ Upstream commit a26aa12384158116c0d80d50e0bdc7b3323551e2 ] The xattr code in ntfs3 is currently a bit confused. For example, it defines a POSIX ACL i_op->set_acl() method but instead of relying on the generic POSIX ACL VFS helpers it defines its own set of xattr helpers with the consequence that i_op->set_acl() is currently dead code. Switch ntfs3 to rely on the VFS POSIX ACL xattr handlers. Also remove i_op->{g,s}et_acl() methods from symlink inode operations. Symlinks don't support xattrs. This is a preliminary change for the following patches which move handling idmapped mounts directly in posix_acl_xattr_set(). This survives POSIX ACL xfstests. Fixes: be71b5cba2e6 ("fs/ntfs3: Add attrib operations") Signed-off-by: Christian Brauner (Microsoft) Reviewed-by: Seth Forshee (DigitalOcean) > Signed-off-by: Sasha Levin --- fs/ntfs3/inode.c | 2 - fs/ntfs3/xattr.c | 102 +++-------------------------------------------- 2 files changed, 6 insertions(+), 98 deletions(-) diff --git a/fs/ntfs3/inode.c b/fs/ntfs3/inode.c index 803ff4c63c31..3b94ad22d9c0 100644 --- a/fs/ntfs3/inode.c +++ b/fs/ntfs3/inode.c @@ -1941,8 +1941,6 @@ const struct inode_operations ntfs_link_inode_operations = { .setattr = ntfs3_setattr, .listxattr = ntfs_listxattr, .permission = ntfs_permission, - .get_acl = ntfs_get_acl, - .set_acl = ntfs_set_acl, }; const struct address_space_operations ntfs_aops = { diff --git a/fs/ntfs3/xattr.c b/fs/ntfs3/xattr.c index e3d443ccb9be..19ce48726b00 100644 --- a/fs/ntfs3/xattr.c +++ b/fs/ntfs3/xattr.c @@ -625,67 +625,6 @@ int ntfs_set_acl(struct user_namespace *mnt_userns, struct inode *inode, return ntfs_set_acl_ex(mnt_userns, inode, acl, type, false); } -static int ntfs_xattr_get_acl(struct user_namespace *mnt_userns, - struct inode *inode, int type, void *buffer, - size_t size) -{ - struct posix_acl *acl; - int err; - - if (!(inode->i_sb->s_flags & SB_POSIXACL)) { - ntfs_inode_warn(inode, "add mount option \"acl\" to use acl"); - return -EOPNOTSUPP; - } - - acl = ntfs_get_acl(inode, type, false); - if (IS_ERR(acl)) - return PTR_ERR(acl); - - if (!acl) - return -ENODATA; - - err = posix_acl_to_xattr(&init_user_ns, acl, buffer, size); - posix_acl_release(acl); - - return err; -} - -static int ntfs_xattr_set_acl(struct user_namespace *mnt_userns, - struct inode *inode, int type, const void *value, - size_t size) -{ - struct posix_acl *acl; - int err; - - if (!(inode->i_sb->s_flags & SB_POSIXACL)) { - ntfs_inode_warn(inode, "add mount option \"acl\" to use acl"); - return -EOPNOTSUPP; - } - - if (!inode_owner_or_capable(mnt_userns, inode)) - return -EPERM; - - if (!value) { - acl = NULL; - } else { - acl = posix_acl_from_xattr(&init_user_ns, value, size); - if (IS_ERR(acl)) - return PTR_ERR(acl); - - if (acl) { - err = posix_acl_valid(&init_user_ns, acl); - if (err) - goto release_and_out; - } - } - - err = ntfs_set_acl(mnt_userns, inode, acl, type); - -release_and_out: - posix_acl_release(acl); - return err; -} - /* * ntfs_init_acl - Initialize the ACLs of a new inode. * @@ -852,23 +791,6 @@ static int ntfs_getxattr(const struct xattr_handler *handler, struct dentry *de, goto out; } -#ifdef CONFIG_NTFS3_FS_POSIX_ACL - if ((name_len == sizeof(XATTR_NAME_POSIX_ACL_ACCESS) - 1 && - !memcmp(name, XATTR_NAME_POSIX_ACL_ACCESS, - sizeof(XATTR_NAME_POSIX_ACL_ACCESS))) || - (name_len == sizeof(XATTR_NAME_POSIX_ACL_DEFAULT) - 1 && - !memcmp(name, XATTR_NAME_POSIX_ACL_DEFAULT, - sizeof(XATTR_NAME_POSIX_ACL_DEFAULT)))) { - /* TODO: init_user_ns? */ - err = ntfs_xattr_get_acl( - &init_user_ns, inode, - name_len == sizeof(XATTR_NAME_POSIX_ACL_ACCESS) - 1 - ? ACL_TYPE_ACCESS - : ACL_TYPE_DEFAULT, - buffer, size); - goto out; - } -#endif /* Deal with NTFS extended attribute. */ err = ntfs_get_ea(inode, name, name_len, buffer, size, NULL); @@ -981,22 +903,6 @@ static noinline int ntfs_setxattr(const struct xattr_handler *handler, goto out; } -#ifdef CONFIG_NTFS3_FS_POSIX_ACL - if ((name_len == sizeof(XATTR_NAME_POSIX_ACL_ACCESS) - 1 && - !memcmp(name, XATTR_NAME_POSIX_ACL_ACCESS, - sizeof(XATTR_NAME_POSIX_ACL_ACCESS))) || - (name_len == sizeof(XATTR_NAME_POSIX_ACL_DEFAULT) - 1 && - !memcmp(name, XATTR_NAME_POSIX_ACL_DEFAULT, - sizeof(XATTR_NAME_POSIX_ACL_DEFAULT)))) { - err = ntfs_xattr_set_acl( - mnt_userns, inode, - name_len == sizeof(XATTR_NAME_POSIX_ACL_ACCESS) - 1 - ? ACL_TYPE_ACCESS - : ACL_TYPE_DEFAULT, - value, size); - goto out; - } -#endif /* Deal with NTFS extended attribute. */ err = ntfs_set_ea(inode, name, name_len, value, size, flags, 0); @@ -1086,7 +992,7 @@ static bool ntfs_xattr_user_list(struct dentry *dentry) } // clang-format off -static const struct xattr_handler ntfs_xattr_handler = { +static const struct xattr_handler ntfs_other_xattr_handler = { .prefix = "", .get = ntfs_getxattr, .set = ntfs_setxattr, @@ -1094,7 +1000,11 @@ static const struct xattr_handler ntfs_xattr_handler = { }; const struct xattr_handler *ntfs_xattr_handlers[] = { - &ntfs_xattr_handler, +#ifdef CONFIG_NTFS3_FS_POSIX_ACL + &posix_acl_access_xattr_handler, + &posix_acl_default_xattr_handler, +#endif + &ntfs_other_xattr_handler, NULL, }; // clang-format on From patchwork Sat Oct 22 07:20: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: 7264 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1091752wrr; Sat, 22 Oct 2022 00:51:46 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7Wa8GTcEDWKBM4GFBWLv/Gi+nGYaxrQphMVZ6XSzpwQVr8ywE+szJrywhU0nSZG7r/U/yO X-Received: by 2002:a05:6a00:b83:b0:565:caea:38be with SMTP id g3-20020a056a000b8300b00565caea38bemr23029146pfj.72.1666425106715; Sat, 22 Oct 2022 00:51:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666425106; cv=none; d=google.com; s=arc-20160816; b=TyH0+hYjWyO+i8/sSd3QxM7Fn0U5gMmGGq8WbyZFeS2Ou3XCqyFFiOqjs1JpI/DnTk mEgTRsZLUSlyPAfgDXFrkMzPJ1fUZty/NK3In0MBqB0wnYxHMLHl/VtQWObx+INS9yqr b9GyAmyaWbpW2qYLJSF3ZitrCCXI8Iz9pxOlRbjdM20Ebq5HXzcjUGsZOJSRqDnbI4lO Btrvkn9qecx0ZJnkZQLwtiIFnqxXSBwTA5ZSDdgxUjgLBHuUcFPomSK475t/Wy/XlV21 FVJ4ucP611V5aktNMuZFiGD5i2szv7i5n8CkXE9xGqQgB1yuleD3I2NtOZf/9UDFTEC0 sP2w== 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=dzTYPRsVQNg5WJvwx8PcMcPJ4i8hKSjvtOGBSoJOax0=; b=yvdq+dPagJrlFeuqAfWn01Yig8HVQqvoZOqcUPsyfVkpMf0lBVCpM5vlvzpXE/8XNg tJ3rW+pfRWl9RGYPtCU7qzKb7v7mw/9fKoSTTVJf1aOHvNOYRJ9zx4PdcSlejolLOwNh KlEF4CqDb+dDanTvIeKPNjM1cDL/Vdw1jF8BGiN2SrPazmCGKLxaIvTtK57XEOXeKu2y FvrkBu0a9014gWH3obiU8aAwjqotUY99/HI8wVol33tUpK5zIdRw+QMyAEnHfO/9hRqU IFs+dmgOwGK1nRJurG8+h7ERYMm/TZ38UL559ZY1hqPOELESsrepfFBFpHoIaI1zh+aR Np0Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="VFH/qmxv"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 p8-20020a170902a40800b00178297641d4si25014251plq.287.2022.10.22.00.51.34; Sat, 22 Oct 2022 00:51: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="VFH/qmxv"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231846AbiJVHvT (ORCPT + 99 others); Sat, 22 Oct 2022 03:51:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49100 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231810AbiJVHtL (ORCPT ); Sat, 22 Oct 2022 03:49: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 ABA2D24B305; Sat, 22 Oct 2022 00:45: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 21E8760B98; Sat, 22 Oct 2022 07:42:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 390DFC433D6; Sat, 22 Oct 2022 07:42:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424527; bh=Hp+4Nn5q4h6t3PT29RYWpNp8hMMj6u2yuQ2wULGvs5g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VFH/qmxvTMkEZZ6NpAyOVQHCuc1zoQMV6T+S4OBLVpbrA1IE/7470jXQfUQRxIt8c AMDiuuNQU+9+nJqiE3gScaZ9rnRLmUqOycH9cSJz0Lb0ktR/avpsmy7tbvUIkzavjB 6En0VzsuySh8JkJBzg7iwj2guokApAAFd3lrjw84= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Xuewen Yan , Viresh Kumar , "Rafael J. Wysocki" , Sasha Levin Subject: [PATCH 5.19 180/717] thermal: cpufreq_cooling: Check the policy first in cpufreq_cooling_register() Date: Sat, 22 Oct 2022 09:20:59 +0200 Message-Id: <20221022072447.444358733@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747373372815302920?= X-GMAIL-MSGID: =?utf-8?q?1747373372815302920?= From: Xuewen Yan [ Upstream commit cff895277c8558221ba180aefe26799dcb4eec86 ] Since the policy needs to be accessed first when obtaining cpu devices, first check whether the policy is legal before this. Fixes: 5130802ddbb1 ("thermal: cpu_cooling: Switch to QoS requests for freq limits") Signed-off-by: Xuewen Yan Acked-by: Viresh Kumar Signed-off-by: Rafael J. Wysocki Signed-off-by: Sasha Levin --- drivers/thermal/cpufreq_cooling.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/thermal/cpufreq_cooling.c b/drivers/thermal/cpufreq_cooling.c index dc19e7c80751..ca5746f53d9e 100644 --- a/drivers/thermal/cpufreq_cooling.c +++ b/drivers/thermal/cpufreq_cooling.c @@ -530,17 +530,17 @@ __cpufreq_cooling_register(struct device_node *np, struct thermal_cooling_device_ops *cooling_ops; char *name; + if (IS_ERR_OR_NULL(policy)) { + pr_err("%s: cpufreq policy isn't valid: %p\n", __func__, policy); + return ERR_PTR(-EINVAL); + } + dev = get_cpu_device(policy->cpu); if (unlikely(!dev)) { pr_warn("No cpu device for cpu %d\n", policy->cpu); return ERR_PTR(-ENODEV); } - if (IS_ERR_OR_NULL(policy)) { - pr_err("%s: cpufreq policy isn't valid: %p\n", __func__, policy); - return ERR_PTR(-EINVAL); - } - i = cpufreq_table_count_valid_entries(policy); if (!i) { pr_debug("%s: CPUFreq table not found or has no valid entries\n", From patchwork Sat Oct 22 07:21: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: 7421 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1097668wrr; Sat, 22 Oct 2022 01:08:25 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7Nke6/lAYOxBj2AkJJKhxSkVwLa7per5uczOC3095/c3+txHTfuwftlJAvWio3nqq4C6vH X-Received: by 2002:a63:6b88:0:b0:46a:ff3c:b64a with SMTP id g130-20020a636b88000000b0046aff3cb64amr19490215pgc.196.1666426104837; Sat, 22 Oct 2022 01:08:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666426104; cv=none; d=google.com; s=arc-20160816; b=eyBw8ONJKZ35BfRPqkGVG6QcgUAMYw6EhE/HxOHBo54j3r+sojTnin/dGm12mikJSb +I0oU0vvqMkURf0FFBrosQeogyjSDY5HGn6BjhBm1EQ4lbq3ljBGcG+mbBrHwnmv65pM 4xUbW753/EalO3xWHNIXva7OMF4lCabh18cgnJ8AZi8dB4Ugowj25auN2QfrYBTjHEeS E75pU6h7Loh25kjTZewpS4ayfA29yW5ypbQSzvIUXjGy/0udkXvUHIWTl4C3u9CtzlD0 MaywFVlFIa4hugqpa5qHlhfIKQP+4xMM8/rkpnXEB2gqxYcqgoehO5n4aa35myxEHaJz O6JA== 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=3HMUYsBs4eeRUSKQEVmNLXfw6bQYHl6eAy4MdNuGz1U=; b=gSokB2b+WPuD9Fn65/K/7Ccn7BYs/+If+tvttG8bnh91KzgHR8oqEQWrgMWRGh5vf8 lTiMhg6uegs+1AAuKBagD79t5LCAIjvhvzrOw6xVd01GkxyfNeYNqdszS/gXbRiiNyh7 U/BZ0+YkqaXO50/SDpau2xJ307TQ6mfXu/hsNIVyJJqBWfPKu1eJjF9/4k62Qc+Y4BLr hrw/d2o3L2gTOqD8bfj5czBwd0rWGJNqSM1y1yApTA8vVu9m2l7araW29lRB447BL2E3 F22PYSXzWsMCBgq5jcffpzKxR059L8biPSH5T/UHyTg5os1cB7gceDZHI5uila58eUKq 9Y/A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=vwWMIRYb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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-20020a170902bb8600b00176b8830921si23385378pls.294.2022.10.22.01.08.12; Sat, 22 Oct 2022 01:08: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=vwWMIRYb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S232808AbiJVIHz (ORCPT + 99 others); Sat, 22 Oct 2022 04:07:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42864 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232764AbiJVIEK (ORCPT ); Sat, 22 Oct 2022 04:04: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 C8B1627A318; Sat, 22 Oct 2022 00:51: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 86C83B82E0B; Sat, 22 Oct 2022 07:42:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D8F63C433D6; Sat, 22 Oct 2022 07:42:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424530; bh=yXakOncocmAMdyM9Kp+4spb4pV7+704OueZkYTIj4p4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vwWMIRYb/WksO+dtHAvjxqdWQdJ+2b90933D5mq6B7UlZXA6yX8zuFwkKW8iaGQJg cRM7Mq4c2eKreL5d4N1Zq9aQH76XAorPd8e33bToX9N5C692mx9glGATkSHSgyovNs klqjagQGJyUPzBMKhRiONVEbsaJ1ovkLLEcBSUYU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Huang Rui , Perry Yuan , "Rafael J. Wysocki" , Sasha Levin Subject: [PATCH 5.19 181/717] cpufreq: amd-pstate: Fix initial highest_perf value Date: Sat, 22 Oct 2022 09:21:00 +0200 Message-Id: <20221022072447.617589858@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747374418986926538?= X-GMAIL-MSGID: =?utf-8?q?1747374418986926538?= From: Perry Yuan [ Upstream commit bedadcfb011fef55273bd686e8893fdd8911dcdb ] To avoid some new AMD processors use wrong highest perf when amd pstate driver loaded, this fix will query the highest perf from MSR register MSR_AMD_CPPC_CAP1 and cppc_acpi interface firstly, then compare with the highest perf value got by calling amd_get_highest_perf() function. The lower value will be the correct highest perf we need to use. Otherwise the CPU max MHz will be incorrect if the amd_get_highest_perf() did not cover the new process family and model ID. Like this lscpu info, the max frequency is incorrect. Vendor ID: AuthenticAMD Socket(s): 1 Stepping: 2 CPU max MHz: 5410.0000 CPU min MHz: 400.0000 BogoMIPS: 5600.54 Fixes: 3743d55b289c2 (x86, sched: Fix the AMD CPPC maximum performance value on certain AMD Ryzen generations) Acked-by: Huang Rui Signed-off-by: Perry Yuan Signed-off-by: Rafael J. Wysocki Signed-off-by: Sasha Levin --- drivers/cpufreq/amd-pstate.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/drivers/cpufreq/amd-pstate.c b/drivers/cpufreq/amd-pstate.c index 9ac75c1cde9c..365f3ad166a7 100644 --- a/drivers/cpufreq/amd-pstate.c +++ b/drivers/cpufreq/amd-pstate.c @@ -152,6 +152,7 @@ static inline int amd_pstate_enable(bool enable) static int pstate_init_perf(struct amd_cpudata *cpudata) { u64 cap1; + u32 highest_perf; int ret = rdmsrl_safe_on_cpu(cpudata->cpu, MSR_AMD_CPPC_CAP1, &cap1); @@ -163,7 +164,11 @@ static int pstate_init_perf(struct amd_cpudata *cpudata) * * CPPC entry doesn't indicate the highest performance in some ASICs. */ - WRITE_ONCE(cpudata->highest_perf, amd_get_highest_perf()); + highest_perf = amd_get_highest_perf(); + if (highest_perf > AMD_CPPC_HIGHEST_PERF(cap1)) + highest_perf = AMD_CPPC_HIGHEST_PERF(cap1); + + WRITE_ONCE(cpudata->highest_perf, highest_perf); WRITE_ONCE(cpudata->nominal_perf, AMD_CPPC_NOMINAL_PERF(cap1)); WRITE_ONCE(cpudata->lowest_nonlinear_perf, AMD_CPPC_LOWNONLIN_PERF(cap1)); @@ -175,12 +180,17 @@ static int pstate_init_perf(struct amd_cpudata *cpudata) static int cppc_init_perf(struct amd_cpudata *cpudata) { struct cppc_perf_caps cppc_perf; + u32 highest_perf; int ret = cppc_get_perf_caps(cpudata->cpu, &cppc_perf); if (ret) return ret; - WRITE_ONCE(cpudata->highest_perf, amd_get_highest_perf()); + highest_perf = amd_get_highest_perf(); + if (highest_perf > cppc_perf.highest_perf) + highest_perf = cppc_perf.highest_perf; + + WRITE_ONCE(cpudata->highest_perf, highest_perf); WRITE_ONCE(cpudata->nominal_perf, cppc_perf.nominal_perf); WRITE_ONCE(cpudata->lowest_nonlinear_perf, From patchwork Sat Oct 22 07:21: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: 7256 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1091585wrr; Sat, 22 Oct 2022 00:51:12 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4DbppZCzccj4GqXMncQHLKEkiwgyuq16DPK6PDGFkowe+75EKuIA5lYzJDOyqWgfntWdGl X-Received: by 2002:a17:90a:4888:b0:203:6d42:ccae with SMTP id b8-20020a17090a488800b002036d42ccaemr27064111pjh.166.1666425072385; Sat, 22 Oct 2022 00:51:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666425072; cv=none; d=google.com; s=arc-20160816; b=zf+DaQgdnVHeVm+3udBoxaZNo3RAuOYKoa7lajyJKYR9PrO4zfOaFAz7kYwbb5SiIB ZDvFqJWq2xwTACiKzu9+83i6YsL6OJIOKc3DLDhlOPUbtcIS97VWfNl8C0QYwNcpFYJg e6JYxp6yaGrKDwsxc//4LPSJ7yaZ+J9TzdBExn9b9/NxROHN829wFAnmJtZ8ArOy/3jx De/iMWL3KyuPcmCIsJxRsiAdqLdbCRYV8hiw6MFpwTh5lducNlQeYosWw72lcgY8FrAq zad5RhyO8Cskp0WQxCLH+jntMP8WygsF80Q//S3WTWdJdqfKREZWn+E59sjGqzIwnkP2 QynA== 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=/FSFo6mf7eMkL0wMWQgBAXbqaoy3pwSZaxsNpeXAa4g=; b=YslUtcoc6yVgC1GRPbzSi1nUZ+VgeeIsq7t5zIblSiu4sCpHNsIak/kOzJMnDaEbt1 QPcrBkUSB+/8uI48hu2bA6RQH7q2b9FuJ+C4NcqlL4DzS7to+NvdJlChUt047TXRXwGc JgBL0YvTXpygcga2t0jdykPtNm2fiYAKNRRZy+VGkbV7ALNrPG7PyEIJjC8g1ycdp1bH ca5mKo3sG0kuvB4RgM/ME1XFo58tGqtANKpII8FmD6YiY5Mwdl4TM+CVCxbbVcfz+luX fs3d5S2BRr1/IMhuVGoHH5URw7jmo2n12awPWFXGK+1ROH4yYNF/BN+p5XQywpcCesSS lXoA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=H9p8V9uc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 g188-20020a636bc5000000b004498b9c8d34si24638672pgc.682.2022.10.22.00.50.59; Sat, 22 Oct 2022 00:51: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=H9p8V9uc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231731AbiJVHuo (ORCPT + 99 others); Sat, 22 Oct 2022 03:50:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49564 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231697AbiJVHtA (ORCPT ); Sat, 22 Oct 2022 03:49: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 A8C3C24AE1A; Sat, 22 Oct 2022 00:45: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 7873F60ADA; Sat, 22 Oct 2022 07:42:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 667CEC433C1; Sat, 22 Oct 2022 07:42:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424535; bh=tsYIEnNeNXBKuktBDiK6adMOHZqbmAxFQCb+rNO0Bnc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=H9p8V9ucd7fkvjnb9j6+/VX4kSpcgClvHZ1WJ5HyTDT6kO6FEfNjaIXve1xzld5VC w8LS/HzRBwmOZD67hKHRe1z5VxKqsFwQvf4wB4ULLZCaneZoZQbfrNSmtx9HjX04j7 BC8Xfdx2Xg7rWcIRvYZDbikhX7RGOJilPOouqF5A= 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 5.19 182/717] sh: machvec: Use char[] for section boundaries Date: Sat, 22 Oct 2022 09:21:01 +0200 Message-Id: <20221022072447.821113921@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747373336614282335?= X-GMAIL-MSGID: =?utf-8?q?1747373336614282335?= 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 d606679a211e..57efaf5b82ae 100644 --- a/arch/sh/kernel/machvec.c +++ b/arch/sh/kernel/machvec.c @@ -20,8 +20,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) @@ -87,8 +87,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 @@ -102,7 +102,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; } pr_notice("Booting machvec: %s\n", get_system_type()); From patchwork Sat Oct 22 07:21: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: 7225 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1090479wrr; Sat, 22 Oct 2022 00:47:18 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7R3cS7mAYuoG1etbi3nq3MVK1cTPXmAfnDFL8294JLC6y3JpJWZjRSoxY19h6YTn7q3oZg X-Received: by 2002:a17:902:b942:b0:178:be25:203f with SMTP id h2-20020a170902b94200b00178be25203fmr23614148pls.101.1666424837825; Sat, 22 Oct 2022 00:47:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666424837; cv=none; d=google.com; s=arc-20160816; b=L9QciMKktVSWoR8I5d0xeModVb5zDsN7uqHCrEibqUjzbojAEL3PicIp5jdb+yjCCw dWieZarsd42ye2pb600V+ipdBhzytrnIu3kMMzS0jLf3Gn/Rl4nWs6A8t3fEAR+Kx9uY ZBxq29Q6MsVQ68ZX096Y8frQ1UzN6QFEXI8WoHodtgdxvrk1wvaBOJ8HUbtFm91IwhFS 8jSgM1o4t4fHCH21E5gifkpTugHoB6xc8CzqshDReq0waPKWvsQcYH1fYjrh/FCfV0NZ p+E9ZGpX6dCIn0SM8UCU+AacF7p8BTZNXEHoPU9I4w94yX6JcVuhVen9yw5BfqNzF6KO bptQ== 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=uz9v+GT12yXoTLaYmxTr871hc9O3PnUdM7KV7ZcaSpI=; b=vuyvfB347Kx4Z4ekCrcZXMah6SjqMxIXtBJOaDFwkPYlqbf/2ogBVgv9BA5tCEo0QI uuBlskbJudqsE1XTdhPK6vMMyzOaYNzkEeFwpZQMj9GKXV0kbT8DsSrBnXBtECtwcbS9 6+Rhkl9stdrQX+qBM5LIVyUCtIH3DxZfqMvdH0Pq/HElwPgQbUdvMYGSXXJiUg0Ad64R 79aDefxnJ648UUAxNZh9Nfs0vJCi1rGd/hWII6GoioDObF6phFkEUNOOyzR54lfdrPWT 3XJVasdtCD4LowEyQg9mjVaiSPB/Zd4IiWWTHkox2l0nBywjWsFeRCuCi4w5+SN0jI2+ 9Gsw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=nahiugeX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 u12-20020a056a00124c00b005669711bcabsi28861825pfi.80.2022.10.22.00.47.05; Sat, 22 Oct 2022 00:47: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=nahiugeX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S230522AbiJVHqq (ORCPT + 99 others); Sat, 22 Oct 2022 03:46:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45920 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231602AbiJVHoi (ORCPT ); Sat, 22 Oct 2022 03:44: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 5907D402E1; Sat, 22 Oct 2022 00:43: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 CD25DB82E14; Sat, 22 Oct 2022 07:42:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3E7CBC433C1; Sat, 22 Oct 2022 07:42:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424538; bh=kNhHrO3zOwOCwUFqeWaMpjDE+M8BL55uYkKdhNtLPMY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nahiugeX8xqCn8dyxr1HkKEFfgjECWxWwQ9+P81/5kxzatFbLaDBHeoBltRuZUWN0 D0hc+3iOI52yWL/vm8gVqhCsuU9hveX20V4YYlmOtNYrfE/lBGjgwJQFCtrlFGQKol eSceacViAKIEJZvAu/57AD+Wnk24j6bG7WHQsIA8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Lin Yujun , Thomas Bogendoerfer , Sasha Levin Subject: [PATCH 5.19 183/717] MIPS: SGI-IP30: Fix platform-device leak in bridge_platform_create() Date: Sat, 22 Oct 2022 09:21:02 +0200 Message-Id: <20221022072448.021112492@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747373090621709472?= X-GMAIL-MSGID: =?utf-8?q?1747373090621709472?= From: Lin Yujun [ Upstream commit 1e6d11fe72e311c1989991ee318d239f650fa318 ] In error case in bridge_platform_create after calling platform_device_add()/platform_device_add_data()/ platform_device_add_resources(), release the failed 'pdev' or it will be leak, call platform_device_put() to fix this problem. Besides, 'pdev' is divided into 'pdev_wd' and 'pdev_bd', use platform_device_unregister() to release sgi_w1 resources when xtalk-bridge registration fails. Fixes: fd27234f24ae ("MIPS: add support for SGI Octane (IP30)") Signed-off-by: Lin Yujun Signed-off-by: Thomas Bogendoerfer Signed-off-by: Sasha Levin --- arch/mips/sgi-ip30/ip30-xtalk.c | 70 +++++++++++++++++++++++---------- 1 file changed, 50 insertions(+), 20 deletions(-) diff --git a/arch/mips/sgi-ip30/ip30-xtalk.c b/arch/mips/sgi-ip30/ip30-xtalk.c index 8129524421cb..7ceb2b23ea1c 100644 --- a/arch/mips/sgi-ip30/ip30-xtalk.c +++ b/arch/mips/sgi-ip30/ip30-xtalk.c @@ -40,12 +40,15 @@ static void bridge_platform_create(int widget, int masterwid) { struct xtalk_bridge_platform_data *bd; struct sgi_w1_platform_data *wd; - struct platform_device *pdev; + struct platform_device *pdev_wd; + struct platform_device *pdev_bd; struct resource w1_res; wd = kzalloc(sizeof(*wd), GFP_KERNEL); - if (!wd) - goto no_mem; + if (!wd) { + pr_warn("xtalk:%x bridge create out of memory\n", widget); + return; + } snprintf(wd->dev_id, sizeof(wd->dev_id), "bridge-%012lx", IP30_SWIN_BASE(widget)); @@ -56,24 +59,35 @@ static void bridge_platform_create(int widget, int masterwid) w1_res.end = w1_res.start + 3; w1_res.flags = IORESOURCE_MEM; - pdev = platform_device_alloc("sgi_w1", PLATFORM_DEVID_AUTO); - if (!pdev) { - kfree(wd); - goto no_mem; + pdev_wd = platform_device_alloc("sgi_w1", PLATFORM_DEVID_AUTO); + if (!pdev_wd) { + pr_warn("xtalk:%x bridge create out of memory\n", widget); + goto err_kfree_wd; + } + if (platform_device_add_resources(pdev_wd, &w1_res, 1)) { + pr_warn("xtalk:%x bridge failed to add platform resources.\n", widget); + goto err_put_pdev_wd; + } + if (platform_device_add_data(pdev_wd, wd, sizeof(*wd))) { + pr_warn("xtalk:%x bridge failed to add platform data.\n", widget); + goto err_put_pdev_wd; + } + if (platform_device_add(pdev_wd)) { + pr_warn("xtalk:%x bridge failed to add platform device.\n", widget); + goto err_put_pdev_wd; } - platform_device_add_resources(pdev, &w1_res, 1); - platform_device_add_data(pdev, wd, sizeof(*wd)); /* platform_device_add_data() duplicates the data */ kfree(wd); - platform_device_add(pdev); bd = kzalloc(sizeof(*bd), GFP_KERNEL); - if (!bd) - goto no_mem; - pdev = platform_device_alloc("xtalk-bridge", PLATFORM_DEVID_AUTO); - if (!pdev) { - kfree(bd); - goto no_mem; + if (!bd) { + pr_warn("xtalk:%x bridge create out of memory\n", widget); + goto err_unregister_pdev_wd; + } + pdev_bd = platform_device_alloc("xtalk-bridge", PLATFORM_DEVID_AUTO); + if (!pdev_bd) { + pr_warn("xtalk:%x bridge create out of memory\n", widget); + goto err_kfree_bd; } bd->bridge_addr = IP30_RAW_SWIN_BASE(widget); @@ -93,15 +107,31 @@ static void bridge_platform_create(int widget, int masterwid) bd->io.flags = IORESOURCE_IO; bd->io_offset = IP30_SWIN_BASE(widget); - platform_device_add_data(pdev, bd, sizeof(*bd)); + if (platform_device_add_data(pdev_bd, bd, sizeof(*bd))) { + pr_warn("xtalk:%x bridge failed to add platform data.\n", widget); + goto err_put_pdev_bd; + } + if (platform_device_add(pdev_bd)) { + pr_warn("xtalk:%x bridge failed to add platform device.\n", widget); + goto err_put_pdev_bd; + } /* platform_device_add_data() duplicates the data */ kfree(bd); - platform_device_add(pdev); pr_info("xtalk:%x bridge widget\n", widget); return; -no_mem: - pr_warn("xtalk:%x bridge create out of memory\n", widget); +err_put_pdev_bd: + platform_device_put(pdev_bd); +err_kfree_bd: + kfree(bd); +err_unregister_pdev_wd: + platform_device_unregister(pdev_wd); + return; +err_put_pdev_wd: + platform_device_put(pdev_wd); +err_kfree_wd: + kfree(wd); + return; } static unsigned int __init xbow_widget_active(s8 wid) From patchwork Sat Oct 22 07:21: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: 7261 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1091710wrr; Sat, 22 Oct 2022 00:51:36 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5ugcEIcgP5fXLE+AULXaQam1b0hb7IxSbyC2YK32qtGXKjIca8ucRlkwHHO99/YXwxVI0T X-Received: by 2002:a17:902:e952:b0:17c:2eee:c0ce with SMTP id b18-20020a170902e95200b0017c2eeec0cemr23047661pll.145.1666425096356; Sat, 22 Oct 2022 00:51:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666425096; cv=none; d=google.com; s=arc-20160816; b=LcprWnG/f1zn/37qiUUgBaGst3sdS5PZkdFJTfYUNxjDkLMPuun9sRLOAecZ0/BJQZ 6TKYr32rL8TocLDh409EFkhH9OF5zVVVkYnW8NrfllZK8NSKbSx9MShau0/b1LoADynl hYx8KVa3tXd7/AgnZepX8Y3VdPKeyYysSbOmVgDC55ky3tZYFAIgmvCX2eY8k5OQrylk 0dzfKeqZwpviJcsyRU1UwGfiwIy7xjHoaTpYk59Z1yAZe6FfRyCf8bZ7f5M1JvpX072n 6/FgTsgQKdk9Dnu4cfax2VnVksBX2hMxwOhyMxKSeVnFq2+W8lWWwjkPiiYBByF5MS00 JfqA== 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=x9m6WPALQFDIMGjgpepRIbnUnUVRQtbQeXkhEKFbXv8=; b=mG+DXVtV2tyEZVW1H6LEcAGJZZSbfN+wc0USWwuSsYJmGO/UpL8zWKnaF4xWue6GB4 SQ1LPdDA1J4NfDhyD1w5lj0I3ErGk8H8h5VXeZJ6FSyWcFVoEfdVY5HZxLIvAibBSS3s OWnnBjKVADwoZ3PhBKJPaA8hHX3nQLazHOwzO2KJSj7wCNO88noPiwKG5OoqTkBp5z9g rBdPO3afZSUErPzwOmt1nMI6Xf4f8uXe3891U0d54GNZ8IKR4EJBGemXue/TY8HxeG9A 3zAG8Ab1enbXnRcg6gBE5reUFSnJkGSGIlWjqWp3PzClXumFn1Mfstfvzztr+0xin91e N+oQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=MEsPZa4Z; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 p21-20020a63e655000000b00438766f903asi27862547pgj.490.2022.10.22.00.51.23; Sat, 22 Oct 2022 00:51: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=MEsPZa4Z; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231801AbiJVHvG (ORCPT + 99 others); Sat, 22 Oct 2022 03:51:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50300 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231784AbiJVHtI (ORCPT ); Sat, 22 Oct 2022 03:49: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 2C6B145239; Sat, 22 Oct 2022 00:45: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 DCBEF60B93; Sat, 22 Oct 2022 07:42:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E7B86C433C1; Sat, 22 Oct 2022 07:42:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424541; bh=HOZhK5nwydeR/Bd8FjHVUeZa+EqAKfMdTpBZvPcFDdk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MEsPZa4ZmcqYhQbfWaEDvsiY9xm2+5xypjp9zxzQ83LpqwHrSD3qI/VZbL1wJoRHc x7hfV5TKazKJv07gEzQoLgGMlzg6fhX0PdmOT8OkZOl3hI7tri7pyYdl4uLxVTpZQ3 Hx5GkEh/Jbgyy+F9vEKwIIkP0Cu8SVzX3fm7teOk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Lin Yujun , Thomas Bogendoerfer , Sasha Levin Subject: [PATCH 5.19 184/717] MIPS: SGI-IP27: Fix platform-device leak in bridge_platform_create() Date: Sat, 22 Oct 2022 09:21:03 +0200 Message-Id: <20221022072448.224341979@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747373362008036202?= X-GMAIL-MSGID: =?utf-8?q?1747373362008036202?= From: Lin Yujun [ Upstream commit 11bec9cba4de06b3c0e9e4041453c2caaa1cbec1 ] In error case in bridge_platform_create after calling platform_device_add()/platform_device_add_data()/ platform_device_add_resources(), release the failed 'pdev' or it will be leak, call platform_device_put() to fix this problem. Besides, 'pdev' is divided into 'pdev_wd' and 'pdev_bd', use platform_device_unregister() to release sgi_w1 resources when xtalk-bridge registration fails. Fixes: 5dc76a96e95a ("MIPS: PCI: use information from 1-wire PROM for IOC3 detection") Signed-off-by: Lin Yujun Signed-off-by: Thomas Bogendoerfer Signed-off-by: Sasha Levin --- arch/mips/sgi-ip27/ip27-xtalk.c | 70 +++++++++++++++++++++++---------- 1 file changed, 50 insertions(+), 20 deletions(-) diff --git a/arch/mips/sgi-ip27/ip27-xtalk.c b/arch/mips/sgi-ip27/ip27-xtalk.c index e762886d1dda..5143d1cf8984 100644 --- a/arch/mips/sgi-ip27/ip27-xtalk.c +++ b/arch/mips/sgi-ip27/ip27-xtalk.c @@ -27,15 +27,18 @@ static void bridge_platform_create(nasid_t nasid, int widget, int masterwid) { struct xtalk_bridge_platform_data *bd; struct sgi_w1_platform_data *wd; - struct platform_device *pdev; + struct platform_device *pdev_wd; + struct platform_device *pdev_bd; struct resource w1_res; unsigned long offset; offset = NODE_OFFSET(nasid); wd = kzalloc(sizeof(*wd), GFP_KERNEL); - if (!wd) - goto no_mem; + if (!wd) { + pr_warn("xtalk:n%d/%x bridge create out of memory\n", nasid, widget); + return; + } snprintf(wd->dev_id, sizeof(wd->dev_id), "bridge-%012lx", offset + (widget << SWIN_SIZE_BITS)); @@ -46,24 +49,35 @@ static void bridge_platform_create(nasid_t nasid, int widget, int masterwid) w1_res.end = w1_res.start + 3; w1_res.flags = IORESOURCE_MEM; - pdev = platform_device_alloc("sgi_w1", PLATFORM_DEVID_AUTO); - if (!pdev) { - kfree(wd); - goto no_mem; + pdev_wd = platform_device_alloc("sgi_w1", PLATFORM_DEVID_AUTO); + if (!pdev_wd) { + pr_warn("xtalk:n%d/%x bridge create out of memory\n", nasid, widget); + goto err_kfree_wd; + } + if (platform_device_add_resources(pdev_wd, &w1_res, 1)) { + pr_warn("xtalk:n%d/%x bridge failed to add platform resources.\n", nasid, widget); + goto err_put_pdev_wd; + } + if (platform_device_add_data(pdev_wd, wd, sizeof(*wd))) { + pr_warn("xtalk:n%d/%x bridge failed to add platform data.\n", nasid, widget); + goto err_put_pdev_wd; + } + if (platform_device_add(pdev_wd)) { + pr_warn("xtalk:n%d/%x bridge failed to add platform device.\n", nasid, widget); + goto err_put_pdev_wd; } - platform_device_add_resources(pdev, &w1_res, 1); - platform_device_add_data(pdev, wd, sizeof(*wd)); /* platform_device_add_data() duplicates the data */ kfree(wd); - platform_device_add(pdev); bd = kzalloc(sizeof(*bd), GFP_KERNEL); - if (!bd) - goto no_mem; - pdev = platform_device_alloc("xtalk-bridge", PLATFORM_DEVID_AUTO); - if (!pdev) { - kfree(bd); - goto no_mem; + if (!bd) { + pr_warn("xtalk:n%d/%x bridge create out of memory\n", nasid, widget); + goto err_unregister_pdev_wd; + } + pdev_bd = platform_device_alloc("xtalk-bridge", PLATFORM_DEVID_AUTO); + if (!pdev_bd) { + pr_warn("xtalk:n%d/%x bridge create out of memory\n", nasid, widget); + goto err_kfree_bd; } @@ -84,15 +98,31 @@ static void bridge_platform_create(nasid_t nasid, int widget, int masterwid) bd->io.flags = IORESOURCE_IO; bd->io_offset = offset; - platform_device_add_data(pdev, bd, sizeof(*bd)); + if (platform_device_add_data(pdev_bd, bd, sizeof(*bd))) { + pr_warn("xtalk:n%d/%x bridge failed to add platform data.\n", nasid, widget); + goto err_put_pdev_bd; + } + if (platform_device_add(pdev_bd)) { + pr_warn("xtalk:n%d/%x bridge failed to add platform device.\n", nasid, widget); + goto err_put_pdev_bd; + } /* platform_device_add_data() duplicates the data */ kfree(bd); - platform_device_add(pdev); pr_info("xtalk:n%d/%x bridge widget\n", nasid, widget); return; -no_mem: - pr_warn("xtalk:n%d/%x bridge create out of memory\n", nasid, widget); +err_put_pdev_bd: + platform_device_put(pdev_bd); +err_kfree_bd: + kfree(bd); +err_unregister_pdev_wd: + platform_device_unregister(pdev_wd); + return; +err_put_pdev_wd: + platform_device_put(pdev_wd); +err_kfree_wd: + kfree(wd); + return; } static int probe_one_port(nasid_t nasid, int widget, int masterwid) From patchwork Sat Oct 22 07:21: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: 7258 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1091605wrr; Sat, 22 Oct 2022 00:51:16 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4A0kbMWgAwGxqQEzvP+EWbOKY7jtPBTyidf6qComjUPFDhsf8VMraOxURBoA726kNWe+bO X-Received: by 2002:a17:902:8695:b0:17f:71ed:dac1 with SMTP id g21-20020a170902869500b0017f71eddac1mr23168779plo.127.1666425076149; Sat, 22 Oct 2022 00:51:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666425076; cv=none; d=google.com; s=arc-20160816; b=KNDHmYRw8C/RQtsnCEP0YwGMPaEGWzKzp9B2Jy3PlNOxnl9m9BmYpldLEovgVUC/nK q00HOxr3K5tFbUVPCX2psmOFXBUC2DidPAZIuGEtiTjXJR4ufgRBWG85wGHNXQZZDX02 IEj8ZWlaKNnsnOPCfoRz03GdUYXqRdkloomX9hnoKTDiyqblrGM8leQh1iTBXApcAabb qc3L84j1RG0R1XSSmoAxwYpNNKKwksmZk2a9jD75QS23lBgNKQg4aV0gsLi4wX58yQz+ Q7115k+m2YXIFG0+12B5nYAN8kKYhvt5r4V5RwiiZ/+KRJJLZiWFTi427EZbqqT7Jp0i yy1w== 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=160xUj7FoYlNJDDaH0QkShc2p2Wp6ZmDJbKBrEcSaEQ=; b=bmSwNScdnuDAdVnSD3RljFz695JStw1uXNv1SaPkWP3vfF+wbRgfPmUIaBwRn8p4XZ 3O3/ctArOG4ABUekNd0EtfMVANv/Ku2HNZpYQW3ibN0JGDe5GBgsPM4/kwfEQ3FXkFe/ gJnvAq7nXnWIcGVo5E42WFiIzBelvfo4VY14DshgjyeDncVptZSj7pwQHa456UY2uFhO Hapw76kv5saPh3K+nVAURZycDzBsU5EOYFz/E9L1TtBfjplLQN345NwfnxRGr/bm0c1j cwECIFMSN7T4t6TiYqx07vvZJxP3u6yGUSvtfp/y/BG7VLsDGVk0rpu0heu/Ce27RuyL HJjg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=PLEl43DJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 a193-20020a6390ca000000b00439753f7df9si1493551pge.667.2022.10.22.00.51.03; Sat, 22 Oct 2022 00:51: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=PLEl43DJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231738AbiJVHus (ORCPT + 99 others); Sat, 22 Oct 2022 03:50:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34302 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231703AbiJVHtB (ORCPT ); Sat, 22 Oct 2022 03:49:01 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ED59A263F22; Sat, 22 Oct 2022 00:45: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 8B0C960AFD; Sat, 22 Oct 2022 07:42:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9C49BC433C1; Sat, 22 Oct 2022 07:42:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424544; bh=93Mwl/CNPEa8olUJJ5MXG4cAm7nEoQMxsfLzscJcT+g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PLEl43DJRz1tp4PyNsPW/EQ5TWIFjDGEdpp50autZqm1KM4Cx8ujaKTw6oWfSI6LF uAxUJmz19fcY1kPXaP1B4qh5rhBm7GFlMmBRtA2Go/+4nQB83V6AT2ZCMC0X2rvTqK KqZY4XLjAtsXGfLOUqRm6dO7uX1GHwVFWLVr8Luo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, syzbot+f966c13b1b4fc0403b19@syzkaller.appspotmail.com, Yue Hu , Gao Xiang , Sasha Levin Subject: [PATCH 5.19 185/717] erofs: fix order >= MAX_ORDER warning due to crafted negative i_size Date: Sat, 22 Oct 2022 09:21:04 +0200 Message-Id: <20221022072448.411194163@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747373340531128206?= X-GMAIL-MSGID: =?utf-8?q?1747373340531128206?= From: Gao Xiang [ Upstream commit 1dd73601a1cba37a0ed5f89a8662c90191df5873 ] As syzbot reported [1], the root cause is that i_size field is a signed type, and negative i_size is also less than EROFS_BLKSIZ. As a consequence, it's handled as fast symlink unexpectedly. Let's fall back to the generic path to deal with such unusual i_size. [1] https://lore.kernel.org/r/000000000000ac8efa05e7feaa1f@google.com Reported-by: syzbot+f966c13b1b4fc0403b19@syzkaller.appspotmail.com Fixes: 431339ba9042 ("staging: erofs: add inode operations") Reviewed-by: Yue Hu Link: https://lore.kernel.org/r/20220909023948.28925-1-hsiangkao@linux.alibaba.com Signed-off-by: Gao Xiang Signed-off-by: Sasha Levin --- fs/erofs/inode.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/erofs/inode.c b/fs/erofs/inode.c index 95a403720e8c..16cf9a283557 100644 --- a/fs/erofs/inode.c +++ b/fs/erofs/inode.c @@ -214,7 +214,7 @@ static int erofs_fill_symlink(struct inode *inode, void *kaddr, /* if it cannot be handled with fast symlink scheme */ if (vi->datalayout != EROFS_INODE_FLAT_INLINE || - inode->i_size >= EROFS_BLKSIZ) { + inode->i_size >= EROFS_BLKSIZ || inode->i_size < 0) { inode->i_op = &erofs_symlink_iops; return 0; } From patchwork Sat Oct 22 07:21: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: 7260 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1091691wrr; Sat, 22 Oct 2022 00:51:33 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7C9T3xl6bbYoWWL/if3w/4eaQ5qQjQ00cUeN/6gUBHlHLfMjQhr3/ouXL/O8ZTMh1xcAVK X-Received: by 2002:a17:90a:8b93:b0:20a:bd84:5182 with SMTP id z19-20020a17090a8b9300b0020abd845182mr64407234pjn.161.1666425093189; Sat, 22 Oct 2022 00:51:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666425093; cv=none; d=google.com; s=arc-20160816; b=M88hJMgjF1WGnR0dJVlpCQx3FuvyBKrfwJCQSLOP5zTRbTM9kowgQCewYXQz7POSIT HtAnHcWE+W0IqfLIIE05RVEgmt/W6s+rRbMM9kEYdGOKCKtQkPQtOFxlGgg9aoH94Hpr SazgisaQj1UYHtOYV/WIjwISC0s3q/tbZzA6na6ejgSGbm2XD7TvD0QG1CJZYirDdvtC YV+qsu8uIvpQU/NTps7xjP42gY8wNgbgpbC2pA2Tgn7uV/low8LN9LanVJQrM3ZxwOAw hl7eqCuOD3XvR+y55MqHJIrsj2etoawyF773h6vOEaBl6Tdp+dgmXgyl7WF6CIylf2dZ pQtw== 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=hkeF6aBcUll/RsHjBBYfXEHPU7uKetDCoY1j1Y+bmjE=; b=0HIxyFoaH3oC//jAnbkjJd/i7W8vUBUlTDKMI9FSSuGHK0aswhE9Qp1SEyy0QC0Lsl mPh97wdVgiCGh56CN7PRRSKP3MKfn4kWGvR1GeebHbnRvMqOIH8isixNJvwGDka9MgwT wywAsZVNH6OHDqEz97DRFpiAKd+RoWqrtrI8wBTDN1lSt+XNvUiwn44pSwkd3OE6JKM0 JeAXpRR0lJms5cF6kwLUFXkioAaMJM0hYZJiW35NVVZppGqwxbJsnK7Oau3t6/n4A1pS 0ZdNrg3krj59nn0gZ/Gnm1p4Jm3U/yiUvSr01b+iXxwNW2iVXq9clLdF5qK/EZLESdE4 zpyg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=O4KpzxkA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 w4-20020a656944000000b0046ec3bd90bbsi3259476pgq.60.2022.10.22.00.51.20; Sat, 22 Oct 2022 00:51: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=O4KpzxkA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231776AbiJVHvC (ORCPT + 99 others); Sat, 22 Oct 2022 03:51:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47526 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231773AbiJVHtH (ORCPT ); Sat, 22 Oct 2022 03:49: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 2EAF7290681; Sat, 22 Oct 2022 00:45: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 5817F60B99; Sat, 22 Oct 2022 07:42:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4258FC433D6; Sat, 22 Oct 2022 07:42:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424546; bh=xPZNmdfZfy6R68roT3NgTCf59wMzLPobvchBQEYHcy8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=O4KpzxkAJgBc/qo4eQ/zFD8cOVibSOLISg/0ZfTSiTvg9nth4t8iVfAT4h8fqcPsp ie+9ld2w49CLgu8hBslwG8B/U52i7Rq4YFCCgWdNPZbC9X1DzoZiU6EBuKGBwam0TG boLT8PpQQ0LKV2jiGUOrk51SdDK+COaOW3chqRZs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jingbo Xu , Jia Zhu , Gao Xiang , Sasha Levin Subject: [PATCH 5.19 186/717] erofs: use kill_anon_super() to kill super in fscache mode Date: Sat, 22 Oct 2022 09:21:05 +0200 Message-Id: <20221022072448.584226841@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747373358696772551?= X-GMAIL-MSGID: =?utf-8?q?1747373358696772551?= From: Jia Zhu [ Upstream commit 1015c1016c231b26d4e2c9b3da65b6c043eb97a3 ] Use kill_anon_super() instead of generic_shutdown_super() since the mount() in erofs fscache mode uses get_tree_nodev() and associated anon bdev needs to be freed. Fixes: 9c0cc9c729657 ("erofs: add 'fsid' mount option") Suggested-by: Jingbo Xu Signed-off-by: Jia Zhu Reviewed-by: Jingbo Xu Link: https://lore.kernel.org/r/20220918043456.147-2-zhujia.zj@bytedance.com Signed-off-by: Gao Xiang Signed-off-by: Sasha Levin --- fs/erofs/super.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/erofs/super.c b/fs/erofs/super.c index 95addc5c9d34..ddf8f737cfb5 100644 --- a/fs/erofs/super.c +++ b/fs/erofs/super.c @@ -877,7 +877,7 @@ static void erofs_kill_sb(struct super_block *sb) WARN_ON(sb->s_magic != EROFS_SUPER_MAGIC); if (erofs_is_fscache_mode(sb)) - generic_shutdown_super(sb); + kill_anon_super(sb); else kill_block_super(sb); From patchwork Sat Oct 22 07:21: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: 7226 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1090507wrr; Sat, 22 Oct 2022 00:47:22 -0700 (PDT) X-Google-Smtp-Source: AMsMyM705xbKFpnxP9lURi5TrfmwUF/j/2RNGHCcx0pqD1WhgebbL4Yz7Vu2uskkMi7DcJaO4cTB X-Received: by 2002:a17:902:9049:b0:180:7922:ce36 with SMTP id w9-20020a170902904900b001807922ce36mr23897359plz.30.1666424842432; Sat, 22 Oct 2022 00:47:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666424842; cv=none; d=google.com; s=arc-20160816; b=k89hHPZ7xmAAh0ksy6WjnInBVuP58gautB+QQeGXx+ISIoxNSebp0qA4KE4o/3TlyV AHdYHs89Frsg1uHz95GzGQREva9UAlIW8C7qa3LJbiOe2USrTPx4Ms3O2Cxdjush6Dc9 ceCrWhNOi3B29RAaF05rukysQMQb8Z7s9bTrAvi2ZWKHEQGL+1jJosSLHWtbUEKT4Osa DUSmXVclrzj9L0MFAsNlrmao4lwj3zzi4vQVaajZ2KfgZl+qoaErzQU/r224FSmsn4Z9 3p4DuEFpPLgyEyFuzCKhRpxeq2WSIUbI+PnoabRtM1FdueBWQa9PgYd9IX2b/mxmwL9c JsXQ== 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=4xMZv8ViEE3E0v4W3WxEk+hihv0YDpHtzrZ7rUZ5tTM=; b=un31l18Oy6KGR0Xqg6daXLrJcvXiYoA9OZ0sdcEDauosrU+V0ztTVP8HuR3X3FmSYT epV52TxN8F1Lfuwh65/98NRwsnl8rzTFeGSvI/SWDseQhMYM0pbNuKVijCAvI2PHso3K kHLXEeX7Oj4sx7S91MZI+CtWFfaFsdmgnTp3ZVKnrok6kMUmtlDyWAXCgB/TTA4L62tc ZrN84FA9blOlkE6ZYLeRIZrYGcp7D3HcPCBBl4f03Tz4WXsfHSjnFZCNwMY+gFYsGjNh FDs25y3C45a+IfgpydJ6z5sP3O/LuCCCxwJv2+Hy0Yq1yld+a8HWuse/kv+BSSBJYNKA sjCA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=wStHh8mC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 w27-20020aa79a1b000000b0056798c2f8ccsi11481892pfj.3.2022.10.22.00.47.10; Sat, 22 Oct 2022 00:47: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=wStHh8mC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231513AbiJVHqy (ORCPT + 99 others); Sat, 22 Oct 2022 03:46:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47088 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231626AbiJVHop (ORCPT ); Sat, 22 Oct 2022 03:44: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 678AE168E46; Sat, 22 Oct 2022 00:43: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 BD35FB82E13; Sat, 22 Oct 2022 07:42:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 166EAC433C1; Sat, 22 Oct 2022 07:42:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424549; bh=zg+p61KItxBrk4fp24Kbh1QhrpK1b7WGZ7RcxpNQlec=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wStHh8mCIYLT1b79UZ8PrVImQ76GsrzYHY+SdUxDMLQCfsZk0pTX1hRy7XLCkPyWh /l08m9KbyrwxM0fUCIGOasFUOTUwRfKZBgwVZDSOgghs1O7ZJESmx/l8ELIDGcxibl GWQP8WL6gORqGtvEsQIJV97tGem8fCyVsdaC22xk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org, Russell King Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Arnd Bergmann , linux-arm-kernel@lists.infradead.org, Bart Van Assche , "Russell King (Oracle)" , Sasha Levin Subject: [PATCH 5.19 187/717] ARM: 9243/1: riscpc: Unbreak the build Date: Sat, 22 Oct 2022 09:21:06 +0200 Message-Id: <20221022072448.735406798@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747373095807439292?= X-GMAIL-MSGID: =?utf-8?q?1747373095807439292?= From: Bart Van Assche [ Upstream commit 32844a8eecaa4a3e65841c53e43e04a9087d1ef6 ] This patch fixes the following build error: In file included from ./include/linux/io.h:13, from ./arch/arm/mach-rpc/include/mach/uncompress.h:9, from arch/arm/boot/compressed/misc.c:31: ./arch/arm/include/asm/io.h:85:22: error: conflicting types for ‘__raw_writeb’ 85 | #define __raw_writeb __raw_writeb | ^~~~~~~~~~~~ ./arch/arm/include/asm/io.h:86:20: note: in expansion of macro ‘__raw_writeb’ 86 | static inline void __raw_writeb(u8 val, volatile void __iomem *addr) | ^~~~~~~~~~~~ In file included from arch/arm/boot/compressed/misc.c:26: arch/arm/boot/compressed/misc-ep93xx.h:13:20: note: previous definition of ‘__raw_writeb’ was here 13 | static inline void __raw_writeb(unsigned char value, unsigned int ptr) | ^~~~~~~~~~~~ To: Russell King Cc: Arnd Bergmann Cc: linux-arm-kernel@lists.infradead.org Fixes: 0361c7e504b1 ("ARM: ep93xx: multiplatform support") Signed-off-by: Bart Van Assche Signed-off-by: Russell King (Oracle) Signed-off-by: Sasha Levin --- arch/arm/boot/compressed/misc.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/arm/boot/compressed/misc.c b/arch/arm/boot/compressed/misc.c index cb2e069dc73f..abfed1aa2baa 100644 --- a/arch/arm/boot/compressed/misc.c +++ b/arch/arm/boot/compressed/misc.c @@ -23,7 +23,9 @@ unsigned int __machine_arch_type; #include #include #include "misc.h" +#ifdef CONFIG_ARCH_EP93XX #include "misc-ep93xx.h" +#endif static void putstr(const char *ptr); From patchwork Sat Oct 22 07:21: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: 7262 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1091733wrr; Sat, 22 Oct 2022 00:51:41 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7/gGx93Kr3G7Rc0MPM67+YsHzx/T1uKh1UaCIcLZ6Z+XG9yhVOPhNIe6RcvuiDSW9aAkis X-Received: by 2002:a17:903:95:b0:186:60a7:f6c with SMTP id o21-20020a170903009500b0018660a70f6cmr12680557pld.20.1666425101615; Sat, 22 Oct 2022 00:51:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666425101; cv=none; d=google.com; s=arc-20160816; b=k57OUbC0e+HIj9vD4RHctcLdXoLb5ZkouBbv59JqbYOcVSy9Z3NQ+g+3OweQL9EZC6 bkcvhacEPC0zid7Tdwgm22Nz953VQNy9+zag8Eo1HK9Hm4UxdRN9TaqZ8v0zQ8Xkdm7b vAK6b81lNTDjuPU0wPwGgIGBelS0uTmjc1rgsDQa5fyFLMAYGeV/MqPNa1p+lLivYuXK 7Xr5MdzyMX+VZdsaBxxy/8hc2j3C3RSgrp1FJ4VH/oYnekBKq9Xns0Nx/uYh90cX9p52 LFGEmlwlG2UPGzLJmsmWvzNPJXx0NaUwmjq8IZlWEA0wl5NdY5lPQZzpwMFYVTwdpCaB lEbw== 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=lMLoWhGTwHN7J+blcoryw54qGgCC26wn8jpBjLiv2n8=; b=OuRnOwZ0j/sKY8Z9IKyMof6WenO3Iyw+aBSvHNcn4nAyiGYJgiBqQT1r/JvMyEfRxl acO3pSJ/oK1/nqla1tpSXOuR9CPUuhHLP5DN9J4AfFF7q2wOUoamXsI4yD2R0FsXHTKt S+SGkyDhCVE655HHQBlDnFOfd2ApjVUjvb78ApUoSI+d7aFXI/f7rfuHD8iXZUbUE2VA EiRHtMO/KDEOAMJc79PztX04uyvknG/CTiiQG/sN0joBHQEsHotXeCJkruqacaCiV83a E5mELXk4rUsh5g0MAS6vT4paegptIUc+uj1BYM3TT9Va5WB82tRPnmtAOzb+bIWEH6p/ +22A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="F6bj/Ti1"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 z20-20020aa78894000000b0053e7495a394si30159841pfe.141.2022.10.22.00.51.29; Sat, 22 Oct 2022 00:51: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="F6bj/Ti1"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231825AbiJVHvM (ORCPT + 99 others); Sat, 22 Oct 2022 03:51:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48372 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231787AbiJVHtJ (ORCPT ); Sat, 22 Oct 2022 03:49: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 66DDD29B88E; Sat, 22 Oct 2022 00:45: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 A25B960B8E; Sat, 22 Oct 2022 07:42:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B6BCCC433C1; Sat, 22 Oct 2022 07:42:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424552; bh=KLXaFQT2JlFqTccYwn76fcGTCiyc8m5psLPMQV9qgJ0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=F6bj/Ti1gAPx/Z2OinsRKGSK9Eca/aD2F9O7zGSQx1TqO+EDoeWc4RaUTkPalZiaF Ea103rthdWbVTvvOaIip7Uq9tH2wFhckN8GcxW3dxRqe/jI7WZp6i6D5/INbTXk2zu jqa/kQ1x1MXsJefCRFTyCl90qE2l6AcG6AKc6L1Q= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kefeng Wang , "Russell King (Oracle)" , Sasha Levin Subject: [PATCH 5.19 188/717] ARM: 9244/1: dump: Fix wrong pg_level in walk_pmd() Date: Sat, 22 Oct 2022 09:21:07 +0200 Message-Id: <20221022072448.891495010@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747373367565509528?= X-GMAIL-MSGID: =?utf-8?q?1747373367565509528?= From: Wang Kefeng [ Upstream commit 2ccd19b3ffac07cc7e75a2bd1ed779728bb67197 ] After ARM supports p4d page tables, the pg_level for note_page() in walk_pmd() should be 4, not 3, fix it. Fixes: 84e6ffb2c49c ("arm: add support for folded p4d page tables") Signed-off-by: Kefeng Wang Signed-off-by: Russell King (Oracle) Signed-off-by: Sasha Levin --- arch/arm/mm/dump.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm/mm/dump.c b/arch/arm/mm/dump.c index fb688003d156..712da6a81b23 100644 --- a/arch/arm/mm/dump.c +++ b/arch/arm/mm/dump.c @@ -346,7 +346,7 @@ static void walk_pmd(struct pg_state *st, pud_t *pud, unsigned long start) addr = start + i * PMD_SIZE; domain = get_domain_name(pmd); if (pmd_none(*pmd) || pmd_large(*pmd) || !pmd_present(*pmd)) - note_page(st, addr, 3, pmd_val(*pmd), domain); + note_page(st, addr, 4, pmd_val(*pmd), domain); else walk_pte(st, pmd, addr, domain); From patchwork Sat Oct 22 07:21: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: 7271 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1091948wrr; Sat, 22 Oct 2022 00:52:24 -0700 (PDT) X-Google-Smtp-Source: AMsMyM64Enb7IarSLGGwJDGMxr3P6ygk1HXAVDt4tp6axk1XZOBjhwOL+4YQ+9TyEEjsZqP44kYj X-Received: by 2002:a63:5950:0:b0:459:35df:3014 with SMTP id j16-20020a635950000000b0045935df3014mr19268884pgm.325.1666425144641; Sat, 22 Oct 2022 00:52:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666425144; cv=none; d=google.com; s=arc-20160816; b=vVVK00J9fxwkpIG+NdEdmbpxmux/olLnmKCoqobWSLB7GUom4xaiLb5/Y27hO6Vyu+ EpDfo8GFx+es7eKnmLK5R68gJB2Hh1/957oiLgqNE33ORXB9cntAetpiHrs2eBoWkyjg qazlL2EH0WvcdcoR7hDX00t93i7twiqu5CINmlRVBqWlLts5pS7KPnmGn5xaFpP5bz8P BHRccManlMdyV3+Hes2Gs8ELsxp8+p5EVDbom3vn3kY5aZSw7IR9PbS/dNHH4C47TzSR k8vGGUtsP65LcToVuTzPcSvepZGvbSniPLWU9eiuW1shnNVHIIOn1fMQTCFQCG1t8iO8 0YxQ== 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=i5lixvYVsdBlK0loifDO7ozXgCgIKMCzpPPt0bhwCUs=; b=J3tUTV21zQf/DFz9spKQ8tYHzuZPbjvXc1fAf0xf3NGS3sbZ7SN7Y3gznQ4TbkS5lc r8tMMTzjb7dRQWvd7zOhfx+bXYA4h+80CZrInwXl4v3pKeGUsGNRQZw0qPoQxls6kOyV XZ5UL7+nqjznPUybe1i2ut1rG13gtrxXi16xTl1KydsbGbTSY265tBp1sKkWHN3IoNIK fzb78Q2wZfe5dl/H0bGwYt0dhrLuLCv8+xlJhar/CoogBv6ay/Y06Z8QiY0tXTrX37zM mhSekI6tb1TEQ6sF/zyNfnKs6wGhRHQ94ZXrh2lWdg3BHhmCDMBjvk0Ppc3B9jgYj71t FMSQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=rdKqVC82; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 h191-20020a6383c8000000b004620970e0e9si26437241pge.116.2022.10.22.00.52.12; Sat, 22 Oct 2022 00:52: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=rdKqVC82; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S230483AbiJVHvo (ORCPT + 99 others); Sat, 22 Oct 2022 03:51:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54846 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231881AbiJVHte (ORCPT ); Sat, 22 Oct 2022 03:49:34 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2BA6529C4AF; Sat, 22 Oct 2022 00:45: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 53B1960B94; Sat, 22 Oct 2022 07:42:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5BAEDC433C1; Sat, 22 Oct 2022 07:42:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424554; bh=00HXMAn+/r8CSZi6lXNpibBGKfp4GOr5lj0UEYdGDG8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rdKqVC82vtYC9Ye4hH7D5xp5dlQMp327P0l3egW633wgD+I10t7hcUYMEj1QaOmcJ haePQwzwF7dfQWiQVMsO+eYHMVIJqqEuobGyWjwaEtcYW2amMa8sjKUJwTELbh5Iwb yk5e80r2M9oFjIQvblHUfKMfXe5MycJK3J+glZuI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kefeng Wang , "Russell King (Oracle)" , Sasha Levin Subject: [PATCH 5.19 189/717] ARM: 9247/1: mm: set readonly for MT_MEMORY_RO with ARM_LPAE Date: Sat, 22 Oct 2022 09:21:08 +0200 Message-Id: <20221022072449.041364364@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747373412311031390?= X-GMAIL-MSGID: =?utf-8?q?1747373412311031390?= From: Wang Kefeng [ Upstream commit 14ca1a4690750bb54e1049e49f3140ef48958a6e ] MT_MEMORY_RO is introduced by commit 598f0a99fa8a ("ARM: 9210/1: Mark the FDT_FIXED sections as shareable"), which is a readonly memory type for FDT area, but there are some different between ARM_LPAE and non-ARM_LPAE, we need to setup PMD_SECT_AP2 and L_PMD_SECT_RDONLY for MT_MEMORY_RO when ARM_LAPE enabled. non-ARM_LPAE 0xff800000-0xffa00000 2M PGD KERNEL ro NX SHD ARM_LPAE 0xff800000-0xffc00000 4M PMD RW NX SHD ARM_LPAE+fix 0xff800000-0xffc00000 4M PMD ro NX SHD Fixes: 598f0a99fa8a ("ARM: 9210/1: Mark the FDT_FIXED sections as shareable") Signed-off-by: Kefeng Wang Signed-off-by: Russell King (Oracle) Signed-off-by: Sasha Levin --- arch/arm/mm/mmu.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/arch/arm/mm/mmu.c b/arch/arm/mm/mmu.c index cd17e324aa51..83a91e0ab848 100644 --- a/arch/arm/mm/mmu.c +++ b/arch/arm/mm/mmu.c @@ -300,7 +300,11 @@ static struct mem_type mem_types[] __ro_after_init = { .prot_pte = L_PTE_PRESENT | L_PTE_YOUNG | L_PTE_DIRTY | L_PTE_XN | L_PTE_RDONLY, .prot_l1 = PMD_TYPE_TABLE, +#ifdef CONFIG_ARM_LPAE + .prot_sect = PMD_TYPE_SECT | L_PMD_SECT_RDONLY | PMD_SECT_AP2, +#else .prot_sect = PMD_TYPE_SECT, +#endif .domain = DOMAIN_KERNEL, }, [MT_ROM] = { From patchwork Sat Oct 22 07:21: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: 7834 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1150445wrr; Sat, 22 Oct 2022 03:58:02 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5f+TBP08ICXHuJ3fmxppSBO3TXjw77yTjHg8v0ZVGdSue6AhQLIoUGwi06Wa5ZrfMvoMs8 X-Received: by 2002:a17:907:78a:b0:78d:9ac7:b697 with SMTP id xd10-20020a170907078a00b0078d9ac7b697mr19104892ejb.457.1666436282269; Sat, 22 Oct 2022 03:58:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666436282; cv=none; d=google.com; s=arc-20160816; b=Wj8u2B4NH27yVO0lRFi6Dl5xR5iuUEjPjbZXw7HT4Xa0qusekcIYlgkzopV5hsBROG Tmvte2Lvxo8OOgfsYt4pcIQ+CDOUUGWBVz96+2mAgZA81iIfdQxo/H5EFA3EqWGTihOg yZaLvYtTw3QE1bZ8k+sCyh6ozV+ImVmY8LvNkWaU5vQCkHTl7SA30D9n+cDTYZAVlP/S F5I7ryvmWSz6cZM/vH8nky7q1lrfBud+tGwzSv/yd4okU4XxYGXwLEQlT0YJ3coxWTve p/JoAk21oKFPbswpP3uoNkUQOceaWSzqmZivr696DGXjhJPHGJjHJZW8j+N8kogkxK8g utAw== 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=nXlo97dBJgGJFNZgYXrHpgQdVUb2GgL8IZN6haLyEeE=; b=EbUC+50ECG8WfVQCElxre/+o9pWzQO6xEf4sybefqpR0fHIsReYzODYPA/zjYn6wLw x1GAz/R1TcqbsvVcAbfZ+7boEQ+7GKfmFbaXVWnp8IeabfqOzRQ2uZnrqhRIxMmLAHQi 555YMn3razwMLgxUqtN54Ccj5Wx8yU3hLoKpdEsY2vIf/4IpYIEnw+NTyvmTUXNhyCDL 6LVzMOgpQjEg5NDwxILl96GZOSEiPUcdSbHxlDIILjorIMlUkFN6BMafTv6pZ7QA9Y1H gAwV3k6aWo1fSQ2RxWFwL/MZ7XPvpsdfSekoqMeq1R0omxAKoQtAf6ttAcs3TCEqBQuI muGw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=dIS7pPwb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 hv20-20020a17090760d400b00791a67e4c00si11372233ejc.835.2022.10.22.03.57.37; Sat, 22 Oct 2022 03:58: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=dIS7pPwb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S229587AbiJVKuZ (ORCPT + 99 others); Sat, 22 Oct 2022 06:50:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59184 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229585AbiJVKuF (ORCPT ); Sat, 22 Oct 2022 06:50:05 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0039F10041D; Sat, 22 Oct 2022 03:07: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 DEE85B82DE2; Sat, 22 Oct 2022 07:42:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 56577C433D6; Sat, 22 Oct 2022 07:42:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424557; bh=njhw0LwRXIffYEP5C+Wa5eEtx0qNIV98IVTRB8jz/4A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dIS7pPwbSIna8eki4KRjbhI5p4TrC8LX4ZKI4LIu5OmYHz1WlV6ltT8/vjiFIkDWQ GL4MoGGi6eDZTfAiKh4ovISDz/lmN8xIpdqvOLtRIoUabSE0ILqUr55D+YbYuJMXXg LoeHndGkFnJ1tb15hRqur9uAP60CaG/MMt2f1a6Q= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Rafael Mendonca , Sudeep Holla , "Rafael J. Wysocki" , Sasha Levin Subject: [PATCH 5.19 190/717] ACPI: PCC: Release resources on address space setup failure path Date: Sat, 22 Oct 2022 09:21:09 +0200 Message-Id: <20221022072449.227831824@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 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?1747385091151263084?= X-GMAIL-MSGID: =?utf-8?q?1747385091151263084?= From: Rafael Mendonca [ Upstream commit f890157e61b85ce8ae01a41ffa375e3b99853698 ] The allocated memory for the pcc_data struct doesn't get freed under an error path in pcc_mbox_request_channel() or acpi_os_ioremap(). Also, the PCC mailbox channel doesn't get freed under an error path in acpi_os_ioremap(). Fixes: 77e2a04745ff8 ("ACPI: PCC: Implement OperationRegion handler for the PCC Type 3 subtype") Signed-off-by: Rafael Mendonca Reviewed-by: Sudeep Holla Signed-off-by: Rafael J. Wysocki Signed-off-by: Sasha Levin --- drivers/acpi/acpi_pcc.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/acpi/acpi_pcc.c b/drivers/acpi/acpi_pcc.c index a12b55d81209..84f1ac416b57 100644 --- a/drivers/acpi/acpi_pcc.c +++ b/drivers/acpi/acpi_pcc.c @@ -63,6 +63,7 @@ acpi_pcc_address_space_setup(acpi_handle region_handle, u32 function, if (IS_ERR(data->pcc_chan)) { pr_err("Failed to find PCC channel for subspace %d\n", ctx->subspace_id); + kfree(data); return AE_NOT_FOUND; } @@ -72,6 +73,8 @@ acpi_pcc_address_space_setup(acpi_handle region_handle, u32 function, if (!data->pcc_comm_addr) { pr_err("Failed to ioremap PCC comm region mem for %d\n", ctx->subspace_id); + pcc_mbox_free_channel(data->pcc_chan); + kfree(data); return AE_NO_MEMORY; } From patchwork Sat Oct 22 07:21: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: 7228 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1090574wrr; Sat, 22 Oct 2022 00:47:36 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5Gt0X2Z0KR0eXiwDR22Og6pn9Ys+0v5BZjkq8XqsKgX1wIm8qY+J0tCbWggYjYVRjwU3Bs X-Received: by 2002:a63:2212:0:b0:43b:f03d:856a with SMTP id i18-20020a632212000000b0043bf03d856amr19606799pgi.192.1666424855829; Sat, 22 Oct 2022 00:47:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666424855; cv=none; d=google.com; s=arc-20160816; b=kbYVe9QW3Jo4NPsVJ7sjTSaOjc0kLNrlziNS+9m6OYujGd8FAvTpfq1QyTxavhJeWS RSeUBdfUJKpd+fKGXdjo4ZbdMD0rdthdjWQq6C2Z/06QjywY0cVK38AqVkR36aWvfZQ3 x9XcQ6M0AQ4839hJVQa03zqsdvTWpskdm33mnR+4c/Z6JjWb/ByQgnyxs+eubsD1V/h4 ffBaamsyhOP2wMaGShcQR0OHmXAqHHsLMrakJU8BaPNfy7S3RN0KPkgx5NKZdReKcibm vLO0BRaGsBnvvyXQd3dpufvPX0+lELVo9/3Y8nGloUn29ieWtkbj7hLYDDGfogoiVH7p Qw+g== 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=G0xMA3E5pvJoByC07Ve/JswS6SYCKYAdI0wOjruq/9U=; b=hJwnwBVXQYc8sraUKix0NLt9UMNHSm5z7Ftn3w3Eu7Bj/R0FgJCPT0COG+Wr+VFkTZ ECqlEw7oclNpMUOJZvy3rfeO36s6VngXR6qVt73S7FZ7FwZNDGXp3yQlq6Da3Ssd0xlt Kc5JRtJhocdtxPVcfA4L8Nu3Tdcjdv3pYLWdKjC5+A/k7VNMwC1lt5PYyEngpU3jGhNK N0fWp7uHGGBfXRsnkJHGRpk9VD+doy9vS+xWKrNeZbrWofV/nSDsZz+ABIJuBO44T+ts GGlv8h5YLUsDAv2ZDqLnyEuDRVzOASaM7+HKZ343s5ee3l4ZYvxtiMIKnb/SkybGtX85 EZRw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=NfBsqYQb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 w2-20020a170902904200b00183a85a9b54si25579245plz.279.2022.10.22.00.47.23; Sat, 22 Oct 2022 00:47: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=NfBsqYQb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231156AbiJVHrA (ORCPT + 99 others); Sat, 22 Oct 2022 03:47:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35556 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231631AbiJVHop (ORCPT ); Sat, 22 Oct 2022 03:44: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 E696859EA4; Sat, 22 Oct 2022 00:43:37 -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 8BB18B82E19; Sat, 22 Oct 2022 07:42:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 002A7C433C1; Sat, 22 Oct 2022 07:42:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424560; bh=2PDkRAInx+5qdYpVRI+2RTNMv7awcytT6P1oXVUQ3zc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NfBsqYQb2/M3ES38czFoOsk7T1CH+5IfZjOlCvQHCZMmo7+FDaTHSqRYplithjnUG Khj/UI+tiPOs49yOlQyQHsXGtYWaxT6m3EwyozgIrTp4eDm9TBpNKO/sOBzR+VgsT3 cMIVP1qNK3E6XVoQf3JdNSQxYN9nA2xAW+90uK+I= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Huisong Li , Sudeep Holla , "Rafael J. Wysocki" , Sasha Levin Subject: [PATCH 5.19 191/717] ACPI: PCC: replace wait_for_completion() Date: Sat, 22 Oct 2022 09:21:10 +0200 Message-Id: <20221022072449.415628006@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747373109580472991?= X-GMAIL-MSGID: =?utf-8?q?1747373109580472991?= From: Huisong Li [ Upstream commit 91cefefb699120efd0a5ba345d12626b688f86ce ] Currently, the function waiting for completion of mailbox operation is 'wait_for_completion()'. The PCC method will be permanently blocked if this mailbox message fails to execute. So this patch replaces it with 'wait_for_completion_timeout()'. And set the timeout interval to an arbitrary retries on top of nominal to prevent the remote processor is slow to respond to PCC commands. Fixes: 77e2a04745ff ("ACPI: PCC: Implement OperationRegion handler for the PCC Type 3 subtype") Signed-off-by: Huisong Li Reviewed-by: Sudeep Holla Signed-off-by: Rafael J. Wysocki Signed-off-by: Sasha Levin --- drivers/acpi/acpi_pcc.c | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/drivers/acpi/acpi_pcc.c b/drivers/acpi/acpi_pcc.c index 84f1ac416b57..16ba875e3293 100644 --- a/drivers/acpi/acpi_pcc.c +++ b/drivers/acpi/acpi_pcc.c @@ -23,6 +23,12 @@ #include +/* + * Arbitrary retries in case the remote processor is slow to respond + * to PCC commands + */ +#define PCC_CMD_WAIT_RETRIES_NUM 500 + struct pcc_data { struct pcc_mbox_chan *pcc_chan; void __iomem *pcc_comm_addr; @@ -89,6 +95,7 @@ acpi_pcc_address_space_handler(u32 function, acpi_physical_address addr, { int ret; struct pcc_data *data = region_context; + u64 usecs_lat; reinit_completion(&data->done); @@ -99,8 +106,20 @@ acpi_pcc_address_space_handler(u32 function, acpi_physical_address addr, if (ret < 0) return AE_ERROR; - if (data->pcc_chan->mchan->mbox->txdone_irq) - wait_for_completion(&data->done); + if (data->pcc_chan->mchan->mbox->txdone_irq) { + /* + * pcc_chan->latency is just a Nominal value. In reality the remote + * processor could be much slower to reply. So add an arbitrary + * amount of wait on top of Nominal. + */ + usecs_lat = PCC_CMD_WAIT_RETRIES_NUM * data->pcc_chan->latency; + ret = wait_for_completion_timeout(&data->done, + usecs_to_jiffies(usecs_lat)); + if (ret == 0) { + pr_err("PCC command executed timeout!\n"); + return AE_TIME; + } + } mbox_client_txdone(data->pcc_chan->mchan, ret); From patchwork Sat Oct 22 07:21: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: 7266 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1091829wrr; Sat, 22 Oct 2022 00:51:59 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7DC2HBrJQCjUIR8Ip6P9AByO1kPQOJqX8aDYvf1S1vjPXrl3OfkLj0vF/NKSy9wYn4VS9G X-Received: by 2002:a17:902:a416:b0:178:a030:5f94 with SMTP id p22-20020a170902a41600b00178a0305f94mr23409685plq.162.1666425119219; Sat, 22 Oct 2022 00:51:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666425119; cv=none; d=google.com; s=arc-20160816; b=ukwTYlr+A0jHeXSotIShO/owdpthGQJWs7OlSr3Lz8qMKTPvHutGpaYGSAjCNG+XXv 8/p8XRQvKNMYcqwgvMYCyX9f4u3wxZ+neVp9jA2+SMzBliRCE1xRmz5d448H8riFDRN/ 4zc8yl8YGGlU3nD+lulx5527JTeGUGtjJ07No27cSU3BWBcZrLgD2v3NvuYgvxqby0q1 jfWyQ3zueUJV8H6jRwupybAORMsm1LNcJw2Gxd7xMcZNScNaPcmUOKDTSe6p0Wasy2za bJdvQEZU0XYRQSrCtzC9vr+gEuWZZdhFAwNLsfeqSGswiCksElNm1alwozC5kSRD7Uo8 G5Ww== 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=SPXz+2SK7iEGe/kOieE0OASf5orUj4AsgH4uWoCc/5U=; b=cP69PwPsbwbBlmOuHiHMoCnIOM1zHtGhC9jQLu04mKZsUWjKlNojUcgimIv13puUPW qwyxzMdPkRySxUM8JKaGUPxmIcnlN+SHwOu3sNCFktVjInHCxIjyOCu3myaDBou5rNrn MgBGXKODOM1aqrHT3GL9lwN1CmuWQe5c8uzp4BopyjeNjF/16X3x8vb+57os86MJBMy7 cthqtX/Mu8KY6TYkE+W70b6sbVmHET7Pk+W2drKDa/Vbl4Z2m+kAUFyrTFY+n2CU+cyQ MdjTLsA+P9JmdmygCfPPjAX5XsRmCdcaNEAP2SoWxYYxTchMRXGG0UV87STrvtpVlFPn Sk/A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=zPXCAPaI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 d2-20020a654242000000b0045c19daa33esi27791233pgq.355.2022.10.22.00.51.46; Sat, 22 Oct 2022 00:51: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=zPXCAPaI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231877AbiJVHvW (ORCPT + 99 others); Sat, 22 Oct 2022 03:51:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35674 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231833AbiJVHtS (ORCPT ); Sat, 22 Oct 2022 03:49: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 3A7EF1BB55A; Sat, 22 Oct 2022 00:45: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 519A060B09; Sat, 22 Oct 2022 07:42:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6561AC433D6; Sat, 22 Oct 2022 07:42:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424565; bh=e+Vd7JvFc0fcUes11UDUpyQCNraPicOwdsaoFGchMI0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zPXCAPaIiCP/lWC5vgyydlhydVYeNZZdUUGSP4ERgbLTD5kd43UlH8hZ5q3e8jmB7 q/ATEQdkLNYwoOEnU1n7sk0w8KuDt5zz5LQdoDGu1oAqr3p7bMVkUeNYo9j/7zbcER ZINwJ8GGPh72NdpB6hY9oGuWT2sNbAsrQZNCCWI0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Huisong Li , Sudeep Holla , "Rafael J. Wysocki" , Sasha Levin Subject: [PATCH 5.19 192/717] ACPI: PCC: Fix Tx acknowledge in the PCC address space handler Date: Sat, 22 Oct 2022 09:21:11 +0200 Message-Id: <20221022072449.554503446@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747373385617789377?= X-GMAIL-MSGID: =?utf-8?q?1747373385617789377?= From: Huisong Li [ Upstream commit 18729106c26fb97d4c9ae63ba7aba9889a058dc4 ] Currently, mbox_client_txdone() is called from the PCC address space handler and that expects the user the Tx state machine to be controlled by the client which is not the case and the below warning is thrown: | PCCT: Client can't run the TX ticker Let the controller run the state machine and the end of Tx can be acknowledge by calling mbox_chan_txdone() instead. Fixes: 77e2a04745ff ("ACPI: PCC: Implement OperationRegion handler for the PCC Type 3 subtype") Signed-off-by: Huisong Li Reviewed-by: Sudeep Holla Signed-off-by: Rafael J. Wysocki Signed-off-by: Sasha Levin --- drivers/acpi/acpi_pcc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/acpi/acpi_pcc.c b/drivers/acpi/acpi_pcc.c index 16ba875e3293..ee4ce5ba1fb2 100644 --- a/drivers/acpi/acpi_pcc.c +++ b/drivers/acpi/acpi_pcc.c @@ -121,7 +121,7 @@ acpi_pcc_address_space_handler(u32 function, acpi_physical_address addr, } } - mbox_client_txdone(data->pcc_chan->mchan, ret); + mbox_chan_txdone(data->pcc_chan->mchan, ret); memcpy_fromio(value, data->pcc_comm_addr, data->ctx.length); From patchwork Sat Oct 22 07:21: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: 7230 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1090653wrr; Sat, 22 Oct 2022 00:47:58 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5kktyqDmmujLuzV6MeSQtHkVUOTkGRjDijgl3MXfz0zWPaQSGauA32gU1YkRIKroG+eT3V X-Received: by 2002:a17:903:2450:b0:185:4165:be54 with SMTP id l16-20020a170903245000b001854165be54mr23280801pls.104.1666424877716; Sat, 22 Oct 2022 00:47:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666424877; cv=none; d=google.com; s=arc-20160816; b=dZeiO4aCQybwWk//nXRatbEZgJVOtr9Fuk3Kj0l13nabE/1BDYbQB5Of3nqzFzZwQn XNVXFc/pScIrwJS/2ZUu7OjaG+8wA0cv80Aml3np7IvfTw+zJVMofyHbccpMC7Qjo4CM B+EEzJP9j/Go80k0nGUaOWGFF24wybXaixaaju/PSbTRC7FawbhGm60+QB0E0mhk2Y59 BxRLSduCjHMWmXS4QTvxqJYlbi6kwWJ9PQCEzg6VXk9tyM1wcEllomxAT9EGkXRyD3tn fI9jAHob7/WkOVSLQ1TBX2cxgw5E5AACTqnNw7CeOs1s6YIkl5KVtNszlsVcIGvNDH9q 9qBw== 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=t05utgu4jM38zfag2flAiy1ZS5Rw35Cv58UVMurbTvw=; b=clhLNwBoOFTzoDvFOSbQ6IPIdjlrqatjJON9kFZbr7rDVp92eH/tm3Hf7FKlEbBdr+ QX/14iL7YsS0DSy2unQ0RCYTy6f2ey4t0xaZNa6Tnhb8dIo2DxJHCVx35eTOOg0ZcKVP T5mbEJaz9X177f28F3l1KiZNjmJO6KYzbf5F0syMU5SQZGCsrRSgnK0NvQEL6PSMQAfS FGhlnEn2zsr5tZYqCAEoWVzgZWJ2GxGPESSwj+46r65WzKgsRzqqaRD3OmZh4vywyMTZ PyN3lX5B5aUTrUDS+uQ4cA3qkiumBIqTzV2c94mBlrO9bmie2jsv3zC97s1msMp9uHuS FPDg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=TdIms5Me; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 z7-20020a170903018700b001781c0dda3fsi30001210plg.12.2022.10.22.00.47.44; Sat, 22 Oct 2022 00:47: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=TdIms5Me; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231546AbiJVHrJ (ORCPT + 99 others); Sat, 22 Oct 2022 03:47:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38288 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231709AbiJVHpL (ORCPT ); Sat, 22 Oct 2022 03:45: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 C8A4F8A6C2; Sat, 22 Oct 2022 00:43: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 B10BCB82E0A; Sat, 22 Oct 2022 07:42:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id ED59EC433C1; Sat, 22 Oct 2022 07:42:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424568; bh=HFFF37R3oYOiJnZ/OBH3lRHLRux8zKszRban/GNbQAA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TdIms5Mevot0585sU584EM2QOaYn77TSCuLN7biW+lmKBBFJKm1BIOKSzAoz1unT1 O+HoYgOH/jifcZtIecPZCcE9yUHuUo1aUheLrYiHKXuoa2EqxVxjEimPEKF/rVO8xy ykma1EtRBT60aKrWdHlLY/qCCcILEonJ72KLm/iI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sami Tolvanen , "Peter Zijlstra (Intel)" , Kees Cook , Sasha Levin Subject: [PATCH 5.19 193/717] objtool: Preserve special st_shndx indexes in elf_update_symbol Date: Sat, 22 Oct 2022 09:21:12 +0200 Message-Id: <20221022072449.694892946@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747373132796236038?= X-GMAIL-MSGID: =?utf-8?q?1747373132796236038?= From: Sami Tolvanen [ Upstream commit 5141d3a06b2da1731ac82091298b766a1f95d3d8 ] elf_update_symbol fails to preserve the special st_shndx values between [SHN_LORESERVE, SHN_HIRESERVE], which results in it converting SHN_ABS entries into SHN_UNDEF, for example. Explicitly check for the special indexes and ensure these symbols are not marked undefined. Fixes: ead165fa1042 ("objtool: Fix symbol creation") Signed-off-by: Sami Tolvanen Acked-by: Peter Zijlstra (Intel) Tested-by: Peter Zijlstra (Intel) Signed-off-by: Kees Cook Link: https://lore.kernel.org/r/20220908215504.3686827-17-samitolvanen@google.com Signed-off-by: Sasha Levin --- tools/objtool/elf.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tools/objtool/elf.c b/tools/objtool/elf.c index c25e957c1e52..7e24b09b1163 100644 --- a/tools/objtool/elf.c +++ b/tools/objtool/elf.c @@ -619,6 +619,11 @@ static int elf_update_symbol(struct elf *elf, struct section *symtab, Elf64_Xword entsize = symtab->sh.sh_entsize; int max_idx, idx = sym->idx; Elf_Scn *s, *t = NULL; + bool is_special_shndx = sym->sym.st_shndx >= SHN_LORESERVE && + sym->sym.st_shndx != SHN_XINDEX; + + if (is_special_shndx) + shndx = sym->sym.st_shndx; s = elf_getscn(elf->elf, symtab->idx); if (!s) { @@ -704,7 +709,7 @@ static int elf_update_symbol(struct elf *elf, struct section *symtab, } /* setup extended section index magic and write the symbol */ - if (shndx >= SHN_UNDEF && shndx < SHN_LORESERVE) { + if ((shndx >= SHN_UNDEF && shndx < SHN_LORESERVE) || is_special_shndx) { sym->sym.st_shndx = shndx; if (!shndx_data) shndx = 0; From patchwork Sat Oct 22 07:21: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: 7273 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1091985wrr; Sat, 22 Oct 2022 00:52:32 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5I9LYYeiFkn0akTrufiTdWUmd3XrRfKAOSBb/Rmvq98mge5j/N0n2aRhTiVP8J/S82XHUu X-Received: by 2002:a05:6a00:181c:b0:563:2c6c:2a7a with SMTP id y28-20020a056a00181c00b005632c6c2a7amr23199876pfa.28.1666425152022; Sat, 22 Oct 2022 00:52:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666425152; cv=none; d=google.com; s=arc-20160816; b=kUIGbN9QEBDzMt7GuOoR5TKHqk4/VspMMCDBDI2z3X4JG1lq3VimSSutJhY6TYPLGa +6xf4hhjvgYXO85fMDOoTKDGmkL0VIzGcrM7U+uILtf6G2Y9qa87K0mSxCDIaVj517yS E6noS0TnwNlpyK/K7/of/ORwaMzMr6Yoyk+JXsYvp8EqiuqkZJmBAiZTSmGHGODVA9eT j0CNvxrFtlAWNHthw0/lsIwPucdS2OfNfTBkvUqhJOwVNRpv8OBxcLkipJr+DGd6FHDk RDLZnaMsCPpAsw8wP4XHKQIURL9Qr72qk758ro/ZODtjKVU/O0+xTM1GO7VHQwPFceBx +Bjw== 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=cZofKYENmurOZTvSXKMo94k2spzaldeBtbxYDPdasCE=; b=qfKxD23foxhiHV3sk7NYyRAKNjqABiYk4Q6mGAk34hFv1TZZEvtOS7dLRmifHgPct4 NiLAsH49YICLwSjf71gG3lyMf61IOFvPO7DjtqTE4KIkQ2lPxu64TCLQJk1eHHTubwFF yde+tDyHmmIcBLRNDtHC2h/8T5c5GIbfpJlyJcunvBUxniWIUT+rJ+0sTgUojzUjz9YE RfdtKQbGYK3tTVoryUlrZEupQnfxWX10T6Pm3hw0SGwf5z+Wtg4VgRyQqTgNI0z+8ogc CfEynZ0vR8uQqpyTWrw43D9WkVcXfxJ8GtjhVRvkygAC8tzd9WUna4sL1G8/a6/lAmwh bFjw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Aw9Vx7v6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 v202-20020a6361d3000000b0046ebaed8e45si4553157pgb.62.2022.10.22.00.52.19; Sat, 22 Oct 2022 00:52: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=Aw9Vx7v6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231623AbiJVHwD (ORCPT + 99 others); Sat, 22 Oct 2022 03:52:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54862 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231891AbiJVHte (ORCPT ); Sat, 22 Oct 2022 03:49: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 6D24F2ABAAF; Sat, 22 Oct 2022 00:46: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 C6CDB60AC7; Sat, 22 Oct 2022 07:42:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D0881C433C1; Sat, 22 Oct 2022 07:42:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424571; bh=cEznBf9bvTB/4ENmafZ5o4nl4xs2vm5vB0HoS9fBxMM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Aw9Vx7v6lSeojtgWiboj3lTbGbteCGXfkyIHFunT9gxqjLwP3BT9MozBjmLFUW93J sdBVC3/SxmG171LK7CS6GhdN2+ZJvNs/dGu8F/vdPVyIBsTIC0q7l7Ir5t3qKEGdVa +AnLx36TXczexQizc9WHPUJP1yYSn5ahFT8Yiv7I= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Christophe JAILLET , Jeff Layton , Chuck Lever , Sasha Levin Subject: [PATCH 5.19 194/717] nfsd: Fix a memory leak in an error handling path Date: Sat, 22 Oct 2022 09:21:13 +0200 Message-Id: <20221022072449.851687239@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747373420193073632?= X-GMAIL-MSGID: =?utf-8?q?1747373420193073632?= From: Christophe JAILLET [ Upstream commit fd1ef88049de09bc70d60b549992524cfc0e66ff ] If this memdup_user() call fails, the memory allocated in a previous call a few lines above should be freed. Otherwise it leaks. Fixes: 6ee95d1c8991 ("nfsd: add support for upcall version 2") Signed-off-by: Christophe JAILLET Reviewed-by: Jeff Layton Signed-off-by: Chuck Lever Signed-off-by: Sasha Levin --- fs/nfsd/nfs4recover.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/fs/nfsd/nfs4recover.c b/fs/nfsd/nfs4recover.c index c634483d85d2..8f24485e0f04 100644 --- a/fs/nfsd/nfs4recover.c +++ b/fs/nfsd/nfs4recover.c @@ -815,8 +815,10 @@ __cld_pipe_inprogress_downcall(const struct cld_msg_v2 __user *cmsg, princhash.data = memdup_user( &ci->cc_princhash.cp_data, princhashlen); - if (IS_ERR_OR_NULL(princhash.data)) + if (IS_ERR_OR_NULL(princhash.data)) { + kfree(name.data); return -EFAULT; + } princhash.len = princhashlen; } else princhash.len = 0; From patchwork Sat Oct 22 07:21: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: 7314 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1093440wrr; Sat, 22 Oct 2022 00:57:18 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4K2ZzasXohaxprUXjh8rCU5B99Q2Q4R36wY9x0eO+bfBv5Adf9Cf6k36vvQsTiBRGB1qrU X-Received: by 2002:a05:6a00:1943:b0:563:8173:b46a with SMTP id s3-20020a056a00194300b005638173b46amr22749769pfk.34.1666425438484; Sat, 22 Oct 2022 00:57:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666425438; cv=none; d=google.com; s=arc-20160816; b=zTMPCSxid7u5Dsz3HQLOYjSEsvTf7EbcGj9fQUX7glPsKemu16jE/OrTEjsy1JM5Wh +rL28nAnSgs7Z6fDJg6tUhKelMMEt7TRgke959Hny0BmsHtNeXfxva/kdwuh8hUI02x0 iKMriLQa4+OdNEmnVUJ8k7JtYfCwz6G5vczm+Aw6qyEvfacvsxPkZS9brm/tofhCXx4g tIfeH+OVbf2klkEeJ1q7Gkgme13VexqUM+Kcd2ELBss29M9kh2YMclStbX/JwsTH8gVR 1mr0uJBFHFa5RqfDxRbKApQF2h+wX2IQdt70NAEe/2ZzNIgZe2Yg0G/TVPZeR6dG1Fph f27g== 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=22oRgqIlYo9nQXF/ZTBVDDa7qujvpB2JdPONsPwpRso=; b=T0He5E9IQX7n95HOw18D1UWphhHBnwONlb/lGq2gp8ASR8ez84rGqbC9WhL2ZEX/Ac lVf2FgizLUXemAAFF+8olmvS+Ln6XyAMAYLrV4Gv50BKcc/s808j49XP2qWeeNppFBG3 6aArJ/KDrJJ2LkYMgmA7qJes+DhrEIPva6cCPamzl9kFwa+VbbdgN0um9WOUC5LNKuLo Gi1wk+VyLR/in66JmVPxJ+zQIZQiiqikgHc3sEfBxhQ2GSBCHGJIiMGQso6wHMAqr0M4 EKMX2sgxrZcYNL60aqoeknEQc7Penn0lXgnKxOujxcWdmS6dQHg6sxj48ND8mf2oTyq5 nDCQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=R0KGsLZP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 m185-20020a633fc2000000b0043c69a39e26si27854573pga.215.2022.10.22.00.57.06; Sat, 22 Oct 2022 00:57: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=R0KGsLZP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S232147AbiJVH4u (ORCPT + 99 others); Sat, 22 Oct 2022 03:56:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55598 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231892AbiJVHwv (ORCPT ); Sat, 22 Oct 2022 03:52: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 65CF82C6EB9; Sat, 22 Oct 2022 00:46: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 1389960BAD; Sat, 22 Oct 2022 07:44:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 29A9AC433C1; Sat, 22 Oct 2022 07:44:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424676; bh=UCOXvJhWORPwHaVSbJcOe6oEVxI7zAC7T2lMUEbvagY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=R0KGsLZPtQjdxa7QHhx+lBNcSbOWEC4Fek+owrztrjE2t3V2J2qKaJDb9+6gL1L9p U4lFN4rAgPmAaD7w7QjhvBLdrc+TkKaCcvCqxYwaXQLQIKelX8FzY3X8bt8pX3LW8L PBgGA0mPfGZk0YXoGoEUPsR/mybnXbj1BRHxzmlI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jeff Layton , Chuck Lever , Sasha Levin Subject: [PATCH 5.19 195/717] SUNRPC: Fix svcxdr_init_decodes end-of-buffer calculation Date: Sat, 22 Oct 2022 09:21:14 +0200 Message-Id: <20221022072450.024803795@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747373720325091303?= X-GMAIL-MSGID: =?utf-8?q?1747373720325091303?= From: Chuck Lever [ Upstream commit 90bfc37b5ab91c1a6165e3e5cfc49bf04571b762 ] Ensure that stream-based argument decoding can't go past the actual end of the receive buffer. xdr_init_decode's calculation of the value of xdr->end over-estimates the end of the buffer because the Linux kernel RPC server code does not remove the size of the RPC header from rqstp->rq_arg before calling the upper layer's dispatcher. The server-side still uses the svc_getnl() macros to decode the RPC call header. These macros reduce the length of the head iov but do not update the total length of the message in the buffer (buf->len). A proper fix for this would be to replace the use of svc_getnl() and friends in the RPC header decoder, but that would be a large and invasive change that would be difficult to backport. Fixes: 5191955d6fc6 ("SUNRPC: Prepare for xdr_stream-style decoding on the server-side") Reviewed-by: Jeff Layton Signed-off-by: Chuck Lever Signed-off-by: Sasha Levin --- include/linux/sunrpc/svc.h | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/include/linux/sunrpc/svc.h b/include/linux/sunrpc/svc.h index daecb009c05b..5a830b66f059 100644 --- a/include/linux/sunrpc/svc.h +++ b/include/linux/sunrpc/svc.h @@ -544,16 +544,27 @@ static inline void svc_reserve_auth(struct svc_rqst *rqstp, int space) } /** - * svcxdr_init_decode - Prepare an xdr_stream for svc Call decoding + * svcxdr_init_decode - Prepare an xdr_stream for Call decoding * @rqstp: controlling server RPC transaction context * + * This function currently assumes the RPC header in rq_arg has + * already been decoded. Upon return, xdr->p points to the + * location of the upper layer header. */ static inline void svcxdr_init_decode(struct svc_rqst *rqstp) { struct xdr_stream *xdr = &rqstp->rq_arg_stream; - struct kvec *argv = rqstp->rq_arg.head; + struct xdr_buf *buf = &rqstp->rq_arg; + struct kvec *argv = buf->head; - xdr_init_decode(xdr, &rqstp->rq_arg, argv->iov_base, NULL); + /* + * svc_getnl() and friends do not keep the xdr_buf's ::len + * field up to date. Refresh that field before initializing + * the argument decoding stream. + */ + buf->len = buf->head->iov_len + buf->page_len + buf->tail->iov_len; + + xdr_init_decode(xdr, buf, argv->iov_base, NULL); xdr_set_scratch_page(xdr, rqstp->rq_scratch_page); } From patchwork Sat Oct 22 07:21: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: 7233 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1090733wrr; Sat, 22 Oct 2022 00:48:15 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7a/j1Th9N2XWyuXdy1A7FiDOEth8y3LH9Mzqoez6u6eKJeTFasdCRNpdymynTBvTw1ggIe X-Received: by 2002:a63:186:0:b0:442:ee11:48a5 with SMTP id 128-20020a630186000000b00442ee1148a5mr19377732pgb.284.1666424895110; Sat, 22 Oct 2022 00:48:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666424895; cv=none; d=google.com; s=arc-20160816; b=Fj7jnPvB7RCSZtH3dU/IZ0Em0o9WSH7C3qX5zIspp7EkMrIBVXijOmmyq9Ff5Jsd4J VEZcq8WWIPnAauIJrleili2TN6bd1UW5NtsXaARIlQoGS6gXXZ8arN/0D5hWJ9StHzDp otKi92BrAlY9ogUtnEYgCpwtl2VKnAhVt17l5/g3RQo/s4LJGH4ePVZ9dtmH42v7Hspa VlTxiFOzYPPyj1Mi1y/ZsenhZRjfH43gOme89GTm7gcKKKB43h9RKI4DnnOe1PxjDpf5 secbki5wN7+fpwY/aOfn3T6yIRg45EuD53OaW5OVti8f997MblOX2GP6FMaG+BHrhCJL LZvQ== 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=980rDNROEUjrgeyQd3XrtA9QDEC+IRMBBoyMetLnbVY=; b=JsbrsEd3isn9LC1X2Ce/mhn6IaCvRJ14XSooPIb6Yg0dpwj+5KgXovL3YP1bIHWucI IZPY2E9Fd/tip488845+lTbOlWgAp33WNtiw6SMYBJaCQeMsdt/z2IBxYyS8+zdm+g5t LxkRlBWePU8tvcQXQS2+8W2OlDbN4RiRwREBx1oDumrxD4T94G993oUG/OgkO57MgW4I bFQpL9M+9TBdX4L3KUhavOfKSC4ostR1Wu2n6KwxxISmu42wwI5FFFZqP/HKS+66f+F0 3LVjxu9F0lsN3bE0Hmxv2QbUC8j5GOn8Q8s0JRP9tRXOBurUzbTJ8hbyQZ0c08QkLOn/ 77vw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=mcKOlYUY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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-20020a170902b18900b0017f8d9b7e5fsi26038065plr.133.2022.10.22.00.48.02; Sat, 22 Oct 2022 00: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=mcKOlYUY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231529AbiJVHri (ORCPT + 99 others); Sat, 22 Oct 2022 03:47:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49078 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231144AbiJVHq7 (ORCPT ); Sat, 22 Oct 2022 03:46: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 266091EB54F; Sat, 22 Oct 2022 00:44: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 97ED8B82E1D; Sat, 22 Oct 2022 07:43:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DDF5AC433D6; Sat, 22 Oct 2022 07:43:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424592; bh=qVYDYelSXhkHfR0AgcNhAsoBtqPipV6eiUkZlAcvI5g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mcKOlYUY9YfFcxA+xpJEeazfq65BeEKlTNFPGt5/TlUPQeEtH1DB51L5U+rxaiScH 42tSIPgknmE9uNVlwv3q7AHlikGm/eXzc50qR2eK0xHP5WNQvMMBuEfXmd7pomPRee yYHG+SxejkSTcVjoKTCPzvbSAY3jJDzyu/wCcBak= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jeff Layton , Chuck Lever , Sasha Levin Subject: [PATCH 5.19 196/717] SUNRPC: Fix svcxdr_init_encodes buflen calculation Date: Sat, 22 Oct 2022 09:21:15 +0200 Message-Id: <20221022072450.180958596@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747373150690868077?= X-GMAIL-MSGID: =?utf-8?q?1747373150690868077?= From: Chuck Lever [ Upstream commit 1242a87da0d8cd2a428e96ca68e7ea899b0f4624 ] Commit 2825a7f90753 ("nfsd4: allow encoding across page boundaries") added an explicit computation of the remaining length in the rq_res XDR buffer. The computation appears to suffer from an "off-by-one" bug. Because buflen is too large by one page, XDR encoding can run off the end of the send buffer by eventually trying to use the struct page address in rq_page_end, which always contains NULL. Fixes: bddfdbcddbe2 ("NFSD: Extract the svcxdr_init_encode() helper") Reviewed-by: Jeff Layton Signed-off-by: Chuck Lever Signed-off-by: Sasha Levin --- include/linux/sunrpc/svc.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/linux/sunrpc/svc.h b/include/linux/sunrpc/svc.h index 5a830b66f059..0ca8a8ffb47e 100644 --- a/include/linux/sunrpc/svc.h +++ b/include/linux/sunrpc/svc.h @@ -587,7 +587,7 @@ static inline void svcxdr_init_encode(struct svc_rqst *rqstp) xdr->end = resv->iov_base + PAGE_SIZE - rqstp->rq_auth_slack; buf->len = resv->iov_len; xdr->page_ptr = buf->pages - 1; - buf->buflen = PAGE_SIZE * (1 + rqstp->rq_page_end - buf->pages); + buf->buflen = PAGE_SIZE * (rqstp->rq_page_end - buf->pages); buf->buflen -= rqstp->rq_auth_slack; xdr->rqst = NULL; } From patchwork Sat Oct 22 07:21: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: 7292 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1092789wrr; Sat, 22 Oct 2022 00:55:16 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7sHPUczsI8F5ykWSDo/f1pdXl8F4IGkNM/EhibkyH2dxhTuReMNhZ7bEu89gy6QV9ZINqv X-Received: by 2002:a17:90a:4607:b0:202:e22d:489c with SMTP id w7-20020a17090a460700b00202e22d489cmr63673314pjg.80.1666425316062; Sat, 22 Oct 2022 00:55:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666425316; cv=none; d=google.com; s=arc-20160816; b=leZfia5v+08RRCqtv3HRcNcj/q3CJLo6Jq+zLirhc9qmvLS5YRBblHOLHeZxQXbKSF zA7UCNyV4g4ffyujNrPmIQ+Ayw0d9caSTQB7pse+ARhurTCqaO8s0eN/tsM3hHifQ/uw cFrx5hCv1MC+vox1fo8NF9kQ38ouGu262ZWGhz2t4mAd0Fz+k4sXFwuZlkS6rtV+lMma dnOEAtM/6mdN/tgEhUPnHGWuKwIazXnmv2aFOVyV0lDZzYswZRs5w83npsLjBj6IfjK6 yb5vy5LUwZwmtWrBk7/LHnOuMl6ZUI11jHn+WbbrGMo/+nVOmv1iv9Qsl9xukm6tKPdD pXOQ== 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=wstaSL58UDwaZKaPtxF4K9ms4zaJOSt6ho2H/Yaoml4=; b=QDmMmOct41p3VZ55UeoqjKxP9AcCT5JM3eEg17hb/c1OdOtoCeqiApuSP4GzjOrXh/ k+abRVndccD7I2vI1sQcXWl0nKeidQ79GrI0SCcTJG9OsQmJmPg4O3t3pwDRs18FCrDv zB5yiaUa24VSdk7RwIE7GJ55QGMa7BBsjsGYCUAOZH6MGJFigl5wVzxXE9CBQDXzw9xC AP8SyezWymBW+iU+to9JzDvtC4oq/bXyDr7jGdDnL8izx7Zpf5hlcmkGEltccUylHo9G Wrj0XrRqe+JURjJ6I9biU+8uw5w8b8hZyApnekBJgm2WJzPFr6dDVlOceACWBMuiCnKm 69/g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ZzoUd26c; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 i63-20020a638742000000b0044034f2c3b8si24715573pge.310.2022.10.22.00.55.03; Sat, 22 Oct 2022 00:55: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=ZzoUd26c; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S232032AbiJVHxm (ORCPT + 99 others); Sat, 22 Oct 2022 03:53:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38542 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231893AbiJVHv1 (ORCPT ); Sat, 22 Oct 2022 03:51:27 -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 F3F362C2AF3; Sat, 22 Oct 2022 00:46: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 dfw.source.kernel.org (Postfix) with ESMTPS id B8D7460B6B; Sat, 22 Oct 2022 07:43:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A0DE4C433D6; Sat, 22 Oct 2022 07:43:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424622; bh=vvroSdVnhpOzWpAlb2Ota3DJevOUQESG8b8NQmA2ZKA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZzoUd26cmmDtzdt4T7fljJZ9Axaag8op/CxXm4TLV3rrkG8JwKpa85FrFOxd6Llj+ 94vbKNXmPfGYiaJmsavaaeaIofQg07Jw3Al0hfareDFz02CwEOKFBUa0UiWWVn8Akx VhKOBYYTTqQGVoRXBszD1CASuhGrjiK9pyiyTQgY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Chuck Lever , Jeff Layton , Sasha Levin Subject: [PATCH 5.19 197/717] NFSD: Protect against send buffer overflow in NFSv2 READDIR Date: Sat, 22 Oct 2022 09:21:16 +0200 Message-Id: <20221022072450.362303294@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747373592103222315?= X-GMAIL-MSGID: =?utf-8?q?1747373592103222315?= From: Chuck Lever [ Upstream commit 00b4492686e0497fdb924a9d4c8f6f99377e176c ] Restore the previous limit on the @count argument to prevent a buffer overflow attack. Fixes: 53b1119a6e50 ("NFSD: Fix READDIR buffer overflow") Signed-off-by: Chuck Lever Reviewed-by: Jeff Layton Signed-off-by: Chuck Lever Signed-off-by: Sasha Levin --- fs/nfsd/nfsproc.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/fs/nfsd/nfsproc.c b/fs/nfsd/nfsproc.c index 16cde315f454..f65eba938a57 100644 --- a/fs/nfsd/nfsproc.c +++ b/fs/nfsd/nfsproc.c @@ -557,12 +557,11 @@ static void nfsd_init_dirlist_pages(struct svc_rqst *rqstp, struct xdr_buf *buf = &resp->dirlist; struct xdr_stream *xdr = &resp->xdr; - count = clamp(count, (u32)(XDR_UNIT * 2), svc_max_payload(rqstp)); - memset(buf, 0, sizeof(*buf)); /* Reserve room for the NULL ptr & eof flag (-2 words) */ - buf->buflen = count - XDR_UNIT * 2; + buf->buflen = clamp(count, (u32)(XDR_UNIT * 2), (u32)PAGE_SIZE); + buf->buflen -= XDR_UNIT * 2; buf->pages = rqstp->rq_next_page; rqstp->rq_next_page++; From patchwork Sat Oct 22 07:21: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: 7288 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1092358wrr; Sat, 22 Oct 2022 00:53:53 -0700 (PDT) X-Google-Smtp-Source: AMsMyM61hFnijXzdlqE0vhtHLniEGcFea504u413xmGu+mddF1fpXtYcHcmo7ZOAXOP5zrJF9QGy X-Received: by 2002:a17:902:e88d:b0:185:3ac3:e1fd with SMTP id w13-20020a170902e88d00b001853ac3e1fdmr23495140plg.114.1666425233124; Sat, 22 Oct 2022 00:53:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666425233; cv=none; d=google.com; s=arc-20160816; b=pmGEuQWpFI5dA8Q5p+MSjAekkGyvgfFuiaU7jTkpR5Nq44n/7CoDEL7dIrLok22bYB oBrJxOiOUTPD8Hm+VRhviPazOGPwI225c1ihU5OZ11QIenR9cWDI9ckzdJ+T8tIL6TbW Epz7AhXjBAJZ29WLEcJpkpporL5CIgkdf55ACcPnZdPSr61hZ65JKxjEXnh8syaLSEVY /NkEo6dlxHhPoHxImzG7XaNxnUi2urJn3M885hAnB0ntZ5ih9/81xddTwkzj58Nx6NOI AUoT1IYFKSFn4mS9KvR9kNaX5iOC00qau2c9HEE5Pj3a4s2rmcIXt2MJdksECWGE0apE 57Dw== 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=mWNjloKPgPd4iBHya7kVtYZQfvGjUXr8ML9bpgElIyI=; b=ihDAYn7hkFH40vYVrKqwVazQs9tRHwfsqygdMzjZP4Jtl0nyiGEFEQkmllYIGjgATZ SQq/wBUM1jwkSqB1xwiscX6tizXnxYRG1GEz3LaOxEE2H0qbzj3Tr1iqEy8UVbJBBkRq BUCzCMi0QZLEhb/hmRNo/uBx0ZTEvMCI31NOAVxCLX+GgIuhpzqsAELfCaRA+0gIiuyK X6gceKUxW8tSm9+iG6yWllDof43c4iD0bMarQuoV72jlBPiAfkPqtfu4q3RNHEVUGxoK SWIYZ/mEOuWFJ4Jx6GbikAxZzIlTpz6rcHnt2Uaeh6KQpjtaPmDzsoIMDrnoXs1FoF7N 5FYQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=WNrtlmty; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 nn12-20020a17090b38cc00b002006b213af9si2528824pjb.32.2022.10.22.00.53.40; Sat, 22 Oct 2022 00:53: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=WNrtlmty; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231995AbiJVHxZ (ORCPT + 99 others); Sat, 22 Oct 2022 03:53:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47526 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231819AbiJVHvL (ORCPT ); Sat, 22 Oct 2022 03:51: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 2B890AC283; Sat, 22 Oct 2022 00:46: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 D6B0060BA0; Sat, 22 Oct 2022 07:44:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E984BC433D6; Sat, 22 Oct 2022 07:44:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424652; bh=2EhvjNtORN3r16Cix0wrloC5od6db+mEbJMl0K4QFlI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WNrtlmtya+1gue/j+IZZ75HoKc8KqvyOwsFs8Mub5TinvHDjIXYIzmoDF+JTzgD+T B9ZfLhg2YiENs35gMsyCzbo/V722z9g2uFNMKOwj6CpGkczNYSty4700mfFZptLCVF EfZg+GMRf5+oKsSqfZGy5gzAmkRfrIku4P9Id/oI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Bruce Fields , Chuck Lever , Sasha Levin Subject: [PATCH 5.19 198/717] NFSD: Fix handling of oversized NFSv4 COMPOUND requests Date: Sat, 22 Oct 2022 09:21:17 +0200 Message-Id: <20221022072450.511212061@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747373505220435445?= X-GMAIL-MSGID: =?utf-8?q?1747373505220435445?= From: Chuck Lever [ Upstream commit 7518a3dc5ea249d4112156ce71b8b184eb786151 ] If an NFS server returns NFS4ERR_RESOURCE on the first operation in an NFSv4 COMPOUND, there's no way for a client to know where the problem is and then simplify the compound to make forward progress. So instead, make NFSD process as many operations in an oversized COMPOUND as it can and then return NFS4ERR_RESOURCE on the first operation it did not process. pynfs NFSv4.0 COMP6 exercises this case, but checks only for the COMPOUND status code, not whether the server has processed any of the operations. pynfs NFSv4.1 SEQ6 and SEQ7 exercise the NFSv4.1 case, which detects too many operations per COMPOUND by checking against the limits negotiated when the session was created. Suggested-by: Bruce Fields Fixes: 0078117c6d91 ("nfsd: return RESOURCE not GARBAGE_ARGS on too many ops") Signed-off-by: Chuck Lever Signed-off-by: Sasha Levin --- fs/nfsd/nfs4proc.c | 19 +++++++++++++------ fs/nfsd/nfs4xdr.c | 12 +++--------- fs/nfsd/xdr4.h | 3 ++- 3 files changed, 18 insertions(+), 16 deletions(-) diff --git a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c index 3895eb52d2b1..c12e66cc58a2 100644 --- a/fs/nfsd/nfs4proc.c +++ b/fs/nfsd/nfs4proc.c @@ -2663,9 +2663,6 @@ nfsd4_proc_compound(struct svc_rqst *rqstp) status = nfserr_minor_vers_mismatch; if (nfsd_minorversion(nn, args->minorversion, NFSD_TEST) <= 0) goto out; - status = nfserr_resource; - if (args->opcnt > NFSD_MAX_OPS_PER_COMPOUND) - goto out; status = nfs41_check_op_ordering(args); if (status) { @@ -2678,10 +2675,20 @@ nfsd4_proc_compound(struct svc_rqst *rqstp) rqstp->rq_lease_breaker = (void **)&cstate->clp; - trace_nfsd_compound(rqstp, args->opcnt); + trace_nfsd_compound(rqstp, args->client_opcnt); while (!status && resp->opcnt < args->opcnt) { op = &args->ops[resp->opcnt++]; + if (unlikely(resp->opcnt == NFSD_MAX_OPS_PER_COMPOUND)) { + /* If there are still more operations to process, + * stop here and report NFS4ERR_RESOURCE. */ + if (cstate->minorversion == 0 && + args->client_opcnt > resp->opcnt) { + op->status = nfserr_resource; + goto encode_op; + } + } + /* * The XDR decode routines may have pre-set op->status; * for example, if there is a miscellaneous XDR error @@ -2757,8 +2764,8 @@ nfsd4_proc_compound(struct svc_rqst *rqstp) status = op->status; } - trace_nfsd_compound_status(args->opcnt, resp->opcnt, status, - nfsd4_op_name(op->opnum)); + trace_nfsd_compound_status(args->client_opcnt, resp->opcnt, + status, nfsd4_op_name(op->opnum)); nfsd4_cstate_clear_replay(cstate); nfsd4_increment_op_stats(op->opnum); diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c index 2acea7792bb2..eef98e3f4ae5 100644 --- a/fs/nfsd/nfs4xdr.c +++ b/fs/nfsd/nfs4xdr.c @@ -2347,16 +2347,10 @@ nfsd4_decode_compound(struct nfsd4_compoundargs *argp) if (xdr_stream_decode_u32(argp->xdr, &argp->minorversion) < 0) return false; - if (xdr_stream_decode_u32(argp->xdr, &argp->opcnt) < 0) + if (xdr_stream_decode_u32(argp->xdr, &argp->client_opcnt) < 0) return false; - - /* - * NFS4ERR_RESOURCE is a more helpful error than GARBAGE_ARGS - * here, so we return success at the xdr level so that - * nfsd4_proc can handle this is an NFS-level error. - */ - if (argp->opcnt > NFSD_MAX_OPS_PER_COMPOUND) - return true; + argp->opcnt = min_t(u32, argp->client_opcnt, + NFSD_MAX_OPS_PER_COMPOUND); if (argp->opcnt > ARRAY_SIZE(argp->iops)) { argp->ops = kzalloc(argp->opcnt * sizeof(*argp->ops), GFP_KERNEL); diff --git a/fs/nfsd/xdr4.h b/fs/nfsd/xdr4.h index 7b744011f2d3..77286e8c9ab0 100644 --- a/fs/nfsd/xdr4.h +++ b/fs/nfsd/xdr4.h @@ -689,9 +689,10 @@ struct nfsd4_compoundargs { struct svcxdr_tmpbuf *to_free; struct svc_rqst *rqstp; - u32 taglen; char * tag; + u32 taglen; u32 minorversion; + u32 client_opcnt; u32 opcnt; struct nfsd4_op *ops; struct nfsd4_op iops[8]; From patchwork Sat Oct 22 07:21: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: 7446 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1098396wrr; Sat, 22 Oct 2022 01:10:41 -0700 (PDT) X-Google-Smtp-Source: AMsMyM43b7m8Lw6OJGZN4qiH52soly+PGJMGgg80XfqvUP2itLL80NnG2OgwkHIU7vYDAA/TV5ij X-Received: by 2002:a17:902:b717:b0:184:4a5c:c74a with SMTP id d23-20020a170902b71700b001844a5cc74amr23582174pls.0.1666426241384; Sat, 22 Oct 2022 01:10:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666426241; cv=none; d=google.com; s=arc-20160816; b=VSB+AWsCsyXZZ243Eymb79qaOLg+N97KbRTHWQtoJ9PtFpkDCC7OIU4DOFGnp4+mEn SKyjS0oSkvWRqLGhxWX8SaNZd9lvWPLX88iOr5eLBUrOVoocOjSvnJjKhTL8WXAu+AuK 81ph2gbWOtntcMSYRz4edo6JHDETxjWFZKUKYu8w9imqO4gKiK69NfSH1AkmFy/s1IMh z6pJc9S4HVz6jkHzbPwdiYaugM/YB6NTulrD9uTc+WyPACfxuGq6mP/wPSeQeHnBflGL 2FUQ93RSbPpGSip6BC+Mw7mZ8pGSVvB228RwhjuVJM3r3Nf2AdeCQ2hyBLcq+PZaieuF 9hNg== 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=IjR25XfV5KRSyAKhUBWqq1cHW1d+VRQw41yHn52s0AQ=; b=yA38Mhu0OtsqUZZsMy6AkqGqUzu7lASjQk/2DK0cUWkmchhe6OQ5gXgo1PsGrc8Mxx aJv11P2ZU58MfbhtmcT5LSj5Jb9YrDEGrn0H6p01TlyXX3UetjKGzJLlw4kYMQXif3Im Nb13hg+6/52GNRBUmHbNVdaMP/EckR1bU9YFEI8BR/JszrEYF1hm4xdTdHate5QvLVDY xKqxPiQhHHs9YxkXrUq0z3Z/ce4djC6uOk56EGQhpcgoY7FIh3fBGq2D9GhA7IyfX9dC 9Yg7nT3ETrMPcLhJiMCImUAZivQfYx3hgL48qoXmm6/xK/z0pVCdb9LOxaDF1AV4IfAR TVDQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=YTGbQucX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 e23-20020a656897000000b004388f47a0b1si29972376pgt.572.2022.10.22.01.10.27; Sat, 22 Oct 2022 01:10: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=YTGbQucX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S233328AbiJVIJe (ORCPT + 99 others); Sat, 22 Oct 2022 04:09:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60864 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232406AbiJVIFR (ORCPT ); Sat, 22 Oct 2022 04:05:17 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3317F2C6E07; Sat, 22 Oct 2022 00:52: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 969CCB82E05; Sat, 22 Oct 2022 07:44:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 120FAC433D6; Sat, 22 Oct 2022 07:44:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424660; bh=2eafooLCWzYB3jrawTGKwYMxHojxlE96ckfg/2CLZiY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YTGbQucXIX4mC2iaKeO1TVOxWadX3v7k3Fvjd2EC/mX8GCBfiwTkgARF9mSfDDYHz 06bcLLZvnlMOS7LG3fk7DCdgDNyFbNsRFhDhvs+CBax+Qgk/oFPxa9YMCOfZ7Vf/Bn kYao5NtlSvAGUD8Mta+aP12ABmMr457+uqaTA264= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Bill Wendling , Juergen Gross , Kees Cook , Sasha Levin , Nathan Chancellor Subject: [PATCH 5.19 199/717] x86/paravirt: add extra clobbers with ZERO_CALL_USED_REGS enabled Date: Sat, 22 Oct 2022 09:21:18 +0200 Message-Id: <20221022072450.677685116@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747374562313450954?= X-GMAIL-MSGID: =?utf-8?q?1747374562313450954?= From: Bill Wendling [ Upstream commit 8c86f29bfb18465d15b05cfd26a6454ec787b793 ] The ZERO_CALL_USED_REGS feature may zero out caller-saved registers before returning. In spurious_kernel_fault(), the "pte_offset_kernel()" call results in this assembly code: .Ltmp151: #APP # ALT: oldnstr .Ltmp152: .Ltmp153: .Ltmp154: .section .discard.retpoline_safe,"",@progbits .quad .Ltmp154 .text callq *pv_ops+536(%rip) .Ltmp155: .section .parainstructions,"a",@progbits .p2align 3, 0x0 .quad .Ltmp153 .byte 67 .byte .Ltmp155-.Ltmp153 .short 1 .text .Ltmp156: # ALT: padding .zero (-(((.Ltmp157-.Ltmp158)-(.Ltmp156-.Ltmp152))>0))*((.Ltmp157-.Ltmp158)-(.Ltmp156-.Ltmp152)),144 .Ltmp159: .section .altinstructions,"a",@progbits .Ltmp160: .long .Ltmp152-.Ltmp160 .Ltmp161: .long .Ltmp158-.Ltmp161 .short 33040 .byte .Ltmp159-.Ltmp152 .byte .Ltmp157-.Ltmp158 .text .section .altinstr_replacement,"ax",@progbits # ALT: replacement 1 .Ltmp158: movq %rdi, %rax .Ltmp157: .text #NO_APP .Ltmp162: testb $-128, %dil The "testb" here is using %dil, but the %rdi register was cleared before returning from "callq *pv_ops+536(%rip)". Adding the proper constraints results in the use of a different register: movq %r11, %rdi # Similar to above. testb $-128, %r11b Link: https://github.com/KSPP/linux/issues/192 Signed-off-by: Bill Wendling Reported-and-tested-by: Nathan Chancellor Fixes: 035f7f87b729 ("randstruct: Enable Clang support") Reviewed-by: Juergen Gross Link: https://lore.kernel.org/lkml/fa6df43b-8a1a-8ad1-0236-94d2a0b588fa@suse.com/ Signed-off-by: Kees Cook Link: https://lore.kernel.org/r/20220902213750.1124421-3-morbo@google.com Signed-off-by: Sasha Levin --- arch/x86/include/asm/paravirt_types.h | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/arch/x86/include/asm/paravirt_types.h b/arch/x86/include/asm/paravirt_types.h index 89df6c6617f5..bc2e1b67319d 100644 --- a/arch/x86/include/asm/paravirt_types.h +++ b/arch/x86/include/asm/paravirt_types.h @@ -414,8 +414,17 @@ int paravirt_disable_iospace(void); "=c" (__ecx) #define PVOP_CALL_CLOBBERS PVOP_VCALL_CLOBBERS, "=a" (__eax) -/* void functions are still allowed [re]ax for scratch */ +/* + * void functions are still allowed [re]ax for scratch. + * + * The ZERO_CALL_USED REGS feature may end up zeroing out callee-saved + * registers. Make sure we model this with the appropriate clobbers. + */ +#ifdef CONFIG_ZERO_CALL_USED_REGS +#define PVOP_VCALLEE_CLOBBERS "=a" (__eax), PVOP_VCALL_CLOBBERS +#else #define PVOP_VCALLEE_CLOBBERS "=a" (__eax) +#endif #define PVOP_CALLEE_CLOBBERS PVOP_VCALLEE_CLOBBERS #define EXTRA_CLOBBERS , "r8", "r9", "r10", "r11" From patchwork Sat Oct 22 07:21: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: 7296 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1092948wrr; Sat, 22 Oct 2022 00:55:36 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7GypDOKveB2u5+9Ux/DLNEKdGlrKLvaBAGzPyYu94KIGXfeE7QQrAK9jyVE7c3MrAgOJkY X-Received: by 2002:a17:90b:17d2:b0:20d:6c68:6df8 with SMTP id me18-20020a17090b17d200b0020d6c686df8mr26406972pjb.54.1666425336678; Sat, 22 Oct 2022 00:55:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666425336; cv=none; d=google.com; s=arc-20160816; b=AlLndpeauqO50RJY65TqG7GA+1bl5gwkfZAqVB6qWqGVUi9Yzup+cDi/8HgMjokB7X GHmCXFIxFwtsysHwcpPdPEMiA5VoZ/oOyuME0tNHL3J8jFp6Wwj1QWc/DSe85/JZa6QT fROgDeyqAybhNkv6qdOmeJHtpUMmksxJDfbv2v0EkVVUmc9W+tRpcRddoRmmZ8Suh4Jy mApTxeC4Bvl66XtVenvl+BGYgiVFM6aIC8De5wGrokP4mlkAs/uDu/G9EkcGFeQUM7Ai xGVNw/c7HE3C5tQ6Nnzn56WyQ/i8dMm7KKvmYOnccphS52C598HKz0KkQ8ZQEhAgr1Lz 89pQ== 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=2ju0xb5J/7LgCjsTM1mnaFCYDOqG0uHEgD1DoR6rxkE=; b=ARsmkf/aRdBd+1A5M86S6RH/hZtqs7mhdylYryiJ+3NcLOwSuIOuj2iuNXHE/PKSoc TUu1BaItqttT6WS+M9AqbaIv1x5/noRFjYq46gjRL350O9WaLTuNcdexRttvS9CkBD55 Gy/AA2YxTiqf7yb96fuzBbuOpwIbqcxnXzpFRJzb/W9CRKPfHZ3VufgvaGrRH8POdF0T kAwuSjgtZDJMT/twK1A1G3pbX8ZLpQq5sF66RsyzZ9+IWONpVgkz7YCDzXOqtzoiQeLw H8pW4blaTHcsWQ4fg7sFDqX+yAKracDgiV6YC0n8zP9JHKl5KAQtMxbs359sdyv8VVAZ tLVA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=rc9BGQ6K; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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-20020a17090301cc00b00176a16ca9b1si30633478plh.529.2022.10.22.00.55.22; Sat, 22 Oct 2022 00:55: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=rc9BGQ6K; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231810AbiJVHzG (ORCPT + 99 others); Sat, 22 Oct 2022 03:55:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58264 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231983AbiJVHv7 (ORCPT ); Sat, 22 Oct 2022 03: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 D0DA92C1735; Sat, 22 Oct 2022 00:46:37 -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 CA12D60ADC; Sat, 22 Oct 2022 07:44:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DD1CEC433D6; Sat, 22 Oct 2022 07:44:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424663; bh=HBbeeWj5cCSDh5GVLlnZ/XVO+E/RGuJ2akvlL/0LNDQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rc9BGQ6KkGb5FpQq3VY2swsJRoa06cQMNqj7bI3KJArKr8T8iRLeFwO5Fs3fwIS7E zGX++K8t1xwGEHjGvybXWMjt0eRToBlhVPY4Uqm4iTv7nsbeDxTDGUDhxC8gy3u/Ei CuC4JhLBp4aw+YMGm9EaLI4nXgfRylTWARvBx3yk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ping-Ke Shih , Kalle Valo , Sasha Levin Subject: [PATCH 5.19 200/717] wifi: rtlwifi: 8192de: correct checking of IQK reload Date: Sat, 22 Oct 2022 09:21:19 +0200 Message-Id: <20221022072450.817790259@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747373613459681036?= X-GMAIL-MSGID: =?utf-8?q?1747373613459681036?= From: Ping-Ke Shih [ Upstream commit 93fbc1ebd978cf408ef5765e9c1630fce9a8621b ] Since IQK could spend time, we make a cache of IQK result matrix that looks like iqk_matrix[channel_idx].val[x][y], and we can reload the matrix if we have made a cache. To determine a cache is made, we check iqk_matrix[channel_idx].val[0][0]. The initial commit 7274a8c22980 ("rtlwifi: rtl8192de: Merge phy routines") make a mistake that checks incorrect iqk_matrix[channel_idx].val[0] that is always true, and this mistake is found by commit ee3db469dd31 ("wifi: rtlwifi: remove always-true condition pointed out by GCC 12"), so I recall the vendor driver to find fix and apply the correctness. Fixes: 7274a8c22980 ("rtlwifi: rtl8192de: Merge phy routines") Signed-off-by: Ping-Ke Shih Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/20220801113345.42016-1-pkshih@realtek.com Signed-off-by: Sasha Levin --- drivers/net/wireless/realtek/rtlwifi/rtl8192de/phy.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192de/phy.c b/drivers/net/wireless/realtek/rtlwifi/rtl8192de/phy.c index 15e6a6aded31..d18c092b6142 100644 --- a/drivers/net/wireless/realtek/rtlwifi/rtl8192de/phy.c +++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192de/phy.c @@ -2386,11 +2386,10 @@ void rtl92d_phy_reload_iqk_setting(struct ieee80211_hw *hw, u8 channel) rtl_dbg(rtlpriv, COMP_SCAN, DBG_LOUD, "Just Read IQK Matrix reg for channel:%d....\n", channel); - _rtl92d_phy_patha_fill_iqk_matrix(hw, true, - rtlphy->iqk_matrix[ - indexforchannel].value, 0, - (rtlphy->iqk_matrix[ - indexforchannel].value[0][2] == 0)); + if (rtlphy->iqk_matrix[indexforchannel].value[0][0] != 0) + _rtl92d_phy_patha_fill_iqk_matrix(hw, true, + rtlphy->iqk_matrix[indexforchannel].value, 0, + rtlphy->iqk_matrix[indexforchannel].value[0][2] == 0); if (IS_92D_SINGLEPHY(rtlhal->version)) { if ((rtlphy->iqk_matrix[ indexforchannel].value[0][4] != 0) From patchwork Sat Oct 22 07:21: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: 7259 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1091632wrr; Sat, 22 Oct 2022 00:51:23 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4ehIGPBpG2Om1yCeAT0VP9u7QMwLAQtPzg4Zxw0ZSsO+3Cbog3hVF9+fHxQCy+7VGrx5FL X-Received: by 2002:a17:903:32c9:b0:186:883f:ffdb with SMTP id i9-20020a17090332c900b00186883fffdbmr3252820plr.135.1666425082599; Sat, 22 Oct 2022 00:51:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666425082; cv=none; d=google.com; s=arc-20160816; b=mA0FHfpzie3CRD4EobsaYphmzV0JsreX0F/fUjIynoZOt/CONMc9OR3rqBXAZomUIw HJYDNEldqzrtwNZhYsomBcIu5NvTiiQ7U+CSOm753n/lE/UbHB2sahb/JW4V41UAHO2W 8yoK8UcQoTDoisqUAnoQRwrDBvpk9SFO4Sqt1ISD/L/sEo8A5ANEdGD4TI9if7SquINC s3J7+D32m54EpW2Nfy1MwSuY7wTTxhoCVpbZohPLtq4vltNKsapAvx9vSEqQ+hVZuniD VTMYClgB7JmHZoPlMSQHizG1CUJHqrhquYzOdwFqac8piOZ3HdizXORdnG6JHthBGX4C SUxA== 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=2CscDqEezkaKvYtfX/0WTdOaeNjXb4cQnf2ocI9CtGo=; b=q2s52yr+2MLWSq2FNNqXr8r48hI/9r1HoX4YjLJf+k7qGo/PU95DMGaRtg26yfOx7E 0PeCKctYdp5BF8uL38cjCp056Sqrg6AT9vYpBCNsdK+2zJadX7jw/4Ks2PLIOOPkwRud B0cDR6fNwldXDTFaHiHEfFZpPMj3VIR+ZVxaTKpwk1i0+itV4rsH42cXrdkOA3UxCUpM 58XnetrYTcNOEU+pnSs3oQLpErixW8j+XLVGNf7FU53Oeyl/L674AMQVLJvJy1e57i5n WfEB2mYc0CETo5r5VWtmsJN3mFFEWBgCBF9tXFrQXzAOcAFRmUjxX0QdZPnohOmdNyp5 6TUQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Icf0Q84W; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 bd1-20020a170902830100b0017ab01a9cb4si24964055plb.317.2022.10.22.00.51.09; Sat, 22 Oct 2022 00:51: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=Icf0Q84W; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231465AbiJVHuy (ORCPT + 99 others); Sat, 22 Oct 2022 03:50:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43748 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231722AbiJVHtC (ORCPT ); Sat, 22 Oct 2022 03:49:02 -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 11DB9253BE6; Sat, 22 Oct 2022 00:45: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 13C9CB82E11; Sat, 22 Oct 2022 07:44:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7CE1BC433D6; Sat, 22 Oct 2022 07:44:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424665; bh=B9Crd4kZ7xxEIngssS4tZiODPInOvcl9djs8Lvm56gQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Icf0Q84WsezApliw3j1e93wNrcxwvOM7k4exINpwyk4kwXK3xBIr/l5/fgRJJ0US/ yGzPFTaMp/rTx8eXzNQxoHxLDrlI35OM8cC6iefdG3Ha4UiCtyWRWv/vUWpu73aotr rnoS61bobNpEKxZ4YEFf/A0HpBwNO3zOyk40AXhI= 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 5.19 201/717] wifi: ath10k: add peer map clean up for peer delete in ath10k_sta_state() Date: Sat, 22 Oct 2022 09:21:20 +0200 Message-Id: <20221022072450.954387549@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747373347545868909?= X-GMAIL-MSGID: =?utf-8?q?1747373347545868909?= 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 6407f509e91b..9a1c970f8f55 100644 --- a/drivers/net/wireless/ath/ath10k/mac.c +++ b/drivers/net/wireless/ath/ath10k/mac.c @@ -864,11 +864,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); @@ -880,25 +905,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); } @@ -7586,10 +7593,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 Sat Oct 22 07:21: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: 7303 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1093168wrr; Sat, 22 Oct 2022 00:56:14 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7iUvR0a4T5O+UCa8A/de2QNuJ68DP4CvwFfVAz3GOZkGhkcOEmFL/LbmEY+pYZhyNYLso8 X-Received: by 2002:a17:902:f60c:b0:17c:163f:c0a8 with SMTP id n12-20020a170902f60c00b0017c163fc0a8mr22446199plg.38.1666425374583; Sat, 22 Oct 2022 00:56:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666425374; cv=none; d=google.com; s=arc-20160816; b=ViFqKUK2gZOzd30QSbGPUZKTDOb3lrcx/ehPzbp8P+SSMjBx2/dkfLWnfxfIOBYk+p GxrI1D1Wk2DJw6V6CYd4+7d9Hy6VHj0cKixKXSCNlZLxbZkOHOTlyB17agtSw8ACugn2 sKqVIWFVgSaW4g5PqC08D5fysO1+QSxPsfrf/ElDODmEXroFr74XF+62VBg65WoUbU4j 819DDzMtg/WZ3d/J0+19KVwFC9w/kgxU7+HXW3tmCUU4MkzmOWSdcvfnk3MOBNvOEoTH SoqYf3REIeT/wUpakPzsG7r9PuoBsJesk/tDHQhb5AJ4CMJY9L9fhrM54/BtyJ0XHPT4 bFqw== 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=fiYyvn+hx4RJ00F+eHrUzmaJYEuuRN5XWESqs8GLjZw=; b=X2HWhaIgvqjSlIMODmC4aAfkv1eagoWAy1BswyDv7DOK4hDPUAX3RB58mK9KPcqlDV uUDoPx/Vh3FnhQ5b3LAhVSOX7LDEoK7HxOOMnmKbFv7uLrd9nXILPqkSuekWP/gOdRCQ /sE2k4/eGsivksIpESnII/doOrxRM/x9PhDLndnq448Y6ry6I6mm4iQLwxy/pxjYC4gs 5rDHmCw0+yKdgkRPVauO9N/Yt5VFCO0RpSD7lyHUYRHJcOGauDx2iPnnLAlXJltW9YMd 6+YTKc2V7uUI8iWd3n8iaEWGFDPdcyKfjTxCRwNtkaFhEHyXW9ip8upy4Bn0cMmV4Ujb X5Xw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=w4nzGHsB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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-20020a65538b000000b0045c398db4e6si28258005pgq.600.2022.10.22.00.56.01; Sat, 22 Oct 2022 00:56: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=w4nzGHsB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S232142AbiJVHzs (ORCPT + 99 others); Sat, 22 Oct 2022 03:55:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54850 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231755AbiJVHwg (ORCPT ); Sat, 22 Oct 2022 03:52: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 170655A140; Sat, 22 Oct 2022 00:46: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 1F4EF60BA3; Sat, 22 Oct 2022 07:44:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2D75AC433D6; Sat, 22 Oct 2022 07:44:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424668; bh=N/eEKm28DGri4kRdFiJuk/ocMDA5G7uunqNFPqEF9o8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=w4nzGHsBrCX6AqB7B3z8riz9bPqqZ1t7ZuduoCeaAr7ccaFMljzv0BH0JZJAARo3q hU8vkb2QSmF9ump4OhYl7okojCAGdh4OvLNSpwMj/wnLlzZgjrCV7/fyh4ml1fwFVx oyglqkaEdlvSqBK+qZVCB7N9dGbYbkgXed/SRzCA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, kernel test robot , Joanne Koong , Daniel Borkmann , Sasha Levin Subject: [PATCH 5.19 202/717] bpf: Fix non-static bpf_func_proto struct definitions Date: Sat, 22 Oct 2022 09:21:21 +0200 Message-Id: <20221022072451.091195507@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747373653335735117?= X-GMAIL-MSGID: =?utf-8?q?1747373653335735117?= From: Joanne Koong [ Upstream commit dc368e1c658e4f478a45e8d1d5b0c8392ca87506 ] This patch does two things: 1) Marks the dynptr bpf_func_proto structs that were added in [1] as static, as pointed out by the kernel test robot in [2]. 2) There are some bpf_func_proto structs marked as extern which can instead be statically defined. [1] https://lore.kernel.org/bpf/20220523210712.3641569-1-joannelkoong@gmail.com/ [2] https://lore.kernel.org/bpf/62ab89f2.Pko7sI08RAKdF8R6%25lkp@intel.com/ Reported-by: kernel test robot Signed-off-by: Joanne Koong Signed-off-by: Daniel Borkmann Link: https://lore.kernel.org/bpf/20220616225407.1878436-1-joannelkoong@gmail.com Stable-dep-of: 883743422ced ("bpf: Fix ref_obj_id for dynptr data slices in verifier") Signed-off-by: Sasha Levin --- include/linux/bpf.h | 3 --- kernel/bpf/helpers.c | 12 ++++++------ kernel/bpf/syscall.c | 2 +- 3 files changed, 7 insertions(+), 10 deletions(-) diff --git a/include/linux/bpf.h b/include/linux/bpf.h index ed352c00330c..647438166558 100644 --- a/include/linux/bpf.h +++ b/include/linux/bpf.h @@ -2273,12 +2273,9 @@ extern const struct bpf_func_proto bpf_for_each_map_elem_proto; extern const struct bpf_func_proto bpf_btf_find_by_name_kind_proto; extern const struct bpf_func_proto bpf_sk_setsockopt_proto; extern const struct bpf_func_proto bpf_sk_getsockopt_proto; -extern const struct bpf_func_proto bpf_kallsyms_lookup_name_proto; extern const struct bpf_func_proto bpf_find_vma_proto; extern const struct bpf_func_proto bpf_loop_proto; -extern const struct bpf_func_proto bpf_strncmp_proto; extern const struct bpf_func_proto bpf_copy_from_user_task_proto; -extern const struct bpf_func_proto bpf_kptr_xchg_proto; const struct bpf_func_proto *tracing_prog_func_proto( enum bpf_func_id func_id, const struct bpf_prog *prog); diff --git a/kernel/bpf/helpers.c b/kernel/bpf/helpers.c index fb03f40116eb..ed7649b04704 100644 --- a/kernel/bpf/helpers.c +++ b/kernel/bpf/helpers.c @@ -584,7 +584,7 @@ BPF_CALL_3(bpf_strncmp, const char *, s1, u32, s1_sz, const char *, s2) return strncmp(s1, s2, s1_sz); } -const struct bpf_func_proto bpf_strncmp_proto = { +static const struct bpf_func_proto bpf_strncmp_proto = { .func = bpf_strncmp, .gpl_only = false, .ret_type = RET_INTEGER, @@ -1402,7 +1402,7 @@ BPF_CALL_2(bpf_kptr_xchg, void *, map_value, void *, ptr) */ #define BPF_PTR_POISON ((void *)((0xeB9FUL << 2) + POISON_POINTER_DELTA)) -const struct bpf_func_proto bpf_kptr_xchg_proto = { +static const struct bpf_func_proto bpf_kptr_xchg_proto = { .func = bpf_kptr_xchg, .gpl_only = false, .ret_type = RET_PTR_TO_BTF_ID_OR_NULL, @@ -1489,7 +1489,7 @@ BPF_CALL_4(bpf_dynptr_from_mem, void *, data, u32, size, u64, flags, struct bpf_ return err; } -const struct bpf_func_proto bpf_dynptr_from_mem_proto = { +static const struct bpf_func_proto bpf_dynptr_from_mem_proto = { .func = bpf_dynptr_from_mem, .gpl_only = false, .ret_type = RET_INTEGER, @@ -1516,7 +1516,7 @@ BPF_CALL_5(bpf_dynptr_read, void *, dst, u32, len, struct bpf_dynptr_kern *, src return 0; } -const struct bpf_func_proto bpf_dynptr_read_proto = { +static const struct bpf_func_proto bpf_dynptr_read_proto = { .func = bpf_dynptr_read, .gpl_only = false, .ret_type = RET_INTEGER, @@ -1544,7 +1544,7 @@ BPF_CALL_5(bpf_dynptr_write, struct bpf_dynptr_kern *, dst, u32, offset, void *, return 0; } -const struct bpf_func_proto bpf_dynptr_write_proto = { +static const struct bpf_func_proto bpf_dynptr_write_proto = { .func = bpf_dynptr_write, .gpl_only = false, .ret_type = RET_INTEGER, @@ -1572,7 +1572,7 @@ BPF_CALL_3(bpf_dynptr_data, struct bpf_dynptr_kern *, ptr, u32, offset, u32, len return (unsigned long)(ptr->data + ptr->offset + offset); } -const struct bpf_func_proto bpf_dynptr_data_proto = { +static const struct bpf_func_proto bpf_dynptr_data_proto = { .func = bpf_dynptr_data, .gpl_only = false, .ret_type = RET_PTR_TO_DYNPTR_MEM_OR_NULL, diff --git a/kernel/bpf/syscall.c b/kernel/bpf/syscall.c index d334aeb23407..7a3444988c84 100644 --- a/kernel/bpf/syscall.c +++ b/kernel/bpf/syscall.c @@ -5138,7 +5138,7 @@ BPF_CALL_4(bpf_kallsyms_lookup_name, const char *, name, int, name_sz, int, flag return *res ? 0 : -ENOENT; } -const struct bpf_func_proto bpf_kallsyms_lookup_name_proto = { +static const struct bpf_func_proto bpf_kallsyms_lookup_name_proto = { .func = bpf_kallsyms_lookup_name, .gpl_only = false, .ret_type = RET_INTEGER, From patchwork Sat Oct 22 07:21: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: 7293 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1092847wrr; Sat, 22 Oct 2022 00:55:22 -0700 (PDT) X-Google-Smtp-Source: AMsMyM56/d6dHuTtVgzinWikAKrC+iKJ4sT9XvuJ8bLhMInk1WgicOzpP8bQYEhixlqQlgM2vfYu X-Received: by 2002:a17:90a:65c7:b0:20f:8385:cc18 with SMTP id i7-20020a17090a65c700b0020f8385cc18mr26586766pjs.235.1666425322160; Sat, 22 Oct 2022 00:55:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666425322; cv=none; d=google.com; s=arc-20160816; b=oe1OqdaobqD90E/AG4QBLWSnYWO8PRe7KAgyYBYZO7HFMe0WcjZSSZTgJJnQgXCbmI LTN/OXnapIFMcGRDmAr5dzFQaEtdyjquB42ik7mPtWdUZReSXJ3FNWNo+47vZR/xXoNl jk2EWxokeLNXEHZSeQCP/MeM5O3aEA6vF3CWoWZiWRgvHbTUpgrzn2Xjs1Y+CmTyhH3+ hTGubzaOG+L4xBCijyUV117DVpW4UepmGgF659lUvHwVhGrmvcvhMDOhred92vZlbrmT sxULXuovCenKShSXDoHXxTvUxjyPytpGNX7A2F8MYaz/s5ksGrcWCbFWp8Yha/b3RHfJ vT8Q== 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=nNDlU3vMA3VsOSoCQo0/6RThmXqAF/k67KJ9UpqRLXw=; b=JV89CjLyWuG7Z5DorGuc1e3GIQU33vjPbH2EGDlr07I+FYwm934Hhb4T9GqwSPvCVq QkY6+PEmZpAcven6ENKZHH1gTUG0d5ij1wD6xs8aTstEpEPtEocJt5NcMjTmH1fY6i/5 lAz57J17+1JSM4e1A4HS6IaJLNM1p484lD0SM9tjfplQZdeYGZ7fDJurl1LoiytUn5V+ la/llZiyYBbhhE4RSLVT5uDhFBM4awwmlx7OnVPNuW7Sm7gkvEOlJecmJqumSj1AsCed d7F07kKDCu87dUAyrm5JxJxQe54bhJdZdh5QZPEovIjx3rdGs3l0SDeP+ffUTVo0v0BK hrvQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=lnaZPnoY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 g6-20020a656cc6000000b0041b7be8ef1csi27811045pgw.219.2022.10.22.00.55.09; Sat, 22 Oct 2022 00:55: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=lnaZPnoY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S232055AbiJVHxx (ORCPT + 99 others); Sat, 22 Oct 2022 03:53:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49562 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231965AbiJVHvl (ORCPT ); Sat, 22 Oct 2022 03:51:41 -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 4677CAC28D; Sat, 22 Oct 2022 00:46: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 B613860B9A; Sat, 22 Oct 2022 07:44:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C0E50C433D6; Sat, 22 Oct 2022 07:44:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424671; bh=5kUA82APk8VdKEjBwR4yCepGh5EvqYWfXL3WKCiPSwY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lnaZPnoY9I6z+n97felTw+4/vY8a7b6cZ6DW1B84U0LKqo3hYPzAYB6f6v2HKpR+8 xAo4wCDmofN+nLIBVTA5VXR2YdwYqDlESG8IPhiq4sKeN4v4BIp9Nk9o9d4OBRmU+U oxPgW8CS/5DaMKcU4kUgFQ1TyYSZbgiGKkpv961c= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jakub Sitnicki , Martin KaFai Lau , Stanislav Fomichev , Alexei Starovoitov , Sasha Levin Subject: [PATCH 5.19 203/717] bpf: convert cgroup_bpf.progs to hlist Date: Sat, 22 Oct 2022 09:21:22 +0200 Message-Id: <20221022072451.265679285@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747373598829526152?= X-GMAIL-MSGID: =?utf-8?q?1747373598829526152?= From: Stanislav Fomichev [ Upstream commit 00442143a2ab7f1da46fbf4d2a99c85df767d49a ] This lets us reclaim some space to be used by new cgroup lsm slots. Before: struct cgroup_bpf { struct bpf_prog_array * effective[23]; /* 0 184 */ /* --- cacheline 2 boundary (128 bytes) was 56 bytes ago --- */ struct list_head progs[23]; /* 184 368 */ /* --- cacheline 8 boundary (512 bytes) was 40 bytes ago --- */ u32 flags[23]; /* 552 92 */ /* XXX 4 bytes hole, try to pack */ /* --- cacheline 10 boundary (640 bytes) was 8 bytes ago --- */ struct list_head storages; /* 648 16 */ struct bpf_prog_array * inactive; /* 664 8 */ struct percpu_ref refcnt; /* 672 16 */ struct work_struct release_work; /* 688 32 */ /* size: 720, cachelines: 12, members: 7 */ /* sum members: 716, holes: 1, sum holes: 4 */ /* last cacheline: 16 bytes */ }; After: struct cgroup_bpf { struct bpf_prog_array * effective[23]; /* 0 184 */ /* --- cacheline 2 boundary (128 bytes) was 56 bytes ago --- */ struct hlist_head progs[23]; /* 184 184 */ /* --- cacheline 5 boundary (320 bytes) was 48 bytes ago --- */ u8 flags[23]; /* 368 23 */ /* XXX 1 byte hole, try to pack */ /* --- cacheline 6 boundary (384 bytes) was 8 bytes ago --- */ struct list_head storages; /* 392 16 */ struct bpf_prog_array * inactive; /* 408 8 */ struct percpu_ref refcnt; /* 416 16 */ struct work_struct release_work; /* 432 72 */ /* size: 504, cachelines: 8, members: 7 */ /* sum members: 503, holes: 1, sum holes: 1 */ /* last cacheline: 56 bytes */ }; Suggested-by: Jakub Sitnicki Reviewed-by: Jakub Sitnicki Reviewed-by: Martin KaFai Lau Signed-off-by: Stanislav Fomichev Link: https://lore.kernel.org/r/20220628174314.1216643-3-sdf@google.com Signed-off-by: Alexei Starovoitov Stable-dep-of: 883743422ced ("bpf: Fix ref_obj_id for dynptr data slices in verifier") Signed-off-by: Sasha Levin --- include/linux/bpf-cgroup-defs.h | 4 +- include/linux/bpf-cgroup.h | 2 +- kernel/bpf/cgroup.c | 76 +++++++++++++++++++-------------- 3 files changed, 47 insertions(+), 35 deletions(-) diff --git a/include/linux/bpf-cgroup-defs.h b/include/linux/bpf-cgroup-defs.h index 695d1224a71b..5d268e76d8e6 100644 --- a/include/linux/bpf-cgroup-defs.h +++ b/include/linux/bpf-cgroup-defs.h @@ -47,8 +47,8 @@ struct cgroup_bpf { * have either zero or one element * when BPF_F_ALLOW_MULTI the list can have up to BPF_CGROUP_MAX_PROGS */ - struct list_head progs[MAX_CGROUP_BPF_ATTACH_TYPE]; - u32 flags[MAX_CGROUP_BPF_ATTACH_TYPE]; + struct hlist_head progs[MAX_CGROUP_BPF_ATTACH_TYPE]; + u8 flags[MAX_CGROUP_BPF_ATTACH_TYPE]; /* list of cgroup shared storages */ struct list_head storages; diff --git a/include/linux/bpf-cgroup.h b/include/linux/bpf-cgroup.h index 669d96d074ad..6673acfbf2ef 100644 --- a/include/linux/bpf-cgroup.h +++ b/include/linux/bpf-cgroup.h @@ -95,7 +95,7 @@ struct bpf_cgroup_link { }; struct bpf_prog_list { - struct list_head node; + struct hlist_node node; struct bpf_prog *prog; struct bpf_cgroup_link *link; struct bpf_cgroup_storage *storage[MAX_BPF_CGROUP_STORAGE_TYPE]; diff --git a/kernel/bpf/cgroup.c b/kernel/bpf/cgroup.c index 34dfa45ef4f3..13526b01f1fd 100644 --- a/kernel/bpf/cgroup.c +++ b/kernel/bpf/cgroup.c @@ -157,11 +157,12 @@ static void cgroup_bpf_release(struct work_struct *work) mutex_lock(&cgroup_mutex); for (atype = 0; atype < ARRAY_SIZE(cgrp->bpf.progs); atype++) { - struct list_head *progs = &cgrp->bpf.progs[atype]; - struct bpf_prog_list *pl, *pltmp; + struct hlist_head *progs = &cgrp->bpf.progs[atype]; + struct bpf_prog_list *pl; + struct hlist_node *pltmp; - list_for_each_entry_safe(pl, pltmp, progs, node) { - list_del(&pl->node); + hlist_for_each_entry_safe(pl, pltmp, progs, node) { + hlist_del(&pl->node); if (pl->prog) bpf_prog_put(pl->prog); if (pl->link) @@ -217,12 +218,12 @@ static struct bpf_prog *prog_list_prog(struct bpf_prog_list *pl) /* count number of elements in the list. * it's slow but the list cannot be long */ -static u32 prog_list_length(struct list_head *head) +static u32 prog_list_length(struct hlist_head *head) { struct bpf_prog_list *pl; u32 cnt = 0; - list_for_each_entry(pl, head, node) { + hlist_for_each_entry(pl, head, node) { if (!prog_list_prog(pl)) continue; cnt++; @@ -291,7 +292,7 @@ static int compute_effective_progs(struct cgroup *cgrp, if (cnt > 0 && !(p->bpf.flags[atype] & BPF_F_ALLOW_MULTI)) continue; - list_for_each_entry(pl, &p->bpf.progs[atype], node) { + hlist_for_each_entry(pl, &p->bpf.progs[atype], node) { if (!prog_list_prog(pl)) continue; @@ -342,7 +343,7 @@ int cgroup_bpf_inherit(struct cgroup *cgrp) cgroup_bpf_get(p); for (i = 0; i < NR; i++) - INIT_LIST_HEAD(&cgrp->bpf.progs[i]); + INIT_HLIST_HEAD(&cgrp->bpf.progs[i]); INIT_LIST_HEAD(&cgrp->bpf.storages); @@ -418,7 +419,7 @@ static int update_effective_progs(struct cgroup *cgrp, #define BPF_CGROUP_MAX_PROGS 64 -static struct bpf_prog_list *find_attach_entry(struct list_head *progs, +static struct bpf_prog_list *find_attach_entry(struct hlist_head *progs, struct bpf_prog *prog, struct bpf_cgroup_link *link, struct bpf_prog *replace_prog, @@ -428,12 +429,12 @@ static struct bpf_prog_list *find_attach_entry(struct list_head *progs, /* single-attach case */ if (!allow_multi) { - if (list_empty(progs)) + if (hlist_empty(progs)) return NULL; - return list_first_entry(progs, typeof(*pl), node); + return hlist_entry(progs->first, typeof(*pl), node); } - list_for_each_entry(pl, progs, node) { + hlist_for_each_entry(pl, progs, node) { if (prog && pl->prog == prog && prog != replace_prog) /* disallow attaching the same prog twice */ return ERR_PTR(-EINVAL); @@ -444,7 +445,7 @@ static struct bpf_prog_list *find_attach_entry(struct list_head *progs, /* direct prog multi-attach w/ replacement case */ if (replace_prog) { - list_for_each_entry(pl, progs, node) { + hlist_for_each_entry(pl, progs, node) { if (pl->prog == replace_prog) /* a match found */ return pl; @@ -480,7 +481,7 @@ static int __cgroup_bpf_attach(struct cgroup *cgrp, struct bpf_cgroup_storage *new_storage[MAX_BPF_CGROUP_STORAGE_TYPE] = {}; enum cgroup_bpf_attach_type atype; struct bpf_prog_list *pl; - struct list_head *progs; + struct hlist_head *progs; int err; if (((flags & BPF_F_ALLOW_OVERRIDE) && (flags & BPF_F_ALLOW_MULTI)) || @@ -503,7 +504,7 @@ static int __cgroup_bpf_attach(struct cgroup *cgrp, if (!hierarchy_allows_attach(cgrp, atype)) return -EPERM; - if (!list_empty(progs) && cgrp->bpf.flags[atype] != saved_flags) + if (!hlist_empty(progs) && cgrp->bpf.flags[atype] != saved_flags) /* Disallow attaching non-overridable on top * of existing overridable in this cgroup. * Disallow attaching multi-prog if overridable or none @@ -525,12 +526,22 @@ static int __cgroup_bpf_attach(struct cgroup *cgrp, if (pl) { old_prog = pl->prog; } else { + struct hlist_node *last = NULL; + pl = kmalloc(sizeof(*pl), GFP_KERNEL); if (!pl) { bpf_cgroup_storages_free(new_storage); return -ENOMEM; } - list_add_tail(&pl->node, progs); + if (hlist_empty(progs)) + hlist_add_head(&pl->node, progs); + else + hlist_for_each(last, progs) { + if (last->next) + continue; + hlist_add_behind(&pl->node, last); + break; + } } pl->prog = prog; @@ -556,7 +567,7 @@ static int __cgroup_bpf_attach(struct cgroup *cgrp, } bpf_cgroup_storages_free(new_storage); if (!old_prog) { - list_del(&pl->node); + hlist_del(&pl->node); kfree(pl); } return err; @@ -587,7 +598,7 @@ static void replace_effective_prog(struct cgroup *cgrp, struct cgroup_subsys_state *css; struct bpf_prog_array *progs; struct bpf_prog_list *pl; - struct list_head *head; + struct hlist_head *head; struct cgroup *cg; int pos; @@ -603,7 +614,7 @@ static void replace_effective_prog(struct cgroup *cgrp, continue; head = &cg->bpf.progs[atype]; - list_for_each_entry(pl, head, node) { + hlist_for_each_entry(pl, head, node) { if (!prog_list_prog(pl)) continue; if (pl->link == link) @@ -637,7 +648,7 @@ static int __cgroup_bpf_replace(struct cgroup *cgrp, enum cgroup_bpf_attach_type atype; struct bpf_prog *old_prog; struct bpf_prog_list *pl; - struct list_head *progs; + struct hlist_head *progs; bool found = false; atype = to_cgroup_bpf_attach_type(link->type); @@ -649,7 +660,7 @@ static int __cgroup_bpf_replace(struct cgroup *cgrp, if (link->link.prog->type != new_prog->type) return -EINVAL; - list_for_each_entry(pl, progs, node) { + hlist_for_each_entry(pl, progs, node) { if (pl->link == link) { found = true; break; @@ -688,7 +699,7 @@ static int cgroup_bpf_replace(struct bpf_link *link, struct bpf_prog *new_prog, return ret; } -static struct bpf_prog_list *find_detach_entry(struct list_head *progs, +static struct bpf_prog_list *find_detach_entry(struct hlist_head *progs, struct bpf_prog *prog, struct bpf_cgroup_link *link, bool allow_multi) @@ -696,14 +707,14 @@ static struct bpf_prog_list *find_detach_entry(struct list_head *progs, struct bpf_prog_list *pl; if (!allow_multi) { - if (list_empty(progs)) + if (hlist_empty(progs)) /* report error when trying to detach and nothing is attached */ return ERR_PTR(-ENOENT); /* to maintain backward compatibility NONE and OVERRIDE cgroups * allow detaching with invalid FD (prog==NULL) in legacy mode */ - return list_first_entry(progs, typeof(*pl), node); + return hlist_entry(progs->first, typeof(*pl), node); } if (!prog && !link) @@ -713,7 +724,7 @@ static struct bpf_prog_list *find_detach_entry(struct list_head *progs, return ERR_PTR(-EINVAL); /* find the prog or link and detach it */ - list_for_each_entry(pl, progs, node) { + hlist_for_each_entry(pl, progs, node) { if (pl->prog == prog && pl->link == link) return pl; } @@ -737,7 +748,7 @@ static void purge_effective_progs(struct cgroup *cgrp, struct bpf_prog *prog, struct cgroup_subsys_state *css; struct bpf_prog_array *progs; struct bpf_prog_list *pl; - struct list_head *head; + struct hlist_head *head; struct cgroup *cg; int pos; @@ -754,7 +765,7 @@ static void purge_effective_progs(struct cgroup *cgrp, struct bpf_prog *prog, continue; head = &cg->bpf.progs[atype]; - list_for_each_entry(pl, head, node) { + hlist_for_each_entry(pl, head, node) { if (!prog_list_prog(pl)) continue; if (pl->prog == prog && pl->link == link) @@ -793,7 +804,7 @@ static int __cgroup_bpf_detach(struct cgroup *cgrp, struct bpf_prog *prog, enum cgroup_bpf_attach_type atype; struct bpf_prog *old_prog; struct bpf_prog_list *pl; - struct list_head *progs; + struct hlist_head *progs; u32 flags; atype = to_cgroup_bpf_attach_type(type); @@ -824,9 +835,10 @@ static int __cgroup_bpf_detach(struct cgroup *cgrp, struct bpf_prog *prog, } /* now can actually delete it from this cgroup list */ - list_del(&pl->node); + hlist_del(&pl->node); + kfree(pl); - if (list_empty(progs)) + if (hlist_empty(progs)) /* last program was detached, reset flags to zero */ cgrp->bpf.flags[atype] = 0; if (old_prog) @@ -854,7 +866,7 @@ static int __cgroup_bpf_query(struct cgroup *cgrp, const union bpf_attr *attr, enum bpf_attach_type type = attr->query.attach_type; enum cgroup_bpf_attach_type atype; struct bpf_prog_array *effective; - struct list_head *progs; + struct hlist_head *progs; struct bpf_prog *prog; int cnt, ret = 0, i; u32 flags; @@ -893,7 +905,7 @@ static int __cgroup_bpf_query(struct cgroup *cgrp, const union bpf_attr *attr, u32 id; i = 0; - list_for_each_entry(pl, progs, node) { + hlist_for_each_entry(pl, progs, node) { prog = prog_list_prog(pl); id = prog->aux->id; if (copy_to_user(prog_ids + i, &id, sizeof(id))) From patchwork Sat Oct 22 07:21: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: 7313 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1093436wrr; Sat, 22 Oct 2022 00:57:17 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7Ge7hxEgvqpZO6RSbXaKGF5K7C497t9je2Z4czcH7AMVcjgq6eRnGsWDUyU0Yl2pYLQIJR X-Received: by 2002:a17:90b:d98:b0:212:d3f9:c311 with SMTP id bg24-20020a17090b0d9800b00212d3f9c311mr6885295pjb.243.1666425437187; Sat, 22 Oct 2022 00:57:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666425437; cv=none; d=google.com; s=arc-20160816; b=DfmqFaXFWKxVpFDi5adn0/RCHWqQZNFBUs5aU7zayxu1RT2Yjii1rQbnktuzM0BWe1 9sHNBrxBCibjN4yq+r1BMXiMX7BdQ81HP7+mh0u8MbpWV7hYaKREyqdmc9jo9eVfY/Nk KBCF2Elq0wikhwz8IP/6JIt3PY7DRJLSZVc6kQoxrrwytaP4J5VvWXgVZO5+M5SbABCj ANgc7bwaBfgSCu4iEvnc8WxxSsCluF9InkIVzk/AAj/pSAYhFyffaz3i/p+rFljCD8Sf Gz94qNJiR1Z98FPCugnaw0a0YJloTCu4iZPLxgmgxHjAErpog3szPdHiLhpdiZIPjxgn b1Xg== 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=lt88/wpmAxTvSLxAaHniIFjPWJipwNoBJ2358PxSpbo=; b=sqRzMWHRJoQKLMX69SXbf5czRfYRLe4Oxzta+l8T8BIiyhBU4hr2c7SC38HsdjDOis YV8rBTCrmSeC98qXcAYS2yKCxgu72sOYAYbcNAPIot4SQvMwxc2muKVsjnnRD2ViUleo 6EdaiChaHOLWeDq+Yo24hfmQ5UOYKetwHp0MQ9NoznpbaYs1Nj1S9Np7/bTKldfJBe0s 2790CrSSENL4zcczsek//3buNpyG+AbrBs2azW9uQaVqJyr7+19XZCzxFcOrj1/wvTEe qZBDL55FafceFP+7Q1YSGoEBdkRlxLj4nqhGDpaQY914dsSnWN3GVnPalkqtnN8R9kTj dEIg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=NaVKzwL0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 c19-20020a63ea13000000b00434dfe7b75esi25495581pgi.223.2022.10.22.00.57.04; Sat, 22 Oct 2022 00:57: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=NaVKzwL0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S232065AbiJVH4g (ORCPT + 99 others); Sat, 22 Oct 2022 03:56:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42732 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231856AbiJVHwt (ORCPT ); Sat, 22 Oct 2022 03:52:49 -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 1C0472C5010; Sat, 22 Oct 2022 00:46: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 5654960B0C; Sat, 22 Oct 2022 07:44:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6D4D2C433C1; Sat, 22 Oct 2022 07:44:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424673; bh=Kqj41S+V63UtDdNsvtO1ZA3eW/sA9t6K52qQFyV2Jps=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NaVKzwL0oaxpFu0b5uglzE+1a912Nxar8UdIFSzWEl0usgxHRvGW7OLf2EWSSktYZ nJjCddBe0+zmNnIpE5BfbpUI7vgau00AoMERVL1yELqPRzgGm8cQE91JZ3l2Isx8RQ j0aGnlDnqfeED0P1q8PNo15Otj9X2LzwbdR3Cc3c= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dave Marchevsky , Martin KaFai Lau , Joanne Koong , Kumar Kartikeya Dwivedi , Alexei Starovoitov , Sasha Levin Subject: [PATCH 5.19 204/717] bpf: Cleanup check_refcount_ok Date: Sat, 22 Oct 2022 09:21:23 +0200 Message-Id: <20221022072451.465748454@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747373719108769665?= X-GMAIL-MSGID: =?utf-8?q?1747373719108769665?= From: Dave Marchevsky [ Upstream commit b2d8ef19c6e7ed71ba5092feb0710063a751834f ] Discussion around a recently-submitted patch provided historical context for check_refcount_ok [0]. Specifically, the function and its helpers - may_be_acquire_function and arg_type_may_be_refcounted - predate the OBJ_RELEASE type flag and the addition of many more helpers with acquire/release semantics. The purpose of check_refcount_ok is to ensure: 1) Helper doesn't have multiple uses of return reg's ref_obj_id 2) Helper with release semantics only has one arg needing to be released, since that's tracked using meta->ref_obj_id With current verifier, it's safe to remove check_refcount_ok and its helpers. Since addition of OBJ_RELEASE type flag, case 2) has been handled by the arg_type_is_release check in check_func_arg. To ensure case 1) won't result in verifier silently prioritizing one use of ref_obj_id, this patch adds a helper_multiple_ref_obj_use check which fails loudly if a helper passes > 1 test for use of ref_obj_id. [0]: lore.kernel.org/bpf/20220713234529.4154673-1-davemarchevsky@fb.com Signed-off-by: Dave Marchevsky Acked-by: Martin KaFai Lau Acked-by: Joanne Koong Acked-by: Kumar Kartikeya Dwivedi Link: https://lore.kernel.org/r/20220808171559.3251090-1-davemarchevsky@fb.com Signed-off-by: Alexei Starovoitov Stable-dep-of: 883743422ced ("bpf: Fix ref_obj_id for dynptr data slices in verifier") Signed-off-by: Sasha Levin --- kernel/bpf/verifier.c | 74 +++++++++++++++++-------------------------- 1 file changed, 29 insertions(+), 45 deletions(-) diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c index 339147061127..210793b5cd6c 100644 --- a/kernel/bpf/verifier.c +++ b/kernel/bpf/verifier.c @@ -467,25 +467,11 @@ static bool type_is_rdonly_mem(u32 type) return type & MEM_RDONLY; } -static bool arg_type_may_be_refcounted(enum bpf_arg_type type) -{ - return type == ARG_PTR_TO_SOCK_COMMON; -} - static bool type_may_be_null(u32 type) { return type & PTR_MAYBE_NULL; } -static bool may_be_acquire_function(enum bpf_func_id func_id) -{ - return func_id == BPF_FUNC_sk_lookup_tcp || - func_id == BPF_FUNC_sk_lookup_udp || - func_id == BPF_FUNC_skc_lookup_tcp || - func_id == BPF_FUNC_map_lookup_elem || - func_id == BPF_FUNC_ringbuf_reserve; -} - static bool is_acquire_function(enum bpf_func_id func_id, const struct bpf_map *map) { @@ -518,6 +504,26 @@ static bool is_ptr_cast_function(enum bpf_func_id func_id) func_id == BPF_FUNC_skc_to_tcp_request_sock; } +static bool is_dynptr_acquire_function(enum bpf_func_id func_id) +{ + return func_id == BPF_FUNC_dynptr_data; +} + +static bool helper_multiple_ref_obj_use(enum bpf_func_id func_id, + const struct bpf_map *map) +{ + int ref_obj_uses = 0; + + if (is_ptr_cast_function(func_id)) + ref_obj_uses++; + if (is_acquire_function(func_id, map)) + ref_obj_uses++; + if (is_dynptr_acquire_function(func_id)) + ref_obj_uses++; + + return ref_obj_uses > 1; +} + static bool is_cmpxchg_insn(const struct bpf_insn *insn) { return BPF_CLASS(insn->code) == BPF_STX && @@ -6456,33 +6462,6 @@ static bool check_arg_pair_ok(const struct bpf_func_proto *fn) return true; } -static bool check_refcount_ok(const struct bpf_func_proto *fn, int func_id) -{ - int count = 0; - - if (arg_type_may_be_refcounted(fn->arg1_type)) - count++; - if (arg_type_may_be_refcounted(fn->arg2_type)) - count++; - if (arg_type_may_be_refcounted(fn->arg3_type)) - count++; - if (arg_type_may_be_refcounted(fn->arg4_type)) - count++; - if (arg_type_may_be_refcounted(fn->arg5_type)) - count++; - - /* A reference acquiring function cannot acquire - * another refcounted ptr. - */ - if (may_be_acquire_function(func_id) && count) - return false; - - /* We only support one arg being unreferenced at the moment, - * which is sufficient for the helper functions we have right now. - */ - return count <= 1; -} - static bool check_btf_id_ok(const struct bpf_func_proto *fn) { int i; @@ -6506,8 +6485,7 @@ static int check_func_proto(const struct bpf_func_proto *fn, int func_id, { return check_raw_mode_ok(fn) && check_arg_pair_ok(fn) && - check_btf_id_ok(fn) && - check_refcount_ok(fn, func_id) ? 0 : -EINVAL; + check_btf_id_ok(fn) ? 0 : -EINVAL; } /* Packet data might have moved, any old PTR_TO_PACKET[_META,_END] @@ -7410,6 +7388,12 @@ static int check_helper_call(struct bpf_verifier_env *env, struct bpf_insn *insn if (type_may_be_null(regs[BPF_REG_0].type)) regs[BPF_REG_0].id = ++env->id_gen; + if (helper_multiple_ref_obj_use(func_id, meta.map_ptr)) { + verbose(env, "verifier internal error: func %s#%d sets ref_obj_id more than once\n", + func_id_name(func_id), func_id); + return -EFAULT; + } + if (is_ptr_cast_function(func_id)) { /* For release_reference() */ regs[BPF_REG_0].ref_obj_id = meta.ref_obj_id; @@ -7422,10 +7406,10 @@ static int check_helper_call(struct bpf_verifier_env *env, struct bpf_insn *insn regs[BPF_REG_0].id = id; /* For release_reference() */ regs[BPF_REG_0].ref_obj_id = id; - } else if (func_id == BPF_FUNC_dynptr_data) { + } else if (is_dynptr_acquire_function(func_id)) { int dynptr_id = 0, i; - /* Find the id of the dynptr we're acquiring a reference to */ + /* Find the id of the dynptr we're tracking the reference of */ for (i = 0; i < MAX_BPF_FUNC_REG_ARGS; i++) { if (arg_type_is_dynptr(fn->arg_type[i])) { if (dynptr_id) { From patchwork Sat Oct 22 07:21: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: 7274 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1092017wrr; Sat, 22 Oct 2022 00:52:40 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7UorEqS9fbupYbVZqiZ84R7DJQ4ijzwLL0i0NOnNPvfo4iOgdWe8hrO5ooHMbqL4X9Iz3T X-Received: by 2002:a17:90b:3e83:b0:212:de17:952c with SMTP id rj3-20020a17090b3e8300b00212de17952cmr3601840pjb.102.1666425159965; Sat, 22 Oct 2022 00:52:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666425159; cv=none; d=google.com; s=arc-20160816; b=VDA9RDnOTsjqkMXb3y3MvDEzYsF3F7iSMDWYaNZwaZadGCQYYjx9Fa7ubDo5x7JAYd OkvgmjP4CUbEJoPvADWAcI5rVPDdMauq1MnfQgRjTe6t3WUrDyf9EbABPqEVZxcIV8VD 9TtRvW2hWviJVWZFXUcS48ngRtFqi3Et9P4tTaMhvZmLGvV5UlvOnmxz0v/A+Mish02+ TtN9a834SHgARMNZ/1v9P+EZqC69gJqWaWYTDxq18CdS2R6tZg3/AkkVvuDCg05qLMve glFaltVk341vsE0wuoAQ09sL8wMtBkY5vstHWeN9/YegV0AzwCSfAKxLejDo87S4UZOG zSzA== 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=qsY+PlN+INru3sODjU8AcjnXAP2aCl71b/S2vrXuI1w=; b=URmpIjI0+vqwfCUnjF959MNCTKwcEBvIRjy9I4xF1H8KAEqSmDeaNJwOPNtu6sOvs1 SgL8OYaP/ShSPWuyMVrly/Klmpk6BRE3BulPxYXn6VcRzasJPslW/Wpg8equgT1AhV+p eCIcqD1P6s3+a0Rsouj03QP69ef/LaWidxY4EEE6x+E9Kp6L4rmPyFM3MFueG8cKeEkH ywD28Z4ny3UVzwjp2jP9zr31+N0sMlITGNS5xXE+SmxgeC8us80L+iB2YM9/ZBCP+GoV Wh+p2CFnzr8RJVgw6ciwucyZxnYAWr6AYdxuYCIcBNSQAFv+RwjzY2e62jDEL7judnoz RNJA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=DixVuT6v; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 y13-20020a056a00190d00b005363fa9e126si29540868pfi.358.2022.10.22.00.52.28; Sat, 22 Oct 2022 00:52: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=DixVuT6v; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S230309AbiJVHwM (ORCPT + 99 others); Sat, 22 Oct 2022 03:52:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54854 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231888AbiJVHte (ORCPT ); Sat, 22 Oct 2022 03:49: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 032552C1719; Sat, 22 Oct 2022 00:46: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 89F4860B9C; Sat, 22 Oct 2022 07:43:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9ACADC433D6; Sat, 22 Oct 2022 07:43:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424595; bh=oyGyxWJUXiy5R6FcVcV6T7cfpWGfVqEQbstwhBlVSqA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DixVuT6v7wnQx2d97pacbEK0CPnMVW4P+fCUJ9viKRvzFtgnCp+D34iqV/OztQpLf bVV9H39oybBWzLI0K2osECdcwK+GeCRqvKBhnBgZui/xe41/dvTbmXg8xy0d4Iy1HG 9VG2tmbTgnXu3ja8bRAEhvNIExC1r2TlDC4h2Y1A= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Pavel Machek , =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= , Wolfram Sang , Sasha Levin Subject: [PATCH 5.19 205/717] leds: lm3601x: Dont use mutex after it was destroyed Date: Sat, 22 Oct 2022 09:21:24 +0200 Message-Id: <20221022072451.627694420@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747373428427226467?= X-GMAIL-MSGID: =?utf-8?q?1747373428427226467?= From: Uwe Kleine-König [ Upstream commit 32f7eed0c763a9b89f6b357ec54b48398fc7b99e ] The mutex might still be in use until the devm cleanup callback devm_led_classdev_flash_release() is called. This only happens some time after lm3601x_remove() completed. Fixes: e63a744871a3 ("leds: lm3601x: Convert class registration to device managed") Acked-by: Pavel Machek Signed-off-by: Uwe Kleine-König Signed-off-by: Wolfram Sang Signed-off-by: Sasha Levin --- drivers/leds/flash/leds-lm3601x.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/leds/flash/leds-lm3601x.c b/drivers/leds/flash/leds-lm3601x.c index d0e1d4814042..3d1272748201 100644 --- a/drivers/leds/flash/leds-lm3601x.c +++ b/drivers/leds/flash/leds-lm3601x.c @@ -444,8 +444,6 @@ static int lm3601x_remove(struct i2c_client *client) { struct lm3601x_led *led = i2c_get_clientdata(client); - mutex_destroy(&led->lock); - return regmap_update_bits(led->regmap, LM3601X_ENABLE_REG, LM3601X_ENABLE_MASK, LM3601X_MODE_STANDBY); From patchwork Sat Oct 22 07:21: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: 7284 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1092241wrr; Sat, 22 Oct 2022 00:53:31 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5A5INBoThyIU0c4xmkDGqg/+Mss3m/3YtI+ScFD/CNoodykG6mhLcrnku7/gtUZaIKaH02 X-Received: by 2002:a63:d845:0:b0:44b:d074:97d with SMTP id k5-20020a63d845000000b0044bd074097dmr19912515pgj.32.1666425210975; Sat, 22 Oct 2022 00:53:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666425210; cv=none; d=google.com; s=arc-20160816; b=CyPqVUM803BQbsS4PLHjwUmmuqwEF3q3g/T1cB8/HKwf8vOFaJXAphjO8/Ls/rxFDD kcYPoECu2zj7jPuy5j/drdc+AbwXMPKKkN7IvGswZ6uf9yXjP7iPJUMLB9HreTGtORWC JOsHhnA2ugCjCYCGyYPzwPDZc0OFireGs1o4XjuUgsYSLEoiEtNHZg0xRxPLSGOYiUTl /0GtMuUZ2XcmdaEpf1vRbEvLXDRmFkl0kwVSEzIGLuANWJWS7PZJR1huL45rOOax1QO7 fneCaBe30Ws+7osGxYGszyWYxmrSh7BjTdorCdfxUqKn4YyikQO09UcpAku1o+hlea2X kWJQ== 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=xVaSAW6sWw+zbEBvbKS0owAphzDxOVcRN4lSYmKce7I=; b=IG2WVYxCzK188S2vcWhHG3/HqhsCzmgVdUhTuEUnz4KOjrbqqfUpbdINDUoS4R0Yqy 1h7WCaoFCi1ejwE/peYewgVBtE1NHhoim423OY6GqqjlYimUpZAYL4YZi/EQ8zH5xdU6 D5YyuJtBWYK6KdvmvIIdOYGcIzUOggRNGXPxBlinZCkpcTMP20n6DFni2QXcIzQJYFva vQysPXH3AeW0Xzp+e8xTYkFRftIJ+hc4QTe88kTvbtsQdpLXbByyOyuem6rMyK1pR4wb ti2gPVeGGZRDS6IfmG4k90VoU1g8u4UOwSnW+XGVbcNhWkFVUdekVIMDpYChrOnPo+3Y ZAPw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=qHYB11H5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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-20020a17090aee8700b0020d67aeb299si1983536pjz.53.2022.10.22.00.53.18; Sat, 22 Oct 2022 00:53: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=qHYB11H5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231933AbiJVHxD (ORCPT + 99 others); Sat, 22 Oct 2022 03:53:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54772 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231617AbiJVHt7 (ORCPT ); Sat, 22 Oct 2022 03:49: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 D3A9F2C1715; Sat, 22 Oct 2022 00:46: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 3E12B60B9B; Sat, 22 Oct 2022 07:43:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4ECE1C433D6; Sat, 22 Oct 2022 07:43:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424597; bh=c/sCNq7gkDPOwlsgPsrYGZOsvI3vWJnfm+lWwWvTG3M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qHYB11H5JycVoxhWUr4MpJL08ImvJvHosrqpBW6OPyNB3JNpEsuYI08CaOplEJIci YB9rQJ6Qd6oJI0mA6DuvB+v1NpkEqsO7EbKUdmpIhVh0OBIJQ88e1gHFP9it1D93PL rGEWvuBFkdfb+kCyW2OQRWj7KmIgWTPe3MclINVk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Gerhard Engleder , "David S. Miller" , Sasha Levin Subject: [PATCH 5.19 206/717] tsnep: Fix TSNEP_INFO_TX_TIME register define Date: Sat, 22 Oct 2022 09:21:25 +0200 Message-Id: <20221022072451.769700798@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747373482329512845?= X-GMAIL-MSGID: =?utf-8?q?1747373482329512845?= From: Gerhard Engleder [ Upstream commit 7d8dd6b5cd1d67dd96c132f91d7ad29c49ed3c59 ] Fixed register define is not used, but register definition shall be kept in sync. Fixes: 403f69bbdbad ("tsnep: Add TSN endpoint Ethernet MAC driver") Signed-off-by: Gerhard Engleder Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/net/ethernet/engleder/tsnep_hw.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/net/ethernet/engleder/tsnep_hw.h b/drivers/net/ethernet/engleder/tsnep_hw.h index 916ceac3ada2..e03aaafab559 100644 --- a/drivers/net/ethernet/engleder/tsnep_hw.h +++ b/drivers/net/ethernet/engleder/tsnep_hw.h @@ -92,8 +92,7 @@ /* tsnep register */ #define TSNEP_INFO 0x0100 -#define TSNEP_INFO_RX_ASSIGN 0x00010000 -#define TSNEP_INFO_TX_TIME 0x00020000 +#define TSNEP_INFO_TX_TIME 0x00010000 #define TSNEP_CONTROL 0x0108 #define TSNEP_CONTROL_TX_RESET 0x00000001 #define TSNEP_CONTROL_TX_ENABLE 0x00000002 From patchwork Sat Oct 22 07:21: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: 7280 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1092181wrr; Sat, 22 Oct 2022 00:53:16 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6T6+walSu7BTWFtbVG4Lb5DhJKgzVU/mbWWKs07+U3Mff8WBBj1Vg5f7CnAt+RmkfRYJ5N X-Received: by 2002:a17:902:bc86:b0:186:5d80:f62f with SMTP id bb6-20020a170902bc8600b001865d80f62fmr15227491plb.28.1666425185617; Sat, 22 Oct 2022 00:53:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666425185; cv=none; d=google.com; s=arc-20160816; b=CrL4XvUQRAmG9479wSarGoLIepJWVzCpLlaLXzuUGc6+AI1JED4GeBnQPnLez5Qplt 26CL6DeGwjlL2l8kzPihhdZsJm6WGTyoHerEC98li5ooL3EkQTCbA+oUbtPH54aJWiU9 r71DLuK+A57I4NgUSLGP+vJzd2hIHqiyUSWKa8ZKPhkoBx7tAaKS1ZVHJPX6WXLBC1Vc wohveFtarS91jTzj3Hm/IIl78BEgnd6fnPnvoB8AaW5vYQvWDDjDq3VOKu6YHtUxocB+ Dtxmf4m6FxtQtoFVHFf63hKPaWgeHAhrRSDFDhSUO7ANjPtV+6dMG32RSpynBkJROxtn OXzQ== 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=SP9tm0NVh7F8bv/9n46iFpt1DzD/faVyRI7ZclQCW/E=; b=cJMgxF7xPigEdwUltc6rk1xAigTPxZ8iQpdolX+IxmTIKjWq7rwy7OTwpx0heWZPWT 7FTt/O3ndg4da9tWo0stsH6x/irZT5Ync/4oB9f43OP2a5qUv+wpUsxxGbPXhfaHwI8L aX385NHi8FjiCc7SiUrjud9mVHYSqnVx33vZxl2FihLsFsdWc7wORC4hbbzDyp3h0Jf+ Yj/adD9umlduTEkQYcAcwLHvdqMdAdDeSeLs7nRpLkxlYT6xf8Dyxubo480tz9/+9q8T L0VSK2OqpmWZg3xOFh75csHzaMlk/4dqjD0DjOdwmEAJ0mtICd8NzwT3QFNozNtWYjY/ e+9w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=zBz4UWNS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 s14-20020a17090302ce00b0016c44b7c8c5si25615822plk.11.2022.10.22.00.52.53; Sat, 22 Oct 2022 00:53: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=zBz4UWNS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231812AbiJVHwg (ORCPT + 99 others); Sat, 22 Oct 2022 03:52:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49478 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231949AbiJVHtl (ORCPT ); Sat, 22 Oct 2022 03:49:41 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E26772C1739; Sat, 22 Oct 2022 00:46: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 CD56E60AC3; Sat, 22 Oct 2022 07:43:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E0D99C433D7; Sat, 22 Oct 2022 07:43:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424600; bh=aXaJ4EopdjlPhTCUGUcNV1Be///P8aLEr/4UntvXyhk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zBz4UWNSexC06lT6SG+YQZ00R2AFSvlKm+jgEt2VTjamvGBS1CEP0cAiOd5qWYQDT KM6TT8aKEG/CQYd86uJf2KaOBjE/cGbUPkTF+WdELY+h8uebanEwNkrScgF1Wylq2Y eFP8YzMdrCUsSNf+o8bqrbDDB/KhCNY8+Oaj6Mjc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kumar Kartikeya Dwivedi , Alexei Starovoitov , Sasha Levin Subject: [PATCH 5.19 207/717] bpf: Fix reference state management for synchronous callbacks Date: Sat, 22 Oct 2022 09:21:26 +0200 Message-Id: <20221022072451.954852324@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747373455601992276?= X-GMAIL-MSGID: =?utf-8?q?1747373455601992276?= From: Kumar Kartikeya Dwivedi [ Upstream commit 9d9d00ac29d0ef7ce426964de46fa6b380357d0a ] Currently, verifier verifies callback functions (sync and async) as if they will be executed once, (i.e. it explores execution state as if the function was being called once). The next insn to explore is set to start of subprog and the exit from nested frame is handled using curframe > 0 and prepare_func_exit. In case of async callback it uses a customized variant of push_stack simulating a kind of branch to set up custom state and execution context for the async callback. While this approach is simple and works when callback really will be executed only once, it is unsafe for all of our current helpers which are for_each style, i.e. they execute the callback multiple times. A callback releasing acquired references of the caller may do so multiple times, but currently verifier sees it as one call inside the frame, which then returns to caller. Hence, it thinks it released some reference that the cb e.g. got access through callback_ctx (register filled inside cb from spilled typed register on stack). Similarly, it may see that an acquire call is unpaired inside the callback, so the caller will copy the reference state of callback and then will have to release the register with new ref_obj_ids. But again, the callback may execute multiple times, but the verifier will only account for acquired references for a single symbolic execution of the callback, which will cause leaks. Note that for async callback case, things are different. While currently we have bpf_timer_set_callback which only executes it once, even for multiple executions it would be safe, as reference state is NULL and check_reference_leak would force program to release state before BPF_EXIT. The state is also unaffected by analysis for the caller frame. Hence async callback is safe. Since we want the reference state to be accessible, e.g. for pointers loaded from stack through callback_ctx's PTR_TO_STACK, we still have to copy caller's reference_state to callback's bpf_func_state, but we enforce that whatever references it adds to that reference_state has been released before it hits BPF_EXIT. This requires introducing a new callback_ref member in the reference state to distinguish between caller vs callee references. Hence, check_reference_leak now errors out if it sees we are in callback_fn and we have not released callback_ref refs. Since there can be multiple nested callbacks, like frame 0 -> cb1 -> cb2 etc. we need to also distinguish between whether this particular ref belongs to this callback frame or parent, and only error for our own, so we store state->frameno (which is always non-zero for callbacks). In short, callbacks can read parent reference_state, but cannot mutate it, to be able to use pointers acquired by the caller. They must only undo their changes (by releasing their own acquired_refs before BPF_EXIT) on top of caller reference_state before returning (at which point the caller and callback state will match anyway, so no need to copy it back to caller). Fixes: 69c087ba6225 ("bpf: Add bpf_for_each_map_elem() helper") Signed-off-by: Kumar Kartikeya Dwivedi Link: https://lore.kernel.org/r/20220823013125.24938-1-memxor@gmail.com Signed-off-by: Alexei Starovoitov Signed-off-by: Sasha Levin --- include/linux/bpf_verifier.h | 11 ++++++++++ kernel/bpf/verifier.c | 42 ++++++++++++++++++++++++++++-------- 2 files changed, 44 insertions(+), 9 deletions(-) diff --git a/include/linux/bpf_verifier.h b/include/linux/bpf_verifier.h index e8439f6cbe57..e66ee8d87e27 100644 --- a/include/linux/bpf_verifier.h +++ b/include/linux/bpf_verifier.h @@ -212,6 +212,17 @@ struct bpf_reference_state { * is used purely to inform the user of a reference leak. */ int insn_idx; + /* There can be a case like: + * main (frame 0) + * cb (frame 1) + * func (frame 3) + * cb (frame 4) + * Hence for frame 4, if callback_ref just stored boolean, it would be + * impossible to distinguish nested callback refs. Hence store the + * frameno and compare that to callback_ref in check_reference_leak when + * exiting a callback function. + */ + int callback_ref; }; /* state of the program: diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c index 210793b5cd6c..b908ff6e520f 100644 --- a/kernel/bpf/verifier.c +++ b/kernel/bpf/verifier.c @@ -1092,6 +1092,7 @@ static int acquire_reference_state(struct bpf_verifier_env *env, int insn_idx) id = ++env->id_gen; state->refs[new_ofs].id = id; state->refs[new_ofs].insn_idx = insn_idx; + state->refs[new_ofs].callback_ref = state->in_callback_fn ? state->frameno : 0; return id; } @@ -1104,6 +1105,9 @@ static int release_reference_state(struct bpf_func_state *state, int ptr_id) last_idx = state->acquired_refs - 1; for (i = 0; i < state->acquired_refs; i++) { if (state->refs[i].id == ptr_id) { + /* Cannot release caller references in callbacks */ + if (state->in_callback_fn && state->refs[i].callback_ref != state->frameno) + return -EINVAL; if (last_idx && i != last_idx) memcpy(&state->refs[i], &state->refs[last_idx], sizeof(*state->refs)); @@ -6919,10 +6923,17 @@ static int prepare_func_exit(struct bpf_verifier_env *env, int *insn_idx) caller->regs[BPF_REG_0] = *r0; } - /* Transfer references to the caller */ - err = copy_reference_state(caller, callee); - if (err) - return err; + /* callback_fn frame should have released its own additions to parent's + * reference state at this point, or check_reference_leak would + * complain, hence it must be the same as the caller. There is no need + * to copy it back. + */ + if (!callee->in_callback_fn) { + /* Transfer references to the caller */ + err = copy_reference_state(caller, callee); + if (err) + return err; + } *insn_idx = callee->callsite + 1; if (env->log.level & BPF_LOG_LEVEL) { @@ -7044,13 +7055,20 @@ record_func_key(struct bpf_verifier_env *env, struct bpf_call_arg_meta *meta, static int check_reference_leak(struct bpf_verifier_env *env) { struct bpf_func_state *state = cur_func(env); + bool refs_lingering = false; int i; + if (state->frameno && !state->in_callback_fn) + return 0; + for (i = 0; i < state->acquired_refs; i++) { + if (state->in_callback_fn && state->refs[i].callback_ref != state->frameno) + continue; verbose(env, "Unreleased reference id=%d alloc_insn=%d\n", state->refs[i].id, state->refs[i].insn_idx); + refs_lingering = true; } - return state->acquired_refs ? -EINVAL : 0; + return refs_lingering ? -EINVAL : 0; } static int check_bpf_snprintf_call(struct bpf_verifier_env *env, @@ -12244,6 +12262,16 @@ static int do_check(struct bpf_verifier_env *env) return -EINVAL; } + /* We must do check_reference_leak here before + * prepare_func_exit to handle the case when + * state->curframe > 0, it may be a callback + * function, for which reference_state must + * match caller reference state when it exits. + */ + err = check_reference_leak(env); + if (err) + return err; + if (state->curframe) { /* exit from nested function */ err = prepare_func_exit(env, &env->insn_idx); @@ -12253,10 +12281,6 @@ static int do_check(struct bpf_verifier_env *env) continue; } - err = check_reference_leak(env); - if (err) - return err; - err = check_return_code(env); if (err) return err; From patchwork Sat Oct 22 07:21: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: 7277 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1092089wrr; Sat, 22 Oct 2022 00:52:55 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6eTXjdwYkcjsU2LHaSOLqdjUUquv7AzEKKkxCrvkRao7qQE7kFprKIAlNI1JANcxbI3ZZ6 X-Received: by 2002:a63:5a26:0:b0:463:7ca2:653b with SMTP id o38-20020a635a26000000b004637ca2653bmr19859611pgb.352.1666425175429; Sat, 22 Oct 2022 00:52:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666425175; cv=none; d=google.com; s=arc-20160816; b=iXERq8HAxau7xuXOsIM+5qxZyeqEa8Dh6ZtsaFPqQ/NWaRjT1SQpacZY5eDFDpAJB0 YGi/gZFEew+teK/rOC65vBTserqjvKTETEhDUYqXJk/IqO9wwsvoPOF4NdEU/Ol4Zl9s K8AF1gGKqofQd2QoboZSsP0+d+o8x8yg3qHCX6DDRxPgz8sz4MQh8gaLiSvPRFLY8KsB vdC5FzzeIe2zFi3t8d9/WJ6bycmhdl/j3c1If28SDRJHfhf+u7X8Fs4BXNGx/HpAG+Zd rBvSf6ErOmsh2eJbxgphmRSVqfe68vOsMOsiKHQbonGB2KgMjc0HWR/pCvvtFblF1D7I 6HsQ== 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=axS1f6qLuUkKB8LOHa8gs2uBpoNPQVUglr6K1aeht3k=; b=r1pbsUY+HPbL2gFFtXu6EB67EXvKEcFg8Zow7ILCIdeTrAteC2KvJ5OkYkT2wKzPZD RebzG5SgX6uQKaMAYKI3fded7asyBhovm3mEzm7l1EGFRjdnrlnHh8J0oYX5RIsjyF2R cMJOpWE4vK+DTSEm7fkem8HE6ZnODyELJgc78SpytXYTrd62iDuYtwq8vgTgrGc79TcX yp9ovjxlo61BxSLgAsPJvBOmjfmgoCtBwp4qaOC5X3XI972PQSyRwsb9x0gZQqKtuWM3 Zz55XvF2WakuFUSJF4SI6Wkh562Z134Y/Fb9f2p9Der1Ur5qL5ps+uTbl9LjnpNQb2ZA 8Cag== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=G5aI5RvX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 l2-20020a056a0016c200b005634a0ecb53si26926033pfc.265.2022.10.22.00.52.43; Sat, 22 Oct 2022 00:52: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=G5aI5RvX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231704AbiJVHwa (ORCPT + 99 others); Sat, 22 Oct 2022 03:52:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35554 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231933AbiJVHtl (ORCPT ); Sat, 22 Oct 2022 03:49:41 -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 73FBF2C2AC2; Sat, 22 Oct 2022 00:46: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 6A3C160B91; Sat, 22 Oct 2022 07:43:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 82659C433D6; Sat, 22 Oct 2022 07:43:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424602; bh=PBClYfgcUgCNfOMwp2cjYimZKZ/95lBXgpCYtvQU0AM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=G5aI5RvX8CxCipiUtv23eGuNiLlIdq8xJ+S99mxsdn1K9BVcp9kf5GfLmDKW7oury 9bAOs+f6zzvPKeaXIqZ5BG1lKYRlUDGIuiBjkzxDYZhFUgddqTCzgle34xZNvQ5g5g k7vJ0cqropbPhtADKxhCGjj6Vu35hXKPNqMInBpo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Shaul Triebitz , Johannes Berg , Sasha Levin Subject: [PATCH 5.19 208/717] wifi: cfg80211: get correct AP link chandef Date: Sat, 22 Oct 2022 09:21:27 +0200 Message-Id: <20221022072452.095033007@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747373444555789159?= X-GMAIL-MSGID: =?utf-8?q?1747373444555789159?= From: Shaul Triebitz [ Upstream commit bc1857619cc7612117d2ee1ed05b5bfeb638614b ] When checking for channel regulatory validity, use the AP link chandef (and not mesh's chandef). Fixes: 7b0a0e3c3a88 ("wifi: cfg80211: do some rework towards MLO link APIs") Signed-off-by: Shaul Triebitz Signed-off-by: Johannes Berg Signed-off-by: Sasha Levin --- net/wireless/reg.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/net/wireless/reg.c b/net/wireless/reg.c index c7383ede794f..d5c7a5aa6853 100644 --- a/net/wireless/reg.c +++ b/net/wireless/reg.c @@ -2389,6 +2389,10 @@ static bool reg_wdev_chan_valid(struct wiphy *wiphy, struct wireless_dev *wdev) switch (iftype) { case NL80211_IFTYPE_AP: case NL80211_IFTYPE_P2P_GO: + if (!wdev->links[link].ap.beacon_interval) + continue; + chandef = wdev->links[link].ap.chandef; + break; case NL80211_IFTYPE_MESH_POINT: if (!wdev->u.mesh.beacon_interval) continue; From patchwork Sat Oct 22 07:21: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: 7713 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1109564wrr; Sat, 22 Oct 2022 01:49:02 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6v8uTXj0ncM+w8OzuuQGH2yJBMYBOf6vD9C7BDAN7EQt0Lbn7CZQxR1Ks+TNfaz5N33x0b X-Received: by 2002:a05:6402:5291:b0:45c:3f6a:d4bc with SMTP id en17-20020a056402529100b0045c3f6ad4bcmr21068060edb.285.1666428542472; Sat, 22 Oct 2022 01:49:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666428542; cv=none; d=google.com; s=arc-20160816; b=pCEz8Ic9j89FIXGMjqqdmA9OYqoWXr3e42w5aV5S3CBfaX6E0T/hJhJD1mliaxXcpw OxeFhVIohZC55X2L7SzWsUNd+p1MQJVuAXfKobdK1/KpuRa0H/vFWW54ZL7LI35U1H+5 Hz/9PN8T770Lan6N+dgDi5uldasFA6nc/mcPpx4zOWdzC1XWCl+gmYxXZ3jhV7oLqwFm 7nxLAUf3iphleQBrC7P7Jwf3DFPYJOqTCZSWlayrRd6luTTANBR1Ioy1oLVLWJoD2t/b 2rxVDEvLPqMyfoKssVtZQzXM2NWKCbhTeILrOEAyXUQNWu6BHwuWTiJaLTxICTz9ku6t coTw== 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=6lic7GtjKSNSlCNkMjO8zOUjRWmmC+cNPbP9LoygaPQ=; b=xqlPtZu7iJ2tz1vcQmTxYhCURQOiLYK5Fd0jeYzMQmqhGhFxNAMQj0fpInVnktbxLp XprFngB3ZJh4S4eXQe9r0C4qvzWx5DsX/b7MRAKXQcqVWEkSTY7Y+UPmCOu/qJJfrONN C2n457xxFReepY26dr2pn2rcix2jy3Lq3FR6JDhxGI1vRLYZO4WsGIh3zn2aqTqDyVbd amuEU5gbJtq3i50gf/R9MK57OC2CXoWP5XFP9aeO5cwSPis8mEBxzc/oFeSi1cnKb0ou ZU7g3QQJMkc/HgzJlRpqnFiC8W3H3vYE4bq8a9EvWK6F5em77QekczjRgEqQ7/UhdYiY qlXw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Tz8MJWZi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 j11-20020a05640211cb00b0045f802c0b98si11374821edw.443.2022.10.22.01.48.38; Sat, 22 Oct 2022 01:49: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=Tz8MJWZi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S234524AbiJVIsF (ORCPT + 99 others); Sat, 22 Oct 2022 04:48:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43996 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235273AbiJVIpF (ORCPT ); Sat, 22 Oct 2022 04:45: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 197032ECF57; Sat, 22 Oct 2022 01:09: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 215D1B82DB2; Sat, 22 Oct 2022 07:43:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3489AC433B5; Sat, 22 Oct 2022 07:43:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424605; bh=VpSA4BMhFeKTWyRx8kXmF54tw9u0jbtrAQ4h/xDZpo8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Tz8MJWZikgEqpMsDZ7uj8CG0mYn3DjptpICY9UfwZ96I0NPeT608rXM+A3SdUuDKW jNGNSkFIgb6XoHn1suH6cTfc/+HEem8UOq5SkZKnOMNinctDbGsMJgotSfWiAeYoBR O1x+YdgyhDIbSpeGXLXw3mOhSvs+SU2PJEDSJEBY= 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 5.19 209/717] wifi: mac80211: allow bw change during channel switch in mesh Date: Sat, 22 Oct 2022 09:21:28 +0200 Message-Id: <20221022072452.264380904@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376975586659917?= X-GMAIL-MSGID: =?utf-8?q?1747376975586659917?= 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 9ca25ae503b0..37484c26259d 100644 --- a/net/mac80211/cfg.c +++ b/net/mac80211/cfg.c @@ -3545,9 +3545,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 Sat Oct 22 07:21: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: 7278 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1092101wrr; Sat, 22 Oct 2022 00:53:00 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6dJw25qJ9E3SYi2wG768lruuelf32QmfiTOTZk58pr4+x/MnysRL2QoY4G64tnEmId/PUS X-Received: by 2002:a05:6a00:a8c:b0:558:991a:6691 with SMTP id b12-20020a056a000a8c00b00558991a6691mr23078903pfl.53.1666425179780; Sat, 22 Oct 2022 00:52:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666425179; cv=none; d=google.com; s=arc-20160816; b=pJ+AINXO0Ct4JNKKu6rRotN/xDLpu/j4Yxy6FEHjm4lg53VraULh0BJ6N1LjFzuXiM bZJUj6Z2+ixCqxfTJE7emrU6pxjh0wrQTg2W9I4Y8HXXNbm2LdR0I1u5Yo1bTuyINTGZ ADN3xdmee8sAgsOTRsoMiImNG7vDRmwTGyxwxE0p2WZfv/vrLek0drMDXgiRisJQz1YD O8fNyBV0W9EOAa5VQ8BZYMX7pS5CVcYUUq/f2gJp7gvdmdUqPD0nUjQNf9E0dtGDTFkF i6tVenNgf1m+IbOQPpjlYmlnT7f4vdKviLl2qZxS2DUrRvF/3fIvXwPxLl4/V7FMkxil 58wg== 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=cMp1T1quMQ+wTwiyaWoTG+HMqlXAtfFLv2DGX7RXyQ8=; b=sTBOlGr5Xj3oWfBG/vsHSQpM7i8Vw3WhqegNZDiGLrL4q/USk/Qt8jLgxZ8iYFV8WZ LWBrcdMi2MaMML4i1n7nBXKpxjgW3Qa0nis9Lr1BsbCEhIwNUDFV3800t1ZylEIxETSZ T+aljj0nMDq9oCIhYlHvVb+nLmkCR+NJij4HtxFS+Y7qeEAtR+iKNDq9n57gvq0KI3/l GWmxZYved8qF2xTr0k8Cdhwnn6VnHhTlZv/CoM9hdAaW/1imCq/QKvseGyjzN2TGkmMx U40FwdbUxsdOQQt5hWpkBLe83exLrLznKzyMWzJPqBqkC6KUTA6g7SfPVK2tIXs8M9jT 8nfA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=qHrMRUZi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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-20020a170902ef4c00b001712e1efa9asi8499811plx.542.2022.10.22.00.52.46; Sat, 22 Oct 2022 00:52: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=qHrMRUZi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231750AbiJVHwd (ORCPT + 99 others); Sat, 22 Oct 2022 03:52:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35564 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231929AbiJVHtl (ORCPT ); Sat, 22 Oct 2022 03:49:41 -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 3ACF229C4A8; Sat, 22 Oct 2022 00:46: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 0500460BA1; Sat, 22 Oct 2022 07:43:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 18F76C433D6; Sat, 22 Oct 2022 07:43:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424608; bh=nWPW16Q4nBgN2GQRonT5pZsCqcDqtb3Q2XgWjNdjRxA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qHrMRUZierzEz1Xv3S+M7eDho54hpEKD0p2I2zzcJon1RmV+3gO4lFpyRs+so+/W1 eDiRvX/oXY8qKqJ6dwe9wV1iEIMENpNeRFz15jaZ0Qg4wijebPsyG9e4vPb8TMpk1S xhHF9r3ftM4JWTqazdQnO6V3qH2EJZAD0mQI+KR0= 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 5.19 210/717] bpftool: Fix a wrong type cast in btf_dumper_int Date: Sat, 22 Oct 2022 09:21:29 +0200 Message-Id: <20221022072452.433485524@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747373449445378616?= X-GMAIL-MSGID: =?utf-8?q?1747373449445378616?= 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 f5dddf8ef404..6d041d1f5395 100644 --- a/tools/bpf/bpftool/btf_dumper.c +++ b/tools/bpf/bpftool/btf_dumper.c @@ -426,7 +426,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 Sat Oct 22 07:21: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: 7286 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1092283wrr; Sat, 22 Oct 2022 00:53:40 -0700 (PDT) X-Google-Smtp-Source: AMsMyM451gWnlGQX5ufaqHDfJtEHkNfnO3kL8MwUj1zgZvoB2CFAvbvrlxPHcteH0jAWFxYYOOHO X-Received: by 2002:a17:902:724c:b0:177:5080:cbeb with SMTP id c12-20020a170902724c00b001775080cbebmr23210828pll.67.1666425220103; Sat, 22 Oct 2022 00:53:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666425220; cv=none; d=google.com; s=arc-20160816; b=iQN2dTPvfa+jgjvm6aPFXDsIiu0gSpzbPqPRrMz3uSxMs1JQCnivzApmTO0sLNhwwP xaYik/qEdjCex0Dq7wn8uxELZK07ApI7i5gjT9aIpisFR7Zihyb3emrgC5/cYlXRdoW/ mKQtjbRebETWDkXlAY619Ces48DqgIFk2uZu5Pl45UJUUwrO3/eilGR4VrFd5QYx9Tv+ MTNL3FOuOPauYwvL4AFCSPnj1XxibDhfig0GEw8j//PHznkQ05Ek1m3GJWDqcPbhe487 HUbToJ1KMB7Wsuk93grpZWSLAWLX+gn9f/Gm9Gt+gk3JqRtbSE/dPhbmjw4dLJtkWHgn iycw== 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=/BOH7xV6fsPN3ShSHLoJ5AZvoOimEkJD1T9cEsCleG0=; b=t1NVKXEATFW1n8Fs9Osp1030UHrAeiZhatgYnjFCWEtCcK55Ob+L4kP5N2F28yZh+b Xw6IcZCWUvjpNfy5wNJrGaW9E2jxGKdiobOsAvWWD2WplkfVkj4tLxqBPlTQ68PBdUlF FIrJmOSzv2Zttrgn1CXhuBbyS48SOR2DEbzW6Zpxzk4vkQwNqZ+kvheob0GFsmWtVabG BEY+/KFJCpYYbp2MahN3KmVAtGf8rB7rdXCDO3fz0JnkNpRHnnYd3ltR0T/KjGzRjgO/ DRG+hpv5mTMqFjsTWBr4XrOivHxsR6GYCHRuI8ScXWfyD44dLGIB+N4xciAfCVKy5y6e Wg0Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=vzLBwBKJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 f20-20020a056a0022d400b0052f60f7e0bcsi31021079pfj.346.2022.10.22.00.53.27; Sat, 22 Oct 2022 00:53: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=vzLBwBKJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231966AbiJVHxL (ORCPT + 99 others); Sat, 22 Oct 2022 03:53:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54852 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231717AbiJVHue (ORCPT ); Sat, 22 Oct 2022 03:50: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 2A6212C2ACB; Sat, 22 Oct 2022 00:46: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 dfw.source.kernel.org (Postfix) with ESMTPS id A11F760B0A; Sat, 22 Oct 2022 07:43:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B056FC433D6; Sat, 22 Oct 2022 07:43:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424611; bh=Kb5ALKjzG/7/M7Lz6XgmAsT3pLBjYGXRI1M5hmOz0JI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vzLBwBKJ4iPKUL08UjWCyk26IRBISe+M0sWWXsApXSOv9t+sSa0qSqDOOSbPuMfSI fdWRYFT8QFrZdIML88eGOdgWxlI7vTIVvrE5qd58iUN2l8vt0BjR1Ynnhu3A3Zzc51 F+Z4gtMYaiK7jChWCOc0l4LUJjlIpcBkolRgBQps= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Richard Guy Briggs , Paul Moore , Sasha Levin Subject: [PATCH 5.19 211/717] audit: explicitly check audit_context->context enum value Date: Sat, 22 Oct 2022 09:21:30 +0200 Message-Id: <20221022072452.598694575@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747373491286757759?= X-GMAIL-MSGID: =?utf-8?q?1747373491286757759?= From: Richard Guy Briggs [ Upstream commit 3ed66951f952ed8f1a5d03e171722bf2631e8d58 ] Be explicit in checking the struct audit_context "context" member enum value rather than assuming the order of context enum values. Fixes: 12c5e81d3fd0 ("audit: prepare audit_context for use in calling contexts beyond syscalls") Signed-off-by: Richard Guy Briggs Signed-off-by: Paul Moore Signed-off-by: Sasha Levin --- kernel/auditsc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/auditsc.c b/kernel/auditsc.c index 0c33e04c293a..65d816cda5df 100644 --- a/kernel/auditsc.c +++ b/kernel/auditsc.c @@ -2094,7 +2094,7 @@ void __audit_syscall_exit(int success, long return_code) /* run through both filters to ensure we set the filterkey properly */ audit_filter_syscall(current, context); audit_filter_inodes(current, context); - if (context->current_state < AUDIT_STATE_RECORD) + if (context->current_state != AUDIT_STATE_RECORD) goto out; audit_log_exit(); From patchwork Sat Oct 22 07:21: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: 7279 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1092153wrr; Sat, 22 Oct 2022 00:53:12 -0700 (PDT) X-Google-Smtp-Source: AMsMyM67u4n/5DQsEccjVWFeNsiPBRAAYHTvSmWfE7MU0ddt2MWnH8KXXsLBP+xdwi8yLqlo1vfO X-Received: by 2002:a17:90a:bf11:b0:211:84c5:42d7 with SMTP id c17-20020a17090abf1100b0021184c542d7mr15151149pjs.122.1666425191901; Sat, 22 Oct 2022 00:53:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666425191; cv=none; d=google.com; s=arc-20160816; b=Oc8wF3tMQrIBEweaLAjyK+Os9d6Dfgs9ez3Na0MngD1Lao3iuILxItCDI66DkUU5wv fPF6viu5cG7hOhh4Qlr8z6nFYv5jjvgvbnyyfTyVSYH0jBDtesuhIZC2wovs+stUHD5N Jw9XW9f24TnIP3vil7nxGMTnnAUVCnwGpwO+uBY/ZSbuwRpIlKVpGZxqiuX3gy1Hjcii QSzcqaQDy9oE/0qu+QvDCwVKH7DJIvuVV5pMpWLUFfDC/cvndk9wcz4fETP75uk7ELuS 4PUgceEeJ1t2S/cVov2+sFAB/99zyXNdb05c9XjIi/tL4gfDUZwWinUUmvGqJDmh1aPA U0bw== 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=So7yaurPMCSI/cLYOrEIqs0d6Tuxy3mZMVHO8TjH4CU=; b=UAlr8/DizjnNMhc2gjJxqk0dGkCZloSdrqzHS+pCC/ZtWHLPznVeQ5X9ABtjSN+jnP h0DWGdFDHDh9B4Hl3uVTsyoQ7MxDHAZ+8FOLZXZ5Kf0jCdiju3oaO8cjN+1wLQ67uujl i7Epj/vj6lJPJbNVRErY5DN0Y8IPIMQBrDuHEoGWfel4Sb6jus6+Jzo6/mxsR8sWIumC ZCmiU1ewYZf70toX565eXIxLPysjdQF+Hh/82IwESTi6lEzfEpAo7UwgSlWV0sDbKP4l EFd9/piBeZiOc8bZKH1QKmbccmRgl7bEgdRsiHpng8k0jCbtmo/5qW9gUFniUO4NFBV0 y+eA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=BTvD6MVn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 u1-20020a632341000000b0043aebb63fc6si29170692pgm.81.2022.10.22.00.52.58; Sat, 22 Oct 2022 00:53: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=BTvD6MVn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231814AbiJVHwm (ORCPT + 99 others); Sat, 22 Oct 2022 03:52:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35556 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231947AbiJVHtl (ORCPT ); Sat, 22 Oct 2022 03:49:41 -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 B6E8B2C2ADD; Sat, 22 Oct 2022 00:46: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 472CD60B4A; Sat, 22 Oct 2022 07:43:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 581ACC433D7; Sat, 22 Oct 2022 07:43:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424613; bh=lRLnCd09qU2Pnvqe8b6Dy8rpdc/eTMoFLE3OYWFRwVE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BTvD6MVnHvgXAfVpJmNCkGIqjRTckiI5JCurOJDn++ec5SbsJLhvVNJevtijf7jhQ 5HGOUrcpCpgFg2vFEop1E3dA2NjC8FB8P3zUh598EOH+7j2hxV12EN08a0dVnXvozh gYEmFrd/3Mut9pG3669kzs0ppuCu2IoGCqREVMUE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Richard Guy Briggs , Paul Moore , Sasha Levin Subject: [PATCH 5.19 212/717] audit: free audit_proctitle only on task exit Date: Sat, 22 Oct 2022 09:21:31 +0200 Message-Id: <20221022072452.771100731@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747373461613136471?= X-GMAIL-MSGID: =?utf-8?q?1747373461613136471?= From: Richard Guy Briggs [ Upstream commit c3f3ea8af44d0c5fba79fe8b198087342d0c7e04 ] Since audit_proctitle is generated at syscall exit time, its value is used immediately and cached for the next syscall. Since this is the case, then only clear it at task exit time. Otherwise, there is no point in caching the value OR bearing the overhead of regenerating it. Fixes: 12c5e81d3fd0 ("audit: prepare audit_context for use in calling contexts beyond syscalls") Signed-off-by: Richard Guy Briggs Signed-off-by: Paul Moore Signed-off-by: Sasha Levin --- kernel/auditsc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/auditsc.c b/kernel/auditsc.c index 65d816cda5df..73121c0185ce 100644 --- a/kernel/auditsc.c +++ b/kernel/auditsc.c @@ -1016,7 +1016,6 @@ static void audit_reset_context(struct audit_context *ctx) WARN_ON(!list_empty(&ctx->killed_trees)); audit_free_module(ctx); ctx->fds[0] = -1; - audit_proctitle_free(ctx); ctx->type = 0; /* reset last for audit_free_*() */ } @@ -1102,6 +1101,7 @@ static inline void audit_free_context(struct audit_context *context) { /* resetting is extra work, but it is likely just noise */ audit_reset_context(context); + audit_proctitle_free(context); free_tree_refs(context); kfree(context->filterkey); kfree(context); From patchwork Sat Oct 22 07:21: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: 7234 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1090786wrr; Sat, 22 Oct 2022 00:48:26 -0700 (PDT) X-Google-Smtp-Source: AMsMyM43tzkC1CLFAHsBeBqqfVtcFjCPqOzW3Z5PKvy5bMRfy52U25IXbh9R81qvAkqI6FaNkTnw X-Received: by 2002:a17:90a:e548:b0:211:2c0c:cb74 with SMTP id ei8-20020a17090ae54800b002112c0ccb74mr16593349pjb.69.1666424906689; Sat, 22 Oct 2022 00:48:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666424906; cv=none; d=google.com; s=arc-20160816; b=WYs5GovVjqE1kdT7hreaD8nyd9u27ZMYP9a/LAp3koR06eEHNTHA62FCPkxVZf0U5+ upTTpvEQ9gaq0Q1bhh2hN37ugxkKNj3q7QOPcSUQCg/66nSfcGKncKS9bCIoaijG/MKh N7kn2CbAf4z/58Y0SO7/F+vxQGdkdosUkkIDVx6A+L/9TDiWkhonIN0VnWVqvUKnyLBX uw8Ot9FxpVN+VswOsEh18HV19eE18RmCqxG8SpF1UVpX+TGMTQmysm008p9uZhtu0hrC TAqWaFRhK81oTRxkFCwRVFa6Crdjj/Z8vBAGQPloEwMLHYhf7nk4OsGf/eLZ97GQ+lKJ J3AQ== 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=6Luwm+6V4EnEcJDN6jv3v3LMxZdE/VcwQnoGBPu0axQ=; b=cs6XxY+iMPAUcRsVQ4RKpP2wpDoD3KmLeGYn/S5GBfEZCYQdltzZ3SPbn1Mb4BpOKe +YXHH5u3P2JpgbxA1gFlz+DCIFNtXmB5G1ehA5XWu6X7CODYBn6or9mf4a+W+TTJ1X0C 1lcKhjE+5A+6NVgRG7EAouu6SAGUSmziUPYgbDHZ82AO/K2Ah4TVMiY0dskZOL46Os+U ucvDMzn/Nk3QDgBEUiSR8h0uTjYImOFVE9w/epDpvCMWdnlePsUWaeJqEk9I1jwXv6wQ dTecXTjGAUdL7asD/16nQBmvmhYcG0efDpWgCy82yNB80iYZUHUrTjQU8KUz42q/mz1R 3YWQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=i6SYq41i; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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-20020a65480d000000b0041c506dde92si26200168pgs.636.2022.10.22.00.48.14; Sat, 22 Oct 2022 00:48: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=i6SYq41i; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231574AbiJVHro (ORCPT + 99 others); Sat, 22 Oct 2022 03:47:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58222 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231552AbiJVHrN (ORCPT ); Sat, 22 Oct 2022 03:47: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 6CFFE15FCD; Sat, 22 Oct 2022 00:44:37 -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 EAC4AB82E13; Sat, 22 Oct 2022 07:43:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0D3AFC433C1; Sat, 22 Oct 2022 07:43:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424616; bh=yVMy2NWsVdNDP54jbBTFxUQN5uZNosG28yGa4Gw8At0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=i6SYq41iOjb1giQvKHakgz8nr/MnGMX2770riDDAzMbXgU8G2y/I8M+kgwUCPFSJU TbbSjxyFTnntLMa7kvAL9yQR2qgoDbKtsMEFup5Dvq+O1qfsciIy/qaFh8WFeTpEbQ Uovn9LI5j0atNhgtn/ppfAaFNy3RlH39kSI2OHJU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sabrina Dubroca , Steffen Klassert , Sasha Levin Subject: [PATCH 5.19 213/717] esp: choose the correct inner protocol for GSO on inter address family tunnels Date: Sat, 22 Oct 2022 09:21:32 +0200 Message-Id: <20221022072452.962173379@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747373162810123568?= X-GMAIL-MSGID: =?utf-8?q?1747373162810123568?= From: Sabrina Dubroca [ Upstream commit 26dbd66eab8080be51759e48280da04015221e22 ] Commit 23c7f8d7989e ("net: Fix esp GSO on inter address family tunnels.") is incomplete. It passes to skb_eth_gso_segment the protocol for the outer IP version, instead of the inner IP version, so we end up calling inet_gso_segment on an inner IPv6 packet and ipv6_gso_segment on an inner IPv4 packet and the packets are dropped. This patch completes the fix by selecting the correct protocol based on the inner mode's family. Fixes: c35fe4106b92 ("xfrm: Add mode handlers for IPsec on layer 2") Signed-off-by: Sabrina Dubroca Signed-off-by: Steffen Klassert Signed-off-by: Sasha Levin --- net/ipv4/esp4_offload.c | 5 ++++- net/ipv6/esp6_offload.c | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/net/ipv4/esp4_offload.c b/net/ipv4/esp4_offload.c index 935026f4c807..170152772d33 100644 --- a/net/ipv4/esp4_offload.c +++ b/net/ipv4/esp4_offload.c @@ -110,7 +110,10 @@ static struct sk_buff *xfrm4_tunnel_gso_segment(struct xfrm_state *x, struct sk_buff *skb, netdev_features_t features) { - return skb_eth_gso_segment(skb, features, htons(ETH_P_IP)); + __be16 type = x->inner_mode.family == AF_INET6 ? htons(ETH_P_IPV6) + : htons(ETH_P_IP); + + return skb_eth_gso_segment(skb, features, type); } static struct sk_buff *xfrm4_transport_gso_segment(struct xfrm_state *x, diff --git a/net/ipv6/esp6_offload.c b/net/ipv6/esp6_offload.c index 3a293838a91d..79d43548279c 100644 --- a/net/ipv6/esp6_offload.c +++ b/net/ipv6/esp6_offload.c @@ -145,7 +145,10 @@ static struct sk_buff *xfrm6_tunnel_gso_segment(struct xfrm_state *x, struct sk_buff *skb, netdev_features_t features) { - return skb_eth_gso_segment(skb, features, htons(ETH_P_IPV6)); + __be16 type = x->inner_mode.family == AF_INET ? htons(ETH_P_IP) + : htons(ETH_P_IPV6); + + return skb_eth_gso_segment(skb, features, type); } static struct sk_buff *xfrm6_transport_gso_segment(struct xfrm_state *x, From patchwork Sat Oct 22 07:21: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: 7299 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1093050wrr; Sat, 22 Oct 2022 00:55:52 -0700 (PDT) X-Google-Smtp-Source: AMsMyM66DOJ66wtOCcadpFPok8SJEVs4hkAyDCPY7b3/Xjn5nyqVs9HM80V+op/LZfHcBu1dPNXW X-Received: by 2002:a63:4e16:0:b0:43f:3554:ff9c with SMTP id c22-20020a634e16000000b0043f3554ff9cmr20068894pgb.578.1666425351953; Sat, 22 Oct 2022 00:55:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666425351; cv=none; d=google.com; s=arc-20160816; b=hioREivc40qrdkyX8/zVGQfGP4OMhdvAtCw/MaO6KIxwpfAExT3PUXP6j5gD7CwqEb 9nKLi7v6IXlttTyL2MzzjxK7A218z0PwSkOe7Z274pqqlUOBfxyXvBuWgSfXE6XCSHP9 hGRcvAXy5sM4wmLxWx617tq04RBjmuSBJ51AlZ8e9a/aiN9LWVTJ5G7O04yEkZnA1X3l p9gLe/GrG7y7N9npOZKiGssQqFv6FZYsdfsUJivdwwI2wFRmZR7RdUiv48a6PeglSbH/ edboQ+6tJmQ85QOo3dY1cqv500sW2FPMEOTGfovAx2uyMK3sfu/JmoPGTYXw5pjXU4Ps ckhA== 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=1SLUKWCGmB66dYqcLSnFazvp5hUW6/FmhLUOspQSX28=; b=w3lOzAsIE9FKEFoKqC7c56q5/G3K3cV3YT/9f5fPk/0TMWloJ0j+fNe6mMyo5wVPly bc5An2h4eXO81fsRWlJwWoO+lMkWZQvcb97kSP+8OWVHbw3ZhQ08Fc0bxS+PRDaCIH5A NTWAqzrgL/XnmfNKzlAC81z2mBuYSbvhJVBeuPP2Eij2IQeJ+1WfazqzU87G2dHQOqkc 81LKST0mCfuacejdJruMy1J+Yq6M6d7qYmN83gPXNr4eSQ+iqQC+cRW+49C6ZYkSww4v 3ssqP62pYttWrerNMYMIRtQE2vBGOJwXVHjF+DZp7k4xpHm6lzzP8EeWBjICBMRH4Qwl lPeQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=WdLAHb0x; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 2-20020a630d42000000b0045a8a6b75fesi27113262pgn.499.2022.10.22.00.55.39; Sat, 22 Oct 2022 00:55: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=WdLAHb0x; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231934AbiJVHzV (ORCPT + 99 others); Sat, 22 Oct 2022 03:55:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54856 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231754AbiJVHwE (ORCPT ); Sat, 22 Oct 2022 03:52:04 -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 E6A612C2AEA; Sat, 22 Oct 2022 00:46: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 E268660BA2; Sat, 22 Oct 2022 07:43:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 015B9C433C1; Sat, 22 Oct 2022 07:43:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424619; bh=KTZcokemeTem35PNMjBQHPCVWK2pq04hPNhpZ0yUFtw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WdLAHb0xQZYfsAoJjnn+P94E+HckkTYwP3kznLgyCFKg/DLsHHCvfWjiTcNT+s43g 7LgnBoSGzPn+jg7cenRdUZZbw4A8F5c4MP49hF0hvytpXR9WkUwW47QDlKolzDC73q ooYgAdAc6R3zPOCEgBrLZKH9jzBIGJtB4hfVutJk= 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 5.19 214/717] spi: mt7621: Fix an error message in mt7621_spi_probe() Date: Sat, 22 Oct 2022 09:21:33 +0200 Message-Id: <20221022072453.129048558@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747373629606764834?= X-GMAIL-MSGID: =?utf-8?q?1747373629606764834?= 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/spi/spi-mt7621.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/spi/spi-mt7621.c b/drivers/spi/spi-mt7621.c index b4b9b7309b5e..351b0ef52bbc 100644 --- a/drivers/spi/spi-mt7621.c +++ b/drivers/spi/spi-mt7621.c @@ -340,11 +340,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 Sat Oct 22 07:21: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: 7387 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1096741wrr; Sat, 22 Oct 2022 01:05:51 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4VxlZfZ+ckCj2rFYgoOng0RmK/QOCXZjNa07r85qmQcj/BbEzo9OBLHrZ9BdmIj0dzuWdC X-Received: by 2002:a63:5a05:0:b0:434:23a5:a5ca with SMTP id o5-20020a635a05000000b0043423a5a5camr19725856pgb.515.1666425951589; Sat, 22 Oct 2022 01:05:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666425951; cv=none; d=google.com; s=arc-20160816; b=r4+Bem5snfQx8sC1U1WgSeG8Wt4Y0xgPQ83u8xUDAnu6zDXYOG8At1NiXdbJm2W9w4 Ml0kH58blqx1OAJ9pX3Txz2v3wW9g5CjFebEL6WtC9qBnugGk0tRtlG4+/aIdBxTHUZ/ zb7LVq6gwB8cHo7KLMJ5K0hBz7HXFg03lKlun5GyhUTJWQtIBw6EugpgCi3upFqwmKi0 f5k7WioOrVvqLTF6z1qplDax/lSjlza6BR2V9uy66vLTfSa2o7uKCs51k5flmh+K2gaD kmgc5vsjU+kzYLfrye+unTeU0j+IXPoBBXwBUhHECnu2aRgja54V+K3SfOUzvAzgXvfE Ttyg== 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=urTV2LCUKsRbNs6/yzO7s1WlXfQQZZDfB6u/aXgcv8A=; b=DzxfZoeQicmHr6P6XF5GJ983xT0xbLTAvaIjeYP6ib1WYhbMWdFbp/IXzvv0k/wDtf 72oPM4gJDYLnQwSGEd8imaUQyauEurks5bZ5ywPXkTO6LLNTePJa/ERWNcUKYZdeOHpX 4H9Spatm6EcJzk1ToalPlOaeaIZt3DGCZlZRhwwKyUcYqgX5yAIHdtMwEHSxOhX4lZxH 3WcYGpiJXBopR6nyLoNC6gk4d6OtB/0Dcdtj5ch3S/HGI/qoflUIxPDNlBhiMlv2NbGe 2Ve4Gt7sZruViY4sMKqV8IMSuj97H4UYgmLL5GL9FyaFb2LCdHLUSML6M9Erz9KwCqbp RUzw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Ez768vD5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 v2-20020a170902ca8200b001841183dc30si22533929pld.563.2022.10.22.01.05.37; Sat, 22 Oct 2022 01: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=Ez768vD5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S232726AbiJVIEE (ORCPT + 99 others); Sat, 22 Oct 2022 04:04:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54382 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232115AbiJVH5d (ORCPT ); Sat, 22 Oct 2022 03:57: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 CE5F013A5B7; Sat, 22 Oct 2022 00:48: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 65E5560B9F; Sat, 22 Oct 2022 07:43:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 72242C433C1; Sat, 22 Oct 2022 07:43:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424624; bh=p6ayDb24pUcC13Ada1bVfO09ocE5wIRtINfIU329Dbg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ez768vD5i4czE2TjuBiZQsx9mkKTzcePYn2Dy60hcEx7rwzrgHOAkVQvluzDqRtoe A3MTTVKV3cK0pWwPUwiQAANOQ+vQ7xGWvWTIhq9/0QUS5jpTcgVTxRCa9TO4a7TETB HAG2Zm3snOkJkxHyk8U/3uGFTWTvF9SNXPcPdA9k= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kohei Tarumizu , Dave Hansen , Reinette Chatre , Sasha Levin Subject: [PATCH 5.19 215/717] x86/resctrl: Fix to restore to original value when re-enabling hardware prefetch register Date: Sat, 22 Oct 2022 09:21:34 +0200 Message-Id: <20221022072453.281763425@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747374258367144879?= X-GMAIL-MSGID: =?utf-8?q?1747374258367144879?= From: Kohei Tarumizu [ Upstream commit 499c8bb4693d1c8d8f3d6dd38e5bdde3ff5bd906 ] The current pseudo_lock.c code overwrites the value of the MSR_MISC_FEATURE_CONTROL to 0 even if the original value is not 0. Therefore, modify it to save and restore the original values. Fixes: 018961ae5579 ("x86/intel_rdt: Pseudo-lock region creation/removal core") Fixes: 443810fe6160 ("x86/intel_rdt: Create debugfs files for pseudo-locking testing") Fixes: 8a2fc0e1bc0c ("x86/intel_rdt: More precise L2 hit/miss measurements") Signed-off-by: Kohei Tarumizu Signed-off-by: Dave Hansen Acked-by: Reinette Chatre Link: https://lkml.kernel.org/r/eb660f3c2010b79a792c573c02d01e8e841206ad.1661358182.git.reinette.chatre@intel.com Signed-off-by: Sasha Levin --- arch/x86/kernel/cpu/resctrl/pseudo_lock.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/arch/x86/kernel/cpu/resctrl/pseudo_lock.c b/arch/x86/kernel/cpu/resctrl/pseudo_lock.c index db813f819ad6..4d8398986f78 100644 --- a/arch/x86/kernel/cpu/resctrl/pseudo_lock.c +++ b/arch/x86/kernel/cpu/resctrl/pseudo_lock.c @@ -420,6 +420,7 @@ static int pseudo_lock_fn(void *_rdtgrp) struct pseudo_lock_region *plr = rdtgrp->plr; u32 rmid_p, closid_p; unsigned long i; + u64 saved_msr; #ifdef CONFIG_KASAN /* * The registers used for local register variables are also used @@ -463,6 +464,7 @@ static int pseudo_lock_fn(void *_rdtgrp) * the buffer and evict pseudo-locked memory read earlier from the * cache. */ + saved_msr = __rdmsr(MSR_MISC_FEATURE_CONTROL); __wrmsr(MSR_MISC_FEATURE_CONTROL, prefetch_disable_bits, 0x0); closid_p = this_cpu_read(pqr_state.cur_closid); rmid_p = this_cpu_read(pqr_state.cur_rmid); @@ -514,7 +516,7 @@ static int pseudo_lock_fn(void *_rdtgrp) __wrmsr(IA32_PQR_ASSOC, rmid_p, closid_p); /* Re-enable the hardware prefetcher(s) */ - wrmsr(MSR_MISC_FEATURE_CONTROL, 0x0, 0x0); + wrmsrl(MSR_MISC_FEATURE_CONTROL, saved_msr); local_irq_enable(); plr->thread_done = 1; @@ -871,6 +873,7 @@ bool rdtgroup_pseudo_locked_in_hierarchy(struct rdt_domain *d) static int measure_cycles_lat_fn(void *_plr) { struct pseudo_lock_region *plr = _plr; + u32 saved_low, saved_high; unsigned long i; u64 start, end; void *mem_r; @@ -879,6 +882,7 @@ static int measure_cycles_lat_fn(void *_plr) /* * Disable hardware prefetchers. */ + rdmsr(MSR_MISC_FEATURE_CONTROL, saved_low, saved_high); wrmsr(MSR_MISC_FEATURE_CONTROL, prefetch_disable_bits, 0x0); mem_r = READ_ONCE(plr->kmem); /* @@ -895,7 +899,7 @@ static int measure_cycles_lat_fn(void *_plr) end = rdtsc_ordered(); trace_pseudo_lock_mem_latency((u32)(end - start)); } - wrmsr(MSR_MISC_FEATURE_CONTROL, 0x0, 0x0); + wrmsr(MSR_MISC_FEATURE_CONTROL, saved_low, saved_high); local_irq_enable(); plr->thread_done = 1; wake_up_interruptible(&plr->lock_thread_wq); @@ -940,6 +944,7 @@ static int measure_residency_fn(struct perf_event_attr *miss_attr, u64 hits_before = 0, hits_after = 0, miss_before = 0, miss_after = 0; struct perf_event *miss_event, *hit_event; int hit_pmcnum, miss_pmcnum; + u32 saved_low, saved_high; unsigned int line_size; unsigned int size; unsigned long i; @@ -973,6 +978,7 @@ static int measure_residency_fn(struct perf_event_attr *miss_attr, /* * Disable hardware prefetchers. */ + rdmsr(MSR_MISC_FEATURE_CONTROL, saved_low, saved_high); wrmsr(MSR_MISC_FEATURE_CONTROL, prefetch_disable_bits, 0x0); /* Initialize rest of local variables */ @@ -1031,7 +1037,7 @@ static int measure_residency_fn(struct perf_event_attr *miss_attr, */ rmb(); /* Re-enable hardware prefetchers */ - wrmsr(MSR_MISC_FEATURE_CONTROL, 0x0, 0x0); + wrmsr(MSR_MISC_FEATURE_CONTROL, saved_low, saved_high); local_irq_enable(); out_hit: perf_event_release_kernel(hit_event); From patchwork Sat Oct 22 07:21: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: 7302 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1093147wrr; Sat, 22 Oct 2022 00:56:10 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4R55FrRUuARfGWqRNyOrdxIV5wXxXHaSe2o/A7AuJVI+brfpXCHzOGL7Km0KSk1bEPW0k8 X-Received: by 2002:a17:902:e804:b0:185:5276:7063 with SMTP id u4-20020a170902e80400b0018552767063mr23910199plg.171.1666425370240; Sat, 22 Oct 2022 00:56:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666425370; cv=none; d=google.com; s=arc-20160816; b=PNaSw4B9pu8T3teI8+P4RZvnLz5byux4m4leBW3P/QhfcaYQe8H4NuXXknmFsiLoN1 UKwal5NvsA2y49RlANayozRMuWWJt25vtlI0DqSqELLsSvUqxJ0mrFEyvJ8NVUYD21qJ KYIioR4J2JMaREo/d94Lyn+pcFIEBMpgwJQE3+wJUyMpU+bOqqvXJLivg8gR7HZ/uyAU AYwuguiRe8rM5HiXk8XG70SU1YMyOOLhDnI6pBsuQM95dm3D10BOMHkBGTZ7sv6XomPD 00X81EQevAqEmV/FXIHJCBgpdMwqVpcwSMjGhC1jOJh5Sfryq69+tw1Qr6rOQYXXMfTr lp3g== 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=/MicHSMi9SYz/FAqJcb+GExpcah1jEY6jIXoCKGHGBk=; b=c4xriWKJoTck71plaq1XgMbIueRok2UGVaOrqUvjnCb5luUJuHgEV8uTfSKmKqdfiu CgM2lR9JWU9bInI4G2oVdRjm7JkQZ/sG2+ZJI9AfVSkeRoyv3LK7HRkNqnruUzsU6+8+ WAqGRZLmh2AOfm2YVt0DncBCGmAdggBURbmdctxyTrprCEcq1bnknoZkU7v4VLACkjtr 0WZesr7ejULacQ5Ri5kxtMIgi11K7vSd1EAcJLAtRyPtmC+OzzsX/0zOtqWItskhA2yd wnLyPHvqV3+8cYENhO0ZbH81KLU1ZF0adkbNopCpkC6oXg4AnBst3UT/ITjjgtX4vq/x 1Zew== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=CUmDIEFT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 z11-20020a630a4b000000b0044b8e2abe1csi28734252pgk.170.2022.10.22.00.55.58; Sat, 22 Oct 2022 00:56: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=CUmDIEFT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S232124AbiJVHzm (ORCPT + 99 others); Sat, 22 Oct 2022 03:55:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54846 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231804AbiJVHwg (ORCPT ); Sat, 22 Oct 2022 03:52:36 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 82EF82C1736; Sat, 22 Oct 2022 00:46: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 366B360B21; Sat, 22 Oct 2022 07:43:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 15280C433D6; Sat, 22 Oct 2022 07:43:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424627; bh=93O7dW6IRHQsb8gextTW4CtzcYvhaFQPXPpG+LAb1ro=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CUmDIEFTTzr58H56+o5iX/D3KHTuaOsaCYl/Ts4NBGAaclG5Y5sG3kh075ndJsY1Z 1jq1aLURc+EcRJ0T51reCRWwUf6H+RRrZFaGTNDnnXPv0L3M14VHy4o5Bn2bo35hIN lJcHHuzy2xlLP//Q5eu/xlUjgnaqvVlO9wYtvguE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Magnus Karlsson , Maciej Fijalkowski , Daniel Borkmann , Sasha Levin Subject: [PATCH 5.19 216/717] xsk: Fix backpressure mechanism on Tx Date: Sat, 22 Oct 2022 09:21:35 +0200 Message-Id: <20221022072453.451371628@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747373649218700816?= X-GMAIL-MSGID: =?utf-8?q?1747373649218700816?= From: Maciej Fijalkowski [ Upstream commit c00c4461689e15ac2cc3b9a595a54e4d8afd3d77 ] Commit d678cbd2f867 ("xsk: Fix handling of invalid descriptors in XSK TX batching API") fixed batch API usage against set of descriptors with invalid ones but introduced a problem when AF_XDP SW rings are smaller than HW ones. Mismatch of reported Tx'ed frames between HW generator and user space app was observed. It turned out that backpressure mechanism became a bottleneck when the amount of produced descriptors to CQ is lower than what we grabbed from XSK Tx ring. Say that 512 entries had been taken from XSK Tx ring but we had only 490 free entries in CQ. Then callsite (ZC driver) will produce only 490 entries onto HW Tx ring but 512 entries will be released from Tx ring and this is what will be seen by the user space. In order to fix this case, mix XSK Tx/CQ ring interractions by moving around internal functions and changing call order: * pull out xskq_prod_nb_free() from xskq_prod_reserve_addr_batch() up to xsk_tx_peek_release_desc_batch(); ** move xskq_cons_release_n() into xskq_cons_read_desc_batch() After doing so, algorithm can be described as follows: 1. lookup Tx entries 2. use value from 1. to reserve space in CQ (*) 3. Read from Tx ring as much descriptors as value from 2 3a. release descriptors from XSK Tx ring (**) 4. Finally produce addresses to CQ Fixes: d678cbd2f867 ("xsk: Fix handling of invalid descriptors in XSK TX batching API") Signed-off-by: Magnus Karlsson Signed-off-by: Maciej Fijalkowski Signed-off-by: Daniel Borkmann Link: https://lore.kernel.org/bpf/20220830121705.8618-1-maciej.fijalkowski@intel.com Signed-off-by: Sasha Levin --- net/xdp/xsk.c | 22 +++++++++++----------- net/xdp/xsk_queue.h | 22 ++++++++++------------ 2 files changed, 21 insertions(+), 23 deletions(-) diff --git a/net/xdp/xsk.c b/net/xdp/xsk.c index 7e311420aab9..e24d62f8883a 100644 --- a/net/xdp/xsk.c +++ b/net/xdp/xsk.c @@ -355,16 +355,15 @@ static u32 xsk_tx_peek_release_fallback(struct xsk_buff_pool *pool, u32 max_entr return nb_pkts; } -u32 xsk_tx_peek_release_desc_batch(struct xsk_buff_pool *pool, u32 max_entries) +u32 xsk_tx_peek_release_desc_batch(struct xsk_buff_pool *pool, u32 nb_pkts) { struct xdp_sock *xs; - u32 nb_pkts; rcu_read_lock(); if (!list_is_singular(&pool->xsk_tx_list)) { /* Fallback to the non-batched version */ rcu_read_unlock(); - return xsk_tx_peek_release_fallback(pool, max_entries); + return xsk_tx_peek_release_fallback(pool, nb_pkts); } xs = list_first_or_null_rcu(&pool->xsk_tx_list, struct xdp_sock, tx_list); @@ -373,12 +372,7 @@ u32 xsk_tx_peek_release_desc_batch(struct xsk_buff_pool *pool, u32 max_entries) goto out; } - max_entries = xskq_cons_nb_entries(xs->tx, max_entries); - nb_pkts = xskq_cons_read_desc_batch(xs->tx, pool, max_entries); - if (!nb_pkts) { - xs->tx->queue_empty_descs++; - goto out; - } + nb_pkts = xskq_cons_nb_entries(xs->tx, nb_pkts); /* This is the backpressure mechanism for the Tx path. Try to * reserve space in the completion queue for all packets, but @@ -386,12 +380,18 @@ u32 xsk_tx_peek_release_desc_batch(struct xsk_buff_pool *pool, u32 max_entries) * packets. This avoids having to implement any buffering in * the Tx path. */ - nb_pkts = xskq_prod_reserve_addr_batch(pool->cq, pool->tx_descs, nb_pkts); + nb_pkts = xskq_prod_nb_free(pool->cq, nb_pkts); if (!nb_pkts) goto out; - xskq_cons_release_n(xs->tx, max_entries); + nb_pkts = xskq_cons_read_desc_batch(xs->tx, pool, nb_pkts); + if (!nb_pkts) { + xs->tx->queue_empty_descs++; + goto out; + } + __xskq_cons_release(xs->tx); + xskq_prod_write_addr_batch(pool->cq, pool->tx_descs, nb_pkts); xs->sk.sk_write_space(&xs->sk); out: diff --git a/net/xdp/xsk_queue.h b/net/xdp/xsk_queue.h index fb20bf7207cf..c6fb6b763658 100644 --- a/net/xdp/xsk_queue.h +++ b/net/xdp/xsk_queue.h @@ -205,6 +205,11 @@ static inline bool xskq_cons_read_desc(struct xsk_queue *q, return false; } +static inline void xskq_cons_release_n(struct xsk_queue *q, u32 cnt) +{ + q->cached_cons += cnt; +} + static inline u32 xskq_cons_read_desc_batch(struct xsk_queue *q, struct xsk_buff_pool *pool, u32 max) { @@ -226,6 +231,8 @@ static inline u32 xskq_cons_read_desc_batch(struct xsk_queue *q, struct xsk_buff cached_cons++; } + /* Release valid plus any invalid entries */ + xskq_cons_release_n(q, cached_cons - q->cached_cons); return nb_entries; } @@ -291,11 +298,6 @@ static inline void xskq_cons_release(struct xsk_queue *q) q->cached_cons++; } -static inline void xskq_cons_release_n(struct xsk_queue *q, u32 cnt) -{ - q->cached_cons += cnt; -} - static inline u32 xskq_cons_present_entries(struct xsk_queue *q) { /* No barriers needed since data is not accessed */ @@ -350,21 +352,17 @@ static inline int xskq_prod_reserve_addr(struct xsk_queue *q, u64 addr) return 0; } -static inline u32 xskq_prod_reserve_addr_batch(struct xsk_queue *q, struct xdp_desc *descs, - u32 max) +static inline void xskq_prod_write_addr_batch(struct xsk_queue *q, struct xdp_desc *descs, + u32 nb_entries) { struct xdp_umem_ring *ring = (struct xdp_umem_ring *)q->ring; - u32 nb_entries, i, cached_prod; - - nb_entries = xskq_prod_nb_free(q, max); + u32 i, cached_prod; /* A, matches D */ cached_prod = q->cached_prod; for (i = 0; i < nb_entries; i++) ring->desc[cached_prod++ & q->ring_mask] = descs[i].addr; q->cached_prod = cached_prod; - - return nb_entries; } static inline int xskq_prod_reserve_desc(struct xsk_queue *q, From patchwork Sat Oct 22 07:21: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: 7460 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1098783wrr; Sat, 22 Oct 2022 01:11:45 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6nS1fKFhHYyMJc+JLBEZvjwUymLzif3mi2qOzxXo7jw88BhWSNKlXt++yd+6zMcifj6uKB X-Received: by 2002:a17:90b:3555:b0:20a:c2d5:d361 with SMTP id lt21-20020a17090b355500b0020ac2d5d361mr27224425pjb.50.1666426294607; Sat, 22 Oct 2022 01:11:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666426294; cv=none; d=google.com; s=arc-20160816; b=tmgnHZRwQJdf041c2TmrlGmaa63YucXIAL1cPJvlKvWejE36QmHYrufYEIzklmXbGJ 8zIBCzGVAVSsHUTSymZhtTckmVPoBBImt9uuyxVpPiYw7pBdMdBQhIyol4qaKDdtoIzG tcdAUl/m03pVLqg+A4j/RUEPISskO4H3uUbacBYNBQgPr7+E+LovOsJs/U4aJg8iMh4F gb5Hy32AZwA38odg9p8kvdKiIAQ96PagFPwcAENLTQ6S8XAJFh3r2udHcl5nzFr4SxW2 ISmrZ6V70lMfu5NMQko+EvlRbkx1O7VYQFtPOLfrwuKaBXypCeGpbi8Ic7o08J7eqQc0 iHsQ== 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=1+ZvcSNhTKhHUKzDSrSWZl+WehQmPbqRCMB+hhQPc64=; b=wo/P2/ly7ZHod2d8KWvBmNWWw/Rw12nva/GKQWuq2Fvtj5tcK3uoUpPuqATMd3xAwM 28ui5QijCk+DitpN+x2ec+4u0dISnCg86DEelxw/n6XGOT9ZD9yV6fTLLsoKf5IcPxwJ uZuBw7NTmwQXWsfDhpZ/jZF5t94F0808+2jLabpd+0Iu9d6m7jTPtxE82fXIfoqoYuE9 h4kCvtgwtIB+FggvQuS8QhX3QJSrOiCAo2pXZdB6GTeiCyBMx7Xnt6stylQFUPgQEBdM u8P6vVnJy3fDDkkmv+VdQKyH+v+UdHWO85GbjRIOj1O1JE+TgLL+7MEQZbfIckMJLk8l jbOg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=DaLmg7+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 c15-20020a056a00248f00b00543bc7e5bc9si27676398pfv.361.2022.10.22.01.11.22; Sat, 22 Oct 2022 01:11: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=DaLmg7+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 S233085AbiJVIKe (ORCPT + 99 others); Sat, 22 Oct 2022 04:10:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57834 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232818AbiJVIGQ (ORCPT ); Sat, 22 Oct 2022 04:06:16 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 45B242D6549; Sat, 22 Oct 2022 00:53: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 D4F2960BA5; Sat, 22 Oct 2022 07:43:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E9E96C433C1; Sat, 22 Oct 2022 07:43:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424630; bh=sMlQcK6UppnZaZaiO1W30seCru7s+7kjiXGTuxdCF+c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DaLmg7+u6qsqwqH++qf9UZcqWW9WLC4hALelF+0BNvZ14sxZf3Y6Bw6qYVMMFqXlS kDlRxEACDhq1nYw8+MJG585xVSzhanKUMo5uSNCtBEWVjMYT0DEYeWFHBWhYfQ5XR/ SQNQ1fwARx0MRCFUY4JkDwkkcrndaTdU7HjT5JnY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Maciej Fijalkowski , Daniel Borkmann , Magnus Karlsson , Sasha Levin Subject: [PATCH 5.19 217/717] selftests/xsk: Add missing close() on netns fd Date: Sat, 22 Oct 2022 09:21:36 +0200 Message-Id: <20221022072453.646112428@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747374617989341077?= X-GMAIL-MSGID: =?utf-8?q?1747374617989341077?= From: Maciej Fijalkowski [ Upstream commit 8a7d61bdc2fac2c460a2f32a062f5c6dbd21a764 ] Commit 1034b03e54ac ("selftests: xsk: Simplify cleanup of ifobjects") removed close on netns fd, which is not correct, so let us restore it. Fixes: 1034b03e54ac ("selftests: xsk: Simplify cleanup of ifobjects") Signed-off-by: Maciej Fijalkowski Signed-off-by: Daniel Borkmann Acked-by: Magnus Karlsson Link: https://lore.kernel.org/bpf/20220830133905.9945-1-maciej.fijalkowski@intel.com Signed-off-by: Sasha Levin --- tools/testing/selftests/bpf/xdpxceiver.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tools/testing/selftests/bpf/xdpxceiver.c b/tools/testing/selftests/bpf/xdpxceiver.c index e5992a6b5e09..92e466310e27 100644 --- a/tools/testing/selftests/bpf/xdpxceiver.c +++ b/tools/testing/selftests/bpf/xdpxceiver.c @@ -1589,6 +1589,8 @@ static struct ifobject *ifobject_create(void) if (!ifobj->umem) goto out_umem; + ifobj->ns_fd = -1; + return ifobj; out_umem: @@ -1600,6 +1602,8 @@ static struct ifobject *ifobject_create(void) static void ifobject_delete(struct ifobject *ifobj) { + if (ifobj->ns_fd != -1) + close(ifobj->ns_fd); free(ifobj->umem); free(ifobj->xsk_arr); free(ifobj); From patchwork Sat Oct 22 07:21: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: 7263 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1091736wrr; Sat, 22 Oct 2022 00:51:42 -0700 (PDT) X-Google-Smtp-Source: AMsMyM61E/oRSowS0esfaLnyZTFTe9veUW5xTiTUdrDp5uoD1/7cJxkBMxUZmJ1gM+/8zalwpXa8 X-Received: by 2002:a17:90b:4a49:b0:20d:5099:f5cc with SMTP id lb9-20020a17090b4a4900b0020d5099f5ccmr25997028pjb.137.1666425092418; Sat, 22 Oct 2022 00:51:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666425092; cv=none; d=google.com; s=arc-20160816; b=upnriXDoQhFNxRaZDG2Vrr8oXGLH/S0/EGZhQFKImsYipidOp5nX937P7BSZq3GUs5 Prvr0NGm4PHSgVbbkhx6K9v3ufHsrr5cnvqNF2XDEQl10SWdKd/SVf08LlFahzWE3edZ q78EoxLM8gE4Lwxn7RKKauoN2mpDkTzxIbX1L9WfqS69d3ZfXPodphu5hDsRfeyW2Rlv g/E+t+WFLztpQoOrzv+5lYeWHddVG1biWVmvria/qMCte3ieXRerqo1vpeY6PLWDHY9X FpolOSZRTZUROjH7jQSVoO76U05GCAzTLGfo6gfd7uOPW+cQNFrJbaf8byxy1aFX59fQ 55aA== 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=N9UMxzjypajciwKqhbwdJTjx2heuE5HS6V6j3GuNwAE=; b=02NCTQuBL5n1LF5MsaopIRfRncFcZnR5ADB9b60PH1drZ38+BMosgD3zTtrzXvxia3 PqXlEVt8hToNr5w629NAzNLkooCFseDtIc0Iwst3uv2AyIyiitzSyKc5fSaQdFDD3THu C9bBkYiz/iRy2OORXIdAMu6IvE9464vhBUb5ou+KtDVSsWx7W3djScnLTqUjvCbXit5e rt//Pkhhk0Px/YLSb1O8+JVPUHlsfIJtIEXcH3K+NeW6Ijsby4RD9f1am3bt0igQXjWX hG9tdLz5o5gyy4q+y3i9odCmhvL05G7soVetB0siW0xbudP9VhD9TzTlNbByqBnNSih4 ecLA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=KZEUn25x; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 g8-20020a1709026b4800b001784c98bfddsi25296937plt.24.2022.10.22.00.51.19; Sat, 22 Oct 2022 00:51: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=KZEUn25x; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231767AbiJVHu6 (ORCPT + 99 others); Sat, 22 Oct 2022 03:50:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38300 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231756AbiJVHtF (ORCPT ); Sat, 22 Oct 2022 03:49: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 7E82926908D; Sat, 22 Oct 2022 00:45: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 6A21DB82E0C; Sat, 22 Oct 2022 07:43:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A70E6C433C1; Sat, 22 Oct 2022 07:43:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424633; bh=X5Y186WYxWqCHF+6mWY7rwZAQh/o7I6+AlwNmuTbF6s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KZEUn25xzlxv/QrN7jiVYgpT601Z3s5a1VhVc7nArmZ3JYlxRsj5ClKYbVI9y00Nj x05vQn5gMX/hIcDRdcuEjJEDqIH+IwmgnG39CWJW+le9CnL/0oSjKzfpkioTTr+z/o T833tgSwe3jw51IqYTr6hOloN2XbKaZOnb8aWWGw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hao Luo , Hou Tao , Martin KaFai Lau , Sasha Levin Subject: [PATCH 5.19 218/717] bpf: Disable preemption when increasing per-cpu map_locked Date: Sat, 22 Oct 2022 09:21:37 +0200 Message-Id: <20221022072453.805093302@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747373357409885331?= X-GMAIL-MSGID: =?utf-8?q?1747373357409885331?= From: Hou Tao [ Upstream commit 2775da21628738ce073a3a6a806adcbaada0f091 ] Per-cpu htab->map_locked is used to prohibit the concurrent accesses from both NMI and non-NMI contexts. But since commit 74d862b682f5 ("sched: Make migrate_disable/enable() independent of RT"), migrate_disable() is also preemptible under CONFIG_PREEMPT case, so now map_locked also disallows concurrent updates from normal contexts (e.g. userspace processes) unexpectedly as shown below: process A process B htab_map_update_elem() htab_lock_bucket() migrate_disable() /* return 1 */ __this_cpu_inc_return() /* preempted by B */ htab_map_update_elem() /* the same bucket as A */ htab_lock_bucket() migrate_disable() /* return 2, so lock fails */ __this_cpu_inc_return() return -EBUSY A fix that seems feasible is using in_nmi() in htab_lock_bucket() and only checking the value of map_locked for nmi context. But it will re-introduce dead-lock on bucket lock if htab_lock_bucket() is re-entered through non-tracing program (e.g. fentry program). One cannot use preempt_disable() to fix this issue as htab_use_raw_lock being false causes the bucket lock to be a spin lock which can sleep and does not work with preempt_disable(). Therefore, use migrate_disable() when using the spinlock instead of preempt_disable() and defer fixing concurrent updates to when the kernel has its own BPF memory allocator. Fixes: 74d862b682f5 ("sched: Make migrate_disable/enable() independent of RT") Reviewed-by: Hao Luo Signed-off-by: Hou Tao Link: https://lore.kernel.org/r/20220831042629.130006-2-houtao@huaweicloud.com Signed-off-by: Martin KaFai Lau Signed-off-by: Sasha Levin --- kernel/bpf/hashtab.c | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/kernel/bpf/hashtab.c b/kernel/bpf/hashtab.c index 4dd5e0005afa..717f85973443 100644 --- a/kernel/bpf/hashtab.c +++ b/kernel/bpf/hashtab.c @@ -162,17 +162,25 @@ static inline int htab_lock_bucket(const struct bpf_htab *htab, unsigned long *pflags) { unsigned long flags; + bool use_raw_lock; hash = hash & HASHTAB_MAP_LOCK_MASK; - migrate_disable(); + use_raw_lock = htab_use_raw_lock(htab); + if (use_raw_lock) + preempt_disable(); + else + migrate_disable(); if (unlikely(__this_cpu_inc_return(*(htab->map_locked[hash])) != 1)) { __this_cpu_dec(*(htab->map_locked[hash])); - migrate_enable(); + if (use_raw_lock) + preempt_enable(); + else + migrate_enable(); return -EBUSY; } - if (htab_use_raw_lock(htab)) + if (use_raw_lock) raw_spin_lock_irqsave(&b->raw_lock, flags); else spin_lock_irqsave(&b->lock, flags); @@ -185,13 +193,18 @@ static inline void htab_unlock_bucket(const struct bpf_htab *htab, struct bucket *b, u32 hash, unsigned long flags) { + bool use_raw_lock = htab_use_raw_lock(htab); + hash = hash & HASHTAB_MAP_LOCK_MASK; - if (htab_use_raw_lock(htab)) + if (use_raw_lock) raw_spin_unlock_irqrestore(&b->raw_lock, flags); else spin_unlock_irqrestore(&b->lock, flags); __this_cpu_dec(*(htab->map_locked[hash])); - migrate_enable(); + if (use_raw_lock) + preempt_enable(); + else + migrate_enable(); } static bool htab_lru_map_delete_node(void *arg, struct bpf_lru_node *node); From patchwork Sat Oct 22 07:21: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: 7270 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1091914wrr; Sat, 22 Oct 2022 00:52:15 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4H/SI9Bd0uUgTwJw1LdAD8KbHkbv+SJWQb0/I0PTT/wPOXTeqNoTIvGim5bnajXuY+lXpg X-Received: by 2002:a63:5955:0:b0:438:8287:6a43 with SMTP id j21-20020a635955000000b0043882876a43mr19252056pgm.495.1666425135362; Sat, 22 Oct 2022 00:52:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666425135; cv=none; d=google.com; s=arc-20160816; b=eJ/TAhImNhn6HNDa2NkI9fZ6ok9vq10cWS12zin/bUFrSef+DflZB6oQHMC1h737gn amIexTKaleyhXWDy1wwK5MD0USszrIsGWJ4o61TSXhiJArFIRy1kdXL8xkJRUg2qftR4 4GgtIYbJs0Ypi+2kDF9pKA9JV3putNZZ71awMsvS4w/c5W39BsV4EuECAzJreflK6c10 YGGmQyOD7g6kTLwpoG7IHU/q52qC9Lze8TWkrjoPVb8Zrmh/IMbDYQUYvyFkPPu1UWy/ B+dfnT1wfsYxyrp35XjUCslgnDBw/gmqrRmf8SMEFNctM5lRWCUetrD9AKizo3b7KFNS 1c6w== 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=1q3Nr3s1tG92jsFCGg70+hkh/BKyzFIsBGyp3rjROks=; b=HzFR1qSQMltQFxp7fqJDhdQeoSyznl3h4OUFKnEuoFE/uMAQ7piSaaF4IHQpibwgd9 63RdXt55YthitoSg599xk+QkQD866Maydi+av6kyYSsEg50Gqi0B/odiGWJuPOTyxXgz 1XeC6SCZfJmSgGikJmtqUNCVZ59l+/3d5KjLQCfl0zbDtNBlcj4E+mlcz/6zF7r43W32 VWlgXUH/bQvZWnEwnOBfv8Czw7IqjQqsgoqXjnsU1crlSzP/nQRfeoPsu+2M7meT+IhJ f0E488gyw2e3zGLL0uB3sy4C+BehzYHPlNkdKpV+jvTtwyHm+NmOHMYSaF7snKlLwxFO p7aQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=P1YRs7C1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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-20020a17090322d000b0017c0d822437si29276768plg.82.2022.10.22.00.52.02; Sat, 22 Oct 2022 00:52: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=P1YRs7C1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231954AbiJVHvk (ORCPT + 99 others); Sat, 22 Oct 2022 03:51:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51316 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231800AbiJVHtK (ORCPT ); Sat, 22 Oct 2022 03:49: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 4B869263B6E; Sat, 22 Oct 2022 00:46: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 076A1B82E0A; Sat, 22 Oct 2022 07:43:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5C927C433D6; Sat, 22 Oct 2022 07:43:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424635; bh=tT3anD75WlhdKhqutw+l0nDcDEE3SDZgAaFmH8y3fag=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=P1YRs7C1/pXV7rzP35otxYKrd7Yh2GKOz8rhFyJ3ikJwKzfYtkZQLUdRQymRqLYRG j0utn4lc2ziQdiVJGJV0/MSROQPKuhfunQkfgh1FDjqnmONctTMjkSYgcM7qrrEO4J lefCFDMKIqofZSrW24cpMjI0c8CuD8oKvP8gM5NA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hao Sun , Hou Tao , Martin KaFai Lau , Sasha Levin Subject: [PATCH 5.19 219/717] bpf: Propagate error from htab_lock_bucket() to userspace Date: Sat, 22 Oct 2022 09:21:38 +0200 Message-Id: <20221022072453.934425338@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747373402934440991?= X-GMAIL-MSGID: =?utf-8?q?1747373402934440991?= From: Hou Tao [ Upstream commit 66a7a92e4d0d091e79148a4c6ec15d1da65f4280 ] In __htab_map_lookup_and_delete_batch() if htab_lock_bucket() returns -EBUSY, it will go to next bucket. Going to next bucket may not only skip the elements in current bucket silently, but also incur out-of-bound memory access or expose kernel memory to userspace if current bucket_cnt is greater than bucket_size or zero. Fixing it by stopping batch operation and returning -EBUSY when htab_lock_bucket() fails, and the application can retry or skip the busy batch as needed. Fixes: 20b6cc34ea74 ("bpf: Avoid hashtab deadlock with map_locked") Reported-by: Hao Sun Signed-off-by: Hou Tao Link: https://lore.kernel.org/r/20220831042629.130006-3-houtao@huaweicloud.com Signed-off-by: Martin KaFai Lau Signed-off-by: Sasha Levin --- kernel/bpf/hashtab.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/kernel/bpf/hashtab.c b/kernel/bpf/hashtab.c index 717f85973443..e20f3d0e3fc7 100644 --- a/kernel/bpf/hashtab.c +++ b/kernel/bpf/hashtab.c @@ -1704,8 +1704,11 @@ __htab_map_lookup_and_delete_batch(struct bpf_map *map, /* do not grab the lock unless need it (bucket_cnt > 0). */ if (locked) { ret = htab_lock_bucket(htab, b, batch, &flags); - if (ret) - goto next_batch; + if (ret) { + rcu_read_unlock(); + bpf_enable_instrumentation(); + goto after_loop; + } } bucket_cnt = 0; From patchwork Sat Oct 22 07:21: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: 7287 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1092301wrr; Sat, 22 Oct 2022 00:53:44 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4a0JpC0n8VrBxU84hSF+4neYChfrpj3+AkEwPo/+1yiqhOt8B4WvYjLrSblxXWRKdm4hg/ X-Received: by 2002:aa7:8d57:0:b0:562:b63c:c2ba with SMTP id s23-20020aa78d57000000b00562b63cc2bamr23365912pfe.29.1666425224054; Sat, 22 Oct 2022 00:53:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666425224; cv=none; d=google.com; s=arc-20160816; b=I3S4+PG7SnRLCFxQSsmNiOgZlHKrkFcTp/22CL5ArQ/z+oqy7yhLjaYfQ5q3acS+hQ Eb2XMWtnTSNjT3/QgFkU3tfjSTNGQKLZl+9fV5YWWerbHW9LH+tVAU4AeQOeE0pkHd4w niNu43KBEJYOhdZyYvjL8aF4DgkmNrf/tpTu+mBkGzXrnXXz2tcV/CZHQXO+y5MEPhZh sMRNY1M6LSrfJ6cRibKYWSwuD/UaCXmhCSQH9p43+5rXqxHPdSoE5mDi7VnsvAZ72TmG 7aLiErneY3i/5M3j/SwuJjFVgjJV+wOjRROJvgagU3a8EvNlM7V790iZL/Bvsiyqe6BL I10A== 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=frXKdYCmf2VUFbylet0lPHhkmiZiLY6rvAchhXZCO5Y=; b=p7VErztZiOLrr4B/YQ9ZGXlSE/Z1tike1eR3a9PplrUNil/tcoZrcgJPS8w4N1SHjV wJuN+yBsdntUh7RWoqwfUu77sFx6xH/9KBZL9/3fTVg2mbqbrKm/x055FYzFuQS7RRQG A6xLf8nZBWe+ESNidSSkzYGLWtLc+97mgswOs22Ch7Pp5MZFD0ybYGru+JBn+tSNTpli OXOZO3EUTvQ9JRKdKjvQya7OqwLmZlvO/y4aq8Dtn8vtfYu1+aMrpdpJ0RxHIX2QQpPI AYMh6Pkcp6wfBfCY9CNAmiV+kchMDe9Hek5kNFBHomwR2ncRCHIia92VSqK44iAX589j 9uxA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Qfr3WgPc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 j63-20020a638042000000b0046e9babe7a1si8080359pgd.54.2022.10.22.00.53.31; Sat, 22 Oct 2022 00:53: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=Qfr3WgPc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231717AbiJVHxQ (ORCPT + 99 others); Sat, 22 Oct 2022 03:53:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54872 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231603AbiJVHuz (ORCPT ); Sat, 22 Oct 2022 03:50: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 A18AA2C5008; Sat, 22 Oct 2022 00:46: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 E21E360B9E; Sat, 22 Oct 2022 07:43:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EF674C433C1; Sat, 22 Oct 2022 07:43:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424638; bh=UP6/5bUIx86QqfWwa+jZPOVnwVLzQc1gxndFdDGRzKY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Qfr3WgPc6YywoWel2r9V3stlVw/m2KRkI8CaNHIGs2I3eOA7+u5mI60cDHU0OIDZ5 a+rNxtSvR+Su2ncJ2TafdCiY09wKzIftqjY2g0/eOSKoS/R/tm5/Qxo0p+UFONp3B8 oGBLshhUjZRUo4HSGGDu5wOzEX5BXlu4KLQUbayo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Manikanta Pubbisetty , Kalle Valo , Sasha Levin Subject: [PATCH 5.19 220/717] wifi: ath11k: Fix incorrect QMI message ID mappings Date: Sat, 22 Oct 2022 09:21:39 +0200 Message-Id: <20221022072454.078226564@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747373495502224454?= X-GMAIL-MSGID: =?utf-8?q?1747373495502224454?= From: Manikanta Pubbisetty [ Upstream commit b3ca32308e46b6384fdcb7e64b3fca4f61aff14b ] QMI message IDs for some of the QMI messages were incorrectly defined in the original implementation. These have to be corrected to enable cold boot support on WCN6750. These corrections are applicable for all chipsets and will not impact them. Refactor the code accordingly. Tested-on: WCN6750 hw1.0 AHB WLAN.MSL.1.0.1-00887-QCAMSLSWPLZ-1 Fixes: d5c65159f289 ("ath11k: driver for Qualcomm IEEE 802.11ax devices") Signed-off-by: Manikanta Pubbisetty Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/20220720134909.15626-2-quic_mpubbise@quicinc.com Signed-off-by: Sasha Levin --- drivers/net/wireless/ath/ath11k/qmi.c | 38 ++++++++++++++++++++++++--- drivers/net/wireless/ath/ath11k/qmi.h | 10 +++++-- 2 files changed, 43 insertions(+), 5 deletions(-) diff --git a/drivers/net/wireless/ath/ath11k/qmi.c b/drivers/net/wireless/ath/ath11k/qmi.c index 61ead37a944a..109f4b618428 100644 --- a/drivers/net/wireless/ath/ath11k/qmi.c +++ b/drivers/net/wireless/ath/ath11k/qmi.c @@ -1696,6 +1696,13 @@ static struct qmi_elem_info qmi_wlanfw_wlan_ini_resp_msg_v01_ei[] = { }, }; +static struct qmi_elem_info qmi_wlfw_fw_init_done_ind_msg_v01_ei[] = { + { + .data_type = QMI_EOTI, + .array_type = NO_ARRAY, + }, +}; + static int ath11k_qmi_host_cap_send(struct ath11k_base *ab) { struct qmi_wlanfw_host_cap_req_msg_v01 req; @@ -3006,6 +3013,10 @@ static void ath11k_qmi_msg_fw_ready_cb(struct qmi_handle *qmi_hdl, struct ath11k_base *ab = qmi->ab; ath11k_dbg(ab, ATH11K_DBG_QMI, "qmi firmware ready\n"); + + ab->qmi.cal_done = 1; + wake_up(&ab->qmi.cold_boot_waitq); + ath11k_qmi_driver_event_post(qmi, ATH11K_QMI_EVENT_FW_READY, NULL); } @@ -3018,11 +3029,22 @@ static void ath11k_qmi_msg_cold_boot_cal_done_cb(struct qmi_handle *qmi_hdl, struct ath11k_qmi, handle); struct ath11k_base *ab = qmi->ab; - ab->qmi.cal_done = 1; - wake_up(&ab->qmi.cold_boot_waitq); ath11k_dbg(ab, ATH11K_DBG_QMI, "qmi cold boot calibration done\n"); } +static void ath11k_qmi_msg_fw_init_done_cb(struct qmi_handle *qmi_hdl, + struct sockaddr_qrtr *sq, + struct qmi_txn *txn, + const void *decoded) +{ + struct ath11k_qmi *qmi = container_of(qmi_hdl, + struct ath11k_qmi, handle); + struct ath11k_base *ab = qmi->ab; + + ath11k_qmi_driver_event_post(qmi, ATH11K_QMI_EVENT_FW_INIT_DONE, NULL); + ath11k_dbg(ab, ATH11K_DBG_QMI, "qmi firmware init done\n"); +} + static const struct qmi_msg_handler ath11k_qmi_msg_handlers[] = { { .type = QMI_INDICATION, @@ -3053,6 +3075,14 @@ static const struct qmi_msg_handler ath11k_qmi_msg_handlers[] = { sizeof(struct qmi_wlanfw_fw_cold_cal_done_ind_msg_v01), .fn = ath11k_qmi_msg_cold_boot_cal_done_cb, }, + { + .type = QMI_INDICATION, + .msg_id = QMI_WLFW_FW_INIT_DONE_IND_V01, + .ei = qmi_wlfw_fw_init_done_ind_msg_v01_ei, + .decoded_size = + sizeof(struct qmi_wlfw_fw_init_done_ind_msg_v01), + .fn = ath11k_qmi_msg_fw_init_done_cb, + }, }; static int ath11k_qmi_ops_new_server(struct qmi_handle *qmi_hdl, @@ -3145,7 +3175,7 @@ static void ath11k_qmi_driver_event_work(struct work_struct *work) } break; - case ATH11K_QMI_EVENT_FW_READY: + case ATH11K_QMI_EVENT_FW_INIT_DONE: clear_bit(ATH11K_FLAG_QMI_FAIL, &ab->dev_flags); if (test_bit(ATH11K_FLAG_REGISTERED, &ab->dev_flags)) { ath11k_hal_dump_srng_stats(ab); @@ -3168,6 +3198,8 @@ static void ath11k_qmi_driver_event_work(struct work_struct *work) set_bit(ATH11K_FLAG_REGISTERED, &ab->dev_flags); } + break; + case ATH11K_QMI_EVENT_FW_READY: break; case ATH11K_QMI_EVENT_COLD_BOOT_CAL_DONE: break; diff --git a/drivers/net/wireless/ath/ath11k/qmi.h b/drivers/net/wireless/ath/ath11k/qmi.h index c83cf822be81..2ec56a34fa81 100644 --- a/drivers/net/wireless/ath/ath11k/qmi.h +++ b/drivers/net/wireless/ath/ath11k/qmi.h @@ -31,8 +31,9 @@ #define QMI_WLFW_REQUEST_MEM_IND_V01 0x0035 #define QMI_WLFW_FW_MEM_READY_IND_V01 0x0037 -#define QMI_WLFW_COLD_BOOT_CAL_DONE_IND_V01 0x0021 -#define QMI_WLFW_FW_READY_IND_V01 0x0038 +#define QMI_WLFW_COLD_BOOT_CAL_DONE_IND_V01 0x003E +#define QMI_WLFW_FW_READY_IND_V01 0x0021 +#define QMI_WLFW_FW_INIT_DONE_IND_V01 0x0038 #define QMI_WLANFW_MAX_DATA_SIZE_V01 6144 #define ATH11K_FIRMWARE_MODE_OFF 4 @@ -69,6 +70,7 @@ enum ath11k_qmi_event_type { ATH11K_QMI_EVENT_FORCE_FW_ASSERT, ATH11K_QMI_EVENT_POWER_UP, ATH11K_QMI_EVENT_POWER_DOWN, + ATH11K_QMI_EVENT_FW_INIT_DONE, ATH11K_QMI_EVENT_MAX, }; @@ -291,6 +293,10 @@ struct qmi_wlanfw_fw_cold_cal_done_ind_msg_v01 { char placeholder; }; +struct qmi_wlfw_fw_init_done_ind_msg_v01 { + char placeholder; +}; + #define QMI_WLANFW_CAP_REQ_MSG_V01_MAX_LEN 0 #define QMI_WLANFW_CAP_RESP_MSG_V01_MAX_LEN 235 #define QMI_WLANFW_CAP_REQ_V01 0x0024 From patchwork Sat Oct 22 07:21: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: 7289 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1092376wrr; Sat, 22 Oct 2022 00:53:57 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5Y0iVkJW9nxNvlf66DjClYjkcqCNjBZSK94QOKulIuSufKJ1quPrT4QUvNMJSh15uGJ23B X-Received: by 2002:a17:90b:254e:b0:20b:7e26:f0a0 with SMTP id nw14-20020a17090b254e00b0020b7e26f0a0mr60178362pjb.203.1666425226349; Sat, 22 Oct 2022 00:53:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666425226; cv=none; d=google.com; s=arc-20160816; b=v+8rVIqV/N3KRp9ZqPZ3PAXp/twTEjjSWfOI8zbfiWancpGUeD0lpPW29pvD40JSol S6HnYXiKJEP4fj/9v/Wy5lDUUYt53PDyPpYSzRL5EhlVdd2U7AJ8vOWgKwmIiBs/I754 pR7Xvqyu/mx6xMqyKRXTItJDJ7hlCgmRG3MRqDc+ZtSInPxWWmpo74qCSMKZ7GR+/bvE HaTy4LlQz4eyNXXaWom4ckhDukKQusbRgxTlnCTyU37mBON+DeiSKh9K9hfokFn2ny8c q3j0NjamqDGM2rrxScDslddQV7XWURR70eXbf6EufEcuQX9CQclHJ0AfnsdAmx93Idl8 1I/g== 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=P8mjak5nTDJH0TaxJk3QWYe/p1OZ6iGjt0fYIhsGcuw=; b=fCj6noOtxgIQhBgXyvWXSVFyZbR69FYHx73clT9pbYuX0Rx3nhZHX1TZZTPMkVcXrb a6Ftegc+e0KKW5HqfFXe/NdvmTF8j7RbD5SWyzlNN9STdJdE00sYoBT6DCxjDacf9ppX 3UndtOQDDAjjcSVx9ZZ0YmSMDtuvgwbAkZ705kxio8ji7Va2zi0bY14aI8YGMJ3HoKe5 OG1v3EO12IK3uAltWqkId16TZTznYTX0DLTSpscMv8EyL82M4qDJtgBL3PO+me1D9YzS y2Sc1Abmmk1FCeEjR6wdRcAMHIHqblbE9JufKsGdB67mJYbszjBoPsm14QqjpJTu3IiJ qIuQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=XwfLxX3G; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 n8-20020a1709026a8800b0016be68156aesi24942243plk.173.2022.10.22.00.53.34; Sat, 22 Oct 2022 00:53: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=XwfLxX3G; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231485AbiJVHxV (ORCPT + 99 others); Sat, 22 Oct 2022 03:53:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54874 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231751AbiJVHu5 (ORCPT ); Sat, 22 Oct 2022 03:50:57 -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 985038A6DE; Sat, 22 Oct 2022 00:46: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 BF71560B3D; Sat, 22 Oct 2022 07:44:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AE747C433D6; Sat, 22 Oct 2022 07:44:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424641; bh=fOZI99R9xfcgoIm40CdSm7/zmpiNb38vJN2fwxj97xQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XwfLxX3GhSxhqhdMdHZPtGG4vawlKb4qhdSupzz2OtY/nsAFRV3O3SIkTnbyr5NO4 ZTy6r3DUiDN3dAW2GIWV6qcnZZouq6PGznF/MA6kx6myEQy2u69yh28P2QH61Q0EL1 4h7I+HpkxvamDm9nmX9WtFyN65z2PO2PVmJjKvA8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hou Tao , Alexei Starovoitov , Martin KaFai Lau , Sasha Levin Subject: [PATCH 5.19 221/717] bpf: Use this_cpu_{inc|dec|inc_return} for bpf_task_storage_busy Date: Sat, 22 Oct 2022 09:21:40 +0200 Message-Id: <20221022072454.252150939@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747373498377779421?= X-GMAIL-MSGID: =?utf-8?q?1747373498377779421?= From: Hou Tao [ Upstream commit 197827a05e13808c60f52632e9887eede63f1c16 ] Now migrate_disable() does not disable preemption and under some architectures (e.g. arm64) __this_cpu_{inc|dec|inc_return} are neither preemption-safe nor IRQ-safe, so for fully preemptible kernel concurrent lookups or updates on the same task local storage and on the same CPU may make bpf_task_storage_busy be imbalanced, and bpf_task_storage_trylock() on the specific cpu will always fail. Fixing it by using this_cpu_{inc|dec|inc_return} when manipulating bpf_task_storage_busy. Fixes: bc235cdb423a ("bpf: Prevent deadlock from recursive bpf_task_storage_[get|delete]") Signed-off-by: Hou Tao Acked-by: Alexei Starovoitov Link: https://lore.kernel.org/r/20220901061938.3789460-2-houtao@huaweicloud.com Signed-off-by: Martin KaFai Lau Signed-off-by: Sasha Levin --- kernel/bpf/bpf_local_storage.c | 4 ++-- kernel/bpf/bpf_task_storage.c | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/kernel/bpf/bpf_local_storage.c b/kernel/bpf/bpf_local_storage.c index 8ce40fd869f6..d13ffb00e981 100644 --- a/kernel/bpf/bpf_local_storage.c +++ b/kernel/bpf/bpf_local_storage.c @@ -555,11 +555,11 @@ void bpf_local_storage_map_free(struct bpf_local_storage_map *smap, struct bpf_local_storage_elem, map_node))) { if (busy_counter) { migrate_disable(); - __this_cpu_inc(*busy_counter); + this_cpu_inc(*busy_counter); } bpf_selem_unlink(selem, false); if (busy_counter) { - __this_cpu_dec(*busy_counter); + this_cpu_dec(*busy_counter); migrate_enable(); } cond_resched_rcu(); diff --git a/kernel/bpf/bpf_task_storage.c b/kernel/bpf/bpf_task_storage.c index e9014dc62682..6f290623347e 100644 --- a/kernel/bpf/bpf_task_storage.c +++ b/kernel/bpf/bpf_task_storage.c @@ -26,20 +26,20 @@ static DEFINE_PER_CPU(int, bpf_task_storage_busy); static void bpf_task_storage_lock(void) { migrate_disable(); - __this_cpu_inc(bpf_task_storage_busy); + this_cpu_inc(bpf_task_storage_busy); } static void bpf_task_storage_unlock(void) { - __this_cpu_dec(bpf_task_storage_busy); + this_cpu_dec(bpf_task_storage_busy); migrate_enable(); } static bool bpf_task_storage_trylock(void) { migrate_disable(); - if (unlikely(__this_cpu_inc_return(bpf_task_storage_busy) != 1)) { - __this_cpu_dec(bpf_task_storage_busy); + if (unlikely(this_cpu_inc_return(bpf_task_storage_busy) != 1)) { + this_cpu_dec(bpf_task_storage_busy); migrate_enable(); return false; } From patchwork Sat Oct 22 07:21: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: 7307 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1093317wrr; Sat, 22 Oct 2022 00:56:49 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4JpxTYiBfdbi7GsXEAQShS0+Ke3O7rYxOSKJAfAh1MDVjrPZo2Kpmm8IxXjevzow1uWstA X-Received: by 2002:a17:902:a508:b0:181:2875:3b09 with SMTP id s8-20020a170902a50800b0018128753b09mr22650248plq.45.1666425409354; Sat, 22 Oct 2022 00:56:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666425409; cv=none; d=google.com; s=arc-20160816; b=suB75QGRrVhVulHI/hQ2EWW5dk14a+vP2nZmYUWH6EYm7dip/y7gu38r+EniorAFgd EI2B6bhy26P0TWa7ji6mDIsKGiGs/UeGY3mFxA1NzHX56lFCSQjoE1bI/NoN7PpMXBJB F0BSfKwYFjv4X6GmG/GSZ9CRNnOLI/CxGinlAVBYcqGSFgNAmfBW/LChyb3rBPLqwarc gkBDSO63MMAwmEJgoo03mRIIglzBPJIxOxnZ6/nZq+iqEueUmyp0Kdp3SltE3V7x5qv3 PhgU9RvmmzmlSYt6tX/ff2Khp3QmGrCYDZr2NsaZKRdrkldt3hnWJAc2JdjGvrMdaQGQ zqOQ== 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=MQzSTSETcp7kHGAbY0+NIIQtNWr2Jk+RL9zuq32GKwQ=; b=T/ZMtDFPp6k8fIuJpDkppdRms7oETuiM3jOK/x0fOL8DvGqxigoK1LrZIqWvI6CV4+ cckFDKdVwwLGeAHlXRIJPO8vH84aXoj6pSvns+faTlvY4QOcbslhaVWBQfcR8r3Cmebw Cp4bMZS5dyIkWW6qicOQvRtYbqCBCTfho2Qz3wgr9cQUxUE/mX9guHt/eUD+dP3l4Rzg IiohbgZAv5g+dS0C8xt62R2E/aO7LbxRJSHvK46c1OVQ9c1JhHEeNxPtiMdzxQlKWrjW d47fnVR8z0xL5rvR9VZXtqNHpt8M6slFTL7oAGs4Xk5A+UGY1pRHraRRaghyB+Et6bk6 2Q8A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="Qte8nB/3"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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-20020a1709027d8800b0017f914799b4si24892353plm.175.2022.10.22.00.56.37; Sat, 22 Oct 2022 00: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="Qte8nB/3"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S232243AbiJVH4M (ORCPT + 99 others); Sat, 22 Oct 2022 03:56:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42398 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231795AbiJVHwk (ORCPT ); Sat, 22 Oct 2022 03:52: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 763362C5035; Sat, 22 Oct 2022 00:46: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 dfw.source.kernel.org (Postfix) with ESMTPS id 650F660BAA; Sat, 22 Oct 2022 07:44:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 76D55C433D6; Sat, 22 Oct 2022 07:44:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424643; bh=paWKtYTyYvMynckSb7l/wvrQRez0ic+BTjI/PbHFihA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Qte8nB/3jz1qz1zrJvzwWet/4k5Nq7wyJnXVNQ/DV0evldXl1GEtKUmrSmPAgGrnQ cwTYDbeA9k8eAWxkCi1gSOT2jzaNHomBtrcSfXZJYlyyS5YMRVtdmzeaQFaeycbCyo KmTJrUoQdZDwQaICGVsZkkWFMuId+/hMENr5LSKY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hou Tao , Alexei Starovoitov , Martin KaFai Lau , Sasha Levin Subject: [PATCH 5.19 222/717] bpf: Use this_cpu_{inc_return|dec} for prog->active Date: Sat, 22 Oct 2022 09:21:41 +0200 Message-Id: <20221022072454.422004579@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747373689708963512?= X-GMAIL-MSGID: =?utf-8?q?1747373689708963512?= From: Hou Tao [ Upstream commit c89e843a11f1075d27684f6b42256213e4592383 ] Both __this_cpu_inc_return() and __this_cpu_dec() are not preemption safe and now migrate_disable() doesn't disable preemption, so the update of prog-active is not atomic and in theory under fully preemptible kernel recurisve prevention may do not work. Fixing by using the preemption-safe and IRQ-safe variants. Fixes: ca06f55b9002 ("bpf: Add per-program recursion prevention mechanism") Signed-off-by: Hou Tao Acked-by: Alexei Starovoitov Link: https://lore.kernel.org/r/20220901061938.3789460-3-houtao@huaweicloud.com Signed-off-by: Martin KaFai Lau Signed-off-by: Sasha Levin --- kernel/bpf/trampoline.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/kernel/bpf/trampoline.c b/kernel/bpf/trampoline.c index 93c7675f0c9e..fe4f4d9d043b 100644 --- a/kernel/bpf/trampoline.c +++ b/kernel/bpf/trampoline.c @@ -585,7 +585,7 @@ u64 notrace __bpf_prog_enter(struct bpf_prog *prog, struct bpf_tramp_run_ctx *ru run_ctx->saved_run_ctx = bpf_set_run_ctx(&run_ctx->run_ctx); - if (unlikely(__this_cpu_inc_return(*(prog->active)) != 1)) { + if (unlikely(this_cpu_inc_return(*(prog->active)) != 1)) { inc_misses_counter(prog); return 0; } @@ -620,7 +620,7 @@ void notrace __bpf_prog_exit(struct bpf_prog *prog, u64 start, struct bpf_tramp_ bpf_reset_run_ctx(run_ctx->saved_run_ctx); update_prog_stats(prog, start); - __this_cpu_dec(*(prog->active)); + this_cpu_dec(*(prog->active)); migrate_enable(); rcu_read_unlock(); } @@ -631,7 +631,7 @@ u64 notrace __bpf_prog_enter_sleepable(struct bpf_prog *prog, struct bpf_tramp_r migrate_disable(); might_fault(); - if (unlikely(__this_cpu_inc_return(*(prog->active)) != 1)) { + if (unlikely(this_cpu_inc_return(*(prog->active)) != 1)) { inc_misses_counter(prog); return 0; } @@ -647,7 +647,7 @@ void notrace __bpf_prog_exit_sleepable(struct bpf_prog *prog, u64 start, bpf_reset_run_ctx(run_ctx->saved_run_ctx); update_prog_stats(prog, start); - __this_cpu_dec(*(prog->active)); + this_cpu_dec(*(prog->active)); migrate_enable(); rcu_read_unlock_trace(); } From patchwork Sat Oct 22 07:21: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: 7586 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1106325wrr; Sat, 22 Oct 2022 01:37:31 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6c96X0kxpvHmoopFZ2y6goaxHR60S5UKfUD5aKmRvN79rOUHk7xPwctC76x+W9xPhiCCVW X-Received: by 2002:aa7:810a:0:b0:55b:674d:d123 with SMTP id b10-20020aa7810a000000b0055b674dd123mr24014545pfi.52.1666427851302; Sat, 22 Oct 2022 01:37:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666427851; cv=none; d=google.com; s=arc-20160816; b=IUEypcmxzJ+SzM/658wVtvgD4zolHS0biwnpX8v5WDv0wQndFj5ZVYcnxLc4o7oFON JCVyR7dnQ9Ikxhu0TNvKgiWhRM7/NygM2uCeh5dnZnxCXPuWno90q0JSBsceU0ksxlH4 Tz+V1dQ4SD1Mut10vafrKfauVm767w3iimFO5qwFsbTx6+lPS8jYuKU897jHkRCH7v+i 09WWP8jR9xqyHftzEBwryFixRdl7fVu5xvoSlPEnTdgilRFJcnu/AxDKPVeasLEzpHi+ XNGHp83WzBXxMXvJtcNzn9Kys4AOuqYqgsHbcmZSa4s/6+qii69z1ITlvhy8coJ14NWN EY+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=WNy0nPlFRZHmyMlcEQ3i6SsH/psOvkNF4ZRngkZbBgE=; b=MpyFOt/PevacjaAMkTz9kzgaZcfYRSw5UuesihPuTGp0CjmV4V7qP1/rrm6pya5gVh JP+6c+IUOXhJpUtroVGpcre55wxkwVpimk/fg9RPe6SNz+kXkDBk4MLyAooQI4vw0pBj yGvmHXs/xYFL7+QBgBMgWQIhEiO9jyJDk1/xq4TH4q+W0xwtVHQViJrwFaGnJO0CSGon 9XLc2dSzRvz0Tp49o43E5Asb/J4bkfRPFHnV+PlNPUuy1EvvDQndPcjIg456io65fhJO bx5E8gnvGoMzdxwXPASNlFI7h2Q/QMpv26T8sCFzzWPQy+UUnBQuotD8exQ/6pgIO9pU IKEQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Y4z6GNUV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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-20020a170902cf4c00b001865b86ad09si10256465plg.419.2022.10.22.01.37.17; Sat, 22 Oct 2022 01:37: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=Y4z6GNUV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S234072AbiJVIdC (ORCPT + 99 others); Sat, 22 Oct 2022 04:33:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58058 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234122AbiJVI3k (ORCPT ); Sat, 22 Oct 2022 04: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 ECDB72E38E2; Sat, 22 Oct 2022 01: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 067BFB82E15; Sat, 22 Oct 2022 07:44:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 55312C433C1; Sat, 22 Oct 2022 07:44:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424646; bh=jUXwn7KHB5zBLuslpmUGxlvhoJHk8Cr4CZPjaxdURag=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Y4z6GNUVffkOsELd6eGUWNy4c8m4md/IcYS0FiyzfkQootkNGBT2OhXDHgG3rsIA8 zA+WMM795Umssa41orYmOlmKIl/0LY44PqWAxARUe/roQXoqI84MSAVdZyLxgsAqdc xa+FvBKShqZ+/bhculEXkRa9cS6R47f05Yd888SI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jing Cai , Sean Wang , Luiz Augusto von Dentz , Sasha Levin Subject: [PATCH 5.19 223/717] Bluetooth: btusb: mediatek: fix WMT failure during runtime suspend Date: Sat, 22 Oct 2022 09:21:42 +0200 Message-Id: <20221022072454.584448188@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376251044657025?= X-GMAIL-MSGID: =?utf-8?q?1747376251044657025?= From: Sean Wang [ Upstream commit fd3f106677bac70437dc12e76c827294ed495a44 ] WMT cmd/event doesn't follow up the generic HCI cmd/event handling, it needs constantly polling control pipe until the host received the WMT event, thus, we should require to specifically acquire PM counter on the USB to prevent the interface from entering auto suspended while WMT cmd/event in progress. Fixes: a1c49c434e15 ("Bluetooth: btusb: Add protocol support for MediaTek MT7668U USB devices") Co-developed-by: Jing Cai Signed-off-by: Jing Cai Signed-off-by: Sean Wang Signed-off-by: Luiz Augusto von Dentz Signed-off-by: Sasha Levin --- drivers/bluetooth/btusb.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c index aaba2d737178..6a320ece3276 100644 --- a/drivers/bluetooth/btusb.c +++ b/drivers/bluetooth/btusb.c @@ -2451,15 +2451,29 @@ static int btusb_mtk_hci_wmt_sync(struct hci_dev *hdev, set_bit(BTUSB_TX_WAIT_VND_EVT, &data->flags); + /* WMT cmd/event doesn't follow up the generic HCI cmd/event handling, + * it needs constantly polling control pipe until the host received the + * WMT event, thus, we should require to specifically acquire PM counter + * on the USB to prevent the interface from entering auto suspended + * while WMT cmd/event in progress. + */ + err = usb_autopm_get_interface(data->intf); + if (err < 0) + goto err_free_wc; + err = __hci_cmd_send(hdev, 0xfc6f, hlen, wc); if (err < 0) { clear_bit(BTUSB_TX_WAIT_VND_EVT, &data->flags); + usb_autopm_put_interface(data->intf); goto err_free_wc; } /* Submit control IN URB on demand to process the WMT event */ err = btusb_mtk_submit_wmt_recv_urb(hdev); + + usb_autopm_put_interface(data->intf); + if (err < 0) goto err_free_wc; From patchwork Sat Oct 22 07:21: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: 7269 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1091891wrr; Sat, 22 Oct 2022 00:52:10 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6UN0MvJVOLy+OWjuNN0YDIotea3S7PFQZ2+8sGp+iaZIxwiVJluz/+p/ntMwclutVxbM7t X-Received: by 2002:a63:1e21:0:b0:43a:b17f:cd13 with SMTP id e33-20020a631e21000000b0043ab17fcd13mr19631868pge.553.1666425130420; Sat, 22 Oct 2022 00:52:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666425130; cv=none; d=google.com; s=arc-20160816; b=TpBCWUDrS0tkfEj0+BhIueYIjRTEHCQA1v8IfFjkChYtGFh/aQCu9NTFudn/sUsC2P vtmC7QFEDt9ivO48FRl5F/IlExW2ZOMQ4fmsQKtLw13Kk463saW8mVj63x5JRCuCXQ5n paD2ktIwxxR6xPA8wPcSMqrOJT2wl7Ns6uAzwcb/W049ihqH1fD1y4274ZUdnOtIdBhs Qxb04xpmS0p7jqHzRSRzC/twl86mYC3F4274VuLZ/8Vkq+gU7YdfOF8vNXIIBfNgfXR+ dF8Jj6ouX1/19Z8vW7ifhjbHeHr4judj8PlaS54rmC+a849ImnXp06NgQ48hM/eqVtit Ii6w== 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=puHrylIcUQXyy+9n3X4N9ZP60S4cYHXsswaoYmVReJc=; b=dDYQq+l8pnMVpFMRB7B2cm54YbsQOiG3edYJbNuAFZ9Bm/1jFDc1OsxdjfTxUnwyWJ 9S2Iwb2Oa+9h5KabM4YaCUKyKQjbJUkUz8/Pw+3Na6yty1dMh3vV2QBo46Z0JZDl6hxN fnh2RN0wXsoCzv4mQbKlO2pTchi8vO8pk66/Ab2L5L0DH1mQ/XuEMc1a5n5UBMbUvicD fkwz3ZrNUT4ojTQnjD7lNEryoGVKq7gnMd7mXBrTVhDRi4f9+9vHEsc7lgrQShqpMFIj G1H4w5oNHqMD00GRzr3dEyI+26u3MWaSISy94zP1xNsjb4yBbu/KcvXI42pQ1tKbnz2V 7wcA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Y0ZO2wB6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 j10-20020a056a00130a00b00564874e14e9si27957266pfu.280.2022.10.22.00.51.58; Sat, 22 Oct 2022 00:52: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=Y0ZO2wB6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231928AbiJVHvi (ORCPT + 99 others); Sat, 22 Oct 2022 03:51:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34368 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231601AbiJVHsp (ORCPT ); Sat, 22 Oct 2022 03:48: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 9A3E817F9A5; Sat, 22 Oct 2022 00:45: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 C5ED1B82E19; Sat, 22 Oct 2022 07:44:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1968CC433D6; Sat, 22 Oct 2022 07:44:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424649; bh=ERDI38QKblPmR1f8XYJ2sDWZUWQpi0wgXYYc/TKJcSY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Y0ZO2wB6Z+ZbnzJfGbCReBmMYssYQTmTSb7xBZXW8PC1v0gCBChoZuLBqhiyTT/Ww BUQ+55sxg1nds0f09crFgkb51tlbbZHeYJVHlhmQFyy3GkCdcccCDhWx6qHDyCVNjv +JKCCNXZjX/CFPYffjlhYowpxqSpv7QS4MF4ROkg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ping-Ke Shih , Kalle Valo , Sasha Levin Subject: [PATCH 5.19 224/717] wifi: rtw89: pci: fix interrupt stuck after leaving low power mode Date: Sat, 22 Oct 2022 09:21:43 +0200 Message-Id: <20221022072454.761173516@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747373397123770486?= X-GMAIL-MSGID: =?utf-8?q?1747373397123770486?= From: Ping-Ke Shih [ Upstream commit b7e715d3dcd2e9fa3a689ba0dd7ab85f8aaf6e9a ] We turn off interrupt in ISR, and re-enable interrupt in threadfn or napi_poll according to the mode it stays. If we are turning off interrupt, rtwpci->running flag is unset and interrupt handler stop processing even if it was called, so disallow to re-enable interrupt in this situation. Or, wifi chip doesn't trigger interrupt events anymore because interrupt status (ISR) isn't clear by interrupt handler anymore. Fixes: c83dcd0508e2 ("rtw89: pci: add a separate interrupt handler for low power mode") Signed-off-by: Ping-Ke Shih Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/20220824063312.15784-1-pkshih@realtek.com Signed-off-by: Sasha Levin --- drivers/net/wireless/realtek/rtw89/pci.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/realtek/rtw89/pci.c b/drivers/net/wireless/realtek/rtw89/pci.c index 0ef7821b2e0f..622f95bc3ffc 100644 --- a/drivers/net/wireless/realtek/rtw89/pci.c +++ b/drivers/net/wireless/realtek/rtw89/pci.c @@ -756,7 +756,8 @@ static irqreturn_t rtw89_pci_interrupt_threadfn(int irq, void *dev) enable_intr: spin_lock_irqsave(&rtwpci->irq_lock, flags); - rtw89_chip_enable_intr(rtwdev, rtwpci); + if (likely(rtwpci->running)) + rtw89_chip_enable_intr(rtwdev, rtwpci); spin_unlock_irqrestore(&rtwpci->irq_lock, flags); return IRQ_HANDLED; } From patchwork Sat Oct 22 07:21: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: 7291 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1092405wrr; Sat, 22 Oct 2022 00:54:01 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4g4S8o/VzudfVcS3BA+86PHeqx7IS4y4oXQA3V5mnITtSvu/FW5tmyQ1MdwCcMUJG4XCOz X-Received: by 2002:a17:902:e5c5:b0:186:5f09:8468 with SMTP id u5-20020a170902e5c500b001865f098468mr14584155plf.122.1666425241228; Sat, 22 Oct 2022 00:54:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666425241; cv=none; d=google.com; s=arc-20160816; b=D6CVkQ3jHboTTTF1XEGbvfJJneNXm7euIjVCSuNX1qMoj95CVKmoADZFibcLSmVDL6 1942Mir30B6A6HUU8BCacrQB3X+N946uBa5FrN7DgDTMfYrax3To7/u4tXE47t9mV4GN vHoCiE4Kw/8ToBZDIAMaIpzGl1GDtozWh3D/LKbyuXSVBw6RpoD4ek0AqPATHQ2oKBLE pq7t37vDhFCFmwyMDAdWTFchQ2clPW8nNfj+H2c4/b8vAFSP8ZNvlcUNRc7iGaXEIxr+ psIHqiOPFHgB8IBiPCOvDi9iOvJaejKcqRd57sUO7gJbpDorVmmOohdbTjHrhn9u22OR EM1w== 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=QpiBZfZVRfgjy/AxJugodVDoLnYT8datCg8RlGRLZU0=; b=kZS1aAB+k+qJC9GPqM7qXkgjpxLEuyzOlhiigMD8oC1ymOYhQPHi9nesqS+h+Yy46S EzKMQWh4lDOGV7bb/wkzVMU/rOtB/UtZ/7Darhf/CUlYmpaF+Oz+virrcaiCayWiWsFm kUUBnOlhwZWZPry6vmsq/9ZWPeqao36JTU6+ob8dVfXEuBFHUAdr6U4GbjIw2YSuSC2y 4vcYctI2BPszXwP0t1L442G8QmNj7M2fiDssKdIV7i/dH6ochcSo/BPRpyO8ZjcSofrc tNWhTkZAPvlndQKFX5FFmkNj56VGaaRqyrpVwukSH43mIafSXNheczXrOltBvtKCVJU9 1izg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=E04x2Jxb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 d16-20020a170903231000b0017f762e2dc6si32120465plh.613.2022.10.22.00.53.47; Sat, 22 Oct 2022 00:54: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=E04x2Jxb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S232016AbiJVHxe (ORCPT + 99 others); Sat, 22 Oct 2022 03:53:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37530 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231810AbiJVHvU (ORCPT ); Sat, 22 Oct 2022 03:51:20 -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 A1E57AC2AC; Sat, 22 Oct 2022 00:46: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 8C39E60ADB; Sat, 22 Oct 2022 07:44:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9F1A9C433D6; Sat, 22 Oct 2022 07:44:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424655; bh=9B4auItuu6R+2k1KwQ4JjfFlpPatjo0qE5hU/icNkEo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=E04x2Jxba970tn4ZmTAV5dlK8pwrCyR1QbCs08ZV+7SWC3XDz/wtWdnk1KVrsMC+7 aXtJO/EVBlKK277zQQ8o9AHmv0QjXnthtY+OWeKn/wQVDLO26oqngWm9SLP6Y+AoMy 5oTogm2dgXMYgRJT8eunL0sTClD9+VZVTomM/t1Y= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ping-Ke Shih , Kalle Valo , Sasha Levin Subject: [PATCH 5.19 225/717] wifi: rtw89: pci: correct TX resource checking in low power mode Date: Sat, 22 Oct 2022 09:21:44 +0200 Message-Id: <20221022072454.934918734@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747373513873261525?= X-GMAIL-MSGID: =?utf-8?q?1747373513873261525?= From: Ping-Ke Shih [ Upstream commit 4a29213cd775cabcbe395229d175903accedbb9d ] Number of TX resource must be minimum of TX_BD and TX_WD. Only considering TX_BD could drop TX packets pulled from mac80211 if TX_WD is unavailable. Fixes: 52edbb9fb78a ("rtw89: ps: access TX/RX rings via another registers in low power mode") Signed-off-by: Ping-Ke Shih Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/20220824063312.15784-2-pkshih@realtek.com Signed-off-by: Sasha Levin --- drivers/net/wireless/realtek/rtw89/pci.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/net/wireless/realtek/rtw89/pci.c b/drivers/net/wireless/realtek/rtw89/pci.c index 622f95bc3ffc..bc8132e91992 100644 --- a/drivers/net/wireless/realtek/rtw89/pci.c +++ b/drivers/net/wireless/realtek/rtw89/pci.c @@ -922,10 +922,12 @@ u32 __rtw89_pci_check_and_reclaim_tx_resource_noio(struct rtw89_dev *rtwdev, { struct rtw89_pci *rtwpci = (struct rtw89_pci *)rtwdev->priv; struct rtw89_pci_tx_ring *tx_ring = &rtwpci->tx_rings[txch]; + struct rtw89_pci_tx_wd_ring *wd_ring = &tx_ring->wd_ring; u32 cnt; spin_lock_bh(&rtwpci->trx_lock); cnt = rtw89_pci_get_avail_txbd_num(tx_ring); + cnt = min(cnt, wd_ring->curr_num); spin_unlock_bh(&rtwpci->trx_lock); return cnt; From patchwork Sat Oct 22 07:21: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: 7298 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1093008wrr; Sat, 22 Oct 2022 00:55:45 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6tlup+TT3GyE7HjUBj8LCQpmpJ/yaQTXbVD1qdm4IO+2CuHZsW02ZZ7Wk8iidxKNXZ7nyC X-Received: by 2002:a17:90b:224d:b0:20d:8828:3051 with SMTP id hk13-20020a17090b224d00b0020d88283051mr26091250pjb.89.1666425345049; Sat, 22 Oct 2022 00:55:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666425345; cv=none; d=google.com; s=arc-20160816; b=W7HcHmH23lWHaDV5cgdC7rcd4r0PhiwSzi5C87nnt6oNM8kjVQGqHUaG8ZYSd5kyni P834Iib6Yi4X9QR9xs/YtlVDEQUPCTac/n5F3DU+cU6DOr8j1symlVZigJxJMk1mHNQz sJGEptk+tgpXwFjDq/90+idcbzKZ/k112WW8sjOV+ESe1qy2plqOpOpKlfoOvQ90k3qj 8egOX5eFGb5PJSx9kB5p2W4StL2/ldN6UTTOrcntVXSR2PM8NJ591j7oKcR+hDcIaHi/ VG5F2Fhf+lphplOxLeajzvolp7ZMe/U08lub/YPsJ+hasywGGdvwRtf9Z9Ka5FTPR5RX tzFA== 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=iiMouDlbmyNjYMDJcDEbqrUbAUGRBRgdVaZ/MwiRD3I=; b=M6CSizTpBGLRzxrZPkYl60VpbEE+MIOL/6xHIE5NbEJZfhnpA2icB/sjTRSJMR/hTx mA+sFH0Tk8vigzSzY09UAusq1X1WY2dsogScCdExblVA49mGgdm6VuktsgmtjmXNE2Ts rhSs0Jx3VW+PdBvxyRvkeU8A65uWM8R0W8ls8nzahpDTV1Yh5/8cbPOrN7b1OdGCmI9V aCNqV6mFaQ6v9DPcCGOnI0FZt/+05m1uvC1utsW59cgTh701jomlIZsgI1DV5mMOH9+A wHYKs7ch+vzFFVsl10UOuiBxeFzjmT5DajO2OZXhsMqxI9scWEankgZGYGLd74ApunC3 04NA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="F/gN75wp"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 p24-20020a170902b09800b0016d2f548842si24032538plr.105.2022.10.22.00.55.31; Sat, 22 Oct 2022 00:55: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="F/gN75wp"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231883AbiJVHzM (ORCPT + 99 others); Sat, 22 Oct 2022 03:55:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40702 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231985AbiJVHv7 (ORCPT ); Sat, 22 Oct 2022 03: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 29B87AC28F; Sat, 22 Oct 2022 00:46: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 3F08760B27; Sat, 22 Oct 2022 07:44:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4B30EC433C1; Sat, 22 Oct 2022 07:44:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424657; bh=9vXiCE0BvIwGv1vGlOobuOURIED+4AIDnWGgCQuShT8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=F/gN75wpAD6xAqLasLfbitG1V6UnwqmJyx6E0dg7k/xh9BG1LnCLhwMIn8a07dFyy nLdoU6LS/Gv3FeZbeZ+n//EICKcXbtOcZYDbtDD9MdOjgu5IkHIMV+QYGTzNy6kA9G NBlaghs0rx3bg0CleGrE+TR7fhisI52KoCFQJZL0= 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 5.19 226/717] wifi: rtl8xxxu: tighten bounds checking in rtl8xxxu_read_efuse() Date: Sat, 22 Oct 2022 09:21:45 +0200 Message-Id: <20221022072455.101563057@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747373622983169936?= X-GMAIL-MSGID: =?utf-8?q?1747373622983169936?= 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 8b2ca9e8eac6..7f09359a238f 100644 --- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c +++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c @@ -1878,13 +1878,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)) { @@ -1895,6 +1888,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 Sat Oct 22 07:21:46 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 7329 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1093923wrr; Sat, 22 Oct 2022 00:58:51 -0700 (PDT) X-Google-Smtp-Source: AMsMyM54BJpeeq0GV830ZC0ChA2gSwB1UGwMUayYuYejRRMIoPAhfKSsHlMs+qgV8NEatBNF9mgJ X-Received: by 2002:a65:42c7:0:b0:462:7158:c863 with SMTP id l7-20020a6542c7000000b004627158c863mr19940318pgp.590.1666425530838; Sat, 22 Oct 2022 00:58:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666425530; cv=none; d=google.com; s=arc-20160816; b=JguFn4AglWbxNZW6RjucCFmHae2L3sOpl8iw5uCMk4XWJ2//evsXrc3/fp8LQeQRd/ gUM+ow3TmwSiMawt4Uj7hVoQjuFx4q1Ft3ihagVXiTh4z0xbaBri0F85ooyb6mT/JAiQ Pm5zE2vfVeWn778W9q8lAwPCdNNFoXsSJu6BheCqZViVnzaLif8QyLyvH3P7GJSrY/47 uan4D+nq9ROxkzwApdbnoHHe3dh2dZ1ncYSiISk6vRSqN1Nke0df4o8URfgGTtMmu6SD aIwCAGIjizc0cgCiYwuGKOEqzhkk3ad0nUkA9THf3DtEJaIMGCMEUJoToiTaVM7ukFaF KDUg== 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=H4PZH7WiCf/YvJbej1zBr8Hv8NavGNvZ/ApM6k840VA=; b=z1y9Ncq0w2IznVFnHSHkbpr7xLIBjlEQJdYPfkxbJQdyo4O+ejQRNbTVQPHEjp6Ojf WM7FPb3UnMjBGKFzGsTThJiDRetzz1xrzgU/gR1rYRcgENMjDQh7qjpcmXUQT90h6zVd MLWHtQn2MISu9oMfM3QIYQ56yjxnWuR4pcV0Ln859mzr24TKTG/Tj/tUpRfo44jlMx3f aBBMBBUagutFbfTmGK1hCtOD/lnitDLdRLUskLFudq5mmWKFWwPeJfIORJl+lv2Mrcst akPXo+jM2BRUcH0wXDBNZvkASwqx98DBwaCJkT2uxMJUqGcSCUrEd+fQK82SgzJxJ+z9 RLlA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=U5HpgIEN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 a72-20020a63904b000000b0046ed15a820esi1876313pge.385.2022.10.22.00.58.38; Sat, 22 Oct 2022 00:58: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=U5HpgIEN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S232362AbiJVH6U (ORCPT + 99 others); Sat, 22 Oct 2022 03:58:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55596 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232085AbiJVHyA (ORCPT ); Sat, 22 Oct 2022 03:54: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 2A65866F17; Sat, 22 Oct 2022 00:47: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 079C460B76; Sat, 22 Oct 2022 07:46:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0DBA6C433D6; Sat, 22 Oct 2022 07:46:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424761; bh=E0P5Plv7o5uoE/gCMwmS7YD7vzFnZnNz9sL7HO26qXM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=U5HpgIENFTizaHv2DzpBTQLILRcvxSLNAV75QMBBhprLwh582Pbos5QqKkP+ZkQ3Y 2ao3uNgcEcd8lw2A75Ec1RqG5wKcj2UUlkIiERCPZ676Sobd5z9W9t1VMjMc0UOahS r+dsQQmEtYzDm696jmXhCqp69xqpfJwsu6kw5iXQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dan Carpenter , =?utf-8?b?SsOpcsO0bWUgUG91aWxs?= =?utf-8?b?ZXI=?= , Kalle Valo , Sasha Levin Subject: [PATCH 5.19 227/717] wifi: wfx: prevent underflow in wfx_send_pds() Date: Sat, 22 Oct 2022 09:21:46 +0200 Message-Id: <20221022072455.271461706@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747373817031106773?= X-GMAIL-MSGID: =?utf-8?q?1747373817031106773?= From: Dan Carpenter [ Upstream commit f97c81f5b7f8047810b0d79a8f759a83951210a0 ] This does a "chunk_len - 4" subtraction later when it calls: ret = wfx_hif_configuration(wdev, buf + 4, chunk_len - 4); so check for "chunk_len" is less than 4. Fixes: dcbecb497908 ("staging: wfx: allow new PDS format") Signed-off-by: Dan Carpenter Reviewed-by: Jérôme Pouiller Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/Yv8eX7Xv2ubUOvW7@kili Signed-off-by: Sasha Levin --- drivers/net/wireless/silabs/wfx/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/wireless/silabs/wfx/main.c b/drivers/net/wireless/silabs/wfx/main.c index e015bfb8d221..84d82ddded56 100644 --- a/drivers/net/wireless/silabs/wfx/main.c +++ b/drivers/net/wireless/silabs/wfx/main.c @@ -181,7 +181,7 @@ int wfx_send_pds(struct wfx_dev *wdev, u8 *buf, size_t len) while (len > 0) { chunk_type = get_unaligned_le16(buf + 0); chunk_len = get_unaligned_le16(buf + 2); - if (chunk_len > len) { + if (chunk_len < 4 || chunk_len > len) { dev_err(wdev->dev, "PDS:%d: corrupted file\n", chunk_num); return -EINVAL; } From patchwork Sat Oct 22 07:21: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: 7841 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1153255wrr; Sat, 22 Oct 2022 04:05:11 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6DRcFYqSUpWWWt8uce3Ilsi+Ahxj64rFafgmNH76fX6OAc0u99gj7LE+gG3AGVRptyndFk X-Received: by 2002:a17:906:9bc3:b0:78d:816f:3743 with SMTP id de3-20020a1709069bc300b0078d816f3743mr19787366ejc.380.1666436710958; Sat, 22 Oct 2022 04:05:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666436710; cv=none; d=google.com; s=arc-20160816; b=JEMjWxmqQDnbjw2O49jKXZ99haWZNhY4VwL29/fi/eH1jzmBU9MPd9J/MPi9IF//F7 uuswv8aidrVDTwXfMrK1CV689dO8D13qFwZW5P5gxX0xOFLBjaAvScPbbJMkj4uG98xE 5SLlOjkVed5MxyhBbYO2EAL84VlGBu2yTJKPq8qO34O8NnjSSXDqaFzttHJd6N3zJJ2J vkT6HRUUCasuglFcbadtDDg3dKMA89LnfFLrxo3dPlOWlHp9fVp7bMf8plRkEzqwIIfX r6TQ4smy3spc3EqMfuBGot5VVv5gCuJB/F9KWAuqTKyRENlqpv8Ao+pNY+u/B+FYxIPn e85w== 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=hNGHAhikpfIlyBarfPF1lwHXQsbVm6NRxqOM6LasUto=; b=k3T4eEApeA2tZBp848OaB4m/DceM35ehl5Uf+cK+2SuzYe8yotKP7XQT+UVFFx5FGN z6xg+n9c7uyVwhNMVqErlVBWqZNnpTZtfHXuvuhEkN+5s8UnDg/y7D1m+dqnvY8ANASF uWdvszK7hvqs7N++qUmm3SCNrorMrhUyurxu/Q1+C3PhkYqArQ19jlx9vqF5xS3ASxlo VX/0zAiG9i7WqNO1X5aamXZ2eow+Dp2DCbSINVLRnry+zzjgV/JyU281bnsRQtJfKUoz Q8LwA4rfn9IBYxmdI6LYCEVbbSEbYzel4alelN/gxwMQxAzM+zRNrnedQvWfbjDI/1+i tjeQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=LtGfJUQO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 nc7-20020a1709071c0700b0078e0e850902si22315141ejc.868.2022.10.22.04.04.37; Sat, 22 Oct 2022 04:05: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=LtGfJUQO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S229921AbiJVK6D (ORCPT + 99 others); Sat, 22 Oct 2022 06:58:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39348 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230494AbiJVK5k (ORCPT ); Sat, 22 Oct 2022 06:57: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 167592E983F; Sat, 22 Oct 2022 03:16: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 ams.source.kernel.org (Postfix) with ESMTPS id 58643B82E14; Sat, 22 Oct 2022 07:44:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C1DFEC433C1; Sat, 22 Oct 2022 07:44:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424679; bh=/WHpOa08+5yeB5M68zBL42rWpAGT/Vty05ist5mnjeg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LtGfJUQOqawN9d7syREvvtG9DClXq9s5SiECps3YMp5JKvxHK/qJtoczZIdJrM9ml mwqKFtvirIDAe09oAqZQg2IELspSSsWLobL5hrNQ1+BDP/bPhkLLx5QfnPdhZOn9nO 5RaHzvP0HxMLFtDUoPGeBMDm4WnSSQtFtUJRpni8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Yang Yingliang , Ping-Ke Shih , Kalle Valo , Sasha Levin Subject: [PATCH 5.19 228/717] wifi: rtw88: add missing destroy_workqueue() on error path in rtw_core_init() Date: Sat, 22 Oct 2022 09:21:47 +0200 Message-Id: <20221022072455.457843616@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 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?1747385540819668084?= X-GMAIL-MSGID: =?utf-8?q?1747385540819668084?= From: Yang Yingliang [ Upstream commit b0ea758b30bbdf7c4323c78b7c50c05d2e1224d5 ] Add the missing destroy_workqueue() before return from rtw_core_init() in error path. Fixes: fe101716c7c9 ("rtw88: replace tx tasklet with work queue") Signed-off-by: Yang Yingliang Reviewed-by: Ping-Ke Shih Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/20220826023817.3908255-1-yangyingliang@huawei.com Signed-off-by: Sasha Levin --- drivers/net/wireless/realtek/rtw88/main.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/realtek/rtw88/main.c b/drivers/net/wireless/realtek/rtw88/main.c index 645ef1d01895..c364482ab331 100644 --- a/drivers/net/wireless/realtek/rtw88/main.c +++ b/drivers/net/wireless/realtek/rtw88/main.c @@ -2037,7 +2037,7 @@ int rtw_core_init(struct rtw_dev *rtwdev) ret = rtw_load_firmware(rtwdev, RTW_NORMAL_FW); if (ret) { rtw_warn(rtwdev, "no firmware loaded\n"); - return ret; + goto out; } if (chip->wow_fw_name) { @@ -2047,11 +2047,15 @@ int rtw_core_init(struct rtw_dev *rtwdev) wait_for_completion(&rtwdev->fw.completion); if (rtwdev->fw.firmware) release_firmware(rtwdev->fw.firmware); - return ret; + goto out; } } return 0; + +out: + destroy_workqueue(rtwdev->tx_wq); + return ret; } EXPORT_SYMBOL(rtw_core_init); From patchwork Sat Oct 22 07:21: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: 7319 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1093584wrr; Sat, 22 Oct 2022 00:57:44 -0700 (PDT) X-Google-Smtp-Source: AMsMyM46ao7Ju/z1kienERpUx8wOse2hUbtTg6Z6llOnUieZGHXeWDPYdzEXTihqNOUMDaJK2F3Y X-Received: by 2002:a17:902:ed93:b0:185:4421:24b with SMTP id e19-20020a170902ed9300b001854421024bmr22841220plj.158.1666425464053; Sat, 22 Oct 2022 00:57:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666425464; cv=none; d=google.com; s=arc-20160816; b=uryMA0HoJtP7HvVyRHwWNUUqJEtvavNiEkGPUXkz9PSr0DfYmKeVXIV+2+IU1upLOG /KZlZ94mQAmoEKs6gawJeQ+wDmp+Tdq7tzYzlB6t5gq97fAckgTzitzmSpXodj5YzzPh ZFdZc9ZBxLU0opxQMmk/VA40XJQzXbMFdtuOCprEyZKdefXQ7S6euXw+eWSEfdWBe+sQ 5DwhJw+DnEgddgaY7XsFB9LEm+ELSEme+ygD2k02+GgFoltDO+jQP2eZ6VyC2ITSevll CsGetGcLOzLkezdYlGh3RmIuslakRDOay3aEBJsKDu75CWKGdvb2AhlQUZOctgWHxX83 eEIA== 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=tod+YBu3wJrXeWsQtbPMwwH04aWfd/GiUUksgrJ83Cw=; b=M7WtLaf7NG5VQlU1o/pFv/9hjXEp2+/3wWc0Biyf0fbFEScDd8c/x1Uh75NgyKXxhg 85NigjWFxJDpgy+NjlHstWj3FMvHnCWJRW86kD4FVxiCVW4M4yj/UXbaE2l4Yc4m8/tU efZ6OiXBsqX1YAxpIDWpCi3cEdg24FjtP+Gq4Y42rqmwXIXgRR6Aic8dbQRug+Qs5rZ5 U35KTIPWPzshYagzeWCjAahrTeQFRohy4jPmql+bDXviJ4/cm/Epwl14YaYVBAI1pSVk 5G+s0jcXcgU0VxTG1N715GVmcLco7BAAIcd2NWRCCZNrNQfEnA9LdqS4RKgbD2MVD4W1 xBOQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ndJTbDHl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 y21-20020a056a00191500b0055ffebbba91si24855971pfi.112.2022.10.22.00.57.31; Sat, 22 Oct 2022 00:57: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=ndJTbDHl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S232116AbiJVH5O (ORCPT + 99 others); Sat, 22 Oct 2022 03:57:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56532 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231974AbiJVHxM (ORCPT ); Sat, 22 Oct 2022 03:53:12 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 65E072CA7DD; Sat, 22 Oct 2022 00:46: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 E9ED560BB1; Sat, 22 Oct 2022 07:45:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 040F3C433D7; Sat, 22 Oct 2022 07:45:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424708; bh=X8yel3LUYWigUVRK5S1/ihrs7Lr86aKcl3MMM3hFUdY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ndJTbDHlo8/Ue8QInr1hdk59o6sWDZ80+TV6sTm97eS2WLqQUcea4NR9LTkStGzXK hD2VJvqa0cr3xK0a7u1uwPhz0vMf0/O01JLfU7GYWIb6YdTBlEL4Wsa+E97lHZocw+ cZb0WQxhBlHD8qmYatomoh/Vlzwe0dM33uIoc+k4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ian Rogers , Daniel Borkmann , Magnus Karlsson , Sasha Levin Subject: [PATCH 5.19 229/717] selftests/xsk: Avoid use-after-free on ctx Date: Sat, 22 Oct 2022 09:21:48 +0200 Message-Id: <20221022072455.624457009@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747373747573783055?= X-GMAIL-MSGID: =?utf-8?q?1747373747573783055?= From: Ian Rogers [ Upstream commit af515a5587b8f45f19e11657746e0c89411b0380 ] The put lowers the reference count to 0 and frees ctx, reading it afterwards is invalid. Move the put after the uses and determine the last use by the reference count being 1. Fixes: 39e940d4abfa ("selftests/xsk: Destroy BPF resources only when ctx refcount drops to 0") Signed-off-by: Ian Rogers Signed-off-by: Daniel Borkmann Acked-by: Magnus Karlsson Link: https://lore.kernel.org/bpf/20220901202645.1463552-1-irogers@google.com Signed-off-by: Sasha Levin --- tools/lib/bpf/xsk.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/lib/bpf/xsk.c b/tools/lib/bpf/xsk.c index 67dc010e9fe3..63954a2e213d 100644 --- a/tools/lib/bpf/xsk.c +++ b/tools/lib/bpf/xsk.c @@ -1228,15 +1228,15 @@ void xsk_socket__delete(struct xsk_socket *xsk) ctx = xsk->ctx; umem = ctx->umem; - xsk_put_ctx(ctx, true); - - if (!ctx->refcount) { + if (ctx->refcount == 1) { xsk_delete_bpf_maps(xsk); close(ctx->prog_fd); if (ctx->has_bpf_link) close(ctx->link_fd); } + xsk_put_ctx(ctx, true); + err = xsk_get_mmap_offsets(xsk->fd, &off); if (!err) { if (xsk->rx) { From patchwork Sat Oct 22 07:21:49 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 7295 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1092913wrr; Sat, 22 Oct 2022 00:55:30 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4u8LVoo5WEiz2ax/xVuWR8aWyUCc6l6ahezz3U2lafcJyXPn4V40K0L9YHlqz25FsuThAT X-Received: by 2002:a17:903:2346:b0:183:fffb:1bff with SMTP id c6-20020a170903234600b00183fffb1bffmr23316976plh.55.1666425330313; Sat, 22 Oct 2022 00:55:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666425330; cv=none; d=google.com; s=arc-20160816; b=SELXOKLrdz6N9DFIaofSH2SWiL8vz1yCF3aXx5MSfJ/nhRyvU46LAyrvATMUlohXsN xq1AOL60lreEm5Xo+mm2hhDM7EotvzBah2Y/fFInpaInGA00TX3CK91HWbNlSoYKe1p2 fzC+lzOMQdhaudgIPqQ8NsEdTwqzBOBzD8iruBo8YPuNud8isGIljos358Cjp7yewuDD FmCHHeE2UdSv+AEuDFCGLPY7n6jYkaKtDfBIqkH2rpSZKC7uE/jDbbPp00etv70es+7H O6pFr1O+ISXBtbuPV3mpO1iPNWtN9640E1PIdSMoosj4o2139mlxvhirHVLseFhoTH3i OIkw== 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=hwAFJISQXBxKrTnk6Pj2/+RIEOifuHUpBzBhdXa2T58=; b=krr1OFtHeIXw6Wm9wrEKz/8K2AfAOolEtH7AQP+VwThrcTscZYjx9SgGP03suPEQT+ D/4s7uKW+rLQ4+th1qLvUxv7dqkabVzVZbZjqD30rwco237tNBwfVTTDS48RChv+bfRL JM2RBgIhf2eBA2E2VOIbUWLFMM7Fo4Sigh8QQiGYj2pRRPBxdlHi/fNpZOpiQ3d+AH8R Ozellc/ROhcTmPRv2PYglGVnk9QzdE++PjhYRUUpI2Q3Emx37Zg7K0s2XX2Qn++X5nVx bhv8o0Z1XABEScDp2F9jtM372nc7hCD5QfE7eA3P/z4nYyqY9S2Z1IBLcXb/B4aMQTPs G9uA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=NRfiM4B7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 w17-20020a170902a71100b0017f802fcffesi26149132plq.410.2022.10.22.00.55.17; Sat, 22 Oct 2022 00:55: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=NRfiM4B7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S232045AbiJVHxq (ORCPT + 99 others); Sat, 22 Oct 2022 03:53:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55612 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231960AbiJVHvl (ORCPT ); Sat, 22 Oct 2022 03:51:41 -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 D17A92C2AEF; Sat, 22 Oct 2022 00:46:37 -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 DA441B82E2A; Sat, 22 Oct 2022 07:45:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4BFB9C433D6; Sat, 22 Oct 2022 07:45:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424737; bh=Rz9rDCBJAQ2vRjx+afllaCE7dQcrdHH6ja7SalU0vXQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NRfiM4B7RgentWQPBsDNA91ZmspghISERhHkn7BnTrnwKrIvY3Lj4if4Hz+hv2pWG 6LVS4t8rJjClz08t6F1kusmqpeNKE2NIJ5H3yo89qHRVyw9v3IHUTLA5b6xt6dBFh+ IA0kDY1KG3sUZR47b9ucxc4UhUqXOWqjonKq2/B4= 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 5.19 230/717] spi: qup: add missing clk_disable_unprepare on error in spi_qup_resume() Date: Sat, 22 Oct 2022 09:21:49 +0200 Message-Id: <20221022072455.804383866@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747373607023433014?= X-GMAIL-MSGID: =?utf-8?q?1747373607023433014?= 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 00d6084306b4..ae4e67f152ec 100644 --- a/drivers/spi/spi-qup.c +++ b/drivers/spi/spi-qup.c @@ -1245,14 +1245,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 Sat Oct 22 07:21:50 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 7301 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1093144wrr; Sat, 22 Oct 2022 00:56:10 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4RKzKs8n+T48i8j/57QSKyuYTrf/PE5Un7eFa/IUmcLA5cOaNdS2f2eJ1yj3LfCKelval4 X-Received: by 2002:a17:90a:cb8c:b0:212:eba5:a143 with SMTP id a12-20020a17090acb8c00b00212eba5a143mr638822pju.79.1666425369708; Sat, 22 Oct 2022 00:56:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666425369; cv=none; d=google.com; s=arc-20160816; b=MUHhCbA5/QLKuE0nF3MXkl8xjndfsZUJa4juXjoj+DcTZXv9/XytAvMXBJmCYOhXmM 15NPBwuXowqXI2cEvmAY92nwk1uxV0p6RYWDhBOH+sFwjvE97dxGvrtWZMljyQC+Un6v GB14mqWCJ1NIkM65cutQlA+K8fGzuKpe/RyS5RhUp66J9f92LoZhrsmdrmujUt0nYJEd jWH6qycyhCKsBdu5e7jWTr1cALmEm9rcqgnwc6Cc3gK052RAsJJiOF5JVbs6H3qzCzvh ye3QSoTE2Co0ASAh0uEsvIAm56c+rC+1QKU/eFuuAmUYP8mKm+M2ei4G48TqDdatpVxP xyzw== 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=Kf8t6uvex/h0oWfv3hpGINwdDDQvwzqtBEQquqgdTqQ=; b=vhsBuEjME3NOVsvc6ViVfAwU7Z+iYCY7onZrCcwIN5CEmxWSxRDm34XLJ3p86aAYUM bNfTLz7R+xltkpEZr3aW97x5c9xcTXx1XV+CQx6E8D9v41EfyyX2W7GFilsr4w/+uNCF 6ccGBbl4MOdyrP4A9ISPg4VrrcTjL5HjrMhJYbJ0BVsZtnXDfyzAatBXMDBefhwkOiyH uoR/WR6XlMvs1r6tmEIWE8ALiOkBJYP5lH6aim0ae3BiW+eV7T3pwrkUsP9ma+nQiqQL TEk5AegwHKFsrRdQFwXPD5LjFACgwmWms1ouoNSqhxWc4Wb5eJqYUOZ/oC/2Zrclacyg Xdiw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=iMOqmRNU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 k14-20020a170902ce0e00b00176c9015627si27461426plg.94.2022.10.22.00.55.57; Sat, 22 Oct 2022 00:56: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=iMOqmRNU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S232014AbiJVHzb (ORCPT + 99 others); Sat, 22 Oct 2022 03:55:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34414 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231774AbiJVHwG (ORCPT ); Sat, 22 Oct 2022 03:52: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 4B8EC2C6EAA; Sat, 22 Oct 2022 00:46: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 DC8EEB82E2C; Sat, 22 Oct 2022 07:45:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 34F32C433D7; Sat, 22 Oct 2022 07:45:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424745; bh=ZHJKRnJNRELyEddaOAAZOUeQIBlE1rnuDZ7KrfCHud8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iMOqmRNU9+1cKweUgPDAcHuP7tW9qcvsnRn+eIMYU5fFtyqor2Q5hxJz6KFW/bI3O ix7PrUPou/E/lYH30rICMd5p2FJyv7bTM6t8jJImKU9f6hyTspmUsuMrX1lp9qh9B5 RVZJgfaZjh8aDZ4n68t48IBKEG49dCEG4p5LZU54= 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 5.19 231/717] spi: qup: add missing clk_disable_unprepare on error in spi_qup_pm_resume_runtime() Date: Sat, 22 Oct 2022 09:21:50 +0200 Message-Id: <20221022072455.967763261@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747373648581333437?= X-GMAIL-MSGID: =?utf-8?q?1747373648581333437?= 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 ae4e67f152ec..7d89510dc3f0 100644 --- a/drivers/spi/spi-qup.c +++ b/drivers/spi/spi-qup.c @@ -1198,8 +1198,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 Sat Oct 22 07:21: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: 7345 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1095113wrr; Sat, 22 Oct 2022 01:01:50 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7gHjkx6BvigRm5VAfsEkaQzx49KzyqhM7u7LNvzud5aPoKUwqWDwp7JIwiCtftTG6v8dPZ X-Received: by 2002:a17:90a:7787:b0:20d:3093:ae7f with SMTP id v7-20020a17090a778700b0020d3093ae7fmr59959665pjk.226.1666425710372; Sat, 22 Oct 2022 01:01:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666425710; cv=none; d=google.com; s=arc-20160816; b=dgUBB5uFIrQm3kfFwaXIPCUQUQel3Md1AR/yhUfJ+wLHs7THdNZt9x/Ya4L+B4yrRb 4y80/gsH5eb2Yc5U9v5KucOEY1LGWkhsv2QqK1Bc90/dFkqAT90O4wDzDWyw4+R/Men2 NfnFCw6i/RxptfDuA5CML3dJYjL475clS8y1F5uZ9/j5Nv7OA56VFZgex0DWfxVGlKWn TXYhGjykJ1VE3jOqI6A7nrhQPwfk6JKjKD6adhquHriPxecheChvDS0MLdv9J3Yaf7yN exv+vFD62bwRkjOYXcEGr1hlmo8EL9Se6mLmPIb+jfpI9/fWw4dQNVl3bLsbL26aCok1 IwvQ== 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=zPkFgHAVcaSeD+A6B+xQ+vbMRTAPNqXsyabSOTiCVwU=; b=s4dCgJ4XSwF3GNWMHcaSQZwmgkocR7jQOu9YxqRyqgxQ27T/e2i2Sx7nhGoLnwPXxj UenavUVxfbHYmtJbsjPwe7m8GyFRkgpTfrIMuFUrjo/R7EX5SGuCqD+ZbnH1gQgyBMjX X0YvaQvkl6woD9KnrgY8JyJT/3jabf+1MZOwNV6nLcWsIv8d8z7+IAjds9IWTimHe0fh I1ki/nOD3ElxVXQBZHPiN4AFi0Vn4JeIRn+3Jnfz2IDDPDB/E95k1i2WUx9BVx8zXujn 6ee397VeqBm3F8rgLALf/aQBfpEWkpyJMI2Ytag6Nv3GjqLN9ScgWONyWLyKSiQRJFQd jIQg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=IfbprFsI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 n3-20020a6546c3000000b0046edc0aea7csi1201809pgr.515.2022.10.22.01.01.08; Sat, 22 Oct 2022 01:01: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=IfbprFsI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S232148AbiJVIAs (ORCPT + 99 others); Sat, 22 Oct 2022 04:00:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54874 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232173AbiJVHyS (ORCPT ); Sat, 22 Oct 2022 03:54: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 C32845A3EA; Sat, 22 Oct 2022 00:46: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 80266B82E2D; Sat, 22 Oct 2022 07:45:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D6FD1C433D6; Sat, 22 Oct 2022 07:45:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424748; bh=Ogzw9qM8KkQVpHjdhIA1KvCs1Ygr9naTGEPaYfLZdPU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IfbprFsIfZRsp78WkSlEvFkv4xSAq6ohIn7aTkHpBvdazsES2rkOZyT2kmoHlO9fo 0MQ9ly6oRosYzpPn7UB61nIXxo7IwmA9iW14QAvl9jpv7uBamhzEqj/KSLPUNxUUiO SUJdEzkXGZ0BC7U9gHG/ggSF2UyvwF8iURXWag/g= 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 5.19 232/717] wifi: rtl8xxxu: Fix skb misuse in TX queue selection Date: Sat, 22 Oct 2022 09:21:51 +0200 Message-Id: <20221022072456.114362939@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747374005732826928?= X-GMAIL-MSGID: =?utf-8?q?1747374005732826928?= 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 7f09359a238f..03b04d6913d7 100644 --- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c +++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c @@ -5062,6 +5062,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); @@ -5074,7 +5076,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 Sat Oct 22 07:21: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: 7315 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1093471wrr; Sat, 22 Oct 2022 00:57:24 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5gBId2qYEOt9ZhWoAMW9oQCoEk17M/SMdM65/j/sA8LRHivINKiFOPu4YhL4SjFlVAdC3X X-Received: by 2002:a17:90b:1e0c:b0:20f:bcbf:ab5 with SMTP id pg12-20020a17090b1e0c00b0020fbcbf0ab5mr25047511pjb.187.1666425444716; Sat, 22 Oct 2022 00:57:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666425444; cv=none; d=google.com; s=arc-20160816; b=AkqWnmKY7LRNRiKMT/GAg7Jzc0aZcg2ICIcHw26vlaD//wfTs9hj21XI2yOoRNDT6b Sh1vAguisCBA6aHclDaUgiJlbRYZnw3jKO0AVoiIb9XnFWPv6g+mac3yRIPJBk9wJ+4K rGhDTyJMQZrBleBX5NaZ0nLO+pBwrz9YBaiLc4r/EqsaclPlhg5Yv0H7oNv4Q4p9GYui I/BkaKXCWBF6ZrIdytUGIDTDyizGtfWuu0SAFmkRtVDs7FfA+7sJNWy5H2SkopsOACi/ B7amrmHI93hhE+7YFSadGH1EJaec1JQpc9JkOhgZWzgZdtY4+TW7DTEmZIokjnoYuOyS 40Wg== 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=bJmKRR/q+kBCiK96k8O/LhdQvMvn+L/FTaOJGRjEInI=; b=wS4syIVESQMI3zcHBT/cq9IeEKX9NhiCisKweQ8F2DEQjwUX29Non3zYF3ado4dR/G IJa8oIdIH9RU1d705TPDCfhr81z5xBtDbhwl3cWrMEGYpLUSPLao36STbbrnxIK/FsuY 77SjCTaTjq9XIvfKxOyIcgEi3v1SNLgwnqkX9TOGPApL5QOsk4A+vuPa/ODnH+LnH8G0 vZnNbO86L6Tj3Bs7W/Cx3PYiHwQZcqyh6GkCedWQ0aotrCbsUFiM06hBcOFTYpuxt5jU 5sLNMSvJjSL3EEC4Ab33iqYHxbFfEND2KmPuCnanOZZUOndEH4KBo/Pdna62nwK3E0t8 Fpkg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=AQAxoj8E; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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-20020a056a00164600b0055fe250267dsi23846456pfc.124.2022.10.22.00.57.12; Sat, 22 Oct 2022 00:57: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=AQAxoj8E; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S232278AbiJVH4z (ORCPT + 99 others); Sat, 22 Oct 2022 03:56:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43158 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231929AbiJVHxA (ORCPT ); Sat, 22 Oct 2022 03:53:00 -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 89DD02CA7C9; Sat, 22 Oct 2022 00:46:52 -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 23727B82E2F; Sat, 22 Oct 2022 07:45:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 73C8BC433D6; Sat, 22 Oct 2022 07:45:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424750; bh=t3dMiH4XJXVQqT24zBIQwudtQaBoBJjPnA3eH7aaObo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AQAxoj8EHAKM8y3d9b3lLpGlKiVvs6AS36+UrwWxd6HFtg/CQnvHW73DShojrMPlz ByCynyhChNYAUviT6tzgq1dr1wOTDNpT3bjAk2R9j7fT77b/5xSr0cPuIq7QALKq/f y31YUEuMl7L7DvHYCeqNZSoz4RiXpRI3C0MTd1UM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Markus Schneider-Pargmann , Neil Armstrong , Mark Brown , Sasha Levin Subject: [PATCH 5.19 233/717] spi: meson-spicc: do not rely on busy flag in pow2 clk ops Date: Sat, 22 Oct 2022 09:21:52 +0200 Message-Id: <20221022072456.269812870@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747373727024847132?= X-GMAIL-MSGID: =?utf-8?q?1747373727024847132?= From: Neil Armstrong [ Upstream commit 36acf80fc0c4b5ebe6fa010b524d442ee7f08fd3 ] Since [1], controller's busy flag isn't set anymore when the __spi_transfer_message_noqueue() is used instead of the __spi_pump_transfer_message() logic for spi_sync transfers. Since the pow2 clock ops were limited to only be available when a transfer is ongoing (between prepare_transfer_hardware and unprepare_transfer_hardware callbacks), the only way to track this down is to check for the controller cur_msg. [1] ae7d2346dc89 ("spi: Don't use the message queue if possible in spi_sync") Fixes: 09992025dacd ("spi: meson-spicc: add local pow2 clock ops to preserve rate between messages") Fixes: ae7d2346dc89 ("spi: Don't use the message queue if possible in spi_sync") Reported-by: Markus Schneider-Pargmann Signed-off-by: Neil Armstrong Tested-by: Markus Schneider-Pargmann Link: https://lore.kernel.org/r/20220908121803.919943-1-narmstrong@baylibre.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- drivers/spi/spi-meson-spicc.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/spi/spi-meson-spicc.c b/drivers/spi/spi-meson-spicc.c index e4cb52e1fe26..6974a1c947aa 100644 --- a/drivers/spi/spi-meson-spicc.c +++ b/drivers/spi/spi-meson-spicc.c @@ -537,7 +537,7 @@ static unsigned long meson_spicc_pow2_recalc_rate(struct clk_hw *hw, struct clk_divider *divider = to_clk_divider(hw); struct meson_spicc_device *spicc = pow2_clk_to_spicc(divider); - if (!spicc->master->cur_msg || !spicc->master->busy) + if (!spicc->master->cur_msg) return 0; return clk_divider_ops.recalc_rate(hw, parent_rate); @@ -549,7 +549,7 @@ static int meson_spicc_pow2_determine_rate(struct clk_hw *hw, struct clk_divider *divider = to_clk_divider(hw); struct meson_spicc_device *spicc = pow2_clk_to_spicc(divider); - if (!spicc->master->cur_msg || !spicc->master->busy) + if (!spicc->master->cur_msg) return -EINVAL; return clk_divider_ops.determine_rate(hw, req); @@ -561,7 +561,7 @@ static int meson_spicc_pow2_set_rate(struct clk_hw *hw, unsigned long rate, struct clk_divider *divider = to_clk_divider(hw); struct meson_spicc_device *spicc = pow2_clk_to_spicc(divider); - if (!spicc->master->cur_msg || !spicc->master->busy) + if (!spicc->master->cur_msg) return -EINVAL; return clk_divider_ops.set_rate(hw, rate, parent_rate); From patchwork Sat Oct 22 07:21: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: 7324 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1093787wrr; Sat, 22 Oct 2022 00:58:27 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4558gJrC+lyerTyzE/WwQK3jy+1zWWjbxJdxpJbtTAsAj1+blbTeHhUKhhEzqLUxZYjqgG X-Received: by 2002:a63:5761:0:b0:46e:b96b:e76 with SMTP id h33-20020a635761000000b0046eb96b0e76mr6090236pgm.534.1666425507650; Sat, 22 Oct 2022 00:58:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666425507; cv=none; d=google.com; s=arc-20160816; b=ZrxnzQiVS0r6JGMnWJBnkTAZqXnQNwlwsipnaNJoozU9s1KfXMvkayH03XvJ7WC2Cu 5G+5yUHTjBp8Jwn0nkNXY4MUtd6KMKgu0ptHLjlaxrs03GaQVEHvub6nFpI0ISM+ZuI4 JxhbclYVBF2VmqXU4pYIP6ngtPvCwmMZceNVVVx0KMTM7Oy1hpJH8BNaRUcbqy4HeJYe EQKwKnrcKLugHebZsgZS9PpdwJDYzVUP8Py5EvuFF2fzjpoU3QPyVzA31gbkMU3AP99i 1HWyOdZVjQJVOXvIH6gDPaxg+d1Ubtye6JZgaT/MgmP1nRvgwOXzZVEgMYAi2aoYZ+2t Bvig== 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=M1IPAKMUprGqsVJstMfZhbO18vPQhnjxgASwvhxA6hg=; b=PpQTNFCzoIQZ/u6rriIs5Nb+9ID+T4puWQGnrocITqx0zjaci9nLrKNx4ND7kTBbhE +AtyXD0u4OLhI93eUGyrS6MvAQDs1rQj7njncn9gQe+o74Z5DfHrpg+tcyAR84tqYYMb YyFpmSMgWoZpy09kE4Zmj44FrWNAyXEPLMsh0ehT4E7Gs4WNx5ftLJ3vRNg6GfxeBTGK pZQw0HicgZmKQyOhDhFS1V3bkztE/ay7NG6l9v+CguaDdL+rFe/P+TmpoxwFRJf0dApl bMkX91Z9bWf3OlBNIb24BM26bwcFNbw11nfp1KT0Tx5uJFdlRpHp3xTpY75T9sUrHuZo tbDQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=SlsCcCqz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 x15-20020a056a00188f00b00542f9f272ffsi31892495pfh.18.2022.10.22.00.58.14; Sat, 22 Oct 2022 00:58: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=SlsCcCqz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S232341AbiJVH5l (ORCPT + 99 others); Sat, 22 Oct 2022 03:57:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42336 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231794AbiJVHxn (ORCPT ); Sat, 22 Oct 2022 03:53: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 EAB4F2CA7F8; Sat, 22 Oct 2022 00:47: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 F20B760B43; Sat, 22 Oct 2022 07:45:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 14033C433D6; Sat, 22 Oct 2022 07:45:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424753; bh=TJ2z8sKjOboAwl+iRlgwNORc3olWsnilEuqNtwDNJQY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SlsCcCqzXltBBqs9UpK62k9WOji7a/dSaXd/Jad8/4XT4frmFyMetkyH+vvakEgN4 +AQLQboNSjYwq9/wCKkVGzRJllnGSdvbtXFa+8kvxpolXWf4P364Ikyp0mm4oLZaJo Lx/QOB7RD8ZDCRvm6OQbtm7tienOY8H8mAGoE50I= 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 5.19 234/717] bpf: btf: fix truncated last_member_type_id in btf_struct_resolve Date: Sat, 22 Oct 2022 09:21:53 +0200 Message-Id: <20221022072456.420768790@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747373793228365356?= X-GMAIL-MSGID: =?utf-8?q?1747373793228365356?= 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 eb12d4f705cc..ff4a2c0b14ea 100644 --- a/kernel/bpf/btf.c +++ b/kernel/bpf/btf.c @@ -3120,7 +3120,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 Sat Oct 22 07:21: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: 7327 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1093857wrr; Sat, 22 Oct 2022 00:58:39 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6HEhfQU7TdaYDMlGniTvhQDAgp+vO82bKJdwFNvQrf/5K2GoU1IYDQM3/a4X1Ap02juYwV X-Received: by 2002:a17:90b:4a84:b0:20d:8953:5ab0 with SMTP id lp4-20020a17090b4a8400b0020d89535ab0mr62056029pjb.48.1666425519247; Sat, 22 Oct 2022 00:58:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666425519; cv=none; d=google.com; s=arc-20160816; b=rhwP7YMacqLhzb9WcbSFr9uN8dHausqxybudmrYsIh9qJy7xkpo6Bu3/S12i3sIUtR G01DZe1+tIDzOOPpRXZOCCeEXNWSvj3w4JR5j8Ry/Lixx+8HLvZcKTuSDBx3ouwSnw20 10jsKP2pQ/Ph93whmZXXP7gVGoCxzsirfE9gbJcKaZTIDnFP1v2yG5bACYdvzQ0soVLF MXdZmE8sApUYH7RORN5Lu+tE+eoUywXg0c7fszG9tZ6F0P+5X4ykZ2i8fQHnnycDDPth CV7KQcabWQwu4Ac+cFxk61yBsKm59xKHQEWAA5z64TDnm4AGM/EK/Pp8izfr/0xad/YF pUXQ== 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=0NSNSeWPyGDNoPo/MXlMb+vb5mPoByzXNLn9r7Z/+MU=; b=ijyhI/g6c4vBae/7kpi4i/wnV1FVv2sM34fP3ZkEdetucBqbuohQb9LrpV0KEdv2ZS +0TbUl46c5do9wBfRSX7BpKftjE3qT5QZf9DnSVSU49FrTP28uSL6QURyMahl6q82uAa c5OdI1Q8rpsYpmkWEwb/dDG7pQPOT2ExryPfyUYX+92Y5pvCJpzazHWsil1Vcajt2mwT 1Cv2qhoZdevsmmME7Z3+ow6n6JTGJwasQT7Xl5UfGbyaWOiWAr9DmqqALoYhpFt5g6ED N3QcjzXD7dlaR47Lc7yZQmjH1qdl7BGa2/mG14rMGxWEpGW+hdhtgHOTvkO8YpK9n5Gx Wh5w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=mY23q3fS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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-20020a17090b4f4b00b0020d542eb5f0si2670456pjb.110.2022.10.22.00.58.26; Sat, 22 Oct 2022 00:58: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=mY23q3fS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S232170AbiJVH5u (ORCPT + 99 others); Sat, 22 Oct 2022 03:57:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42382 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231824AbiJVHxo (ORCPT ); Sat, 22 Oct 2022 03:53: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 BC3092CA7FF; Sat, 22 Oct 2022 00:47: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 9B4E460AD9; Sat, 22 Oct 2022 07:45:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AD672C433C1; Sat, 22 Oct 2022 07:45:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424756; bh=JhgL9COsiyeoFdvdjazLag1ghoyXd+7VEHktdi85UDE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mY23q3fSCAEvPbwQ2GlXCiWwrYXQVDceEx32SlO+O7Gu1njUPzRACWGMhkaEVgE6p IXx8T/8ccqRlNYPsdz20gsjVs3sxSCQUUZmaYT9mzKmBdhJbuc7pVnPBOMlEJH8UYy wKDSBLavw1X972hs7EN94WV4/GlmE1qNkDKP5iY0= 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 5.19 235/717] wifi: rtl8xxxu: gen2: Fix mistake in path B IQ calibration Date: Sat, 22 Oct 2022 09:21:54 +0200 Message-Id: <20221022072456.608029589@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747373805569887199?= X-GMAIL-MSGID: =?utf-8?q?1747373805569887199?= 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 03b04d6913d7..780a485eafd9 100644 --- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c +++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c @@ -2929,12 +2929,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 Sat Oct 22 07:21: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: 7310 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1093393wrr; Sat, 22 Oct 2022 00:57:04 -0700 (PDT) X-Google-Smtp-Source: AMsMyM61zHgipLcbeugoQ2v0IORqVN93MB5fVt8li1/rpxf8zxABpYRh6YMLXYVyiuWKKoHAGQzZ X-Received: by 2002:a63:1455:0:b0:438:e26b:ab1f with SMTP id 21-20020a631455000000b00438e26bab1fmr18967825pgu.183.1666425423928; Sat, 22 Oct 2022 00:57:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666425423; cv=none; d=google.com; s=arc-20160816; b=WdCGsYxD7zqpc/WCDowGUfkXttYl0vDcTyeLq5Z+7ccKn4BGgaineJSPNuGo9TGQuA YBmY5o5erIj5nBJtP+JiQGyprizmGvBVsV9MUdf6TZIneP7QhgxK5LMr4IrarbPndMTs uhRl7ezGN0t6vyHodgGQ47Ey8nUWBuZnP5InQaPjtCuA0DP7iPzjn73qBNSe0GXuP8ys SFJbKEB+YigXNWf+ayYkjE3FRCwZVXqG14ojLRKIjacJ1DYzpdsBSveUJGBlQbJpiXmM 2jQBgRpHVLntSgQ4PMuozUb5xi+pLor4QFstMp7yQWdxgC599qe38hKx73lxVOWN9RLQ 32UA== 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=5QLTH4pVycFqwi8gjNIRvc3ekY9ENaN+0+Q2jY9HKVI=; b=BOhyklMj3CuB7E3+FjJbL5DnGQGJNEAMdVIHED7ixHTf06hzzHmeJ3BXZKDDNWmrz4 r5Gp/RBzd3hRUzG88q7AHWCUzQgdfz43SbPEaNvEfoAfAsiabkZOTERsRhHYzynvWbMg 6n6xS4aGWJVx7pgkgHviIpeTOJBj9dyD4+Ua8cxrtOa7/JBQ9VX+NkyFUoRXtj+13uhA 2Q1XmnBZ7/7U2mxkntSIQuZH7xxJiiKqcZGaszdKsxGUA/6p48zhp8ZGCAE+bKuq5mWu W3Xck8Ou8rGTqcDZlqQgeiCP+I9pcoOxDbOkLuAXUIDjidaYbegF7X6JrdqKR2iFwLxr /+bg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=zVxCFtzR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 z13-20020a170902cccd00b0018659ff71d2si10298913ple.62.2022.10.22.00.56.50; Sat, 22 Oct 2022 00:57: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=zVxCFtzR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S232270AbiJVH42 (ORCPT + 99 others); Sat, 22 Oct 2022 03:56:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42520 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231834AbiJVHwn (ORCPT ); Sat, 22 Oct 2022 03:52:43 -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 DA32B2CA7CB; Sat, 22 Oct 2022 00:46:52 -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 02800B82E04; Sat, 22 Oct 2022 07:46:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 68EFFC433D7; Sat, 22 Oct 2022 07:45:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424758; bh=cb9AYLegFXiTkvHGAfCKIRGZYjBMoWfVo20Z0DvmxeM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zVxCFtzRNxE2/kOQlzQeYlsINBeMxFEHaXWts6ZxpTzzMJ+u/c2dKZtQH4hs/6MjZ DwPb2DGfqplQtLCbnxufzs6+Ac8YLK2XLklMlTuxroamuuw1ok1KGoEG7xiMzo+QgA 6i83BaNhZYxtQvrDvIaX6FCXlDIGGrD28LnG+PE8= 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 5.19 236/717] wifi: rtl8xxxu: Remove copy-paste leftover in gen2_update_rate_mask Date: Sat, 22 Oct 2022 09:21:55 +0200 Message-Id: <20221022072456.774535134@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747373705624322650?= X-GMAIL-MSGID: =?utf-8?q?1747373705624322650?= From: Bitterblue Smith [ Upstream commit d5350756c03cdf18696295c6b11d7acc4dbf825c ] It looks like a leftover from copying rtl8xxxu_update_rate_mask, which is used with the gen1 chips. It wasn't causing any problems for my RTL8188FU test device, but it's clearly a mistake, so remove it. Fixes: f653e69009c6 ("rtl8xxxu: Implement basic 8723b specific update_rate_mask() function") Signed-off-by: Bitterblue Smith Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/d5544fe8-9798-28f1-54bd-6839a1974b10@gmail.com Signed-off-by: Sasha Levin --- drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c index 780a485eafd9..472b00c70781 100644 --- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c +++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c @@ -4353,15 +4353,14 @@ void rtl8xxxu_gen2_update_rate_mask(struct rtl8xxxu_priv *priv, h2c.b_macid_cfg.ramask2 = (ramask >> 16) & 0xff; h2c.b_macid_cfg.ramask3 = (ramask >> 24) & 0xff; - h2c.ramask.arg = 0x80; h2c.b_macid_cfg.data1 = rateid; if (sgi) h2c.b_macid_cfg.data1 |= BIT(7); h2c.b_macid_cfg.data2 = bw; - dev_dbg(&priv->udev->dev, "%s: rate mask %08x, arg %02x, size %zi\n", - __func__, ramask, h2c.ramask.arg, sizeof(h2c.b_macid_cfg)); + dev_dbg(&priv->udev->dev, "%s: rate mask %08x, rateid %02x, sgi %d, size %zi\n", + __func__, ramask, rateid, sgi, sizeof(h2c.b_macid_cfg)); rtl8xxxu_gen2_h2c_cmd(priv, &h2c, sizeof(h2c.b_macid_cfg)); } From patchwork Sat Oct 22 07:21: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: 7308 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1093355wrr; Sat, 22 Oct 2022 00:56:59 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4/j2dOikojZS9+oq0QxIFpcm45X3PJdcwKK7Xg/PuvNeG6Do0MCDJUP3Yhpkv/7ejpLxe+ X-Received: by 2002:a65:4c0c:0:b0:45f:f12d:f46f with SMTP id u12-20020a654c0c000000b0045ff12df46fmr19633881pgq.579.1666425418866; Sat, 22 Oct 2022 00:56:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666425418; cv=none; d=google.com; s=arc-20160816; b=usu6SeW9NXL65SfhH9TnzYZti4fu5vjzlPvi6Oglz9D/WlbER10i2rRQsnROn+yoN5 aLMAEqKWi1Vv5DG8C2JTqzpJkUN9+1QIu2ODbnZmVzLs0SGa4umffNPhbWm3BQUBOhR/ qrf17AAT3lMqY5FYbwINBWfTW0kxhbLjxrGlkP1u6fu4IeQ6GAGs89pJ4O2E+hp6GnTy 6sHu+uSRVIprS8iyxgJ5sSJydM09z6gAmFVI3AK99d/5RO1uU6vXqB3A4/ZqD+KaAbgK QqJlksiBjjALDN29MKDY28QfLv3oUT0xg0kVcCylGhWtDV/lCqDzEQlfCkmQ+nvfYKfW yvmg== 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=CPAiZ8LxqUuUbJ57SYwBf90RYJhKPSO+BnS3dk141NU=; b=MTfjX05+1K3nDTXnfCLOMfOY44P5DNh/pRb70I71UDRpfhppzYhbha8dzz2dGMmVfT leKiJWelaFxrXJUENG85qSeTmiPI0JBzTRvXsYSgrPgUSB8NhE01uvfkuWBMlHnhG43T +116SvbWP3FkCuDBaKkrtZ8xnFkqb5utrh9RZx5BM07glygenS3w+92jV6yTijg1zOCB 2aTqJOK0cQUpNXI1Vt7NItToDWU/UJ/c7K1MwmEyCixEo31WaVBBMmc45lHLwzEx2tAv Uw/PlW6t9+kXEN/OWfwqeBgokW8rhvhvfL1FqrX7vspaorXwF0Nh0baGKwADJiyB3Tcq +pUA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=lNLMWu41; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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-20020aa78e45000000b005635bfe397bsi24630791pfr.218.2022.10.22.00.56.45; Sat, 22 Oct 2022 00:56: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=lNLMWu41; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S232283AbiJVH4W (ORCPT + 99 others); Sat, 22 Oct 2022 03:56:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42332 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231826AbiJVHwi (ORCPT ); Sat, 22 Oct 2022 03:52: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 65ACF2C6EB7; Sat, 22 Oct 2022 00:46: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 7C11E60BB5; Sat, 22 Oct 2022 07:44:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8AED6C433D6; Sat, 22 Oct 2022 07:44:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424681; bh=Ezjo1GhHEo9V8xJkef95aeBkTOtIzA4CqJ/f1m1eZJc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lNLMWu419+CvpvQqVMNNw7kWJaVbNC9ePPdDJHD4Itgdp0crUUTMvo8W3VeSbvgmE F7+CcnMx9xNjQdQtbllsC5YNp9y2fYSxGICrM8nC+G9od7gn8ovZS5rrhWxYKxCjZz hejcNuvdfS4sAAb6ioCY0qiQybiWZrDkUbvjFMPg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, YN Chen , Sean Wang , Felix Fietkau , Sasha Levin Subject: [PATCH 5.19 237/717] wifi: mt76: mt7921e: fix race issue between reset and suspend/resume Date: Sat, 22 Oct 2022 09:21:56 +0200 Message-Id: <20221022072456.938168436@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747373700036756747?= X-GMAIL-MSGID: =?utf-8?q?1747373700036756747?= From: Sean Wang [ Upstream commit ff6c4a6449793e9718ef2e9ad46864b63022648e ] It is unexpected that the reset work is running simultaneously with the suspend or resume context and it is possible that reset work is still running even after mt7921 is suspended if we don't fix the race issue. Thus, the suspend procedure should be waiting until the reset is completed at the beginning and ignore the subsequent the reset requests. In case there is an error that happens during either suspend or resume handler, we will schedule a reset task to recover the error before returning the error code to ensure we can immediately fix the error there. Fixes: 0c1ce9884607 ("mt76: mt7921: add wifi reset support") Co-developed-by: YN Chen Signed-off-by: YN Chen Signed-off-by: Sean Wang Signed-off-by: Felix Fietkau Signed-off-by: Sasha Levin --- drivers/net/wireless/mediatek/mt76/mt7921/mac.c | 5 +++++ drivers/net/wireless/mediatek/mt76/mt7921/pci.c | 13 +++++++++---- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/mac.c b/drivers/net/wireless/mediatek/mt76/mt7921/mac.c index 2a2ea7b9977a..7e0cddc2aeab 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7921/mac.c +++ b/drivers/net/wireless/mediatek/mt76/mt7921/mac.c @@ -1215,6 +1215,7 @@ void mt7921_mac_reset_work(struct work_struct *work) void mt7921_reset(struct mt76_dev *mdev) { struct mt7921_dev *dev = container_of(mdev, struct mt7921_dev, mt76); + struct mt76_connac_pm *pm = &dev->pm; if (!dev->hw_init_done) return; @@ -1222,8 +1223,12 @@ void mt7921_reset(struct mt76_dev *mdev) if (dev->hw_full_reset) return; + if (pm->suspended) + return; + queue_work(dev->mt76.wq, &dev->reset_work); } +EXPORT_SYMBOL_GPL(mt7921_reset); void mt7921_mac_update_mib_stats(struct mt7921_phy *phy) { diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/pci.c b/drivers/net/wireless/mediatek/mt76/mt7921/pci.c index b5fb22b8e086..295c21586273 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7921/pci.c +++ b/drivers/net/wireless/mediatek/mt76/mt7921/pci.c @@ -368,6 +368,7 @@ static int mt7921_pci_suspend(struct pci_dev *pdev, pm_message_t state) int i, err; pm->suspended = true; + flush_work(&dev->reset_work); cancel_delayed_work_sync(&pm->ps_work); cancel_work_sync(&pm->wake_work); @@ -433,6 +434,9 @@ static int mt7921_pci_suspend(struct pci_dev *pdev, pm_message_t state) restore_suspend: pm->suspended = false; + if (err < 0) + mt7921_reset(&dev->mt76); + return err; } @@ -451,7 +455,7 @@ static int mt7921_pci_resume(struct pci_dev *pdev) err = mt7921_mcu_drv_pmctrl(dev); if (err < 0) - return err; + goto failed; mt7921_wpdma_reinit_cond(dev); @@ -481,11 +485,12 @@ static int mt7921_pci_resume(struct pci_dev *pdev) mt76_connac_mcu_set_deep_sleep(&dev->mt76, false); err = mt76_connac_mcu_set_hif_suspend(mdev, false); - if (err) - return err; - +failed: pm->suspended = false; + if (err < 0) + mt7921_reset(&dev->mt76); + return err; } #endif /* CONFIG_PM */ From patchwork Sat Oct 22 07:21: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: 7306 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1093252wrr; Sat, 22 Oct 2022 00:56:35 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5e7btP1aRySQcgqQg6AhWRc+YRlG/QDiAFkXjv5QbianCbphw3BF3nWhqud1P5MuTmLZNT X-Received: by 2002:a63:4752:0:b0:439:5dcc:fd78 with SMTP id w18-20020a634752000000b004395dccfd78mr19037055pgk.104.1666425395240; Sat, 22 Oct 2022 00:56:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666425395; cv=none; d=google.com; s=arc-20160816; b=pD/w4+k1BUZayD7FpX0QL8gBtH1++hgL4T8B+EznDAdAMoK6k2pBXWId4U2HJh9IwK Z6k5M82E++0dUd2QecHgKXSR24nv/E4ZxYzqPVCP1N0b7oEHEqyuk6jrsEtoYxoDWGNE 0h0gbCY16a44VSFOdZmgMIQQG1cLRGsn0oWorvjypuSmh6RtBa9iUa0TPc76FavW1MOR KX8cuVfHWRSIsfY5XXJzqMoO3SoB+Sfvbnz3JOX8n5+dtlwFVvkLZ85F6PWIKyqabEve lTV2JOpStJtPyIS7ckEO0PSlNbDnA/8KbByYdQHfvK+jzFKsgsOhmw+l++45uAjnNkGM 4CHA== 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=5FdZHR8LyzLPdsluQybj3l862H6OItUQ2avF4COcTMA=; b=VSWRf09ivpd+VbBkeF7CFPW8jHXvwvzz03arIuhnYgys9ebNCHEMjQ/QcfFXUxgYyc qDjKLBrCKKtoLT65lMHi22AszNFaqN/TnCeSCvOYa3v4JiXj/GWPxx1BcwTynN75ytgM FfPZYpvQTM5d2P1ofj/l2CwwcHzcBwIlICfHquAM7OLLsTHVnOClMjZ9aXDH7u6f0m5k MRzuGXi2vOOErkdsGkg2c0IoGQU3AKh59FQtKOW4fxBFuv7CCH3b7jPSy/6jsSp+s6sn bdKiRLp4aQWN77XuCkA5C1NJ02eBLcQP4qoi6dgJyMyBbvglZkHKBTuKpOtrbcuaNE8L 5smg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=HuGUvbrq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 b16-20020a170902d51000b001869394a38dsi121321plg.503.2022.10.22.00.56.22; Sat, 22 Oct 2022 00:56: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=HuGUvbrq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S232217AbiJVH4G (ORCPT + 99 others); Sat, 22 Oct 2022 03:56:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42336 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231789AbiJVHwi (ORCPT ); Sat, 22 Oct 2022 03:52: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 6E1AB2CA7C7; Sat, 22 Oct 2022 00:46:52 -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 3935160B00; Sat, 22 Oct 2022 07:44:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 261BAC433C1; Sat, 22 Oct 2022 07:44:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424684; bh=mm2zaj2XYewV94kiPFrJN30t0TgqhWK83H/2Drtdujc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HuGUvbrqvK6tY9wnrXvv37N8Oa53eRoXMtYCDcNlpeid1/wVRQTR96kkP7vXNcogG DI1YVUQ3Q/U2vI+8WbJ3CohpO0IgswGngEUkGc5PFKdR4cU8/Mamg6NT035Kdei2n9 pwjTANdqH0xhN8OeiHnXP58lOMPio0fmz9QyJGj4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, YN Chen , Sean Wang , Felix Fietkau , Sasha Levin Subject: [PATCH 5.19 238/717] wifi: mt76: mt7921s: fix race issue between reset and suspend/resume Date: Sat, 22 Oct 2022 09:21:57 +0200 Message-Id: <20221022072457.102513648@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747373675623430377?= X-GMAIL-MSGID: =?utf-8?q?1747373675623430377?= From: Sean Wang [ Upstream commit e86f10e6809add9132ecc2c6b3184ed59db7ca71 ] It is unexpected that the reset work is running simultaneously with the suspend or resume context and it is possible that reset work is still running even after mt7921 is suspended if we don't fix the race issue. Thus, the suspend procedure should be waiting until the reset is completed at the beginning and ignore the subsequent the reset requests. In case there is an error that happens during either suspend or resume handler, we will schedule a reset task to recover the error before returning the error code to ensure we can immediately fix the error there. Fixes: ca74b9b907f9 ("mt76: mt7921s: add reset support") Co-developed-by: YN Chen Signed-off-by: YN Chen Signed-off-by: Sean Wang Signed-off-by: Felix Fietkau Signed-off-by: Sasha Levin --- drivers/net/wireless/mediatek/mt76/mt7921/sdio.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/sdio.c b/drivers/net/wireless/mediatek/mt76/mt7921/sdio.c index af26d59fa2f0..5610c63fe1e6 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7921/sdio.c +++ b/drivers/net/wireless/mediatek/mt76/mt7921/sdio.c @@ -206,6 +206,7 @@ static int mt7921s_suspend(struct device *__dev) pm->suspended = true; set_bit(MT76_STATE_SUSPEND, &mdev->phy.state); + flush_work(&dev->reset_work); cancel_delayed_work_sync(&pm->ps_work); cancel_work_sync(&pm->wake_work); @@ -261,6 +262,9 @@ static int mt7921s_suspend(struct device *__dev) clear_bit(MT76_STATE_SUSPEND, &mdev->phy.state); pm->suspended = false; + if (err < 0) + mt7921_reset(&dev->mt76); + return err; } @@ -276,7 +280,7 @@ static int mt7921s_resume(struct device *__dev) err = mt7921_mcu_drv_pmctrl(dev); if (err < 0) - return err; + goto failed; mt76_worker_enable(&mdev->tx_worker); mt76_worker_enable(&mdev->sdio.txrx_worker); @@ -288,11 +292,12 @@ static int mt7921s_resume(struct device *__dev) mt76_connac_mcu_set_deep_sleep(mdev, false); err = mt76_connac_mcu_set_hif_suspend(mdev, false); - if (err) - return err; - +failed: pm->suspended = false; + if (err < 0) + mt7921_reset(&dev->mt76); + return err; } From patchwork Sat Oct 22 07:21: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: 7318 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1093536wrr; Sat, 22 Oct 2022 00:57:38 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6tazmBosrDZL84avNdCMYtTcQoE564tUihkdNBMQxhuYBrs64n4Tq6Iqg6olumtLxNPlqh X-Received: by 2002:a17:902:7d87:b0:17f:9cd0:2e03 with SMTP id a7-20020a1709027d8700b0017f9cd02e03mr23161669plm.164.1666425457779; Sat, 22 Oct 2022 00:57:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666425457; cv=none; d=google.com; s=arc-20160816; b=ivHDavPfIcU7p3POtCYqbv+a+JCvIQ0+BSgxCp4EjjZ2TNQVZNb4YWM8UMvwf3vxBt VMHv6ckpPzz85v/oe2v7Fwt6s3zP8z+x8cBlXQMcY2pfu+lBgtrr108Q3JFuAPR6plvO DQHj+hRADenH3PXQnWuAQ82pQVSexBgNBkZjqFiMo3vo+l7ICpqn2R4/iIa/Akd4vyEo xFZcityz3dSsttxxm6FTvcTUoG4kUe5QFeSZMJ4yCgDCPt5UcnjQAKuYvLYzbQwST4PP JEF3beuwIHO1F4LCtfGz/NA4BkWAWjClORkpG26oPWu25IMIblJWSwqsljWu8X7NxiXY Wp7A== 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=ZElE0e6Xzws/B2ARTYCQX2o/rPJrO+egUleYANk82Cc=; b=H0+Cp8mp3eANM57IBr/tGcicVTje5EtAEs4ehHuup+9/8eNCZVztKoqRt/EC1kuuUp 5uZFGDKHYyLBUQTRgvyNTOitkWh+22f4tV1mwhsczZfxbGuD2kenmmDVWKd6pUrYsYlD y/tgeYwJwrSySKo6knHV55dlAcyB+X7123uBZgWeSIbUePsy7Jn96zPm/XMp0c4LBb3q vacUBqUKpvetyyBi+8lUzcK1XYZttjCkoecHk8dOUIFDrU1wjaRvEkYs84wcOy6C/Hl/ lxhvM194XA03GXITpEEG3W+Ws+n9Nn4yo6TuTocYujn/5M3CMi7PD43o1StgqxLzB+pO jseA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=N79iC+Jc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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-20020a630243000000b0046ed54becf6si2330943pgc.678.2022.10.22.00.57.25; Sat, 22 Oct 2022 00:57: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=N79iC+Jc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231958AbiJVH5L (ORCPT + 99 others); Sat, 22 Oct 2022 03:57:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56428 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231962AbiJVHxL (ORCPT ); Sat, 22 Oct 2022 03:53: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 323A92CA7D0; Sat, 22 Oct 2022 00:46: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 D6DDA60BB8; Sat, 22 Oct 2022 07:44:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E8E9AC433C1; Sat, 22 Oct 2022 07:44:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424687; bh=7ZzkCr20JnkiwmkmTiSJfuITjuLNjcYgYZSQfOnkhSM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=N79iC+JcO5weRvZgVn0krGCT9RebZqcYSzXC+7EDBbPBfjVApnhVDxel+lTAtZuZn XtRyhcBgB0m5bd39zEa7cukjRzHT0KZt8STTfqFc0cf2dKi+BOZ1lgLRxCTuoUIsr+ eFQEH6sNgcDXNdL9VYaT+wxcBVdyXQcuKB6WUl/g= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, YN Chen , Sean Wang , Felix Fietkau , Sasha Levin Subject: [PATCH 5.19 239/717] wifi: mt76: mt7921u: fix race issue between reset and suspend/resume Date: Sat, 22 Oct 2022 09:21:58 +0200 Message-Id: <20221022072457.262097154@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747373740893918218?= X-GMAIL-MSGID: =?utf-8?q?1747373740893918218?= From: Sean Wang [ Upstream commit 86f15d043ba7f13211d5c3e41961c3381fb12880 ] It is unexpected that the reset work is running simultaneously with the suspend or resume context and it is possible that reset work is still running even after mt7921 is suspended if we don't fix the race issue. Thus, the suspend procedure should be waiting until the reset is completed at the beginning and ignore the subsequent the reset requests. In case there is an error that happens during either suspend or resume handler, we will schedule a reset task to recover the error before returning the error code to ensure we can immediately fix the error there. Fixes: df3e4143ba8a ("mt76: mt7921u: add suspend/resume support") Co-developed-by: YN Chen Signed-off-by: YN Chen Signed-off-by: Sean Wang Signed-off-by: Felix Fietkau Signed-off-by: Sasha Levin --- .../net/wireless/mediatek/mt76/mt7921/usb.c | 28 ++++++++++++++++--- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/usb.c b/drivers/net/wireless/mediatek/mt76/mt7921/usb.c index dc38baef273a..25b4a8001b9e 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7921/usb.c +++ b/drivers/net/wireless/mediatek/mt76/mt7921/usb.c @@ -292,11 +292,15 @@ static void mt7921u_disconnect(struct usb_interface *usb_intf) static int mt7921u_suspend(struct usb_interface *intf, pm_message_t state) { struct mt7921_dev *dev = usb_get_intfdata(intf); + struct mt76_connac_pm *pm = &dev->pm; int err; + pm->suspended = true; + flush_work(&dev->reset_work); + err = mt76_connac_mcu_set_hif_suspend(&dev->mt76, true); if (err) - return err; + goto failed; mt76u_stop_rx(&dev->mt76); mt76u_stop_tx(&dev->mt76); @@ -304,11 +308,20 @@ static int mt7921u_suspend(struct usb_interface *intf, pm_message_t state) set_bit(MT76_STATE_SUSPEND, &dev->mphy.state); return 0; + +failed: + pm->suspended = false; + + if (err < 0) + mt7921_reset(&dev->mt76); + + return err; } static int mt7921u_resume(struct usb_interface *intf) { struct mt7921_dev *dev = usb_get_intfdata(intf); + struct mt76_connac_pm *pm = &dev->pm; bool reinit = true; int err, i; @@ -330,16 +343,23 @@ static int mt7921u_resume(struct usb_interface *intf) if (reinit || mt7921_dma_need_reinit(dev)) { err = mt7921u_dma_init(dev, true); if (err) - return err; + goto failed; } clear_bit(MT76_STATE_SUSPEND, &dev->mphy.state); err = mt76u_resume_rx(&dev->mt76); if (err < 0) - return err; + goto failed; + + err = mt76_connac_mcu_set_hif_suspend(&dev->mt76, false); +failed: + pm->suspended = false; + + if (err < 0) + mt7921_reset(&dev->mt76); - return mt76_connac_mcu_set_hif_suspend(&dev->mt76, false); + return err; } #endif /* CONFIG_PM */ From patchwork Sat Oct 22 07:21: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: 7265 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1091826wrr; Sat, 22 Oct 2022 00:51:59 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5HP+RmD2q7UB/vAwoi6/DNYSmUIPSt0rUn2/9IB0Q40qKpEzXRfK9zHeCSvrpqfmtpPU2v X-Received: by 2002:a17:90b:1c8b:b0:203:dcf1:128a with SMTP id oo11-20020a17090b1c8b00b00203dcf1128amr60278101pjb.182.1666425118950; Sat, 22 Oct 2022 00:51:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666425118; cv=none; d=google.com; s=arc-20160816; b=gY5AwexQ9W+Kl9P5x+A2Apgyu60+srh7AuvSd/QBAxl9UXeAoJV9TtmFAR+6s1aqOu gxoHVsTCen2shWVdTFhhMp88rmRJKbFgPeOfGB8sGN9MlFjLY8J2I1fAV5AFj4Fw/HCd aeHnva+4Xu+3aCr7pVgzDRPBd9Tiu55fHSqL0MHWeyaWSzF7IEuZY9jtE3LPFRhcxJgM moi9ti66ICXtCeQ8ZRP1rQlqx3zXBa7BwKtMRzcpvjuttSZrVYPEg3kRacEYc31sljqp AqYXN3QCytOCi4pvktVORSH9KwPm8exJtEZD6A4V/UNQC6KpxoDUVg+8XsoPQFvhKFGr WaAQ== 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=79qzC5ys4s8RdYle92aTycV7NqPJ9PsUiQ2nDpzcTlo=; b=wdmdwCXgwPlvy80Lhgt9keZatUggAQpsBdB5IfpPWjHNXC/iddHPn4z9YLyznJmHs2 goRDJ0gxfGI9yT1yIrkupBLrzvAlrV3VGMUSj9eSFZSRxKLzBfeZCB3NEVEffSxmqW+J B4AggtV3SkiO8SBBWz18yNzRJn/6DYa7V0vVLtxerZj5wPgx7CFBhWPSVamAXo2HBNO+ 6ImSIvo8St86MsQOqZzTeyqidJyUNv+4ibds2p4Vq/Ed0RlolDBRRWcyBR9lUdvlB9Bn KHO7cPCy+552rWPS8aqNC4VpVJ5FFDwB3T3xpK9kgRHeEizZhLmRx0tEbOEYReoEm2uT gk2g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=vMvlb3I6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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-20020a170902ced200b001865dfb6774si11437048plg.458.2022.10.22.00.51.44; Sat, 22 Oct 2022 00:51: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=vMvlb3I6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231896AbiJVHv3 (ORCPT + 99 others); Sat, 22 Oct 2022 03:51:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34326 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231854AbiJVHt0 (ORCPT ); Sat, 22 Oct 2022 03:49: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 B20D7173FD5; Sat, 22 Oct 2022 00:45:56 -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 549EAB82E13; Sat, 22 Oct 2022 07:44:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A3C07C433C1; Sat, 22 Oct 2022 07:44:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424690; bh=A50efcMezfHBVBM3mdxcEfLUQK/RuFshzE7sArVfLNU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vMvlb3I6pdwJSsQUOGxoaMPkI7PShgbivu6h84KGQD4Z3UclDqkWWIAn1wDSOMeoi I6jmCH+zXkywMH7Sl/lYZnv704KNRZa8NHsDBACqo4zsLsogDrHfIH7r1jVbZVCKVm 4OrBVOiyw6KySDrE/qEf0V2jdpXm91Fa3N5tHBG8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, YN Chen , Sean Wang , Felix Fietkau , Sasha Levin Subject: [PATCH 5.19 240/717] wifi: mt76: sdio: fix the deadlock caused by sdio->stat_work Date: Sat, 22 Oct 2022 09:21:59 +0200 Message-Id: <20221022072457.410525308@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747373385543743840?= X-GMAIL-MSGID: =?utf-8?q?1747373385543743840?= From: Sean Wang [ Upstream commit e5d78fd998be94fb459a3d625df7367849b997b8 ] Because wake_work and sdio->stat_work share the same workqueue mt76->wq, if sdio->stat_work cannot acquire the mutex lock such as that was possibly held up by [mt7615, mt7921]_mutex_acquire. Additionally, if [mt7615, mt7921]_mutex_acquire was called by sdio->stat_work self, the wake would be blocked by itself. Thus, we move the stat_work into ieee80211_workqueue instead to break the deadlock. Fixes: d39b52e31aa6 ("mt76: introduce mt76_sdio module") Co-developed-by: YN Chen Signed-off-by: YN Chen Signed-off-by: Sean Wang Signed-off-by: Felix Fietkau Signed-off-by: Sasha Levin --- drivers/net/wireless/mediatek/mt76/sdio.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/sdio.c b/drivers/net/wireless/mediatek/mt76/sdio.c index def7f325f5c5..574687ca93a9 100644 --- a/drivers/net/wireless/mediatek/mt76/sdio.c +++ b/drivers/net/wireless/mediatek/mt76/sdio.c @@ -483,7 +483,7 @@ static void mt76s_status_worker(struct mt76_worker *w) if (dev->drv->tx_status_data && !test_and_set_bit(MT76_READING_STATS, &dev->phy.state) && !test_bit(MT76_STATE_SUSPEND, &dev->phy.state)) - queue_work(dev->wq, &dev->sdio.stat_work); + ieee80211_queue_work(dev->hw, &dev->sdio.stat_work); } while (nframes > 0); if (resched) @@ -510,7 +510,7 @@ static void mt76s_tx_status_data(struct work_struct *work) } if (count && test_bit(MT76_STATE_RUNNING, &dev->phy.state)) - queue_work(dev->wq, &sdio->stat_work); + ieee80211_queue_work(dev->hw, &sdio->stat_work); else clear_bit(MT76_READING_STATS, &dev->phy.state); } From patchwork Sat Oct 22 07:22: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: 7617 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1106812wrr; Sat, 22 Oct 2022 01:39:05 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4mPsnBRrbBILSyUZV/UunwAv+d41ACsWjyNlLOS3czagEiWL0PlC/D/n9+tvYFRiawUsNh X-Received: by 2002:a05:6402:3887:b0:458:289e:c9cc with SMTP id fd7-20020a056402388700b00458289ec9ccmr21247086edb.101.1666427945773; Sat, 22 Oct 2022 01:39:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666427945; cv=none; d=google.com; s=arc-20160816; b=Orgz1jEagwu83t32Ll4v8MPCHzjBdxKZNdVRHiWBCDdhxE7p4KIUSCEIi79UsRiyOI k/USQA0QsIYM/lkfdCsh4piDk7gnmxhwMcNSJ6DHXB3q6bcIriiBrXy16jgcNBhpL+6A H4eJWUMYJEn9DINmp+Rdn0bobE/wqOl9WkI9Z8WcH55F47uZS0pPx+GrkzBmsu2SH9GB Gr/qy7NPfxOxVcQ+gCyGllfjSUe2QAhrpqYkcJZXmkth34FlkG9/Ge7YXA7C2jWjFGtf K95C+/qjvMw7BuWYzMYIi7LlWV8RWSgO+B08lqcv+RPI6akN+knfJWI/LwWthxU2oz4d OOGQ== 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=4D+wIugDQqH4Y4vcAY9aOYu4eey76nTLOUEdS51Jsr0=; b=OvvptHs+M10xeLfzWaHxTyMzViepIWl/FQ/eC8RPgfX0g86dNyvonMj0eQpwasOtyf u83kJmzjZ8mn8old5XI2EElAIQLU/6KhpGB4Kv/5Ee9As0c0CS1tSo9bQr8FjrDLwiw1 X3Y1xWuFAdEF4UIgM2p/GD+Kw3spVFz8UEoXeyNSD1Y0yBGnl+F3I3jrAga2xWN/9Nxs lYGP7Nixdr4fZDiykToRTePYIZT1TEDlSDzNQi8BfxYIIr1DlliJjVxKK7V27fv5si9U quyYfPzIYhrfIiywiX7fbbH+zB09ll3umQ0Z9sWFpvYJSUDJU3jZqm0+KgkD24/UTTeX Z/hQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=NYy2RHtP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 cs17-20020a170906dc9100b007848e6eaef1si17289158ejc.733.2022.10.22.01.38.40; Sat, 22 Oct 2022 01:39: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=NYy2RHtP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S234311AbiJVIhO (ORCPT + 99 others); Sat, 22 Oct 2022 04:37:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59156 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229949AbiJVIb0 (ORCPT ); Sat, 22 Oct 2022 04:31: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 A232F2E5E03; Sat, 22 Oct 2022 01: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 EA649B82E1B; Sat, 22 Oct 2022 07:44:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 46A45C433D7; Sat, 22 Oct 2022 07:44:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424692; bh=D8oIh+1zXiFFvPpS+HgYcc84mQJZmkJPdY0WfYVOJTU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NYy2RHtPQC+xoeIzgSdhrNONTfTAOlrrLige04YJRWst4pOmnZESgmpYc1bfcHzgX Fwpou9YRKsBrTd+w+uwm6gudJhNJYAQCCgkTF5jISw4ki3tzkPwk67v6LCd3KWACfH f1xwRn+xp5ayhMJN3BzO9wPrmuqlY6nQqNJt4s4I= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sean Wang , Felix Fietkau , Sasha Levin Subject: [PATCH 5.19 241/717] wifi: mt76: sdio: poll sta stat when device transmits data Date: Sat, 22 Oct 2022 09:22:00 +0200 Message-Id: <20221022072457.603810048@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376349682943569?= X-GMAIL-MSGID: =?utf-8?q?1747376349682943569?= From: Sean Wang [ Upstream commit a323e5f041dd11af5e3de19ed7ea95a97d588c11 ] It is not meaningful to poll sta stat when there is no data traffic. So polling sta stat when the device has transmitted data instead to save CPU power. That implies that it is unallowed the stat_work to work while MCU is being initialized in the really early stage to fix the possible time to time MCU initialization failure. Fixes: d39b52e31aa6 ("mt76: introduce mt76_sdio module") Signed-off-by: Sean Wang Signed-off-by: Felix Fietkau Signed-off-by: Sasha Levin --- drivers/net/wireless/mediatek/mt76/sdio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/wireless/mediatek/mt76/sdio.c b/drivers/net/wireless/mediatek/mt76/sdio.c index 574687ca93a9..fa54ee112b0b 100644 --- a/drivers/net/wireless/mediatek/mt76/sdio.c +++ b/drivers/net/wireless/mediatek/mt76/sdio.c @@ -480,7 +480,7 @@ static void mt76s_status_worker(struct mt76_worker *w) if (ndata_frames > 0) resched = true; - if (dev->drv->tx_status_data && + if (dev->drv->tx_status_data && ndata_frames > 0 && !test_and_set_bit(MT76_READING_STATS, &dev->phy.state) && !test_bit(MT76_STATE_SUSPEND, &dev->phy.state)) ieee80211_queue_work(dev->hw, &dev->sdio.stat_work); From patchwork Sat Oct 22 07:22: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: 7326 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1093838wrr; Sat, 22 Oct 2022 00:58:36 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5fTzefwCAU0lA+y5zMzaiAw5u3xX52RQAjXBRix1lKLoxOjOaDQzm/IIElX+36uCQNuLYx X-Received: by 2002:a05:6a00:1414:b0:563:ae66:3103 with SMTP id l20-20020a056a00141400b00563ae663103mr22823496pfu.17.1666425515749; Sat, 22 Oct 2022 00:58:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666425515; cv=none; d=google.com; s=arc-20160816; b=IA0aSPQdLCq/ALdvG4cNnILkVhDFuuv5SvxCHCYZvNqMLecU5WB4Z5ph+eUKaZ7SAG 6gNh2Pn6c7rC+EynZTxxbLVoPGsRKo9C9U2LceXkhbogog0S/xev4CVOpV8GxmtXjoEs 6ZWYBrHzozBwH8aXb8itqXQWtUUvDEB33Od1L2lLNw7L7uygjYusAsEvXYgrdlnNfPRq 3pK+ezTDPy84vONE3DqN5gikjwMmn3fnCFPRPx74mAd9TcpzVnKBE0Ganed2Hcl/gmbL 01+93FF/aNitVTA0CSIr/atk/0uvblkcee+P7trTwT2HVAvd9iWyjMWY7AODl7ziexqj c22A== 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=Q++Z1BUPIIX7Od6i1PPgXl41fDxp8ow+FITPu3gkX1U=; b=DIwpxWq7YjuwyYfvC3X5GX4Ox2tL1l9SBnXxojjctDG04Q/MnbeLJ0ZKeSjNlKe4ah cRLEuSjUF88pSdDZiNrCnIPNZMdaJGAT9Lu6LjiHFPWgLmgUay94RRJ3d9ZVLe60SmBM o9A8SjrDKI6ZuDlS/4LWg004A3IWcLxki7qCUYB5g3gwvz2C3/NZn44niKK3N+dOD0J6 4CapShIdsYqDP/e9NUrk1ZWUJFI4Bdt2lYvkR8ZT2glDXhf3G0UX5QrxdcfT8yQuE+Fj 0cZfmQfEFpQNQgU5Kki5h2yKzFobju39A4IYNc6t5Q/jcRPW85hl9xWsKAJS8KS5Wlat TenQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ncNB9RwL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 x9-20020a63cc09000000b004580a3b847dsi25576430pgf.287.2022.10.22.00.58.22; Sat, 22 Oct 2022 00:58: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=ncNB9RwL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S232346AbiJVH5r (ORCPT + 99 others); Sat, 22 Oct 2022 03:57:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42470 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232039AbiJVHxo (ORCPT ); Sat, 22 Oct 2022 03:53:44 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 149FF2CA7D5; Sat, 22 Oct 2022 00:46: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 C12FB60BA7; Sat, 22 Oct 2022 07:44:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D9E6FC433D6; Sat, 22 Oct 2022 07:44:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424695; bh=Znl7Ywixd2/dDDc1fGHz5Ph8s2HQtOrWq5nb89jtzME=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ncNB9RwLsOmINJQLJyjit2FOQkHkBajpa0ZEekrzdpL5QsmAGoO1Csm1oLgAPmxii Wd8CiVvC4X29QF6HWIxeUqPQN0KjZN/H0d9HwhfHNytCqCn8t2/Ek5ZK29IlXnfS0R hrpfNu44ro/sbrAfHHwyt+HdNK2OzLv8F1FUOWjw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sean Wang , YN Chen , Felix Fietkau , Sasha Levin Subject: [PATCH 5.19 242/717] wifi: mt76: sdio: fix transmitting packet hangs Date: Sat, 22 Oct 2022 09:22:01 +0200 Message-Id: <20221022072457.778536172@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747373801363829011?= X-GMAIL-MSGID: =?utf-8?q?1747373801363829011?= From: YN Chen [ Upstream commit 250b1827205846ff346a76044955cb79d4963f70 ] Fix transmitting packets hangs with continuing to pull the pending packet from mac80211 queues when receiving Tx status notification from the device. Fixes: aac5104bf631 ("mt76: sdio: do not run mt76_txq_schedule directly") Acked-by: Sean Wang Signed-off-by: YN Chen Signed-off-by: Felix Fietkau Signed-off-by: Sasha Levin --- drivers/net/wireless/mediatek/mt76/sdio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/wireless/mediatek/mt76/sdio.c b/drivers/net/wireless/mediatek/mt76/sdio.c index fa54ee112b0b..140145e03f12 100644 --- a/drivers/net/wireless/mediatek/mt76/sdio.c +++ b/drivers/net/wireless/mediatek/mt76/sdio.c @@ -487,7 +487,7 @@ static void mt76s_status_worker(struct mt76_worker *w) } while (nframes > 0); if (resched) - mt76_worker_schedule(&dev->sdio.txrx_worker); + mt76_worker_schedule(&dev->tx_worker); } static void mt76s_tx_status_data(struct work_struct *work) From patchwork Sat Oct 22 07:22: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: 7272 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1091965wrr; Sat, 22 Oct 2022 00:52:29 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6w5Rv93blwTH3qNz+2Oc0GU7dBf916x4UnJM7yqqD4K09vzvMaLUHWnj6byktsxnhFn3xP X-Received: by 2002:a17:90b:1bc3:b0:20d:75b8:ee74 with SMTP id oa3-20020a17090b1bc300b0020d75b8ee74mr64107409pjb.1.1666425148930; Sat, 22 Oct 2022 00:52:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666425148; cv=none; d=google.com; s=arc-20160816; b=Ke/BCQKe/9ldJg2uu5LB/7D1Gq4+2cDTZGJ6awhOrnT4uY6OwMxePyeOkaYFjq+4rE UJaRfCtRr0AmLJyz42fX44m6Gs7QDp8lySJQxuNnR0S7kyRItNkQAs/OO6fJWEL4nPvJ Dry5fpsn46IV0oy/I4Mx81P8ZPJoYiXIII8iTupELj/npkhkr49oB6gV/ER92ontyVcp lx2awQ5Uzl5Ec+C7X8xNx4T/LXqyyZLAHCDzvZpFQ8kt6Piql6bJnfmtp3BmX1xCQlB2 JgsketaZN4SKjOGqik8nbHT731muocpLXIy3z54Am8699mn+PTciQs2PKAi8wcgGQBcy UYdw== 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=GocChEVnz4V5UncG5GRHBvGX0cot1JnGv6Ti6OwBkhk=; b=lyRrg9Of9QEKc4v7cLYJq0qSkYL2RDGyHigeIwjAPHoT0nZEMl1MWF0k0hfUScI8tZ YWydn3c5c3ZS8WjP838AVVCQ92ex/fzgvbXch88r4t0K38ZzQqnakwAzorNyACPUidig KT7raUYviSntVaHrwD7WVRzmt+7Kf/4Am1BQ+SstjTvhVXQPQy3TOigYqncw1Z1DiSZQ wTUlas6sRZhsZqXMzcX8uL8OEvgcWuX15NrPrmYViinyoVlTeZpGvcAzqI/KM1mSMk95 KK7jw5ofX8k4598WbDwEt6V85JiXXCMnyIgxCjPJ1ZTyhSfjMpC6ruNcXHmlapJjt92C XLhQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=0XKvmnBn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 d9-20020a170903230900b0018532e03614si31595689plh.470.2022.10.22.00.52.16; Sat, 22 Oct 2022 00:52: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=0XKvmnBn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231341AbiJVHvy (ORCPT + 99 others); Sat, 22 Oct 2022 03:51:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54850 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231883AbiJVHte (ORCPT ); Sat, 22 Oct 2022 03:49: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 0967F2AA152; Sat, 22 Oct 2022 00:46: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 ams.source.kernel.org (Postfix) with ESMTPS id 31373B82E1A; Sat, 22 Oct 2022 07:44:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 82001C433C1; Sat, 22 Oct 2022 07:44:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424697; bh=ox7vi4Bv2Sh7+GvuZXncrkO2Hs5AcUsm0cIlGIXr+08=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0XKvmnBnsK62BAdZDyogDNXH7NkYbWSaZd8vdGMoI2sgjXZOHV43trz4sAbWQqczK v3Y/TsZgSY8DUMo/GZtnJYmybIBBNwntxanjXnOIB3CP+nkD4DzuJFFFu+1myvFqBx ED+W7PtYRQayLWkqjnei+O4Om2rc0WDHy5D9F/xE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Lorenzo Bianconi , Felix Fietkau , Sasha Levin Subject: [PATCH 5.19 243/717] wifi: mt76: mt7615: add mt7615_mutex_acquire/release in mt7615_sta_set_decap_offload Date: Sat, 22 Oct 2022 09:22:02 +0200 Message-Id: <20221022072457.940959451@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747373416563429590?= X-GMAIL-MSGID: =?utf-8?q?1747373416563429590?= From: Lorenzo Bianconi [ Upstream commit 765c69d477a44c088e5d19e7758dfa4db418e3ba ] Similar to mt7921 driver, introduce mt7615_mutex_acquire/release in mt7615_sta_set_decap_offload in order to avoid sending mcu commands while the device is in low-power state. Fixes: d4b98c63d7a77 ("mt76: mt7615: add support for rx decapsulation offload") Signed-off-by: Lorenzo Bianconi Signed-off-by: Felix Fietkau Signed-off-by: Sasha Levin --- drivers/net/wireless/mediatek/mt76/mt7615/main.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/main.c b/drivers/net/wireless/mediatek/mt76/mt7615/main.c index d722c3c177be..4a1e6b92ff73 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7615/main.c +++ b/drivers/net/wireless/mediatek/mt76/mt7615/main.c @@ -1194,12 +1194,16 @@ static void mt7615_sta_set_decap_offload(struct ieee80211_hw *hw, struct mt7615_dev *dev = mt7615_hw_dev(hw); struct mt7615_sta *msta = (struct mt7615_sta *)sta->drv_priv; + mt7615_mutex_acquire(dev); + if (enabled) set_bit(MT_WCID_FLAG_HDR_TRANS, &msta->wcid.flags); else clear_bit(MT_WCID_FLAG_HDR_TRANS, &msta->wcid.flags); mt7615_mcu_set_sta_decap_offload(dev, vif, sta); + + mt7615_mutex_release(dev); } #ifdef CONFIG_PM From patchwork Sat Oct 22 07:22: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: 7311 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1093417wrr; Sat, 22 Oct 2022 00:57:09 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6s85UvesdeAwyXP5FLzMIOIxNth1UX9y3sWHy8vIe0rpH3n1f6VTj5H+YZnQgPB4powrwF X-Received: by 2002:a63:e14c:0:b0:439:2e24:e014 with SMTP id h12-20020a63e14c000000b004392e24e014mr19185221pgk.173.1666425429662; Sat, 22 Oct 2022 00:57:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666425429; cv=none; d=google.com; s=arc-20160816; b=t5yPMdUfqo1Hbun5192uBS4VkhmR1XK/THgOHPqUh+9Z8Z/l/NAE88GwBkF3JzHCfQ jSCXawheAb6KAyKne0A481oAfdzMVZdEowXm6K84yegj/BfsUW1vekD8icVFhqvGbYZr bS780/vYK1dfIInBbz0WHoef9Ay0OxYXt1XTGgFzthuuHY0uvQWRoSyazJK1djd4pu0F UhaaG0iZeNqYtJn6H4JCgSU7gv1ujss60mFMaEHBgIXLyBQK4KrFVLXPiHDd413USPUe wqYS9CxnOFwfTpqhkZJac3FsGt4HClMSiI+tzF/x5BSQ56Q9w998fc4O2sBaDENam7Oo vVVQ== 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=2BQWTQd2jrsaYmKsh1EldvjUkEQm0qc3f+NBU6AEYx4=; b=tdQdNZWiei/Tay+sPQWaJBQ2m6KwMCJoxKyc7xBsP1kzft4BJbR96gaYk/NiwbuAr0 igCCI2r4Q1p3w9K/SiLtMm5I/UnL8G9K4ynBZIa7GXc6Vo015xVvJbJR1cOz1MNzrSgO GPU+4YcIMh+1N0N/MbUKBfi1e4KvE1TDk2ORF2gTaJvcUwICCf8e/gGCQL+uhTNBWlG2 NpVEzOAmSyCsP7rqyctBm18o/I0LESxl9fAeiHU7BmmAZIsU8ZxjpIT0uRp3k5eutTrN QPv4RGKKwapa5cKzjWmvZIlijqMYqFg1CvI0tjnalMhobPq3T+RoIyuOlST0zQAwFlCt PdUA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=128Mk6uG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 pi5-20020a17090b1e4500b00212ca8e7457si6059040pjb.133.2022.10.22.00.56.57; Sat, 22 Oct 2022 00:57: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=128Mk6uG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S232113AbiJVH4k (ORCPT + 99 others); Sat, 22 Oct 2022 03:56:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55590 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231871AbiJVHwv (ORCPT ); Sat, 22 Oct 2022 03:52: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 65C942CA7DC; Sat, 22 Oct 2022 00:46: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 3988B60B3B; Sat, 22 Oct 2022 07:45:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 192F7C433D6; Sat, 22 Oct 2022 07:44:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424700; bh=VRLqewPZnRfvRb2gTusmvVhdK4472AhYpCvXWsyNu4c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=128Mk6uGJWbDuGB2cdAvsIZmO90vMkS2ydUOCL+hldbFIYAV28W9GGp23Uvj+kWPQ PgUT8mnVxH+Rdnrs+Sgy6zoEHmYYkSqeUbV9E5rRIXe/dFfY9ElUkq6CQoy3Quzv4m oADV9bh54Rb3FBhneWC99L0clif9g7lgAGpM7dbs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, kernel test robot , Lorenzo Bianconi , Felix Fietkau , Sasha Levin Subject: [PATCH 5.19 244/717] wifi: mt76: mt7915: fix possible unaligned access in mt7915_mac_add_twt_setup Date: Sat, 22 Oct 2022 09:22:03 +0200 Message-Id: <20221022072458.124221443@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747373711311586083?= X-GMAIL-MSGID: =?utf-8?q?1747373711311586083?= From: Lorenzo Bianconi [ Upstream commit 3d9aa54355d863e5412a7e08180f50a8f1827b7f ] Fix possible unaligned pointer in mt7915_mac_add_twt_setup routine. Reported-by: kernel test robot Fixes: 3782b69d03e71 ("mt76: mt7915: introduce mt7915_mac_add_twt_setup routine") Signed-off-by: Lorenzo Bianconi Signed-off-by: Felix Fietkau Signed-off-by: Sasha Levin --- drivers/net/wireless/mediatek/mt76/mt7915/mac.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/mac.c b/drivers/net/wireless/mediatek/mt76/mt7915/mac.c index 89f10bf885ba..4f3a3a88f086 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7915/mac.c +++ b/drivers/net/wireless/mediatek/mt76/mt7915/mac.c @@ -2536,8 +2536,9 @@ void mt7915_mac_add_twt_setup(struct ieee80211_hw *hw, } flowid = ffs(~msta->twt.flowid_mask) - 1; - le16p_replace_bits(&twt_agrt->req_type, flowid, - IEEE80211_TWT_REQTYPE_FLOWID); + twt_agrt->req_type &= ~cpu_to_le16(IEEE80211_TWT_REQTYPE_FLOWID); + twt_agrt->req_type |= le16_encode_bits(flowid, + IEEE80211_TWT_REQTYPE_FLOWID); table_id = ffs(~dev->twt.table_mask) - 1; exp = FIELD_GET(IEEE80211_TWT_REQTYPE_WAKE_INT_EXP, req_type); @@ -2587,8 +2588,9 @@ void mt7915_mac_add_twt_setup(struct ieee80211_hw *hw, unlock: mutex_unlock(&dev->mt76.mutex); out: - le16p_replace_bits(&twt_agrt->req_type, setup_cmd, - IEEE80211_TWT_REQTYPE_SETUP_CMD); + twt_agrt->req_type &= ~cpu_to_le16(IEEE80211_TWT_REQTYPE_SETUP_CMD); + twt_agrt->req_type |= + le16_encode_bits(setup_cmd, IEEE80211_TWT_REQTYPE_SETUP_CMD); twt->control = (twt->control & IEEE80211_TWT_CONTROL_WAKE_DUR_UNIT) | (twt->control & IEEE80211_TWT_CONTROL_RX_DISABLED); } From patchwork Sat Oct 22 07:22: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: 7376 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1096558wrr; Sat, 22 Oct 2022 01:05:26 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7cNODpIoOPUW3B4BLiBakb7TnToaHmf/vVggfpqVbW2KlWpIMzTUy+n1xoQr7oLb6ewULd X-Received: by 2002:a17:90b:1e11:b0:20d:90b3:45a0 with SMTP id pg17-20020a17090b1e1100b0020d90b345a0mr59363992pjb.29.1666425926305; Sat, 22 Oct 2022 01:05:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666425926; cv=none; d=google.com; s=arc-20160816; b=z1KMFvGAvzDOn+z+rfKspO6VD22w5rRJH3d0zr/xGYfCvmmXK9Q4hp2p2QfAP8oZad 2zQ8aPeNJEbOjQDAUiCoKa/+1+VmC23VGSnT3Pc8E5/EVPx+jhfNiRQqQFch9FemYAA6 /6b3TNLewV8g7JKKV0GfHIb3uXJivylvOb47BIPt3waB4NrLYijpUhMBp2/jgYlTkWLa vCPx+XmnViag4SCHK0EGYcOGSOS7dyx0MqahmHLrPoM/K/rtAqj2MkVv38XpPcmPt0ot AED/tiTyYotV6q+2bzbndQm3XYshHzoESIafTCc3GFIwgeKn0M8EruBxLF4Gz4VtVMQ7 RhAg== 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=fApmytazUCHANFuc/R6fe98LwtXJhaMJIw/lWr/NfCc=; b=DFlaAWJNIIKmvPcU4sohjVjOS+y3NqLv3IkFGgVmYNo5UGl4OUNjyQYf4eP8/uds0C Z9bd4YfbIQXnOPD9vgWfjNWm2mTaCqTuvDyg0duQXUQZU5Acb2BaG5YBHbWioICZgD3M OG9+Y+nklEHrzW84pIwd+GSfoj0ta9wrzmlIbifVwJEKSHGdMzN43kfHhoAf4J8saSDI q3LFRTZx+X9m88dB7V8/fK1/KEOWf7AS4N9lKlWBAn9gzbwDOl3bdmkTkU5LP7MVePHT xVChHnMtsdCoNpZTCLKajMh5ArIXcw8hoRpPAFG86vO86Gh+TNPrkfEo7F3XcMDzU1r0 I26w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="pLj/n9x+"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 f16-20020a63f110000000b0045fd05b2ce9si25838393pgi.521.2022.10.22.01.05.12; Sat, 22 Oct 2022 01:05: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="pLj/n9x+"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S232676AbiJVIDt (ORCPT + 99 others); Sat, 22 Oct 2022 04:03:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47386 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232236AbiJVH4s (ORCPT ); Sat, 22 Oct 2022 03:56: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 9DF9B13A588; Sat, 22 Oct 2022 00:48: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 7CE46B82E1C; Sat, 22 Oct 2022 07:45:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EAEB6C433D6; Sat, 22 Oct 2022 07:45:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424703; bh=uKCPqX8as8dkL2IZatNJrSMA6N4n2ERN4NedPly5oI8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pLj/n9x+1oXu3a0Y04YtrIcDspxFKhopJfhpAo6Ch4Rk8AWovujNElDmJ4HaxzpAT d6WxaYg5cLRfKtv4XxAeqO1PM/+ebMpMqjtKrAPY0WuyYhEmtp1NpHb/KadacCaFMK VmVQPnXfBUNoYeJ+K8O2zT0igvz6sVHsL8Ii0SFg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, kernel test robot , Lorenzo Bianconi , Felix Fietkau , Sasha Levin Subject: [PATCH 5.19 245/717] wifi: mt76: connac: fix possible unaligned access in mt76_connac_mcu_add_nested_tlv Date: Sat, 22 Oct 2022 09:22:04 +0200 Message-Id: <20221022072458.267489976@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747374232126632361?= X-GMAIL-MSGID: =?utf-8?q?1747374232126632361?= From: Lorenzo Bianconi [ Upstream commit 0a4860f627f1f2b2b777f54f993de1638a79da9f ] Fix possible unaligned pointer in mt76_connac_mcu_add_nested_tlv routine. Reported-by: kernel test robot Fixes: 25702d9c55dc5 ("mt76: connac: rely on le16_add_cpu in mt76_connac_mcu_add_nested_tlv") Signed-off-by: Lorenzo Bianconi Signed-off-by: Felix Fietkau Signed-off-by: Sasha Levin --- drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c index 7eb23805aa94..d10b441eac4f 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c @@ -258,8 +258,10 @@ mt76_connac_mcu_add_nested_tlv(struct sk_buff *skb, int tag, int len, ntlv = le16_to_cpu(ntlv_hdr->tlv_num); ntlv_hdr->tlv_num = cpu_to_le16(ntlv + 1); - if (sta_hdr) - le16_add_cpu(&sta_hdr->len, len); + if (sta_hdr) { + len += le16_to_cpu(sta_hdr->len); + sta_hdr->len = cpu_to_le16(len); + } return ptlv; } From patchwork Sat Oct 22 07:22: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: 7282 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1092209wrr; Sat, 22 Oct 2022 00:53:21 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4W5Uvnkcv7E38CcZQKLP3bdSgtL9NCBQgJouvt6/nnQy8jU7Jt4bemyPoyVuv/GEDxyWJU X-Received: by 2002:a17:902:cac3:b0:186:6ce4:f94a with SMTP id y3-20020a170902cac300b001866ce4f94amr10592426pld.145.1666425201073; Sat, 22 Oct 2022 00:53:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666425201; cv=none; d=google.com; s=arc-20160816; b=d+cOOdeFm5vGtspRZIL1GZM8n61p441WSv+wCsr8peIjV7I9A4PbAEJBn9wdVobNJO PVCFwrA8vomnnf8ZAylwXMHQLmO1WB42i6NC944nrH/l8169G6BPQqPB2bVJSv0NXajZ vN9VCA/+Qmb7nX5UJhThV1RPDyi0W8ds0Wrnam9sifM2jEalnbKEtNLv/nGsPqjSyVb4 VVTzxiuw84BRZ0FuTJBoRlGB8Vh1ocjBC0VQdyTaDctMRl1G6W/LimhqIV7t5yE3zaUJ 5wY33AYnS4ltVKf6RFkDSD5UKPXrYv6Fp4wC1IbxNBvtElwdvVTmas7jkp+nhrDdmqxE 7YEg== 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=3nHgGXwDyXhxrIoWp/w4G3QpnHPU7gCyagY0RPYLytE=; b=feKaQqKvKPFsQHVuE5p8d4Pql+HY5bih+N9OJOxnfwaUm/gPWVcD09scHAfazYgiPT hi0IOCEFTqOwA3rBSl/OE7rp0Qd2NHti3b+9LBmMAhxLo5HB1M0TtgPnXFBCPNPg4RaD mUGb3h6lfWHS96JxK396w/UsBaFfcykqxRDSBzxjSG3GMf65GqizV2BTdiBQbi0K0ZOf 4HUnP5PoOlNGsdYb72DNIuo/Y8vPg1aJPxgHfZayqEFEgivCeDzcbqFUT8AK6WTJIEXU /BflKR7JbYL4jjEzBEn9oQLo2C+6HLjGSEftONGNuOk/zNK46UuJNo1jdWMvVvaiW2QH 6Pnw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=GXRXHfxk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 x17-20020a656ab1000000b004347b49d045si29076764pgu.631.2022.10.22.00.53.08; Sat, 22 Oct 2022 00:53: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=GXRXHfxk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231857AbiJVHwv (ORCPT + 99 others); Sat, 22 Oct 2022 03:52:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49462 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231948AbiJVHtl (ORCPT ); Sat, 22 Oct 2022 03:49:41 -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 DF579A3B88; Sat, 22 Oct 2022 00:46: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 32EDDB82E20; Sat, 22 Oct 2022 07:45:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8F1AAC433D6; Sat, 22 Oct 2022 07:45:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424705; bh=x6YESoJfx3sab24CZpUUqkR9w/aWB/eTAk+eNCGXbKg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GXRXHfxkN5OSTvVV7h4d5pTdOGhRhO5b7HuUYHmoyAEeqwaSWxyqHgqo9HZJPjm10 oGaEZqlk+P6Ptwx/MEBOlte8Sh8r0LYwXAUVQqg/rp6fyi4MfwXB+VNTyyxi1s0zm9 b7QMMOPVZAn/ASkpAbhYFkt/3J6i40DWWu/qLu5o= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, AngeloGioacchino Del Regno , Sean Wang , Lorenzo Bianconi , Felix Fietkau , Sasha Levin Subject: [PATCH 5.19 246/717] wifi: mt76: mt7921: add mt7921_mutex_acquire at mt7921_[start, stop]_ap Date: Sat, 22 Oct 2022 09:22:05 +0200 Message-Id: <20221022072458.428220926@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747373471324207191?= X-GMAIL-MSGID: =?utf-8?q?1747373471324207191?= From: Sean Wang [ Upstream commit 52b44015f031f629f1ce1d73415a2017593c7ade ] Add mt7921_mutex_acquire at mt7921_[start, stop]_ap to fix the race with the context holding dev->muxtex and the driver might access the device in low power state. Fixes: 9d958b60ebc2 ("mt76: mt7921: fix command timeout in AP stop period") Tested-by: AngeloGioacchino Del Regno Signed-off-by: Sean Wang Acked-by: Lorenzo Bianconi Signed-off-by: Felix Fietkau Signed-off-by: Sasha Levin --- .../net/wireless/mediatek/mt76/mt7921/main.c | 21 ++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/main.c b/drivers/net/wireless/mediatek/mt76/mt7921/main.c index d3f310877248..22c9793e4a40 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7921/main.c +++ b/drivers/net/wireless/mediatek/mt76/mt7921/main.c @@ -1499,17 +1499,23 @@ mt7921_start_ap(struct ieee80211_hw *hw, struct ieee80211_vif *vif) struct mt7921_dev *dev = mt7921_hw_dev(hw); int err; + mt7921_mutex_acquire(dev); + err = mt76_connac_mcu_uni_add_bss(phy->mt76, vif, &mvif->sta.wcid, true); if (err) - return err; + goto out; err = mt7921_mcu_set_bss_pm(dev, vif, true); if (err) - return err; + goto out; + + err = mt7921_mcu_sta_update(dev, NULL, vif, true, + MT76_STA_INFO_STATE_NONE); +out: + mt7921_mutex_release(dev); - return mt7921_mcu_sta_update(dev, NULL, vif, true, - MT76_STA_INFO_STATE_NONE); + return err; } static void @@ -1520,11 +1526,16 @@ mt7921_stop_ap(struct ieee80211_hw *hw, struct ieee80211_vif *vif) struct mt7921_dev *dev = mt7921_hw_dev(hw); int err; + mt7921_mutex_acquire(dev); + err = mt7921_mcu_set_bss_pm(dev, vif, false); if (err) - return; + goto out; mt76_connac_mcu_uni_add_bss(phy->mt76, vif, &mvif->sta.wcid, false); + +out: + mt7921_mutex_release(dev); } const struct ieee80211_ops mt7921_ops = { From patchwork Sat Oct 22 07:22: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: 7290 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1092381wrr; Sat, 22 Oct 2022 00:53:58 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4an4fLZ7tJ8AvOR2xU9Hn0PcEwUJ2mWje4PUiRSnWD0osKhYTzh+WMGeokIOSEeTkyf7zn X-Received: by 2002:a17:90b:70a:b0:211:f163:ddff with SMTP id s10-20020a17090b070a00b00211f163ddffmr14369821pjz.202.1666425238417; Sat, 22 Oct 2022 00:53:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666425238; cv=none; d=google.com; s=arc-20160816; b=VEtgTxZAvYnzCPHrpJE35+cq3GeReW7sQazoqvx+aCm6RDH6cJLNafOKx1C/8UktRY lojqWpjJQjVDScf8JraK4D9HUc157e8SLesGQKkWWdh6UzFMv+ZpBp+XwlVwY6tYO4lh smWEdkA4TNJDhaqYd9MeHBIGYgAcqWwP7mxMp+pXlJCsuvYeXXV9aMMEycoK/sSvhGts RxXyaL2G8yOBu3cvEn0Tu1il0Exfv1I/mHC5os5zZ/fF68wGpzZUM5H2DbJjExCzMa0/ fZB66Rej9Kg9QWtD7oC1iM12UAoTEj1a+H++7i295vwSgqwQAMqnIaWR9VMX80It0h/8 KhaQ== 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=1bOLkdT19YclZnPT6n2fCcYcZatIztYNhWXdqmD579o=; b=hGN2FnSrMinvCHFB4ZTHNtxO9aErnGzus+VLwSn3heiY5QL45jP0DQh/ZV+WwVAH3/ wz5DDz68Rx7cS3cEL0kkiCWtHFFyA/LYy/KtDV+4cdp3/uDSgW4TcXx11SJ5VEHiC3Og dGZQ5Q8K/goY8fgTENBNkGAcNq4GUVw/ppdW0gjTQ5+VMoBlI+IXXXoLNrP9iVT0XGJA Y9ETxRBoGK4VGlOD/U5xeK3CYHu6MULeBB1kB07BESYihMzJfczj+gP1LyOE+Gqqg6Pu Q2WrjmvKkUxaZbpCZ0etNudoCTSDDtxocquaC+m6HIW80JF1qxn7n6bl7u5yKvRY+TO+ AdnA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Ax7eEDoH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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-20020a170902e80400b0017a7506e0dcsi30442064plg.231.2022.10.22.00.53.44; Sat, 22 Oct 2022 00:53: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=Ax7eEDoH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S232004AbiJVHx3 (ORCPT + 99 others); Sat, 22 Oct 2022 03:53:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47412 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231822AbiJVHvL (ORCPT ); Sat, 22 Oct 2022 03:51: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 437EA5A3DC; Sat, 22 Oct 2022 00:46: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 4176CB82E21; Sat, 22 Oct 2022 07:45:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 96B74C433D6; Sat, 22 Oct 2022 07:45:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424711; bh=f8W3x/eNGh6+vFBt2F0UXR8CUiAaNf4piXlXCa3ZCGg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ax7eEDoH3RmtZ75ulbYn38dkEYd+Z5wi2kTSMmhKG4BPqySFRLSelm+7u5fl3j0ze tMkMEr94uYasKYdnnfCKrnO8SQFh6q0BbECu1rc+4++ZJWtuw/aYGCVxLODQXU+//0 Gt5XqaCz+0Cy/d/4a3c1ZSoBtL8lCrVv/XOLGmTc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, AngeloGioacchino Del Regno , Lorenzo Bianconi , Sean Wang , Felix Fietkau , Sasha Levin Subject: [PATCH 5.19 247/717] wifi: mt76: mt7921: add mt7921_mutex_acquire at mt7921_sta_set_decap_offload Date: Sat, 22 Oct 2022 09:22:06 +0200 Message-Id: <20221022072458.598094096@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747373510794161477?= X-GMAIL-MSGID: =?utf-8?q?1747373510794161477?= From: Sean Wang [ Upstream commit 59c20b91786d5f140ee7be2f24c242b5f8986046 ] Add mt7921_mutex_acquire at mt7921_[start, stop]_ap to fix the race with the context holding dev->muxtex and the driver might access the device in low power state. Fixes: 24299fc869f7 ("mt76: mt7921: enable rx header traslation offload") Tested-by: AngeloGioacchino Del Regno Acked-by: Lorenzo Bianconi Signed-off-by: Sean Wang Signed-off-by: Felix Fietkau Signed-off-by: Sasha Levin --- drivers/net/wireless/mediatek/mt76/mt7921/main.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/main.c b/drivers/net/wireless/mediatek/mt76/mt7921/main.c index 22c9793e4a40..0316d226e38d 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7921/main.c +++ b/drivers/net/wireless/mediatek/mt76/mt7921/main.c @@ -1390,6 +1390,8 @@ static void mt7921_sta_set_decap_offload(struct ieee80211_hw *hw, struct mt7921_sta *msta = (struct mt7921_sta *)sta->drv_priv; struct mt7921_dev *dev = mt7921_hw_dev(hw); + mt7921_mutex_acquire(dev); + if (enabled) set_bit(MT_WCID_FLAG_HDR_TRANS, &msta->wcid.flags); else @@ -1397,6 +1399,8 @@ static void mt7921_sta_set_decap_offload(struct ieee80211_hw *hw, mt76_connac_mcu_sta_update_hdr_trans(&dev->mt76, vif, &msta->wcid, MCU_UNI_CMD(STA_REC_UPDATE)); + + mt7921_mutex_release(dev); } #if IS_ENABLED(CONFIG_IPV6) From patchwork Sat Oct 22 07:22: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: 7276 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1092065wrr; Sat, 22 Oct 2022 00:52:51 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7c26HhFww9Qu/Ou+j/gKWx26ZGSlRGzyOEJyWNDSk+AqqmqYTkjL2BWtdHj0vyouLgtmYm X-Received: by 2002:a65:5ac8:0:b0:463:9c77:285a with SMTP id d8-20020a655ac8000000b004639c77285amr19433053pgt.517.1666425171215; Sat, 22 Oct 2022 00:52:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666425171; cv=none; d=google.com; s=arc-20160816; b=z7NpllMp9O+9RZWPWeFdEI8ufTZmB4fyBdVCHCqyBbThrk0rxI1K+mfaSacDZdK/Ta 354O687MRr55sT1r5VuTd+hIrxkcEF6XPwrCP8jhzNiYQ9K7GYFzQdDOYj0tu3sXTHUp 2ptkaDGhsBly/EW8pLZdVW3d9nvPDS59ezgB352OwhM0i/GNUbmMXIByimwJ7dVCw/8l UAmQyhkRkpi1c9vUwNzeoli1AwRd1PXvVHQ7d+Q4mG8po3pe4MsssEEVpuZKNj9NCLte J0ClS3EG/xbVXsJY0RgA4ld8huCfQuE55/Qtb+xvw0P6+gIk3lezauc02cJlRKnyAMmE 6eBQ== 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=REx2iPNeQTmjpf4qATudROU2qHClEHheNGCtNyS6AFw=; b=hGf70CHBu+ub+YOvWm1WKck3K4uedDAFj3AMjH5cxs8dzmdUlWoWUwDSLE/Utc1Qbq gkXSvX7GX7Q/a06FlTSM7agmf4pghAKmY+P8h6YCvjiTyqAE2o0gQJkRBNqeWBGYhG7I yqNauEyeCrDzVgI1n4YTtPw+cQxWqbzJ72AHRr9ckLHlGOExGsWoFDnS7IU23BNzq/fa 1w4cCmMUboUTeRNI7HDbPRxctjBqh5PJ4NTiUnH5V2j3EYvSqRBAqkRaoRcRN18ombnI 6i9x0oiKroDTHiebmFziUJphkCm9V0hMQj5CKcqCPkrztTuFJRiri0raoliZG0xsiC2F TZlw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="Nv/G7kYX"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 pv14-20020a17090b3c8e00b0020a774637a6si2077762pjb.67.2022.10.22.00.52.38; Sat, 22 Oct 2022 00:52: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="Nv/G7kYX"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231681AbiJVHwT (ORCPT + 99 others); Sat, 22 Oct 2022 03:52:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50278 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231912AbiJVHth (ORCPT ); Sat, 22 Oct 2022 03:49:37 -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 98F318A6ED; Sat, 22 Oct 2022 00:46: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 EC993B82E1F; Sat, 22 Oct 2022 07:45:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3D2D1C433C1; Sat, 22 Oct 2022 07:45:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424713; bh=U3Vw3D6HP5pNxYddemRgXmagrQL9/QTUYvo5batzupQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Nv/G7kYX6td22lczASPYB0cioo5OG5Jklu4AVc0szDAXH4IMXxuzXHIYHHokUl62F 3sg8jHnXZeDlm+4rfIXp7/v4ECPqJD1FLl4fh099Nu6gYao8jY4nvdZahr25e312k7 jn+UF+7EPxtFFefk0ibuYlFzLZ+c/cF2+5G1EufA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Howard Hsu , Felix Fietkau , Sasha Levin Subject: [PATCH 5.19 248/717] wifi: mt76: mt7915: fix mcs value in ht mode Date: Sat, 22 Oct 2022 09:22:07 +0200 Message-Id: <20221022072458.768674217@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747373440136033836?= X-GMAIL-MSGID: =?utf-8?q?1747373440136033836?= From: Howard Hsu [ Upstream commit c6d3e16ad4362502e804a6ca01e955612f3b8222 ] Fix the error that mcs will be reduced to a range of 0 to 7 in ht mode. Fixes: 70fd1333cd32 ("mt76: mt7915: rework .set_bitrate_mask() to support more options") Signed-off-by: Howard Hsu Signed-off-by: Felix Fietkau Signed-off-by: Sasha Levin --- drivers/net/wireless/mediatek/mt76/mt7915/mcu.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7915/mcu.c index 17fa2acc0d07..ec8a5083466f 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7915/mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt7915/mcu.c @@ -1460,7 +1460,7 @@ mt7915_mcu_add_rate_ctrl_fixed(struct mt7915_dev *dev, struct sta_phy phy = {}; int ret, nrates = 0; -#define __sta_phy_bitrate_mask_check(_mcs, _gi, _he) \ +#define __sta_phy_bitrate_mask_check(_mcs, _gi, _ht, _he) \ do { \ u8 i, gi = mask->control[band]._gi; \ gi = (_he) ? gi : gi == NL80211_TXRATE_FORCE_SGI; \ @@ -1473,15 +1473,17 @@ mt7915_mcu_add_rate_ctrl_fixed(struct mt7915_dev *dev, continue; \ nrates += hweight16(mask->control[band]._mcs[i]); \ phy.mcs = ffs(mask->control[band]._mcs[i]) - 1; \ + if (_ht) \ + phy.mcs += 8 * i; \ } \ } while (0) if (sta->deflink.he_cap.has_he) { - __sta_phy_bitrate_mask_check(he_mcs, he_gi, 1); + __sta_phy_bitrate_mask_check(he_mcs, he_gi, 0, 1); } else if (sta->deflink.vht_cap.vht_supported) { - __sta_phy_bitrate_mask_check(vht_mcs, gi, 0); + __sta_phy_bitrate_mask_check(vht_mcs, gi, 0, 0); } else if (sta->deflink.ht_cap.ht_supported) { - __sta_phy_bitrate_mask_check(ht_mcs, gi, 0); + __sta_phy_bitrate_mask_check(ht_mcs, gi, 1, 0); } else { nrates = hweight32(mask->control[band].legacy); phy.mcs = ffs(mask->control[band].legacy) - 1; From patchwork Sat Oct 22 07:22: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: 7328 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1093887wrr; Sat, 22 Oct 2022 00:58:44 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5RZfhEqjCkUcjwN17C+tGTQIGedFU2gU5RzT1kNUIBMd3fCgMVLLA1RAWso3PkhlqUoH2E X-Received: by 2002:a17:903:2c2:b0:182:df88:e6d3 with SMTP id s2-20020a17090302c200b00182df88e6d3mr23145972plk.81.1666425524638; Sat, 22 Oct 2022 00:58:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666425524; cv=none; d=google.com; s=arc-20160816; b=JUyjFZkjwBuHQGg0Loxd6oXDdsUITThwyGk/zOVv4q+jbFC5xCHDJaIabQ5h5h1jQu dUIauG7IpO/fNX49R7wG2pwx4MVau+hFCr2iJ/MXoicq3lyvR5sRLXukVJRMPx56hYeP BaT4CjWsTMpeeqDIsZczIqesvNFvm/UNiaPJUF1Tx2bmuErqFXkCHncWjLWHb1rBI2Ii mliGYYzkbDGL0xyiH3pleRV/bm0HUV4BijppzufNBQA3dFndcthrEtrJePYUWIvBpkh/ sRvBszK9ZmPGGuvhGlVqCerjeQILgCUnarJ4w5rRYaj3dbdRuKoNBnFK20U8Mg/c/1jl qENA== 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=9OkU7jflebU7ac1SOB6VUMqY0HxBV2bUBpUPRMJ7S+c=; b=smgbY+JuRbp/9BbMQyrEZiPkvSZREOSnvfxn0Y9mQhi/3ipzeRa1UOL5URi7n1jRrO ymBrJZHoKn1ajBdBl9hLeRcRctIBwfh2sjTFb32Fup+PGS4zRdQKpB2ofTXR5L/82cYD l5bQSECmFapIauVEOUbnLz2ErWZVaQzcwbVJfSFnWZqjlebihn26VUNl3yUBOvZSXX/a d8Sv+otaccu2T7Lw9ply6gNtKAWe13myUG2Z85G6ydGLgg/Dh7tpR4F/ZDu7nATa6ooi jjJY0EQZvl2aUtge8TxhdptCacjbPYojzW/phDWigHpGNO9ps/xoMG6ar1gH8K7FKteV kHDA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=PYlEwSdF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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-20020a635917000000b0045f0757ead9si29498051pgb.727.2022.10.22.00.58.32; Sat, 22 Oct 2022 00:58: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=PYlEwSdF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S232227AbiJVH6F (ORCPT + 99 others); Sat, 22 Oct 2022 03:58:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42734 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231847AbiJVHxt (ORCPT ); Sat, 22 Oct 2022 03:53:49 -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 065CA29B8A4; Sat, 22 Oct 2022 00:46:56 -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 DFF1C60BB9; Sat, 22 Oct 2022 07:45:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F40DBC433D6; Sat, 22 Oct 2022 07:45:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424716; bh=tIBsBLLuzY+hkWm+XuxHlNQ6uSDfN7fZPVjIX6Wp4vk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PYlEwSdFGbUMqTGAZufY+87fuA3b8XGCo0NJH/rd68EDQmOugrQtgjJF5enkmvBeo ovskoGHRdviYlu0ir8lNUzn7LTRheuOhSYhveaHP3tcGirN6mbinnSGKMwADkyMtj9 8dmzIAWkjQH1nYFQOFBFzHwNry3996lubT2axyXI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Howard Hsu , Felix Fietkau , Sasha Levin Subject: [PATCH 5.19 249/717] wifi: mt76: mt7915: do not check state before configuring implicit beamform Date: Sat, 22 Oct 2022 09:22:08 +0200 Message-Id: <20221022072458.937520590@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747373811017756365?= X-GMAIL-MSGID: =?utf-8?q?1747373811017756365?= From: Howard Hsu [ Upstream commit d2b5bb6dfab29fe32bedefaade88dcd182c03a00 ] Do not need to check running state before configuring implicit Tx beamform. It is okay to configure implicit Tx beamform in run time. Noted that the existing connected stations will be applied for new configuration only if they reconnected to the interface. Fixes: 6d6dc980e07d ("mt76: mt7915: add implicit Tx beamforming support") Signed-off-by: Howard Hsu Signed-off-by: Felix Fietkau Signed-off-by: Sasha Levin --- drivers/net/wireless/mediatek/mt76/mt7915/debugfs.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/debugfs.c b/drivers/net/wireless/mediatek/mt76/mt7915/debugfs.c index fd76db8f5269..6ef3431cad64 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7915/debugfs.c +++ b/drivers/net/wireless/mediatek/mt76/mt7915/debugfs.c @@ -23,9 +23,9 @@ mt7915_implicit_txbf_set(void *data, u64 val) { struct mt7915_dev *dev = data; - if (test_bit(MT76_STATE_RUNNING, &dev->mphy.state)) - return -EBUSY; - + /* The existing connected stations shall reconnect to apply + * new implicit txbf configuration. + */ dev->ibf = !!val; return mt7915_mcu_set_txbf(dev, MT_BF_TYPE_UPDATE); From patchwork Sat Oct 22 07:22: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: 7804 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1136307wrr; Sat, 22 Oct 2022 03:12:06 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4r0kfyP56HaHg1gWtw8TcwaEa2kvbeGJm0bXWEUMjXE5JDFEbp3fFS8gX/JsLG5mKlpJNY X-Received: by 2002:a63:4e16:0:b0:43f:3554:ff9c with SMTP id c22-20020a634e16000000b0043f3554ff9cmr20431119pgb.578.1666433525913; Sat, 22 Oct 2022 03:12:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666433525; cv=none; d=google.com; s=arc-20160816; b=pa7+mJ23Gcil+r+1bLw+QdsGlQwq55ya8SQAQyH4TljPn5QgBw0t0UW20J8HhSNpi7 ZqUo11RrqVnBe7Clwir7WNDzbgih7AxTT2NrecjdGHS1aYvSgMv50Mg3F8qKYuNXeD5Y t6NFrh/p/S6KdzySp97yRA98AolaAvCchphKHhTUq5U89fN+tubaNsx5mgCQNCDnuUV4 ybd+9H/DsPtXgHRfuMNbq3co0sPeFA16B2K1eY/1c3/t7Of79KL07f1vgzya0/bKbqPK OUaF+l5hfB77SqAGSCKHZZM8NsM/h2MUd9rdL53UzENbAqApRjXggMFlqcFvUbb3sQJE FwgQ== 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=3Ir2cuapATUltk5I6q9ZH2mYH42mk8zBEnyEpORZk3M=; b=gd8WSJ0ibghK0d7yS54+GqODbNM6/1p0fSn1yuAyFpuLRXplUzoXzIM7Yw1UxIloxf zLRCepjAq9glMWR41zC9B4s2MtXFHAG0YRxe8KhfhbUvTU12XdQjkR3qR22gavm2oyL0 Vq0d5pGjdEz/3V2LrdmJNPUsgxQM7JEmzPna6Xbi6veqJ5c7jDArwMhxndFFmbOJTwOc I6ngq0uzQRv8JVe6p+HjvBFRBszC9oTPNZjJZLMbmbQVr1n0azdoncFFqN2GnY6YEtIP WC/sP5mwALY8n0EsG0UBq3gLKcJvxPbUiN+uPksZaKh7czjyAdahy+KlAqJfYOeZexFz 4sHQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=AtRqtR+f; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 cp8-20020a056a00348800b0053dd073fc8dsi24731868pfb.175.2022.10.22.03.11.52; Sat, 22 Oct 2022 03:12: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=AtRqtR+f; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S230138AbiJVKK7 (ORCPT + 99 others); Sat, 22 Oct 2022 06:10:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58386 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230190AbiJVKKj (ORCPT ); Sat, 22 Oct 2022 06:10: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 6BAA530F9DB; Sat, 22 Oct 2022 02:27: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 34D06B82E24; Sat, 22 Oct 2022 07:45:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9B31AC433C1; Sat, 22 Oct 2022 07:45:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424719; bh=Vozqve6uz0M1YkzgDdcf8XEiQm+jmQXPx46GgpjETVE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AtRqtR+f9jN3C1CFjU5BJFgyqBKq0PhnvIvrAjSagNaMPUiFTyg6iOPnOPJylrfaL iW7W1IbXsMU+qH+XCpZ1mfKgiqlypaDSz8cf8unxiJtfUUt+UtyjJRQFntyiB6IqbV 1C8Bwp23hOj5DZAY7/rqmNEei+G4tBbAwyT78RD8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Deren Wu , Felix Fietkau , Sasha Levin Subject: [PATCH 5.19 250/717] wifi: mt76: mt7921e: fix rmmod crash in driver reload test Date: Sat, 22 Oct 2022 09:22:09 +0200 Message-Id: <20221022072459.104520548@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 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?1747382201222868749?= X-GMAIL-MSGID: =?utf-8?q?1747382201222868749?= From: Deren Wu [ Upstream commit b5a62d612b7baf6e09884e4de94decb6391d6a9d ] In insmod/rmmod stress test, the following crash dump shows up immediately. The problem is caused by missing mt76_dev in mt7921_pci_remove(). We should make sure the drvdata is ready before probe() finished. [168.862789] ================================================================== [168.862797] BUG: KASAN: user-memory-access in try_to_grab_pending+0x59/0x480 [168.862805] Write of size 8 at addr 0000000000006df0 by task rmmod/5361 [168.862812] CPU: 7 PID: 5361 Comm: rmmod Tainted: G OE 5.19.0-rc6 #1 [168.862816] Hardware name: Intel(R) Client Systems NUC8i7BEH/NUC8BEB, 05/04/2020 [168.862820] Call Trace: [168.862822] [168.862825] dump_stack_lvl+0x49/0x63 [168.862832] print_report.cold+0x493/0x6b7 [168.862845] kasan_report+0xa7/0x120 [168.862857] kasan_check_range+0x163/0x200 [168.862861] __kasan_check_write+0x14/0x20 [168.862866] try_to_grab_pending+0x59/0x480 [168.862870] __cancel_work_timer+0xbb/0x340 [168.862898] cancel_work_sync+0x10/0x20 [168.862902] mt7921_pci_remove+0x61/0x1c0 [mt7921e] [168.862909] pci_device_remove+0xa3/0x1d0 [168.862914] device_remove+0xc4/0x170 [168.862920] device_release_driver_internal+0x163/0x300 [168.862925] driver_detach+0xc7/0x1a0 [168.862930] bus_remove_driver+0xeb/0x2d0 [168.862935] driver_unregister+0x71/0xb0 [168.862939] pci_unregister_driver+0x30/0x230 [168.862944] mt7921_pci_driver_exit+0x10/0x1b [mt7921e] [168.862949] __x64_sys_delete_module+0x2f9/0x4b0 [168.862968] do_syscall_64+0x38/0x90 [168.862973] entry_SYSCALL_64_after_hwframe+0x63/0xcd Test steps: 1. insmode 2. do not ifup 3. rmmod quickly (within 1 second) Fixes: 1c71e03afe4b ("mt76: mt7921: move mt7921_init_hw in a dedicated work") Signed-off-by: Deren Wu Signed-off-by: Felix Fietkau Signed-off-by: Sasha Levin --- drivers/net/wireless/mediatek/mt76/mt7921/pci.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/pci.c b/drivers/net/wireless/mediatek/mt76/mt7921/pci.c index 295c21586273..d8347b33641e 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7921/pci.c +++ b/drivers/net/wireless/mediatek/mt76/mt7921/pci.c @@ -289,6 +289,8 @@ static int mt7921_pci_probe(struct pci_dev *pdev, goto err_free_pci_vec; } + pci_set_drvdata(pdev, mdev); + dev = container_of(mdev, struct mt7921_dev, mt76); dev->hif_ops = &mt7921_pcie_ops; From patchwork Sat Oct 22 07:22: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: 7285 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1092268wrr; Sat, 22 Oct 2022 00:53:35 -0700 (PDT) X-Google-Smtp-Source: AMsMyM67zHwiQ3N1Q1MdIEumfoqBvobchRahgVKBshs9okAXEbP6qxxH/1Unm3sPztJBj6QC1WVa X-Received: by 2002:a17:902:ed4d:b0:183:ee9e:5578 with SMTP id y13-20020a170902ed4d00b00183ee9e5578mr22815139plb.23.1666425215677; Sat, 22 Oct 2022 00:53:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666425215; cv=none; d=google.com; s=arc-20160816; b=UWbaJOP/YRRPJljQd/QWw1oqDy02GrEaYeKlXqRq2c81DTCOet9+rGxP+NnBgb5ot2 XZ2lxuboYPp+mNaRXl3VbTGt9NTb87OnLqcy6HvSXzRI6jENSrS8Pa6dRxVe6nmndVd3 q21kRygQw854qNNxeyORdYVicAagkMl+aGNCs8/5+EjKWo9P+ztNLphfcbi3EvE59AET 1f/u7b9pZo3AMMYZy/0haF3tv8WIJ4aaKvqgMlzaILqV+zwXLVYMDicIGnWM8aHXllR1 7uIVzttvedj7H72i+YhsuoQhacaWq7BVnMyJs6mHoPh4qW0gBf2Ym0VtYtFKRwnmhJml yo+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=JpdVq4gNkwurGSmqYH9Aof38YZcYgwm7+YigtH/JSMI=; b=fRz//DyYnkedc3X18SNUjac3LC+Ak7H1gMyUnUOoeZWsdaWO0nnTZ+bOXHqMKCU1qy 2gIVpl0xp0NeOZ+8Vi4cvVA8E1yyZu1V4v3BqCAfb+p0SiMsbis3ef7Lhtbf8v+/qeh1 ammKwtI7sPm5H5vxrMuuvnp/j9RHFEacaU5tiNNxwVwRGkx0oor7WCAs+npJ1F/z00dE v4V+q3N+k5e07unmvJrKLEgkRvOfRH70FiOUDy3RQDaWMMeh8LK8AdSRi++q2ZVGWD4c XA6qh2xUZTxaadKRg+et91exU9cktYhSHeGGmqvQer4cnnmC0ErjFxsaSKvf2K2oBWbw SUPA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=gjj5a3sp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 y28-20020a63495c000000b0045a73a1790asi28276265pgk.613.2022.10.22.00.53.23; Sat, 22 Oct 2022 00:53: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=gjj5a3sp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231944AbiJVHxG (ORCPT + 99 others); Sat, 22 Oct 2022 03:53:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58640 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231667AbiJVHuO (ORCPT ); Sat, 22 Oct 2022 03:50:14 -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 283C02C2AD0; Sat, 22 Oct 2022 00:46:22 -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 D178FB82E18; Sat, 22 Oct 2022 07:45:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4028BC433D6; Sat, 22 Oct 2022 07:45:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424721; bh=C6CwbD+x4Djmkf1hfONC+CIP9Mm3gn2aJ3WQUw0pJs4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gjj5a3spyEsV/HXUtOe6l7DGX96lk2QvSf7B7wCR/KR1csSaIMaK5LuHGHzkAVfJ1 gGp0S4qNpyPtXD9ermSl459OvJfI10KuSA50gKx1h2Pclbpm8MOkrBaVmrE5QgnYoY p4FceeT6sU5o0AQKbStqmbiHfvLcL9ZgcLYZXOi8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Luiz Augusto von Dentz , Sasha Levin Subject: [PATCH 5.19 251/717] Bluetooth: RFCOMM: Fix possible deadlock on socket shutdown/release Date: Sat, 22 Oct 2022 09:22:10 +0200 Message-Id: <20221022072459.267678236@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747373487231864433?= X-GMAIL-MSGID: =?utf-8?q?1747373487231864433?= From: Luiz Augusto von Dentz [ Upstream commit 812e92b824c1db16c9519f8624d48a9901a0d38f ] Due to change to switch to use lock_sock inside rfcomm_sk_state_change the socket shutdown/release procedure can cause a deadlock: rfcomm_sock_shutdown(): lock_sock(); __rfcomm_sock_close(): rfcomm_dlc_close(): __rfcomm_dlc_close(): rfcomm_dlc_lock(); rfcomm_sk_state_change(): lock_sock(); To fix this when the call __rfcomm_sock_close is now done without holding the lock_sock since rfcomm_dlc_lock exists to protect the dlc data there is no need to use lock_sock in that code path. Link: https://lore.kernel.org/all/CAD+dNTsbuU4w+Y_P7o+VEN7BYCAbZuwZx2+tH+OTzCdcZF82YA@mail.gmail.com/ Fixes: b7ce436a5d79 ("Bluetooth: switch to lock_sock in RFCOMM") Signed-off-by: Luiz Augusto von Dentz Signed-off-by: Sasha Levin --- net/bluetooth/rfcomm/sock.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/net/bluetooth/rfcomm/sock.c b/net/bluetooth/rfcomm/sock.c index 4bf4ea6cbb5e..21e24da4847f 100644 --- a/net/bluetooth/rfcomm/sock.c +++ b/net/bluetooth/rfcomm/sock.c @@ -902,7 +902,10 @@ static int rfcomm_sock_shutdown(struct socket *sock, int how) lock_sock(sk); if (!sk->sk_shutdown) { sk->sk_shutdown = SHUTDOWN_MASK; + + release_sock(sk); __rfcomm_sock_close(sk); + lock_sock(sk); if (sock_flag(sk, SOCK_LINGER) && sk->sk_lingertime && !(current->flags & PF_EXITING)) From patchwork Sat Oct 22 07:22: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: 7320 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1093597wrr; Sat, 22 Oct 2022 00:57:47 -0700 (PDT) X-Google-Smtp-Source: AMsMyM67oRpq+juiWXTR5OKk+dG3WaIN+Wzi3b2HL6cRHtZV/M5YMzdLLW3qLDc3Iwa4wPEe321H X-Received: by 2002:a62:b501:0:b0:557:d887:20ee with SMTP id y1-20020a62b501000000b00557d88720eemr23231822pfe.8.1666425467178; Sat, 22 Oct 2022 00:57:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666425467; cv=none; d=google.com; s=arc-20160816; b=BiglWv/2HbxU+871r2/juMkyuupBeLkS/q1nHfum4FZpCXlSHap4Xy4j6osSGYKnsv YxPIY4xjzbmoYxjpEgDWtOWhfsSIk7dzrwyFtlyMTM7IZyNRk9IW9rZ1qn0UESQXdu8v X32Dy9ndEI/oniubqxKVt1RrWY1eLm4lr5C+zP6atDqGVDhbC/JK8D7ypWqqdzdi/ee0 Ljj/lGYNNia6VFwL5cUPY22SC4b/sNoWFZKVFwm/I7af5hDtC0u3jylbwZ528hXcBN7n Zfq2KCev+qJ12LgVoHPKBgEJJSv3NygZuV2N0ay5eDXFTTIGucCIhzRpjsojpEM1WRIE d6hw== 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=LMUHfsEU4k3wAkLBg+Vw5V899iFkD4jcMpKug11/YoNEylaD2IoNXU4MFdWgJL8m5T tedju5MD+lrncb/8p3VLkFJBsiaLBBJkEmu1YsrhedsLBvwHm4DU8QpLPK+jINHzxPh3 ujDXp5TNBna88Y22zAL95kWzkDMXqLvycBP0XFOjRy5kxy7vwMYSQVenL0CHvlqfRGxY xosPJcXwq8SJcEcaGuSbJNWtIU3p7Mntc4bap0M0lOZpjypHTrHfpnfiQHAgslHtrqNY hpKPJwh3LjW0e2A1oEh7Z5ZmIkjFa/OZQcUKsETESyxL5kE/rj319F1elwhvXpUBticF 6QUA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="K4F/V7lg"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 w8-20020a170902e88800b00182c500d973si33162428plg.43.2022.10.22.00.57.34; Sat, 22 Oct 2022 00:57: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="K4F/V7lg"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S232158AbiJVH5S (ORCPT + 99 others); Sat, 22 Oct 2022 03:57:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58264 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232000AbiJVHx0 (ORCPT ); Sat, 22 Oct 2022 03:53:26 -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 63DA72C6E8C; Sat, 22 Oct 2022 00:46: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 DC97660B24; Sat, 22 Oct 2022 07:45:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id ECF70C433D7; Sat, 22 Oct 2022 07:45:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424724; bh=deb/+f+bTm4Ytyvf8OL7N3yZQGGpLOBi7QxH7ZECr8U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=K4F/V7lgRYEAH5kIErjgu5qocCivSxvlP0EDYwzIZqrTdxzcJa+IGjMJtK7V8iPwb tztANwH7tbwqUaay/f0D8bINQ0oWOzeO0GuHbfZOIS4bh7sEv4Mt3p3PZi7y8f/Fg+ k2fvi3l26NIQ8XDCYmgxW0o+exNCW3Y1eDXA0MyI= 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 5.19 252/717] net: fs_enet: Fix wrong check in do_pd_setup Date: Sat, 22 Oct 2022 09:22:11 +0200 Message-Id: <20221022072459.454387212@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747373750865192917?= X-GMAIL-MSGID: =?utf-8?q?1747373750865192917?= 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 Sat Oct 22 07:22: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: 7312 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1093430wrr; Sat, 22 Oct 2022 00:57:14 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5dFJesW3q032gYCVWG2o12J3RhlGxHA3JCg0MJH7/LweQWoedO37XqycfOPd2Nuc3s8DCD X-Received: by 2002:a63:5761:0:b0:43c:5940:9176 with SMTP id h33-20020a635761000000b0043c59409176mr19351043pgm.65.1666425433856; Sat, 22 Oct 2022 00:57:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666425433; cv=none; d=google.com; s=arc-20160816; b=yZFlB+Ob5Ud0yrdjXBlImohE2t1BFbvykHm0aoSr3t7cgRJVNi5VKo28jIU2bCOKoO spKvizsJfXYGFtxpG3bIoXtsPON/S50EVA3x+K608szgH3B2M8UKzA448tnvvF6uor4u s3uLnPB231oCj1vFvW0gSS5eaV70ne5l1636b6biU48CdHW3How6Er96t/04wB+7ruQF PaJQ2ozXU5XWZKLsum2hZa7TmxcbgtagqTdryFzRWKzgMKIZvNXIGPiC6V91Ldatd0Ct 1qkX0n1HuGuWnMCZCA6X9jtAAShqh9nPh+Ce6LVwKVJFEdt5e272P7bAbDhdRgkkxjmM va5Q== 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=Yz4Bd+NSZmKkn1Ll22znpWa7yzAkQdmD+xL2GFyPjoQ=; b=ivKmthCsS/RzgiNoh9iznyOanF+ImSamPnfoPiQvI4LCyVWpRKDtvmKr6O1dvgdo63 X8RtFJzrzZh/8PlxpZ2PO4dk82fUBtB6bM1spdHJy2dzZRklkIOoQ66ainmjZNB77u/w +ZJJ0WXfe4yOEik72K1ph+SsXCjmF/PHYcF29t+t9grwK5VBqdSrVIEBJSZNyMcVDF3B 2QoZQaD+Ccg5cOaqkTLXtoAyFHTE0d7F1dpRPP7HWL1RT1P2W5xUSFEsOTD7Y3EDAZ69 HeasaykLoT51nSzzLbORo+6JMZtxCT4u/HkfTo1EPt4hvp4gCbs7ug/n1tfmjDsEeWn/ N32w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=SAkJz2rF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 il11-20020a17090b164b00b001fb3040753fsi10730389pjb.64.2022.10.22.00.57.01; Sat, 22 Oct 2022 00:57: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=SAkJz2rF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S232161AbiJVH4o (ORCPT + 99 others); Sat, 22 Oct 2022 03:56:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42802 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231873AbiJVHwv (ORCPT ); Sat, 22 Oct 2022 03:52: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 068042CA7D1; Sat, 22 Oct 2022 00:46: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 dfw.source.kernel.org (Postfix) with ESMTPS id 7BC0460B1B; Sat, 22 Oct 2022 07:45:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9334DC433D6; Sat, 22 Oct 2022 07:45:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424726; bh=HiG51sHsMxzHVedBNQE+5UlO3SgRy+hGjnxhkYctKZw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SAkJz2rF0MLx3D+TcCVHce3fpLksAVq04ESX+07XTU8zGonEa3zblzQ7RLaYlo8S8 QiiHRycYFPadX5KPDAS1DKza27bo4SWRSb0ErLH7WttiYin+ZnV59GdJmajtUgOJS8 hrEl/5unbHY1OffR7tF27lKgcuOSEzlLOoOM+/AI= 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 5.19 253/717] bpf: Ensure correct locking around vulnerable function find_vpid() Date: Sat, 22 Oct 2022 09:22:12 +0200 Message-Id: <20221022072459.614445182@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747373715655510359?= X-GMAIL-MSGID: =?utf-8?q?1747373715655510359?= 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 7a3444988c84..494ba88054e8 100644 --- a/kernel/bpf/syscall.c +++ b/kernel/bpf/syscall.c @@ -4361,7 +4361,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 Sat Oct 22 07:22: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: 7839 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1153125wrr; Sat, 22 Oct 2022 04:04:49 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6ZKoxilTYi3dgYkFv/KIgAuCAcIv/ibOK37yk1mYVQi6wK7XjBaA/v1DIOH4FDujEOFAuY X-Received: by 2002:a05:6402:50cd:b0:45d:109d:676c with SMTP id h13-20020a05640250cd00b0045d109d676cmr22565777edb.344.1666436689589; Sat, 22 Oct 2022 04:04:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666436689; cv=none; d=google.com; s=arc-20160816; b=bevFGuV2+98UHxVynhpnajoLLhgJ9VJihWa72ivnDCXGOxkBO1ywc23ETFBKEP3G3W bbLwURQOJAFknk0StIYcepZP0lbW/5KLj+MuX4ILb3xvT+uEEJCPBvErlBFWXXPD0Xtz F+2fBEaz3ld9yBQzWqVxP9Go9vfCj4f688fBR9cGTivNv7h030c4qFfejqgLg8NXIvlO V2xw70w/J8wQPHlhuD86yRTbuzrpqTTnxABqgVviADQ22KAgFGm3iFbdEsogS/TBnLfa B+5RcGsrBRc8ZCVC6F/cPYDecQIYyEqDUVEgXLOSIgot5Hf8r+OFF8M3X42WMAxIB3Da MqQw== 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=hcagcCn4MD1kzAhQNzeOIdT0IoPDF4T9ob3acs7B3HA=; b=vpv04shh30R45IYdmWPvDVbePznd1lvILQGizpXZz+ZUO2rtpqLB0Tf9QNuCxu8Nup I88wlv2/lWEXFBHE9vI/seewicpeicmq2C/8AdWVR3o0fhlU/gE4BhnHd0uh7yxsMjHi 5dNrnEcO1XA8K0MhEe4QWtjU4MVIahQIF60TL7Eo9kf8EN4NVtNBc3kosnxwVyqdB+yD K6dLNJHc9shbKOC7ZypMPaVCeExKHWNdZMo4XWHOzCpzm2kJB2x6Q2ztcZJZyILE0hpW nUNqhQtEAqzf2nuzXwwID8xSqyfKiU5xOuZ3D0v8VEr+4Vy9a2OKGPduXo3SdAHGivNv zujg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=h7gp7Ncm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 nb36-20020a1709071ca400b0078cba073ec3si24365527ejc.734.2022.10.22.04.04.12; Sat, 22 Oct 2022 04:04: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=h7gp7Ncm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S230115AbiJVK6G (ORCPT + 99 others); Sat, 22 Oct 2022 06:58:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46418 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230094AbiJVK5r (ORCPT ); Sat, 22 Oct 2022 06:57: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 E4659318128; Sat, 22 Oct 2022 03:16: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 BA355B82E27; Sat, 22 Oct 2022 07:45:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 308FDC433D6; Sat, 22 Oct 2022 07:45:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424729; bh=mJCJOvl0y7LTRwf4p585S532bpIt8sAVDqmZaOPVe8A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=h7gp7NcmuDFLG0+FS6e/15VGejReTNFc5klEbiz49of73AEHRt+Lz7TPmuyXMSF7j jL5XPLEppyo5VNu0s0tRyANOqxyY80owZe+niZaFGn32/OlK9KD//9EMTUXjwMlhjj 06R7xBVjSFQkDhDFXOgDSc4u5gs1n7yZ3BQGK4wA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Baochen Qiang , Kalle Valo , Sasha Levin Subject: [PATCH 5.19 254/717] wifi: ath11k: Include STA_KEEPALIVE_ARP_RESPONSE TLV header by default Date: Sat, 22 Oct 2022 09:22:13 +0200 Message-Id: <20221022072459.744282162@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 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?1747385518203088013?= X-GMAIL-MSGID: =?utf-8?q?1747385518203088013?= From: Baochen Qiang [ Upstream commit b7b6f86149a7e06269d61a7a5206360f5b642f80 ] In current code STA_KEEPALIVE_ARP_RESPONSE TLV header is included only when ARP method is used, this causes firmware always to crash when wowlan is enabled because firmware needs it to be present no matter ARP method is used or not. Fix this issue by including STA_KEEPALIVE_ARP_RESPONSE TLV header by default. Also fix below typo: s/WMI_TAG_STA_KEEPALVE_ARP_RESPONSE/WMI_TAG_STA_KEEPALIVE_ARP_RESPONSE/ Tested-on: WCN6855 hw2.0 PCI WLAN.HSP.1.1-03125-QCAHSPSWPL_V1_V2_SILICONZ_LITE-3 Fixes: 0f84a156aa3b ("ath11k: Handle keepalive during WoWLAN suspend and resume") Signed-off-by: Baochen Qiang Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/20220913044358.2037-1-quic_bqiang@quicinc.com Signed-off-by: Sasha Levin --- drivers/net/wireless/ath/ath11k/wmi.c | 9 +++++---- drivers/net/wireless/ath/ath11k/wmi.h | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/net/wireless/ath/ath11k/wmi.c b/drivers/net/wireless/ath/ath11k/wmi.c index cc84bd53ddae..1c8aa503e614 100644 --- a/drivers/net/wireless/ath/ath11k/wmi.c +++ b/drivers/net/wireless/ath/ath11k/wmi.c @@ -9003,12 +9003,13 @@ int ath11k_wmi_sta_keepalive(struct ath11k *ar, cmd->interval = arg->interval; cmd->method = arg->method; + arp = (struct wmi_sta_keepalive_arp_resp *)(cmd + 1); + arp->tlv_header = FIELD_PREP(WMI_TLV_TAG, + WMI_TAG_STA_KEEPALIVE_ARP_RESPONSE) | + FIELD_PREP(WMI_TLV_LEN, sizeof(*arp) - TLV_HDR_SIZE); + if (arg->method == WMI_STA_KEEPALIVE_METHOD_UNSOLICITED_ARP_RESPONSE || arg->method == WMI_STA_KEEPALIVE_METHOD_GRATUITOUS_ARP_REQUEST) { - arp = (struct wmi_sta_keepalive_arp_resp *)(cmd + 1); - arp->tlv_header = FIELD_PREP(WMI_TLV_TAG, - WMI_TAG_STA_KEEPALVE_ARP_RESPONSE) | - FIELD_PREP(WMI_TLV_LEN, sizeof(*arp) - TLV_HDR_SIZE); arp->src_ip4_addr = arg->src_ip4_addr; arp->dest_ip4_addr = arg->dest_ip4_addr; ether_addr_copy(arp->dest_mac_addr.addr, arg->dest_mac_addr); diff --git a/drivers/net/wireless/ath/ath11k/wmi.h b/drivers/net/wireless/ath/ath11k/wmi.h index b1fad4707dc6..ca3b9a384d60 100644 --- a/drivers/net/wireless/ath/ath11k/wmi.h +++ b/drivers/net/wireless/ath/ath11k/wmi.h @@ -1214,7 +1214,7 @@ enum wmi_tlv_tag { WMI_TAG_NS_OFFLOAD_TUPLE, WMI_TAG_FTM_INTG_CMD, WMI_TAG_STA_KEEPALIVE_CMD, - WMI_TAG_STA_KEEPALVE_ARP_RESPONSE, + WMI_TAG_STA_KEEPALIVE_ARP_RESPONSE, WMI_TAG_P2P_SET_VENDOR_IE_DATA_CMD, WMI_TAG_AP_PS_PEER_CMD, WMI_TAG_PEER_RATE_RETRY_SCHED_CMD, From patchwork Sat Oct 22 07:22: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: 7300 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1093112wrr; Sat, 22 Oct 2022 00:56:04 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4MF5tXO6YD6V/BM4/LM0GYqeM20x1hrmQylPrzzf3vJeAwoTHiFn3g013FS79ZaHb5KpbG X-Received: by 2002:a63:4845:0:b0:460:1693:acff with SMTP id x5-20020a634845000000b004601693acffmr19825071pgk.538.1666425363936; Sat, 22 Oct 2022 00:56:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666425363; cv=none; d=google.com; s=arc-20160816; b=o/FhskajfDKdJuuLO51+D/l3c7Qyc0bpwcXlNkWkc/QmRxDenBdDmRcn19jOIeeb0X uIHduNCLm+awGMpU8dQH33c0avwvAfDI2TpBOvQBZLHMwiBn4fUK/6/brGXNKC8fyDhY IDZVL6rXJwkff9diB1WQvNkUXjOoOGm7Q9Qc6XrW9oI5tjm+OEjzHNwBO9/sNLJgrEN+ zBpF0ukQIMFFLT+ZHxMGtjptnBP1pvTl8af1h32uX4SMo9nd1bchEUuzWVN9gl7Ub1w5 lptikDNhpZmEYqsb+7vvPgFJ+I+vdlVa+/CMzNkDtMAcZtzQ9AilluFoNB2ciXPDVVo/ z+7A== 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=iDZxBpHEMuWW/IHcoGPFen8vKYrYIQgt1kpP0dt7gdk=; b=jBmgXJ8K6yp4MDAR/Vz9g/VdIsz9YpXr3oeS/n3LXZoBqKbLe1NE714/1o7vaRILQj 91QT5Lia04TuT5y05ffkAqNmOMUWgWsSBIBRKqUQl7FtwfgIp57VIrjSWk38kVmXjJBL e5of/Hr/YFSXvzUCzS85lMG7xVdffbxNl7siYZrOzuR0ROFivCX3WlIGyXejUnOFhhH7 BadMVVxzQd6JS5oqqEbIoVr8FpC29GZv33njOCyp2d37J4rJIllFnOmg0TEGg2s4O8Wn 0dmaGD1tQqhcneTquaOZphDZ7+DM8GFD3spqm65j8ERA1p2CWPX/CEuy3oFyRtp9bQWX n6fw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=emN9mDtV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 c17-20020a170902d49100b001784b572d3csi4232216plg.525.2022.10.22.00.55.51; Sat, 22 Oct 2022 00:56: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=emN9mDtV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S232048AbiJVHzi (ORCPT + 99 others); Sat, 22 Oct 2022 03:55:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54860 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231791AbiJVHwG (ORCPT ); Sat, 22 Oct 2022 03:52: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 3B7042C2AFF; Sat, 22 Oct 2022 00:46: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 771D8B82E28; Sat, 22 Oct 2022 07:45:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CB40AC433D6; Sat, 22 Oct 2022 07:45:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424732; bh=7h9aWcGCfgx2rKr3+DGUU7gZV0M1EwXuVeR7W2iK1KQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=emN9mDtVj3IS3r3i+RJpZWPV2zYr0HZ/H+goF+IBZBeXCewcrB44B2/Yr+0T+W5ts h+xRP4tBteUOAnT/nByRJOk3sMHwVIlEVFHbjOZYgTOjpFY6f1jyj8l+uliccET884 K98NqwEXlx1pI5bO4cVoJyRI1YTc6JptJ2aRswTs= 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 5.19 255/717] Bluetooth: hci_{ldisc,serdev}: check percpu_init_rwsem() failure Date: Sat, 22 Oct 2022 09:22:14 +0200 Message-Id: <20221022072459.894957866@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747373642265090120?= X-GMAIL-MSGID: =?utf-8?q?1747373642265090120?= From: Tetsuo Handa [ Upstream commit 3124d320c22f3f4388d9ac5c8f37eaad0cefd6b1 ] syzbot is reporting NULL pointer dereference at hci_uart_tty_close() [1], for rcu_sync_enter() is called without rcu_sync_init() due to hci_uart_tty_open() ignoring percpu_init_rwsem() failure. While we are at it, fix that hci_uart_register_device() ignores percpu_init_rwsem() failure and hci_uart_unregister_device() does not call percpu_free_rwsem(). Link: https://syzkaller.appspot.com/bug?extid=576dfca25381fb6fbc5f [1] Reported-by: syzbot Signed-off-by: Tetsuo Handa Fixes: 67d2f8781b9f00d1 ("Bluetooth: hci_ldisc: Allow sleeping while proto locks are held.") Fixes: d73e172816652772 ("Bluetooth: hci_serdev: Init hci_uart proto_lock to avoid oops") Signed-off-by: Luiz Augusto von Dentz Signed-off-by: Sasha Levin --- drivers/bluetooth/hci_ldisc.c | 7 +++++-- drivers/bluetooth/hci_serdev.c | 10 +++++++--- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/drivers/bluetooth/hci_ldisc.c b/drivers/bluetooth/hci_ldisc.c index f537673ede17..865112e96ff9 100644 --- a/drivers/bluetooth/hci_ldisc.c +++ b/drivers/bluetooth/hci_ldisc.c @@ -493,6 +493,11 @@ static int hci_uart_tty_open(struct tty_struct *tty) BT_ERR("Can't allocate control structure"); return -ENFILE; } + if (percpu_init_rwsem(&hu->proto_lock)) { + BT_ERR("Can't allocate semaphore structure"); + kfree(hu); + return -ENOMEM; + } tty->disc_data = hu; hu->tty = tty; @@ -505,8 +510,6 @@ static int hci_uart_tty_open(struct tty_struct *tty) INIT_WORK(&hu->init_ready, hci_uart_init_work); INIT_WORK(&hu->write_work, hci_uart_write_work); - percpu_init_rwsem(&hu->proto_lock); - /* Flush any pending characters in the driver */ tty_driver_flush_buffer(tty); diff --git a/drivers/bluetooth/hci_serdev.c b/drivers/bluetooth/hci_serdev.c index c0e5f42ec6b7..f16fd79bc02b 100644 --- a/drivers/bluetooth/hci_serdev.c +++ b/drivers/bluetooth/hci_serdev.c @@ -310,11 +310,12 @@ int hci_uart_register_device(struct hci_uart *hu, serdev_device_set_client_ops(hu->serdev, &hci_serdev_client_ops); + if (percpu_init_rwsem(&hu->proto_lock)) + return -ENOMEM; + err = serdev_device_open(hu->serdev); if (err) - return err; - - percpu_init_rwsem(&hu->proto_lock); + goto err_rwsem; err = p->open(hu); if (err) @@ -389,6 +390,8 @@ int hci_uart_register_device(struct hci_uart *hu, p->close(hu); err_open: serdev_device_close(hu->serdev); +err_rwsem: + percpu_free_rwsem(&hu->proto_lock); return err; } EXPORT_SYMBOL_GPL(hci_uart_register_device); @@ -410,5 +413,6 @@ void hci_uart_unregister_device(struct hci_uart *hu) clear_bit(HCI_UART_PROTO_READY, &hu->flags); serdev_device_close(hu->serdev); } + percpu_free_rwsem(&hu->proto_lock); } EXPORT_SYMBOL_GPL(hci_uart_unregister_device); From patchwork Sat Oct 22 07:22: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: 7297 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1092996wrr; Sat, 22 Oct 2022 00:55:43 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5Nbn6rRBSOEcYW1RCsWDCV6OfMLWJFFFwy66ZsKawd7aI8QvaMV1m7LVVmugJ/UfFxnIhv X-Received: by 2002:a17:90b:3b88:b0:212:d5c7:8858 with SMTP id pc8-20020a17090b3b8800b00212d5c78858mr6634014pjb.151.1666425342863; Sat, 22 Oct 2022 00:55:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666425342; cv=none; d=google.com; s=arc-20160816; b=zHdCFGDXkBhEKGPlKf3wo7XOa/X8MYEKpyalPOIIWHXFD2IifT3kEGF622KIigXKPI jix8+56orxXqkN91wP64Mr07+SyKECzVpPylYkkodmVtSud93qO7hZHY5uAj4eNsOdm5 XOBx4q7rCsLs+KbkDXimh8/eR+9Lr0kRvUJuaCOefUmEeNnz+mu8+Z0EmTc0kLyBLGhr KV/YCbT5grZ4SBnML6s4jCZe+p7lB/GNEgFmW+DkS9pBDYCrUmCXlZ25RIZjnExU5BqK 3DoD8npkh0atrVNSSSsZKAIaoENtXLb7EG3fQseUwBiUNPo63IjvmMBz7cd+yjEsQaBc UUPA== 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=in389ZDG8/oHYVFZJLHvTdNNTUraU6HUtRw5h4h0A7Y=; b=Llu/6f6ioUprGQVS89IV/nGabON4IyJ8QfTAznOpNlG4u6jjLlhHTpq1ZLC1eF55rY 2B2IldTn2oBfGcjrbeu1ADyoQcTC4zBGxbFORS50nA8pw5ZyzVuUyR9GK+5XqTlE/fEc l4mLpUVQt+fBOgK8fXHHKf+MP5TKxU+BDDDu7gU2qJCklJTaIEPcLVgieSlRLqs+hZ+/ 0EIB0RFET27wsJW0Mg9VK/ubYLHQ+65ccrXbNaE6JE+Qr8CNYynz4l1Z1DK835nYfp5/ uidWVp4/UOPXw7/4qdJaaB2Xr8yT9l2M4VSZzyDLf0jMGNcNGVzVVGVVymU4767DrFnF 6Eww== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=QpTDnVYP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 u30-20020a056a00099e00b00562a956d979si26879125pfg.67.2022.10.22.00.55.29; Sat, 22 Oct 2022 00:55: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=QpTDnVYP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S232088AbiJVHyA (ORCPT + 99 others); Sat, 22 Oct 2022 03:54:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56530 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231980AbiJVHvu (ORCPT ); Sat, 22 Oct 2022 03:51:50 -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 626F3AC299; Sat, 22 Oct 2022 00:46: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 4CE6EB82E29; Sat, 22 Oct 2022 07:45:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9132AC433D7; Sat, 22 Oct 2022 07:45:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424735; bh=4WtSWs0+NqxbJeJz/1Xlp9+z0YYStOt8rbByNslallE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QpTDnVYPT3SmCaBETY2mrYyBfDSg+YAW5xOfiaQ2PVUGwSjN0PV4GrtVPHqZZXnJL bCjBUdo3cIfhMv3qMymqO+NJMZ5J0bSz3ubFtkSlJ7NKwPOam/BYAHeQBG2ZjViJbp Oy+DrPWBBDSyVD4RC76bu60IH44GL+t/KmFb648Y= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Florian Westphal , Antoine Tenart , Sasha Levin Subject: [PATCH 5.19 256/717] netfilter: conntrack: fix the gc rescheduling delay Date: Sat, 22 Oct 2022 09:22:15 +0200 Message-Id: <20221022072500.034465258@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747373620181879964?= X-GMAIL-MSGID: =?utf-8?q?1747373620181879964?= From: Antoine Tenart [ Upstream commit 95eabdd207024312876d0ebed90b4c977e050e85 ] Commit 2cfadb761d3d ("netfilter: conntrack: revisit gc autotuning") changed the eviction rescheduling to the use average expiry of scanned entries (within 1-60s) by doing: for (...) { expires = clamp(nf_ct_expires(tmp), ...); next_run += expires; next_run /= 2; } The issue is the above will make the average ('next_run' here) more dependent on the last expiration values than the firsts (for sets > 2). Depending on the expiration values used to compute the average, the result can be quite different than what's expected. To fix this we can do the following: for (...) { expires = clamp(nf_ct_expires(tmp), ...); next_run += (expires - next_run) / ++count; } Fixes: 2cfadb761d3d ("netfilter: conntrack: revisit gc autotuning") Cc: Florian Westphal Signed-off-by: Antoine Tenart Signed-off-by: Florian Westphal Signed-off-by: Sasha Levin --- net/netfilter/nf_conntrack_core.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/net/netfilter/nf_conntrack_core.c b/net/netfilter/nf_conntrack_core.c index 369aeabb94fe..6fdbffc85222 100644 --- a/net/netfilter/nf_conntrack_core.c +++ b/net/netfilter/nf_conntrack_core.c @@ -67,6 +67,7 @@ struct conntrack_gc_work { struct delayed_work dwork; u32 next_bucket; u32 avg_timeout; + u32 count; u32 start_time; bool exiting; bool early_drop; @@ -1468,6 +1469,7 @@ static void gc_worker(struct work_struct *work) unsigned int expired_count = 0; unsigned long next_run; s32 delta_time; + long count; gc_work = container_of(work, struct conntrack_gc_work, dwork.work); @@ -1477,10 +1479,12 @@ static void gc_worker(struct work_struct *work) if (i == 0) { gc_work->avg_timeout = GC_SCAN_INTERVAL_INIT; + gc_work->count = 1; gc_work->start_time = start_time; } next_run = gc_work->avg_timeout; + count = gc_work->count; end_time = start_time + GC_SCAN_MAX_DURATION; @@ -1500,8 +1504,8 @@ static void gc_worker(struct work_struct *work) hlist_nulls_for_each_entry_rcu(h, n, &ct_hash[i], hnnode) { struct nf_conntrack_net *cnet; - unsigned long expires; struct net *net; + long expires; tmp = nf_ct_tuplehash_to_ctrack(h); @@ -1515,6 +1519,7 @@ static void gc_worker(struct work_struct *work) gc_work->next_bucket = i; gc_work->avg_timeout = next_run; + gc_work->count = count; delta_time = nfct_time_stamp - gc_work->start_time; @@ -1530,8 +1535,8 @@ static void gc_worker(struct work_struct *work) } expires = clamp(nf_ct_expires(tmp), GC_SCAN_INTERVAL_MIN, GC_SCAN_INTERVAL_CLAMP); + expires = (expires - (long)next_run) / ++count; next_run += expires; - next_run /= 2u; if (nf_conntrack_max95 == 0 || gc_worker_skip_ct(tmp)) continue; @@ -1572,6 +1577,7 @@ static void gc_worker(struct work_struct *work) delta_time = nfct_time_stamp - end_time; if (delta_time > 0 && i < hashsz) { gc_work->avg_timeout = next_run; + gc_work->count = count; gc_work->next_bucket = i; next_run = 0; goto early_exit; From patchwork Sat Oct 22 07:22: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: 7322 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1093651wrr; Sat, 22 Oct 2022 00:57:57 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4zXtLbSccpuUFtYG9dfjszHu67ZpzyqdafZM+ZrNBwENP/qt9bg52lPftduQ5ehnn9cOk/ X-Received: by 2002:a17:902:b28c:b0:186:708e:6ed7 with SMTP id u12-20020a170902b28c00b00186708e6ed7mr9582400plr.98.1666425477589; Sat, 22 Oct 2022 00:57:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666425477; cv=none; d=google.com; s=arc-20160816; b=pio8m3jzCegNNqkyUc1pSbyYKccrDMWKeMB7FgMUI2+TfwXMwRK/sVPdHASMA/WF7i llyFz1HZXEsbiugUu0vrxcVwZen9UdnAr0nSC8V7hteiI+7gpwgsuFzBjpSom/kzgrpv 5RiGTntlF+mliyg4QH4ahbRh0ta3FKTWdkPw+srpq0VASTKtpHtuRnj2wIE0UGO4i8f9 sqbUYJp2Pt6qZ32aiWqoAuzJyLaNQUZh1FmgQHDB1rB0uw4bOB8l0j9uiKKnwC2wn7pO mnxtvcXPY1hv6YksSyayVKDAu+0w/vtNuBj5XihxKGFEjNJBhpShPT6FRoZiuNDYSZTa xgwA== 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=kU+askfolksuVvE3H6Gcc18BeCgip2CjRBBGHeHhi7c=; b=Cqva84uTMtv1aeGV4hvyWS6334I9EZSV6iXaFs12nfjoc7Ku9jDrK9q5XHCZMH+XjS VVJPIYBO1rpZn9YHFHQmB+6QK8h6JriG4KlBRIkoOBWVl/g+HdBxqJ81aHfKMGYkrE4S rHdWAJOTjWvVwsHiR1omuJrOA3CXBRfLSBAIdjvo5IgSjTpMiVHC6IUZaOC7hyOtTI2t fP72RcQtskWaNxiWaz366fL+nATlIjlSqZxoTsCuYH7Z1oHuHtiASSTk1dkjPRPQQBCw jxu3ghNpNEPn508M8g/QaCwChDHCXMl5uUcqcnuXvg1DoxbJhMUGUkeb/ulkqN7avFwO dteg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=hgNuyxtL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 kb10-20020a17090ae7ca00b00200a43d4d58si2644308pjb.80.2022.10.22.00.57.45; Sat, 22 Oct 2022 00:57: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=hgNuyxtL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S232322AbiJVH50 (ORCPT + 99 others); Sat, 22 Oct 2022 03:57:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54874 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231831AbiJVHxf (ORCPT ); Sat, 22 Oct 2022 03:53:35 -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 CDA9F63D3E; Sat, 22 Oct 2022 00:46: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 C9FBA60B28; Sat, 22 Oct 2022 07:45:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DE77FC433D7; Sat, 22 Oct 2022 07:45:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424740; bh=rBuWlK9pjgJ07GZwAebfVpLnClf0Leicr5n/pyGzMbM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hgNuyxtLYmMgdyf5m6Q0nz5tKs/ACdWk5yiRrLTmFLP/J/4nO7QZWhI3tiq5k7nNe lgTYmwSOmA7oB71SPxBJSijQ1CiTgXuG/PXfuOZ5XYp1fttKBudbl9Xc2K6dAQB1op tDWonfg/NZFgstMTDsywA2HhU563cT5P28wHk+Ms= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Florian Westphal , Antoine Tenart , Sasha Levin Subject: [PATCH 5.19 257/717] netfilter: conntrack: revisit the gc initial rescheduling bias Date: Sat, 22 Oct 2022 09:22:16 +0200 Message-Id: <20221022072500.214803000@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747373761474860028?= X-GMAIL-MSGID: =?utf-8?q?1747373761474860028?= From: Antoine Tenart [ Upstream commit 2aa192757005f130b2dd3547dda6e462e761199f ] The previous commit changed the way the rescheduling delay is computed which has a side effect: the bias is now represented as much as the other entries in the rescheduling delay which makes the logic to kick in only with very large sets, as the initial interval is very large (INT_MAX). Revisit the GC initial bias to allow more frequent GC for smaller sets while still avoiding wakeups when a machine is mostly idle. We're moving from a large initial value to pretending we have 100 entries expiring at the upper bound. This way only a few entries having a small timeout won't impact much the rescheduling delay and non-idle machines will have enough entries to lower the delay when needed. This also improves readability as the initial bias is now linked to what is computed instead of being an arbitrary large value. Fixes: 2cfadb761d3d ("netfilter: conntrack: revisit gc autotuning") Suggested-by: Florian Westphal Signed-off-by: Antoine Tenart Signed-off-by: Florian Westphal Signed-off-by: Sasha Levin --- net/netfilter/nf_conntrack_core.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/net/netfilter/nf_conntrack_core.c b/net/netfilter/nf_conntrack_core.c index 6fdbffc85222..8ef19f033773 100644 --- a/net/netfilter/nf_conntrack_core.c +++ b/net/netfilter/nf_conntrack_core.c @@ -86,10 +86,12 @@ static DEFINE_MUTEX(nf_conntrack_mutex); /* clamp timeouts to this value (TCP unacked) */ #define GC_SCAN_INTERVAL_CLAMP (300ul * HZ) -/* large initial bias so that we don't scan often just because we have - * three entries with a 1s timeout. +/* Initial bias pretending we have 100 entries at the upper bound so we don't + * wakeup often just because we have three entries with a 1s timeout while still + * allowing non-idle machines to wakeup more often when needed. */ -#define GC_SCAN_INTERVAL_INIT INT_MAX +#define GC_SCAN_INITIAL_COUNT 100 +#define GC_SCAN_INTERVAL_INIT GC_SCAN_INTERVAL_MAX #define GC_SCAN_MAX_DURATION msecs_to_jiffies(10) #define GC_SCAN_EXPIRED_MAX (64000u / HZ) @@ -1479,7 +1481,7 @@ static void gc_worker(struct work_struct *work) if (i == 0) { gc_work->avg_timeout = GC_SCAN_INTERVAL_INIT; - gc_work->count = 1; + gc_work->count = GC_SCAN_INITIAL_COUNT; gc_work->start_time = start_time; } From patchwork Sat Oct 22 07:22: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: 7294 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1092873wrr; Sat, 22 Oct 2022 00:55:25 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4k2MXwDlsLL962cXazP3+ImzMp5BXPbLD0nONX/EjYVBsz2SKxpjoBwu5xL3Ri+r6dhJq+ X-Received: by 2002:a05:6a00:174a:b0:562:781f:eca3 with SMTP id j10-20020a056a00174a00b00562781feca3mr22773518pfc.41.1666425325578; Sat, 22 Oct 2022 00:55:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666425325; cv=none; d=google.com; s=arc-20160816; b=zrPFvNDcGXdSojg70T01IA23q9wlrKzqJXcdyUjpMFQOzsmZfntrb8pbUtLMgxv2CM 2/Xx/aoMrAY40nPAZ4WtrGsvYdMYY5YYUKJGwXRbzfL+oN+xtrzaRy2WuiP0l6awvW1f ctokS9+YaeTN7PWeM6D+QfX4r25DPETIhZm8ZB0jECPjdjkqb2X2K/YOnzyKFQLhx0fe Tlwkxs8uQzCtTcoQ6b5YgLdus64psL8bCjYLMhfr9lJjV6kpRe09akh+rD/lT/OjIkoL NokmQK3NSvM3tz1sy0G6U/fn1/gAwDwphQhTnGD2wxjEzr4t74S0PdwyrA5QwVJWaPKc P01g== 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=Bvxej/lvKFn6NJWJBgeNiVG/Jbo9SQ0H95FOpaNbiVI=; b=cOHxQAqHdlfr1qqj2U8TotG8JzpS5QOIxQFuKwwi2tNByQ6ewL6ecxTtJ8LAy/gzTm F1VZGI5ZCDej9rmio8QqrYhV9hvJsroaX60o8HfAN4GfxUeezJsIZB7m/D14niSsgYRf jvRPSBWrVc04gGLA45FWlRyMfwvainRCQ7IbxcKr+3WXpfGFYTqdlwP7KivdMmO6QVd6 xKTxqVTqTvQpRNZMMwx7F6DAb5CnqXHnBSEw/BKoFFrm4Pk3mscddkTxlqNH0dIlijv/ ztArgzE7+XtEYfVd+lKQNX+Yjslcupk5343qlYpwYCRTGgpJ5ClUxKyNmT1h8Tvi/EIT zx4w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=yauzaur7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 y7-20020a17090a784700b00212eb5485afsi414769pjl.77.2022.10.22.00.55.12; Sat, 22 Oct 2022 00:55: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=yauzaur7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S232070AbiJVHx4 (ORCPT + 99 others); Sat, 22 Oct 2022 03:53:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40188 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231976AbiJVHvs (ORCPT ); Sat, 22 Oct 2022 03:51: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 C65842C6E9D; Sat, 22 Oct 2022 00:46: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 3186CB82E19; Sat, 22 Oct 2022 07:45:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7E939C433C1; Sat, 22 Oct 2022 07:45:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424742; bh=/RIb42wHw1L9PcyyDmOwf1FOxZOlDFzTAebjEtF6xrM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=yauzaur7HEp3lYwooJuMt0aNocmn6yzuz/KQ/yCrWsIx98dAL2ASJLDFqVgkHMxMI LcBPUBbLzvdFg2Gnc2DTx0s5xRddmirzwUH07018Xfia3anfpkELFKoJzXbhWcy3/o WNuFEAUn3Dq/jkxejiDemWs8TwJReUhOdyDuWlFM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Qingqing Yang , Boris Sukholitko , Jakub Kicinski , Sasha Levin Subject: [PATCH 5.19 258/717] flow_dissector: Do not count vlan tags inside tunnel payload Date: Sat, 22 Oct 2022 09:22:17 +0200 Message-Id: <20221022072500.377801790@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747373602547669739?= X-GMAIL-MSGID: =?utf-8?q?1747373602547669739?= From: Qingqing Yang [ Upstream commit 9f87eb4246994e32a4e4ea88476b20ab3b412840 ] We've met the problem that when there is a vlan tag inside GRE encapsulation, the match of num_of_vlans fails. It is caused by the vlan tag inside GRE payload has been counted into num_of_vlans, which is not expected. One example packet is like this: Ethernet II, Src: Broadcom_68:56:07 (00:10:18:68:56:07) Dst: Broadcom_68:56:08 (00:10:18:68:56:08) 802.1Q Virtual LAN, PRI: 0, DEI: 0, ID: 100 Internet Protocol Version 4, Src: 192.168.1.4, Dst: 192.168.1.200 Generic Routing Encapsulation (Transparent Ethernet bridging) Ethernet II, Src: Broadcom_68:58:07 (00:10:18:68:58:07) Dst: Broadcom_68:58:08 (00:10:18:68:58:08) 802.1Q Virtual LAN, PRI: 0, DEI: 0, ID: 200 ... It should match the (num_of_vlans 1) rule, but it matches the (num_of_vlans 2) rule. The vlan tags inside the GRE or other tunnel encapsulated payload should not be taken into num_of_vlans. The fix is to stop counting the vlan number when the encapsulation bit is set. Fixes: 34951fcf26c5 ("flow_dissector: Add number of vlan tags dissector") Signed-off-by: Qingqing Yang Reviewed-by: Boris Sukholitko Link: https://lore.kernel.org/r/20220919074808.136640-1-qingqing.yang@broadcom.com Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin --- net/core/flow_dissector.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/net/core/flow_dissector.c b/net/core/flow_dissector.c index bcba61ef5b37..ac6360433003 100644 --- a/net/core/flow_dissector.c +++ b/net/core/flow_dissector.c @@ -1168,8 +1168,8 @@ bool __skb_flow_dissect(const struct net *net, nhoff += sizeof(*vlan); } - if (dissector_uses_key(flow_dissector, - FLOW_DISSECTOR_KEY_NUM_OF_VLANS)) { + if (dissector_uses_key(flow_dissector, FLOW_DISSECTOR_KEY_NUM_OF_VLANS) && + !(key_control->flags & FLOW_DIS_ENCAPSULATION)) { struct flow_dissector_key_num_of_vlans *key_nvs; key_nvs = skb_flow_dissector_target(flow_dissector, From patchwork Sat Oct 22 07:22: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: 7343 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1095031wrr; Sat, 22 Oct 2022 01:01:34 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6SprrlB6YAxbxYRr53mJ84juEUKzSqQO6hXfr6qkl6wAPykhmqjwW+cyzTrSBMNjYLT1Ue X-Received: by 2002:a17:90a:e592:b0:20d:3b10:3817 with SMTP id g18-20020a17090ae59200b0020d3b103817mr11860032pjz.43.1666425693864; Sat, 22 Oct 2022 01:01:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666425693; cv=none; d=google.com; s=arc-20160816; b=oVb0e3iV7ty8UZWOzxrdePnhidrVwb9qoOrMLDXKBDFBnyWLM9wIzoquCFLorBoAGM fzryGGkY1CcM4WrcWYOOB83sTv2Km5nrV66TsZGTgdNpb3bP6lGNit2I1aFTy6HETgOq QnEQIEKLphGaJSFTaNQlDudP6oiGQmQFwBm0j6llytOZ6ntPR47RvnxDvMW2ikbGtPXS hZYK6tVhw8RocT0xnvUURimRDb/qBLqD+QFgfRj3KLc+Uvi0Lm8Lwi0NAgCbz2i4M86y 1G6CDtJpVXahhI3fNJMdO1LaMnkItX2vn2JFehrv1oSr2oStIbc8np/TFH9WUDuIHYF8 dBnQ== 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=fi3DrkniSyLfEnzw2yZthaK7l1VZtRtm7T/ByKIwfug=; b=UNqqMwyT0+42mMi5AZzL9QDlROk2NNhnS1RDyfh3L3gVRrEA8N6RE374ft+4G8w4Ir 2Y2Snxdl7+MD9mFcxyyiegdW2EAf2tbAnYWhBR2rlxymxyxggwm7j5Hizkm5XQ5zeODf HMFcJ/AV80abU7J2H/qJweAkUxjekVoIt/GjFsYy3Wb4fdl5ld8aLK/2Y8Wl+fGvzIaE K8/h42LSHMzrWtG3GaSQkkVyXFbCJ7rRfjhmofn6CKemy6QA1+qFnVSpsEDP/TqPySGG +Abft3G6CxF13/dqgK/hdabXrk8jugrYe9OWspWNwnqm8+sHrrBVkmCUYCjNXmQQZRBi 2xZg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=cQMXbGJL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 mi12-20020a17090b4b4c00b0020befc1a93asi10394697pjb.100.2022.10.22.01.01.19; Sat, 22 Oct 2022 01:01: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=cQMXbGJL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S232306AbiJVIA7 (ORCPT + 99 others); Sat, 22 Oct 2022 04:00:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54850 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232182AbiJVHyV (ORCPT ); Sat, 22 Oct 2022 03:54: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 684D9951E2; Sat, 22 Oct 2022 00:47: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 19B9960B1B; Sat, 22 Oct 2022 07:47:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 26C50C433D6; Sat, 22 Oct 2022 07:47:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424849; bh=okG/4qFfhpuVeMOdSWkHAOkH9AW4hZf9FC85j0+U+3A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cQMXbGJLrVirqdj8oYr3KfsKtT6XLovFnfQbgfynd0/a1XNLYzUPnsewSss0UFCHI 7YEooSsWA3l5nAWK0ue7Fq7rwrhG+MGeP8xlTnHL3gkTt6eWSD9uRfXj1+BFyBjUAR xpDbTUsJHnlL5DcQNYuAE5pV5+q2YCpqe95grfdo= 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 5.19 259/717] wifi: ath11k: fix failed to find the peer with peer_id 0 when disconnected Date: Sat, 22 Oct 2022 09:22:18 +0200 Message-Id: <20221022072500.528983268@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747373988671666273?= X-GMAIL-MSGID: =?utf-8?q?1747373988671666273?= From: Wen Gong [ Upstream commit a20ed60bb357776301c2dad7b4a4f0db97e143e9 ] It has a fail log which is ath11k_dbg in ath11k_dp_rx_process_mon_status(), as below, it will not print when debug_mask is not set ATH11K_DBG_DATA. ath11k_dbg(ab, ATH11K_DBG_DATA, "failed to find the peer with peer_id %d\n", ppdu_info.peer_id); When run scan with station disconnected, the peer_id is 0 for case HAL_RX_MPDU_START in ath11k_hal_rx_parse_mon_status_tlv() which called from ath11k_dp_rx_process_mon_status(), and the peer_id of ppdu_info is reset to 0 in the while loop, so it does not match condition of the check "if (ppdu_info->peer_id == HAL_INVALID_PEERID" in the loop, and then the log "failed to find the peer with peer_id 0" print after the check in the loop, it is below call stack when debug_mask is set ATH11K_DBG_DATA. The reason is this commit 01d2f285e3e5 ("ath11k: decode HE status tlv") add "memset(ppdu_info, 0, sizeof(struct hal_rx_mon_ppdu_info))" in ath11k_dp_rx_process_mon_status(), but the commit does not initialize the peer_id to HAL_INVALID_PEERID, then lead the check mis-match. Callstack of the failed log: [12335.689072] RIP: 0010:ath11k_dp_rx_process_mon_status+0x9ea/0x1020 [ath11k] [12335.689157] Code: 89 ff e8 f9 10 00 00 be 01 00 00 00 4c 89 f7 e8 dc 4b 4e de 48 8b 85 38 ff ff ff c7 80 e4 07 00 00 01 00 00 00 e9 20 f8 ff ff <0f> 0b 41 0f b7 96 be 06 00 00 48 c7 c6 b8 50 44 c1 4c 89 ff e8 fd [12335.689180] RSP: 0018:ffffb874001a4ca0 EFLAGS: 00010246 [12335.689210] RAX: 0000000000000000 RBX: ffff995642cbd100 RCX: 0000000000000000 [12335.689229] RDX: 0000000000000000 RSI: 0000000000000000 RDI: ffff99564212cd18 [12335.689248] RBP: ffffb874001a4dc0 R08: 0000000000000001 R09: 0000000000000000 [12335.689268] R10: 0000000000000220 R11: ffffb874001a48e8 R12: ffff995642473d40 [12335.689286] R13: ffff99564212c5b8 R14: ffff9956424736a0 R15: ffff995642120000 [12335.689303] FS: 0000000000000000(0000) GS:ffff995739000000(0000) knlGS:0000000000000000 [12335.689323] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [12335.689341] CR2: 00007f43c5d5e039 CR3: 000000011c012005 CR4: 00000000000606e0 [12335.689360] Call Trace: [12335.689377] [12335.689418] ? rcu_read_lock_held_common+0x12/0x50 [12335.689447] ? rcu_read_lock_sched_held+0x25/0x80 [12335.689471] ? rcu_read_lock_held_common+0x12/0x50 [12335.689504] ath11k_dp_rx_process_mon_rings+0x8d/0x4f0 [ath11k] [12335.689578] ? ath11k_dp_rx_process_mon_rings+0x8d/0x4f0 [ath11k] [12335.689653] ? lock_acquire+0xef/0x360 [12335.689681] ? rcu_read_lock_sched_held+0x25/0x80 [12335.689713] ath11k_dp_service_mon_ring+0x38/0x60 [ath11k] [12335.689784] ? ath11k_dp_rx_process_mon_rings+0x4f0/0x4f0 [ath11k] [12335.689860] call_timer_fn+0xb2/0x2f0 [12335.689897] ? ath11k_dp_rx_process_mon_rings+0x4f0/0x4f0 [ath11k] [12335.689970] run_timer_softirq+0x21f/0x540 [12335.689999] ? ktime_get+0xad/0x160 [12335.690025] ? lapic_next_deadline+0x2c/0x40 [12335.690053] ? clockevents_program_event+0x82/0x100 [12335.690093] __do_softirq+0x151/0x4a8 [12335.690135] irq_exit_rcu+0xc9/0x100 [12335.690165] sysvec_apic_timer_interrupt+0xa8/0xd0 [12335.690189] [12335.690204] [12335.690225] asm_sysvec_apic_timer_interrupt+0x12/0x20 Reset the default value to HAL_INVALID_PEERID each time after memset of ppdu_info as well as others memset which existed in function ath11k_dp_rx_process_mon_status(), then the failed log disappeared. Tested-on: WCN6855 hw2.0 PCI WLAN.HSP.1.1-03125-QCAHSPSWPL_V1_V2_SILICONZ_LITE-3 Fixes: 01d2f285e3e5 ("ath11k: decode HE status tlv") Signed-off-by: Wen Gong Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/20220518033556.31940-1-quic_wgong@quicinc.com Signed-off-by: Sasha Levin --- drivers/net/wireless/ath/ath11k/dp_rx.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/ath/ath11k/dp_rx.c b/drivers/net/wireless/ath/ath11k/dp_rx.c index b3e133add1ce..1459e3b1c4f5 100644 --- a/drivers/net/wireless/ath/ath11k/dp_rx.c +++ b/drivers/net/wireless/ath/ath11k/dp_rx.c @@ -5194,7 +5194,8 @@ int ath11k_dp_rx_process_mon_status(struct ath11k_base *ab, int mac_id, if (log_type != ATH11K_PKTLOG_TYPE_INVALID) trace_ath11k_htt_rxdesc(ar, skb->data, log_type, rx_buf_sz); - memset(ppdu_info, 0, sizeof(struct hal_rx_mon_ppdu_info)); + memset(ppdu_info, 0, sizeof(*ppdu_info)); + ppdu_info->peer_id = HAL_INVALID_PEERID; hal_status = ath11k_hal_rx_parse_mon_status(ab, ppdu_info, skb); if (test_bit(ATH11K_FLAG_MONITOR_STARTED, &ar->monitor_flags) && From patchwork Sat Oct 22 07:22: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: 7316 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1093507wrr; Sat, 22 Oct 2022 00:57:32 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5N6EGFIyrrgTOXEhLYrCqGe3sxqXVnvZS3to04ZXGOKxxkmkmeT6oQtVFXXEU9Y0sWVrln X-Received: by 2002:a17:903:11c3:b0:17a:e62:16e8 with SMTP id q3-20020a17090311c300b0017a0e6216e8mr24085355plh.137.1666425452082; Sat, 22 Oct 2022 00:57:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666425452; cv=none; d=google.com; s=arc-20160816; b=WEvqwvDn3hrI4qQVinqvNPjEzdOF+hI2zZQXvnsZ0IwRLWI9uqzK4Ny7fsdNtkovBJ q4As/eDGQFdy7pGXZXJ1Q5yzXADsk4qODzWy7g+xBPbxAlLEP7vA6+K5a2odq2H9hFJN jGExykLiBEQeoCj6zNeaT+SowkuPIgmu4RcNY5ZvfA+6M1VMC3/BZ3NzK/vW0PNxjg6W ffo5+TyPQGe3wbM8SWxgd5bneK9cEK05Nizx3xf1Z9dlLl0aR+/x6x13H6oWOChLszaA 1ftm6srwq6kwnw8DgNzKfOuKeMld9XElO4JvikBke1KVhU8cHl09AHPCFJtefLxKfDkY kuhg== 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=uwO0dui+65bmDRvTzzp4w67d2+vC6it/yVb5OURS4D0=; b=jyLEhCETzERYHoOJxYzP86TzCN/XRzvT4Hf36zg8o/wFPvOOByaE0LojgvekM6jDPi g5r9014JYLRh9GZFzkT1lGPJhenHL3l2aGhylBq4/S8rlr1c4PcxiiJtEB3bBPAiGBm3 iwXJkwj+2in5XR3UCl2hDZEAD/UCpl1lB/srTh8EkrPgxy/SL9QnMGz94gJYELI8zSjA EgTKi9w/Kb06SvfWTuHRMAlRJ/ax/8My2c50fXkXrI6ex5Sr8LB9epwAdz5dhWh4pDfL dT2sbbqLEiV3BZMPyCBmtnfOMNft0oIfCOSbtHgZlNPXBHDmZLEoYyvHOXIGewwwrJM/ zePA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ActyNUO6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 lx16-20020a17090b4b1000b0020a71053a85si10015480pjb.143.2022.10.22.00.57.18; Sat, 22 Oct 2022 00:57: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=ActyNUO6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S232200AbiJVH5B (ORCPT + 99 others); Sat, 22 Oct 2022 03:57:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57486 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231975AbiJVHxM (ORCPT ); Sat, 22 Oct 2022 03:53:12 -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 89DAF2CA7DF; Sat, 22 Oct 2022 00:46: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 ams.source.kernel.org (Postfix) with ESMTPS id 61C8FB82E25; Sat, 22 Oct 2022 07:46:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AF8BEC433C1; Sat, 22 Oct 2022 07:46:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424764; bh=0OomcN+6Xegv5qPSVKWmYj5hvP0ZwQmGX72HULQDYjY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ActyNUO6elPBw+Tmtj6DaUxcAbXNeFwBPofTbUdU5r1VmWy/c+YcpBABVfMmVSBPz aEuoHDM3y7HBpVmxU09IiasFIMMwYcDJc0xNwFRJdT4GxXuICVsgnbe1CHK2kIxI5M ZM138nbVlfYXMjm92mmkX9GZ7T3+nRilQ0xnaHm4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jesus Fernandez Manzano , Kalle Valo , Sasha Levin Subject: [PATCH 5.19 260/717] wifi: ath11k: fix number of VHT beamformee spatial streams Date: Sat, 22 Oct 2022 09:22:19 +0200 Message-Id: <20221022072500.677344792@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747373735215613874?= X-GMAIL-MSGID: =?utf-8?q?1747373735215613874?= From: Jesus Fernandez Manzano [ Upstream commit 55b5ee3357d7bb98ee578cf9b84a652e7a1bc199 ] The number of spatial streams used when acting as a beamformee in VHT mode are reported by the firmware as 7 (8 sts - 1) both in IPQ6018 and IPQ8074 which respectively have 2 and 4 sts each. So the firmware should report 1 (2 - 1) and 3 (4 - 1). Fix this by checking that the number of VHT beamformee sts reported by the firmware is not greater than the number of receiving antennas - 1. The fix is based on the same approach used in this same function for sanitizing the number of sounding dimensions reported by the firmware. Without this change, acting as a beamformee in VHT mode is not working properly. Tested-on: IPQ6018 hw1.0 AHB WLAN.HK.2.5.0.1-01208-QCAHKSWPL_SILICONZ-1 Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.5.0.1-01208-QCAHKSWPL_SILICONZ-1 Fixes: d5c65159f289 ("ath11k: driver for Qualcomm IEEE 802.11ax devices") Signed-off-by: Jesus Fernandez Manzano Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/20220616173947.21901-1-jesus.manzano@galgus.net Signed-off-by: Sasha Levin --- drivers/net/wireless/ath/ath11k/mac.c | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/drivers/net/wireless/ath/ath11k/mac.c b/drivers/net/wireless/ath/ath11k/mac.c index 06b86dcc3826..94d9a7190953 100644 --- a/drivers/net/wireless/ath/ath11k/mac.c +++ b/drivers/net/wireless/ath/ath11k/mac.c @@ -4949,6 +4949,8 @@ static int ath11k_mac_set_txbf_conf(struct ath11k_vif *arvif) if (vht_cap & (IEEE80211_VHT_CAP_SU_BEAMFORMEE_CAPABLE)) { nsts = vht_cap & IEEE80211_VHT_CAP_BEAMFORMEE_STS_MASK; nsts >>= IEEE80211_VHT_CAP_BEAMFORMEE_STS_SHIFT; + if (nsts > (ar->num_rx_chains - 1)) + nsts = ar->num_rx_chains - 1; value |= SM(nsts, WMI_TXBF_STS_CAP_OFFSET); } @@ -4989,7 +4991,7 @@ static int ath11k_mac_set_txbf_conf(struct ath11k_vif *arvif) static void ath11k_set_vht_txbf_cap(struct ath11k *ar, u32 *vht_cap) { bool subfer, subfee; - int sound_dim = 0; + int sound_dim = 0, nsts = 0; subfer = !!(*vht_cap & (IEEE80211_VHT_CAP_SU_BEAMFORMER_CAPABLE)); subfee = !!(*vht_cap & (IEEE80211_VHT_CAP_SU_BEAMFORMEE_CAPABLE)); @@ -4999,6 +5001,11 @@ static void ath11k_set_vht_txbf_cap(struct ath11k *ar, u32 *vht_cap) subfer = false; } + if (ar->num_rx_chains < 2) { + *vht_cap &= ~(IEEE80211_VHT_CAP_SU_BEAMFORMEE_CAPABLE); + subfee = false; + } + /* If SU Beaformer is not set, then disable MU Beamformer Capability */ if (!subfer) *vht_cap &= ~(IEEE80211_VHT_CAP_MU_BEAMFORMER_CAPABLE); @@ -5011,7 +5018,9 @@ static void ath11k_set_vht_txbf_cap(struct ath11k *ar, u32 *vht_cap) sound_dim >>= IEEE80211_VHT_CAP_SOUNDING_DIMENSIONS_SHIFT; *vht_cap &= ~IEEE80211_VHT_CAP_SOUNDING_DIMENSIONS_MASK; - /* TODO: Need to check invalid STS and Sound_dim values set by FW? */ + nsts = (*vht_cap & IEEE80211_VHT_CAP_BEAMFORMEE_STS_MASK); + nsts >>= IEEE80211_VHT_CAP_BEAMFORMEE_STS_SHIFT; + *vht_cap &= ~IEEE80211_VHT_CAP_BEAMFORMEE_STS_MASK; /* Enable Sounding Dimension Field only if SU BF is enabled */ if (subfer) { @@ -5023,9 +5032,15 @@ static void ath11k_set_vht_txbf_cap(struct ath11k *ar, u32 *vht_cap) *vht_cap |= sound_dim; } - /* Use the STS advertised by FW unless SU Beamformee is not supported*/ - if (!subfee) - *vht_cap &= ~(IEEE80211_VHT_CAP_BEAMFORMEE_STS_MASK); + /* Enable Beamformee STS Field only if SU BF is enabled */ + if (subfee) { + if (nsts > (ar->num_rx_chains - 1)) + nsts = ar->num_rx_chains - 1; + + nsts <<= IEEE80211_VHT_CAP_BEAMFORMEE_STS_SHIFT; + nsts &= IEEE80211_VHT_CAP_BEAMFORMEE_STS_MASK; + *vht_cap |= nsts; + } } static struct ieee80211_sta_vht_cap From patchwork Sat Oct 22 07:22:20 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 7357 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1095563wrr; Sat, 22 Oct 2022 01:02:59 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6VVx+EBI4IyNauQLmqWkQFVB4M1//Zdb24e1MDJ1GPEQt6oYom4d5Y6rHZhvTYlYs7pzpe X-Received: by 2002:a17:90b:110c:b0:205:cfeb:cfb with SMTP id gi12-20020a17090b110c00b00205cfeb0cfbmr27135642pjb.75.1666425779506; Sat, 22 Oct 2022 01:02:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666425779; cv=none; d=google.com; s=arc-20160816; b=jjGOllKtKTnIYTj+JMcizvDKCXuWjxSMiVk8tJ4lcDGhCNc1gdKSa5qDSZKxXEq5pN +nbFjsXNzcVejZJ1gmk1uiAuF5s2bPcOMZ+Yczyb7DOeb7dswZ55vv5zMaNvb047vbjc EuKuj86FApTIaY9hF1vyS3AhAQANXV+XsJ+A1vN3Fm42cQOTY19LUw4b9PSrAvogf5zz kM8V3cbLQMpQhYkbb3p4OI+bHa95gLUTeC8ZHRW8CNDgOdncjcEE1lzWh9EfFR4Bw9sm 13I06fe5Ti7FMOvKOEk8YTRdXJxpWk94/wblfaEEWW4ULA9rJv75iBVIz4JnEtADQyFD laDA== 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=ENPgE7U5vwWMxXW1zlqL0GPgChG9UWftFQhLQ1LHRA4=; b=WKfFjyFBIn0jcfvPn4atCpqKetoFTcOw2drSvOClO254HhwAtZTYetYVlQgClPoKpX +2uEzwvY/Ujc/6xrL3J5vNwpd9QKHq3WcxFiugy018n3LWqCrWJEhfZQdJd+zYFAt33O KTbZGGUEpPjjC7bYMn2EOUYwWPwI2rSDY4yfdUrbC8Pj9OSOpmhqqpWMfUljz7l84QBD EFgPvT3HLmO5ZJKU7rTncbiaYrjhvbbgfLTGQT7BjAN0uO5AiM0uGweBBBCTl806WNyC uk+EDdwxDF0IfqJ6hOIlnqfgqpwNbTehQjLnwfDa9wStWiUk0X1uLst4swAV7vSDK441 6oHA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=0jEohYFl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 m5-20020a170902768500b001755f43df36si24058456pll.479.2022.10.22.01.02.46; Sat, 22 Oct 2022 01:02: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=0jEohYFl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S232564AbiJVIC3 (ORCPT + 99 others); Sat, 22 Oct 2022 04:02:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42470 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232292AbiJVHyj (ORCPT ); Sat, 22 Oct 2022 03:54: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 5B5A1356D3; Sat, 22 Oct 2022 00:47: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 616F1B82E2E; Sat, 22 Oct 2022 07:46:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A6170C4314B; Sat, 22 Oct 2022 07:46:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424793; bh=l/euQJPP0mwXSsy4UxgqRB05+NW8V00BdPhBeRB2P0s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0jEohYFld89eptxalM2R7sIoID+3S5CsUv+2cV/vFeqAb93fIhlQWWTmdMAJfplGU YS5u/iYaAYVw3NNf7c7qhrAT9A2y1+TpNDOYZ5p5+LBY036UkkpsnDOCygmaL4Ncve PqUF5zuo/+2oIYxpGRF5uLJxae+ahS/JK8ljQN5w= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?utf-8?b?QXLEsW7DpyDDnE5BTA==?= , Sergio Paracuellos , "David S. Miller" , Sasha Levin Subject: [PATCH 5.19 261/717] mips: dts: ralink: mt7621: fix external phy on GB-PC2 Date: Sat, 22 Oct 2022 09:22:20 +0200 Message-Id: <20221022072500.824900397@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747374078296864214?= X-GMAIL-MSGID: =?utf-8?q?1747374078296864214?= From: Arınç ÜNAL [ Upstream commit 247825f991b34440f9b9d4fe607502435a42ac7b ] The address of the external phy on the mdio bus is 5. Update the devicetree for GB-PC2 accordingly. Fixes: 5bc148649cf3 ("staging: mt7621-dts: fix GB-PC2 devicetree") Signed-off-by: Arınç ÜNAL Reviewed-by: Sergio Paracuellos Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- arch/mips/boot/dts/ralink/mt7621-gnubee-gb-pc2.dts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/arch/mips/boot/dts/ralink/mt7621-gnubee-gb-pc2.dts b/arch/mips/boot/dts/ralink/mt7621-gnubee-gb-pc2.dts index a6201a119a1f..5bdc63187e77 100644 --- a/arch/mips/boot/dts/ralink/mt7621-gnubee-gb-pc2.dts +++ b/arch/mips/boot/dts/ralink/mt7621-gnubee-gb-pc2.dts @@ -83,12 +83,12 @@ &gmac1 { status = "okay"; - phy-handle = <ðphy7>; + phy-handle = <ðphy5>; }; &mdio { - ethphy7: ethernet-phy@7 { - reg = <7>; + ethphy5: ethernet-phy@5 { + reg = <5>; phy-mode = "rgmii-rxid"; }; }; From patchwork Sat Oct 22 07:22: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: 7607 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1106593wrr; Sat, 22 Oct 2022 01:38:23 -0700 (PDT) X-Google-Smtp-Source: AMsMyM51ZjFBwFC4WJhRIGpkWk/u3JyB/QniPg3dFv1BJvbvt5o7ywrYP4DWUoPGBM5ibeV8LVRj X-Received: by 2002:a05:6402:3806:b0:450:bad8:8cd5 with SMTP id es6-20020a056402380600b00450bad88cd5mr21943878edb.305.1666427903669; Sat, 22 Oct 2022 01:38:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666427903; cv=none; d=google.com; s=arc-20160816; b=y3+oQ//ZJl9nhD7foq1T+8RdmSodTq09+qYmzNzWogwbrnLgNlC/o6NXF8hmFbO4JC e15SNHtffmJy7a7vtpzM6jandK+zeZFMbH2v9xrY4YCGNSvKbNZ9V12fPa5uR92raGn7 4XRfgdPOEKqDc5g0/2NONYLIjYb+tynD7CJ5eN3CJ3untwBdEb/qZCDtCR6BXCWwNYcA IOlz7fFd937GEvVN5gBaF+GwDN3RK/Ba8lpPmXtvf0OYfMgnIvrj9tah38QK4FptNxhJ USGiOApFSE45NnR8xNgGvd1DJmfB6iy0IcTRUYvYXhaVgrpFirrGnV/iJ/9YdTps+Tbq cKew== 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=nTfs9PJCZDLNOu+dE21FTZpjlwAbI6Ad0yqiNqNjXEE=; b=BvAOPpUg6CfxALT+LIb5LY49qCk1XzDyiXM72GK3622CUzV5fuMN02Iwk4SOaiVOlv MKJN7DjsttDAoTq4eNsIqnyCYqO/DW83hLF/o7lSf40LkFrKb2ctnL+1iemWNiu0k1Ye xkz7XEKVUpynP51uRZztqJanTH37p8ni7K76ujjjwgswlhicEQ54GcaxXG9avCvK8/TK YsVyLqvGxaXMIfUEsij3UzWyOSINJLC0yyqneQxgvKMlhnQxywl4keTvXhxgTRMPzHIO N4iCQgROao7qVl73OvUgAQspWWup2uRENKlPMEZ1UMllhGHp9o9z7N4HaOw30CYoyd6y WvDg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=wn4SHrSm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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-20020a056402274300b0045968aa645dsi26994988edd.30.2022.10.22.01.37.52; Sat, 22 Oct 2022 01:38: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=wn4SHrSm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S234091AbiJVIdZ (ORCPT + 99 others); Sat, 22 Oct 2022 04:33:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51926 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234148AbiJVI3r (ORCPT ); Sat, 22 Oct 2022 04:29: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 BC6F524B334; Sat, 22 Oct 2022 01:02: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 6C012B82E19; Sat, 22 Oct 2022 07:47:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A6CFDC433C1; Sat, 22 Oct 2022 07:47:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424822; bh=DxdqHRq9n3CnM6oqOwqOVl6LE5qMcE9fhLL5nLUgjn8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wn4SHrSmfkww5OWZr9F+TuB1FU0/HVOLfeM1jvhWXDJ7OONg+XCBhE3BqFcFDX9vM m30wTpPY3K+60rnT6jTTAg8lM9v/dyj0a7ey7czXGtCoxMP1nPpEo8/g3xjlpimNw3 gpU8g9Iy3d+SSnbI7MmXDyDYy7NsZF7wYL1HS8eA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Daniel Micay , Kees Cook , Borislav Petkov , Sasha Levin Subject: [PATCH 5.19 262/717] x86/microcode/AMD: Track patch allocation size explicitly Date: Sat, 22 Oct 2022 09:22:21 +0200 Message-Id: <20221022072500.994478851@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376305501606779?= X-GMAIL-MSGID: =?utf-8?q?1747376305501606779?= From: Kees Cook [ Upstream commit 712f210a457d9c32414df246a72781550bc23ef6 ] In preparation for reducing the use of ksize(), record the actual allocation size for later memcpy(). This avoids copying extra (uninitialized!) bytes into the patch buffer when the requested allocation size isn't exactly the size of a kmalloc bucket. Additionally, fix potential future issues where runtime bounds checking will notice that the buffer was allocated to a smaller value than returned by ksize(). Fixes: 757885e94a22 ("x86, microcode, amd: Early microcode patch loading support for AMD") Suggested-by: Daniel Micay Signed-off-by: Kees Cook Signed-off-by: Borislav Petkov Link: https://lore.kernel.org/lkml/CA+DvKQ+bp7Y7gmaVhacjv9uF6Ar-o4tet872h4Q8RPYPJjcJQA@mail.gmail.com/ Signed-off-by: Sasha Levin --- arch/x86/include/asm/microcode.h | 1 + arch/x86/kernel/cpu/microcode/amd.c | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/arch/x86/include/asm/microcode.h b/arch/x86/include/asm/microcode.h index 0c3d3440fe27..aa675783412f 100644 --- a/arch/x86/include/asm/microcode.h +++ b/arch/x86/include/asm/microcode.h @@ -9,6 +9,7 @@ struct ucode_patch { struct list_head plist; void *data; /* Intel uses only this one */ + unsigned int size; u32 patch_id; u16 equiv_cpu; }; diff --git a/arch/x86/kernel/cpu/microcode/amd.c b/arch/x86/kernel/cpu/microcode/amd.c index 8b2fcdfa6d31..615bc6efa1dd 100644 --- a/arch/x86/kernel/cpu/microcode/amd.c +++ b/arch/x86/kernel/cpu/microcode/amd.c @@ -788,6 +788,7 @@ static int verify_and_add_patch(u8 family, u8 *fw, unsigned int leftover, kfree(patch); return -EINVAL; } + patch->size = *patch_size; mc_hdr = (struct microcode_header_amd *)(fw + SECTION_HDR_SIZE); proc_id = mc_hdr->processor_rev_id; @@ -869,7 +870,7 @@ load_microcode_amd(bool save, u8 family, const u8 *data, size_t size) return ret; memset(amd_ucode_patch, 0, PATCH_MAX_SIZE); - memcpy(amd_ucode_patch, p->data, min_t(u32, ksize(p->data), PATCH_MAX_SIZE)); + memcpy(amd_ucode_patch, p->data, min_t(u32, p->size, PATCH_MAX_SIZE)); return ret; } From patchwork Sat Oct 22 07:22: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: 7348 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1095244wrr; Sat, 22 Oct 2022 01:02:12 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5G/1ytN9qIzpTDNt4OP1dl36RaBvSUSqRmc/nezGuDX11EQya78YFqk2sznr2yTVjscOPA X-Received: by 2002:a05:6a00:2402:b0:52c:81cf:8df2 with SMTP id z2-20020a056a00240200b0052c81cf8df2mr23095653pfh.40.1666425731855; Sat, 22 Oct 2022 01:02:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666425731; cv=none; d=google.com; s=arc-20160816; b=CcjrFeJqkIorAsZVR4ZywDehFq3uEXc3BitLw9BYznjYYD8aUWg3TBLg0zhEUWWlZf 1fcipqqWqk/GHYsazsG2bU/755M/ok83GS537wlCLskkiQuJomc+4yOS/NsJCFTUIc8R mPfCe/PqOq/NueShQ9fw8ZH6pMkLlZitp0Oh6wEeCnjq4w3Myi9iPLjMBrOD6uB9gUPl vCHFozKuUH7X8NzX+AwBHfGYe3BZi0HnJ9yJoBM0iCj5Cebr0OADT4XzNfKACWQKY6jC /KX0qBg7HU5KPM/GUmqpifzdglgaOKXkaNZPPMu/5PRwdUovrb+jF7NqnYZXBOR3TQfD ZO5Q== 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=0/IKtHvtUfdAprwwiZIAqWdyMzyiigcUYvkxESl7Jds=; b=eacLg+ADztHzWHDpeinYpPy4zB+BGMN70RtctOYgttXiLtm7yy769/MbVzwPKn1BVE rMWUD/12t+EsqoyvjhJd9XTJHJaVsq6+A1NKnOu17N5TRuflA2MO1BFF6l6w7XBhSgbW rpQdZYsmW0KLoTyd43x1doKXl53XvY389zrD0RWPqa3F/L7V7N3nWpQg+qYuSFxJ1Sif EjZBKtQhKcRAchEYftFsGkjuKMOPb55q8LfSpo8U+npywvuj8tVQWcJ3hCTcbi+wOZZv VKaBX5RXoJoXac0A0GsHTg8bC5hqg8dh+t5bhx/VRhDzYm5XfMG9+TndMqfI9oV7wnKH 3iDA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=LvCwJcpQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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-20020a639144000000b0046125fee7dbsi25588364pge.382.2022.10.22.01.01.57; Sat, 22 Oct 2022 01:02: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=LvCwJcpQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S232442AbiJVIBa (ORCPT + 99 others); Sat, 22 Oct 2022 04:01:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42470 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232199AbiJVHyX (ORCPT ); Sat, 22 Oct 2022 03:54: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 3BF91951CA; Sat, 22 Oct 2022 00:47:25 -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 5A08660AFA; Sat, 22 Oct 2022 07:47:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 64BD9C433C1; Sat, 22 Oct 2022 07:47:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424832; bh=z8354MLPzt46BjyGsVWJYbQLbpGutp1mNQkt1bEaeCo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LvCwJcpQSfuWcMgpTVuRMYlq/K9SyMkvgnT0jzIsYRnYME8/F4dN72mvx1bMo9UdQ Zw2cTho2qSD071QIf8/ThbnPm8LyeHyEhHPpy2SZgyjZ48sPz/Sya4Xi3WybjljYVK BldVMnrJIHBvQkTwjO0IlwD7WM4NZfCPvPO4Rf8M= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Christian Ansuel Marangi , Kalle Valo , Sasha Levin Subject: [PATCH 5.19 263/717] wifi: ath11k: fix peer addition/deletion error on sta band migration Date: Sat, 22 Oct 2022 09:22:22 +0200 Message-Id: <20221022072501.174437947@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747374028085228829?= X-GMAIL-MSGID: =?utf-8?q?1747374028085228829?= From: Christian 'Ansuel' Marangi [ Upstream commit d673cb6fe6c03b2be157cc6c5db40481828d282d ] This patch try to fix the following error. Wed Jun 1 22:19:30 2022 kern.warn kernel: [ 119.561227] ath11k c000000.wifi: peer already added vdev id 0 req, vdev id 1 present Wed Jun 1 22:19:30 2022 kern.warn kernel: [ 119.561282] ath11k c000000.wifi: Failed to add peer: 28:c2:1f:xx:xx:xx for VDEV: 0 Wed Jun 1 22:19:30 2022 kern.warn kernel: [ 119.568053] ath11k c000000.wifi: Failed to add station: 28:c2:1f:xx:xx:xx for VDEV: 0 Wed Jun 1 22:19:31 2022 daemon.notice hostapd: wlan2: STA 28:c2:1f:xx:xx:xx IEEE 802.11: Could not add STA to kernel driver Wed Jun 1 22:19:31 2022 daemon.notice hostapd: wlan2: STA 28:c2:1f:xx:xx:xx IEEE 802.11: did not acknowledge authentication response Wed Jun 1 22:19:31 2022 daemon.notice hostapd: wlan1: AP-STA-DISCONNECTED 28:c2:1f:xx:xx:xx Wed Jun 1 22:19:31 2022 daemon.info hostapd: wlan1: STA 28:c2:1f:xx:xx:xx IEEE 802.11: disassociated due to inactivity Wed Jun 1 22:19:32 2022 daemon.info hostapd: wlan1: STA 28:c2:1f:xx:xx:xx IEEE 802.11: deauthenticated due to inactivity (timer DEAUTH/REMOVE) To repro this: - Have 2 Wifi with the same bssid and pass on different band (2.4 and 5GHz) - Enable 802.11r Fast Transaction with same mobility domain - FT Protocol: FT over the Air >From a openwrt system issue the command (with the correct mac) ubus call hostapd.wlan1 wnm_disassoc_imminent '{"addr":"28:C2:1F:xx:xx:xx"}' Notice the log printing the errors. The cause of this error has been investigated and we found that this is related to the WiFi Fast Transaction feature. We observed that this is triggered when the router tells the device to change band. In this case the device first auth to the other band and then the disconnect path from the prev band is triggered. This is problematic with the current rhash implementation since the addrs is used as key and the logic of "adding first, delete later" conflicts with the rhash logic. In fact peer addition will fail since the peer is already added and with that fixed a peer deletion will cause unitended effect by removing the peer just added. Current solution to this is to add additional logic to the peer delete, make sure we are deleting the correct peer taken from the rhash table (and fallback to the peer list) and for the peer add logic delete the peer entry for the rhash list before adding the new one (counting as an error only when a peer with the same vlan_id is asked to be added). With this change, a sta can correctly transition from 2.4GHz and 5GHZ with no drop and no error are printed. Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.5.0.1-01208-QCAHKSWPL_SILICONZ-1 Fixes: 7b0c70d92a43 ("ath11k: Add peer rhash table support") Signed-off-by: Christian 'Ansuel' Marangi Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/20220603164559.27769-1-ansuelsmth@gmail.com Signed-off-by: Sasha Levin --- drivers/net/wireless/ath/ath11k/peer.c | 30 ++++++++++++++++++++++---- 1 file changed, 26 insertions(+), 4 deletions(-) diff --git a/drivers/net/wireless/ath/ath11k/peer.c b/drivers/net/wireless/ath/ath11k/peer.c index 9e22aaf34b88..1ae7af02c364 100644 --- a/drivers/net/wireless/ath/ath11k/peer.c +++ b/drivers/net/wireless/ath/ath11k/peer.c @@ -302,6 +302,21 @@ static int __ath11k_peer_delete(struct ath11k *ar, u32 vdev_id, const u8 *addr) spin_lock_bh(&ab->base_lock); peer = ath11k_peer_find_by_addr(ab, addr); + /* Check if the found peer is what we want to remove. + * While the sta is transitioning to another band we may + * have 2 peer with the same addr assigned to different + * vdev_id. Make sure we are deleting the correct peer. + */ + if (peer && peer->vdev_id == vdev_id) + ath11k_peer_rhash_delete(ab, peer); + + /* Fallback to peer list search if the correct peer can't be found. + * Skip the deletion of the peer from the rhash since it has already + * been deleted in peer add. + */ + if (!peer) + peer = ath11k_peer_find(ab, vdev_id, addr); + if (!peer) { spin_unlock_bh(&ab->base_lock); mutex_unlock(&ab->tbl_mtx_lock); @@ -312,8 +327,6 @@ static int __ath11k_peer_delete(struct ath11k *ar, u32 vdev_id, const u8 *addr) return -EINVAL; } - ath11k_peer_rhash_delete(ab, peer); - spin_unlock_bh(&ab->base_lock); mutex_unlock(&ab->tbl_mtx_lock); @@ -372,8 +385,17 @@ int ath11k_peer_create(struct ath11k *ar, struct ath11k_vif *arvif, spin_lock_bh(&ar->ab->base_lock); peer = ath11k_peer_find_by_addr(ar->ab, param->peer_addr); if (peer) { - spin_unlock_bh(&ar->ab->base_lock); - return -EINVAL; + if (peer->vdev_id == param->vdev_id) { + spin_unlock_bh(&ar->ab->base_lock); + return -EINVAL; + } + + /* Assume sta is transitioning to another band. + * Remove here the peer from rhash. + */ + mutex_lock(&ar->ab->tbl_mtx_lock); + ath11k_peer_rhash_delete(ar->ab, peer); + mutex_unlock(&ar->ab->tbl_mtx_lock); } spin_unlock_bh(&ar->ab->base_lock); From patchwork Sat Oct 22 07:22: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: 7362 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1095718wrr; Sat, 22 Oct 2022 01:03:22 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4IXHYlffpn35f4zSs3zYG0Y6STOF0egkBnaN/ddLj1KOLPP4cdMtcoWXRZ2QS0u8fLsWyW X-Received: by 2002:a17:902:cccc:b0:178:a9b3:43e6 with SMTP id z12-20020a170902cccc00b00178a9b343e6mr22865226ple.92.1666425802055; Sat, 22 Oct 2022 01:03:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666425802; cv=none; d=google.com; s=arc-20160816; b=ynPisWGNNGju9gzZTiWwwB0GnfrioAkdAVemjjRBtwqEOz/wXm+TNm84T8Jqtnq+Pr phigaQCl0w5JpdD91Y8MDQMKlks3VexttHszdRw97cslkaqv+aYOUCDWw+QC/hxgX06/ GctSr4OQp80qa0L3Omvta68Z8gF8MQ1t5mQPus0BACh2C71pIi7/w+weftyWUgWKAr8G txhi/HqdHXK9q+tzj5l60XaiZ7hHeeKrDPb4lsIGyKhZMVB9DGeEqSF1x0ixSNyuVJAT cR3vDMDvwdRUFKZDGyJx8tXJvOQQ2NozeNncLNB5YMZ+WxI/wN9h8t24D6RyIBUm917j zULQ== 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=6vbu2UhrpqfSjY5KZbTC0xCcHezl4iro1za3qzWu2SE=; b=Mdbey1ZaeZfe/HSFdk/z9vpHyO6kcTO3drNK3qpmx3pWhkqrOWw3wiC5dkTTOC1dRm OWmAObN14DqPLFPDzkTXYfgROEqD5+KtSWBfq7G+syDUM9YaIbMvuXULHtHDykYX960h ufpqhogkUd9oLkOim9VatXKzHZhHISlvJKpYXXYA7l7wyU4eA042KIxa3yoFZtzb76UG Dt+dKgO+5sGq7Bc4g6z5IpldMPMsJs6nzROm8cwvcj0hPWNiGz5bKNl3dMcfxo6JzbuB HLfEbK0isVDzwJAzurLWfSA2jhCQ/wMAyrM5C/4kdp9M63+QQwgX0J5fwvlEFaLuEi21 wfBA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=haBcRnvm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 189-20020a6306c6000000b0046ed84b9503si2092441pgg.77.2022.10.22.01.03.08; Sat, 22 Oct 2022 01:03: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=haBcRnvm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S232605AbiJVICs (ORCPT + 99 others); Sat, 22 Oct 2022 04:02:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42520 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232315AbiJVHyj (ORCPT ); Sat, 22 Oct 2022 03:54: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 A52185F5D; Sat, 22 Oct 2022 00:47: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 B6CB1B82E18; Sat, 22 Oct 2022 07:47:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 10CCAC433C1; Sat, 22 Oct 2022 07:47:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424835; bh=u5uu7zoc5mzz1n4mGIg5JGx6nhue3av2roUzPtmk3q8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=haBcRnvmn4UqHG+8ETH2JB/Vj3lhC87oHzw+qANufAC3GaxRB9OYPMHrOWeafFq7T gbJpis8me4fCImW3oll5pZ8t2ZCQdkUcMK3Io4T97kvFvb8lHYSclrnhGE/J7TD996 7rmc7NQXxDveK/+6GmS4koBWv1Z8G71iwFGunwUk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?utf-8?q?Luciano_Le=C3=A3o?= , Borislav Petkov , " =?utf-8?q?N=C3=ADcolas_F_=2E__R_=2E__A_=2E_?= =?utf-8?q?_Prado?= " , Sasha Levin Subject: [PATCH 5.19 264/717] x86/cpu: Include the header of init_ia32_feat_ctl()s prototype Date: Sat, 22 Oct 2022 09:22:23 +0200 Message-Id: <20221022072501.284632208@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 required=5.0 tests=BAD_ENC_HEADER,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?1747374101491789821?= X-GMAIL-MSGID: =?utf-8?q?1747374101491789821?= From: Luciano Leão [ Upstream commit 30ea703a38ef76ca119673cd8bdd05c6e068e2ac ] Include the header containing the prototype of init_ia32_feat_ctl(), solving the following warning: $ make W=1 arch/x86/kernel/cpu/feat_ctl.o arch/x86/kernel/cpu/feat_ctl.c:112:6: warning: no previous prototype for ‘init_ia32_feat_ctl’ [-Wmissing-prototypes] 112 | void init_ia32_feat_ctl(struct cpuinfo_x86 *c) This warning appeared after commit 5d5103595e9e5 ("x86/cpu: Reinitialize IA32_FEAT_CTL MSR on BSP during wakeup") had moved the function init_ia32_feat_ctl()'s prototype from arch/x86/kernel/cpu/cpu.h to arch/x86/include/asm/cpu.h. Note that, before the commit mentioned above, the header include "cpu.h" (arch/x86/kernel/cpu/cpu.h) was added by commit 0e79ad863df43 ("x86/cpu: Fix a -Wmissing-prototypes warning for init_ia32_feat_ctl()") solely to fix init_ia32_feat_ctl()'s missing prototype. So, the header include "cpu.h" is no longer necessary. [ bp: Massage commit message. ] Fixes: 5d5103595e9e5 ("x86/cpu: Reinitialize IA32_FEAT_CTL MSR on BSP during wakeup") Signed-off-by: Luciano Leão Signed-off-by: Borislav Petkov Reviewed-by: Nícolas F. R. A. Prado Link: https://lore.kernel.org/r/20220922200053.1357470-1-lucianorsleao@gmail.com Signed-off-by: Sasha Levin --- arch/x86/kernel/cpu/feat_ctl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/x86/kernel/cpu/feat_ctl.c b/arch/x86/kernel/cpu/feat_ctl.c index da696eb4821a..e77032c5f85c 100644 --- a/arch/x86/kernel/cpu/feat_ctl.c +++ b/arch/x86/kernel/cpu/feat_ctl.c @@ -1,11 +1,11 @@ // SPDX-License-Identifier: GPL-2.0 #include +#include #include #include #include #include -#include "cpu.h" #undef pr_fmt #define pr_fmt(fmt) "x86/cpu: " fmt From patchwork Sat Oct 22 07:22: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: 7350 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1095339wrr; Sat, 22 Oct 2022 01:02:27 -0700 (PDT) X-Google-Smtp-Source: AMsMyM618vEkTurXIaWH0q2m4x4I4wknJ3udr0nB1R/mXlFpF05Xt1jrnANWV5EwP+DTSGjt23z3 X-Received: by 2002:a17:903:2342:b0:17c:ae18:1c86 with SMTP id c2-20020a170903234200b0017cae181c86mr22803141plh.5.1666425736193; Sat, 22 Oct 2022 01:02:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666425736; cv=none; d=google.com; s=arc-20160816; b=mwamiP5aww/Mvs068vfLNXLwY+/7zK5t2d3AEYKDt5ed8na4XU00GGN1HSkEFF19g6 5Hvvh8ejljqiy2hRKv2lK/HYBiayXWVbrMDUneyCJ7iMao4b7MA1AgXUKhLPlAoYcf2U /5fGi3Sr0wyOh43bIQtXeJ3BBJRjPp1i5UZmzhjrr3e0QSxKqcwJj/tmIybgh5MpfKZj HJ4rMv3GyivTohPJuQ9cvfsCkIcVcbt9JKnqZkfO9nqCgQI/EpS4vbQD92IbOvzujOmr K7qjcrlOoD0ULrjL+uCIfWQCQnqbnNNyFOdwpSvBr28e/JU4KFJFufYcOcNogh6b8wOv 4y/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=3kmEUc4L8FoHBK2zHVjcvA+mHwUT6nYaMMrgF9XlsOY=; b=S76kO6x4m1SRDUc5YN8/GUdL1mmE5VsvemVIdF69wsMfh6r7rLsMlAU3Swc/9xcK9u BhNyvV7m2McVpHVCzZVyhPQOTGALXvKwVscZ28wBamGyqwW6zeMyesBAh21cVlP43Lzv O1H//g+oMYIAtKAa2MspD2aYqUpnTJytQka8MKUUIfecCsQNj+YJHK0ADQvmNYEYgKfI nBEmCn78HhfRr13TKX55WsuP0TRN10qiz9kRQ2bXz8Agnq52n59di2WzGcbLV7JQTlJV w+euyzqC5E8/u+EtePgW22vYYaNRjE5ydpnPyOVLw7hdFkyueXTPGYULDBkSJ2HS33oa 4jpw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=JWnO3Imt; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 n6-20020a170903110600b00176b7b8cf2esi31447224plh.586.2022.10.22.01.02.03; Sat, 22 Oct 2022 01:02: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=JWnO3Imt; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S232420AbiJVIBX (ORCPT + 99 others); Sat, 22 Oct 2022 04:01:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42336 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232193AbiJVHyV (ORCPT ); Sat, 22 Oct 2022 03:54:21 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3BBC7951C8; Sat, 22 Oct 2022 00:47:25 -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 4595F60AC3; Sat, 22 Oct 2022 07:47:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 26FE4C433C1; Sat, 22 Oct 2022 07:47:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424838; bh=GCQFGmmWCILSM7TeGWDzdxKnjq1UN8sj7bNfO38tuKg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JWnO3ImtqsEfxpmCYdqcOcelSKZpB5cc+yWq8uKUVnZXTfjny4j74CCYiZuaWeGLQ DovkKbCaiS+yzqhgwoFpK8FYYvYMrGs3l+za0IdWuoULqR3f0EO4xDK56amvyPavyy KJOu1wkSs2eWRcVLG3TCKuF9v4TLmADK+HC7+hU4= 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 5.19 265/717] spi: cadence-quadspi: Fix PM disable depth imbalance in cqspi_probe Date: Sat, 22 Oct 2022 09:22:24 +0200 Message-Id: <20221022072501.398405631@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747374032298493422?= X-GMAIL-MSGID: =?utf-8?q?1747374032298493422?= From: Zhang Qilong [ Upstream commit 4d0ef0a1c35189a6e8377d8ee8310ea5ef22c5f3 ] 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:73d5fe0462702 ("spi: cadence-quadspi: Remove spi_master_put() in probe failure path") Signed-off-by: Zhang Qilong Link: https://lore.kernel.org/r/20220924121310.78331-2-zhangqilong3@huawei.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- drivers/spi/spi-cadence-quadspi.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/spi/spi-cadence-quadspi.c b/drivers/spi/spi-cadence-quadspi.c index 72b1a5a2298c..106c09ffa425 100644 --- a/drivers/spi/spi-cadence-quadspi.c +++ b/drivers/spi/spi-cadence-quadspi.c @@ -1619,7 +1619,7 @@ static int cqspi_probe(struct platform_device *pdev) pm_runtime_enable(dev); ret = pm_runtime_resume_and_get(dev); if (ret < 0) - return ret; + goto probe_pm_failed; ret = clk_prepare_enable(cqspi->clk); if (ret) { @@ -1712,6 +1712,7 @@ static int cqspi_probe(struct platform_device *pdev) clk_disable_unprepare(cqspi->clk); probe_clk_failed: pm_runtime_put_sync(dev); +probe_pm_failed: pm_runtime_disable(dev); return ret; } From patchwork Sat Oct 22 07:22: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: 7355 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1095484wrr; Sat, 22 Oct 2022 01:02:47 -0700 (PDT) X-Google-Smtp-Source: AMsMyM40SNTo7B3gRmTcpgJdOqvQEZxV0BP2nn3p65pXMoqh0qzC3ePn1At+jC6BVnhHbtCz8uAx X-Received: by 2002:a05:6a00:10cf:b0:528:48c3:79e0 with SMTP id d15-20020a056a0010cf00b0052848c379e0mr23262907pfu.18.1666425767571; Sat, 22 Oct 2022 01:02:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666425767; cv=none; d=google.com; s=arc-20160816; b=CkM7on3RR6sd8PuZHcP3RkwwN2/SbPTAviFHamTZheBfqJkMiFHFXjf+Tyu4oIeRDe DwJxzWlA+aWkwTRs02pAIdmP6sS3XVZXZvfoCHpel/n7X8QLfxWs2yNYJCK8C/ic0DeA UyFjg65V6u70YYaf41zsfQIl8x0qIaqzrEUzVDR4/ngHK1SLus9p+byxoWis6+4ly/dD +MOpzTLvr1gXCPhbKin5nyqvOzPHfvB6o7PgdMAphW+vEH6jds6EdlGuZ3dRFPrUWhqL sDRIh75nG0GTb6zYlbcWDZSBr0R+LH8RAhrAhCQsVeLEsIFFkSs3FeM6OTqi6o3oi3pZ 6usQ== 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=9Vy9pEX22U2fIvLJ9gZXt6BGMwqqLoqhUmM8Cm9n57M=; b=XDu/pM1xp3T2qpS3PA4BOAGq2nVesVcOagPPH6cpAOehA5N9fvnlL/O85R4SzLVPVN 6hMVK0we77CaV8ZXHWXumKsC1b/heEqVvL/OMs7PJGFoJk8zOtT/pnklig/ObRTizk/k 2p+ub/TIiizqk3Pt4kAq0BLv6WEI1XztsomAM56VHkPeHqdGYc6rNRpVa3bXHVhw6hta B0BmJ+5fX5UAiuHUVRbPAx0/TRev5MHR1cBuIClAAGXAYVjzkmv0i/2nH9EIdS4G5IJK TPLl0mb/NuA4ziFYOzAivnpUi+jUZeDnMwoo5zNC3w1R3Hl32ov+jZo0RRccqcdGHevZ i1Mg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=QKcsoiVX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 q12-20020a170902eb8c00b0017f61ac5a53si24312559plg.111.2022.10.22.01.02.14; Sat, 22 Oct 2022 01:02: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=QKcsoiVX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S232483AbiJVIBv (ORCPT + 99 others); Sat, 22 Oct 2022 04:01:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55596 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232214AbiJVHy0 (ORCPT ); Sat, 22 Oct 2022 03:54:26 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 49E7E951D1; Sat, 22 Oct 2022 00:47:25 -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 04FC360ADA; Sat, 22 Oct 2022 07:47:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E947AC433D6; Sat, 22 Oct 2022 07:47:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424841; bh=ts0uQ0ZHszs3Hfyb7b4wNuPKsVvQ1XetjCglba3KlkA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QKcsoiVX9vhRyvGIPE3XGRDqML6Pc3aRGUcBHJEdnhdcGCY2Z0PJ0iZwwI7f0qEmP p/JAu8sUPE7BFLaj/OlYfQ41eVGiBN6dftABbQjCPXRCWiNK4ImX14uLqdXbsuuDZ7 QQGDtMpaOwwFuekydyyrkGw8bDpF18/KioMeN2nM= 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 5.19 266/717] spi: dw: Fix PM disable depth imbalance in dw_spi_bt1_probe Date: Sat, 22 Oct 2022 09:22:25 +0200 Message-Id: <20221022072501.544426246@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747374066026484282?= X-GMAIL-MSGID: =?utf-8?q?1747374066026484282?= From: Zhang Qilong [ Upstream commit 618d815fc93477b1675878f3c04ff32657cc18b4 ] 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:abf00907538e2 ("spi: dw: Add Baikal-T1 SPI Controller glue driver") Signed-off-by: Zhang Qilong Link: https://lore.kernel.org/r/20220924121310.78331-3-zhangqilong3@huawei.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- drivers/spi/spi-dw-bt1.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/spi/spi-dw-bt1.c b/drivers/spi/spi-dw-bt1.c index c06553416123..3fb89dee595e 100644 --- a/drivers/spi/spi-dw-bt1.c +++ b/drivers/spi/spi-dw-bt1.c @@ -293,8 +293,10 @@ static int dw_spi_bt1_probe(struct platform_device *pdev) pm_runtime_enable(&pdev->dev); ret = dw_spi_add_host(&pdev->dev, dws); - if (ret) + if (ret) { + pm_runtime_disable(&pdev->dev); goto err_disable_clk; + } platform_set_drvdata(pdev, dwsbt1); From patchwork Sat Oct 22 07:22: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: 7356 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1095513wrr; Sat, 22 Oct 2022 01:02:51 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5t+LyytPuI2UggzstujfHRw70qgaxs2XXCB+rlls3cspwvpiNHShcSdRp4VBmYrFIIpV8c X-Received: by 2002:a17:902:d4c7:b0:186:8cda:c9c3 with SMTP id o7-20020a170902d4c700b001868cdac9c3mr1131715plg.154.1666425771558; Sat, 22 Oct 2022 01:02:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666425771; cv=none; d=google.com; s=arc-20160816; b=P/JjDz0k/OOd4B0GOIYKPdzatHZRk8CCtTxuFy3nmcQvfoMhqAcfZoNnxm6C+kebp4 IHvBBufesllaJSAMg6c7WIHT5TDBl79PKyDUoI1Du7B7KfmsvjraByOVLlLK1o6xRKwd OTthEibwnsfniViByFmLs8KkrP0R//OP2tQVReJVBnwm3kmk9Amf4dCK9N4WbDNjFax7 jFrAMu5hRebmIsUn7HoXQH1yb/ewzxXGgr16s4CTDHCCcSjQvi99WvRgKnR4G/ROq6Kd 8+e10jLwpzcl1Rik7ieJT67MAh7vvBYri/3JIJxksqYYQk1obZhnYmMb37roplQ7a4to ac3g== 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=AvkYwu7Y3jkvZ6alWLtfagXvYipmN3O5BMvV5lnyp0g=; b=oOj6kkrNaaowmq8MHE/Z/zzdKpKwLEkepBJivwO7ctnJ3o+rxBb6Aq4+meqZRRz3Zx LHG4+KUhZAT5KhVbVlQVW+TIwejO4+5rZb6Qlf3GtpqTWQEiKqRHLIYuDZ1KI7zZpiMr ZtnriHm9cVks05U89SbW6mA+O/nowkQpYDSaHUvfZelFCUCau1wPhaDCs4fyz5eD3Yxj zvjds5E820plgZgnU2vuCBYm19r89vySfDW+326vZZ/29657FLdJ6jcczxWOSYUoebPh bruAbFdK+3gujeFE0zfRIe8PbIUm8pKfMK95o9yzX9vXQbzQngWL4Rj4ogPBSaVTAUok meCw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=AJyJD069; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 jd4-20020a170903260400b0018668e41784si6572399plb.13.2022.10.22.01.02.38; Sat, 22 Oct 2022 01:02: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=AJyJD069; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S232552AbiJVICW (ORCPT + 99 others); Sat, 22 Oct 2022 04:02:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56428 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232255AbiJVHyc (ORCPT ); Sat, 22 Oct 2022 03:54:32 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 84ED5951D6; Sat, 22 Oct 2022 00:47: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 dfw.source.kernel.org (Postfix) with ESMTPS id C611760AD9; Sat, 22 Oct 2022 07:47:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D83DDC433D6; Sat, 22 Oct 2022 07:47:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424844; bh=qfRkPOfBXEFDRbBTB/Q/Jpv5q9piXIqG1CnSctn/W4I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AJyJD069eW1hzVnFRd0wBO4vKT3l0kgQwzoTNLp84D8yS7FeS0af/Lm6YPdxq4Snr E9hBXLyEtVKEpbKSyuQ99TsIaVT326lc4LgxIEHa58rDuWyYoQu86+JbbxrGVu+9Mk RLrR1J98JIycmvc1+QJpmMv5peJQCXuyxiezY+ZQ= 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 5.19 267/717] spi/omap100k:Fix PM disable depth imbalance in omap1_spi100k_probe Date: Sat, 22 Oct 2022 09:22:26 +0200 Message-Id: <20221022072501.681024657@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747374069939970326?= X-GMAIL-MSGID: =?utf-8?q?1747374069939970326?= 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 20b047172965..061f7394e5b9 100644 --- a/drivers/spi/spi-omap-100k.c +++ b/drivers/spi/spi-omap-100k.c @@ -412,6 +412,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 Sat Oct 22 07:22: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: 7366 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1095875wrr; Sat, 22 Oct 2022 01:03:40 -0700 (PDT) X-Google-Smtp-Source: AMsMyM532/YFP0EN73po509bfZse/JJ7cGcqoPmo8JeJDbjmEgI4GrnRioJTeRyHOXPE5e/u3LbU X-Received: by 2002:a17:903:1251:b0:17f:7f78:e71c with SMTP id u17-20020a170903125100b0017f7f78e71cmr23474226plh.147.1666425820669; Sat, 22 Oct 2022 01:03:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666425820; cv=none; d=google.com; s=arc-20160816; b=Q+Jyw7xO3OoFxQ0FY52OOXKW6aaQnEU/15gFPbdrgL1+bdY0baotiwa3HOcSpfCDYu aBI9+OC07Cz/ayrW3AMGwNZ6NyE06OJeytiLSAfK241puiqM1/abJAPgbg8uB1yLnTAe 9kRoYpGDWfvxaOpddGJyE3e4D5q7srv7W2SYA5/hdL6Rhq2rxi2UaLeMC4gPR091C8Eb rpWVzDPwmg3bUX1R0w1Fu11SOoGI4t063qyMoBS0ZsXigKoJAJNRwZ1r8lswFigRDkWJ c5YLz4mkzwiYRZXE8uO4ylngalBEBuKgKAc9HzlJ8A4cB/F7kAMReCZfkan3qN67cZqM 9U6A== 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=MSGZVNZxL0wYGC+mLfDT+kNbW6LhrFDWYy/nsUpMvSY=; b=dV3um3bCJBRD4A8Bh8+kwcLc5lwbkuA/mb/F8bj0I3fiZx7c0ntcsgUt7V7bYe3DY0 JaWx8z/rM+YrkdeGrsLcqmiP7pUdjTOzDFQuH3T30S8dSSLER5d91lkBIRPQp5sluFZL TOs7WLZSrrSd0Z/miLWoE3LwvcGOIgJkhAavl7sbsWYCb2zllF/V5MrEMYwo/il4CmNK qqlVB/rZD9SPfoaDa45UGF/oA1W+guPJoY9XAuyz3hZl7qusu9i+dLk+CnGgO+BgWVSW mW6yLXWvnoJ0wNeR5uSQPgMPSP4RlNN24u8ClJL358KOrGBi2NgGrwNeoduoe6FNr114 PWbw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=jJ6MgLhB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 r124-20020a632b82000000b00434d8692854si28156514pgr.541.2022.10.22.01.03.27; Sat, 22 Oct 2022 01:03: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=jJ6MgLhB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S232473AbiJVIDI (ORCPT + 99 others); Sat, 22 Oct 2022 04:03:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47420 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232387AbiJVHyx (ORCPT ); Sat, 22 Oct 2022 03:54: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 CD36B3FA07; Sat, 22 Oct 2022 00:48: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 ams.source.kernel.org (Postfix) with ESMTPS id 15D99B82E04; Sat, 22 Oct 2022 07:47:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 84152C433D6; Sat, 22 Oct 2022 07:47:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424846; bh=ipVy3jWeRp0xJbTVsGRKB0dSH6uQrgwCt2Ovp5+8Yww=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jJ6MgLhBB5rbAHpwm2ru9lSu6+Wlc2zDqJdqzA34omWHBkvfxRYgxlmvjTztalDwz BkufMn0PLCo4luzUIC++bTt382ZK6vlIlKogx/JKoTgosUrordSJQM/sNWhfmrBOlA g+NxZOOTxeblC2A39RX3TihY7F/e1C3lq20pjGkE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Liu Jian , Daniel Borkmann , John Fastabend , Sasha Levin Subject: [PATCH 5.19 268/717] skmsg: Schedule psock work if the cached skb exists on the psock Date: Sat, 22 Oct 2022 09:22:27 +0200 Message-Id: <20221022072501.806164079@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747374121301994273?= X-GMAIL-MSGID: =?utf-8?q?1747374121301994273?= From: Liu Jian [ Upstream commit bec217197b412d74168c6a42fc0f76d0cc9cad00 ] In sk_psock_backlog function, for ingress direction skb, if no new data packet arrives after the skb is cached, the cached skb does not have a chance to be added to the receive queue of psock. As a result, the cached skb cannot be received by the upper-layer application. Fix this by reschedule the psock work to dispose the cached skb in sk_msg_recvmsg function. Fixes: 604326b41a6f ("bpf, sockmap: convert to generic sk_msg interface") Signed-off-by: Liu Jian Signed-off-by: Daniel Borkmann Acked-by: John Fastabend Link: https://lore.kernel.org/bpf/20220907071311.60534-1-liujian56@huawei.com Signed-off-by: Sasha Levin --- net/core/skmsg.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/net/core/skmsg.c b/net/core/skmsg.c index 69ac686c7cae..864cd7ded2ca 100644 --- a/net/core/skmsg.c +++ b/net/core/skmsg.c @@ -435,8 +435,10 @@ int sk_msg_recvmsg(struct sock *sk, struct sk_psock *psock, struct msghdr *msg, if (copied + copy > len) copy = len - copied; copy = copy_page_to_iter(page, sge->offset, copy, iter); - if (!copy) - return copied ? copied : -EFAULT; + if (!copy) { + copied = copied ? copied : -EFAULT; + goto out; + } copied += copy; if (likely(!peek)) { @@ -456,7 +458,7 @@ int sk_msg_recvmsg(struct sock *sk, struct sk_psock *psock, struct msghdr *msg, * didn't copy the entire length lets just break. */ if (copy != sge->length) - return copied; + goto out; sk_msg_iter_var_next(i); } @@ -478,7 +480,9 @@ int sk_msg_recvmsg(struct sock *sk, struct sk_psock *psock, struct msghdr *msg, } msg_rx = sk_psock_peek_msg(psock); } - +out: + if (psock->work_state.skb && copied > 0) + schedule_work(&psock->work); return copied; } EXPORT_SYMBOL_GPL(sk_msg_recvmsg); From patchwork Sat Oct 22 07:22: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: 7330 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1093951wrr; Sat, 22 Oct 2022 00:58:55 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6e/ieo206EbwA2wXPT1lpZm7J8D4tf+krixmlbCI+Ihf3SPsw+5Y0EO1r/6cxgIvusE623 X-Received: by 2002:a62:7bc5:0:b0:56b:47ed:22a7 with SMTP id w188-20020a627bc5000000b0056b47ed22a7mr5127489pfc.63.1666425535194; Sat, 22 Oct 2022 00:58:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666425535; cv=none; d=google.com; s=arc-20160816; b=JBjEJtMG4zwIXB/e7oHB6+/jnRSPTagZLWC0wgzsnLOwZ91A8QjZy+K/PakV7bogLH txl7Hm4z7blZdZW4rsggVwUqIeCC+8enREPp9QAFFs1Y53GtBXPWxTHpC9J2x4vEOnhS j5U4+ZWV1fxsq6NtMcTRitFbMqAqZvxsWXak5+z4Y6r3nf/6hGoYeH4SYosVV1cxiv1z intKKudsT0Qxpe4LVQOK/fJFPzhNqyBFxHtL2Y1nhtCGzS0sZ4FWH2gCrqfVW0saqyAe t4g8ypGCcZemTpUcYEsqVSEuvAJtvWtjmxJTI3vd7O0iF3r4P15rwWxcB+4U+ZM248w1 vjhA== 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=Nfa+HXInf3+9WrIfRzS6/6EK+owEXMGAUIzzaIB4kIM=; b=xVb1S3IUZNB8lFOgUOGqkIAdJWlnqlTSiEifS8qZC1BkpTCc50xtP2RbIOAv38b36q RvJ3JvB133b1tT1C9ivoG5oqmgPBdSjAwWrz310gogfuBPKU9RWhi3p5V/rwWUErN0rH RN5MGmAveMwc6q7ecNMu+m2fKg9LKBxCAdPn7s4bHWOwU7XQMc3wYAzQLcwMlZsnVrUs OEm0ICu2YFZfwN1Eyfd6Cv8dV44OEKfpFqkfQERw+H/szi/3X3ZyL5RzmTzRWdjDeUiS gBvdQKY6EM/yh1dKLWYjj7FHKpYD2Eh1L/P8DPHwe7QgQXpEdZZIaS9uxOp088q2/6I1 TI1w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=2EYNcA7a; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 bc9-20020a170902930900b001868827ed1esi1971915plb.131.2022.10.22.00.58.42; Sat, 22 Oct 2022 00:58: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=2EYNcA7a; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S232366AbiJVH6Z (ORCPT + 99 others); Sat, 22 Oct 2022 03:58:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55588 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232091AbiJVHyB (ORCPT ); Sat, 22 Oct 2022 03:54:01 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 240C666F1D; Sat, 22 Oct 2022 00:47: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 690FF60B83; Sat, 22 Oct 2022 07:46:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 79804C433D6; Sat, 22 Oct 2022 07:46:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424766; bh=dVDJSEzRrPtFqIsoE3zXwmOWCE8M6Zw0BQZP6LOW0Mw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=2EYNcA7anzzEdgiI04P+Ne0DWp6/g2dM8RaLbUwUARtNtafNaEPoWLZUo9wsTYzp/ zLSTVzEoboJCDwdZMk2anc6Kt9uCkICL6CO8l2lRndLg9f4HDDhwiRDVJyEbW30I4k ir5ST+oSsjxQmMXJYZA/FfQaHDNzAu7f+avfGSLw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Xiaomeng Tong , Kalle Valo , Sasha Levin Subject: [PATCH 5.19 269/717] cw1200: fix incorrect check to determine if no element is found in list Date: Sat, 22 Oct 2022 09:22:28 +0200 Message-Id: <20221022072501.951140149@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747373821799878545?= X-GMAIL-MSGID: =?utf-8?q?1747373821799878545?= From: Xiaomeng Tong [ Upstream commit 86df5de5c632d3bd940f59bbb14ae912aa9cc363 ] The bug is here: "} else if (item) {". The list iterator value will *always* be set and non-NULL by list_for_each_entry(), so it is incorrect to assume that the iterator value will be NULL if the list is empty or no element is found in list. Use a new value 'iter' as the list iterator, while use the old value 'item' as a dedicated pointer to point to the found element, which 1. can fix this bug, due to now 'item' is NULL only if it's not found. 2. do not need to change all the uses of 'item' after the loop. 3. can also limit the scope of the list iterator 'iter' *only inside* the traversal loop by simply declaring 'iter' inside the loop in the future, as usage of the iterator outside of the list_for_each_entry is considered harmful. https://lkml.org/lkml/2022/2/17/1032 Fixes: a910e4a94f692 ("cw1200: add driver for the ST-E CW1100 & CW1200 WLAN chipsets") Signed-off-by: Xiaomeng Tong Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/20220413091723.17596-1-xiam0nd.tong@gmail.com Signed-off-by: Sasha Levin --- drivers/net/wireless/st/cw1200/queue.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/drivers/net/wireless/st/cw1200/queue.c b/drivers/net/wireless/st/cw1200/queue.c index e06da4b3b0d4..805a3c1bf8fe 100644 --- a/drivers/net/wireless/st/cw1200/queue.c +++ b/drivers/net/wireless/st/cw1200/queue.c @@ -91,23 +91,25 @@ static void __cw1200_queue_gc(struct cw1200_queue *queue, bool unlock) { struct cw1200_queue_stats *stats = queue->stats; - struct cw1200_queue_item *item = NULL, *tmp; + struct cw1200_queue_item *item = NULL, *iter, *tmp; bool wakeup_stats = false; - list_for_each_entry_safe(item, tmp, &queue->queue, head) { - if (time_is_after_jiffies(item->queue_timestamp + queue->ttl)) + list_for_each_entry_safe(iter, tmp, &queue->queue, head) { + if (time_is_after_jiffies(iter->queue_timestamp + queue->ttl)) { + item = iter; break; + } --queue->num_queued; - --queue->link_map_cache[item->txpriv.link_id]; + --queue->link_map_cache[iter->txpriv.link_id]; spin_lock_bh(&stats->lock); --stats->num_queued; - if (!--stats->link_map_cache[item->txpriv.link_id]) + if (!--stats->link_map_cache[iter->txpriv.link_id]) wakeup_stats = true; spin_unlock_bh(&stats->lock); cw1200_debug_tx_ttl(stats->priv); - cw1200_queue_register_post_gc(head, item); - item->skb = NULL; - list_move_tail(&item->head, &queue->free_pool); + cw1200_queue_register_post_gc(head, iter); + iter->skb = NULL; + list_move_tail(&iter->head, &queue->free_pool); } if (wakeup_stats) From patchwork Sat Oct 22 07:22: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: 7325 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1093801wrr; Sat, 22 Oct 2022 00:58:29 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6L2seWc59QQ/8nlrSPR65fw7+vdoV2dj4ASqSZMYGGx8lJlU1miMkbQEBV3VkFZ5sKSBd2 X-Received: by 2002:a17:902:820b:b0:185:b9a:8ac1 with SMTP id x11-20020a170902820b00b001850b9a8ac1mr23324178pln.111.1666425509083; Sat, 22 Oct 2022 00:58:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666425509; cv=none; d=google.com; s=arc-20160816; b=dGQ7qtIg1qhaVwp4JbnnI2vPNNxJ8T+lKQATLtMnZiE380D8VsH5d1Y2+a6JBNdfSp DYlqSWiEp5awqJaOv68IFIpgc1XmUDQF2L9lJdB3tBLQbq8lLpfry6fkkRy33hEUHXn9 W7Kh+XaYxSPMnlsGC3ScTHaejo7kVWmq+NPkOgtVJmdYJQB2WF5GY+2XJO0zNyBttusj dJchXobq7qoObLBMwyHXWX4EZuWhSmTzrS70mV8WWCPwEImBq4RqVaZPYPFaagUnFgGe I5pmjDPUwoiPTTmxJk4wNYygyW1YM8ePrP14iQ/BRRJmcCNnbDsYg9dtVXGXDfdp2EN/ 4Tyg== 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=DBsSQLLby1VNi70VhMbPTIBsxbPnnca8nnhb9/MOEbY=; b=zs6mM18VKBsFAUokIQGqdHycwiMynN7UuObFM/12pGGDCcaioCm2j+5NEoxPkqebfX booi7doeXsB+he6pn0RgYYuieboqAzHp4/cj40AMRRIqmHdivesnI5HN6Wol39Um5T5l hkURO9wujFwGYwzxYWPgLbTsNUFK/lE734hRxJQihZGueJ6vrv/L6USb2/jeQrBwy2+M 4bcxiNA/h9fouHXLIhvuFP9j2rVR2wcEvVU+ctOeh3/010bTWNIer7C9FI+pt0Py7Yu6 bABE6Pte18qqukSWU4hJAMRRDoswFFYEEsan0A6DcSFVWXJh25qYAte26LGQWkGS1sdd 8ATw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=BCDa3POg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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-20020a170902c40400b00185402cfee2si32354446plk.390.2022.10.22.00.58.16; Sat, 22 Oct 2022 00:58: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=BCDa3POg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S232335AbiJVH5h (ORCPT + 99 others); Sat, 22 Oct 2022 03:57:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54870 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231772AbiJVHxh (ORCPT ); Sat, 22 Oct 2022 03:53: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 0CDCA66F2D; Sat, 22 Oct 2022 00:47: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 0B2EF60B81; Sat, 22 Oct 2022 07:46:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 178F2C433C1; Sat, 22 Oct 2022 07:46:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424769; bh=W+SzmJ4+Ai0GJAXfRt/BGB8Dxa/vhps1D+4o/1qiegw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BCDa3POgPft+maYowYoi+nXPlhn65fWlLHf2ozMR3XsxGF/yDwEkQ3Hs7zr6xJQRH JxyXrmiTe1EjDWOMv8IF35m4mHONjhStExbPznc57on2mzlkIbV7oUGvi2ABI8gtIQ jVrYyWpnxwhZJDSFpgX/WdYeDyo5AwddWRys8ljw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Khalil Blaiech , Asmaa Mnebhi , Wolfram Sang , Sasha Levin Subject: [PATCH 5.19 270/717] i2c: mlxbf: support lock mechanism Date: Sat, 22 Oct 2022 09:22:29 +0200 Message-Id: <20221022072502.144621556@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747373794715287590?= X-GMAIL-MSGID: =?utf-8?q?1747373794715287590?= From: Asmaa Mnebhi [ Upstream commit 86067ccfa1424a26491542d6f6d7546d40b61a10 ] Linux is not the only entity using the BlueField I2C busses so support a lock mechanism provided by hardware to avoid issues when multiple entities are trying to access the same bus. The lock is acquired whenever written explicitely or the lock register is read. So make sure it is always released at the end of a successful or failed transaction. Fixes: b5b5b32081cd206b (i2c: mlxbf: I2C SMBus driver for Mellanox BlueField SoC) Reviewed-by: Khalil Blaiech Signed-off-by: Asmaa Mnebhi Signed-off-by: Wolfram Sang Signed-off-by: Sasha Levin --- drivers/i2c/busses/i2c-mlxbf.c | 44 ++++++++++++++++++++++++++++++---- 1 file changed, 39 insertions(+), 5 deletions(-) diff --git a/drivers/i2c/busses/i2c-mlxbf.c b/drivers/i2c/busses/i2c-mlxbf.c index ad5efd7497d1..0e840eba4fd6 100644 --- a/drivers/i2c/busses/i2c-mlxbf.c +++ b/drivers/i2c/busses/i2c-mlxbf.c @@ -306,6 +306,7 @@ static u64 mlxbf_i2c_corepll_frequency; * exact. */ #define MLXBF_I2C_SMBUS_TIMEOUT (300 * 1000) /* 300ms */ +#define MLXBF_I2C_SMBUS_LOCK_POLL_TIMEOUT (300 * 1000) /* 300ms */ /* Encapsulates timing parameters. */ struct mlxbf_i2c_timings { @@ -514,6 +515,25 @@ static bool mlxbf_smbus_master_wait_for_idle(struct mlxbf_i2c_priv *priv) return false; } +/* + * wait for the lock to be released before acquiring it. + */ +static bool mlxbf_i2c_smbus_master_lock(struct mlxbf_i2c_priv *priv) +{ + if (mlxbf_smbus_poll(priv->smbus->io, MLXBF_I2C_SMBUS_MASTER_GW, + MLXBF_I2C_MASTER_LOCK_BIT, true, + MLXBF_I2C_SMBUS_LOCK_POLL_TIMEOUT)) + return true; + + return false; +} + +static void mlxbf_i2c_smbus_master_unlock(struct mlxbf_i2c_priv *priv) +{ + /* Clear the gw to clear the lock */ + writel(0, priv->smbus->io + MLXBF_I2C_SMBUS_MASTER_GW); +} + static bool mlxbf_i2c_smbus_transaction_success(u32 master_status, u32 cause_status) { @@ -705,10 +725,19 @@ mlxbf_i2c_smbus_start_transaction(struct mlxbf_i2c_priv *priv, slave = request->slave & GENMASK(6, 0); addr = slave << 1; - /* First of all, check whether the HW is idle. */ - if (WARN_ON(!mlxbf_smbus_master_wait_for_idle(priv))) + /* + * Try to acquire the smbus gw lock before any reads of the GW register since + * a read sets the lock. + */ + if (WARN_ON(!mlxbf_i2c_smbus_master_lock(priv))) return -EBUSY; + /* Check whether the HW is idle */ + if (WARN_ON(!mlxbf_smbus_master_wait_for_idle(priv))) { + ret = -EBUSY; + goto out_unlock; + } + /* Set first byte. */ data_desc[data_idx++] = addr; @@ -732,8 +761,10 @@ mlxbf_i2c_smbus_start_transaction(struct mlxbf_i2c_priv *priv, write_en = 1; write_len += operation->length; if (data_idx + operation->length > - MLXBF_I2C_MASTER_DATA_DESC_SIZE) - return -ENOBUFS; + MLXBF_I2C_MASTER_DATA_DESC_SIZE) { + ret = -ENOBUFS; + goto out_unlock; + } memcpy(data_desc + data_idx, operation->buffer, operation->length); data_idx += operation->length; @@ -765,7 +796,7 @@ mlxbf_i2c_smbus_start_transaction(struct mlxbf_i2c_priv *priv, ret = mlxbf_i2c_smbus_enable(priv, slave, write_len, block_en, pec_en, 0); if (ret) - return ret; + goto out_unlock; } if (read_en) { @@ -792,6 +823,9 @@ mlxbf_i2c_smbus_start_transaction(struct mlxbf_i2c_priv *priv, priv->smbus->io + MLXBF_I2C_SMBUS_MASTER_FSM); } +out_unlock: + mlxbf_i2c_smbus_master_unlock(priv); + return ret; } From patchwork Sat Oct 22 07:22: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: 7353 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1095446wrr; Sat, 22 Oct 2022 01:02:42 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7pvGukkmGJRbff562JfdqlL8nhRRbfVeW+Nui8MNtdTWko08P6ceCwHyrMv50jviLTsigL X-Received: by 2002:a17:902:724b:b0:183:16f:fae4 with SMTP id c11-20020a170902724b00b00183016ffae4mr23429713pll.88.1666425762480; Sat, 22 Oct 2022 01:02:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666425762; cv=none; d=google.com; s=arc-20160816; b=ay9DQCNyN+WCvTwxwPEwyVTOx1CDd8wYaoZm56VbW+0Xhb9ZuMJdFr9WZhLhpjTMPB +0PhVVCIK/qgSBf36WtZIuhN1fOB2RHsgt2078chuojua7RKgwkfdvzEeEv4/RZby5pZ 7lvh46rHLJsKf66+hXxN0m6AKt6B/b5jtQY3tABoDgOKOlkAIB5w1vTG2ATaVl9Pajv9 bQrM0exwL0xUWsxyNZF9R3UmLsAH6v4+bJm76+nnJY8viDXBqwWovQ8TO7hIEmVM+wNV QU5aMRHDkptZ+wVOyc6N9zys6HP5yB9LABrBduKpLGFQ4jVXNWTCjFe6AAuwsnr+z+Tq uUiw== 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=okQH43dtBlvxFDpTBd0/FP9nlOSvC/wS9htzS3JAMKE=; b=PLvigzUmhAflwVjxhmSldwF4bkhhioBg5pgEAa+xFiBk47hpK6LayF0Ig3TTD+EoWa 6F7uTjeUIaMv4yGtPw4XhYe5jTN2mCm5DW4TZ9gxr/GuPuI29M3ot3FtBvKCFF/guzZd W4nE914x5ZJLMUX3CO8MUTIfjNZrtFqDfUCz9SZC+hY/w1xujTY6pAzw4uFsCMMp5qDO 8qofv0iVEusmPndXKAQtPh1VsXE96rqFJ4uPVBfEZQLswKM1BJ8TlY8TkFrmN3oxHtq/ i56r96dlQwfbgpn7ct+q1kNqoM2Ddz4+a4paIVRVsZTtDdsAoHC/wuygeddBaJguXUpw 1+cQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=E5VLJuCD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 hg3-20020a17090b300300b0020dba9319fcsi8152445pjb.111.2022.10.22.01.02.29; Sat, 22 Oct 2022 01:02: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=E5VLJuCD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S232514AbiJVICG (ORCPT + 99 others); Sat, 22 Oct 2022 04:02:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39698 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232241AbiJVHya (ORCPT ); Sat, 22 Oct 2022 03:54:30 -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 E75E2951C1; Sat, 22 Oct 2022 00:47: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 640FEB82DFC; Sat, 22 Oct 2022 07:46:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BDF63C433C1; Sat, 22 Oct 2022 07:46:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424772; bh=6F9Q7yQOukegTSuI//Wh9z9S+yPVAsGd+7m722dCw2o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=E5VLJuCDXZ3OI8Z06qMYlpz+ubG41fsypkVPmQJee35YiDVrebSi/k58ES9Bsvj+t KkhKy0DpQ+Kn2/Qaabd/BlBAjCgYdevmr8G5behlFC3LmXxCiYyU6yFmHK1qcwOq87 /tSUz0R1cxKiqwgdyN9YUOan+QQzIEFCAek7JOOk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Luiz Augusto von Dentz , David Beinder , Sasha Levin Subject: [PATCH 5.19 271/717] Bluetooth: hci_core: Fix not handling link timeouts propertly Date: Sat, 22 Oct 2022 09:22:30 +0200 Message-Id: <20221022072502.371046546@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747374060165428217?= X-GMAIL-MSGID: =?utf-8?q?1747374060165428217?= From: Luiz Augusto von Dentz [ Upstream commit 116523c8fac05d1d26f748fee7919a4ec5df67ea ] Change that introduced the use of __check_timeout did not account for link types properly, it always assumes ACL_LINK is used thus causing hdev->acl_last_tx to be used even in case of LE_LINK and then again uses ACL_LINK with hci_link_tx_to. To fix this __check_timeout now takes the link type as parameter and then procedure to use the right last_tx based on the link type and pass it to hci_link_tx_to. Fixes: 1b1d29e51499 ("Bluetooth: Make use of __check_timeout on hci_sched_le") Signed-off-by: Luiz Augusto von Dentz Tested-by: David Beinder Signed-off-by: Sasha Levin --- net/bluetooth/hci_core.c | 34 +++++++++++++++++++++++----------- 1 file changed, 23 insertions(+), 11 deletions(-) diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c index 48029a390c65..8ecc0a18df76 100644 --- a/net/bluetooth/hci_core.c +++ b/net/bluetooth/hci_core.c @@ -3370,15 +3370,27 @@ static inline int __get_blocks(struct hci_dev *hdev, struct sk_buff *skb) return DIV_ROUND_UP(skb->len - HCI_ACL_HDR_SIZE, hdev->block_len); } -static void __check_timeout(struct hci_dev *hdev, unsigned int cnt) +static void __check_timeout(struct hci_dev *hdev, unsigned int cnt, u8 type) { - if (!hci_dev_test_flag(hdev, HCI_UNCONFIGURED)) { - /* ACL tx timeout must be longer than maximum - * link supervision timeout (40.9 seconds) */ - if (!cnt && time_after(jiffies, hdev->acl_last_tx + - HCI_ACL_TX_TIMEOUT)) - hci_link_tx_to(hdev, ACL_LINK); + unsigned long last_tx; + + if (hci_dev_test_flag(hdev, HCI_UNCONFIGURED)) + return; + + switch (type) { + case LE_LINK: + last_tx = hdev->le_last_tx; + break; + default: + last_tx = hdev->acl_last_tx; + break; } + + /* tx timeout must be longer than maximum link supervision timeout + * (40.9 seconds) + */ + if (!cnt && time_after(jiffies, last_tx + HCI_ACL_TX_TIMEOUT)) + hci_link_tx_to(hdev, type); } /* Schedule SCO */ @@ -3436,7 +3448,7 @@ static void hci_sched_acl_pkt(struct hci_dev *hdev) struct sk_buff *skb; int quote; - __check_timeout(hdev, cnt); + __check_timeout(hdev, cnt, ACL_LINK); while (hdev->acl_cnt && (chan = hci_chan_sent(hdev, ACL_LINK, "e))) { @@ -3479,8 +3491,6 @@ static void hci_sched_acl_blk(struct hci_dev *hdev) int quote; u8 type; - __check_timeout(hdev, cnt); - BT_DBG("%s", hdev->name); if (hdev->dev_type == HCI_AMP) @@ -3488,6 +3498,8 @@ static void hci_sched_acl_blk(struct hci_dev *hdev) else type = ACL_LINK; + __check_timeout(hdev, cnt, type); + while (hdev->block_cnt > 0 && (chan = hci_chan_sent(hdev, type, "e))) { u32 priority = (skb_peek(&chan->data_q))->priority; @@ -3561,7 +3573,7 @@ static void hci_sched_le(struct hci_dev *hdev) cnt = hdev->le_pkts ? hdev->le_cnt : hdev->acl_cnt; - __check_timeout(hdev, cnt); + __check_timeout(hdev, cnt, LE_LINK); tmp = cnt; while (cnt && (chan = hci_chan_sent(hdev, LE_LINK, "e))) { From patchwork Sat Oct 22 07:22: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: 7339 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1094984wrr; Sat, 22 Oct 2022 01:01:25 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7UG0cgUVjwVS/U82qnQ46RE/Ytjud0ZMdcCFUms28DNSCRj3Y3DhwrFyOyhvCzRea92oX/ X-Received: by 2002:a17:90a:7787:b0:20d:3093:ae7f with SMTP id v7-20020a17090a778700b0020d3093ae7fmr59957786pjk.226.1666425684921; Sat, 22 Oct 2022 01:01:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666425684; cv=none; d=google.com; s=arc-20160816; b=wAKjIr+5bVi6LqAfu5K7hkmydvQBDAif4PcQ6zxBa8z8g9Kzlo9JPkCPKsP7vRflhG /3+qT/HZHGklbkYSf8mWX1IKhWp9oQeg2gahfK8t4OTFvOpwKLFBxrfyjZTX5anHkm6/ f+nIPdoDDHYOrIU3DWQc10IHaLEGFpkY7Q66qya2UCXy1XNE6M3lke1uhsM5lqoDY8Tz 3pokSdwS5lEnCvbRhSrautQpbMNB9AoDAatPH0/kjoc7x3yeEGlwkL2jHRC+aphwfMrH cefxqjciqNIYAsohQ4VSLOQY9r6ef5oLfTSsm2kFOXlzO2k7yaugDBye2WqU5McnSW0v +3Jg== 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=nmKHs+8MV5p9zsQ1uZschs/OXHne+3MhEcyHmhYx0rI=; b=ejZz6u5WeI0Fl0qmZcJTE7ttVRGOEkhUBOeWaIbz9beObI4Y6eKBJjgOEKAny2XtHi eEUlvn32HG2Z5FsxxHkDxIGfu1xl4vIPYYB4g9LAi4kr7BzPNxqZMUs7HXv5NeaKtJB7 6+q66O+rth1eCgtxXGHAyDnnxrUAvTD6fI5rOeiidOrifcrFKj9pQXsx0syKeYlBjEHo pTVQJPJEOWqavPt+aUfJZgHPL6zb/+utUdR2J4KwpKVvCDt29XqVMOqFeTNQKEGkarUR /i72REkUBx6H1RVC/55O3k4BcTffjGWnDBrOlFtIPgV+VQBXqeltUXvWh36yV3pYwaLb 8z+A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Rm1tQBFZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 z11-20020a170903018b00b00178a9b343f5si29220121plg.16.2022.10.22.01.00.50; Sat, 22 Oct 2022 01:01: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=Rm1tQBFZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S232507AbiJVH7F (ORCPT + 99 others); Sat, 22 Oct 2022 03:59:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56386 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232138AbiJVHyJ (ORCPT ); Sat, 22 Oct 2022 03:54:09 -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 54F9F65023; Sat, 22 Oct 2022 00:47: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 F0E75B82E11; Sat, 22 Oct 2022 07:46:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 68C5FC433C1; Sat, 22 Oct 2022 07:46:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424774; bh=9le4u6YBKk5xmMeRChSacgla+pEWkHdhSCXIYxa77Mo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Rm1tQBFZQ3Ywh+wlp4hoK5tSbStdes+hmj1zDYNwQ+JUNCNWTftIuEFDi5MVvJ/sz 4CkC+e8GSyLqpRHs6mY7DCNJcVX1Z5P8iaimzjxa/iaPLgJ9WOpHnWgHeQEdJjaV6I PXy1Btvhoi0Vv3YCyVF10kXiUTjXZd21SgQYMwtE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Liu Jian , Steffen Klassert , Sasha Levin Subject: [PATCH 5.19 272/717] xfrm: Reinject transport-mode packets through workqueue Date: Sat, 22 Oct 2022 09:22:31 +0200 Message-Id: <20221022072502.557784933@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747373978594120129?= X-GMAIL-MSGID: =?utf-8?q?1747373978594120129?= From: Liu Jian [ Upstream commit 4f4920669d21e1060b7243e5118dc3b71ced1276 ] The following warning is displayed when the tcp6-multi-diffip11 stress test case of the LTP test suite is tested: watchdog: BUG: soft lockup - CPU#0 stuck for 22s! [ns-tcpserver:48198] CPU: 0 PID: 48198 Comm: ns-tcpserver Kdump: loaded Not tainted 6.0.0-rc6+ #39 Hardware name: QEMU KVM Virtual Machine, BIOS 0.0.0 02/06/2015 pstate: 80400005 (Nzcv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--) pc : des3_ede_encrypt+0x27c/0x460 [libdes] lr : 0x3f sp : ffff80000ceaa1b0 x29: ffff80000ceaa1b0 x28: ffff0000df056100 x27: ffff0000e51e5280 x26: ffff80004df75030 x25: ffff0000e51e4600 x24: 000000000000003b x23: 0000000000802080 x22: 000000000000003d x21: 0000000000000038 x20: 0000000080000020 x19: 000000000000000a x18: 0000000000000033 x17: ffff0000e51e4780 x16: ffff80004e2d1448 x15: ffff80004e2d1248 x14: ffff0000e51e4680 x13: ffff80004e2d1348 x12: ffff80004e2d1548 x11: ffff80004e2d1848 x10: ffff80004e2d1648 x9 : ffff80004e2d1748 x8 : ffff80004e2d1948 x7 : 000000000bcaf83d x6 : 000000000000001b x5 : ffff80004e2d1048 x4 : 00000000761bf3bf x3 : 000000007f1dd0a3 x2 : ffff0000e51e4780 x1 : ffff0000e3b9a2f8 x0 : 00000000db44e872 Call trace: des3_ede_encrypt+0x27c/0x460 [libdes] crypto_des3_ede_encrypt+0x1c/0x30 [des_generic] crypto_cbc_encrypt+0x148/0x190 crypto_skcipher_encrypt+0x2c/0x40 crypto_authenc_encrypt+0xc8/0xfc [authenc] crypto_aead_encrypt+0x2c/0x40 echainiv_encrypt+0x144/0x1a0 [echainiv] crypto_aead_encrypt+0x2c/0x40 esp6_output_tail+0x1c8/0x5d0 [esp6] esp6_output+0x120/0x278 [esp6] xfrm_output_one+0x458/0x4ec xfrm_output_resume+0x6c/0x1f0 xfrm_output+0xac/0x4ac __xfrm6_output+0x130/0x270 xfrm6_output+0x60/0xec ip6_xmit+0x2ec/0x5bc inet6_csk_xmit+0xbc/0x10c __tcp_transmit_skb+0x460/0x8c0 tcp_write_xmit+0x348/0x890 __tcp_push_pending_frames+0x44/0x110 tcp_rcv_established+0x3c8/0x720 tcp_v6_do_rcv+0xdc/0x4a0 tcp_v6_rcv+0xc24/0xcb0 ip6_protocol_deliver_rcu+0xf0/0x574 ip6_input_finish+0x48/0x7c ip6_input+0x48/0xc0 ip6_rcv_finish+0x80/0x9c xfrm_trans_reinject+0xb0/0xf4 tasklet_action_common.constprop.0+0xf8/0x134 tasklet_action+0x30/0x3c __do_softirq+0x128/0x368 do_softirq+0xb4/0xc0 __local_bh_enable_ip+0xb0/0xb4 put_cpu_fpsimd_context+0x40/0x70 kernel_neon_end+0x20/0x40 sha1_base_do_update.constprop.0.isra.0+0x11c/0x140 [sha1_ce] sha1_ce_finup+0x94/0x110 [sha1_ce] crypto_shash_finup+0x34/0xc0 hmac_finup+0x48/0xe0 crypto_shash_finup+0x34/0xc0 shash_digest_unaligned+0x74/0x90 crypto_shash_digest+0x4c/0x9c shash_ahash_digest+0xc8/0xf0 shash_async_digest+0x28/0x34 crypto_ahash_digest+0x48/0xcc crypto_authenc_genicv+0x88/0xcc [authenc] crypto_authenc_encrypt+0xd8/0xfc [authenc] crypto_aead_encrypt+0x2c/0x40 echainiv_encrypt+0x144/0x1a0 [echainiv] crypto_aead_encrypt+0x2c/0x40 esp6_output_tail+0x1c8/0x5d0 [esp6] esp6_output+0x120/0x278 [esp6] xfrm_output_one+0x458/0x4ec xfrm_output_resume+0x6c/0x1f0 xfrm_output+0xac/0x4ac __xfrm6_output+0x130/0x270 xfrm6_output+0x60/0xec ip6_xmit+0x2ec/0x5bc inet6_csk_xmit+0xbc/0x10c __tcp_transmit_skb+0x460/0x8c0 tcp_write_xmit+0x348/0x890 __tcp_push_pending_frames+0x44/0x110 tcp_push+0xb4/0x14c tcp_sendmsg_locked+0x71c/0xb64 tcp_sendmsg+0x40/0x6c inet6_sendmsg+0x4c/0x80 sock_sendmsg+0x5c/0x6c __sys_sendto+0x128/0x15c __arm64_sys_sendto+0x30/0x40 invoke_syscall+0x50/0x120 el0_svc_common.constprop.0+0x170/0x194 do_el0_svc+0x38/0x4c el0_svc+0x28/0xe0 el0t_64_sync_handler+0xbc/0x13c el0t_64_sync+0x180/0x184 Get softirq info by bcc tool: ./softirqs -NT 10 Tracing soft irq event time... Hit Ctrl-C to end. 15:34:34 SOFTIRQ TOTAL_nsecs block 158990 timer 20030920 sched 46577080 net_rx 676746820 tasklet 9906067650 15:34:45 SOFTIRQ TOTAL_nsecs block 86100 sched 38849790 net_rx 676532470 timer 1163848790 tasklet 9409019620 15:34:55 SOFTIRQ TOTAL_nsecs sched 58078450 net_rx 475156720 timer 533832410 tasklet 9431333300 The tasklet software interrupt takes too much time. Therefore, the xfrm_trans_reinject executor is changed from tasklet to workqueue. Add add spin lock to protect the queue. This reduces the processing flow of the tcp_sendmsg function in this scenario. Fixes: acf568ee859f0 ("xfrm: Reinject transport-mode packets through tasklet") Signed-off-by: Liu Jian Signed-off-by: Steffen Klassert Signed-off-by: Sasha Levin --- net/xfrm/xfrm_input.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/net/xfrm/xfrm_input.c b/net/xfrm/xfrm_input.c index b2f4ec9c537f..aa5220565763 100644 --- a/net/xfrm/xfrm_input.c +++ b/net/xfrm/xfrm_input.c @@ -24,7 +24,8 @@ #include "xfrm_inout.h" struct xfrm_trans_tasklet { - struct tasklet_struct tasklet; + struct work_struct work; + spinlock_t queue_lock; struct sk_buff_head queue; }; @@ -760,18 +761,22 @@ int xfrm_input_resume(struct sk_buff *skb, int nexthdr) } EXPORT_SYMBOL(xfrm_input_resume); -static void xfrm_trans_reinject(struct tasklet_struct *t) +static void xfrm_trans_reinject(struct work_struct *work) { - struct xfrm_trans_tasklet *trans = from_tasklet(trans, t, tasklet); + struct xfrm_trans_tasklet *trans = container_of(work, struct xfrm_trans_tasklet, work); struct sk_buff_head queue; struct sk_buff *skb; __skb_queue_head_init(&queue); + spin_lock_bh(&trans->queue_lock); skb_queue_splice_init(&trans->queue, &queue); + spin_unlock_bh(&trans->queue_lock); + local_bh_disable(); while ((skb = __skb_dequeue(&queue))) XFRM_TRANS_SKB_CB(skb)->finish(XFRM_TRANS_SKB_CB(skb)->net, NULL, skb); + local_bh_enable(); } int xfrm_trans_queue_net(struct net *net, struct sk_buff *skb, @@ -789,8 +794,10 @@ int xfrm_trans_queue_net(struct net *net, struct sk_buff *skb, XFRM_TRANS_SKB_CB(skb)->finish = finish; XFRM_TRANS_SKB_CB(skb)->net = net; + spin_lock_bh(&trans->queue_lock); __skb_queue_tail(&trans->queue, skb); - tasklet_schedule(&trans->tasklet); + spin_unlock_bh(&trans->queue_lock); + schedule_work(&trans->work); return 0; } EXPORT_SYMBOL(xfrm_trans_queue_net); @@ -817,7 +824,8 @@ void __init xfrm_input_init(void) struct xfrm_trans_tasklet *trans; trans = &per_cpu(xfrm_trans_tasklet, i); + spin_lock_init(&trans->queue_lock); __skb_queue_head_init(&trans->queue); - tasklet_setup(&trans->tasklet, xfrm_trans_reinject); + INIT_WORK(&trans->work, xfrm_trans_reinject); } } From patchwork Sat Oct 22 07:22: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: 7340 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1095011wrr; Sat, 22 Oct 2022 01:01:30 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4dt05Qk+I4QhlfyueZvehUk8rR2BwpprFkoL+/Fyu0Rnhhwu3SlOnzZzYclRfZJo5zUIqe X-Received: by 2002:a63:5551:0:b0:461:8bc8:6bdf with SMTP id f17-20020a635551000000b004618bc86bdfmr19424489pgm.453.1666425690121; Sat, 22 Oct 2022 01:01:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666425690; cv=none; d=google.com; s=arc-20160816; b=dZNQTwY/7rHQ+udbe2d0yytM/sbEJPhXYgdUgTKc8mcAprY4TordVf6yGtPVxXQ3e9 +MwAIZyU6AY9y0GEx14KQiKW0gidvwjpLNCSq5DnDb9N5aFXrWeTpXJqS+4LAJZOJBPs CcnvM0JKUy57AqPJo+69Hzecmzp4MhU+18tajbs5HXtTszww3YQBmQgqwb0gMTa85C1O KA4a5OrWJT62V805ghFcOGcEhCPhScPE/IJ5f2Sx1a4fTCgjrYXHORzyVoabzw4aDGEj gBOcJbZ84zzb8u6eebD1wgeN0YxSJ88TmKBcT7PsgXe/lNNHF4KxfBnxvQnqaWM6Qgmh kPFw== 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=hoUERXjGNd2o8CnyFPbMc5XcSFDIi9YpZZfdtR5QjIY=; b=QVeJpajFCkmCoUGadOYjlobDYT9UR1g6UTElOGC4MP21SCGg8GxnJdBvZLq81q2o1E BQOA8urUJbgY42fiUop3G6O1JKfLKbkvDrkeazqrDZM3h9mpXeDpIlQU6SF2uZCPCCye QW1gHZ1k1mDuLQPKwh70OYQ8yXUvxysTaJ5UNAgbNn85i5/3LoYZo7/UjTAIro/R0RUR JZeTM/IhCHRCx4vTlCLrDMzN3AJst2ylqYGNL8T0U6gD299YFbM7yOdxP23uy+TpBIHK 23lI+6d5tc7JkDHUmFBX2kLE7ovnbQxoxf4Kcea/p4kaWOBfu6to99IFRj6rsWRLiK0l A0sw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=sF6wYgmU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 d15-20020a056a0010cf00b005589b36444esi29938543pfu.87.2022.10.22.01.01.17; Sat, 22 Oct 2022 01:01: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=sF6wYgmU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S232479AbiJVH7D (ORCPT + 99 others); Sat, 22 Oct 2022 03:59:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55940 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232130AbiJVHyH (ORCPT ); Sat, 22 Oct 2022 03:54:07 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4BDCE66F35; Sat, 22 Oct 2022 00:47: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 EDA2360B09; Sat, 22 Oct 2022 07:46:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0E731C433C1; Sat, 22 Oct 2022 07:46:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424777; bh=xNMqv/ZsY0vx5mTBDBy94sW1JDIi2qFUa783AYIVEJU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sF6wYgmUJSH5s4ycXf45/Jx2bkcSWnFOhFGPoC+sKQ9JAqah15w2hGE75izZtfMy6 H0Z0/tLdgwBEVmD/n6Unhxf4+PkJsMbJf/bnn6LVodn2v1sVGz1L1zTA/Mu0iP4EB6 xWDctsU3kcb6F/VJv9mFjMjGY61mJ7GNPKKOwCm4= 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 5.19 273/717] netfilter: nft_fib: Fix for rpath check with VRF devices Date: Sat, 22 Oct 2022 09:22:32 +0200 Message-Id: <20221022072502.701219783@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747373984895540578?= X-GMAIL-MSGID: =?utf-8?q?1747373984895540578?= 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 b75cac69bd7e..7ade04ff972d 100644 --- a/net/ipv4/netfilter/nft_fib_ipv4.c +++ b/net/ipv4/netfilter/nft_fib_ipv4.c @@ -83,6 +83,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, nft_in(pkt)); diff --git a/net/ipv6/netfilter/nft_fib_ipv6.c b/net/ipv6/netfilter/nft_fib_ipv6.c index 8970d0b4faeb..1d7e520d9966 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) @@ -197,7 +200,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; nft_fib_store_result(dest, priv, rt->rt6i_idev->dev); From patchwork Sat Oct 22 07:22: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: 7323 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1093680wrr; Sat, 22 Oct 2022 00:58:04 -0700 (PDT) X-Google-Smtp-Source: AMsMyM44CAx8BlkpjaXiIKy7Le3CUSmSZUZBA59AROIoxk5JVIYDokSkl3cwRYkiVkzlUVKql46h X-Received: by 2002:a17:90b:60e:b0:212:d5cd:4e58 with SMTP id gb14-20020a17090b060e00b00212d5cd4e58mr6640646pjb.165.1666425484306; Sat, 22 Oct 2022 00:58:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666425484; cv=none; d=google.com; s=arc-20160816; b=R6159BBHlROaTfUYxF1/71z2YXSHhIuVGtE3LWbU0L4ZiVafaaazR0vgd86AQnpPeC 34Kk1vnYNv4nqJ71/KwRBkZHBuLD4vVN4WApfnkeKemSA/NYRijIXgD6ZKmLCKRK/htM r/VzlCQFcUSJlIscl8eCRrH9q2jHw0sVhddeq5Zsu8qKC8iAwAGyhSmLEk0OXuuhCZ+V P5SqwMRt0K04NTuQBCdEMg+tWQqqbQ5WE5BsRn8VPdntXTk56oOV2rF/N/hy2nBTaLPt 4CJa2aUkSXRRcpPNxX+3eF314v0MupYMwRw6Sl5dOivLtJ7pKQrj724Ikm/DeHXFPdM0 D3Lw== 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=tEkSBIyrMM8I/Mqij1EXkeqWlUrNzogi0o8dd5saoSE=; b=k6jkQaeqAIGdZ8dJzVroV5x/vruS7laMfDwNvxrVJCybxnUwM1y+pR6pVfBnYtXDlk v7j+3rhra93QnIOoxbhV7Ki59oRojsRnp2TlESvc26R1RLt7n1sT1w5Jk1t7fxASGhum wqIrh3nR1xHxROmucX/16Aar/G19NbKr0KbfZhaIQ3HAn2yJ2sJCC3JkgwXSmvH6KyW9 Hxs+2HtR5mXmJVX7OPrr7dwLJLjVHBzg7PYh1EBKoON6xV9o2OXMlQjp1hEvC7drteO3 A0IGK8SUFjXrM09WSwjeswvcKoCSicbrWw0Un0axjX1Je57g7HSOjOO+0Fs9uJ+P7ODK RDDA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=lnsl3KXW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 x12-20020a170902ec8c00b00177ee2efd41si18824166plg.265.2022.10.22.00.57.52; Sat, 22 Oct 2022 00:58: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=lnsl3KXW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231755AbiJVH5e (ORCPT + 99 others); Sat, 22 Oct 2022 03:57:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54854 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232026AbiJVHxk (ORCPT ); Sat, 22 Oct 2022 03:53: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 C583E66F3D; Sat, 22 Oct 2022 00:47: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 90DE560ADA; Sat, 22 Oct 2022 07:46:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9F45EC433D6; Sat, 22 Oct 2022 07:46:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424780; bh=WFKe53kAeWTn6rXCQwWFO44BGTReVqKDgbguBaL8nb4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lnsl3KXWXqQVp2/TOOLDwSJy4YsEp2tzGvBBGtSF/9sVbg368RFonLgXRyWLSJem7 TaGHHURiloVR2jTamkvlPFuxXyV0wkd8Ua/txUeaWQ3KS7N48HaJS1Ago2cm3kLtZD MfZAC0GjmTYZ/HBvsHTbae8iO8g3maZsKiORB35I= 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 5.19 274/717] spi: s3c64xx: Fix large transfers with DMA Date: Sat, 22 Oct 2022 09:22:33 +0200 Message-Id: <20221022072502.830055066@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747373768837178694?= X-GMAIL-MSGID: =?utf-8?q?1747373768837178694?= 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 8fa21afc6a35..b77c98bcf93f 100644 --- a/drivers/spi/spi-s3c64xx.c +++ b/drivers/spi/spi-s3c64xx.c @@ -83,6 +83,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) @@ -663,6 +664,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) @@ -1100,6 +1108,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->use_gpio_descriptors = true; master->dma_alignment = 8; From patchwork Sat Oct 22 07:22: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: 7347 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1095231wrr; Sat, 22 Oct 2022 01:02:10 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5+Qz6/ae7GFAT+XMGGwksERusiWE7uhiqZUBkflGi9Ax8pf0Zn8ZwWIvVrjwgibazf0UTv X-Received: by 2002:a05:6a00:1389:b0:566:1549:c5bc with SMTP id t9-20020a056a00138900b005661549c5bcmr23515099pfg.8.1666425730194; Sat, 22 Oct 2022 01:02:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666425730; cv=none; d=google.com; s=arc-20160816; b=vAz1mzCFr0IjshzPWvL0USiFDvj0CsyKTHSjtni113YHPCT0a5ai7sIcUbTQLxoYkw 6fjlAfD9cv6BGUpZg3kGTG1Sz5ldMl+AxyR4lJQ7FMPL1RoyiecUM+OvR5eLbsNzpsuW Ej/TnsBIS5ZQs68HRFlvQLCnWdF2zDP/jAidTzsUmLlBUFuXqUV/4RT5jj6VxyjNNXRf dG//jnw8ikGbVM8YBzWdx1rwlZVYIZnghOueqxLB+H5lP0oZdlhmIZNGEdWgs/mAxHpb aWHbLZ1kqJ4h40DAySlxvZi5/vflgbm6DS0POmL7djM+9cvq4VbvMZGmAafoVspxBa3Z SImA== 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=pMKLEbKX4OuCwhw/hN4Lvzt2EMqVxFnUC8nvTigy/Fk=; b=W1mJkW30xW8OhUuLCmcq+tV0h4okBSCNLXTBkrVX+RHA4WW6g2bQYhmip17KM7PxyF kZzvz2E7XixZmAN8HsNLAB9jA4MR0Kd+qILW67Y3/BLXzi5Q2mTyLqsVoHi6OWWCZu5R bBw0C9W5offcVWQZ/nBbt9MmY3ynrWfn1mW/PgxY6q4XSSNr6U3f0VhNj0NUFQwgHkRV JWBT+uxwdS3B/c+5yuzMH5cWACRPKmktcw6GH8DYLUUdrSD2u6k+Kubrw46QPjUHbJOK DOIAb7HLhrOq8BS0w4OqWVc8lcJivw3jg/1kZnP+glLOkUTxc4clvSq8ybvQ7azV5n4H dJ0g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=YVK84GHy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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-20020a170902d3c600b001783af487d1si25222027plb.533.2022.10.22.01.01.55; Sat, 22 Oct 2022 01:02: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=YVK84GHy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S232381AbiJVIBQ (ORCPT + 99 others); Sat, 22 Oct 2022 04:01:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42382 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232195AbiJVHyW (ORCPT ); Sat, 22 Oct 2022 03:54: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 3BDA3951C9; Sat, 22 Oct 2022 00:47:25 -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 E83E2B82E1F; Sat, 22 Oct 2022 07:46:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3DFB8C433D6; Sat, 22 Oct 2022 07:46:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424782; bh=u/+7TSvDsljNqBSiPYLaoz8YvmB2nRnkyRvQUBWU3+0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YVK84GHyDIXinA6ZJParbRBOLInosDLhvEUIfRyWjFabsgb5b5dthVHsYuxff6yLe EsADctQkR5m6dP3oAOW23q9TCWhrnC4GaGepxGVJo65RDCHm/wbsF1IOVY0TrPCkJ4 31R4zE85YA6YNKfnPXMeS46eSjunRPHjidAzBbZs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Bitterblue Smith , Jes Sorensen , Kalle Valo , Sasha Levin Subject: [PATCH 5.19 275/717] wifi: rtl8xxxu: gen2: Enable 40 MHz channel width Date: Sat, 22 Oct 2022 09:22:34 +0200 Message-Id: <20221022072502.922263635@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747374026509783758?= X-GMAIL-MSGID: =?utf-8?q?1747374026509783758?= From: Bitterblue Smith [ Upstream commit a8b5aef2cca15b7fa533421d462e4e0a3429bd6f ] The module parameter ht40_2g was supposed to enable 40 MHz operation, but it didn't. Tell the firmware about the channel width when updating the rate mask. This makes it work with my gen 2 chip RTL8188FU. I'm not sure if anything needs to be done for the gen 1 chips, if 40 MHz channel width already works or not. They update the rate mask with a different structure which doesn't have a field for the channel width. Also set the channel width correctly for sta_statistics. Fixes: f653e69009c6 ("rtl8xxxu: Implement basic 8723b specific update_rate_mask() function") Fixes: bd917b3d28c9 ("rtl8xxxu: fill up txrate info for gen1 chips") Signed-off-by: Bitterblue Smith Acked-by: Jes Sorensen Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/3a950997-7580-8a6b-97a0-e0a81a135456@gmail.com Signed-off-by: Sasha Levin --- .../net/wireless/realtek/rtl8xxxu/rtl8xxxu.h | 6 +++--- .../wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 21 +++++++++++++------ 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h index 7ddce3c3f0c4..782b089a2e1b 100644 --- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h +++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h @@ -1425,7 +1425,7 @@ struct rtl8xxxu_fileops { void (*set_tx_power) (struct rtl8xxxu_priv *priv, int channel, bool ht40); void (*update_rate_mask) (struct rtl8xxxu_priv *priv, - u32 ramask, u8 rateid, int sgi); + u32 ramask, u8 rateid, int sgi, int txbw_40mhz); void (*report_connect) (struct rtl8xxxu_priv *priv, u8 macid, bool connect); void (*fill_txdesc) (struct ieee80211_hw *hw, struct ieee80211_hdr *hdr, @@ -1511,9 +1511,9 @@ void rtl8xxxu_gen2_config_channel(struct ieee80211_hw *hw); void rtl8xxxu_gen1_usb_quirks(struct rtl8xxxu_priv *priv); void rtl8xxxu_gen2_usb_quirks(struct rtl8xxxu_priv *priv); void rtl8xxxu_update_rate_mask(struct rtl8xxxu_priv *priv, - u32 ramask, u8 rateid, int sgi); + u32 ramask, u8 rateid, int sgi, int txbw_40mhz); void rtl8xxxu_gen2_update_rate_mask(struct rtl8xxxu_priv *priv, - u32 ramask, u8 rateid, int sgi); + u32 ramask, u8 rateid, int sgi, int txbw_40mhz); void rtl8xxxu_gen1_report_connect(struct rtl8xxxu_priv *priv, u8 macid, bool connect); void rtl8xxxu_gen2_report_connect(struct rtl8xxxu_priv *priv, diff --git a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c index 472b00c70781..5f9d6cce1114 100644 --- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c +++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c @@ -4320,7 +4320,7 @@ static void rtl8xxxu_sw_scan_complete(struct ieee80211_hw *hw, } void rtl8xxxu_update_rate_mask(struct rtl8xxxu_priv *priv, - u32 ramask, u8 rateid, int sgi) + u32 ramask, u8 rateid, int sgi, int txbw_40mhz) { struct h2c_cmd h2c; @@ -4340,10 +4340,15 @@ void rtl8xxxu_update_rate_mask(struct rtl8xxxu_priv *priv, } void rtl8xxxu_gen2_update_rate_mask(struct rtl8xxxu_priv *priv, - u32 ramask, u8 rateid, int sgi) + u32 ramask, u8 rateid, int sgi, int txbw_40mhz) { struct h2c_cmd h2c; - u8 bw = RTL8XXXU_CHANNEL_WIDTH_20; + u8 bw; + + if (txbw_40mhz) + bw = RTL8XXXU_CHANNEL_WIDTH_40; + else + bw = RTL8XXXU_CHANNEL_WIDTH_20; memset(&h2c, 0, sizeof(struct h2c_cmd)); @@ -4621,7 +4626,11 @@ rtl8xxxu_bss_info_changed(struct ieee80211_hw *hw, struct ieee80211_vif *vif, RATE_INFO_FLAGS_SHORT_GI; } - rarpt->txrate.bw |= RATE_INFO_BW_20; + if (rtl8xxxu_ht40_2g && + (sta->deflink.ht_cap.cap & IEEE80211_HT_CAP_SUP_WIDTH_20_40)) + rarpt->txrate.bw = RATE_INFO_BW_40; + else + rarpt->txrate.bw = RATE_INFO_BW_20; } bit_rate = cfg80211_calculate_bitrate(&rarpt->txrate); rarpt->bit_rate = bit_rate; @@ -4630,7 +4639,7 @@ rtl8xxxu_bss_info_changed(struct ieee80211_hw *hw, struct ieee80211_vif *vif, priv->vif = vif; priv->rssi_level = RTL8XXXU_RATR_STA_INIT; - priv->fops->update_rate_mask(priv, ramask, 0, sgi); + priv->fops->update_rate_mask(priv, ramask, 0, sgi, rarpt->txrate.bw == RATE_INFO_BW_40); rtl8xxxu_write8(priv, REG_BCN_MAX_ERR, 0xff); @@ -6343,7 +6352,7 @@ static void rtl8xxxu_refresh_rate_mask(struct rtl8xxxu_priv *priv, } priv->rssi_level = rssi_level; - priv->fops->update_rate_mask(priv, rate_bitmap, ratr_idx, sgi); + priv->fops->update_rate_mask(priv, rate_bitmap, ratr_idx, sgi, txbw_40mhz); } } From patchwork Sat Oct 22 07:22: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: 7349 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1095319wrr; Sat, 22 Oct 2022 01:02:24 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4zg3PPJXIORxmB4TfAsX8PGVBY4K6Z6exiPY/g3BezumCwFrzfD2DtUKmgeR8cAwaGPgLi X-Received: by 2002:a17:902:724b:b0:183:16f:fae4 with SMTP id c11-20020a170902724b00b00183016ffae4mr23428498pll.88.1666425743808; Sat, 22 Oct 2022 01:02:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666425743; cv=none; d=google.com; s=arc-20160816; b=RFjsJR5amnol5sWZB000A78jhBcBJdum1RtXDj+vS+3dmx9C6E0VCaWdAtCdYxpmry EUHzOu6V6JlTLtNYQ4ytJ+u7mrw/t4zQEpavRB0RlBlx624y51ErqIaxC+h6vyFA8r6P iVVrUD+/X7+GjmH1te5X+5Aq/5JHJc7xNPP0UIk2Qh74jW+DsIqoiIdWS4mfdb5Wy66q +vpUUFfDsDVWfySBwwglpqq1Y4DOVrYyDK0qG7Zxrt2gdz1qEVQVMWHNHdqFnlL2d6jw dG9SutjjeH19b5OZSbY4TjnqKH9lC6s0Q+Q6QO9O9MYBwuDiADv7OVj+x5NUYHQ9M2PY 99mg== 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=XTTYSkJlAKmiU/5kYrdMqtu+6fizvv5IXkdcFhS/23g=; b=m2ZhF5axjz+866qsGdrkmZhvgBEAxyPWHtND8N5aHdMyC/slARHrbUGroob2Pq5fEE flfozVpDac2HcRnvCxQqbxIZCVhL3t4W98vfwWM5L1b1K19vEacYvP95VXmZwe0TSE13 uMAQC8HibY4ylVpDDGOoTrpDOw5IVT9jxAak+7hPj3dmBego2OV3OrSJ87/w9hDK67nf d/nZhk32tohcRIF0wZ5AWJfQyEpMSDpds3UH8Eo4bV/Z8M4HIKvKapVBG5oHT4cQ5ySC l9HQL4+4c0EN0npXb1Rdsf9WTCtti/yFQVyOEDhLfBPCkUesWy9Ur27vN4mlO+8Aw00F UXdg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="a/EJbPL9"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 h21-20020a056a001a5500b00562a1cb3661si29650622pfv.272.2022.10.22.01.02.08; Sat, 22 Oct 2022 01:02: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="a/EJbPL9"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S232468AbiJVIBm (ORCPT + 99 others); Sat, 22 Oct 2022 04:01:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39498 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232218AbiJVHy0 (ORCPT ); Sat, 22 Oct 2022 03:54: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 C6534951D8; Sat, 22 Oct 2022 00:47: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 5FEB6B82E17; Sat, 22 Oct 2022 07:46:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C95FFC433D6; Sat, 22 Oct 2022 07:46:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424785; bh=kUpBrIVqSlkp2SOCGgG54sjDPu8ZawxljH/7Mfewagg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=a/EJbPL9p4PN61+z3JkI4qwD6Vs888Kh6WjbO1Al7YnTCBg1imq2NegOV0jz7FQKH EIiwoVgSTVuTPlcORinvekoetKhCiCu3Tze8Sm5G2Anxled4v50lBuHfau/5aQJweg YZeRNjYWp4UMeIUUwqc7jHC7UJyQOElwsqohRDHY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Bitterblue Smith , Jes Sorensen , Kalle Valo , Sasha Levin Subject: [PATCH 5.19 276/717] wifi: rtl8xxxu: Fix AIFS written to REG_EDCA_*_PARAM Date: Sat, 22 Oct 2022 09:22:35 +0200 Message-Id: <20221022072503.020943027@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747374040396067958?= X-GMAIL-MSGID: =?utf-8?q?1747374040396067958?= From: Bitterblue Smith [ Upstream commit 5574d3290449916397f3092dcd2bac92415498e1 ] ieee80211_tx_queue_params.aifs is not supposed to be written directly to the REG_EDCA_*_PARAM registers. Instead process it like the vendor drivers do. It's kinda hacky but it works. This change boosts the download speed and makes it more stable. Tested with RTL8188FU but all the other supported chips should also benefit. Fixes: 26f1fad29ad9 ("New driver: rtl8xxxu (mac80211)") Signed-off-by: Bitterblue Smith Acked-by: Jes Sorensen Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/038cc03f-3567-77ba-a7bd-c4930e3b2fad@gmail.com Signed-off-by: Sasha Levin --- .../wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 49 +++++++++++++++++++ 1 file changed, 49 insertions(+) diff --git a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c index 5f9d6cce1114..57b5370a256b 100644 --- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c +++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c @@ -4560,6 +4560,53 @@ rtl8xxxu_wireless_mode(struct ieee80211_hw *hw, struct ieee80211_sta *sta) return network_type; } +static void rtl8xxxu_set_aifs(struct rtl8xxxu_priv *priv, u8 slot_time) +{ + u32 reg_edca_param[IEEE80211_NUM_ACS] = { + [IEEE80211_AC_VO] = REG_EDCA_VO_PARAM, + [IEEE80211_AC_VI] = REG_EDCA_VI_PARAM, + [IEEE80211_AC_BE] = REG_EDCA_BE_PARAM, + [IEEE80211_AC_BK] = REG_EDCA_BK_PARAM, + }; + u32 val32; + u16 wireless_mode = 0; + u8 aifs, aifsn, sifs; + int i; + + if (priv->vif) { + struct ieee80211_sta *sta; + + rcu_read_lock(); + sta = ieee80211_find_sta(priv->vif, priv->vif->bss_conf.bssid); + if (sta) + wireless_mode = rtl8xxxu_wireless_mode(priv->hw, sta); + rcu_read_unlock(); + } + + if (priv->hw->conf.chandef.chan->band == NL80211_BAND_5GHZ || + (wireless_mode & WIRELESS_MODE_N_24G)) + sifs = 16; + else + sifs = 10; + + for (i = 0; i < IEEE80211_NUM_ACS; i++) { + val32 = rtl8xxxu_read32(priv, reg_edca_param[i]); + + /* It was set in conf_tx. */ + aifsn = val32 & 0xff; + + /* aifsn not set yet or already fixed */ + if (aifsn < 2 || aifsn > 15) + continue; + + aifs = aifsn * slot_time + sifs; + + val32 &= ~0xff; + val32 |= aifs; + rtl8xxxu_write32(priv, reg_edca_param[i], val32); + } +} + static void rtl8xxxu_bss_info_changed(struct ieee80211_hw *hw, struct ieee80211_vif *vif, struct ieee80211_bss_conf *bss_conf, u32 changed) @@ -4679,6 +4726,8 @@ rtl8xxxu_bss_info_changed(struct ieee80211_hw *hw, struct ieee80211_vif *vif, else val8 = 20; rtl8xxxu_write8(priv, REG_SLOT, val8); + + rtl8xxxu_set_aifs(priv, val8); } if (changed & BSS_CHANGED_BSSID) { From patchwork Sat Oct 22 07:22: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: 7354 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1095478wrr; Sat, 22 Oct 2022 01:02:46 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5YvtXAxWZu0rMZ9O3/naW565tvlfEcwW+x7AZ4zGs5xi+knlTnl1583bga4ajZTVPdx+OO X-Received: by 2002:a63:f921:0:b0:46b:18b:fe4d with SMTP id h33-20020a63f921000000b0046b018bfe4dmr19933985pgi.573.1666425766287; Sat, 22 Oct 2022 01:02:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666425766; cv=none; d=google.com; s=arc-20160816; b=tMZzH5812kZAV02FnHUKyF0qcqWrleUsvkVHaAeCkzkRigNMhiKs3TnBoF9hsVgj08 rNC+lBg9c5O1SLGtvioH6wQIjNuOOoD8pu7xXos3t/AFao/2Ysl5j0RK6PO808imqgFF qJq54IYwkUeBTmn04rTh4k16sp3D4Fu47DZqymuVnCox6g6DABlDbG8XKF+LVavyc0J9 gvDTK6tQW+DRcFNkEN/vnkD3TF4TbeR4MepXn7Jq4/m2goASjf80gFRg95PwUhIBWSiT q4KtWb79bjB++OXY0jJMW58/Mlzzih4Q0K9G612QTuCKxvBPsYQAlH8LVYJrjmAPZr45 HVyA== 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=TrJi4IFQSSyIRcOaI4/eWPMMO9CVY6q+RJgai3SVUsg=; b=kE2I3nnOvADO9mBXIVodEpcFnjkficIh9kw0upw4NQbsZvT07giaf8c/OQlBUjter0 HBuM9XykIYG3oO8PY6YHTHl+shPLQuwwql6IR9YF/uU7f2gxxhOlxcbw6WxLiG11jJey Md7RI9ehFE7AJovB/q26SwfSSmDejd/VjZ+LNZaVGxRODbg5SzcyKLf1/pbM6Mq63L46 KCB2NEjvzrI9GgHnyrgIj9CE7R63dofU3LxYPrffvyhP7L3RJ7aaImKs/G3nOpJ2LAK5 CeR8t2uqdcSvi9DY/RS2hbIhK8r7VAjCLbPEAoWc/i7yvqx7WfIR70slvXr5k2pOOSZz MAjw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="VP/Z0QJq"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 me8-20020a17090b17c800b001fd7cab081bsi2608495pjb.125.2022.10.22.01.02.33; Sat, 22 Oct 2022 01:02: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="VP/Z0QJq"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S232543AbiJVICO (ORCPT + 99 others); Sat, 22 Oct 2022 04:02:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43156 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232244AbiJVHyb (ORCPT ); Sat, 22 Oct 2022 03:54: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 E9CCE63D3A; Sat, 22 Oct 2022 00:47: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 04FC9B82DF3; Sat, 22 Oct 2022 07:46:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 723FAC433D6; Sat, 22 Oct 2022 07:46:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424787; bh=qI9liugzN9G0XVfsXLBml/djNWH/lcscIH6cMpNxmU4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VP/Z0QJqSJUdp5Oj1h5vjvZz7wTV0FB6K3m60vkZaOZfpsUUe0PhGdvA1/2yw6ALm TGyz+jRGl5qMzlHeJTq95xxkDm2Ks/Hbc/fURQ+TAmrYPuWVx/ZuGxws70Zqcs+S5p vZ1/WV+AUZKPZQt2yz/fok6paxeJmBCXAeRd2EPY= 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 5.19 277/717] vhost/vsock: Use kvmalloc/kvfree for larger packets. Date: Sat, 22 Oct 2022 09:22:36 +0200 Message-Id: <20221022072503.105679795@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747374064257283568?= X-GMAIL-MSGID: =?utf-8?q?1747374064257283568?= 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 368330417bde..5703775af129 100644 --- a/drivers/vhost/vsock.c +++ b/drivers/vhost/vsock.c @@ -393,7 +393,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 ec2c2afbf0d0..3a12aee33e92 100644 --- a/net/vmw_vsock/virtio_transport_common.c +++ b/net/vmw_vsock/virtio_transport_common.c @@ -1342,7 +1342,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 Sat Oct 22 07:22: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: 7545 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1105888wrr; Sat, 22 Oct 2022 01:36:26 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6qSDFFSc2ASfR6cLFs8rVqYptpk7eEh710lDedgNG9WqoogVdIfL88EgguwrhYu3nPV7vP X-Received: by 2002:a17:902:e9ca:b0:186:8624:9675 with SMTP id 10-20020a170902e9ca00b0018686249675mr4468055plk.76.1666427786564; Sat, 22 Oct 2022 01:36:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666427786; cv=none; d=google.com; s=arc-20160816; b=rN0QUalZ6RfciUiL4Ljl3qxBwAEdCx9Dj2gbtnCN2QijdQHFQpt4gk3eGdxF5HuK+g 3nLcpuhVQ8efz+EOPGMtmpvd47tn86NeyVOrc5r3GcHreAiLebXc4fyABM9qV9H/6Grh Lic+6l/qf/lOeT+DL3yY4XpbgLSzW1i4kQFi8Qh8MYHxz+0IwI/pg0tLAMkhxj34bkEe IViDhLAhXqXkyv4HjvExTX03tRE7m2te4lxbk+e2uSSfHYQ2z4TRFjkcWfVmVGehCufe FgVFCQbpRkMKNooJ9DXOB3uF0ski/DNvYnSCXNuSqAnt9CxxjTv3EN+KU3+OSHTYmn6d Wllg== 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=dRWhc9IrM5i0Z6x5VvW/anGd+5oiVAOqYKSYFU6kae4=; b=errBOOQagatIvViaexYkGeXQr+zjlZtSqZVAtKtKG+8+dXDWS/w1mKc4zPzScchfsF nt9ZDSdjJPyx3RLsXlRmt1C3Lwlu8RBhiD+LtZ3/jNhVRijaRF/unwCimk0zxEwUexFt BHFCUDPwf6W5qXOWagW/LL+cO/g6nqs+hqRtUHL78QHISdJGwGqw2Zue03tpG6DGtXZH odnGtWqt+n7gdYAlmtD9RmuSEckug6V7yURB8uCR1Nct84GzfFfrZIaUfmkHxOlCQidp 7RcKNnC4QNoTbJAImRSPzoK1GfkLInsUaTe0qdKuDgI0d0ZXr4M5F2SVFlILAwWfKRuM zDyQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=0sPKgkrZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 me8-20020a17090b17c800b0020dba4e1b21si11823244pjb.0.2022.10.22.01.36.11; Sat, 22 Oct 2022 01:36: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=0sPKgkrZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S230424AbiJVIRY (ORCPT + 99 others); Sat, 22 Oct 2022 04:17:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37370 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233886AbiJVIPb (ORCPT ); Sat, 22 Oct 2022 04:15: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 5B2982DA752; Sat, 22 Oct 2022 00:56: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 B6E78B82E1A; Sat, 22 Oct 2022 07:46:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0B076C433C1; Sat, 22 Oct 2022 07:46:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424790; bh=RZ6NS0SnC3gnbfETbcJ/j5wvx8/vJ3dE1h7eQRYb3WY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0sPKgkrZ3TZJnjUDyz8hPAOCGn4bnMoaDxXcCx+2SQWVj9/jeKYMe/CGuKkLVM1Yg hdsen7OyeGJFLhjmicQ0wmnSr/wZvCKB2j4m37CcHdV6zjRwquSIqzZu4ZldUqI7KG C5SPFhJaQ9BshLVj+qFS1WBrGPauJn7z+m2wIy/g= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Niels Dossche , Jakub Kicinski , Sasha Levin , Zbynek Michl Subject: [PATCH 5.19 278/717] eth: alx: take rtnl_lock on resume Date: Sat, 22 Oct 2022 09:22:37 +0200 Message-Id: <20221022072503.183456425@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376182397000775?= X-GMAIL-MSGID: =?utf-8?q?1747376182397000775?= From: Jakub Kicinski [ Upstream commit 6ad1c94e1e7e374d88f0cfd77936dddb8339aaba ] Zbynek reports that alx trips an rtnl assertion on resume: RTNL: assertion failed at net/core/dev.c (2891) RIP: 0010:netif_set_real_num_tx_queues+0x1ac/0x1c0 Call Trace: __alx_open+0x230/0x570 [alx] alx_resume+0x54/0x80 [alx] ? pci_legacy_resume+0x80/0x80 dpm_run_callback+0x4a/0x150 device_resume+0x8b/0x190 async_resume+0x19/0x30 async_run_entry_fn+0x30/0x130 process_one_work+0x1e5/0x3b0 indeed the driver does not hold rtnl_lock during its internal close and re-open functions during suspend/resume. Note that this is not a huge bug as the driver implements its own locking, and does not implement changing the number of queues, but we need to silence the splat. Fixes: 4a5fe57e7751 ("alx: use fine-grained locking instead of RTNL") Reported-and-tested-by: Zbynek Michl Reviewed-by: Niels Dossche Link: https://lore.kernel.org/r/20220928181236.1053043-1-kuba@kernel.org Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin --- drivers/net/ethernet/atheros/alx/main.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/net/ethernet/atheros/alx/main.c b/drivers/net/ethernet/atheros/alx/main.c index a89b93cb4e26..d5939586c82e 100644 --- a/drivers/net/ethernet/atheros/alx/main.c +++ b/drivers/net/ethernet/atheros/alx/main.c @@ -1912,11 +1912,14 @@ static int alx_suspend(struct device *dev) if (!netif_running(alx->dev)) return 0; + + rtnl_lock(); netif_device_detach(alx->dev); mutex_lock(&alx->mtx); __alx_stop(alx); mutex_unlock(&alx->mtx); + rtnl_unlock(); return 0; } @@ -1927,6 +1930,7 @@ static int alx_resume(struct device *dev) struct alx_hw *hw = &alx->hw; int err; + rtnl_lock(); mutex_lock(&alx->mtx); alx_reset_phy(hw); @@ -1943,6 +1947,7 @@ static int alx_resume(struct device *dev) unlock: mutex_unlock(&alx->mtx); + rtnl_unlock(); return err; } From patchwork Sat Oct 22 07:22: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: 7344 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1095082wrr; Sat, 22 Oct 2022 01:01:44 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4rM40ZT9gcFgaVrQcP7ei1M42UeRZUSt9eNKwRJSo/M6iW1hXIpwbfJoY6uuJxlFIPMA/9 X-Received: by 2002:a17:902:bd46:b0:17e:8ee5:7b61 with SMTP id b6-20020a170902bd4600b0017e8ee57b61mr23661983plx.44.1666425703937; Sat, 22 Oct 2022 01:01:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666425703; cv=none; d=google.com; s=arc-20160816; b=uz1dcKMa8DrfwALOJ/loxVYD/MfqbfP2Rn6qgsX1ht45JRbZKYlSGWcZmumlt0QCrg qtJfJY7FX6jkiPBLJWthZc6k/tifr2gpqoCPatevSr7Vd5zFQaZad+w8MBE6BeQ4eOHN IebTn2J1HJFS/xepjsLuGwiI8hn4aVVjIJ+GxbiOh5ka7x7LY8+oKYYsl9NRQrHPsT3W uYyWmKIZmKv2JJwaOxbfJgwoyQEdq2gCSeBvz7JGGDY0e2rKWk6WirBZ4lVE3pPS+37B dWjvWsKzd2PoOnrNCqIWl8AC0JcbANf0nQrLLymL5ed7pDLsb49BnWLTT3sF6RXdr46D b4hA== 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=p8l2m2NHhPOpZ8OREbIlejd/CKEhwKGWuFVuNbozv38=; b=r533zUFuAeSfVHO5ZZTGvL18eTzr+HXTswwHqyt2Dmeh8QSZdNBJxB5A4XfGRe30aX RnRptHXaL/7pxJFNMLJ8WU+m8VsjE9n45cBFlab2zBYbVCV97yeuefvl2ToTZy6E895U efbv14L5+bKqzjrKQJfdT3dccZKA4MgzR0Kw66/m/XPgwl3rQI1c5lylrn/qNWQNr0tq Zb6cZlxhKBpbcmusVYa/tLG2IZD5cNVg8DqFUvB8P2TfI4Jw3Y2+vAbnt7mqo0fDj1Ns hQUWlLRotq/7+6/u6sMLRg0n/2w6Zt9V/8noM3ELg5mp6K8VOw7PwTY/wHQR7K2TOKfr KeFQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Ed9HtI76; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 nb12-20020a17090b35cc00b002009d750a2dsi1981377pjb.58.2022.10.22.01.01.30; Sat, 22 Oct 2022 01:01: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=Ed9HtI76; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S232546AbiJVH7K (ORCPT + 99 others); Sat, 22 Oct 2022 03:59:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57484 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232152AbiJVHyK (ORCPT ); Sat, 22 Oct 2022 03:54: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 8961A165C86; Sat, 22 Oct 2022 00:47: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 5D11660AC7; Sat, 22 Oct 2022 07:46:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 71317C433D6; Sat, 22 Oct 2022 07:46:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424795; bh=1vk9cCfPuQn9h6X3LRfdcgmD8iNffBsmLEgziE8/sDQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ed9HtI76yHNAaDwoPru4wIoyZqjOkZ8TejFPq+2PkQRPR3/6Yqaj9n7BGvO0ctwQl lU7Ht6RY+I6PTCkMYT62Fn3Ke7E6QFV4O4XeF8IVusrQ0YnxUhcxNB4eTHEXFvg/At 308/9yWX17jxvzqYbvrAoGGQbj4eAN5gkE+OAq+Y= 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 5.19 279/717] mISDN: fix use-after-free bugs in l1oip timer handlers Date: Sat, 22 Oct 2022 09:22:38 +0200 Message-Id: <20221022072503.291343145@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747373998552424582?= X-GMAIL-MSGID: =?utf-8?q?1747373998552424582?= 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 2c40412466e6..a77195e378b7 100644 --- a/drivers/isdn/mISDN/l1oip_core.c +++ b/drivers/isdn/mISDN/l1oip_core.c @@ -275,7 +275,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; @@ -601,7 +601,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 */ @@ -1232,11 +1234,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 Sat Oct 22 07:22: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: 7359 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1095626wrr; Sat, 22 Oct 2022 01:03:11 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7AMdw1JA72+HxZoFfsZmn0/ZtgMEEj3U25tYOUz1kitnJg5Ti/QLmTMZr988N3Lgt6q8WS X-Received: by 2002:a17:903:2347:b0:181:33f0:f64e with SMTP id c7-20020a170903234700b0018133f0f64emr24026908plh.106.1666425791222; Sat, 22 Oct 2022 01:03:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666425791; cv=none; d=google.com; s=arc-20160816; b=PXZI4Sffpj/F3t6C9tPPnR1jR6+4S3Bt0X80pjPBr9ABM2GJdZtXxHJXPs+dnODZlA QcluJiDTjDmFc6EM3mPoruiZnt8XwEyH8jCMECx7QKRm0oRHbeTng7BXUIATIP306Qbo DGupE9Nu/cIRjfH7b8w+mYfvWMSxfEp5Y7M57URi5DPLPMx5SqsDjwtueH5hSDXyDLny e1V9aeOR5xCdqQtNiJ62CX+k/XktOGFFkp3dvmNTwIyZYTFASomL4x0NMT9IT8Pu1JGp 43oGydEGyWSSTbnuVIOYiCghc6p2zePmZKZWbbNDdtvGLnyfPU6ArycIIrIVEhE7CGlf ywKw== 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=g9z8YdGt90JpK2hCM+zsBv3a81ZKd8cUT021uMxF+YI=; b=GMUMJNNK5rUZyo+jVUXNSMb4ng1nMccZl1fDA2jGtU00CA3SQKX3GzBVqRjyEuuQPW EIlgtemi3iWbNHXb1a5IJCXJvqB/cYjYQYcR92cPMXn7FjOI483AiZgbAOw9U7Ibirlx stckoSOwRGuFgaFo/qs4pUifBh9rjdpnxzHrzJqgD6e+4aRgs8mqprWAwLwOayNIuMGb xK97oVOFoecmOgiCTBYMbaofG3Lu7hRHmKMMIu0AdDluj+u2E224kEvqa4j9s8Zo8yrS 4Lw6pm4I4p+Xd2MofgdrlITw/OZJiNwHUfeKn32/cOU8G2m24EN87EntrXha11if5tPK J3ng== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=B0sEyyis; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 c127-20020a633585000000b0041aaa841692si33663227pga.108.2022.10.22.01.02.58; Sat, 22 Oct 2022 01:03: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=B0sEyyis; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S232588AbiJVICi (ORCPT + 99 others); Sat, 22 Oct 2022 04:02:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47390 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232301AbiJVHyj (ORCPT ); Sat, 22 Oct 2022 03:54: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 6C4EF951F8; Sat, 22 Oct 2022 00:47: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 A268AB82E21; Sat, 22 Oct 2022 07:46:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0EAF1C433D6; Sat, 22 Oct 2022 07:46:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424798; bh=jOc7LW7IWzijjP0DhfLG0KzytqA6AuX/PkOEIoEOpsI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=B0sEyyisHfz028LOIqlDOr8exRAAq+I6Q9n5IMQPbcM7wZu7ECXIbkiyRKKwE8Mz+ idRsZHehtujP2Z0OhVRmg/VcXmMDOgK+SfW1LInJUO+++kM1t+iEhlZ8+ldZs03Fau qcfgRz6kn0Dp6tWSLqdZkJAMhjLVvDjhxdK98Gn8= 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 5.19 280/717] sctp: handle the error returned from sctp_auth_asoc_init_active_key Date: Sat, 22 Oct 2022 09:22:39 +0200 Message-Id: <20221022072503.424041248@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747374090323785683?= X-GMAIL-MSGID: =?utf-8?q?1747374090323785683?= 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 db6b7373d16c..34964145514e 100644 --- a/net/sctp/auth.c +++ b/net/sctp/auth.c @@ -863,12 +863,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; } @@ -902,8 +907,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 Sat Oct 22 07:22: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: 7367 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1095902wrr; Sat, 22 Oct 2022 01:03:44 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5gg7wKsSKWu4I0cazhpID5ZD2oVHmkHlezAYRhajtUI3Yd5Q8GxmemAP+tp7w5XyF+oyw0 X-Received: by 2002:a63:4e66:0:b0:456:b3a7:7a80 with SMTP id o38-20020a634e66000000b00456b3a77a80mr19110190pgl.467.1666425824288; Sat, 22 Oct 2022 01:03:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666425824; cv=none; d=google.com; s=arc-20160816; b=cyvloWpgyNAuLJ6OfdtN5LcRfQwWw8hMOmA96EnUtLS+mDzV90MrZcSaUI66DKng5t 323/qkEeYNgpPHqcPZGThJxwk4kJ+EqmPYULM0/7shpnXu8SdpUV0rxsrixqi/emjgVR 783w8iTkf56hKA2g5DMxkZT06YmjOe6nMUDBvYdLPVtfT78W7/p/7aBOMrUUdb+lEfBI 4SpxTlKxZ0+mY+VCNOtvHzK5LNIycQbJ/hLlAV5zRryQfi3exrfvg21y04goX36BvYqd FV7KZy6R4F8JO0b2utUypoYE4YOaFMgl49UMp1UWYdR6El3Z7HJ7mCConj9iDHvAq1rE +E4A== 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=Ww6W2wzWF9XrXMmEd+aTVZUrUmxleOhDQLQfFRHqTjw=; b=k4n7bUtuLlr6lp2uursmfOueQY1tfOpVPVJo2UuwJQDHhD2sBC5mXqMXCiAGU/WGhP AC7wM8y/iaMlTFuPI8B3SzS/JVBqazUKqc5j11APDIuw7KcYJxzlW69d60ScB57I94fW NyKAkR6I0lKhIRoQCgawbVAqpMvfcIhuuCa6TY3CPTr9lufKb2AzasGyIQCO7TJN9vXM UEMYP5EKAks9fi0FN9nz0u3IksFDMMjvV9nik7XTGfCaFy/9jqo5UDP/4+6F656PSQJJ eG/O7uPJ51T/zwH9FgRJJ334Dku5kH/mVOO5ZyVSB7mmlli0pV7b5EUBj0a6bktTccS4 Lpxg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=CFNYtnh9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 a192-20020a6390c9000000b0046af665ed92si2005164pge.480.2022.10.22.01.03.31; Sat, 22 Oct 2022 01:03: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=CFNYtnh9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S232637AbiJVIDL (ORCPT + 99 others); Sat, 22 Oct 2022 04:03:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47414 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232408AbiJVHyz (ORCPT ); Sat, 22 Oct 2022 03:54: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 851D2356D5; Sat, 22 Oct 2022 00:47: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 45D00B82E0C; Sat, 22 Oct 2022 07:46:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A7CA1C433C1; Sat, 22 Oct 2022 07:46:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424801; bh=Ru4G+3ge//H9NJZQ0OiqM6QGQaZIT8gVzXirC+yW40U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CFNYtnh9t8AMlbNi/4lgEgqedKr6w0QzY1XEjHFAtUlDsFnRxFQi4qoYSoOJ+fjwC P2yjwJQBicmGXGCGqlX5EqhzKQz/r206eC3fkQHuntvvoht6NrQYKx95840WUJJuVs e2WT/3+3Y0OM6wLNdvzvncNH7+P7j9wwjOhTQ7oQ= 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 5.19 281/717] tcp: fix tcp_cwnd_validate() to not forget is_cwnd_limited Date: Sat, 22 Oct 2022 09:22:40 +0200 Message-Id: <20221022072503.542307241@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747374125266306726?= X-GMAIL-MSGID: =?utf-8?q?1747374125266306726?= 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 1168302b7927..bb31d60addac 100644 --- a/include/linux/tcp.h +++ b/include/linux/tcp.h @@ -265,7 +265,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 78a64e1b33a7..788b1f17b5e3 100644 --- a/include/net/tcp.h +++ b/include/net/tcp.h @@ -1289,11 +1289,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 tcp_snd_cwnd(tp) < 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 ab03977b6578..f82cd6eb7088 100644 --- a/net/ipv4/tcp.c +++ b/net/ipv4/tcp.c @@ -3042,6 +3042,8 @@ int tcp_disconnect(struct sock *sk, int flags) tp->snd_ssthresh = TCP_INFINITE_SSTHRESH; tcp_snd_cwnd_set(tp, TCP_INIT_CWND); 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 84314de754f8..a16139cacc45 100644 --- a/net/ipv4/tcp_output.c +++ b/net/ipv4/tcp_output.c @@ -1875,15 +1875,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 Sat Oct 22 07:22: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: 7351 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1095396wrr; Sat, 22 Oct 2022 01:02:36 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6r4Q/QUv8PQszHKs1OZDvqHCLrs0OaleUg8JT/jIjjLjd9/czeh91zJh1+kO124mvCdwAK X-Received: by 2002:a05:6a00:1da1:b0:563:2e07:db1b with SMTP id z33-20020a056a001da100b005632e07db1bmr22964990pfw.22.1666425756087; Sat, 22 Oct 2022 01:02:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666425756; cv=none; d=google.com; s=arc-20160816; b=NzBVeXWVcAuEvACGC6PTqOAZhubMBvZn4eD4Z4nrrAdPXKxgbv5g4lhdDRxH2hOUma 61XQ41FQk/P2Lou5K5cQ8r1Td56xQej7Yj+idLZNvp6HRv8hbYrrLX2n7oQxEZQD31wK UoVc2eu2WC6E6wys1MI5oWTSSWzHKguBRxQ/N7cJ/ibHyg51D+5ySrJqDI7rmxA6BaCY PzZRNt4nOo3aWNvDavABnZzpX+6AHdiMFYVjBRBiiYTtymTuqJKoFwv/71Z6oGB096L7 GRdolBaE0CNhi7BtGTZPbxjsnpBINl6Qq97yFhKSygZYor04Pmyi9loGzLmxpoBWctbY Q63g== 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=INTi5KWJdpM4tZdt+qWRvfUpk5Hv/Po257sPG9nLI7c=; b=gcibMpghBV7Bm5owMsyJHWZhbcP2vEmxv2FQafgB+Uu4apwBv9U9+X2NfX35FAJGwt MOuzbgfo4s4OF81V8VbHzsArS+HyZpOzEAvBZ5EeQhpjSUb2pF5oU+/oFhrv+jZRdYPk T30WntL6aPEF1bxl4+DQM6cxSjPQfIaeX2sQKx61h6y+HKV2uPTMzuvEVhZJZCm4ym9h OL1eBJqsxLMACzDAgbLbRT3z1KAYIOhZvutwcz97FhRKDqOkOScV4wUGtQmjC5tLsTs7 yGFDESthmLJAv1K40u0IYTxonBhM4EaDGgE59poo3WYgwtepVkRd3Kq7AAV37Glb+Htg PsXw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=D58ohirG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 z14-20020a170902d54e00b00183f6ff535dsi27364410plf.490.2022.10.22.01.02.22; Sat, 22 Oct 2022 01:02: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=D58ohirG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S232410AbiJVIB5 (ORCPT + 99 others); Sat, 22 Oct 2022 04:01:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42802 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232230AbiJVHy1 (ORCPT ); Sat, 22 Oct 2022 03:54:27 -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 7752829F66F; Sat, 22 Oct 2022 00:47: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 3AA8360B1A; Sat, 22 Oct 2022 07:46:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 51428C433D7; Sat, 22 Oct 2022 07:46:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424803; bh=e9rDTZzYaQS3sxO5Dhrp00pJNaqgumzz+ILinbeYFx8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=D58ohirG3xCE3YJnevGLIqRqMu7saGDKd7JD/a/vvML7mzrT7yvt2y4Zcx4c1ahFq /2UYfB52fcvrZan+/j84+vlq4atguenM8LZC5SpTEmngyM3H/0zY7SgcHTRMHKsuB8 tppqaM7CbofXIIomdvfTZcKzX7QoHikXxb90YDmA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Marek Szyprowski , Mark Brown , Sasha Levin Subject: [PATCH 5.19 282/717] spi: Ensure that sg_table wont be used after being freed Date: Sat, 22 Oct 2022 09:22:41 +0200 Message-Id: <20221022072503.655201205@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747374053198298532?= X-GMAIL-MSGID: =?utf-8?q?1747374053198298532?= From: Marek Szyprowski [ Upstream commit 8e9204cddcc3fea9affcfa411715ba4f66e97587 ] SPI code checks for non-zero sgt->orig_nents to determine if the buffer has been DMA-mapped. Ensure that sg_table is really zeroed after free to avoid potential NULL pointer dereference if the given SPI xfer object is reused again without being DMA-mapped. Fixes: 0c17ba73c08f ("spi: Fix cache corruption due to DMA/PIO overlap") Signed-off-by: Marek Szyprowski Link: https://lore.kernel.org/r/20220930113408.19720-1-m.szyprowski@samsung.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- drivers/spi/spi.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c index 2c616024f7c0..f595e516058c 100644 --- a/drivers/spi/spi.c +++ b/drivers/spi/spi.c @@ -1047,6 +1047,8 @@ void spi_unmap_buf(struct spi_controller *ctlr, struct device *dev, if (sgt->orig_nents) { dma_unmap_sg(dev, sgt->sgl, sgt->orig_nents, dir); sg_free_table(sgt); + sgt->orig_nents = 0; + sgt->nents = 0; } } From patchwork Sat Oct 22 07:22: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: 7338 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1094980wrr; Sat, 22 Oct 2022 01:01:24 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5YFw/NjWMdLg/3NNc6qoMFTQh3eqepIUbLkYN+IRkP09v3SzXfKOMKei5Pi92VLlO5tyER X-Received: by 2002:a65:4084:0:b0:463:aa4:49cf with SMTP id t4-20020a654084000000b004630aa449cfmr19355209pgp.164.1666425684063; Sat, 22 Oct 2022 01:01:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666425684; cv=none; d=google.com; s=arc-20160816; b=X3CXkNgAnwM7MfbMevq39Q0GN84aMwfHfLuwlFh5putkv0q+PHVSmXwSr6mQvCrE3x lBhWkoNZLbA8dNWN6sPqfr7metsiASbS/zKu6pVX5jH4XLAk8dynwY7eLmXv3m9I0UPI fvDkbDZvHTDMNvSGNtwKdva0Kxp8fqkgvpDSu3JNBSfY0X5pIy9MoZjn6egDwCzSgX/f mz2ZkO66zJdXUaZoqCbhXgTcp9Cu/KtOxEfX1+WVMcKIqRja6OiUBaEVXQnfGacNTUca hIsDcRVKtJ/CUkyEedOWG3e8H2xjxFGTzjSoNyzkTwYIxhn9CYAmzGoSvjl07tQESvVH BcFw== 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=QhwF28PKyH+cRS9JLvlEQN/qC87RoYCVF0Y8Rhbrq3s=; b=acNyc1GrQHUTHnH97FJEm2AZrtQPfbE06vyRQpBXROyKO3o0E5erovKJawEhBw2oT5 YIFn5oF57r351ne/jDJTN1zpLxfNPWwiO5rglQqG7erni2eQCOW2Ok5DIyv5fKui0oeq Js7p4o41W3yMBRCQSbDwoy4Afm5SK4KpSn3EBtmGhNpoB2/0gxwsi3NV4M/a/wpqDAjM hSkcoplZioyUi7RtoWT5HKp6Xoj95NDrKtVwhIQZ7WmH2dY2Yn1uVvacHJn4zhzEX9AP NaIh5jirBduVzoj20utCYyrmznOybFdHLUDgL0cxToWl8SVOH8aUp4iOJ7YPebFrnjDu g4ag== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=XAvZbU9N; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 t20-20020a634614000000b00438806c7b2bsi25729477pga.154.2022.10.22.01.00.54; Sat, 22 Oct 2022 01:01: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=XAvZbU9N; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S232579AbiJVH7N (ORCPT + 99 others); Sat, 22 Oct 2022 03:59:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58264 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232157AbiJVHyN (ORCPT ); Sat, 22 Oct 2022 03:54: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 5EC3D2C6EA8; Sat, 22 Oct 2022 00:47: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 D4FAA60AFD; Sat, 22 Oct 2022 07:46:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E7D5DC433C1; Sat, 22 Oct 2022 07:46:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424806; bh=W0IX97rDbejV5O6XzcEziQT2bEP4ZyIT4QwCqP1mfbo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XAvZbU9Nuog+vRWdKm1VUh3LC9rXk5f/Ivq6EdYkkJ2k9BMEEGpReDkb5KiA3L+oC gtV1ZPK52gvd7KGE0yDkJbTyVUa8h9DkDUXwA35RxfNjkw6wAjsNBQSQ9hklRigZJf R8B7y67XvgbiIhc6xbHP24Md97pmlwsHdrqdEbZ0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Luiz Augusto von Dentz , Tedd Ho-Jeong An , Sasha Levin Subject: [PATCH 5.19 283/717] Bluetooth: hci_sync: Fix not indicating power state Date: Sat, 22 Oct 2022 09:22:42 +0200 Message-Id: <20221022072503.834302003@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747373978302197148?= X-GMAIL-MSGID: =?utf-8?q?1747373978302197148?= From: Luiz Augusto von Dentz [ Upstream commit 6abf0dae8c3c927f54e62c46faf8aba580ba0d04 ] When setting power state using legacy/non-mgmt API (e.g hcitool hci0 up) the likes of mgmt_set_powered_complete won't be called causing clients of the MGMT API to not be notified of the change of the state. Fixes: cf75ad8b41d2 ("Bluetooth: hci_sync: Convert MGMT_SET_POWERED") Signed-off-by: Luiz Augusto von Dentz Tested-by: Tedd Ho-Jeong An Signed-off-by: Sasha Levin --- net/bluetooth/hci_sync.c | 1 + 1 file changed, 1 insertion(+) diff --git a/net/bluetooth/hci_sync.c b/net/bluetooth/hci_sync.c index 3b4cee67bbd6..a7c0cd2fabfb 100644 --- a/net/bluetooth/hci_sync.c +++ b/net/bluetooth/hci_sync.c @@ -4033,6 +4033,7 @@ int hci_dev_open_sync(struct hci_dev *hdev) hci_dev_test_flag(hdev, HCI_MGMT) && hdev->dev_type == HCI_PRIMARY) { ret = hci_powered_update_sync(hdev); + mgmt_power_on(hdev, ret); } } else { /* Init failed, cleanup */ From patchwork Sat Oct 22 07:22: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: 7342 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1095028wrr; Sat, 22 Oct 2022 01:01:33 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5G3TQOqQZIs4p18281wzP410MKfnO+/xHPVkiTCbBAnDBXAmRDnU8WGvGhT7lmYa/H0AdN X-Received: by 2002:a17:902:f643:b0:185:50e4:f55e with SMTP id m3-20020a170902f64300b0018550e4f55emr22835865plg.156.1666425682579; Sat, 22 Oct 2022 01:01:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666425682; cv=none; d=google.com; s=arc-20160816; b=Pj6wLeHcFA2rgvilBSc/MYFqu/5MHlX7tGLE8761xJX3t+gRzNt9V5ZZV86HpUaR9l OKikNdUBcNM1BPDK38WYCadIBw9G6B7iCPexU9WJKWnKcAGGndy199WmuTOfztFwPqQr S3GsLxISMIRqpOEfyh/rVcVZBkPVBuenFlNQzPxntOWjKeBsubD/1fWVBz1evIdlgrEH ZuJ23a+dB04n12mIwep5QdfCbi9jZfDbZm7LELIwlkIBsI+EMl5ck3zG+XHFnOiXeR5e MCnjD8Q3GO/f7x5TAkEm4+MsW0CNS7+Ojdd6KRip1mRQKmdAAYgLeY7oB2bLmZg3n1qG sxBA== 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=2Zbb8w+LmaZVDpJVt0ahQZ3eHBRJJKPNOm/xBC0g4yQ=; b=EwGzjE5nAsYR7gOuY8KB0nDAfm0oDxKlfqK8ATFBg9gfWphzza/zC9BVxSM8Wi08+o cmDYnszKwU771ANV+MKnXeb5gslANUglXh5J7tNdqsJ7vPLJAnlpSBA7bUmO54vXK0dr TgleUNsjEQ8L0LOoMMnSQa7vFVmL2exIFJollZTQoddhsR9520TTufsSGJd1LIsWvrDC nOxKGl4zzZtAABIs+MO9ROP/RLHIRAxWcMrIQy7i7AI+kUVEFs0eIiNXVKoSPcjSzCE5 vOm191srkfxI7TYySFbFTGR3Em4XIJCHaSM35u44YCLFhpnFNkCwHts7wG+Oym8rVBJ5 2g4w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=vPC8xjyH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 nu18-20020a17090b1b1200b001fd7ae1ae32si2362380pjb.126.2022.10.22.01.00.59; Sat, 22 Oct 2022 01: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=vPC8xjyH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231824AbiJVIAl (ORCPT + 99 others); Sat, 22 Oct 2022 04:00:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54872 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232172AbiJVHyS (ORCPT ); Sat, 22 Oct 2022 03:54:18 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9E4022C6EB3; Sat, 22 Oct 2022 00:47: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 7A6B160B0A; Sat, 22 Oct 2022 07:46:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8E86CC433C1; Sat, 22 Oct 2022 07:46:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424808; bh=HZaN/LuBXVRxq6KpjERBiJycbpJDZKdsXB0MQGoEFeE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vPC8xjyHCw+HeiP4cYdzHApKvrmsBwDCBxaHn7vIdOj/Gvf5qyCoDi6pNnoBMm59K ri5JRhiGSIbPTDu9PmX2jDUYy844Xnhzkj6sk2iRAlnwAWvtlonRFE6VY6FC++2YF9 t56iCNEMIsmDbIF0xVDh9uXILH6gRyNgQR+3P7qk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Oleksandr Shamray , Vadim Pasternak , Guenter Roeck , Sasha Levin Subject: [PATCH 5.19 284/717] hwmon: (pmbus/mp2888) Fix sensors readouts for MPS Multi-phase mp2888 controller Date: Sat, 22 Oct 2022 09:22:43 +0200 Message-Id: <20221022072503.950265706@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747373976498436798?= X-GMAIL-MSGID: =?utf-8?q?1747373976498436798?= From: Oleksandr Shamray [ Upstream commit 525dd5aed67a2f4f7278116fb92a24e6a53e2622 ] Fix scale factors for reading MPS Multi-phase mp2888 controller. Fixed sensors: - PIN/POUT: based on vendor documentation, set bscale factor 0.5W/LSB - IOUT: based on vendor documentation, set scale factor 0.25 A/LSB Fixes: e4db7719d037 ("hwmon: (pmbus) Add support for MPS Multi-phase mp2888 controller") Signed-off-by: Oleksandr Shamray Reviewed-by: Vadim Pasternak Link: https://lore.kernel.org/r/20220929121642.63051-1-oleksandrs@nvidia.com Signed-off-by: Guenter Roeck Signed-off-by: Sasha Levin --- drivers/hwmon/pmbus/mp2888.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/drivers/hwmon/pmbus/mp2888.c b/drivers/hwmon/pmbus/mp2888.c index 8ecd4adfef40..24e5194706cf 100644 --- a/drivers/hwmon/pmbus/mp2888.c +++ b/drivers/hwmon/pmbus/mp2888.c @@ -34,7 +34,7 @@ struct mp2888_data { int curr_sense_gain; }; -#define to_mp2888_data(x) container_of(x, struct mp2888_data, info) +#define to_mp2888_data(x) container_of(x, struct mp2888_data, info) static int mp2888_read_byte_data(struct i2c_client *client, int page, int reg) { @@ -109,7 +109,7 @@ mp2888_read_phase(struct i2c_client *client, struct mp2888_data *data, int page, * - Kcs is the DrMOS current sense gain of power stage, which is obtained from the * register MP2888_MFR_VR_CONFIG1, bits 13-12 with the following selection of DrMOS * (data->curr_sense_gain): - * 00b - 5µA/A, 01b - 8.5µA/A, 10b - 9.7µA/A, 11b - 10µA/A. + * 00b - 8.5µA/A, 01b - 9.7µA/A, 1b - 10µA/A, 11b - 5µA/A. * - Rcs is the internal phase current sense resistor. This parameter depends on hardware * assembly. By default it is set to 1kΩ. In case of different assembly, user should * scale this parameter by dividing it by Rcs. @@ -118,10 +118,9 @@ mp2888_read_phase(struct i2c_client *client, struct mp2888_data *data, int page, * because sampling of current occurrence of bit weight has a big deviation, especially for * light load. */ - ret = DIV_ROUND_CLOSEST(ret * 100 - 9800, data->curr_sense_gain); - ret = (data->phase_curr_resolution) ? ret * 2 : ret; + ret = DIV_ROUND_CLOSEST(ret * 200 - 19600, data->curr_sense_gain); /* Scale according to total current resolution. */ - ret = (data->total_curr_resolution) ? ret * 8 : ret * 4; + ret = (data->total_curr_resolution) ? ret * 2 : ret; return ret; } @@ -212,7 +211,7 @@ static int mp2888_read_word_data(struct i2c_client *client, int page, int phase, ret = pmbus_read_word_data(client, page, phase, reg); if (ret < 0) return ret; - ret = data->total_curr_resolution ? ret * 2 : ret; + ret = data->total_curr_resolution ? ret : DIV_ROUND_CLOSEST(ret, 2); break; case PMBUS_POUT_OP_WARN_LIMIT: ret = pmbus_read_word_data(client, page, phase, reg); @@ -223,7 +222,7 @@ static int mp2888_read_word_data(struct i2c_client *client, int page, int phase, * set 1. Actual power is reported with 0.5W or 1W respectively resolution. Scaling * is needed to match both. */ - ret = data->total_curr_resolution ? ret * 4 : ret * 2; + ret = data->total_curr_resolution ? ret * 2 : ret; break; /* * The below registers are not implemented by device or implemented not according to the From patchwork Sat Oct 22 07:22: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: 7360 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1095636wrr; Sat, 22 Oct 2022 01:03:12 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7IgO2WvG25+up/5JpuBWXdQwUD8NVzQz54MjiHrsi6Ci1fTJn7f+clXC69azI8M9ij2iCg X-Received: by 2002:a17:902:ccc4:b0:186:6fcb:3fcf with SMTP id z4-20020a170902ccc400b001866fcb3fcfmr10016401ple.100.1666425792089; Sat, 22 Oct 2022 01:03:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666425792; cv=none; d=google.com; s=arc-20160816; b=sCQfck6yKczgqmhCzWmgp3K0++SfaLnxptZ7G/P9UCB4pK5iRFLuENSy5awtl/JEXn SizVWBd5VPkk/W5jcfPJVn2VWSFLKJP35DVFII6Vk0JCQsfMoSPZ0t2JAY8lXTC2CaFr 6V9mkUL+YjM6D5dLIoEPkxyqvh8hniivQ4NFJPfpLDhIFpqI7bRLKEkYGiZcSLCBZ0EE T3L6Sxo0DFamBpr56kz//HAyEBaclsACvthb6Y15hkO2pul2kpaj7t+d/yXkIF+7SY4l 54Oua3EePexYoc6qsQmvR4flE7mw4n1bkqHKwNZmMPXRc15asYFkBoQv3tTzG0tC2WVL D9aQ== 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=x49Iyp1n8uAaMK7VPCIDJHRf1Fld/cAWjRw6nf6Gsl4=; b=QDAceMy5nMtO6UihTTMEZsEHqqQ6e18aeVGNyudAHTRY27/lphI/2wKlfqYWWXowAK GOgNsehidfTWX80Aak3mlVmC92+TjeaBIU9IoXsa0Kc8uiOJ/Vc12YtEHYqWb6Jw4T6r lt5sIVitFuO5W/7SP/gvuDtjS59M2NwEZJCy/R3RfdwXXEy7PHBKukGCCzu8JvS7PGGW x5CwHYTDHZvwiEbwNDSmurwj5pTqyVACrRD3kFfWiMP58M4t2jxOSZKcJaBJAm7oHD9e pVGvlLoe/m2TEEuaKK0nCNrAv47MTmcf9Y6ee09pBNIS7P02yZs4sUscXNYYrLSQR7GZ +w4Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ywPS4zMZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 t5-20020a656085000000b004594e9f9b10si28799298pgu.188.2022.10.22.01.02.58; Sat, 22 Oct 2022 01: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=ywPS4zMZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S232557AbiJVICZ (ORCPT + 99 others); Sat, 22 Oct 2022 04:02:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56532 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232259AbiJVHyc (ORCPT ); Sat, 22 Oct 2022 03:54: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 56898951DD; Sat, 22 Oct 2022 00:47: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 ams.source.kernel.org (Postfix) with ESMTPS id D01BEB82E26; Sat, 22 Oct 2022 07:46:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2C244C433D6; Sat, 22 Oct 2022 07:46:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424811; bh=epD93SGW1hEwjy9oseb8+CuhtM2ecZygpN9U7N9We9Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ywPS4zMZ/6X4YWGwM2IrX3BTE3NIcg11AHLA0sPpcIYBqZ/8Hsmr41wen4RxM1f23 2lGm58BGggot5DkkAWl3MN2B1PxOjyTkxfYTzGy0bZCpzkEwbEhIUhybLyBmEgdIiL CvSrn/AnhK+jzGKgA9FPUj7uYfV/XG3Qi3f35z90= 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 5.19 285/717] net: rds: dont hold sock lock when cancelling work from rds_tcp_reset_callbacks() Date: Sat, 22 Oct 2022 09:22:44 +0200 Message-Id: <20221022072504.078542538@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747374091288907633?= X-GMAIL-MSGID: =?utf-8?q?1747374091288907633?= 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 73ee2771093d..d0ff413f697c 100644 --- a/net/rds/tcp.c +++ b/net/rds/tcp.c @@ -166,10 +166,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 Sat Oct 22 07:22: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: 7346 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1095153wrr; Sat, 22 Oct 2022 01:01:55 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5I244VR+e8tPPIxPZUKKUStDbFsuk5Rh1LBt69Kafck8Cq7orym48DJ+AnO1LLqxQGYDBk X-Received: by 2002:a17:90b:3505:b0:20d:ba2e:994b with SMTP id ls5-20020a17090b350500b0020dba2e994bmr50567524pjb.46.1666425704057; Sat, 22 Oct 2022 01:01:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666425704; cv=none; d=google.com; s=arc-20160816; b=HYBpHM0yh4biXLh5npckP4gM2ziLGtflpdOdwXCw3kQ1TnKx0cd6dcYdOBz23DkSm9 tT+nCVK/Jq+wFJLiAyIl/U97/Az8LedVABR+eM7y7ge3qBWdnlpdbF3T36OO9T9Eux2H oHUOncY5skNaD+b8dJcEE3oFJJLxfx7vbZHeWY6cQX2RC48xXIJUW6xM7QZCBQOan8BJ 7R3LBQ5OHdmGfrv+UqLA7ShitPcdTA0+2+ThYKpxzXdbgSMKj8FPYd3t72HQXUoWiK4k KmGKZEmebUjzwPdeDiZVDXLAqNwQW2bKgEm7LUQJ8H/656bcKa8NdzJQZSdY3vxGaA1K BAfA== 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=oqCS9BQ0LYscQXU0xRC79QjcakB/ugufOwB2SzK1hBc=; b=MDy5zGbegRLBZOlNa0ctIcqlpoE9ipygTwPvXGcbu3G01++8KEDjS1+524115NYjvx 9DXunmfaTvIXklYO1FYRFeaRIujJxTt/6bGxi50uzIP0MlrW19rmgRv1tEJdVQpIP9BO AJr9VTVishnAaQx7pOxZq+qyfO+qpN3xTPEf5ObE3902FdRfHlw/5CzYq4nnF3PBh2B0 2rqkcgN6FfbVndM8u/vJBCUAVFPsn3A91NgIXUmCAEhIvRvRUUrnf+g1CuDz1pG3JjCf VFtRVcGbpCVrmlyKCPk9Pct+Y0H1P0MiO4CZmM6PvNWyfNilqd+7tQAKgy7i9Z92HCA/ N95A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=CnKVybTO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 h185-20020a6383c2000000b00461515e9706si26244526pge.654.2022.10.22.01.01.29; Sat, 22 Oct 2022 01:01: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=CnKVybTO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S232367AbiJVIBG (ORCPT + 99 others); Sat, 22 Oct 2022 04:01:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54862 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232183AbiJVHyV (ORCPT ); Sat, 22 Oct 2022 03:54: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 9E5248A6D6; Sat, 22 Oct 2022 00:47: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 BD1D960B1F; Sat, 22 Oct 2022 07:46:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D10E8C433C1; Sat, 22 Oct 2022 07:46:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424814; bh=yJ/mjHVuHuKgEgxhXjb+OhqM37MZoOaiJaQbRqrj8x4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CnKVybTOkGE7ZGjSuIbSUPY02oCJh8mwj5AOrClrDv+PJ1Rdp3KUQLR0h75oyE/je IjNBSzXPXfmcQe01iD1lYat+h9WMt1Hw1x3/AD2GTjNdG2eHYuGTnn0wCTF6YHiCOj ddJsue1RYUS9j87eEL/+aoZdjBfYMkHllzZfhmTg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, syzbot , Kuniyuki Iwashima , "David S. Miller" , Sasha Levin Subject: [PATCH 5.19 286/717] af_unix: Fix memory leaks of the whole sk due to OOB skb. Date: Sat, 22 Oct 2022 09:22:45 +0200 Message-Id: <20221022072504.218304416@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747373999136746921?= X-GMAIL-MSGID: =?utf-8?q?1747373999136746921?= From: Kuniyuki Iwashima [ Upstream commit 7a62ed61367b8fd01bae1e18e30602c25060d824 ] syzbot reported a sequence of memory leaks, and one of them indicated we failed to free a whole sk: unreferenced object 0xffff8880126e0000 (size 1088): comm "syz-executor419", pid 326, jiffies 4294773607 (age 12.609s) hex dump (first 32 bytes): 00 00 00 00 00 00 00 00 7d 00 00 00 00 00 00 00 ........}....... 01 00 07 40 00 00 00 00 00 00 00 00 00 00 00 00 ...@............ backtrace: [<000000006fefe750>] sk_prot_alloc+0x64/0x2a0 net/core/sock.c:1970 [<0000000074006db5>] sk_alloc+0x3b/0x800 net/core/sock.c:2029 [<00000000728cd434>] unix_create1+0xaf/0x920 net/unix/af_unix.c:928 [<00000000a279a139>] unix_create+0x113/0x1d0 net/unix/af_unix.c:997 [<0000000068259812>] __sock_create+0x2ab/0x550 net/socket.c:1516 [<00000000da1521e1>] sock_create net/socket.c:1566 [inline] [<00000000da1521e1>] __sys_socketpair+0x1a8/0x550 net/socket.c:1698 [<000000007ab259e1>] __do_sys_socketpair net/socket.c:1751 [inline] [<000000007ab259e1>] __se_sys_socketpair net/socket.c:1748 [inline] [<000000007ab259e1>] __x64_sys_socketpair+0x97/0x100 net/socket.c:1748 [<000000007dedddc1>] do_syscall_x64 arch/x86/entry/common.c:50 [inline] [<000000007dedddc1>] do_syscall_64+0x38/0x90 arch/x86/entry/common.c:80 [<000000009456679f>] entry_SYSCALL_64_after_hwframe+0x63/0xcd We can reproduce this issue by creating two AF_UNIX SOCK_STREAM sockets, send()ing an OOB skb to each other, and close()ing them without consuming the OOB skbs. int skpair[2]; socketpair(AF_UNIX, SOCK_STREAM, 0, skpair); send(skpair[0], "x", 1, MSG_OOB); send(skpair[1], "x", 1, MSG_OOB); close(skpair[0]); close(skpair[1]); Currently, we free an OOB skb in unix_sock_destructor() which is called via __sk_free(), but it's too late because the receiver's unix_sk(sk)->oob_skb is accounted against the sender's sk->sk_wmem_alloc and __sk_free() is called only when sk->sk_wmem_alloc is 0. In the repro sequences, we do not consume the OOB skb, so both two sk's sock_put() never reach __sk_free() due to the positive sk->sk_wmem_alloc. Then, no one can consume the OOB skb nor call __sk_free(), and we finally leak the two whole sk. Thus, we must free the unconsumed OOB skb earlier when close()ing the socket. Fixes: 314001f0bf92 ("af_unix: Add OOB support") Reported-by: syzbot Signed-off-by: Kuniyuki Iwashima Signed-off-by: David S. Miller Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- net/unix/af_unix.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) --- a/net/unix/af_unix.c +++ b/net/unix/af_unix.c @@ -548,12 +548,6 @@ static void unix_sock_destructor(struct skb_queue_purge(&sk->sk_receive_queue); -#if IS_ENABLED(CONFIG_AF_UNIX_OOB) - if (u->oob_skb) { - kfree_skb(u->oob_skb); - u->oob_skb = NULL; - } -#endif WARN_ON(refcount_read(&sk->sk_wmem_alloc)); WARN_ON(!sk_unhashed(sk)); WARN_ON(sk->sk_socket); @@ -598,6 +592,13 @@ static void unix_release_sock(struct soc unix_state_unlock(sk); +#if IS_ENABLED(CONFIG_AF_UNIX_OOB) + if (u->oob_skb) { + kfree_skb(u->oob_skb); + u->oob_skb = NULL; + } +#endif + wake_up_interruptible_all(&u->peer_wait); if (skpair != NULL) { From patchwork Sat Oct 22 07:22: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: 7341 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1095010wrr; Sat, 22 Oct 2022 01:01:30 -0700 (PDT) X-Google-Smtp-Source: AMsMyM74DZ6Mujyi6Ke0mA1xsO0QJou9mWVOhe/5bW3sq5c3o3x9osdGmI/PXKBvG5H69p9YKLcc X-Received: by 2002:a17:902:b089:b0:178:54cf:d692 with SMTP id p9-20020a170902b08900b0017854cfd692mr22933646plr.1.1666425690051; Sat, 22 Oct 2022 01:01:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666425690; cv=none; d=google.com; s=arc-20160816; b=z7kozZKCasWD4uO/g0dTbLm0HU0sW/qfe92QCsr/gLLeobYXZXKmROg3USexvIim3C t7l/uUY9Vc8PYiIL7E3At4VXFASH2aDHgy9NrWXJ4LLROQ3T+Bivuc0DAS9AblFLP+4m LDaicbOsi8Dl7oNu5o6D0k7S+gXkDD4oQ4oiddfNijThKooGqK1/6S0f6vEIsUCyMyrz 8Hmcmak/QDV6A/QsygDeMga2NWlE+zv19Rpx3R054RtTTAJuDVfbeZRoqWMHILFxewQv 86wiz4Gl0JRBMqLG2HzZhHwYkvEea3rm9n5CaBo7Sx7QCFDgOhMiruN6k50ltwkx14QR 5Uwg== 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=wOaPGhvn4wPLOJ8GCCUbrJ1NIB1B85jILs31EDFG4lQ=; b=zL5HTnAb/4TN6qSk7hUn7+Hha0lCeBCRVGkPE2TSvsRhujcJd3GakUlLmaNcGXKToI rCTk8vyptH5kBNYP2AOD23sJNWZbiLUx1o57m7JnGeKyv6VryD1/sraihORPgT9wIPm4 1E3XVJP1HpsTSmV5BGj18CCyT3MmGGs23uz1mEzaKkHlo07DZGNBURS6GwGLKdevFlPo 1uen5aQV4b3Gho3OTOgyqRaJqVTeTT9tgl79d77ULxDr02rtfWaIKb0Brv07rKeBv6qG PPdn/ekQZ/AOBEdsNrcB85DnYSGRudcAlILmrqZ2cGPKRCwz7Fv1ynea86zYGraODTtP ozKg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=wQ2G5z1Q; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 k138-20020a628490000000b00562dda10caesi26464885pfd.245.2022.10.22.01.01.16; Sat, 22 Oct 2022 01:01: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=wQ2G5z1Q; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S232273AbiJVIAw (ORCPT + 99 others); Sat, 22 Oct 2022 04:00:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54868 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232184AbiJVHyV (ORCPT ); Sat, 22 Oct 2022 03:54: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 8BF402CA7E3; Sat, 22 Oct 2022 00:47: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 dfw.source.kernel.org (Postfix) with ESMTPS id 5298260B00; Sat, 22 Oct 2022 07:46:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6A3BFC433D7; Sat, 22 Oct 2022 07:46:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424816; bh=jn6U7cWk9g7ErLccI+E2jIRBBJZlYMN6lO4atQmarNQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wQ2G5z1QLAc2Fe29X6w6XD8ovLfP6U3rF8of2tJfWtC6JZQGZJf9X0oc7e9ieHGZw OmAwAGOmJ3pB/50SdQZRZTWfE3x2vbGTU8yUM9MaSu3JG7JBYalbWPOmPjzibRg/Xt U/76Pe1rtwk8yk5IML2ppBTnxIujCxE7DVIRSxNY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jiasheng Jiang , Taras Chornyi , "David S. Miller" , Sasha Levin Subject: [PATCH 5.19 287/717] net: prestera: acl: Add check for kmemdup Date: Sat, 22 Oct 2022 09:22:46 +0200 Message-Id: <20221022072504.324321512@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747373983926731060?= X-GMAIL-MSGID: =?utf-8?q?1747373983926731060?= From: Jiasheng Jiang [ Upstream commit 9e6fd874c7bb47b6a4295abc4c81b2f41b97e970 ] As the kemdup could return NULL, it should be better to check the return value and return error if fails. Moreover, the return value of prestera_acl_ruleset_keymask_set() should be checked by cascade. Fixes: 604ba230902d ("net: prestera: flower template support") Signed-off-by: Jiasheng Jiang Reviewed-by: Taras Chornyi Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/net/ethernet/marvell/prestera/prestera_acl.c | 8 ++++++-- drivers/net/ethernet/marvell/prestera/prestera_acl.h | 4 ++-- drivers/net/ethernet/marvell/prestera/prestera_flower.c | 6 +++++- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/drivers/net/ethernet/marvell/prestera/prestera_acl.c b/drivers/net/ethernet/marvell/prestera/prestera_acl.c index 3a141f2db812..c0d4ddc18f87 100644 --- a/drivers/net/ethernet/marvell/prestera/prestera_acl.c +++ b/drivers/net/ethernet/marvell/prestera/prestera_acl.c @@ -162,10 +162,14 @@ prestera_acl_ruleset_create(struct prestera_acl *acl, return ERR_PTR(err); } -void prestera_acl_ruleset_keymask_set(struct prestera_acl_ruleset *ruleset, - void *keymask) +int prestera_acl_ruleset_keymask_set(struct prestera_acl_ruleset *ruleset, + void *keymask) { ruleset->keymask = kmemdup(keymask, ACL_KEYMASK_SIZE, GFP_KERNEL); + if (!ruleset->keymask) + return -ENOMEM; + + return 0; } int prestera_acl_ruleset_offload(struct prestera_acl_ruleset *ruleset) diff --git a/drivers/net/ethernet/marvell/prestera/prestera_acl.h b/drivers/net/ethernet/marvell/prestera/prestera_acl.h index f963e1e0c0f0..21dbfe4fe5b8 100644 --- a/drivers/net/ethernet/marvell/prestera/prestera_acl.h +++ b/drivers/net/ethernet/marvell/prestera/prestera_acl.h @@ -185,8 +185,8 @@ struct prestera_acl_ruleset * prestera_acl_ruleset_lookup(struct prestera_acl *acl, struct prestera_flow_block *block, u32 chain_index); -void prestera_acl_ruleset_keymask_set(struct prestera_acl_ruleset *ruleset, - void *keymask); +int prestera_acl_ruleset_keymask_set(struct prestera_acl_ruleset *ruleset, + void *keymask); bool prestera_acl_ruleset_is_offload(struct prestera_acl_ruleset *ruleset); int prestera_acl_ruleset_offload(struct prestera_acl_ruleset *ruleset); void prestera_acl_ruleset_put(struct prestera_acl_ruleset *ruleset); diff --git a/drivers/net/ethernet/marvell/prestera/prestera_flower.c b/drivers/net/ethernet/marvell/prestera/prestera_flower.c index 4d93ad6a284c..553413248823 100644 --- a/drivers/net/ethernet/marvell/prestera/prestera_flower.c +++ b/drivers/net/ethernet/marvell/prestera/prestera_flower.c @@ -428,7 +428,9 @@ int prestera_flower_tmplt_create(struct prestera_flow_block *block, } /* preserve keymask/template to this ruleset */ - prestera_acl_ruleset_keymask_set(ruleset, rule.re_key.match.mask); + err = prestera_acl_ruleset_keymask_set(ruleset, rule.re_key.match.mask); + if (err) + goto err_ruleset_keymask_set; /* skip error, as it is not possible to reject template operation, * so, keep the reference to the ruleset for rules to be added @@ -444,6 +446,8 @@ int prestera_flower_tmplt_create(struct prestera_flow_block *block, list_add_rcu(&template->list, &block->template_list); return 0; +err_ruleset_keymask_set: + prestera_acl_ruleset_put(ruleset); err_ruleset_get: kfree(template); err_malloc: From patchwork Sat Oct 22 07:22: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: 7371 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1096041wrr; Sat, 22 Oct 2022 01:04:09 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7LUfOeOElY7DINg1OB/kM3T4Yg6wVnE3ci/bCGr3Wt5DGlxzRlvt/mt9cJvqlrZLN/pRzW X-Received: by 2002:a17:90b:1d8c:b0:212:e08d:7390 with SMTP id pf12-20020a17090b1d8c00b00212e08d7390mr2743862pjb.168.1666425839189; Sat, 22 Oct 2022 01:03:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666425839; cv=none; d=google.com; s=arc-20160816; b=H/1YryRIOoSPzW4sIadMpCcNrdVkkNXKRVBzBn7/EcXomXAAaeJPjSE7IOnN0ip2P8 fQXDrfPs28quBJeYyWikgDhNTU72vbthHCMvfMr/cchl+Du8OeTHqygxRxPtNcsxJKwR bIZPUdIezjgd8qOr9o5QMyuPeiDKgJ1zuUGa+YwrSvLXioe+fk9hwZSKz8m3WigrxN9l 8IPJDzjplyvnXUkRY8ixdc4s7PAqQnnekojxey+iozCzFOrPs9wA0cbC+3nMt7a8dm04 21PoDE9iD7w3x+G6z1pXsPL/8C/CcNTj+0Jh63x1hurhtrSghKL8pcAq8jCq1P8LEHXr /R1w== 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=/jEnyGqp+5UM9rxW0zL6ebiol0WSNs70t1/LnQqcBzE=; b=FQQMeOpzPiwJsdBdCdg8Mt9zlzvobwuh7ojDMA+K5qbzJ2x7B7qPaIiIzwYtzUt4uD 4hHGSBQsb3Nc4nicFWAsVqYyUBk8IAVvofQ+WnftaHD0LZ+1fq6leny80Y6ZJ/X4TxOD 8c8M8UkKuS1CffBnXCovZjmWnC3GiBq7+lwV+GRQYMtuzV1OP6YeUCnJHdy22Df+QlpC HA+ZIHtOiS8tlu+oUc3R66enk7eraJ7pB3jFgJS+UHK+Gt6VSv2rCxXYjMPLR7SS3D5f VIk1G/hNN0bgS8RtY///vjlVOsIFhJlsgTeGxhJwko/kyFFgTOa/KLlVb2oi3oO/FRHU xUHg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Q6Uoie7n; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 t187-20020a632dc4000000b0045ec918ad38si28838029pgt.548.2022.10.22.01.03.46; Sat, 22 Oct 2022 01:03: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=Q6Uoie7n; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S232511AbiJVID0 (ORCPT + 99 others); Sat, 22 Oct 2022 04:03:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42722 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232440AbiJVHy7 (ORCPT ); Sat, 22 Oct 2022 03:54: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 3DE6D2CA7E8; Sat, 22 Oct 2022 00:47:52 -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 8BFF5B82DF6; Sat, 22 Oct 2022 07:47:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 07D6EC433D6; Sat, 22 Oct 2022 07:46:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424819; bh=XGkmMzPTDEeMhMngRVduxRnock1hXej9ySL7e00w6T0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Q6Uoie7nRMhsn181Q8m/3TqZCpalbg4BrsAroshjsmSyppy6Sno3lsRIAZriY4buO AaY3nuyyEvBKh1tCzt4vbkbMa8mIUovxI7cYm9edGsn4ng4ilRwJh7XU/p2S6n/T9O jMuKzqDw+466V0aXKfIYcWPL81AZeyIm2rD3bEjQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Raju Lakkaraju , Horatiu Vultur , "David S. Miller" , Sasha Levin Subject: [PATCH 5.19 288/717] eth: lan743x: reject extts for non-pci11x1x devices Date: Sat, 22 Oct 2022 09:22:47 +0200 Message-Id: <20221022072504.477747120@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747374140935865928?= X-GMAIL-MSGID: =?utf-8?q?1747374140935865928?= From: Raju Lakkaraju [ Upstream commit cb4b12071a4b68df323c339f60805834246b3e9e ] Remove PTP_PF_EXTTS support for non-PCI11x1x devices since they do not support the PTP-IO Input event triggered timestamping mechanisms added Fixes: 60942c397af6 ("net: lan743x: Add support for PTP-IO Event Input External Timestamp (extts)") Signed-off-by: Raju Lakkaraju Reviewed-by: Horatiu Vultur Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/net/ethernet/microchip/lan743x_ptp.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/net/ethernet/microchip/lan743x_ptp.c b/drivers/net/ethernet/microchip/lan743x_ptp.c index 6a11e2ceb013..da3ea905adbb 100644 --- a/drivers/net/ethernet/microchip/lan743x_ptp.c +++ b/drivers/net/ethernet/microchip/lan743x_ptp.c @@ -1049,6 +1049,10 @@ static int lan743x_ptpci_verify_pin_config(struct ptp_clock_info *ptp, enum ptp_pin_function func, unsigned int chan) { + struct lan743x_ptp *lan_ptp = + container_of(ptp, struct lan743x_ptp, ptp_clock_info); + struct lan743x_adapter *adapter = + container_of(lan_ptp, struct lan743x_adapter, ptp); int result = 0; /* Confirm the requested function is supported. Parameter @@ -1057,7 +1061,10 @@ static int lan743x_ptpci_verify_pin_config(struct ptp_clock_info *ptp, switch (func) { case PTP_PF_NONE: case PTP_PF_PEROUT: + break; case PTP_PF_EXTTS: + if (!adapter->is_pci11x1x) + result = -1; break; case PTP_PF_PHYSYNC: default: From patchwork Sat Oct 22 07:22: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: 7335 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1094750wrr; Sat, 22 Oct 2022 01:00:55 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6HP38SFqCYYhXsr/+bl/iZiA69R3TUdq6IsidlnsEznP2o5htkQzZBAFc8ZYQoSAcYlDhX X-Received: by 2002:a63:d1b:0:b0:42b:828b:f14a with SMTP id c27-20020a630d1b000000b0042b828bf14amr19889963pgl.235.1666425655394; Sat, 22 Oct 2022 01:00:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666425655; cv=none; d=google.com; s=arc-20160816; b=xj8+sfGtp4yaMOKptf0QHZQ+1moI9UmpLjDfY6TYJwu2sW+ijWKAG+chXA5HnFG07+ QNgXVPQUKRSG4qbYG89lfw8y2+aOMEbdI+AUIuF7L7EzW9rUZJzKbRikBj34P8elLVtR HIgcNKGSYGKEwNpSmZXLL07IT9ka3P1jA+u9Cv4OJpk8nS3wZJ0T2MtvIIZr3wW/UYgl R1SJAs6czWRRWdE8KlHLj9UNijwqFdfrmD6Y+aN5Qo62SWdoNiwSMpnJ6KEbhS5oyjIZ SG/BZ35pp4zcN4SeDblERvPsGwZ4AAXrTXVqg0/4/T1Kqj0SEKZ84YTDBCfirefoQJ+1 RNag== 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=x0hoey/w+Al5u4IT3VAMva/F7XmMt3wcuzpvZk3Eq8c=; b=X2/knQUpQ+zhrHlMHYgo+XWrgDcZdMACQJs+gNl3K24QVbgqtxoa4R/KZT1pNBE6Bs DJ+wr8A1the+xZlynH+mNM+4v5GGfGO8pH3WZKr+RNIEZ8RdQ5EDLm4RLWnB1lrIzGga OzhEexBa5mLnDKeNeKE9V8y98eRuBnvJKtghHa3QSZQeCdRturNc43GORQG70ixUZdzI nii6WuwNeptdfwI9HFFSqim087xuAFiOcID3K7uG1KzL9x7oLaT76RlhpHc1J3f/T8qo CLHozYG6RQZVrH00Pojm98p2ab696QwsBirlxzsqEDJhD50v8Jj9kHvQ7KbEaoRR+n0V 7sUg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=jXF6PIpi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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-20020a170902b68600b00174418919a6si25920422pls.513.2022.10.22.01.00.38; Sat, 22 Oct 2022 01:00: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=jXF6PIpi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S232269AbiJVH6m (ORCPT + 99 others); Sat, 22 Oct 2022 03:58:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38786 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232109AbiJVHyE (ORCPT ); Sat, 22 Oct 2022 03:54:04 -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 69176645CE; Sat, 22 Oct 2022 00:47: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 dfw.source.kernel.org (Postfix) with ESMTPS id 583B060ADC; Sat, 22 Oct 2022 07:47:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5A79BC433D7; Sat, 22 Oct 2022 07:47:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424824; bh=VEZNnwj0nUV+r46mdb30yQGhzT2eyjw9eB3hHB+x73Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jXF6PIpizCTdD+bMU0JkC/oqMlOn963O0Xw87fvXxpa6J8fuaLONGCOwBy/ToKgq+ fv5USg0MHPs+U2/JZ+zOQZaB5wLtiq+a5rDiZjTPowgMGOQIQLyu3DC8AJBTA31d2H b+U1uhayMxAB9Ved1o9CUiLTE7+ZiYGD/uoVRqnU= 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 5.19 289/717] bnx2x: fix potential memory leak in bnx2x_tpa_stop() Date: Sat, 22 Oct 2022 09:22:48 +0200 Message-Id: <20221022072504.604401072@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747373948190869592?= X-GMAIL-MSGID: =?utf-8?q?1747373948190869592?= 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 5729a5ab059d..4cbd3ba5acb9 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c @@ -789,6 +789,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 Sat Oct 22 07:22: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: 7364 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1095768wrr; Sat, 22 Oct 2022 01:03:28 -0700 (PDT) X-Google-Smtp-Source: AMsMyM56x73+F0XRXQhYPXGJUL60pRgfiZLaba3//Ps7s2fPFvjn/20Xe/tTyAwKZn4PCD4k8PdN X-Received: by 2002:a63:285:0:b0:46e:9da4:df71 with SMTP id 127-20020a630285000000b0046e9da4df71mr10106180pgc.564.1666425808579; Sat, 22 Oct 2022 01:03:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666425808; cv=none; d=google.com; s=arc-20160816; b=Z9QRiy+G+GO+HjhVnvxkWkNflddMsi8cfxEUi3qb9WlVesAQdYt50MNXZLyGxdF7Y8 0Ul13BesFYnlN3Oy/rEf5jRMoEOHzLl0QMIvRPCbC+V9v9HPraSMwB1M1TA7i2PnadZl 16zZW5DZ4eme15ND4Wk9wDLOIQhs8lPuI6jMGDc1OHPqT+Sj6uA4VRjWFf456kCDDq5Q ppiykw7eHhyXvozn1DYKsarU26vu1v7QsY1wfEMb4B2w08luQhRKyQFB1O2rBuasQHmX aHmFO9vhZ9xqNtOItAS3+9IHlggnnYaSmbK+npWv7K8w8cGNQgqH77/8ZqG5DlxSozqN rx6g== 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=AW+NyJ0F48ftx91VRFw+qXnvt5ovAtiBxMdRFSdVWqo=; b=QxbygZwDefr6bd6GF3pMey2dS5uUrhlH4/PFUlkN5HN1Mk6Y7J2Fx/xBeHhfVeALRv zk9PTqWVan/KFcf245kpQ5zHCTtkBwJlmbqXIIXsQdHBfCM5nT0LZGDpVOizg++waMed 4td/+0Qg6elbdVhDcPIESC5P3BiqoA4If6Xxigj/LoErFGcbpi1BB9NqQ+lSJPeXKvQ8 68KtdiRBDRK3f0Dl8MbupSat5wFFmDn96m0R/sybJgP39R0hRJkC6KVTkTcnbyEKorD6 Z4tO1ZgTEiTAms5l7FHf7GDEKp/tnLUdl5FZyq3szvtwW7lAK8JCiW0XUBsnMi2wXky0 o7oQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="gR/r/+dC"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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-20020a170902b18900b0017f8d9b7e5fsi26070166plr.133.2022.10.22.01.03.15; Sat, 22 Oct 2022 01:03: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="gR/r/+dC"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S230150AbiJVIC6 (ORCPT + 99 others); Sat, 22 Oct 2022 04:02:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42802 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232348AbiJVHyn (ORCPT ); Sat, 22 Oct 2022 03:54:43 -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 B6A472CDE7; Sat, 22 Oct 2022 00:47: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 ams.source.kernel.org (Postfix) with ESMTPS id C1158B82E13; Sat, 22 Oct 2022 07:47:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1DF63C433C1; Sat, 22 Oct 2022 07:47:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424827; bh=qubxgJW3yy4v52tdRBQ7C/fWqSRTYb6tebZiHAJIdL4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gR/r/+dCvEDeH7zXQm3r1qOKh7VlWIV2G9w53qf87qC4Z3xPEfGj1xbi7mWqes1Il nOSayFLQb3l1ThmkzyVVDVreo+H5xtPP54sPJ0+vObtJwqSQ6JOeM5fDijXIisroyh 9ohnL5Fjht0obMx/6fjVBf+u0ZVkvWRW3MutUx40= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zheng Wang , "David S. Miller" , Sasha Levin Subject: [PATCH 5.19 290/717] eth: sp7021: fix use after free bug in spl2sw_nvmem_get_mac_address Date: Sat, 22 Oct 2022 09:22:49 +0200 Message-Id: <20221022072504.730256985@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747374108636443995?= X-GMAIL-MSGID: =?utf-8?q?1747374108636443995?= From: Zheng Wang [ Upstream commit 12aece8b01507a2d357a1861f470e83621fbb6f2 ] This frees "mac" and tries to display its address as part of the error message on the next line. Swap the order. Fixes: fd3040b9394c ("net: ethernet: Add driver for Sunplus SP7021") Signed-off-by: Zheng Wang Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/net/ethernet/sunplus/spl2sw_driver.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/sunplus/spl2sw_driver.c b/drivers/net/ethernet/sunplus/spl2sw_driver.c index 3773ce5e12cc..37711331ba0f 100644 --- a/drivers/net/ethernet/sunplus/spl2sw_driver.c +++ b/drivers/net/ethernet/sunplus/spl2sw_driver.c @@ -248,8 +248,8 @@ static int spl2sw_nvmem_get_mac_address(struct device *dev, struct device_node * /* Check if mac address is valid */ if (!is_valid_ether_addr(mac)) { - kfree(mac); dev_info(dev, "Invalid mac address in nvmem (%pM)!\n", mac); + kfree(mac); return -EINVAL; } From patchwork Sat Oct 22 07:22: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: 7332 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1094746wrr; Sat, 22 Oct 2022 01:00:55 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5sWGaTaZEczBNBtipyLkplctghKRqt9NtRyt0z9MNqNzcdK86UlebsCpROGQo11lf7QSMi X-Received: by 2002:a17:90b:1f87:b0:212:533:3184 with SMTP id so7-20020a17090b1f8700b0021205333184mr14709174pjb.3.1666425655281; Sat, 22 Oct 2022 01:00:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666425655; cv=none; d=google.com; s=arc-20160816; b=EdcD+NYP/SBqfn2PTNiw8Qpr0ohAusKd6Hb0Lv8JVqTCAiXlFBWyndVl6Va6dTAm3C EGaZExJjDJhe5ouQR6iJJ1547uQ037l62yUhKgUN4+hGF+swBBJuHFUvjkObH0JOS/Rs Lf/W+qAUodSQoUO92TfOXUtECznZtOBfFPeLtV22F7bGHR+WTrysjnrEbdDi7GN+VvLo AjqayovAROyETFpG2ca5tgutffQ0RlP9gzEtH7RouYrGLAdwuDgg8DsPyP7uVpdoXyWp ftNEkzwXeXtbjZpd/FE00Mr5BMRVfRyKXrzAwqAM9Gp5pxAAyGMJKkeVGh7pTPLjzrx2 vloQ== 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=rhXD+g75m/68woPSUp34I8eVax0JZdfTvkjJkjSYwkY=; b=Ad5NQo1QDtxwD/ng8lvK2/vmHpJ5dBGeKup45YRSSlkypB/mKWrAY6UZLZGRBRIfrR 2ZfI9yMB/ofQNyWraMf9OLonMafQrXcOL2OI/iAQ8qW+IIwa6lSp0qAuQLyb5O4gAMee Gk86CJxaTwShiucJ7PRPW8dWita0RNO7zxfKqAulMtiwgeLAjglLw35MyQj3SLt4a8JE 9vYpCLeVPoQV4zh5jGaxZ3n0cyd3fzTivjMvdBuBGsdpK7LNru+TLkoKcIUxMZH7MVMz sBtbVtgi1bE7p63p9/fMcLFS5IzGsjUSVsAzH5mHzcpxkNV020u4cQBvS5GCwua3R6tz 8E5A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=bKGdVYKy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 g16-20020a056a001a1000b00557e99763d3si31037473pfv.93.2022.10.22.01.00.37; Sat, 22 Oct 2022 01:00: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=bKGdVYKy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S232261AbiJVH6h (ORCPT + 99 others); Sat, 22 Oct 2022 03:58:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55598 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232118AbiJVHyG (ORCPT ); Sat, 22 Oct 2022 03:54:06 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 819A059EAA; Sat, 22 Oct 2022 00:47:22 -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 A558F60B1B; Sat, 22 Oct 2022 07:47:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B93A4C43470; Sat, 22 Oct 2022 07:47:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424830; bh=KNf54MzYOzZQ7PIZ9pF8uzpHZeVH6NK8nEr5MpJ/Xzk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bKGdVYKysi7jdCE8zbZjoZbRPXYN2+/hHKhwSYMpPYfdML60nGKJTs08uHO0Xa4qE rfaNpefxPOWPUBwbAO12FU9/oaaucMqYQXVj9UsrO2jRjdpF6WZbbEi0+Fz+8HhK73 H0cijDpXQu4Cm3vP+nSlEFZ2crOtGgnMb84Rk9DY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Maxim Mikityanskiy , M Chetan Kumar , "David S. Miller" , Sasha Levin Subject: [PATCH 5.19 291/717] net: wwan: iosm: Call mutex_init before locking it Date: Sat, 22 Oct 2022 09:22:50 +0200 Message-Id: <20221022072504.847688169@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747373947689550639?= X-GMAIL-MSGID: =?utf-8?q?1747373947689550639?= From: Maxim Mikityanskiy [ Upstream commit ba0fbdb95da5ddd8db457ce6ba09d16dd979a294 ] wwan_register_ops calls wwan_create_default_link, which ends up in the ipc_wwan_newlink callback that locks ipc_wwan->if_mutex. However, this mutex is not yet initialized by that point. Fix it by moving mutex_init above the wwan_register_ops call. This also makes the order of operations in ipc_wwan_init symmetric to ipc_wwan_deinit. Fixes: 83068395bbfc ("net: iosm: create default link via WWAN core") Signed-off-by: Maxim Mikityanskiy Reviewed-by: M Chetan Kumar Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/net/wwan/iosm/iosm_ipc_wwan.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/net/wwan/iosm/iosm_ipc_wwan.c b/drivers/net/wwan/iosm/iosm_ipc_wwan.c index 27151148c782..4712f01a7e33 100644 --- a/drivers/net/wwan/iosm/iosm_ipc_wwan.c +++ b/drivers/net/wwan/iosm/iosm_ipc_wwan.c @@ -323,15 +323,16 @@ struct iosm_wwan *ipc_wwan_init(struct iosm_imem *ipc_imem, struct device *dev) ipc_wwan->dev = dev; ipc_wwan->ipc_imem = ipc_imem; + mutex_init(&ipc_wwan->if_mutex); + /* WWAN core will create a netdev for the default IP MUX channel */ if (wwan_register_ops(ipc_wwan->dev, &iosm_wwan_ops, ipc_wwan, IP_MUX_SESSION_DEFAULT)) { + mutex_destroy(&ipc_wwan->if_mutex); kfree(ipc_wwan); return NULL; } - mutex_init(&ipc_wwan->if_mutex); - return ipc_wwan; } From patchwork Sat Oct 22 07:22: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: 7379 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1096559wrr; Sat, 22 Oct 2022 01:05:26 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4ht5xAMHyDRblZx/Dkq4oC6OUSMEkzJf8CiXbdND+osvwl5TSo71khRw//u8FocJRjV6hu X-Received: by 2002:a17:90a:cf06:b0:212:d9ab:811b with SMTP id h6-20020a17090acf0600b00212d9ab811bmr5369362pju.65.1666425926307; Sat, 22 Oct 2022 01:05:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666425926; cv=none; d=google.com; s=arc-20160816; b=eLPKCtKNbCSAeEgQA9iRQigjP5Wtf2C86tWhJ1BNj3Fgae7tul3AFPbK1Mf8cRVCjz dnOzp5xzii4MqFvyHGPF4h7BxS9Xjw4NuJE5U0UhxoiUyQJYc9MSLrNnXyL2hIwIvc40 BSNhqdmoTBYcQVkhw3Ah73J5yooBTF8HjbymKLecTWYSR74vD896MfwINCIcdn49IEds Hu9NeALtUEEaIlV/pEoWk0O53Q1qCkP/EdJvh9GWWOGtCZk0eIuWpfEq7A2IV+hq3J6z sFhBtbcBfdT43DrAV+lcyHK3XmsQnFeceibWEu8xvv32siCwyJ1p4SPRSn1yJnK4A+R8 fmBg== 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=H2e7y1sYXqrXeGy2KXktBigbXNeCvcebPWS3U5Oo238=; b=MAFVYZ0CzyRz2yoJ6WdoZq//m7hKKYWdZlXrD03aSN0G1oHRMABEOv2Ls8zCTmgwNj a65QqHa92oHYeFojB8NaOOGaF0rngR5PwyNukJCVrmBmQM7qalPX0OLe37pcQn7ySr9l TJ4ULFO+xKxEDQLU1B/8zpzNzNYCYvhxCs9VQc/SN8jmdPnagsBIawpnlDkdo1GAkbm3 g8uF7A3eebXJiZs3EuolCxXh8DYW14epeSVJ+zfdNSijGGGlBZPw/T8rxsrfuAGQ3zoM d3KgxvRQbNiONnLdC/Fb+TwCJksT+iZCllHMFIbxlJ9WeGiup4tnc24Sxw6eTAB+5CCV QEAA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=1BOzT+cx; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 d4-20020a655ac4000000b0043c5d3dc0d4si28988839pgt.332.2022.10.22.01.05.13; Sat, 22 Oct 2022 01:05: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=1BOzT+cx; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S232802AbiJVIEP (ORCPT + 99 others); Sat, 22 Oct 2022 04:04:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35784 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232357AbiJVH6A (ORCPT ); Sat, 22 Oct 2022 03:58: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 EC7A312276F; Sat, 22 Oct 2022 00:49: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 E713060ACE; Sat, 22 Oct 2022 07:48:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 011ADC433C1; Sat, 22 Oct 2022 07:48:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424936; bh=4skOxrJgX4AfIkPHOIg87BN7DK+WMUVYiGNtnr5td+c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1BOzT+cxYOWd4g+16P9RykHSdptaPh22Hb3uBdmVYzShbDIJNdK2MlaINZY8hNxMv 6gIuGf67d+4ZOVJ0RoC0Jr9j8VU9dfS/qarxKNPqEctH4nw+H5ORgvM+LSbJtIOv2d fhuXEXRE0cLV2cTXpEslH/RAD9hzLyw8F3AX2RTc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, syzbot , Tetsuo Handa , "David S. Miller" , Sasha Levin Subject: [PATCH 5.19 292/717] net/ieee802154: reject zero-sized raw_sendmsg() Date: Sat, 22 Oct 2022 09:22:51 +0200 Message-Id: <20221022072505.011272412@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747374232232599401?= X-GMAIL-MSGID: =?utf-8?q?1747374232232599401?= From: Tetsuo Handa [ Upstream commit 3a4d061c699bd3eedc80dc97a4b2a2e1af83c6f5 ] syzbot is hitting skb_assert_len() warning at raw_sendmsg() for ieee802154 socket. What commit dc633700f00f726e ("net/af_packet: check len when min_header_len equals to 0") does also applies to ieee802154 socket. Link: https://syzkaller.appspot.com/bug?extid=5ea725c25d06fb9114c4 Reported-by: syzbot Fixes: fd1894224407c484 ("bpf: Don't redirect packets with invalid pkt_len") Signed-off-by: Tetsuo Handa Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- net/ieee802154/socket.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/net/ieee802154/socket.c b/net/ieee802154/socket.c index 7889e1ef7fad..cbd0e2ac4ffe 100644 --- a/net/ieee802154/socket.c +++ b/net/ieee802154/socket.c @@ -251,6 +251,9 @@ static int raw_sendmsg(struct sock *sk, struct msghdr *msg, size_t size) return -EOPNOTSUPP; } + if (!size) + return -EINVAL; + lock_sock(sk); if (!sk->sk_bound_dev_if) dev = dev_getfirstbyhwtype(sock_net(sk), ARPHRD_IEEE802154); From patchwork Sat Oct 22 07:22: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: 7368 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1095928wrr; Sat, 22 Oct 2022 01:03:52 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6ltm4sJdZB15N75PorH3k747u8FPOpTPCGBqeoTpE39jzybfVBoig3GRfs0MSsrPgacU1W X-Received: by 2002:a17:903:2448:b0:17f:8069:532a with SMTP id l8-20020a170903244800b0017f8069532amr23491991pls.95.1666425831838; Sat, 22 Oct 2022 01:03:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666425831; cv=none; d=google.com; s=arc-20160816; b=HrHzgyQ06fOu8CIcEdVwGzcWEOxVJuwL3xj+yqEsCgqMKLP9CvDvDqZl88M458Lr8H ndWYwZkbgxsg+sXbKRAsVk5BS8u04QgS3NLI9yWAd9xEt+9nm0gWhL5HtINVC0A/flky h6RZ1yKs4WgE8ZWzozxE1Pomf4C75gxBijupBTwlInj7KPhTdYLKbQfLsu4Jltxyupvi UbPFwzjHJvCjakkr+Gw1Ts72HGpfifLGOmWyBHTi25WBaAgn7C7Z01gLrrEt83LfBXgD m3DqMEKW0eFqggnn8fgj4CHvh5OHNl7BFe5ZJkzcPPtVKZdkWl1Ny3WS6fKL8vrHb5Of EEoQ== 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=ZMLMrIqV2Hqp4WV6sJu0uPP2SnCL7cOhhoHRmWMTPBs=; b=amYFHzjbPFuouu974uJ6XrEer6OouicWDQHi0wLc+cq9tXieGw+akd7lr2xoHvoiih FNJSE9ct+jIFOYZX6bu2i0Gqh7yBSfFSVWM+O+JTxhL3k30JEXOfuHbIX1gAtc8ox9eh N3gNby7pwN+LpKvS79KtYQz6GN8DwQHxkLnovvwq2zp78QQMD4JaY73m+dUIC5wu4QId k1ym/pvtmL/qMW9ruTJSeZid+XNxa12YErZJci2xdnTzacymCXkB6IyTw4b0ysIZhmjs R+1loQCB71xlZd3Ejf/XLcikK7rxnG/mdV7QF8Uf21HjT3OoxTbxCmR7GJML8zE3ErOi vetA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=J3NcoYkv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 j16-20020a62b610000000b005572895941asi24922471pff.139.2022.10.22.01.03.38; Sat, 22 Oct 2022 01:03: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=J3NcoYkv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S232643AbiJVIDP (ORCPT + 99 others); Sat, 22 Oct 2022 04:03:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42706 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232434AbiJVHy7 (ORCPT ); Sat, 22 Oct 2022 03:54: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 B8335D6B99; Sat, 22 Oct 2022 00:48: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 56495B82DEF; Sat, 22 Oct 2022 07:47:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C84E5C433D6; Sat, 22 Oct 2022 07:47:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424852; bh=Yl6aQ+j6wt8Z2KBbxFSyZRemgeXrHICwrJWYCeS6/84=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=J3NcoYkvmMeTka6+94ntid7vGgTyc5dk25+MfqYULTFqHOX+yrZEnQBZntkXmOsbG 8bMAq+0bWcjPMwOS5g23GCAx1FZtPCBYdPmEK5aCw26Agg/0zYnEW6j3AoszPEOZaM 1AWWWdVie0YBhnElLidhcYI3GglbitzT1aAGyC3s= 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 5.19 293/717] once: add DO_ONCE_SLOW() for sleepable contexts Date: Sat, 22 Oct 2022 09:22:52 +0200 Message-Id: <20221022072505.148407446@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747374132682428686?= X-GMAIL-MSGID: =?utf-8?q?1747374132682428686?= 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 f54523052bbc..aebc038e79e5 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 b9d995b5ce24..f5950a7172d6 100644 --- a/net/ipv4/inet_hashtables.c +++ b/net/ipv4/inet_hashtables.c @@ -729,8 +729,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 Sat Oct 22 07:22: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: 7377 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1096557wrr; Sat, 22 Oct 2022 01:05:26 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5AhkHOLseO6P36fP7Xr3s9/q02LNgcQk4Fg2K2B1nWBNyc7Lt8r2qbZPVYsoAyK3arJ4gH X-Received: by 2002:a17:902:ce87:b0:181:e55d:2d4 with SMTP id f7-20020a170902ce8700b00181e55d02d4mr23602025plg.13.1666425926289; Sat, 22 Oct 2022 01:05:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666425926; cv=none; d=google.com; s=arc-20160816; b=W81KFIjf3zsEVmXykTAsqCvqlcI4p0S8EqwhcVEZb4McK+KpQWitok18haUe/eU1zy YvmVTnQzqCvJfDQ6aTbjyTJqTBIJA/6k/SGZUTd1Jtw9xyFhEyz67pmlXMOdh5IHbEHK PFH3F/NUFdZz3+lEV+rXUpUJVyWYxHLBJc1peZAOqJVR9MetZc25tn4YoDXZRaCA0kTP uJz9qAuy466xKmE/8NPioyjyWCGGPGzUXRCEURbhjeHDdkzfRde9KHMLmfS6X6QoPxwy nB0cmq1O+gwzQang8oSc1oiFd3ohvtqH9JKwfcit7PNJXlC+0W40k0NhIGRCMwg6mlZg C2aA== 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=0FZfFRDggJThrZKP5h0o9Bgs4E9AylyY3r2+ZY2GSlA=; b=qxWWxzinseDhfDkxmLGu4DiQgbhT9TDODB5VVJv+ET8fcfDsughkiwfN3Au5etZ/n+ VTLUMgFvbA+Kpb8azoin63BnyuFojVnmpspAxGelk1YIkIIMw3aH/wLptSS0g5sZI+49 WiTGnsk0JADJP/F5k0/DaInTLZPsEFzo5sMUoBgapm82iWTzSs7dSP5C4Vx8OMuYKqF/ eoXP8nQnytroOHfryYtklGYZMcJRHNlxNEyE9lyFZUEd4VXpIhyZqt6EcYJrHrqMrvLZ 7H4cF/tk+Vln/TRmfm/zDVulqwKnFofrDnO+M4QoeD0ky3HAg8EtwOZGgagYDwWrxnHQ deRg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Cwaphk65; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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-20020a17090a4cc400b00212d5631badsi1976239pjh.55.2022.10.22.01.05.12; Sat, 22 Oct 2022 01:05: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=Cwaphk65; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S232671AbiJVIDp (ORCPT + 99 others); Sat, 22 Oct 2022 04:03:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47424 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232160AbiJVH4o (ORCPT ); Sat, 22 Oct 2022 03:56: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 7AAB5D6BB0; Sat, 22 Oct 2022 00:48: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 ams.source.kernel.org (Postfix) with ESMTPS id 09539B82DF3; Sat, 22 Oct 2022 07:48:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5DC9AC433D6; Sat, 22 Oct 2022 07:48:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424881; bh=LVfDi4HCdgetF0yIHxqNdI6P3WM866A87brlpoCcN4g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Cwaphk65KCwrUn+7tuFMPK5mvXhc8eODGIbAGqrhRH/JzVmmbSyPmp71EpUSljg96 zomP+Tl3KRR/TvBWirYSeyiufFOCy/xqPr786HVR5qLsti2GtIAm58gNdKEN35tCrY vtXWqq8Pz2zBBOcjUz0PfELhI14XKUoycpYKVv9E= 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 5.19 294/717] net: mvpp2: fix mvpp2 debugfs leak Date: Sat, 22 Oct 2022 09:22:53 +0200 Message-Id: <20221022072505.284307316@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747374231985955482?= X-GMAIL-MSGID: =?utf-8?q?1747374231985955482?= 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 ad73a488fc5f..11e603686a27 100644 --- a/drivers/net/ethernet/marvell/mvpp2/mvpp2.h +++ b/drivers/net/ethernet/marvell/mvpp2/mvpp2.h @@ -1530,6 +1530,7 @@ u32 mvpp2_read(struct mvpp2 *priv, u32 offset); void mvpp2_dbgfs_init(struct mvpp2 *priv, const char *name); void mvpp2_dbgfs_cleanup(struct mvpp2 *priv); +void mvpp2_dbgfs_exit(void); void mvpp23_rx_fifo_fc_en(struct mvpp2 *priv, int port, bool en); diff --git a/drivers/net/ethernet/marvell/mvpp2/mvpp2_debugfs.c b/drivers/net/ethernet/marvell/mvpp2/mvpp2_debugfs.c index 4a3baa7e0142..75e83ea2a926 100644 --- a/drivers/net/ethernet/marvell/mvpp2/mvpp2_debugfs.c +++ b/drivers/net/ethernet/marvell/mvpp2/mvpp2_debugfs.c @@ -691,6 +691,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); @@ -700,10 +707,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 b84128b549b4..eaa51cd7456b 100644 --- a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c +++ b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c @@ -7706,7 +7706,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 Sat Oct 22 07:22: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: 7382 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1096666wrr; Sat, 22 Oct 2022 01:05:39 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7GdejfLOxa8vfaaiv4nQ7+v50+fIBsHWgY3OR+sdM/lDPLs5g0OumheYY8Hbn9VgpFQ/+j X-Received: by 2002:a17:902:cecd:b0:185:46d3:8cad with SMTP id d13-20020a170902cecd00b0018546d38cadmr23012717plg.83.1666425939025; Sat, 22 Oct 2022 01:05:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666425939; cv=none; d=google.com; s=arc-20160816; b=upnukFXv//EZ4mgJKT29UmDf2TAyEExm9H1KFjrzj99URF1yr0doO9Ax5TDxfFHqMa DGVP4gMb/i/uycEJh87rC01cz5mU9DkrvOyE4kH5VY/r3zQbq27qZb/kfbc3l8aw2FSB tHb1/aAU1RTW07UjLq0jiJDSAMlqzRKQBrr8PIOachq//Hy1vMxOswokEI6z9AzNGs+L CAvQqJrm8hpT16zSFGBXSTwmD3uS1dXQoega+Y9crgR7+bXe6udebRCAs0/RCMm+Q3d6 Qo4ejWwsijIjGxw7J14g4y4Gpdq5CfjVvENdmFM9ZNp0hn3kq4dFP23u+fZyN206pKXJ j/XQ== 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=9Ql+8mskdflqjs60zn5boSVajE1zrmUsKWcrthwMS8c=; b=dy2RjG8mMdkRBVLUAXe6jCaRwtN92KMcRDFHEq7KP2Ji/hcigYWKW5PVm+Yn5sZG3O KAc0lqkcjOarnChIRGOBgJknNqBlaJuK2Jcv4UbdU0VYnlE3AKsJBgN+GC25E2Lc13va bWU6OOV9Unm+zUsv7kzJgS4Kq6qBAlZB69SbQCt1R03B+t/NmaK9UUZgIZ+bnNAtCq9w 2zdVt4U9o5vmjVsH6e3df/2lkcofnOCeuvAmMRtZI3c0S2JIV5yRxv3o0gpVgOU0y0aW 8rsEmmeLTIkbLtMlKUjzHa6KV5158oBBjsiIrRDO1IE7NT3wm7DT/HjahWr3jgQ5jUlz dsUg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=bQlNliMO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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-20020a6301c1000000b00430b25c0134si28731837pgb.670.2022.10.22.01.05.24; Sat, 22 Oct 2022 01:05: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=bQlNliMO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S232913AbiJVIEX (ORCPT + 99 others); Sat, 22 Oct 2022 04:04:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33344 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232394AbiJVH6i (ORCPT ); Sat, 22 Oct 2022 03:58: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 B63A546615; Sat, 22 Oct 2022 00:48: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 35134B82E1F; Sat, 22 Oct 2022 07:48:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9E1E4C433C1; Sat, 22 Oct 2022 07:48:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424911; bh=bf1vPmgo21IJELc6XjmdXWEzqUu73Vv87VkAI1mMerA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bQlNliMOmHaWWvpiP+J2lLtN28/WSuzoIv2taHx2GU6yxJengbeMBsxmJXYS99W92 uyB71MY8FNoVAgw4AUHjrMMh4clMJt+OBZXenaVp/qzkOm3AYuJsT3aW/0pzfHx+7l 5mvN9RainBkXl8fKAwtwrRvuHkjwi1ewCj2JExAg= 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 5.19 295/717] drm: bridge: adv7511: fix CEC power down control register offset Date: Sat, 22 Oct 2022 09:22:54 +0200 Message-Id: <20221022072505.403153582@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747374245884602054?= X-GMAIL-MSGID: =?utf-8?q?1747374245884602054?= 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 a031a0cd1f18..94de73cbeb2d 100644 --- a/drivers/gpu/drm/bridge/adv7511/adv7511.h +++ b/drivers/gpu/drm/bridge/adv7511/adv7511.h @@ -394,10 +394,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 0b266f28f150..99964f5a5457 100644 --- a/drivers/gpu/drm/bridge/adv7511/adv7511_cec.c +++ b/drivers/gpu/drm/bridge/adv7511/adv7511_cec.c @@ -359,7 +359,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); @@ -386,7 +386,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 Sat Oct 22 07:22: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: 7381 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1096661wrr; Sat, 22 Oct 2022 01:05:38 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5w6SIzovPms1asP0ncmcwp+6ilYqAukDppSpffXNQqBZKmBUyelOAH3t8Wj05/iMd9jIng X-Received: by 2002:a05:6a00:1907:b0:557:e83b:1671 with SMTP id y7-20020a056a00190700b00557e83b1671mr22785690pfi.65.1666425938219; Sat, 22 Oct 2022 01:05:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666425938; cv=none; d=google.com; s=arc-20160816; b=hMfFDubdtHeEDLcCT4jUJPCBE/rl8NbEI0WwGCDGZSFQJn86Oykib16fosfk/7bmfo 7ZKQLPBraksAZpowMLy3UDiFzhhUJNjfQl321Pz7PzRysXmfEWy2/kJC1XpR8WT+k54f APjUguX3+safctW/kcP4NwWbJDApmrgVFDVq7fEIzpWf/fmD8CcqsXD0Rjj7TOIIH6xd xiXAqPOGqZERp7kuGo8lNInf2hx0JcH8y35BS4britRdWZfedG1hLfYYu9Yt1vYH0IYn knT8OvTNORS0+4PVlIH8IhibTuec4MiyNGn7P1mEdm627G58Z++0FNd5oapP6xN21eJk fcMA== 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=FK8udx5g6EqaQ0vX+IbXDNGhPAHhwa8PempJmDXwer8=; b=SEpiR53XsJfRWRpgPFEQnUOIFfR75kFC2ce2MSAvsU/rY2eDpAGB79Rs5/JLYR7cd6 TXevExPJ6KJIlgA9wTf0gOupsZYGFkUDAz5yPhBPN6VOivyHVwdLlqX6hjpy5JhFiEDk w1Iy1lZrGiqgoE60xFo6DHHu5sMSuL4uKpL1m24EKjQrdlk9Z8UwPejn/2rIIgcZDOql M/CYJ4bEP+FAwDSEIZ7lL+WgVYujhT3JbYWFDvGdKN+F6aDm1NDvvySw5W5EbYNfAzhR 8kdb6Lc7ShR7rQfyncQmthb4NNdBXrUUPix71ls1P+4pKx6eRjcdjFvF2tvhFjObb0E/ x6Vg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=a9H7OtsL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 a192-20020a6390c9000000b0046af665ed92si2006557pge.480.2022.10.22.01.05.21; Sat, 22 Oct 2022 01:05: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=a9H7OtsL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S232881AbiJVIEV (ORCPT + 99 others); Sat, 22 Oct 2022 04:04:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47386 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232385AbiJVH6c (ORCPT ); Sat, 22 Oct 2022 03:58: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 9FB7A3C8C4; Sat, 22 Oct 2022 00:49: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 184C3B82DB3; Sat, 22 Oct 2022 07:48:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 54A95C433D6; Sat, 22 Oct 2022 07:48:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424919; bh=tHZ+Kc3V7pkYjCTEr+UzdBcU68D87nzYfaa2EbrgrWY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=a9H7OtsL5IujnMKO7g+ZSlQh2A4smObuH1COSs7+UzWPYzMj4QNZCInZHilmQMNSc PH6WP9NlL2VpwcEluonWie3E76KVE0e81sAS5KGvVR7e1S6j9uAOK0bL7tGaVmvgl6 Sc04gBymRV3yDWaNLpDJ4ZE8yaCnYFL3L/Oo68Jo= 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 5.19 296/717] drm: bridge: adv7511: unregister cec i2c device after cec adapter Date: Sat, 22 Oct 2022 09:22:55 +0200 Message-Id: <20221022072505.481613332@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747374244362967334?= X-GMAIL-MSGID: =?utf-8?q?1747374244362967334?= From: Alvin Šipraga [ Upstream commit 40cdb02cb9f965732eb543d47f15bef8d10f0f5f ] cec_unregister_adapter() assumes that the underlying adapter ops are callable. For example, if the CEC adapter currently has a valid physical address, then the unregistration procedure will invalidate the physical address by setting it to f.f.f.f. Whence the following kernel oops observed after removing the adv7511 module: Unable to handle kernel execution of user memory at virtual address 0000000000000000 Internal error: Oops: 86000004 [#1] PREEMPT_RT SMP Call trace: 0x0 adv7511_cec_adap_log_addr+0x1ac/0x1c8 [adv7511] cec_adap_unconfigure+0x44/0x90 [cec] __cec_s_phys_addr.part.0+0x68/0x230 [cec] __cec_s_phys_addr+0x40/0x50 [cec] cec_unregister_adapter+0xb4/0x118 [cec] adv7511_remove+0x60/0x90 [adv7511] i2c_device_remove+0x34/0xe0 device_release_driver_internal+0x114/0x1f0 driver_detach+0x54/0xe0 bus_remove_driver+0x60/0xd8 driver_unregister+0x34/0x60 i2c_del_driver+0x2c/0x68 adv7511_exit+0x1c/0x67c [adv7511] __arm64_sys_delete_module+0x154/0x288 invoke_syscall+0x48/0x100 el0_svc_common.constprop.0+0x48/0xe8 do_el0_svc+0x28/0x88 el0_svc+0x1c/0x50 el0t_64_sync_handler+0xa8/0xb0 el0t_64_sync+0x15c/0x160 Code: bad PC value ---[ end trace 0000000000000000 ]--- Protect against this scenario by unregistering i2c_cec after unregistering the CEC adapter. Duly disable the CEC clock afterwards too. 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-3-alvin@pqrs.dk Signed-off-by: Sasha Levin --- drivers/gpu/drm/bridge/adv7511/adv7511_drv.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c b/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c index 38bf28720f3a..6031bdd92342 100644 --- a/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c +++ b/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c @@ -1340,9 +1340,6 @@ static int adv7511_remove(struct i2c_client *i2c) { struct adv7511 *adv7511 = i2c_get_clientdata(i2c); - i2c_unregister_device(adv7511->i2c_cec); - clk_disable_unprepare(adv7511->cec_clk); - adv7511_uninit_regulators(adv7511); drm_bridge_remove(&adv7511->bridge); @@ -1350,6 +1347,8 @@ static int adv7511_remove(struct i2c_client *i2c) adv7511_audio_exit(adv7511); cec_unregister_adapter(adv7511->cec_adap); + i2c_unregister_device(adv7511->i2c_cec); + clk_disable_unprepare(adv7511->cec_clk); i2c_unregister_device(adv7511->i2c_packet); i2c_unregister_device(adv7511->i2c_edid); From patchwork Sat Oct 22 07:22: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: 7384 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1096691wrr; Sat, 22 Oct 2022 01:05:42 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6+XXbHjAMDcFH4cfEzLFxcDrPnZbwLcnzaJtVGaE6uFROMyiZmH1xuA83EmOBHafSMLfOe X-Received: by 2002:a17:90b:2812:b0:20d:7a3b:df3e with SMTP id qb18-20020a17090b281200b0020d7a3bdf3emr62815431pjb.169.1666425941882; Sat, 22 Oct 2022 01:05:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666425941; cv=none; d=google.com; s=arc-20160816; b=uZs1pRWgqTlyYfrVSqH37p/yXOurfpMXTIpCIwMjifY25DpOMQErGrZQ/3YK79jUFb FyoGuYSSrpgTvi/XX8jQ4OWDe0Div0zPcITTBN0HjwMPkuGVwJPuDw0D56AZ4mAZbodi RHs2yKdNpSdx33Xh4RNmqBxOSjvEPBxD4LyG9OupbUGIHzA+ksjuYCqKCkvq/nYXLVa7 WZZFAuIonlDLn72iqjyFR2jxF/15JfhXQ8Go/IeMC8j0bggk+f8fe9SNcW9LdXyf91dG xQXsO3yzkTpHVzg586cahRe6qRU0niht54aP0is6WLKC0UBaPF7tf3YNYIFc8zcn9tzG 51dw== 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=AR2L7fgchsaszYJsW8H+Esbc2IYduhF/A6px8aeEEkc=; b=w0Ez0eV4ONfYLiyenqUcWNDtvO8ObanQscnBHEXsZ76gsP2uwKuP2w7TNMLlkXesCM Fw0upmYNcvqyT8lS5AkY/xxvaciSJJBHalOvCZ352vt28EyLrX2awrrEISs7+dWXfHji Kr9gEPhcF+DVetS3egiuz1Y6ZKIEUXQipyELSfAJniOEU/t20W1/k9HZVFKJA1hirBcK f+wDhu3d6wl2vJ8AUtJwLlLiULzfpNN5kH7UKZZNqm4QdsAzS5IoTc9/lzvXmoUDEQEE AhB04P4ZsdG9qJ9MoeHsHX4qgy7VukI01YvnJpAB5GJtI+qKqDDwXolPctUTJAYsWKzw 5FPA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=AmehfEeT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 bk13-20020a056a02028d00b0045cfaf0bad4si26696135pgb.379.2022.10.22.01.05.27; Sat, 22 Oct 2022 01:05: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=AmehfEeT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S232964AbiJVIEc (ORCPT + 99 others); Sat, 22 Oct 2022 04:04:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49838 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232424AbiJVH66 (ORCPT ); Sat, 22 Oct 2022 03:58: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 3D282157881; Sat, 22 Oct 2022 00:49: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 DF76BB82E22; Sat, 22 Oct 2022 07:48:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 359DDC433D6; Sat, 22 Oct 2022 07:48:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424922; bh=0AaFD66QoCu+aNMC5pc5YET2gdKwWwa6+Akg5ngrniw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AmehfEeTcFg0WS4OwxR2zojA6veqk4affVAwEufd6/vk6FFwrb3eZS0QksGw3F//g SgFJ5HdF7Vf0UKyEg1BN8S4d3BQJqJzf6eXkh4CsXo3K1/9VcEdjZN8BBZWdhB5a/C mCb91YBUL7bKd1YVcxUAx3RjLkZN3fHQpolPbizs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dan Carpenter , Maxime Ripard , Sasha Levin Subject: [PATCH 5.19 297/717] drm/bridge: Avoid uninitialized variable warning Date: Sat, 22 Oct 2022 09:22:56 +0200 Message-Id: <20221022072505.578097055@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747374248118323053?= X-GMAIL-MSGID: =?utf-8?q?1747374248118323053?= From: Dan Carpenter [ Upstream commit 7d1202738efda60155d98b370b3c70d336be0eea ] This code works, but technically it uses "num_in_bus_fmts" before it has been initialized so it leads to static checker warnings and probably KMEMsan warnings at run time. Initialize the variable to zero to silence the warning. Fixes: f32df58acc68 ("drm/bridge: Add the necessary bits to support bus format negotiation") Signed-off-by: Dan Carpenter Signed-off-by: Maxime Ripard Link: https://patchwork.freedesktop.org/patch/msgid/YrrIs3hoGcPVmXc5@kili Signed-off-by: Sasha Levin --- drivers/gpu/drm/drm_bridge.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/drm_bridge.c b/drivers/gpu/drm/drm_bridge.c index c96847fc0ebc..36ca4092c1ab 100644 --- a/drivers/gpu/drm/drm_bridge.c +++ b/drivers/gpu/drm/drm_bridge.c @@ -823,8 +823,8 @@ static int select_bus_fmt_recursive(struct drm_bridge *first_bridge, struct drm_connector_state *conn_state, u32 out_bus_fmt) { + unsigned int i, num_in_bus_fmts = 0; struct drm_bridge_state *cur_state; - unsigned int num_in_bus_fmts, i; struct drm_bridge *prev_bridge; u32 *in_bus_fmts; int ret; @@ -945,7 +945,7 @@ drm_atomic_bridge_chain_select_bus_fmts(struct drm_bridge *bridge, struct drm_connector *conn = conn_state->connector; struct drm_encoder *encoder = bridge->encoder; struct drm_bridge_state *last_bridge_state; - unsigned int i, num_out_bus_fmts; + unsigned int i, num_out_bus_fmts = 0; struct drm_bridge *last_bridge; u32 *out_bus_fmts; int ret = 0; From patchwork Sat Oct 22 07:22: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: 7580 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1106287wrr; Sat, 22 Oct 2022 01:37:25 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5M15HsUifwa1sN2b4aeoOMW8cgDfnJOZHYojHdk/RUfHppASmfORzusHlLhF8l5lZeSWCq X-Received: by 2002:a17:903:186:b0:182:ecf9:6227 with SMTP id z6-20020a170903018600b00182ecf96227mr23637512plg.70.1666427845323; Sat, 22 Oct 2022 01:37:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666427845; cv=none; d=google.com; s=arc-20160816; b=az3e2sS+xfNeaHVeaXl4WwL9BM1Ou5hIOxNCcODzxjYBk/Me62jTTNPNtP5m3ijnJh 6O+3Iahl8Wsy8oIjrZucFBogtLy6zI1JiFFCiV3EXPnbOb6rfWr0zluhpJVOUzS98YVL gYV+qwNEK2BqJRipUBg8ZRg4gxt0DxPyKY6ncQGuvsxo5o/puXtNn6yILm0sq00PteoI LxCysvByN59UkFqj0P79TI3nCwfHxgScxACcL0A6hQDQBhcqmntw2z+iytPpodd6q2z6 5p2wwJqFJsqLTGlOSKXsGpKju4+KXhNrXSamo0oEBMMjICj+o57/BgOmcHSNba3HbOTq tc3Q== 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=pYwhLFZiUeP2h3tEcszipLvkPOELhk0OpaIfhgBrjww=; b=VZyUYNdOQTdNUi3mst0/7dbG/DhUXmlCGzKWpPXQcnH4xeaxMrlVJPI4R/oSUp7Ijh XjGopaX4LJXpk+IDYvWHHyRPb8uwJxB+Q23ertRs7+nRfyc3oyLY1JOfdmYF5OwohdUz UsQ8Ai2j1nK6rNlvmyhOmj7cz6FmpMdNLbP6RY+QLHRubkDMIlCjlOuM2uZhls9meQsC 4UQT91Ge61DH6ovhlvT11v0Kt2sUuStgXsN5cBY9IXs+CZxTM0I3lYcG38fZUysiC6yQ k2OMH0KA2Ak8ILAuF0BXh/YXnmO24QnJlSY2v+taROm/uoaJeT9atkVY/nyCSnB6pooY JB3g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=vvZ8vyPD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 c134-20020a63358c000000b00439cc644c03si27583190pga.228.2022.10.22.01.37.08; Sat, 22 Oct 2022 01:37: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=vvZ8vyPD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S230062AbiJVIcs (ORCPT + 99 others); Sat, 22 Oct 2022 04:32:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52732 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234070AbiJVI3b (ORCPT ); Sat, 22 Oct 2022 04:29: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 B43862E32C8; Sat, 22 Oct 2022 01:02: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 66AE7B82DFC; Sat, 22 Oct 2022 07:48:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D2FE1C433C1; Sat, 22 Oct 2022 07:48:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424925; bh=QhYu81M8WtAo05jbsad99FIeUifFSmuabQ0GNCOz7wI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vvZ8vyPDSY0WYLnikL/ahwL1htyv2K4oXkpUO57fbYRMf6bWhnN6l/s2mDNQEzvtU UjGw9kuAeEE2J0ha+CX+oFy6siW7jo9rkOmK+Tj0v8QJIoobvF/P4g4VLJ6w5Um4AY dfuv2byvEmcuLA0g1OPMdJ7P9/C1J8lPyyoCbwc0= 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 5.19 298/717] drm/mipi-dsi: Detach devices when removing the host Date: Sat, 22 Oct 2022 09:22:57 +0200 Message-Id: <20221022072505.704974634@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376244547528292?= X-GMAIL-MSGID: =?utf-8?q?1747376244547528292?= 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 c40bde96cfdf..c317ee9fa445 100644 --- a/drivers/gpu/drm/drm_mipi_dsi.c +++ b/drivers/gpu/drm/drm_mipi_dsi.c @@ -346,6 +346,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 Sat Oct 22 07:22: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: 7406 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1097340wrr; Sat, 22 Oct 2022 01:07:27 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5IN4r01xt7HJLA9s1Dg5F3ytbxmsy7r2w3aajryr58cOBOABPqRCCWVERWfn4XvAGs9jgc X-Received: by 2002:aa7:88c4:0:b0:563:9fe9:5da9 with SMTP id k4-20020aa788c4000000b005639fe95da9mr23189023pff.41.1666426047275; Sat, 22 Oct 2022 01:07:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666426047; cv=none; d=google.com; s=arc-20160816; b=pq+8Icqq41EQjb/+k/xua6xm4ikW4V40lZV/GXRrB7vxUkQxmjTpnJTVo57Hz1Cc2Q ZF+dL60Tu4bOGNMjOGzpR3XEelBfQIp6CSPAOF4tAzJAdvgbZWwms2b+Jlu9LHKSV87V ejcx3rFQ0v4YBd5DvGNQk/+7IpXlGzJz1hW7u3iBsZXCb7hyyAlRHNa+ng11eywKPSiS XWzbMFWOlajEHOdjSSoi9+wL8kALtZpdcub3wMNrAgLjiiTPmY8iqPidzREpLgwJISEV txmy0boaYfHDLeKjpYxl6dVoHbq9rpzdLWK2l0Gn6N3VKAYclPzYyb1AODlOhvEpblQg ZYtA== 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=Ko9cPGMesre6Lm8lyZdkvZ3XiHviKS2Au2xKN1iwn7c=; b=i/JyTG3K1JAskOSpGGGrnXhvMgjRjN4xDBWIGFKfmQQ0lJc70HSx7EN3Tb+mtiRN8Q o4XeiM1R5Q+PdCAgHGtap7q0QqO93wM3liRnc34Az7kE5wqdpEBcVcmoQDbHo7XMlg1P jiNKAJnPnQuTroJ4IadbQG9R94FGt1dMStT6CX06fSSt+WaY2kNDVVL7+BQ+RhAPPcEX gSWIZgwt4mv4sKx6RKf0h66Thi/cEuepFA7N1Ay+yC8z+xMGSOhtuWggXrJMK2lqc5C6 F5iEC80fVBzmtA8AwePW4qqxh+jIV8zTDu604VFFaIkTYj7NYTq5YzifD8w85epLlGb/ nxIA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=rleCEOgD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 q145-20020a632a97000000b00460b3aecba3si27878521pgq.542.2022.10.22.01.07.14; Sat, 22 Oct 2022 01:07: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=rleCEOgD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S232793AbiJVIGs (ORCPT + 99 others); Sat, 22 Oct 2022 04:06:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33538 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232937AbiJVIAY (ORCPT ); Sat, 22 Oct 2022 04:00:24 -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 876332670E7; Sat, 22 Oct 2022 00:50: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 B95276092A; Sat, 22 Oct 2022 07:48:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 98645C433C1; Sat, 22 Oct 2022 07:48:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424928; bh=phSnUqnY7Kv4or2QaTwjWCnYha4ABTmtG8iuKHhbVc4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rleCEOgD592SzoCgauYcseqt2AX0DcYo0TWJ61G2jm+n6S7tAcdO3foLjLMhZu2Du IqyFII2/WID2jootnTYPlrVDOgo/f2JRPg41dWMiLDzbek/uoqooJbbYsXGKB+Q7Lj En8I2etcMLmQ6YKG7avpxIo4gifTjJ2ETz2bZnuE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Pin-Yen Lin , Allen Chen , Robert Foss , Sasha Levin Subject: [PATCH 5.19 299/717] drm/bridge: it6505: Power on downstream device in .atomic_enable Date: Sat, 22 Oct 2022 09:22:58 +0200 Message-Id: <20221022072505.851111038@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747374358731099771?= X-GMAIL-MSGID: =?utf-8?q?1747374358731099771?= From: Pin-Yen Lin [ Upstream commit fbc1fdaa8338ec4ebd862d918a0ce3e12033e8a3 ] Send DPCD DP_SET_POWER_D0 command to the monitor in .atomic_enable callback. Without this command, some monitors won't show up again after changing the resolution. Fixes: 46ca7da7f1e8 ("drm/bridge: it6505: Send DPCD SET_POWER to downstream") Signed-off-by: Pin-Yen Lin Reviewed-by: Allen Chen Fixes: 46ca7da7f1e8 ("drm/bridge: it6505: Send DPCD SET_POWER to downstream") Signed-off-by: Robert Foss Link: https://patchwork.freedesktop.org/patch/msgid/20220714173715.v2.1.I85af54e9ceda74ec69f661852825845f983fc343@changeid Signed-off-by: Sasha Levin --- drivers/gpu/drm/bridge/ite-it6505.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/gpu/drm/bridge/ite-it6505.c b/drivers/gpu/drm/bridge/ite-it6505.c index 4b673c4792d7..e5626035f311 100644 --- a/drivers/gpu/drm/bridge/ite-it6505.c +++ b/drivers/gpu/drm/bridge/ite-it6505.c @@ -2945,6 +2945,9 @@ static void it6505_bridge_atomic_enable(struct drm_bridge *bridge, if (ret) dev_err(dev, "Failed to setup AVI infoframe: %d", ret); + it6505_drm_dp_link_set_power(&it6505->aux, &it6505->link, + DP_SET_POWER_D0); + it6505_update_video_parameter(it6505, mode); ret = it6505_send_video_infoframe(it6505, &frame); From patchwork Sat Oct 22 07:22: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: 7392 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1096931wrr; Sat, 22 Oct 2022 01:06:24 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4H6foyCPyRA7QzfnKvmqbT/HN3zK2wZ0htn4+ZS/E/1KRWWQw6F2q1biZ0Ov9vS85k1DV+ X-Received: by 2002:a62:4c2:0:b0:52e:bd4d:50e1 with SMTP id 185-20020a6204c2000000b0052ebd4d50e1mr23512010pfe.8.1666425984526; Sat, 22 Oct 2022 01:06:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666425984; cv=none; d=google.com; s=arc-20160816; b=IJ1nfRVdeKcpabeViwYeLA/8YbzT8gPcYzDHQQD0EhFuoWFxBXVxsPcTzq6vJOrCkM Etf17HGSdPdv9vYv8iKVJDW5Doyemql8Nbw3chI5oKGu8G3L4MDffxPo6uFRVJ6FGXpp +KyHLW+4Aj9Xhwjbgu7OCXOx45HOXpdY8RqfcY88xpQFF8/3laSVPV/9hPyKc4qaTZg8 BhkxUSeRTB2r7RaayZCXtCKyaELO8Wf6uZ3JOGEuaUtbkuT64Vmu2WUn6iFxjvvwYVQq Be9kl6fki0l95gNz2GKIO88kaooVK91wcqxuF3vM02PpusA4tVY1l/Ft0qVtejugP4oD ciNg== 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=GN0+YOy70zoYZPp5tqaWEccb5XQrXOx1r1uqZfcxcn4=; b=shqOSDnyj8XEdfoS7iSgmiS9THUhgY6IZ1iAD49Sp8+TN9gaeZxV9DFzhVyMqPyhl9 8vSFiLKzhVUXHWFeRlcnCdgx7Q7NYxuKaravc957vhtm0VTuwq2C4e2KFnsrl4AWmPjW 2rYRA+adFsDRcxvL9D8ZVvEFk6dTJvECnZvuFHJTkQtNALyKJ8POSYu3ac7XJmG+LreK oieoxlqw4xiAdQAwYWqYt5afequmm/zjF5RXjUjTXTC4ymv34uuL1INCA2QHMy15Ebj+ LgbfRfPgCFM7OOOad9tlHfK35glybsx+aETYXhRWzw1MVevliZlWaEj+zF/AngsrDDqI KxBw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=imBb4EXp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 s16-20020a170902b19000b00172ded6ff02si1589235plr.382.2022.10.22.01.06.10; Sat, 22 Oct 2022 01:06: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=imBb4EXp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S232582AbiJVIFZ (ORCPT + 99 others); Sat, 22 Oct 2022 04:05:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47768 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232431AbiJVH67 (ORCPT ); Sat, 22 Oct 2022 03:58: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 80FE7196B6E; Sat, 22 Oct 2022 00:49: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 26C37B82DF1; Sat, 22 Oct 2022 07:48:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7BE02C433C1; Sat, 22 Oct 2022 07:48:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424930; bh=EEbUB2+t3mQjhUpvR8BIh6PyoINtwoaI6t93TceIrNU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=imBb4EXpPFTMr8v2qUGlyBGEomh3Sj2bovV9XCQ0FE8ESLWnZ8hKCVRXrMLj7asEs i6ijqN4t7T+Im8bkkqSF0/xzZUs67eL3pZXf+BY01rrhQ5jiPv6V7y7LUL69134Hjq BBLgwkx8UcCWYbNWO4c08HYMVALpzXsvzfYNL3PU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Emil Velikov , Dmitry Osipenko , Gerd Hoffmann , Sasha Levin Subject: [PATCH 5.19 300/717] drm/virtio: Correct drm_gem_shmem_get_sg_table() error handling Date: Sat, 22 Oct 2022 09:22:59 +0200 Message-Id: <20221022072506.048459884@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747374293233915234?= X-GMAIL-MSGID: =?utf-8?q?1747374293233915234?= From: Dmitry Osipenko [ Upstream commit 64b88afbd92fbf434759d1896a7cf705e1c00e79 ] Previous commit fixed checking of the ERR_PTR value returned by drm_gem_shmem_get_sg_table(), but it missed to zero out the shmem->pages, which will crash virtio_gpu_cleanup_object(). Add the missing zeroing of the shmem->pages. Fixes: c24968734abf ("drm/virtio: Fix NULL vs IS_ERR checking in virtio_gpu_object_shmem_init") Reviewed-by: Emil Velikov Signed-off-by: Dmitry Osipenko Link: http://patchwork.freedesktop.org/patch/msgid/20220630200726.1884320-2-dmitry.osipenko@collabora.com Signed-off-by: Gerd Hoffmann Signed-off-by: Sasha Levin --- drivers/gpu/drm/virtio/virtgpu_object.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/gpu/drm/virtio/virtgpu_object.c b/drivers/gpu/drm/virtio/virtgpu_object.c index b38c338211aa..75a159df0af6 100644 --- a/drivers/gpu/drm/virtio/virtgpu_object.c +++ b/drivers/gpu/drm/virtio/virtgpu_object.c @@ -170,6 +170,7 @@ static int virtio_gpu_object_shmem_init(struct virtio_gpu_device *vgdev, shmem->pages = drm_gem_shmem_get_sg_table(&bo->base); if (IS_ERR(shmem->pages)) { drm_gem_shmem_unpin(&bo->base); + shmem->pages = NULL; return PTR_ERR(shmem->pages); } From patchwork Sat Oct 22 07:23: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: 7594 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1106358wrr; Sat, 22 Oct 2022 01:37:39 -0700 (PDT) X-Google-Smtp-Source: AMsMyM45bUvOqtAzyTXPRskjp+0WTEAV+tPHj5rWEWp2y9FeA+JIbzom4/+xCulCZD5E/AhtosoM X-Received: by 2002:a05:6a00:e1b:b0:537:7c74:c405 with SMTP id bq27-20020a056a000e1b00b005377c74c405mr23428047pfb.43.1666427859303; Sat, 22 Oct 2022 01:37:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666427859; cv=none; d=google.com; s=arc-20160816; b=IzQOc9pis7NBljHUY/yZJM4yXoNu5y1zv8kKaXbmhKS/YlCoM7FEVBGp6UM5oBVUU2 hO9T9C825EzO2e0oJy2uOap/JbYm+XoBUbyUSV5WpXHOBOeTRdOkOAdoXsrF9nAylOwQ QgsSepjV5f3YO4qCaqHhlNEjzY3HDr7h1G32pLpU7chTaAD/0I+jbMSIkk2kDVMByWpM rxzDWLASi44IFQvPbPRH57nDxNYap6t6FM8E8BMjS5leqcQOnLxwVYNdZ9T2nDCBg9pf WgqIKjnTXjGq3kVU95fpITqMBWuFnpTd8yIDwzb3wKXjidXKyKLYWCdSJYuaPR1rTmhk 1fZQ== 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=lmXJQqyWmTSjH0uKNwuqzSY2rFXV/thledKDzAAKiVY=; b=031DVTlpSu4MbXv4BQX5DFF+EjsoFSAWzdJHXV6KChJtd+QVf+HRbCCgVWus8YYnpz YRsmiG9C5u1c3bs99rwQi1vpN6bduZYettGpI+ZxnW4QkeV0SjZDXhv9RETOqX5NXMsD 9hJVQEa46fkw+BAD7bv3rHrBKqg3p0tJ4qVefxvFQ0vd5r2e8wbKx94EOrnE5k9I1KfP LY8wQgFOvqqEguFhlOq4l99qoWqVO5P6YuujYLRgoqkcGe+nff82KoOiwHp1ViV9ZJ7Y H2DRyTvwy7DVvRuBi3Iw7f5iGP7MXhjO2J3vScyRY/RT/nQ9ytAaOGzceOUThSFFyzdW eK6A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=DEUkwU0p; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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-20020aa79acb000000b0054875fd979bsi24550310pfp.216.2022.10.22.01.37.26; Sat, 22 Oct 2022 01:37: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=DEUkwU0p; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S233735AbiJVIZ4 (ORCPT + 99 others); Sat, 22 Oct 2022 04:25:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54606 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233960AbiJVIYZ (ORCPT ); Sat, 22 Oct 2022 04:24:25 -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 5E24A34720; Sat, 22 Oct 2022 00: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 433B860B00; Sat, 22 Oct 2022 07:48:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2A942C433C1; Sat, 22 Oct 2022 07:48:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424933; bh=OrgKGO73y1B/u0tS6QRxRrNmb9qgT0q8a/QBwrZrYSk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DEUkwU0pLF9jawIfsoRIkJa5N/ZcgZNmSqmrUCaowq4v2ytuAqBmeP8JGEmZiQGne YY4vtGE6ko95LYgc1x1zvTDpLKbFEhotcUIcTz+0YLCQ4igHeqygjOmxr82W5HcKQ+ pRh8ZdxLYBE5cvi1SRf2PQz5sEs1T8QeTPbMB8vM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Liang He , Robert Foss , Sasha Levin Subject: [PATCH 5.19 301/717] drm/bridge: tc358767: Add of_node_put() when breaking out of loop Date: Sat, 22 Oct 2022 09:23:00 +0200 Message-Id: <20221022072506.211730742@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376258812469993?= X-GMAIL-MSGID: =?utf-8?q?1747376258812469993?= From: Liang He [ Upstream commit 14e7157afb055248ed34901fcd6fbf54201cfea1 ] In tc_probe_bridge_endpoint(), we should call of_node_put() when breaking out of the for_each_endpoint_of_node() which will automatically increase and decrease the refcount. Fixes: 71f7d9c03118 ("drm/bridge: tc358767: Detect bridge mode from connected endpoints in DT") Signed-off-by: Liang He Reviewed-by: Robert Foss Signed-off-by: Robert Foss Link: https://patchwork.freedesktop.org/patch/msgid/20220719065447.1080817-2-windhl@126.com Signed-off-by: Sasha Levin --- drivers/gpu/drm/bridge/tc358767.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/bridge/tc358767.c b/drivers/gpu/drm/bridge/tc358767.c index 16affb42086a..c41c6c464b7f 100644 --- a/drivers/gpu/drm/bridge/tc358767.c +++ b/drivers/gpu/drm/bridge/tc358767.c @@ -1986,9 +1986,10 @@ static int tc_probe_bridge_endpoint(struct tc_data *tc) for_each_endpoint_of_node(dev->of_node, node) { of_graph_parse_endpoint(node, &endpoint); - if (endpoint.port > 2) + if (endpoint.port > 2) { + of_node_put(node); return -EINVAL; - + } mode |= BIT(endpoint.port); } From patchwork Sat Oct 22 07:23: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: 7373 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1096554wrr; Sat, 22 Oct 2022 01:05:26 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7gKx8oXqp7E20MF4uhB4gEzeKT1d04D8briohUFjTRuJuhXbePRKjCPzYqb7yrq/M+u8ox X-Received: by 2002:aa7:88c5:0:b0:565:eca5:c289 with SMTP id k5-20020aa788c5000000b00565eca5c289mr23788185pff.72.1666425926020; Sat, 22 Oct 2022 01:05:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666425926; cv=none; d=google.com; s=arc-20160816; b=w9V0JaAeBKfEY09ZIlVbk9sHSJqNCpyEWbwMaIymLVTHm2rvPkbFqPM2xvZVJcODNr csern1r38qpaWUzPgtnASpvqSZK8oSdFttOpOH1Vy6CH82XK1Rz0wKME7zy0BuUfr3BH HTABJszwOEB7jrJGoCqfPOk4RkF3g1OQwT/mHSrH8VqHptCkRC+n0ZHUJevQJD4AvUY7 yjVoEU+5s+RDRxuCqhb9izjKXvZvrp7rxLObdmghEy/t1KfMGbAKRt7zl/0sk9+UH7w9 FS/u5UcuLSPUwxSne6THkdY4uG6JKFqAsU8JaoQvqsiQAHExIrN8QccUTgEPxyVV6V24 rQEw== 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=OGSBkxhbWKJGXaAwt6r+yIV6B3wO9auTVMUwVgGEWYw=; b=ZWx+VMeVxsH77tV5ooAA+XnH7CoQ8uumIAFK1nsbwhxTdiVZUukXOYwevDxV/HtuaS XIZH6+qg6OmMnU/3JB7Pbb5Oq2HEI5sNaOhrBn32w3l1VALR1ceGMdJ9R9hvzxVpPZcZ qJ+Zvg2tseVgBC0vG0rQdQh/y3IMZ4K9h6dkVsVPFtBSM8rWUX/otN0mjc83VBO7MPd7 965e6b/1TxwS7oTLcjJoJOYmXSCZkgYt774HXypVhnV3Ftrdc04TzQ0TlFV1/K0YLg4l nNcBJsE+0SfTwYlYfy2Zg5v3Psrhy0bQX39drDbd/3NQLLoSqKSokUT+fQo81vG47Tva 1GkA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=H1i6NkRd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 mw4-20020a17090b4d0400b0020da3876a77si10072850pjb.119.2022.10.22.01.05.13; Sat, 22 Oct 2022 01:05: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=H1i6NkRd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S232241AbiJVID5 (ORCPT + 99 others); Sat, 22 Oct 2022 04:03:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47766 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232308AbiJVH5D (ORCPT ); Sat, 22 Oct 2022 03:57: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 747AA2615; Sat, 22 Oct 2022 00:48: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 2DD8EB82E11; Sat, 22 Oct 2022 07:47:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7CE25C433D6; Sat, 22 Oct 2022 07:47:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424854; bh=igiYCLXYnX3P4qwWb2eb2cyMpJjh/OfOIwrUzVmttEw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=H1i6NkRdpNAjfca8jjojXA1hQzvVWkJZJDirwO5mzVd/C6IjUMtSV/TLi1FwSekYk 7cXrwpwIZVIw5E4gAV124MKNxLb4pkQzQosu0mcPfwheL8FZgqdqW62gPS29Ng6XG/ lgGHUA66RAP+8Gz+4qae8TiNPE5+ZCTwYDZkZiwE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Chen-Yu Tsai , Neil Armstrong , Robert Foss , Sasha Levin Subject: [PATCH 5.19 302/717] drm/bridge: parade-ps8640: Fix regulator supply order Date: Sat, 22 Oct 2022 09:23:01 +0200 Message-Id: <20221022072506.305012646@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747374231661730522?= X-GMAIL-MSGID: =?utf-8?q?1747374231661730522?= From: Chen-Yu Tsai [ Upstream commit fc94224c2e0ae8d83ac511a3ef4962178505469d ] The datasheet says that VDD12 must be enabled and at full voltage before VDD33 is enabled. Reorder the bulk regulator supply names so that VDD12 is enabled before VDD33. Any enable ramp delays should be handled by setting proper constraints on the regulators. Fixes: bc1aee7fc8f0 ("drm/bridge: Add I2C based driver for ps8640 bridge") Signed-off-by: Chen-Yu Tsai Reviewed-by: Neil Armstrong Signed-off-by: Robert Foss Link: https://patchwork.freedesktop.org/patch/msgid/20220721092258.3397461-1-wenst@chromium.org Signed-off-by: Sasha Levin --- drivers/gpu/drm/bridge/parade-ps8640.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/bridge/parade-ps8640.c b/drivers/gpu/drm/bridge/parade-ps8640.c index edb939b14c04..38dcc606b499 100644 --- a/drivers/gpu/drm/bridge/parade-ps8640.c +++ b/drivers/gpu/drm/bridge/parade-ps8640.c @@ -596,8 +596,8 @@ static int ps8640_probe(struct i2c_client *client) if (!ps_bridge) return -ENOMEM; - ps_bridge->supplies[0].supply = "vdd33"; - ps_bridge->supplies[1].supply = "vdd12"; + ps_bridge->supplies[0].supply = "vdd12"; + ps_bridge->supplies[1].supply = "vdd33"; ret = devm_regulator_bulk_get(dev, ARRAY_SIZE(ps_bridge->supplies), ps_bridge->supplies); if (ret) From patchwork Sat Oct 22 07:23: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: 7500 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1104905wrr; Sat, 22 Oct 2022 01:33:41 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7DJaumRHAWrLBMUmAZ9esDy7c6QSLsur+dioUURwWNjdyWEOSkzxesFdhc0ReLkuS7nyD5 X-Received: by 2002:a17:903:2490:b0:17f:bf7e:c521 with SMTP id p16-20020a170903249000b0017fbf7ec521mr23149957plw.161.1666427620962; Sat, 22 Oct 2022 01:33:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666427620; cv=none; d=google.com; s=arc-20160816; b=JV3a+FuQkntq3rR2Tg87p5DBNVU2tPUHoHWt6klUQoKr8BA1/cNO79NqAwqhkICEKx qKbqLWgpImjq2KlI3SfLt9Ee7G252qm8l5+qxlTt62Pkyt5ujwOPkvczl/UsvqXxyZ03 kgYKOlMGTec1D5xrPqGO66anixZTyCHVEUvIozQa4jStkMadVhY0KOQvBYpZ2MaQEojd kNXxLig66BgE7bQhhG/9CcVjgkCy9JOtjcBDXoY79SpFf96VT4YhcGwn+rs6hBZaXuVN S/cQHAxmh/kWsrTK+Nz2+Sa9OECIlsKVdymjM4vgXMEAV4oOitnbu/pjmrIlpCH9gMpx 57oQ== 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=wNNi9XRp9MXuI5jU68P8di+W1fIdMmIRSN+4FcevlEY=; b=VczYaNU4f+bZxS3PaSsP9w7i7whJGhCkZOGJS09pTD+ic9gxQmgrzFUvfmI7j49Ugo mEOx7keTJGrUuuZkAhnjEUo3Mip+5fmTb0VhCzYtrT8ou15Bi6RizP07DwUUzK3oqqGE zojEg4wZFUc15bcoLN/+ifN/aPKMHzcKCEV1jW3mLNTCOcoiZtdYIatNRn9bN2rx38yp +596Dm0hNBBtByyR9jbuFj0mnOZbzTGXOBDTeWay38hjt60J5a8e4vn+JOd3UlwmhvUO /u9uQZIqi0civb+0M3YOUgag0vVGQRLBy/mW7x5exXb4oLsBQHOlkRSYTfrOAlvYNg4z FDeg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="Yz/wxypv"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 38-20020a630d66000000b004616889d5c2si29305988pgn.495.2022.10.22.01.33.26; Sat, 22 Oct 2022 01:33: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="Yz/wxypv"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S233675AbiJVITE (ORCPT + 99 others); Sat, 22 Oct 2022 04:19:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48814 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233310AbiJVIQk (ORCPT ); Sat, 22 Oct 2022 04:16: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 19D7CFF20A; Sat, 22 Oct 2022 00: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 ams.source.kernel.org (Postfix) with ESMTPS id E4AE6B82DFE; Sat, 22 Oct 2022 07:47:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5A4CEC433C1; Sat, 22 Oct 2022 07:47:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424857; bh=Vp52VCPyvK1uo9tqWME7V3/uLHnMjoZvQgmyVTyQAMM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Yz/wxypvxh9k7XoYZNbM4NAnmiI1ylJuujlR0akBjeXQrK2CjBljRyqGbN2feq44A z94UAqkUuU+ctabhyrVHLY1LWk+64e8llLRZ0DEM6gx+a+uqpBpy+41C+IzuPHxiZX 9i931XEDDRxqBw3rCUQpeelbPl8/A/sMH+Q+ZMpc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Simon Ser , Lyude Paul , Benjamin Gaignard , Jani Nikula , Sasha Levin Subject: [PATCH 5.19 303/717] drm/dp_mst: fix drm_dp_dpcd_read return value checks Date: Sat, 22 Oct 2022 09:23:02 +0200 Message-Id: <20221022072506.436381005@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376009505554978?= X-GMAIL-MSGID: =?utf-8?q?1747376009505554978?= From: Simon Ser [ Upstream commit 2ac6cdd581f48c8f68747156fde5868486a44985 ] drm_dp_dpcd_read returns the number of bytes read. The previous code would print garbage on DPCD error, and would exit with on error on success. Signed-off-by: Simon Ser Fixes: cb897542c6d2 ("drm/dp_mst: Fix W=1 warnings") Cc: Lyude Paul Cc: Benjamin Gaignard Reviewed-by: Jani Nikula Link: https://patchwork.freedesktop.org/patch/473500/ Signed-off-by: Sasha Levin --- drivers/gpu/drm/display/drm_dp_mst_topology.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/display/drm_dp_mst_topology.c b/drivers/gpu/drm/display/drm_dp_mst_topology.c index 18f2b6075b78..28dd741f7da1 100644 --- a/drivers/gpu/drm/display/drm_dp_mst_topology.c +++ b/drivers/gpu/drm/display/drm_dp_mst_topology.c @@ -4916,14 +4916,14 @@ void drm_dp_mst_dump_topology(struct seq_file *m, seq_printf(m, "dpcd: %*ph\n", DP_RECEIVER_CAP_SIZE, buf); ret = drm_dp_dpcd_read(mgr->aux, DP_FAUX_CAP, buf, 2); - if (ret) { + if (ret != 2) { seq_printf(m, "faux/mst read failed\n"); goto out; } seq_printf(m, "faux/mst: %*ph\n", 2, buf); ret = drm_dp_dpcd_read(mgr->aux, DP_MSTM_CTRL, buf, 1); - if (ret) { + if (ret != 1) { seq_printf(m, "mst ctrl read failed\n"); goto out; } @@ -4931,7 +4931,7 @@ void drm_dp_mst_dump_topology(struct seq_file *m, /* dump the standard OUI branch header */ ret = drm_dp_dpcd_read(mgr->aux, DP_BRANCH_OUI, buf, DP_BRANCH_OUI_HEADER_SIZE); - if (ret) { + if (ret != DP_BRANCH_OUI_HEADER_SIZE) { seq_printf(m, "branch oui read failed\n"); goto out; } From patchwork Sat Oct 22 07:23: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: 7369 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1095944wrr; Sat, 22 Oct 2022 01:03:54 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4jtQJtFqtsklRCxq+PWcdg6nvBtocqhZ/n2LACXvk4LpQjNqL8NK8DAh+E5h0y2Q735zcy X-Received: by 2002:a17:902:7297:b0:17f:93b5:5ecc with SMTP id d23-20020a170902729700b0017f93b55eccmr22774282pll.93.1666425834465; Sat, 22 Oct 2022 01:03:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666425834; cv=none; d=google.com; s=arc-20160816; b=jJSlk//skE1Tj29OVSOQYujHaKCnet7fZiI69cIffAFRb+sMrrdv3dqv61Q/VcxCY7 SiKcScGHdPHpKYZQB46bNa1ZWlPWJCvTd3/I5zTrIUtyiQ2jLHNqPnQKiFXNIMJ4q47U ON4lprxwdycI5VLCpGkKdFFaxgs15lp4/yusQlSR2IFzUIlOFpNPtpx3gbh+9rLmcwXJ tUDwHxADLKkuA6R1zpSYSrSSRpVopEBEkPmORrxxbnuJ6VOn6LpNdi71j4LgnGMi2sxM CekUq69iUPlz42jsdqiEsB3dsOzFUpKPCrXWouYQqw5MTnI4GM2TqepZzX97Gvcan0IH kRdg== 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=sAWuKxm5KE5yho2DHO6WVJq2sT80b5mYbiICUduid8U=; b=m2yZ1La2sjlbwURkGEp9cAwRNwwAKZaL9LuU5n2xwxeW0Nquleu2VD1SEXvHfx2eoZ ddA1HmL4rHSRfuxiiNZwoIjlzYyvtfzocj+OGitIUtWZzpLzyV4RRabqr4eMjJ2NFj4B P+oKmeZDtR1sHOQg1Jyc1nSHtjMX8XcmHfiDu7N3+G3hzyT2EFBh/B0MhRZ5eoTaa3qu mP6CPPdiIEmoBYMhZg09P8lDYA1GkC9l2thmkT8dMWH2J7xdoqYjHBpIZubbGsqFM6b+ Ai1bUp912lj3JQu9TtkbYuL8M3k25ULRPhBES+vjffQ7pyQvhjLGHiZJsCy9Nxboo0WW tm8A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=D+WtBPoC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 lb1-20020a17090b4a4100b0020c060f42cbsi2575471pjb.98.2022.10.22.01.03.41; Sat, 22 Oct 2022 01:03: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=D+WtBPoC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S232651AbiJVIDW (ORCPT + 99 others); Sat, 22 Oct 2022 04:03:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42734 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232437AbiJVHy7 (ORCPT ); Sat, 22 Oct 2022 03:54: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 B8E79D6BB2; Sat, 22 Oct 2022 00:48: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 8824DB82E22; Sat, 22 Oct 2022 07:47:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EF88BC433C1; Sat, 22 Oct 2022 07:47:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424860; bh=+6nKuQUQQhp/DPGhaTRSC6cZh6rw96mQOZjAlDCFnuo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=D+WtBPoClLlsv5bjcadVgmAlR2ZFo62A3YnZI8jwF1YS75KIws79CkpX42xChZu90 MczqqmHsaQBt1ns8qld4ytwFgjbyPnykqcESgFO3jmyYDBfjFBHutvMi8gctWqWMu4 ayTIIr6yhnL7FY2p9ds1w5mny1YnDX/yai0k8aW4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Liang He , Rob Herring , Daniel Vetter , Sasha Levin Subject: [PATCH 5.19 304/717] drm:pl111: Add of_node_put() when breaking out of for_each_available_child_of_node() Date: Sat, 22 Oct 2022 09:23:03 +0200 Message-Id: <20221022072506.554606120@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747374135450702716?= X-GMAIL-MSGID: =?utf-8?q?1747374135450702716?= From: Liang He [ Upstream commit e0686dc6f2252e009c455fe99e2ce9d62a60eb47 ] The reference 'child' in the iteration of for_each_available_child_of_node() is only escaped out into a local variable which is only used to check its value. So we still need to the of_node_put() when breaking of the for_each_available_child_of_node() which will automatically increase and decrease the refcount. Fixes: ca454bd42dc2 ("drm/pl111: Support the Versatile Express") Signed-off-by: Liang He Reviewed-by: Rob Herring Signed-off-by: Daniel Vetter Link: https://patchwork.freedesktop.org/patch/msgid/20220711131550.361350-1-windhl@126.com Signed-off-by: Sasha Levin --- drivers/gpu/drm/pl111/pl111_versatile.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/gpu/drm/pl111/pl111_versatile.c b/drivers/gpu/drm/pl111/pl111_versatile.c index bdd883f4f0da..963a5d5e6987 100644 --- a/drivers/gpu/drm/pl111/pl111_versatile.c +++ b/drivers/gpu/drm/pl111/pl111_versatile.c @@ -402,6 +402,7 @@ static int pl111_vexpress_clcd_init(struct device *dev, struct device_node *np, if (of_device_is_compatible(child, "arm,pl111")) { has_coretile_clcd = true; ct_clcd = child; + of_node_put(child); break; } if (of_device_is_compatible(child, "arm,hdlcd")) { From patchwork Sat Oct 22 07:23: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: 7374 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1096555wrr; Sat, 22 Oct 2022 01:05:26 -0700 (PDT) X-Google-Smtp-Source: AMsMyM60Re54uBVpDnDQqyjVgVQRQvH80zArubpUlcJrrtf3ZbbHP2OrJ+pzYXbB2n2IFp9AatSR X-Received: by 2002:a17:903:1105:b0:178:ae31:aad with SMTP id n5-20020a170903110500b00178ae310aadmr23047214plh.3.1666425926025; Sat, 22 Oct 2022 01:05:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666425926; cv=none; d=google.com; s=arc-20160816; b=aG+lZQS2hSGF30c+hNYXPDd26GGSk4r9FsEsRm15/OO2NmPfqe8bCQ5Tci5Gv8b2S9 pPLR4ppAYgbiO+nMU/iss4kpLgmLkK/jxz71zc+AcJ3Ce1Adogbq4TKS2sCjwFDRECHq l71bByECqfmigxIypF6LuBc/eTLHeWrZS6tLuXl4aKwITG9FAcnoERqVa6f2nzbLy/S2 u6vRJNxPIfNY3ieycG8bJKXdR+fmi4fLQFMVYk5BhbHO7Ua1NuUNlH52klZAMyoMUPOP Uk0Bglo/O+SQNJ1yzbEOQgFqXKZAnSZMjLl6k3WhPed0t6GNF4oT6ozpv2L2gJ2mWao+ ouIQ== 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=+2OlzfpS5MMajXr+hZlxFbQG1yH4zv3SD1T4YaiRlB8=; b=furDW0Lfu5+Ff8PAhDvKahgKhwMw1RAf/5MBqorBZraqvV07zTjsJCiyJGkMm82hnx xbPi+lVeaS2k21RorlICPxATMc5ib6TE3rQizl3a+D9sH5OxI7iNqG7JpEblvCVUaAxV 4OWRW0GKnTgDEQB+icH9CJA3KGg0xG3Y+xzSitFIFkaFtdXf8OHWT79KVX73Z3iyjEJp 7oMkQgghGmn/K5MA/lav6uUqXeaxCeOjef93psZDhQcrzGEmYuIm5NIXGvLSnmhiJgrw PvwOfS1lSWB2nB6Xoi4Q6Rzwix2ydvbXUgm7avz0bV8PDMikssb7B3yTRi4ih9sCpUnH aLtg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Ve7dQ7sI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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-20020a6381c2000000b00437e609414dsi26798720pgd.563.2022.10.22.01.05.12; Sat, 22 Oct 2022 01:05: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=Ve7dQ7sI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S232683AbiJVIDy (ORCPT + 99 others); Sat, 22 Oct 2022 04:03:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42722 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232277AbiJVH4z (ORCPT ); Sat, 22 Oct 2022 03:56: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 BC5425B108; Sat, 22 Oct 2022 00:48: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 861DEB82E17; Sat, 22 Oct 2022 07:47:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B405BC433C1; Sat, 22 Oct 2022 07:47:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424863; bh=juEF15GNwvV1UwXjbjTX7qGN5uH7jvIijRl/WPZIT4w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ve7dQ7sIUqHX948qp3RKXBk+e1F6fOSNMpEmz3zSuAQQOc6+fWezZsJif6mY+8IyY QY70ede0xTKdQcTe3RBfJMGuMERmj3j1qeLLiAPnM3k9YUI1xW4E7xit8cp25nXv4y elkfThQNbswyqu8ufDSjq0lUNqAWWv8rtVERWI2k= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dan Carpenter , Mark Brown , Sasha Levin Subject: [PATCH 5.19 305/717] ASoC: mt6359: fix tests for platform_get_irq() failure Date: Sat, 22 Oct 2022 09:23:04 +0200 Message-Id: <20221022072506.706529547@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747374231796475129?= X-GMAIL-MSGID: =?utf-8?q?1747374231796475129?= From: Dan Carpenter [ Upstream commit 51eea3a6fb4d39c2cc71824e6eee5949d7ae4d1c ] The platform_get_irq() returns negative error codes. It can't actually return zero, but if it did that should be treated as success. Fixes: eef07b9e0925 ("ASoC: mediatek: mt6359: add MT6359 accdet jack driver") Signed-off-by: Dan Carpenter Link: https://lore.kernel.org/r/YvThhr86N3qQM2EO@kili Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- sound/soc/codecs/mt6359-accdet.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sound/soc/codecs/mt6359-accdet.c b/sound/soc/codecs/mt6359-accdet.c index c190628e2905..7f624854948c 100644 --- a/sound/soc/codecs/mt6359-accdet.c +++ b/sound/soc/codecs/mt6359-accdet.c @@ -965,7 +965,7 @@ static int mt6359_accdet_probe(struct platform_device *pdev) mutex_init(&priv->res_lock); priv->accdet_irq = platform_get_irq(pdev, 0); - if (priv->accdet_irq) { + if (priv->accdet_irq >= 0) { ret = devm_request_threaded_irq(&pdev->dev, priv->accdet_irq, NULL, mt6359_accdet_irq, IRQF_TRIGGER_HIGH | IRQF_ONESHOT, @@ -979,7 +979,7 @@ static int mt6359_accdet_probe(struct platform_device *pdev) if (priv->caps & ACCDET_PMIC_EINT0) { priv->accdet_eint0 = platform_get_irq(pdev, 1); - if (priv->accdet_eint0) { + if (priv->accdet_eint0 >= 0) { ret = devm_request_threaded_irq(&pdev->dev, priv->accdet_eint0, NULL, mt6359_accdet_irq, @@ -994,7 +994,7 @@ static int mt6359_accdet_probe(struct platform_device *pdev) } } else if (priv->caps & ACCDET_PMIC_EINT1) { priv->accdet_eint1 = platform_get_irq(pdev, 2); - if (priv->accdet_eint1) { + if (priv->accdet_eint1 >= 0) { ret = devm_request_threaded_irq(&pdev->dev, priv->accdet_eint1, NULL, mt6359_accdet_irq, From patchwork Sat Oct 22 07:23: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: 7401 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1097209wrr; Sat, 22 Oct 2022 01:07:05 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6whmmeqQPp/F+SfLdyyBCHcKGC8Dz6xFGjOG7cpo21Dio5UnT2QNi63Pg3bJjhxU1FpP93 X-Received: by 2002:a17:902:aa8b:b0:178:8f1d:6936 with SMTP id d11-20020a170902aa8b00b001788f1d6936mr23394461plr.168.1666426024922; Sat, 22 Oct 2022 01:07:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666426024; cv=none; d=google.com; s=arc-20160816; b=W0Gmk69u4uc2AHmBreeoLm7Txz+zuGa4eyB/WzIjeSJgIlztqr9mFjamUeb0QA8mNd RuFmJFIyCuPphlKOI9RTwGfFG2Y13Giqx6Qn9JEhp/2bAzuGafsEXmTIvbXH8QV/dx0a mnQupilTFBenGiaWBw7/dC1c66c/ZHkCfMlj5YHIKIUwGtYBdKHLRkVo+ZVq9px7PGnd gSHS5jL8VVy2AqXEdn6ZdzmTgd1CJTqrBAfnU1mNcL4YBeU5UXa6DSvMWBT5NAIyDsbJ FlCjy+rgK5kp56SW2h5kwYpsnit6cW4mali56kDImx8zpYe5HNxUPvwScxGbsXcfk4ME Ci+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=z6C2OaagE+mqY6QU0d3MNuMQdawZKnMDjv2OSS9vaxo=; b=NPq4V1ryjS19dMtrDPY0AU8CMqIu6lmh6JElvICsJmva5glnLH47c8guzd3ZvlrPFL zkSGndA5BIFVAS8NK381BGmpViqzgmoxxPgMtqhz8pQo7MVsbPlPAp+7bqcci2NCRoHw tnKuUWzB+9CaHVcXqLeWuDGRCeg9hytwCQ/l9J+2i7S7DCDqkIJIdF+X0uDIgqwBdXH6 b6bkb7dSenQ0urHgucRyLIMvPcgzxd1IlTRTXyooTNW0K7nZm0eMZQvPr0YvLL6GccGC 355U1jO+E01qXTaSu/uR23Ekm/N+04ATjVK8NMlBhmeka5zqCq/JawUPjKmVhy8yh9ca U/tg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=pXntIxjv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 k9-20020aa788c9000000b00565977791a3si30242907pff.202.2022.10.22.01.06.49; Sat, 22 Oct 2022 01:07: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=pXntIxjv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S232803AbiJVIGa (ORCPT + 99 others); Sat, 22 Oct 2022 04:06:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42026 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232836AbiJVIAD (ORCPT ); Sat, 22 Oct 2022 04:00: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 5DC2A132EA8; Sat, 22 Oct 2022 00:50: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 6034460AFD; Sat, 22 Oct 2022 07:47:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 796A2C433C1; Sat, 22 Oct 2022 07:47:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424865; bh=jycY7O9BpnycH4RJKvzEcVNXUyY74AUmcG++4cJQdgI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pXntIxjvbdioxMs6WOhT8s35+Fu3fAVSWJJ0ur7kKP1ERqw1yNXh4JGKAwK2X3cvj BuV8x1/vLT2ofceHzMFDmXtsKhOlYREqxakClinbgHwDEFF+pi5DbDnc70RZPVtcQj 7oTUoWn/pOndSJ5YpYsXDE/Vqkjd0WkX4aBp/bW4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Javier Martinez Canillas , Abhinav Kumar , Sasha Levin Subject: [PATCH 5.19 306/717] drm/msm: Make .remove and .shutdown HW shutdown consistent Date: Sat, 22 Oct 2022 09:23:05 +0200 Message-Id: <20221022072506.812743481@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747374335218646447?= X-GMAIL-MSGID: =?utf-8?q?1747374335218646447?= From: Javier Martinez Canillas [ Upstream commit 0a58d2ae572adaec8d046f8d35b40c2c32ac7468 ] Drivers' .remove and .shutdown callbacks are executed on different code paths. The former is called when a device is removed from the bus, while the latter is called at system shutdown time to quiesce the device. This means that some overlap exists between the two, because both have to take care of properly shutting down the hardware. But currently the logic used in these two callbacks isn't consistent in msm drivers, which could lead to kernel panic. For example, on .remove the component is deleted and its .unbind callback leads to the hardware being shutdown but only if the DRM device has been marked as registered. That check doesn't exist in the .shutdown logic and this can lead to the driver calling drm_atomic_helper_shutdown() for a DRM device that hasn't been properly initialized. A situation like this can happen if drivers for expected sub-devices fail to probe, since the .bind callback will never be executed. If that is the case, drm_atomic_helper_shutdown() will attempt to take mutexes that are only initialized if drm_mode_config_init() is called during a device bind. This bug was attempted to be fixed in commit 623f279c7781 ("drm/msm: fix shutdown hook in case GPU components failed to bind"), but unfortunately it still happens in some cases as the one mentioned above, i.e: systemd-shutdown[1]: Powering off. kvm: exiting hardware virtualization platform wifi-firmware.0: Removing from iommu group 12 platform video-firmware.0: Removing from iommu group 10 ------------[ cut here ]------------ WARNING: CPU: 6 PID: 1 at drivers/gpu/drm/drm_modeset_lock.c:317 drm_modeset_lock_all_ctx+0x3c4/0x3d0 ... Hardware name: Google CoachZ (rev3+) (DT) pstate: a0400009 (NzCv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--) pc : drm_modeset_lock_all_ctx+0x3c4/0x3d0 lr : drm_modeset_lock_all_ctx+0x48/0x3d0 sp : ffff80000805bb80 x29: ffff80000805bb80 x28: ffff327c00128000 x27: 0000000000000000 x26: 0000000000000000 x25: 0000000000000001 x24: ffffc95d820ec030 x23: ffff327c00bbd090 x22: ffffc95d8215eca0 x21: ffff327c039c5800 x20: ffff327c039c5988 x19: ffff80000805bbe8 x18: 0000000000000034 x17: 000000040044ffff x16: ffffc95d80cac920 x15: 0000000000000000 x14: 0000000000000315 x13: 0000000000000315 x12: 0000000000000000 x11: 0000000000000000 x10: 0000000000000000 x9 : 0000000000000000 x8 : ffff80000805bc28 x7 : 0000000000000000 x6 : 0000000000000000 x5 : 0000000000000000 x4 : 0000000000000000 x3 : 0000000000000000 x2 : ffff327c00128000 x1 : 0000000000000000 x0 : ffff327c039c59b0 Call trace: drm_modeset_lock_all_ctx+0x3c4/0x3d0 drm_atomic_helper_shutdown+0x70/0x134 msm_drv_shutdown+0x30/0x40 platform_shutdown+0x28/0x40 device_shutdown+0x148/0x350 kernel_power_off+0x38/0x80 __do_sys_reboot+0x288/0x2c0 __arm64_sys_reboot+0x28/0x34 invoke_syscall+0x48/0x114 el0_svc_common.constprop.0+0x44/0xec do_el0_svc+0x2c/0xc0 el0_svc+0x2c/0x84 el0t_64_sync_handler+0x11c/0x150 el0t_64_sync+0x18c/0x190 ---[ end trace 0000000000000000 ]--- Unable to handle kernel NULL pointer dereference at virtual address 0000000000000018 Mem abort info: ESR = 0x0000000096000004 EC = 0x25: DABT (current EL), IL = 32 bits SET = 0, FnV = 0 EA = 0, S1PTW = 0 FSC = 0x04: level 0 translation fault Data abort info: ISV = 0, ISS = 0x00000004 CM = 0, WnR = 0 user pgtable: 4k pages, 48-bit VAs, pgdp=000000010eab1000 [0000000000000018] pgd=0000000000000000, p4d=0000000000000000 Internal error: Oops: 96000004 [#1] PREEMPT SMP ... Hardware name: Google CoachZ (rev3+) (DT) pstate: a0400009 (NzCv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--) pc : ww_mutex_lock+0x28/0x32c lr : drm_modeset_lock_all_ctx+0x1b0/0x3d0 sp : ffff80000805bb50 x29: ffff80000805bb50 x28: ffff327c00128000 x27: 0000000000000000 x26: 0000000000000000 x25: 0000000000000001 x24: 0000000000000018 x23: ffff80000805bc10 x22: ffff327c039c5ad8 x21: ffff327c039c5800 x20: ffff80000805bbe8 x19: 0000000000000018 x18: 0000000000000034 x17: 000000040044ffff x16: ffffc95d80cac920 x15: 0000000000000000 x14: 0000000000000315 x13: 0000000000000315 x12: 0000000000000000 x11: 0000000000000000 x10: 0000000000000000 x9 : 0000000000000000 x8 : ffff80000805bc28 x7 : 0000000000000000 x6 : 0000000000000000 x5 : 0000000000000000 x4 : 0000000000000000 x3 : 0000000000000000 x2 : ffff327c00128000 x1 : 0000000000000000 x0 : 0000000000000018 Call trace: ww_mutex_lock+0x28/0x32c drm_modeset_lock_all_ctx+0x1b0/0x3d0 drm_atomic_helper_shutdown+0x70/0x134 msm_drv_shutdown+0x30/0x40 platform_shutdown+0x28/0x40 device_shutdown+0x148/0x350 kernel_power_off+0x38/0x80 __do_sys_reboot+0x288/0x2c0 __arm64_sys_reboot+0x28/0x34 invoke_syscall+0x48/0x114 el0_svc_common.constprop.0+0x44/0xec do_el0_svc+0x2c/0xc0 el0_svc+0x2c/0x84 el0t_64_sync_handler+0x11c/0x150 el0t_64_sync+0x18c/0x190 Code: aa0103f4 d503201f d2800001 aa0103e3 (c8e37c02) ---[ end trace 0000000000000000 ]--- Kernel panic - not syncing: Attempted to kill init! exitcode=0x0000000b Kernel Offset: 0x495d77c00000 from 0xffff800008000000 PHYS_OFFSET: 0xffffcd8500000000 CPU features: 0x800,00c2a015,19801c82 Memory Limit: none ---[ end Kernel panic - not syncing: Attempted to kill init! exitcode=0x0000000b ]--- Fixes: 9d5cbf5fe46e ("drm/msm: add shutdown support for display platform_driver") Signed-off-by: Javier Martinez Canillas Reviewed-by: Abhinav Kumar Link: https://patchwork.freedesktop.org/patch/msgid/20220816134612.916527-1-javierm@redhat.com Signed-off-by: Sasha Levin --- drivers/gpu/drm/msm/msm_drv.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/msm/msm_drv.c b/drivers/gpu/drm/msm/msm_drv.c index 7c0314d6566a..c5f931b2574c 100644 --- a/drivers/gpu/drm/msm/msm_drv.c +++ b/drivers/gpu/drm/msm/msm_drv.c @@ -1169,10 +1169,15 @@ void msm_drv_shutdown(struct platform_device *pdev) struct msm_drm_private *priv = platform_get_drvdata(pdev); struct drm_device *drm = priv ? priv->dev : NULL; - if (!priv || !priv->kms) - return; - - drm_atomic_helper_shutdown(drm); + /* + * Shutdown the hw if we're far enough along where things might be on. + * If we run this too early, we'll end up panicking in any variety of + * places. Since we don't register the drm device until late in + * msm_drm_init, drm_dev->registered is used as an indicator that the + * shutdown will be successful. + */ + if (drm && drm->registered) + drm_atomic_helper_shutdown(drm); } static struct platform_driver msm_platform_driver = { From patchwork Sat Oct 22 07:23: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: 7399 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1097128wrr; Sat, 22 Oct 2022 01:06:52 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5H1jSKfj+qb6fPmzvA5FlcLur2u5aIAwnn7UMxraOVu0tFLSeYGjkmXTJeuxh+h1/VxYLh X-Received: by 2002:a05:6a00:1306:b0:555:6d3f:11ed with SMTP id j6-20020a056a00130600b005556d3f11edmr23280680pfu.55.1666426012731; Sat, 22 Oct 2022 01:06:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666426012; cv=none; d=google.com; s=arc-20160816; b=GMFtidzh6ucVSpbu+O5A0/CHYyuRZb8Geks0Vj+ZhZ39yBhw91kIxDzWeXfdqzKz74 Ep6xi3u4MYgH8BL011NTiL6PSKGG0yD5T273x9xruqyVTfKc/cNLyn5bdPjHxHfHr9Wl +2NKUPuBSRNvaPaAq2GwV0JwYtYLB6SL5T8KkUmfLg4hqXX834/aUi675GfS2xxe/WIm JfRol9sG10+wLRP0SQJca85NgPdScXmdgrXHiXWLyQx2v3r+JswmQ/TDquxiBc37IWfj 3rqzyvGbPQ7NFXtMlugla5hIeZAuWNQaGsHivI3zLh8RG/P76H6H38jBHOh+sXzxdYZ7 ZHqw== 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=yiJsqhWZ51lv6jSigGqrq4pl8vUIDOOi4yq4AybLCTw=; b=YTKXbOdHtZjJlcgOzuKgA31Am7J8+GGYhzYPojE32q5JTe+I4+cKgni5HsXZvAeU1i FrZ7xS5i6dyeRIOuzaMDHEgIOKZMFpr9QmYdOWGsYcDMowA3w8zzm4J4rn/w2roBgBDP OD2du844OYKQGsh0YUu1Ng3nToziD36tE84Jq/kMCNaUCZV0zHHkUvBf+B7AruuCdMfP XSwgRQoCht0fG5lOFd0mzr4wWMPTs27XIYGV4U+GkHVCW4sDlz8CkoT05DDFosZXCfYp Sn7fpUEB+ypc/T9vK9CGhO0LygcezKOR4gaUBFKKSw4YLJ+tevPKX3wBqZoIjzqkYNWf judg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=AhEFL6bA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 h8-20020a170902f70800b0017f59ed2dfasi25865171plo.63.2022.10.22.01.06.40; Sat, 22 Oct 2022 01:06: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=AhEFL6bA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S232848AbiJVIGR (ORCPT + 99 others); Sat, 22 Oct 2022 04:06:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40420 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232747AbiJVH7t (ORCPT ); Sat, 22 Oct 2022 03:59:49 -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 3B50F237DE; Sat, 22 Oct 2022 00:49: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 dfw.source.kernel.org (Postfix) with ESMTPS id 0697660AC3; Sat, 22 Oct 2022 07:47:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 19E06C433D6; Sat, 22 Oct 2022 07:47:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424868; bh=fpkRYoZRvDjIHv0uj2UG4gMaTQvdCazIzAKjiv1dqaU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AhEFL6bAqKSGqOZDssgTzuQNJFjXG/YgEJl18jrcEN7y2t1sU3QJEKB91sbQ2sSI3 hTcW9oQ/yJOFWN7smjxAVkqHGWsS4sMDMnCaVpfxyDSNGWFlRpwHs02vw4lA23xHll lvtZjP/cNJyioOexGtlj0zeulOpoI/uB36M2qILY= 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 5.19 307/717] platform/chrome: fix double-free in chromeos_laptop_prepare() Date: Sat, 22 Oct 2022 09:23:06 +0200 Message-Id: <20221022072506.971076554@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747374322831231985?= X-GMAIL-MSGID: =?utf-8?q?1747374322831231985?= 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 4e14b4d6635d..a2cdbfbaeae6 100644 --- a/drivers/platform/chrome/chromeos_laptop.c +++ b/drivers/platform/chrome/chromeos_laptop.c @@ -740,6 +740,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; @@ -748,17 +749,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); @@ -775,16 +774,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 (!IS_ERR_OR_NULL(info->fwnode)) fwnode_remove_software_node(info->fwnode); } - kfree(cros_laptop->i2c_peripherals); + kfree(i2c_peripherals); return error; } From patchwork Sat Oct 22 07:23: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: 7407 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1097367wrr; Sat, 22 Oct 2022 01:07:32 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6E2k9WFB2f7uric1c7flhIz1rsu4ebZTB/0xtcQ4VnfqhnQLEF1/YCIzNfHrpgt8f30ZHC X-Received: by 2002:a17:902:70c4:b0:178:54cf:d397 with SMTP id l4-20020a17090270c400b0017854cfd397mr22529742plt.24.1666426051879; Sat, 22 Oct 2022 01:07:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666426051; cv=none; d=google.com; s=arc-20160816; b=m3lr0W5J5MM8DFG/xWldVI6SadkyeTYXRuwfmBFgDRHpUj78OETAjuaqH3HthUstaF xfw9Cvf+rHZVQlO5DLPQgi3y4h889cFq6/XiNC1vi9Ai8ltLnr9q1cMuHHCr7cIRW7dP iSy8PvxdQFRRo0dY1l0eZVFNxd8RjRGJP/RUg/0KUotYoosYWiXM1nAdKZfbXQJIVF/F X83lO3ci/GUYWV97ASWo5Fokkn/Klp57/aOBXJkGyYcIJwKVngTbTvQIuqF6aejrjz6x TRuLWV//UBcNyPSAucAfw9IKEsewkblyqe6poGjF0LtuWocfHXS/nr7XkbD34ndjReD6 n7Aw== 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=vvI3+VWA+2mcXN4KXlGusSzPv4NyoHHcIk3s6pIfUvg=; b=Rs9gWtNOfWzFPClhOo8MS+EbVY7YAeKe3RBL+LNyqzE7okk/q6VPMLi+FQHXh1k2z3 o/bSENMcrJqKya5INc62OmaVJwnqap07RcMVqguzukczc34+Rxm2zlBJHkGHoUPcQkYJ YNV8s/FyJCthTG82Gf5nr+MYZ07XI24C58Gp0+sRyzpg3hOIgCW86ffZ3u71bvmpgWLV b/rX5QmBNACACBWhk8r+1N5XdRsclV2Wn6x4dzSk74Ffs6rYXOWt4FyMNnNvUEKsJPcA mVSBI3wUIO1xwRv58J2EDW4tlo+hS7tWiFWW2X74jXrRlgS5yJmh1VcNO70pKAsChl77 ufEA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=OvlJOOH0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 nh7-20020a17090b364700b0020d56f57eafsi1871864pjb.120.2022.10.22.01.07.19; Sat, 22 Oct 2022 01:07: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=OvlJOOH0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S232626AbiJVIHC (ORCPT + 99 others); Sat, 22 Oct 2022 04:07:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40728 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232981AbiJVIAa (ORCPT ); Sat, 22 Oct 2022 04:00:30 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7A160253BD6; Sat, 22 Oct 2022 00:50: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 5F354B82E20; Sat, 22 Oct 2022 07:47:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B73B3C433D7; Sat, 22 Oct 2022 07:47:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424871; bh=FGLUiA+nI5EoWurmpv9dwxt2Cwd9+rHSJ5m5kYCZDGs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OvlJOOH0zUz/2cGCojgm2eB7PVb9N5O68I60841tNneeaoR+MuaAXtu0SO9A0eNHL KdMX7nUp6lVFOKGOiPApKm3Rg4foVrcFeBR9R5GR9hJYVPkSAMePFa2l/IHu+LEMmi eAaxfDu58WF9XMOTzY2KfjmvsgOOakBXmJxqViPg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dan Carpenter , Guenter Roeck , Tzung-Bi Shih , Sasha Levin Subject: [PATCH 5.19 308/717] platform/chrome: fix memory corruption in ioctl Date: Sat, 22 Oct 2022 09:23:07 +0200 Message-Id: <20221022072507.107751863@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747374363607406911?= X-GMAIL-MSGID: =?utf-8?q?1747374363607406911?= From: Dan Carpenter [ Upstream commit 8a07b45fd3c2dda24fad43639be5335a4595196a ] If "s_mem.bytes" is larger than the buffer size it leads to memory corruption. Fixes: eda2e30c6684 ("mfd / platform: cros_ec: Miscellaneous character device to talk with the EC") Signed-off-by: Dan Carpenter Reviewed-by: Guenter Roeck Signed-off-by: Tzung-Bi Shih Link: https://lore.kernel.org/r/Yv8dpCFZJdbUT5ye@kili Signed-off-by: Sasha Levin --- drivers/platform/chrome/cros_ec_chardev.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/platform/chrome/cros_ec_chardev.c b/drivers/platform/chrome/cros_ec_chardev.c index fd33de546aee..0de7c255254e 100644 --- a/drivers/platform/chrome/cros_ec_chardev.c +++ b/drivers/platform/chrome/cros_ec_chardev.c @@ -327,6 +327,9 @@ static long cros_ec_chardev_ioctl_readmem(struct cros_ec_dev *ec, if (copy_from_user(&s_mem, arg, sizeof(s_mem))) return -EFAULT; + if (s_mem.bytes > sizeof(s_mem.buffer)) + return -EINVAL; + num = ec_dev->cmd_readmem(ec_dev, s_mem.offset, s_mem.bytes, s_mem.buffer); if (num <= 0) From patchwork Sat Oct 22 07:23: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: 7370 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1096027wrr; Sat, 22 Oct 2022 01:04:06 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4mtqOzO4d9/gRZ7Z26sPJPMZlRzSBvfdEDiNQJqVtssQiRbSD3D1vQU/NRcSbfkISQnpa2 X-Received: by 2002:a63:211d:0:b0:44e:f294:8440 with SMTP id h29-20020a63211d000000b0044ef2948440mr19311608pgh.103.1666425846678; Sat, 22 Oct 2022 01:04:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666425846; cv=none; d=google.com; s=arc-20160816; b=tVZ4WPQzGYVMSU+mPCcyo/uLr7eUtOXdkjhOhlcHAljJIn0hhlseaa072rGg2tBhCv 3xMMb50BDic1L9CaVPigHBG5CeNkopNqDAb0F+z84po7/4fcnzRB2AbxYsk2eimImytm /js9yoHeKVq/03RoX2suloc+4LruAJy502n5upwntBq8nroEWTXMxHXVU4DxBNe4LrFv 3Wy8KxOZw9H4ck74jUpQskqHID1EFkEmpwKLQtJ/qHzIvIhRp/XFLJX2cyWbkNsbr78+ VbvudiabVJvyZKfclhs5QnD8VdOFW/8twQOssYeveP17HrgchC587BpytLNtLhpidhoD ZUiA== 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=jjgKJHG4vB4Rm3ZerTgQFCggJRja6GbNL/KGS0rRpyU=; b=hpMeje1BlxVVT1jx25WyZm8Xf9gHr1M+DmcG7xC7SL874UmVAR2TPxUfkz+8IKXHxU cfYoKDXJEPCUxK3qZ9Xm3oava09gXb2fCxPXIH9zI9QGWQR1uvdweTwbK7+mrvdLkBK7 FTAV7R1w/e07nwqknp+6XLKlkwDyxfb/6y6FAFIfht/RzHT2tRLRF3QiuPTSpH7+zcRJ B+epdBYHagP20EaAQLPCcCqfCmxq7sFbustT5Ss9ZZSQefbFMkzvRpPrCG17+M/yPo2/ ag1Cp2zeva33O4Nrl/aoxTL1y+Q4tiodTXydtqPIy3f5bCrmlQgbDZ93cc868bhisIUS S+Zg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=aMEgqGMZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 x12-20020a170902ec8c00b00177ee2efd41si18840952plg.265.2022.10.22.01.03.53; Sat, 22 Oct 2022 01:04: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=aMEgqGMZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S232658AbiJVIDc (ORCPT + 99 others); Sat, 22 Oct 2022 04:03:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49838 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232457AbiJVHzC (ORCPT ); Sat, 22 Oct 2022 03:55:02 -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 358F14A13E; Sat, 22 Oct 2022 00:48: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 ED4A3B82DFC; Sat, 22 Oct 2022 07:47:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5BF26C433C1; Sat, 22 Oct 2022 07:47:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424873; bh=a9QnuAj57d0g4YM0AcqhAV4WtYyzOmeBc0b2HC4WlRs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=aMEgqGMZUHqaDjRfuljiItxlvLV1c5A4bWwtvQiQRVtp02nQgeZO7YSOz3FzTIAST KbAbdbJMSbHmwUk0CkSIeXyNeL7ElJIEFmx7pOFg22PwGMSDFqUFTC8S8egThCTYpM McCw2nRMtGsfNG90hdX5xJOAp2f9D0XyvijYpuoA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Rob Clark , Gerd Hoffmann , Sasha Levin Subject: [PATCH 5.19 309/717] drm/virtio: Fix same-context optimization Date: Sat, 22 Oct 2022 09:23:08 +0200 Message-Id: <20221022072507.258233889@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747374148483779316?= X-GMAIL-MSGID: =?utf-8?q?1747374148483779316?= From: Rob Clark [ Upstream commit 3007dc2af6e86ac00b4daf7414142637fdf50bfa ] When VIRTGPU_EXECBUF_RING_IDX is used, we should be considering the timeline that the EB if running on rather than the global driver fence context. Fixes: 85c83ea915ed ("drm/virtio: implement context init: allocate an array of fence contexts") Signed-off-by: Rob Clark Link: http://patchwork.freedesktop.org/patch/msgid/20220812224001.2806463-1-robdclark@gmail.com Signed-off-by: Gerd Hoffmann Signed-off-by: Sasha Levin --- drivers/gpu/drm/virtio/virtgpu_ioctl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/virtio/virtgpu_ioctl.c b/drivers/gpu/drm/virtio/virtgpu_ioctl.c index 9b2702116f93..3b1701607aae 100644 --- a/drivers/gpu/drm/virtio/virtgpu_ioctl.c +++ b/drivers/gpu/drm/virtio/virtgpu_ioctl.c @@ -168,7 +168,7 @@ static int virtio_gpu_execbuffer_ioctl(struct drm_device *dev, void *data, * array contains any fence from a foreign context. */ ret = 0; - if (!dma_fence_match_context(in_fence, vgdev->fence_drv.context)) + if (!dma_fence_match_context(in_fence, fence_ctx + ring_idx)) ret = dma_fence_wait(in_fence, true); dma_fence_put(in_fence); From patchwork Sat Oct 22 07:23: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: 7372 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1096046wrr; Sat, 22 Oct 2022 01:04:11 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5Emy4QopxX1cnZLqKcm0kNAJCa9U7ThjcXve0v028H9sE9B8rBKBVtnxuY/wjRVOuuNXKw X-Received: by 2002:a62:ee0c:0:b0:558:5c4:97dc with SMTP id e12-20020a62ee0c000000b0055805c497dcmr23391338pfi.14.1666425851467; Sat, 22 Oct 2022 01:04:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666425851; cv=none; d=google.com; s=arc-20160816; b=ozWo9LREbo2S3Q63L92FlER4h3ijkV0whO20o4rcWylVOLMiN0miSAdJhRqTDZe3LS POl0U75AeG3cK9k8aFRPNAiLZnzBVYTOrCuYgjy9/YSjWE/VuNsm2qFdkZ40Z/ologQ6 byTkUb1plAtQmptHmcI7lEDe24Zsma2OMsdt7/1SinlcfiZ/J9d3i9XV9+6v+BiAPSFo kVJdMypQTRZh/PWEMKchYqhuDd88+CJl6Q+4WuxnycDjYZJOCUS72nVYpEb+CM8Zjr6j xa3K6Gifb3EOG1cgZtPnVqZT6ZaLaA7Um8a0P4b4AW/ik9E6gNw/PaU/iNRjBqGsK/yq cX9w== 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=XJw7hRf7v7CYsVI12yQlkPPQK1t6Rjzos+P+WdCGH1w=; b=oehyaLjaYETE7YMdkXpJl41PgMXf2XPglHGrk9+pG8PEmJq6g9FqPbqddd3J4aFxsV j6lYn3D/7FDu1jzuuD52lV/+483KQjLwhhgVFb9lPjGTRgcccFWlaYdOBhqS7AJrmvpm vpaJKn05mkv1YRpoktzUDtJBN/eK5Dm013aZh+SUWd4/cD5OBgqCijBPdL9Lo4JPYJDl IWHFQZzS5XU+9Mw9SHH7dftylOZ8kAlWbImTPV8fFibBqZIwxCcQUSMvsPEfXThtfGwW Gj9kvpZsr1OCHZ1nGUhB9KJH/0Fq+xJg3Dg+snB1HWWxdGGH4kPIzaSLj4GPQOaNbgkX EmGQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ZZ1fVqY7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 t6-20020a17090ad50600b0020ab20c54fesi1989305pju.114.2022.10.22.01.03.57; Sat, 22 Oct 2022 01:04: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=ZZ1fVqY7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S232663AbiJVIDi (ORCPT + 99 others); Sat, 22 Oct 2022 04:03:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42398 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232159AbiJVHzv (ORCPT ); Sat, 22 Oct 2022 03:55: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 50EBE108DCE; Sat, 22 Oct 2022 00:48: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 8497DB82DF1; Sat, 22 Oct 2022 07:47:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F1A07C433D6; Sat, 22 Oct 2022 07:47:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424876; bh=Gdu8FkS/FwQ0ued/QFrnPBGMV5XAprYfU7DZMznsFag=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZZ1fVqY7WBzNjKlsHxU6NP/lw4fclO0p2fHoG9C9UgrhHbzTwqg3CNw+O6MJURtkD XTGBbDnHFlXLxjbelh0fBSLUsb9HK1tELTOrZA3DHahsl4+gz3dZkLltCzlfGWwDC9 sQH1PwRvvZn77lHkPJhvCGFYmts+InbuD4yslMI8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Takashi Iwai , Kuninori Morimoto , Mark Brown , Sasha Levin Subject: [PATCH 5.19 310/717] ASoC: soc-pcm.c: call __soc_pcm_close() in soc_pcm_close() Date: Sat, 22 Oct 2022 09:23:09 +0200 Message-Id: <20221022072507.380977444@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747374153628146336?= X-GMAIL-MSGID: =?utf-8?q?1747374153628146336?= From: Kuninori Morimoto [ Upstream commit 6bbabd28805f36baf6d0f3eb082db032a638f612 ] commit b7898396f4bbe16 ("ASoC: soc-pcm: Fix and cleanup DPCM locking") added __soc_pcm_close() for non-lock version of soc_pcm_close(). But soc_pcm_close() is not using it. It is no problem, but confusable. static int __soc_pcm_close(...) { => return soc_pcm_clean(rtd, substream, 0); } static int soc_pcm_close(...) { ... snd_soc_dpcm_mutex_lock(rtd); => soc_pcm_clean(rtd, substream, 0); snd_soc_dpcm_mutex_unlock(rtd); return 0; } This patch use it. Fixes: b7898396f4bbe16 ("ASoC: soc-pcm: Fix and cleanup DPCM locking") Cc: Takashi Iwai Signed-off-by: Kuninori Morimoto Link: https://lore.kernel.org/r/87czctgg3w.wl-kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- sound/soc/soc-pcm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c index 0c1de5624842..6359d00b7bda 100644 --- a/sound/soc/soc-pcm.c +++ b/sound/soc/soc-pcm.c @@ -723,7 +723,7 @@ static int soc_pcm_close(struct snd_pcm_substream *substream) struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream); snd_soc_dpcm_mutex_lock(rtd); - soc_pcm_clean(rtd, substream, 0); + __soc_pcm_close(rtd, substream); snd_soc_dpcm_mutex_unlock(rtd); return 0; } From patchwork Sat Oct 22 07:23:10 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 7509 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1104993wrr; Sat, 22 Oct 2022 01:33:51 -0700 (PDT) X-Google-Smtp-Source: AMsMyM64HihGrna5aICbZpNEx9RaN42B9PY6v3pfZMXrnjq6bLDTsvThUTp4NkJfZN+sNm65//aA X-Received: by 2002:a17:90b:4a51:b0:20d:4ded:3c26 with SMTP id lb17-20020a17090b4a5100b0020d4ded3c26mr62015991pjb.23.1666427631392; Sat, 22 Oct 2022 01:33:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666427631; cv=none; d=google.com; s=arc-20160816; b=tCVRGyzJ300332zRkCx7mVd+l79Z5r1KJujA25p7YHeHqoSS/7bFHOQgCy1JKODZOI 6G6TpTNYp2TSDFg2zIJ9oDukHphwtqyXRNMaZ5Vyti7Jtd95d3fvBXGgcxUFCsGSnl68 9HTzJFPcBB7//WneVLkxWGNpR5wdRzu6FdmnPb+ewxKtzyFqa/jXR8pVflXD3HxM6XDX xHA4maHHQO2ffo8CbsrGU0FuxK2xKqACND2kFPVTumY2V8Y2UehypSFXJ17MN+ccK8JL SwWmnio4QmJtoC30UvxqmgsJ7qVfcpsYs4BS9cqM7bvou29WLSlBcnOQtrWm9A/BQksj r60w== 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=Wea5tuZCyejUUOeFShn9tag2ou3s3i3YEvhxpCHwNao=; b=NSk0T9OtQehTIa4NZ+jY9skXwFVVq4fE8sKChyjDb50y7d0N2y7iVmMWtA7ESP3Fg/ yM1zsUqLnztmdYPfDIXPcoTjtfuQFJcmaTIpPTznikPmqhoCI0Zd91InA4FvhE4DOAyZ N/ooM5D0oTzRFzMwD9pGYlDwyZt3yF3W2b8Lj/+PIW5UEVyTG9hbSgGfdEHAb25IE+8q iLlHg9TPR2cO+x8FmzaGoMVaX+mxEXsJd26a9HDv9DSHvHfWbMmV1cZsycN/ddl5e75k msdu+L52q11q4IsBqXB/1uARnJ8Mww9H/yrol/7eA4oOWi1WIo5Y+/Bihi9B8VP1K+cE F9Hw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=wdzYe1GF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 j4-20020a056a00234400b005436ab3283csi23892063pfj.43.2022.10.22.01.33.36; Sat, 22 Oct 2022 01:33: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=wdzYe1GF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S233553AbiJVIUU (ORCPT + 99 others); Sat, 22 Oct 2022 04:20:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50008 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233681AbiJVITF (ORCPT ); Sat, 22 Oct 2022 04: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 881A22CCA0F; Sat, 22 Oct 2022 00:58: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 A70FE60AD9; Sat, 22 Oct 2022 07:47:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8FA7AC433D6; Sat, 22 Oct 2022 07:47:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424879; bh=7+fjVzf8Ald8bczHdsBDYgEKHhhR9GoYNcP6Ek+3Dd4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wdzYe1GFCY3mPdCF8tvgk/r+UbybuwvunTZuljf5yxptOZXTl3AfaCQ/Agw8nBv3h +A0ksoDWsFFgFs7nJxSazFr39wqp4Rzib0/qzfnhVPh0+3+96JK6NwRSKzHFiOytu0 EFsXxk0BiNzUhZuEkJFv/hTnCD7+sEwwNFPInDmo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?utf-8?q?Martin_Povi=C5=A1er?= , Mark Brown , Sasha Levin Subject: [PATCH 5.19 311/717] ASoC: tas2764: Allow mono streams Date: Sat, 22 Oct 2022 09:23:10 +0200 Message-Id: <20221022072507.487813118@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376019962807403?= X-GMAIL-MSGID: =?utf-8?q?1747376019962807403?= From: Martin Povišer [ Upstream commit 23204d928a27146d13e11c9383632775345ecca8 ] The part is a mono speaker amp, but it can do downmix and switch between left and right channel, so the right channel range is 1 to 2. (This mirrors commit bf54d97a835d ("ASoC: tas2770: Allow mono streams") which was a fix to the tas2770 driver.) Fixes: 827ed8a0fa50 ("ASoC: tas2764: Add the driver for the TAS2764") Signed-off-by: Martin Povišer Link: https://lore.kernel.org/r/20220825140241.53963-2-povik+lin@cutebit.org Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- sound/soc/codecs/tas2764.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sound/soc/codecs/tas2764.c b/sound/soc/codecs/tas2764.c index 4cb788f3e5f7..00df36fb3ede 100644 --- a/sound/soc/codecs/tas2764.c +++ b/sound/soc/codecs/tas2764.c @@ -485,7 +485,7 @@ static struct snd_soc_dai_driver tas2764_dai_driver[] = { .id = 0, .playback = { .stream_name = "ASI1 Playback", - .channels_min = 2, + .channels_min = 1, .channels_max = 2, .rates = TAS2764_RATES, .formats = TAS2764_FORMATS, From patchwork Sat Oct 22 07:23:11 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 7380 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1096598wrr; Sat, 22 Oct 2022 01:05:31 -0700 (PDT) X-Google-Smtp-Source: AMsMyM791BzsD1bNVirb+HtVW/P2wTm1O3xeWmm87hoxxvxWyNC2C00bM+g8Blw+4gDkmUANdnlY X-Received: by 2002:a63:571c:0:b0:452:e934:4058 with SMTP id l28-20020a63571c000000b00452e9344058mr19333857pgb.426.1666425931089; Sat, 22 Oct 2022 01:05:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666425931; cv=none; d=google.com; s=arc-20160816; b=ZyGBlPLfx/P+7LpDrdIdWP/wi+m17HeL1pHznpjgWGvDRy3YJFnGCX95pqAm6x0mer IhBG/Rgjwi/MIgVZbRpvalJbxFyI5WpgEZNlkwJL3ibyUitS6CWUEyII8Dex+s3aVSvy 7ti2lOHMaEsTUeou5/2j35hJy2k7E/ZpvXD4OT/82I9cwVvQLuMo/4SAcQOJpWbNS+KM SNAaDyFxESPY4nkzic8Yi3HgcyP+u2QQwoqBdkLzawjQ1uRATCie8a5+Y/GYo7eqRLl9 byoCP5mNBNlt1Fv/jjmk61E/ducvFYDm3qpbl3L/Z1vCnzoyPg1cfFW8azEjvlhRBPUd 9NQQ== 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=m7/YXtN3h0vTT77IRVuMOK3W3RLIfPEvB1edy4Z/FSE=; b=j5gCbTib7XXUZYQGp5r1aiToNVzNUsAS6ytJbi7GpNUuptxIpNoOPjzxoP6E3kF/z+ O54MgIDzF+HyCBEPgAAiT85j9eO+EqBXUwFCZvNCtCgN+itlfvSrkSqaOC+4atGuE7bf +HW5Vcj4wSbLgSHEuxlAs2e6vdQMoBC93p0Y1sk/FwliJ4p0DIFMnPisKPHQ8UfDDW+W T8fgdSy8D5KCxdqqpCslJmUs04SxsxOlmv9thTr8RrjjY8e3yqPdio7k0dC8vBLVfO9K qEm1GTP0qpQI3XaMtwf4+99gU+rhchh9rcUgsipU5WfGCPy6ZYxhb1B2abWpdhEpPt/n 4PDw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=zkwAnTZu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 l184-20020a6388c1000000b0046ebe02835bsi3865240pgd.283.2022.10.22.01.05.17; Sat, 22 Oct 2022 01:05: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=zkwAnTZu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S232847AbiJVIES (ORCPT + 99 others); Sat, 22 Oct 2022 04:04:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35400 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232354AbiJVH5t (ORCPT ); Sat, 22 Oct 2022 03:57: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 416C71705D; Sat, 22 Oct 2022 00:48: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 83405B82DF0; Sat, 22 Oct 2022 07:48:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F22EFC433D6; Sat, 22 Oct 2022 07:48:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424884; bh=68E9zNx4nfInYFDMqNQFvaQmUhl+e8RIQ89AnbruO/c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zkwAnTZuJe9TvYaC2dtscU+NaUVoNJBCwtaUfGjl/L8V53Eq1qS9lWFO6AyOq6fKM tqLf7g6y24bhKz4eNVmwWZ+srai8rP+TMiThCBIualKwES0I7AtQtyJ8qstnHNfDMq Z6eC+Dzj52e2VdXTgo6WVqGzlHY9PcpmHaRT+ORw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?utf-8?q?Martin_Povi=C5=A1er?= , Mark Brown , Sasha Levin Subject: [PATCH 5.19 312/717] ASoC: tas2764: Drop conflicting set_bias_level power setting Date: Sat, 22 Oct 2022 09:23:11 +0200 Message-Id: <20221022072507.624459929@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747374236899827647?= X-GMAIL-MSGID: =?utf-8?q?1747374236899827647?= From: Martin Povišer [ Upstream commit 09273f38832406db19a8907a934687cc10660a6b ] The driver is setting the PWR_CTRL field in both the set_bias_level callback and on DAPM events of the DAC widget (and also in the mute_stream method). Drop the set_bias_level callback altogether as the power setting it does is in conflict with the other code paths. (This mirrors commit c8a6ae3fe1c8 ("ASoC: tas2770: Drop conflicting set_bias_level power setting") which was a fix to the tas2770 driver.) Fixes: 827ed8a0fa50 ("ASoC: tas2764: Add the driver for the TAS2764") Signed-off-by: Martin Povišer Link: https://lore.kernel.org/r/20220825140241.53963-3-povik+lin@cutebit.org Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- sound/soc/codecs/tas2764.c | 33 --------------------------------- 1 file changed, 33 deletions(-) diff --git a/sound/soc/codecs/tas2764.c b/sound/soc/codecs/tas2764.c index 00df36fb3ede..c11406bbe5bc 100644 --- a/sound/soc/codecs/tas2764.c +++ b/sound/soc/codecs/tas2764.c @@ -50,38 +50,6 @@ static void tas2764_reset(struct tas2764_priv *tas2764) usleep_range(1000, 2000); } -static int tas2764_set_bias_level(struct snd_soc_component *component, - enum snd_soc_bias_level level) -{ - struct tas2764_priv *tas2764 = snd_soc_component_get_drvdata(component); - - switch (level) { - case SND_SOC_BIAS_ON: - snd_soc_component_update_bits(component, TAS2764_PWR_CTRL, - TAS2764_PWR_CTRL_MASK, - TAS2764_PWR_CTRL_ACTIVE); - break; - case SND_SOC_BIAS_STANDBY: - case SND_SOC_BIAS_PREPARE: - snd_soc_component_update_bits(component, TAS2764_PWR_CTRL, - TAS2764_PWR_CTRL_MASK, - TAS2764_PWR_CTRL_MUTE); - break; - case SND_SOC_BIAS_OFF: - snd_soc_component_update_bits(component, TAS2764_PWR_CTRL, - TAS2764_PWR_CTRL_MASK, - TAS2764_PWR_CTRL_SHUTDOWN); - break; - - default: - dev_err(tas2764->dev, - "wrong power level setting %d\n", level); - return -EINVAL; - } - - return 0; -} - #ifdef CONFIG_PM static int tas2764_codec_suspend(struct snd_soc_component *component) { @@ -549,7 +517,6 @@ static const struct snd_soc_component_driver soc_component_driver_tas2764 = { .probe = tas2764_codec_probe, .suspend = tas2764_codec_suspend, .resume = tas2764_codec_resume, - .set_bias_level = tas2764_set_bias_level, .controls = tas2764_snd_controls, .num_controls = ARRAY_SIZE(tas2764_snd_controls), .dapm_widgets = tas2764_dapm_widgets, From patchwork Sat Oct 22 07:23:12 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 7610 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1106733wrr; Sat, 22 Oct 2022 01:38:51 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6VJQefTHal5ll45oPEcPPxIVTJ30cpSe1jXswNqib4RcRmYIrKGMoE72ox0kReqNIG4luk X-Received: by 2002:a17:90b:1808:b0:20c:8409:2007 with SMTP id lw8-20020a17090b180800b0020c84092007mr27259209pjb.226.1666427920815; Sat, 22 Oct 2022 01:38:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666427920; cv=none; d=google.com; s=arc-20160816; b=HCcj84XG92cmOFxXEfb11mteNfVUD4zmS/V+fbheEQK7Fhvx4ymKQL9BBsdrkJxaAd siFS1bj0oE7teqzJFnbLJJrpn9oqgd26h/ehBU4AYzTCd+AlKLHYx5KyiBr0P/v6bm8V 77dlWK29zilD6GZYUadQ4YQJapwxZIm07xrVSaeNv2jw+YmheLaLuzRWEo0kKTc5P19u EFHWzbAm05CGUNQk1+Jku8O7AxrwnJG1uKA0TgfzSJMMdFKB5D0Cw9rFnGF7BHJlmpmJ eiprtHHNoCuBE54xQIg7CyAbd35HI+Hc7d7V6pqydxpSEgbDEN2ejE6jTchS9zYsIEX1 5efA== 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=0WdEKypt9W0WpVhmhz/qBxiM1g2ytYelDkaM19a+Dc4=; b=BO1S50omZON34z11Vkk40kMWM41z6T/uhP3iVWjC+VTZ+MjQ0MfItFttE2xpI4TILK D2wS1GMrULD3uD5xAuuvihTzXwBjs5rzfBA0xNJNroctlU9yTzWF+SREdgPJMliOtO8E epHmkIu15N+Wyj6vxavdZoA0j430d9JZZzClvK7CCUUgAYrcX9BO7CQ1T3uuqeM7gYLX FrG68p+v5O/vdncw0FIFyandjJkN6W93PDotKnI6OONchbTbuiVDfheC6WkzZ4jQG1bD fFwylKeUcmItcL/ciWXkZ2+wZtrtFGJifJlQ1Cb2fIHbX2AKS7QonvK8wwah9oqevVnM geQQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=SHQT+cq4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 pf2-20020a17090b1d8200b002006ace0cc4si2300044pjb.138.2022.10.22.01.38.26; Sat, 22 Oct 2022 01:38: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=SHQT+cq4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S230160AbiJVIcz (ORCPT + 99 others); Sat, 22 Oct 2022 04:32:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52734 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234066AbiJVI3a (ORCPT ); Sat, 22 Oct 2022 04:29:30 -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 F27DC2E25E3; Sat, 22 Oct 2022 01: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 6D838B82E21; Sat, 22 Oct 2022 07:48:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9BB44C433D6; Sat, 22 Oct 2022 07:48:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424887; bh=v6XsYF2D1laF2NTZayhIX9dkIblRNqa009SYmswfqmg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SHQT+cq4xIkzOqtVVgnJ5okLEgtGOFjPVy4ZW2M6xwEj749gCpi0lIdfbkXm9qYC0 zShbvl48XodWbdaVbrEKmaFYEpSmBEaxxtcd1K764M0CrCaij1WbryWmd6xgzEatQp U+sRee/vU9XLP2/xzLWBHGpI3mNFq2k1OTcHNaXI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?utf-8?q?Martin_Povi=C5=A1er?= , Mark Brown , Sasha Levin Subject: [PATCH 5.19 313/717] ASoC: tas2764: Fix mute/unmute Date: Sat, 22 Oct 2022 09:23:12 +0200 Message-Id: <20221022072507.733879519@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376323289460424?= X-GMAIL-MSGID: =?utf-8?q?1747376323289460424?= From: Martin Povišer [ Upstream commit f5ad67f13623548e5aff847f89700c178aaf2a98 ] Because the PWR_CTRL field is modeled as the power state of the DAC widget, and at the same time it is used to implement mute/unmute, we need some additional book-keeping to have the right end result no matter the sequence of calls. Without this fix, one permanently mutes an ongoing stream by toggling the associated speaker pin control. (This mirrors commit 1e5907bcb3a3 ("ASoC: tas2770: Fix handling of mute/unmute") which was a fix to the tas2770 driver.) Fixes: 827ed8a0fa50 ("ASoC: tas2764: Add the driver for the TAS2764") Signed-off-by: Martin Povišer Link: https://lore.kernel.org/r/20220825140241.53963-4-povik+lin@cutebit.org Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- sound/soc/codecs/tas2764.c | 57 +++++++++++++++++++++----------------- 1 file changed, 32 insertions(+), 25 deletions(-) diff --git a/sound/soc/codecs/tas2764.c b/sound/soc/codecs/tas2764.c index c11406bbe5bc..7ae7a5249f95 100644 --- a/sound/soc/codecs/tas2764.c +++ b/sound/soc/codecs/tas2764.c @@ -34,6 +34,9 @@ struct tas2764_priv { int v_sense_slot; int i_sense_slot; + + bool dac_powered; + bool unmuted; }; static void tas2764_reset(struct tas2764_priv *tas2764) @@ -50,6 +53,26 @@ static void tas2764_reset(struct tas2764_priv *tas2764) usleep_range(1000, 2000); } +static int tas2764_update_pwr_ctrl(struct tas2764_priv *tas2764) +{ + struct snd_soc_component *component = tas2764->component; + unsigned int val; + int ret; + + if (tas2764->dac_powered) + val = tas2764->unmuted ? + TAS2764_PWR_CTRL_ACTIVE : TAS2764_PWR_CTRL_MUTE; + else + val = TAS2764_PWR_CTRL_SHUTDOWN; + + ret = snd_soc_component_update_bits(component, TAS2764_PWR_CTRL, + TAS2764_PWR_CTRL_MASK, val); + if (ret < 0) + return ret; + + return 0; +} + #ifdef CONFIG_PM static int tas2764_codec_suspend(struct snd_soc_component *component) { @@ -82,9 +105,7 @@ static int tas2764_codec_resume(struct snd_soc_component *component) usleep_range(1000, 2000); } - ret = snd_soc_component_update_bits(component, TAS2764_PWR_CTRL, - TAS2764_PWR_CTRL_MASK, - TAS2764_PWR_CTRL_ACTIVE); + ret = tas2764_update_pwr_ctrl(tas2764); if (ret < 0) return ret; @@ -118,14 +139,12 @@ static int tas2764_dac_event(struct snd_soc_dapm_widget *w, switch (event) { case SND_SOC_DAPM_POST_PMU: - ret = snd_soc_component_update_bits(component, TAS2764_PWR_CTRL, - TAS2764_PWR_CTRL_MASK, - TAS2764_PWR_CTRL_MUTE); + tas2764->dac_powered = true; + ret = tas2764_update_pwr_ctrl(tas2764); break; case SND_SOC_DAPM_PRE_PMD: - ret = snd_soc_component_update_bits(component, TAS2764_PWR_CTRL, - TAS2764_PWR_CTRL_MASK, - TAS2764_PWR_CTRL_SHUTDOWN); + tas2764->dac_powered = false; + ret = tas2764_update_pwr_ctrl(tas2764); break; default: dev_err(tas2764->dev, "Unsupported event\n"); @@ -170,17 +189,11 @@ static const struct snd_soc_dapm_route tas2764_audio_map[] = { static int tas2764_mute(struct snd_soc_dai *dai, int mute, int direction) { - struct snd_soc_component *component = dai->component; - int ret; - - ret = snd_soc_component_update_bits(component, TAS2764_PWR_CTRL, - TAS2764_PWR_CTRL_MASK, - mute ? TAS2764_PWR_CTRL_MUTE : 0); + struct tas2764_priv *tas2764 = + snd_soc_component_get_drvdata(dai->component); - if (ret < 0) - return ret; - - return 0; + tas2764->unmuted = !mute; + return tas2764_update_pwr_ctrl(tas2764); } static int tas2764_set_bitwidth(struct tas2764_priv *tas2764, int bitwidth) @@ -494,12 +507,6 @@ static int tas2764_codec_probe(struct snd_soc_component *component) if (ret < 0) return ret; - ret = snd_soc_component_update_bits(component, TAS2764_PWR_CTRL, - TAS2764_PWR_CTRL_MASK, - TAS2764_PWR_CTRL_MUTE); - if (ret < 0) - return ret; - return 0; } From patchwork Sat Oct 22 07:23: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: 7748 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1111217wrr; Sat, 22 Oct 2022 01:56:30 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6sKCyiDur0uHLcm1wQ707oWzCrWE9iHjQQhfiFFpwiz8xOUOURHh042ssX47uRcJpMGOJT X-Received: by 2002:aa7:c6c1:0:b0:460:f684:901a with SMTP id b1-20020aa7c6c1000000b00460f684901amr10684716eds.6.1666428990068; Sat, 22 Oct 2022 01:56:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666428990; cv=none; d=google.com; s=arc-20160816; b=HwayaMm5RAPdpuw3lku11Y+K72+w5MxwNtKp+KNCDkJFAuC6v5uV7ZV+OtoqV/IeXk AlX+mcYLnie5nuS5k+3RauFxdWInK6GblpXungTxnaNGdTMGEi+44O/31/tflozzMD/V 6bRdPOffC622LI/QhxrrhEeLVgf8fRVV8ciR1JyOvysDlZkbBqeg8KlJDfwoq2lWyuLO HzTNZUpQ8sHy9XZtE/cqJW3qC13l+SVPQLWqrqE2BbAGGcgHLhfbk4fybqlc5KSVTJR5 rXspkMep0XPZ91gxqwnROfn4Y+6N0tgXhP3mVHOflNcROgp+iLCl+3jErJpM+OxRBcEv Jg6Q== 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=MS4M3jPRe/eceu35UWAgoEN/5imJ9m/RGty4IwYH/v0=; b=d9mRSBcO/kVptjHMUXYXMRtiOjeQNEKgC0hvTIlWPzjzhLi7smYXKzgF+ImJsTIznz Nn7309mw/Ene8wP2RM/jz9oJ7ieBrbYCnPvaRXR6L7P8TOfKC6LLpj4oFx2Gw4bBH89p vsWkE8zs35EZM4pR7T/Cg3tZJt13pOTJn9OZExiZqMJt3N2Rp8PVfRHuP2p+1RyiWASV IwRZCpyQnJ6y0pO/c+0PQFqn+tQgBFREhEIIu182XAHGT64Faq2cUFnLL438NF4ccqGe qncVAHRBDaYE1s6PTsW7vbc56PXhv8mLXE9woT6rc052cKsTKof/oExndk8h8He0C/AD sRyQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=2oPgO31E; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 qa44-20020a17090786ac00b0078a10c159b4si22489663ejc.290.2022.10.22.01.56.06; Sat, 22 Oct 2022 01:56: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=2oPgO31E; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S234905AbiJVIzd (ORCPT + 99 others); Sat, 22 Oct 2022 04:55:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38842 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235021AbiJVIyE (ORCPT ); Sat, 22 Oct 2022 04:54: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 B15B92F3DB5; Sat, 22 Oct 2022 01:13: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 043EEB82E26; Sat, 22 Oct 2022 07:48:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5958CC433D6; Sat, 22 Oct 2022 07:48:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424889; bh=zT6MDUv1/e0ceaKhgr+62ulahZ4sloOaOytnAgt472Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=2oPgO31EY3XgzCFS5eBicQfbpLGjOlMBmPW2LYWg2Pnc/qFxYzAgW11aPIOpUmcaX iPNOi44Omx3wCiV454MmrH0U5fXf2MKN+3vbZ6uwSBpX3yjevtIGy1scd56VzcXF1d HJnfMNMt4eEVh8wDUwcnu4YP8nAdidb644BeD++U= 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 5.19 314/717] platform/x86: msi-laptop: Fix old-ec check for backlight registering Date: Sat, 22 Oct 2022 09:23:13 +0200 Message-Id: <20221022072507.831291749@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747377444998545136?= X-GMAIL-MSGID: =?utf-8?q?1747377444998545136?= 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 24ffc8e2d2d1..0960205ee49f 100644 --- a/drivers/platform/x86/msi-laptop.c +++ b/drivers/platform/x86/msi-laptop.c @@ -1048,8 +1048,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 Sat Oct 22 07:23: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: 7409 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1097429wrr; Sat, 22 Oct 2022 01:07:43 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7LKWDSejnVh0bt2iI0JrXbYPUafJdmz+wB5PyESXN1zaZy0gNB9reLpMGJ3FsErQPPHnq0 X-Received: by 2002:a63:f91e:0:b0:456:ccc4:85c2 with SMTP id h30-20020a63f91e000000b00456ccc485c2mr19283551pgi.624.1666426063547; Sat, 22 Oct 2022 01:07:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666426063; cv=none; d=google.com; s=arc-20160816; b=RU+OdgtS049AfV/nRWDh/tivxrr/dy/3AtgRNH9OAfwlIB3KILApKJPJjgu+vho0gi +OYICHTwm72f2D7c/P5Wuchdzo7cRGfgPs4JisUO2o4pkXIr5vfO5f7WZX/KAIWMjScb sZkiHh+sajWhit4Ub8wfRmc/ESMwHaskiYKfLwOGLtyjLHo/7Zhe455vrQvMut+fmea1 iVt9+IBSjhnp2ZHVIRDeLem+U0ACV8/dz5D9MPCVCK/HWzo2GtQhehMLo/D+mt6AGxTm SR/oVSoj9dD0QbKTwjGvq1QxqB4VTkj/pmCnh4umYZMtlbORX7cJOyhrdrLVA8FeD/59 tD/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=vrHf8FVIz3ooUssgsspeBESZGqBVJvKQiAbgpLMHoOQ=; b=Gnl/6lB40abqTmRrEVutFUhGttnEBRKxyVacGjoUB4++fTg63WfNiQYW49XU3oCWo4 FzMZO5iIrPmNpSUVAnbxqXIfaDO/lrfkL+aiC3gK9kmSjWZe5JFJfLZTy1cLTYFNywTE mFGsU98jGcjHM510HOHRJXzoF1I78TD3xbiYBZtOmThVLrAviUldWm/s/QOCrOesMoet CIz49xX0IGOoC/IZiOKDuZ0mIprFndnef7iUOnp/m/HFIYz4dyeoYV96OQoL5i2AitrR gITEs79JWwR/ot9pN1Nv1rttH4Y2uy0gvmgq+0g6WzhkkKuM8XdeczYfvpzi5Pzw8L8/ RqDA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=jd3jQsQ6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 9-20020a631849000000b0045f83471400si28451780pgy.328.2022.10.22.01.07.30; Sat, 22 Oct 2022 01:07: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=jd3jQsQ6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S232887AbiJVIGw (ORCPT + 99 others); Sat, 22 Oct 2022 04:06:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34414 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232950AbiJVIA0 (ORCPT ); Sat, 22 Oct 2022 04:00:26 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D72EE2681F0; Sat, 22 Oct 2022 00:50: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 D554D60AD7; Sat, 22 Oct 2022 07:48:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E7F11C433D6; Sat, 22 Oct 2022 07:48:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424892; bh=LMiQSmINL+WpJ+Efxa9vMNxwvWoH4bT4QVIx9zBBdls=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jd3jQsQ6jGifMreDjrFoO5KQV/8IThSbSOS8f+86frtV9BKIkMruUi8VmPl8F+CGF vVHWPy/FoMD6j8Yt9BwQrwkotm2bbFTugcJF89SyYtg2xTh2aHcMCyH03OTUyEDeAF R6JwcVffEwyTXyZE9ctJ8nfRXVBn6KTo9umdW3NA= 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 5.19 315/717] platform/x86: msi-laptop: Fix resource cleanup Date: Sat, 22 Oct 2022 09:23:14 +0200 Message-Id: <20221022072507.941071274@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747374375895619460?= X-GMAIL-MSGID: =?utf-8?q?1747374375895619460?= 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 0960205ee49f..3e935303b143 100644 --- a/drivers/platform/x86/msi-laptop.c +++ b/drivers/platform/x86/msi-laptop.c @@ -1116,6 +1116,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(); @@ -1136,6 +1138,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 Sat Oct 22 07:23: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: 7513 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1105053wrr; Sat, 22 Oct 2022 01:34:01 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5OUS/kcqRLANBr7TRufTUSi17E3Fv03RvSEYBJxtUlAaThlAmnIsN1qPHbgAbBtHphmhWb X-Received: by 2002:aa7:8a0d:0:b0:562:a5bf:95e9 with SMTP id m13-20020aa78a0d000000b00562a5bf95e9mr23289916pfa.24.1666427640861; Sat, 22 Oct 2022 01:34:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666427640; cv=none; d=google.com; s=arc-20160816; b=cAFTqrUD/95GY5rHS5P5s9jWv1JMRY8d+dwCN3sOOY1NcemMrxvc1psDIN+LO9mvqT ifoRtx/1JO7BxW4NspDylJLQBq4KbWybqO7/bf+qa8L21vrhFswA0xN1mgez1R7CPV4/ CtQSn6tCwDR88zKHVrs8qa+Y8DtfGzpu1j8HZ4AVMulSoHNw1IicOxxC6XTuP0fpdT4M fj0g4WmVbP2JCEWuQ2JbaukRFK2WE21DJ/AoeirNp+bU52cU1dur8a//cQzaT8Fd3/xC HGHhf/TDrGR+YKouKKoBCM4tH2TNw2E3s3DU+UBHt91eDN0idJ+7qI4iTioObpcWYCIo dIyQ== 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=v6ZgtwWTu0SMSjjucml8ubJp2Z5Eb14X5zOTO1c4uzs=; b=iyF2d0XHxRUeKByoFUwm0KDFQU1i/VD/1LTmPSZd68k46W9DVerEc66opTMXfY0wPX sgUoeAfWN+RUOoqxvONkDIoRyfeC2HeXbLSyTNprK72V5anF8oTq7WwQoxCLRsdeabLc 2416mq8P+wzLsnYA58eVcmatmHjd90yi0wJCJwQkeh17HZ77oc1/xk4TohbVoLGd2L96 k2k+sjmOtnAcfL1GXgrGApPYpMBkBu1P9t/BHB3XeR+jzuEnbk6TTMlIW/vLHAVDbAmn DkNVrrqS8HoQLBnaLl82mkH+LpyOUrzyg0mYk+X9gcI9H0yDwDnf6uUCuvN9oKpSzpCA RPow== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ffnpsx5W; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 q18-20020a631f52000000b0043447486c84si27752684pgm.875.2022.10.22.01.33.45; Sat, 22 Oct 2022 01:34: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=ffnpsx5W; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S230063AbiJVIUw (ORCPT + 99 others); Sat, 22 Oct 2022 04:20:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55954 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233740AbiJVITQ (ORCPT ); Sat, 22 Oct 2022 04:19:16 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9EED42DF454; Sat, 22 Oct 2022 00:58: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 766FD60B1B; Sat, 22 Oct 2022 07:48:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 893BEC433D7; Sat, 22 Oct 2022 07:48:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424894; bh=c2ft1Iae6NDuIB9gttmxUKDBTR38ExvWyk+Gc+BZs0A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ffnpsx5W0lH/6U6JuEs0dYEn/YVGKRvdrFlZYF7Q3ujX9pPOS7NG6stBi+36KWqXx GeR4sQ52ChsWrDhTiOJRXV7a+/TF+L6oioZI+PGbLSQ4B8HI1LwpuMqGiIPjJ3agof hgFQrEtPng34IjSmqKUhl/D94D+dOjOJW44Iykpo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Prashant Malani , Heikki Krogerus , Tzung-Bi Shih , Sasha Levin Subject: [PATCH 5.19 316/717] platform/chrome: cros_ec_typec: Correct alt mode index Date: Sat, 22 Oct 2022 09:23:15 +0200 Message-Id: <20221022072508.049503779@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376030143003095?= X-GMAIL-MSGID: =?utf-8?q?1747376030143003095?= From: Prashant Malani [ Upstream commit 4e477663e396f48c5cfc5f2d75d4b514f409516a ] Alt mode indices used by USB PD (Power Delivery) start with 1, not 0. Update the alt mdoe registration code to factor this in to the alt mode descriptor. Fixes: de0f49487db3 ("platform/chrome: cros_ec_typec: Register partner altmodes") Signed-off-by: Prashant Malani Acked-by: Heikki Krogerus Reviewed-by: Tzung-Bi Shih Link: https://lore.kernel.org/r/20220819190807.1275937-3-pmalani@chromium.org Signed-off-by: Sasha Levin --- drivers/platform/chrome/cros_ec_typec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/platform/chrome/cros_ec_typec.c b/drivers/platform/chrome/cros_ec_typec.c index 7cb2e35c4ded..1305a22a8831 100644 --- a/drivers/platform/chrome/cros_ec_typec.c +++ b/drivers/platform/chrome/cros_ec_typec.c @@ -669,7 +669,7 @@ static int cros_typec_register_altmodes(struct cros_typec_data *typec, int port_ for (j = 0; j < sop_disc->svids[i].mode_count; j++) { memset(&desc, 0, sizeof(desc)); desc.svid = sop_disc->svids[i].svid; - desc.mode = j; + desc.mode = j + 1; desc.vdo = sop_disc->svids[i].mode_vdo[j]; if (is_partner) From patchwork Sat Oct 22 07:23: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: 7768 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1121041wrr; Sat, 22 Oct 2022 02:27:18 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6hwvTPnIrcrOwMdXEbFQ1/w/Px44iwDdmQKs3FBINS3OnBpzbhY9O86SO/CUC8osJ3Rsmu X-Received: by 2002:a17:902:7c11:b0:178:a6ca:4850 with SMTP id x17-20020a1709027c1100b00178a6ca4850mr24264043pll.111.1666430838042; Sat, 22 Oct 2022 02:27:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666430838; cv=none; d=google.com; s=arc-20160816; b=frqsRlc6fEwqU3nxUatOI6NRDPuOVUpyNnquSzWTk+fewjypAjt7cWoIww3W7VCeUB oTtsH36mXDzNrOF0hY5SzDHO75cOpn9NcY+WTq4stNXrSfMn6mA8d3qs4TqmLr594liN 1MLZCC9xjWOWJL0F64twKb9Pebyio6vnM5FqEC+rRFPOe3oXrd+6KhS4VKa3/8iflEyU pilS7Mi/kXb1cwWFNouH1DeZQ7vrjs6g8XAz6AHgt3/kKr9rziRBIpWfhXFL5nNAEzEK ebE4LpY6UP1em3cL18EYleXWsFfll58K3dg6/0t/OAJMPyL+UmJXy/CEfPXuAFCaW1G+ YBAw== 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=hYr81rnz6b9axV9drCfEuwHsAti1mmV8bbWOF9tVjbA=; b=SEnRh8VLVnXu9BbCX1rHPKOECq2xP+oguvW+6dFc1n03orpljle9fGsseRLXF5c1RT FUkofLYHlHYyVi9FncETBE5gsMFyq610dIsx9pNlJo3bGglTWVqO5l/EwUMFJA0qmkhU bJ3ZYBozDV9U51wJofKDLGYbU67b56QC+NKLTXugIdHqN95JbvBf70MIegW6HaCQonZk hjUwhyScaDrsV0qmAs829ZR2sjAsqgTpHPSu1EemZs9oMg5js/McOv9wax3dAxOJxhEI 5A8aLS7iFGeiE2sCx85FLazBpmBeF9sgalyAJ2C+BIcSGTvIKGhWjpi2/JXntlmfDnkt 55lg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=t38+x8Wk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 q13-20020a17090311cd00b00172f8a4b3e1si30948246plh.81.2022.10.22.02.27.05; Sat, 22 Oct 2022 02:27: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=t38+x8Wk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S233112AbiJVJFP (ORCPT + 99 others); Sat, 22 Oct 2022 05:05:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43972 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235102AbiJVJDq (ORCPT ); Sat, 22 Oct 2022 05:03: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 BEEB22FBDF6; Sat, 22 Oct 2022 01:18: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 ams.source.kernel.org (Postfix) with ESMTPS id C409CB82E04; Sat, 22 Oct 2022 07:48:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 214A1C433D6; Sat, 22 Oct 2022 07:48:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424897; bh=pP2r2bExKP4Le3wtAbMnar0v4Dk3GywGU3NbELH8LRo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=t38+x8WkoAe7YJOx4avhVAz6+MLQ+4pvrun6ks6zv9mzakIQXPuWWfbx8vPgy9XuM 3c1zcyMQvdYP3D0JNfGF7/6jNcuw96M9pveZ5GAz1mu2iE96C0lcM1WllhdayNt+WQ BkbsZ66TTqji7ffsaJOGruq9c8oIaKqgkd+EnZSc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Yang Yingliang , Alex Deucher , Sasha Levin Subject: [PATCH 5.19 317/717] drm/amdgpu: add missing pci_disable_device() in amdgpu_pmops_runtime_resume() Date: Sat, 22 Oct 2022 09:23:16 +0200 Message-Id: <20221022072508.171109408@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747379382266389583?= X-GMAIL-MSGID: =?utf-8?q?1747379382266389583?= From: Yang Yingliang [ Upstream commit 6b11af6d1c8f5d4135332bb932baaa06e511173d ] Add missing pci_disable_device() if amdgpu_device_resume() fails. Fixes: 8e4d5d43cc6c ("drm/amdgpu: Handling of amdgpu_device_resume return value for graceful teardown") Signed-off-by: Yang Yingliang Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin --- drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c index 8890300766a5..5e8ca32bc3a9 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c @@ -2548,8 +2548,11 @@ static int amdgpu_pmops_runtime_resume(struct device *dev) amdgpu_device_baco_exit(drm_dev); } ret = amdgpu_device_resume(drm_dev, false); - if (ret) + if (ret) { + if (amdgpu_device_supports_px(drm_dev)) + pci_disable_device(pdev); return ret; + } if (amdgpu_device_supports_px(drm_dev)) drm_dev->switch_power_state = DRM_SWITCH_POWER_ON; From patchwork Sat Oct 22 07:23: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: 7375 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1096556wrr; Sat, 22 Oct 2022 01:05:26 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7iO3d2z3XQCvJmXnQiQHw0TGsGKfUnKBSBhLE9d8A7XdK/70NyD9We0WwEWfwdHRao6bva X-Received: by 2002:a63:c5d:0:b0:460:17cc:73a6 with SMTP id 29-20020a630c5d000000b0046017cc73a6mr19450422pgm.332.1666425926299; Sat, 22 Oct 2022 01:05:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666425926; cv=none; d=google.com; s=arc-20160816; b=yWnNxmKvU7kz+KrPL9/IrMAQmVWp1YvJBrIjXq/jUy3sKvE7uBtYE57eNsqB1I7PX1 OLKHbtNcBiv5LJrOnyotIy2NF2Fz5PGWo9iL8dOaWdUeBOEb4AT13OMjnQJWfOcfbEqt 0hG2dICfxzb52SsxsscU81Jd7rgyEYG5yZzBwVE1Bkqab6uPcpctBj/AU6AlTFGsZz58 /h/AJMXV9phYTL83sSD3/5thtINON6Dij2Xat7svwh+oDEIzmy0vplFyx3ioZAmrZ5/P 2SLR+iwAfiLNHTNX8l3Pk1foQlEqK9H4l2n+yvivTKJjwXCMjwO+/6HUr1ARO50qXRPb VAKw== 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=+MXc/a5oFlvsgTc572ro7Oq3bWVBVE0/rriL/owB27s=; b=VOFK2Ju4RdgrGlZtS8Q40/hY0IDrHH/29l7fop5aAaH3IZvoua1RrFPpVRuPs80s/j +oWzamRgI1UgIod9ar2txwh1RkOi042eOFl96aDzk9NlxRdpqjVxZ8fkzxlIyiznRUz3 r67ACt4+Dhj0LXdLbbmjMtdTp0xpx1CkvStjF4rAfmz4EK+66zpWsp4Nyzzbr1d660uw Q70YB45LrTVzE8bAC7bipsTq/apPR1yeFV6/clzMms4E6/JVo+ecn73Yg8v/CAatfFTQ 13PEfGLkgh8nhQFlMgxnddU+1UcXG5FBQV0PEDvVudCzinwdMS6quI6/R6LrkifF3VyT gA8w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=lMM+U4CA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 k7-20020a170902d58700b0017847b1528dsi8963620plh.125.2022.10.22.01.05.13; Sat, 22 Oct 2022 01:05: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=lMM+U4CA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S232696AbiJVIEA (ORCPT + 99 others); Sat, 22 Oct 2022 04:04:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48634 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232041AbiJVH5V (ORCPT ); Sat, 22 Oct 2022 03:57: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 5320374CC7; Sat, 22 Oct 2022 00:48: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 69BF7B82E0C; Sat, 22 Oct 2022 07:48:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C1963C433D6; Sat, 22 Oct 2022 07:48:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424900; bh=OzLtw84/qExOO0VigNtqfN9GRq/sTIKWBf6EPPnoyMA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lMM+U4CAeLrUZ8QVCmmkcpVuhCUG2nbd8/wAwNnLojG4olmyTDiPJ/rpK0N+u9gaa 7vNbJ6rSUZGPF+TLxOfndI0x56mx26dT5RWwG3r0oF3cGemq5AA66HZMfdRga04oie HdLFFoZ0xFbuEkaHqg9eLDFHWRDXQtRHpAX3BtrQ= 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 5.19 318/717] drm/bridge: megachips: Fix a null pointer dereference bug Date: Sat, 22 Oct 2022 09:23:17 +0200 Message-Id: <20221022072508.308070614@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747374231956362448?= X-GMAIL-MSGID: =?utf-8?q?1747374231956362448?= 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 cce98bf2a4e7..72248a565579 100644 --- a/drivers/gpu/drm/bridge/megachips-stdpxxxx-ge-b850v3-fw.c +++ b/drivers/gpu/drm/bridge/megachips-stdpxxxx-ge-b850v3-fw.c @@ -296,7 +296,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 Sat Oct 22 07:23: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: 7787 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1122250wrr; Sat, 22 Oct 2022 02:30:39 -0700 (PDT) X-Google-Smtp-Source: AMsMyM45nJe/kpxY3DHL68cHTXojCpj0y7YKMcJl8NEo+3EEPQIdqbBB2jOcPs3TLOf1jIetkSEB X-Received: by 2002:a17:902:c948:b0:186:7baa:10ef with SMTP id i8-20020a170902c94800b001867baa10efmr6521623pla.73.1666431039409; Sat, 22 Oct 2022 02:30:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666431039; cv=none; d=google.com; s=arc-20160816; b=cXS+hCWNyuBMokJ3VGItbUuqAC/+SRYq6s5Ujy4CJPoXenchJ9qnSc+3+6Jkjiz5I9 xvqXT48ZlsCbLbkiS40iIAGWqJqX4n48JI499BxqF3d01uh28/4Dx3DqQ5/9xUHCGEib nqHdiN07Lrm4wobvWWu+0JGRWaryc4VNsmPItITSjytoIkljLjxnFET1W4eqKrv16bMi pQttfM7xjlNlK+Fhb+fl/ITz5rTb0aTzsDKn1Q7ES0whKX3i06Z844eUQPfXEAKXo5+b 1vfDtbH12fMmDam2ZqcF8bApmIUaiAjFw4+9R7EGEhrGWDiP1Vrnq3XHAJiloRE590Tq Z2VQ== 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=fhpuDQ2nH0LSgh8M6dGSNDvkPRO2mW78msTpYQRkbhg=; b=GS58uqeiR1qfa2uU4i1R0S2bRvyg98xuTdqWNpCEA0QmrqQPvJR6VcmqnYabhdoS14 n0KVvE7EusJsa7lXvISfTizVs5wpxS8/PLzbCSU8ioX/XHJzxKBhvfyEA9SFk/zMrKsb rYMuS7S+9CKibgMqoG3EVf6XNCXf+WkIzI9kMZ4ANMbeq2JcqXeM4HG+8zQQMhmmDM4x huzesEhMh7/5CdVnDd4w4tlcs3JxoxRQnfri2bJkVPDrUflPeWPLQtToC5nl5mPLvtPL UwL4IzrtpgtE7Czc3DOQvQ3Utz+NHmhMRRfw/eifSAHJgNUDNWcxp2Ovzk6PrxpjoqTY VvYg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=u3yjSkGK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 k11-20020a6555cb000000b00438b7cb3311si30533338pgs.501.2022.10.22.02.30.25; Sat, 22 Oct 2022 02:30: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=u3yjSkGK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S232022AbiJVJLy (ORCPT + 99 others); Sat, 22 Oct 2022 05:11:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37788 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232165AbiJVJLa (ORCPT ); Sat, 22 Oct 2022 05:11: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 02BD32514E3; Sat, 22 Oct 2022 01:25: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 6564560B0C; Sat, 22 Oct 2022 07:48:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 766DCC433C1; Sat, 22 Oct 2022 07:48:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424902; bh=CKtuwDOYPsb0DMnuLbGcnbkAajbl8yEKG+j15wLGQfA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=u3yjSkGKQ1+NLzAf42T76EK+ulDzpZarpQjMrYhqKF3aqP6Z7nvtgtU3JO2YemP3b N3pE6TpE5XhflqeJKXpCWP7Lf+3aTC2sZ6NwK9oQvJ+hH381gFqfy7reMIesbdpPtQ 7J48jMsXzJVCZ63Hp6ut5hzCdwrZ9ehIiigLfW/Y= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Pin-yen Lin , Robert Foss , Sasha Levin Subject: [PATCH 5.19 319/717] drm/bridge: it6505: Fix the order of DP_SET_POWER commands Date: Sat, 22 Oct 2022 09:23:18 +0200 Message-Id: <20221022072508.422913883@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747379593585221804?= X-GMAIL-MSGID: =?utf-8?q?1747379593585221804?= From: Pin-yen Lin [ Upstream commit 7c1dceaffd99247bf443606730515b54d6285969 ] Send DP_SET_POWER_D3 command to the downstream before stopping DP, so the suspend process will not be interrupted by the HPD interrupt. Also modify the order in .atomic_enable callback to make the callbacks symmetric. Fixes: 46ca7da7f1e8 ("drm/bridge: it6505: Send DPCD SET_POWER to downstream") Signed-off-by: Pin-yen Lin Reviewed-by: Robert Foss Signed-off-by: Robert Foss Link: https://patchwork.freedesktop.org/patch/msgid/20220830045756.1655954-1-treapking@chromium.org Signed-off-by: Sasha Levin --- drivers/gpu/drm/bridge/ite-it6505.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/bridge/ite-it6505.c b/drivers/gpu/drm/bridge/ite-it6505.c index e5626035f311..a09d1a39ab0a 100644 --- a/drivers/gpu/drm/bridge/ite-it6505.c +++ b/drivers/gpu/drm/bridge/ite-it6505.c @@ -2945,9 +2945,6 @@ static void it6505_bridge_atomic_enable(struct drm_bridge *bridge, if (ret) dev_err(dev, "Failed to setup AVI infoframe: %d", ret); - it6505_drm_dp_link_set_power(&it6505->aux, &it6505->link, - DP_SET_POWER_D0); - it6505_update_video_parameter(it6505, mode); ret = it6505_send_video_infoframe(it6505, &frame); @@ -2957,6 +2954,9 @@ static void it6505_bridge_atomic_enable(struct drm_bridge *bridge, it6505_int_mask_enable(it6505); it6505_video_reset(it6505); + + it6505_drm_dp_link_set_power(&it6505->aux, &it6505->link, + DP_SET_POWER_D0); } static void it6505_bridge_atomic_disable(struct drm_bridge *bridge, @@ -2968,9 +2968,9 @@ static void it6505_bridge_atomic_disable(struct drm_bridge *bridge, DRM_DEV_DEBUG_DRIVER(dev, "start"); if (it6505->powered) { - it6505_video_disable(it6505); it6505_drm_dp_link_set_power(&it6505->aux, &it6505->link, DP_SET_POWER_D3); + it6505_video_disable(it6505); } } From patchwork Sat Oct 22 07:23: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: 7378 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1096560wrr; Sat, 22 Oct 2022 01:05:26 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5YM8ttL3pU/lfL4yfMRfMhTwnIdnO7V+Ey8czwuJ//ivdHDtcz9T+zRSgPenQpUn/AfPxS X-Received: by 2002:a63:84c6:0:b0:46e:df48:afdd with SMTP id k189-20020a6384c6000000b0046edf48afddmr892028pgd.458.1666425926551; Sat, 22 Oct 2022 01:05:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666425926; cv=none; d=google.com; s=arc-20160816; b=s+WSn3W+FJjPeLYktdGhVxMfenr2QIsKQGuYISoaWbmLnCIyKipyhU6Q8rUiuW0w1Z U1qeCFQZMl/Y2xm5htJJ1kalwXmaWLTVaLOyb2del/XpVxzZTenx8HxIdn4SK77u2cic o8p3pJ+wqve8EP52ErYguYaqmtq6bOg1g2SmfGEDAsZp/sd1V78Ib7fONvbGb0RS5+Mw TzrOujirGMXwSmGSK72L9lnM2Eb0YkmsbverejiIgxtfdovC+CbHpRrnDPLaJqV13PfL 1y4d0rWzbhSlb788gdIJ+pKaQ5+ObfLs47mtw4P/5TU+zeAi6Jj4e/I5UXoWM2c4gCv5 C04A== 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=d0WDyIyQA8uDUrNU7usXAgtk1xz5lkGM09fFgR+BrTk=; b=tPpr1WgwgPz8MlvfkyLK5KVcU/6WvRF31FI0KewW5fH3+hk+D67Hi8axQf4Y8vMkg2 rlPAxsZ+BohKaVeCxG4YDkqVMwNGMUTLbJVk7GRceNEPuD/6aA8jxq84b0kvIwrFboP9 ovld6sOgUy2R37yFYaOg3ppaDex01rpmMsZyCt3Ses9to1sv7+DFxjDPs9UuXityhR0F i25fltMBPi05oSvSmwzyQHGMRNvaDcDEaoOvVnek0wq4/uJWuh4VNjsGhuilemCTWmmI 9UxSQCd8pWQm1Fntnqb5YUVYdMmjaPMLC79wBapQ1wFqr0IPYU7DmdCL0EYvsLMKWfv9 eNqw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=UJFPx6Xq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 l9-20020a170903244900b0017d2c45e93fsi31482962pls.169.2022.10.22.01.05.13; Sat, 22 Oct 2022 01:05: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=UJFPx6Xq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S232766AbiJVIEL (ORCPT + 99 others); Sat, 22 Oct 2022 04:04:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42398 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232332AbiJVH5d (ORCPT ); Sat, 22 Oct 2022 03:57: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 82E8213A5B4; Sat, 22 Oct 2022 00:48: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 BDF5AB82DEF; Sat, 22 Oct 2022 07:48:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2345EC433D7; Sat, 22 Oct 2022 07:48:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424905; bh=0M6ldLkPIHOA6wq73aLHiYig4mC6FQqYwNyvlLZ3uo0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UJFPx6Xqv0PnA0Ahf0iwef+DM2x1DeQlJDVaoK+yZ7wDSVOOyJDHy+CDCgebITE/q 4zVJQ4gWO2VMIvE6xt8WWPoAqHSAPMpWRVGGexBrnJ1jwysoHHwhUsQF8mW2uTqzDw 4ssOv9macPzzrF3OoYHXIIRz+Rlo46s8oR+UJm/Y= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jiasheng Jiang , Kuninori Morimoto , Mark Brown , Sasha Levin Subject: [PATCH 5.19 320/717] ASoC: rsnd: Add check for rsnd_mod_power_on Date: Sat, 22 Oct 2022 09:23:19 +0200 Message-Id: <20221022072508.533986921@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747374232202600539?= X-GMAIL-MSGID: =?utf-8?q?1747374232202600539?= From: Jiasheng Jiang [ Upstream commit 376be51caf8871419bbcbb755e1e615d30dc3153 ] As rsnd_mod_power_on() can return negative numbers, it should be better to check the return value and deal with the exception. Fixes: e7d850dd10f4 ("ASoC: rsnd: use mod base common method on SSI-parent") Signed-off-by: Jiasheng Jiang Acked-by: Kuninori Morimoto Link: https://lore.kernel.org/r/20220902013030.3691266-1-jiasheng@iscas.ac.cn Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- sound/soc/sh/rcar/ctu.c | 6 +++++- sound/soc/sh/rcar/dvc.c | 6 +++++- sound/soc/sh/rcar/mix.c | 6 +++++- sound/soc/sh/rcar/src.c | 5 ++++- sound/soc/sh/rcar/ssi.c | 4 +++- 5 files changed, 22 insertions(+), 5 deletions(-) diff --git a/sound/soc/sh/rcar/ctu.c b/sound/soc/sh/rcar/ctu.c index 6156445bcb69..e39eb2ac7e95 100644 --- a/sound/soc/sh/rcar/ctu.c +++ b/sound/soc/sh/rcar/ctu.c @@ -171,7 +171,11 @@ static int rsnd_ctu_init(struct rsnd_mod *mod, struct rsnd_dai_stream *io, struct rsnd_priv *priv) { - rsnd_mod_power_on(mod); + int ret; + + ret = rsnd_mod_power_on(mod); + if (ret < 0) + return ret; rsnd_ctu_activation(mod); diff --git a/sound/soc/sh/rcar/dvc.c b/sound/soc/sh/rcar/dvc.c index 5137e03a9d7c..16befcbc312c 100644 --- a/sound/soc/sh/rcar/dvc.c +++ b/sound/soc/sh/rcar/dvc.c @@ -186,7 +186,11 @@ static int rsnd_dvc_init(struct rsnd_mod *mod, struct rsnd_dai_stream *io, struct rsnd_priv *priv) { - rsnd_mod_power_on(mod); + int ret; + + ret = rsnd_mod_power_on(mod); + if (ret < 0) + return ret; rsnd_dvc_activation(mod); diff --git a/sound/soc/sh/rcar/mix.c b/sound/soc/sh/rcar/mix.c index 3572c2c5686c..1de0e085804c 100644 --- a/sound/soc/sh/rcar/mix.c +++ b/sound/soc/sh/rcar/mix.c @@ -146,7 +146,11 @@ static int rsnd_mix_init(struct rsnd_mod *mod, struct rsnd_dai_stream *io, struct rsnd_priv *priv) { - rsnd_mod_power_on(mod); + int ret; + + ret = rsnd_mod_power_on(mod); + if (ret < 0) + return ret; rsnd_mix_activation(mod); diff --git a/sound/soc/sh/rcar/src.c b/sound/soc/sh/rcar/src.c index 0ea84ae57c6a..f832165e46bc 100644 --- a/sound/soc/sh/rcar/src.c +++ b/sound/soc/sh/rcar/src.c @@ -463,11 +463,14 @@ static int rsnd_src_init(struct rsnd_mod *mod, struct rsnd_priv *priv) { struct rsnd_src *src = rsnd_mod_to_src(mod); + int ret; /* reset sync convert_rate */ src->sync.val = 0; - rsnd_mod_power_on(mod); + ret = rsnd_mod_power_on(mod); + if (ret < 0) + return ret; rsnd_src_activation(mod); diff --git a/sound/soc/sh/rcar/ssi.c b/sound/soc/sh/rcar/ssi.c index 43c5e27dc5c8..7ade6c5ed96f 100644 --- a/sound/soc/sh/rcar/ssi.c +++ b/sound/soc/sh/rcar/ssi.c @@ -480,7 +480,9 @@ static int rsnd_ssi_init(struct rsnd_mod *mod, ssi->usrcnt++; - rsnd_mod_power_on(mod); + ret = rsnd_mod_power_on(mod); + if (ret < 0) + return ret; rsnd_ssi_config_init(mod, io); From patchwork Sat Oct 22 07:23: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: 7820 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1142511wrr; Sat, 22 Oct 2022 03:31:45 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5bxqb56xi3CBAxJ9Sb9MJWaxKWByP0OPjiuDhPgzV+vga7xvq00uV/jZKGlj8q4gHE8vSD X-Received: by 2002:a17:907:2e01:b0:78d:e768:e845 with SMTP id ig1-20020a1709072e0100b0078de768e845mr19542402ejc.484.1666434705823; Sat, 22 Oct 2022 03:31:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666434705; cv=none; d=google.com; s=arc-20160816; b=bm++LjFMHFofdLsTUrnMk09gI1UOyenRFC+/AEo9VvywdOnihc0h3Lx9x9pdNOAy/I YdIY/XDndZcPmO6oKp80uxA7cTI0nLlAOyoFtmbcLVb4LdnTQedJ3VGYOP6R+nb/cPus E4ss54YZXBPYtG/XeBSgbnQ73qjiHXQwVQ6ClPeFrqkF/MHEBz1UcKAFkp896qu5iY+Z AXr/ghJtT6lgRaw+vG7rtuVM7pL2dm4bw3ULUIFTm3nAEuK512ocNXGQybofS4wB9od/ tNI5j3EPg4Udiw0BpjEgSRxr2b0omQxgN4q4dM4ghGy2N8XPGFIk5B2ft3jwxC80D4ek dW5Q== 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=9xVrRUz5QHgjfnMqmkLC22PRD1VBPD2pqEiE4V1wiSk=; b=w/yQWxddPByYnclwWQlWvpsOQh1v/UzPAbmxTnJaOWYgwwfQJ4M66uWP9k6r6OROC4 lRPGrmYkQNtrDN+w2HIDbHJNM3ajFTXnRqkhMNaDRFUYGAnh5KgM0nefd2CiI6IBqi8e NC1IbhcFXrkhp8v04G8FYjmYSIlI+m7KXJbAuFMFOkvHSePDYWPPNkMaNn8xBoSghD9i zJihzq3XoBVw7aMoinkQ973fmHyCOVRCmNWgKA/lpt/OKnvRO3Dozx4hGzhFrmU0TDtS p2a1+yJ2zqjlwOcnk2NW4cHGaPoiQ01qvc7TA2xEV0xreG98tiO9TsUk7+s1MG4s+L1P JEHg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=A8KHaivr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 j9-20020a05640211c900b0045db850a506si15033227edw.46.2022.10.22.03.31.18; Sat, 22 Oct 2022 03:31: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=A8KHaivr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S229936AbiJVK2B (ORCPT + 99 others); Sat, 22 Oct 2022 06:28:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37910 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230415AbiJVK1b (ORCPT ); Sat, 22 Oct 2022 06:27: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 D240DDDA24; Sat, 22 Oct 2022 02:42:52 -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 DD2CF60AB1; Sat, 22 Oct 2022 07:48:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C649DC433D7; Sat, 22 Oct 2022 07:48:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424908; bh=8ov550mYe0q+OuIWy6vLBThDt4WXXctu0mu59Wjd02g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=A8KHaivrENtU6ENY3+u48cbIAoiXY3HEVjxl6hE4Yncf5rBk7eKj9zdTNSoBstwer 18t2gAOyMNpMIAJXssIaBos3bM7gwIME8Su/NpEaL4jtDkCdwOotM5guHsU5vhE03y Lkjfp2u1lm/OZPIndM80Gg6egunIvC2rTpCfhru0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Cristian Ciocaltea , Charles Keepax , Mark Brown , Sasha Levin Subject: [PATCH 5.19 321/717] ASoC: wm_adsp: Handle optional legacy support Date: Sat, 22 Oct 2022 09:23:20 +0200 Message-Id: <20221022072508.612649469@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 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?1747383437704908303?= X-GMAIL-MSGID: =?utf-8?q?1747383437704908303?= From: Cristian Ciocaltea [ Upstream commit 35c8ae25c4fdeabf490e005692795a3be17ca5f6 ] The tracing capabilities for the speaker protection fw enabled via commit c55b3e46cb99 ("ASoC: wm_adsp: Add trace caps to speaker protection FW") are not be available on all platforms, such as the Valve's Steam Deck which is based on the Halo Core DSP. As a consequence, whenever the firmware is loaded, a rather misleading 'Failed to parse legacy: -19' error message is written to the kernel ring buffer: [ 288.977412] steamdeck kernel: cs35l41 spi-VLV1776:01: DSP1: Firmware version: 3 [ 288.978002] steamdeck kernel: cs35l41 spi-VLV1776:01: DSP1: cs35l41-dsp1-spk-prot.wmfw: Fri 02 Apr 2021 21:03:50 W. Europe Daylight Time [ 289.094065] steamdeck kernel: cs35l41 spi-VLV1776:01: DSP1: Firmware: 400a4 vendor: 0x2 v0.33.0, 2 algorithms [ 289.095073] steamdeck kernel: cs35l41 spi-VLV1776:01: DSP1: 0: ID cd v29.53.0 XM@94 YM@e [ 289.095665] steamdeck kernel: cs35l41 spi-VLV1776:01: DSP1: 1: ID f20b v0.0.1 XM@170 YM@0 [ 289.096275] steamdeck kernel: cs35l41 spi-VLV1776:01: DSP1: Protection: C:\Users\ocanavan\Desktop\cirrusTune_july2021.bin [ 291.172383] steamdeck kernel: cs35l41 spi-VLV1776:01: DSP1: Failed to parse legacy: -19 Update wm_adsp_buffer_init() to print a more descriptive info message when wm_adsp_buffer_parse_legacy() returns -ENODEV. Fixes: c55b3e46cb99 ("ASoC: wm_adsp: Add trace caps to speaker protection FW") Signed-off-by: Cristian Ciocaltea Acked-by: Charles Keepax Link: https://lore.kernel.org/r/20220825220530.1205141-1-cristian.ciocaltea@collabora.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- sound/soc/codecs/wm_adsp.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sound/soc/codecs/wm_adsp.c b/sound/soc/codecs/wm_adsp.c index a7784ac15dde..0e2c785d911f 100644 --- a/sound/soc/codecs/wm_adsp.c +++ b/sound/soc/codecs/wm_adsp.c @@ -1617,7 +1617,9 @@ static int wm_adsp_buffer_init(struct wm_adsp *dsp) if (list_empty(&dsp->buffer_list)) { /* Fall back to legacy support */ ret = wm_adsp_buffer_parse_legacy(dsp); - if (ret) + if (ret == -ENODEV) + adsp_info(dsp, "Legacy support not available\n"); + else if (ret) adsp_warn(dsp, "Failed to parse legacy: %d\n", ret); } From patchwork Sat Oct 22 07:23: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: 7404 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1097259wrr; Sat, 22 Oct 2022 01:07:12 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5R3e6chk5WKqwNiJJo/dX4fRORTG/GsVPd4cM44NISMdJlY5a1b9t+dmehlBmuaIDIlUp6 X-Received: by 2002:a17:902:ce86:b0:182:498f:afdb with SMTP id f6-20020a170902ce8600b00182498fafdbmr23602944plg.12.1666426032478; Sat, 22 Oct 2022 01:07:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666426032; cv=none; d=google.com; s=arc-20160816; b=X7NOnWyzcWf76fRl1u8boQi6S/xTph+EIO8NpQVMOheA1NIHSq0r8HLcUriRMeEqQ7 vmyNdLtIP9SjLjRZBvdjAxgW8rDlR0ksvMEBresI+7K8HZ+TSGVzWt5nkY+a1cAFRmVJ VkYwKcKbLax8aAYzK4R+l7Nvd2Y1+479Fdn0cSIKNSj/7By+eLdptZvFyd3Kr+GS7w0u M9QwKILdbK7OjRqD9GgjiAEjpmyv4BYJmtpxmFWnicrZE7QA5e/l+VtZJdF5XDZ/RF8D S+hTeDNmB8KPe2fyoDnkkOx+AIoysYl3vRzakc0imsShBQulcUFFfaryErB/Qa9DE3z/ 4j6Q== 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=Ta+1BC9ZUnNgE3sAI6+eKH47hxlQU90YhiP24MOf16Q=; b=Fq7sV9JxoAlFGunQJyPitksc4U9govQcUuQqvablEtkbv69W5/kuwvOlXK7SlYKUNb VDxjyqh5AAu4O7ZcWKEQCbc8Iv+7079G9fLPFUO0SLYrhht/qQDLRyJP3qcGvlcSpFZn +/D22DRZwGIe6C20TlgqE9X9sr4cWv14Ih99EpHQyKI6dErXp13WXYWLmBmLstBIn4Vz 4d01xQ03sQ0dvmgrxw5N0leyUJXvnlsvGLthGCFyxjWmlaIxCXBkF+gSMhO5lV1fCaGj XUApQ28MbL7KVPz6M4CaAmX/Ci5o6Tj81WQeenRxT45J7uCKiWLUB6O6fzxdBSEgcok0 RT7A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=C7mOsT77; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 3-20020a17090a08c300b0020267707b1csi1970995pjn.59.2022.10.22.01.07.00; Sat, 22 Oct 2022 01:07: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=C7mOsT77; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S232705AbiJVIGi (ORCPT + 99 others); Sat, 22 Oct 2022 04:06:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42506 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232893AbiJVIAM (ORCPT ); Sat, 22 Oct 2022 04:00:12 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 93BE81A527C; Sat, 22 Oct 2022 00:50: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 dfw.source.kernel.org (Postfix) with ESMTPS id 63AEF60B40; Sat, 22 Oct 2022 07:48:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4AC14C433D6; Sat, 22 Oct 2022 07:48:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424913; bh=uLP/v4pPCuxso/vuU6PoxkZFMFw+IoE4hCq+BrnMAP0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=C7mOsT77EEnsuWrpq/kWOz5Ur2U1qiHb02It22GvlonTNag89K2TQiORCLKsjAoK3 2UUjy7f94U2chOsS8KkQJUjPCX5FpnurG2i49/WJ3aSk9bwypLrm1q+62nVHPMbtcs fsuvRZ5ugelp/ye7/TRkCiLxnxSboahcKLRqhP1o= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Takashi Iwai , Sasha Levin Subject: [PATCH 5.19 322/717] ALSA: hda: beep: Simplify keep-power-at-enable behavior Date: Sat, 22 Oct 2022 09:23:21 +0200 Message-Id: <20221022072508.700301228@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747374343499299982?= X-GMAIL-MSGID: =?utf-8?q?1747374343499299982?= From: Takashi Iwai [ Upstream commit 4c8d695cb9bc5f6fd298a586602947b2fc099a64 ] The recent fix for IDT codecs to keep the power up while the beep is enabled can be better integrated into the beep helper code. This patch cleans up the code with refactoring. Fixes: 414d38ba8710 ("ALSA: hda/sigmatel: Keep power up while beep is enabled") Link: https://lore.kernel.org/r/20220906092306.26183-1-tiwai@suse.de Signed-off-by: Takashi Iwai Signed-off-by: Sasha Levin --- sound/pci/hda/hda_beep.c | 15 +++++++++++++-- sound/pci/hda/hda_beep.h | 1 + sound/pci/hda/patch_sigmatel.c | 25 ++----------------------- 3 files changed, 16 insertions(+), 25 deletions(-) diff --git a/sound/pci/hda/hda_beep.c b/sound/pci/hda/hda_beep.c index 53a2b89f8983..e63621bcb214 100644 --- a/sound/pci/hda/hda_beep.c +++ b/sound/pci/hda/hda_beep.c @@ -118,6 +118,12 @@ static int snd_hda_beep_event(struct input_dev *dev, unsigned int type, return 0; } +static void turn_on_beep(struct hda_beep *beep) +{ + if (beep->keep_power_at_enable) + snd_hda_power_up_pm(beep->codec); +} + static void turn_off_beep(struct hda_beep *beep) { cancel_work_sync(&beep->beep_work); @@ -125,6 +131,8 @@ static void turn_off_beep(struct hda_beep *beep) /* turn off beep */ generate_tone(beep, 0); } + if (beep->keep_power_at_enable) + snd_hda_power_down_pm(beep->codec); } /** @@ -140,7 +148,9 @@ int snd_hda_enable_beep_device(struct hda_codec *codec, int enable) enable = !!enable; if (beep->enabled != enable) { beep->enabled = enable; - if (!enable) + if (enable) + turn_on_beep(beep); + else turn_off_beep(beep); return 1; } @@ -167,7 +177,8 @@ static int beep_dev_disconnect(struct snd_device *device) input_unregister_device(beep->dev); else input_free_device(beep->dev); - turn_off_beep(beep); + if (beep->enabled) + turn_off_beep(beep); return 0; } diff --git a/sound/pci/hda/hda_beep.h b/sound/pci/hda/hda_beep.h index a25358a4807a..db76e3ddba65 100644 --- a/sound/pci/hda/hda_beep.h +++ b/sound/pci/hda/hda_beep.h @@ -25,6 +25,7 @@ struct hda_beep { unsigned int enabled:1; unsigned int linear_tone:1; /* linear tone for IDT/STAC codec */ unsigned int playing:1; + unsigned int keep_power_at_enable:1; /* set by driver */ struct work_struct beep_work; /* scheduled task for beep event */ struct mutex mutex; void (*power_hook)(struct hda_beep *beep, bool on); diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c index 7f340f18599c..a794a01a68ca 100644 --- a/sound/pci/hda/patch_sigmatel.c +++ b/sound/pci/hda/patch_sigmatel.c @@ -4311,6 +4311,8 @@ static int stac_parse_auto_config(struct hda_codec *codec) if (codec->beep) { /* IDT/STAC codecs have linear beep tone parameter */ codec->beep->linear_tone = spec->linear_tone_beep; + /* keep power up while beep is enabled */ + codec->beep->keep_power_at_enable = 1; /* if no beep switch is available, make its own one */ caps = query_amp_caps(codec, nid, HDA_OUTPUT); if (!(caps & AC_AMPCAP_MUTE)) { @@ -4444,28 +4446,6 @@ static int stac_suspend(struct hda_codec *codec) return 0; } - -static int stac_check_power_status(struct hda_codec *codec, hda_nid_t nid) -{ -#ifdef CONFIG_SND_HDA_INPUT_BEEP - struct sigmatel_spec *spec = codec->spec; -#endif - int ret = snd_hda_gen_check_power_status(codec, nid); - -#ifdef CONFIG_SND_HDA_INPUT_BEEP - if (nid == spec->gen.beep_nid && codec->beep) { - if (codec->beep->enabled != spec->beep_power_on) { - spec->beep_power_on = codec->beep->enabled; - if (spec->beep_power_on) - snd_hda_power_up_pm(codec); - else - snd_hda_power_down_pm(codec); - } - ret |= spec->beep_power_on; - } -#endif - return ret; -} #else #define stac_suspend NULL #endif /* CONFIG_PM */ @@ -4478,7 +4458,6 @@ static const struct hda_codec_ops stac_patch_ops = { .unsol_event = snd_hda_jack_unsol_event, #ifdef CONFIG_PM .suspend = stac_suspend, - .check_power_status = stac_check_power_status, #endif }; From patchwork Sat Oct 22 07:23: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: 7412 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1097507wrr; Sat, 22 Oct 2022 01:07:57 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5vgTL+GM6JbBEwMEUdezPQVaV3ticPKZDnQ8bOsJNyxQMowj1U6kOIQcEwTyA39LRb7BRo X-Received: by 2002:a65:6e4a:0:b0:438:874c:53fd with SMTP id be10-20020a656e4a000000b00438874c53fdmr20183212pgb.355.1666426076929; Sat, 22 Oct 2022 01:07:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666426076; cv=none; d=google.com; s=arc-20160816; b=EclL9JEgebhXMOXuWyAn29fLaS9gundmmUf0mC7THPfo251/Oajf9i4xvJF9SG8Wq2 /m54w35xB/9swZZT7OrPiP0MNyH65bAj6p8xu2JmyYIuG8x1Er0Cq4fJ/BMDJMBrprBX Cmccv2hhneEqXxr9ATSnQthoxcm1KxNwHN2rVZv1/AZhV5TVM6OMG8xtvG869zrCFBXf GUnrQ7VWf8phc+5mVzNFbB/W7T8Gx53dRI6JL6Af3RH76T0KcgQmhOgizV7KKotQfHMa DcOPkTt+AE7zv7tsappBRSkmN+6h8Psi/WK/TvZcjR0lpyUqERebX7JL+XS3GirkmwW7 gZXw== 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=KXGEhK+ZyJg45MIZH8zMPCyPbNvVStLuXTcKClQ5YP8=; b=VGI2QdLeIFRQ2Ns4nBpJv3iahZ2ECumvIjTPcyzuOco63AaXaiHfe9N0qTJlRtoWV+ W/D/kyRx93wqKwAvqAAhCaTXreunMpa1R9VW48v0jm00jfG+uQ1xR02zJ25CXiMo5hxr hsF292+ylwwzU3QQN+Iia0Q5gx021LC/GW64YvVS9RteSdrk2vzZgsBjjO8mEaVLfjSS M2ryX4Evammcyf0sukYmu8WR1038DBXb3LD7eXRmHFh1mOsoDBm+x8pfL6QUBM9iBj9b A/BndE+LybzZvYsXxVOKNuBB9xz3+pHru5eZC3dZKYMoMRw49EMN4GKQCTLa8oJpKv7n TvNg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=AvCFikQT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 mq11-20020a17090b380b00b0020a7e0138d2si10839441pjb.50.2022.10.22.01.07.41; Sat, 22 Oct 2022 01:07: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=AvCFikQT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S232924AbiJVIHT (ORCPT + 99 others); Sat, 22 Oct 2022 04:07:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41668 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232458AbiJVIBj (ORCPT ); Sat, 22 Oct 2022 04:01:39 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4035628B1A4; Sat, 22 Oct 2022 00:50: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 390A060B49; Sat, 22 Oct 2022 07:48:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 48354C433C1; Sat, 22 Oct 2022 07:48:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424916; bh=ZgKxMsG8k59NViVoefO54z2B9yZQpBZLWjXNfWIvuok=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AvCFikQTdkONowiA9cqeyuvqFlNx6ynYfiFh9U0V/MM2rreuUXySOooy/dnxW1SqW B4gzROSqv4jFhgq4a18gEQcvdkPcVn+83OVwmq+FVt0VBAlqlAoAZUQF0jwgaNYcK1 kUf0ZdwZg3z6HGE2U46k0dXpn1wS897qg4XjeuFg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Shao-Chuan Lee , Chia-I Wu , Gerd Hoffmann , Sasha Levin Subject: [PATCH 5.19 323/717] drm/virtio: set fb_modifiers_not_supported Date: Sat, 22 Oct 2022 09:23:22 +0200 Message-Id: <20221022072508.789883172@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747374389835676102?= X-GMAIL-MSGID: =?utf-8?q?1747374389835676102?= From: Chia-I Wu [ Upstream commit 85faca8ca0f659263b5fb2385e4c231cc075bd84 ] Without this, the drm core advertises LINEAR modifier which is incorrect. Also userspace virgl does not support modifiers. For example, it causes chrome on ozone/drm to fail with "Failed to create scanout buffer". Fixes: 2af104290da5 ("drm: introduce fb_modifiers_not_supported flag in mode_config") Suggested-by: Shao-Chuan Lee Signed-off-by: Chia-I Wu Link: http://patchwork.freedesktop.org/patch/msgid/20220831190601.1295129-1-olvaffe@gmail.com Signed-off-by: Gerd Hoffmann Signed-off-by: Sasha Levin --- drivers/gpu/drm/virtio/virtgpu_display.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/gpu/drm/virtio/virtgpu_display.c b/drivers/gpu/drm/virtio/virtgpu_display.c index f73352e7b832..96e71813864a 100644 --- a/drivers/gpu/drm/virtio/virtgpu_display.c +++ b/drivers/gpu/drm/virtio/virtgpu_display.c @@ -348,6 +348,8 @@ int virtio_gpu_modeset_init(struct virtio_gpu_device *vgdev) vgdev->ddev->mode_config.max_width = XRES_MAX; vgdev->ddev->mode_config.max_height = YRES_MAX; + vgdev->ddev->mode_config.fb_modifiers_not_supported = true; + for (i = 0 ; i < vgdev->num_scanouts; ++i) vgdev_output_init(vgdev, i); From patchwork Sat Oct 22 07:23: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: 7570 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1106103wrr; Sat, 22 Oct 2022 01:36:57 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6hXUsRd0tOQ0/eMeMywdyklbJUIDBAwm3WGq7jAql2lssB843mdXPd9yq9BmpZluXoNEci X-Received: by 2002:a17:903:2410:b0:17a:b32:dbec with SMTP id e16-20020a170903241000b0017a0b32dbecmr23165939plo.163.1666427816938; Sat, 22 Oct 2022 01:36:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666427816; cv=none; d=google.com; s=arc-20160816; b=mRe7u6bJw5xv8SHha1AV7fQusgF8vODqh8/akKVzRq/iU+7YRJ476fwPcZxgOQRnZY lleHMHg6gscKiCkECEMqFMJ609MKHDElApnaiWOmxkub3Hv12x8T3IpOU7YWDgpJHfKZ xwkDaVRFCZhhHrcSSALsXRVyNTe7T6pRv9LpP1jOa8I127vwbKXNGBuMYaoXc3YqU9+v REBPz6CMT4TAoz0NKUpdnLsiF00RBoTpbSUj09buU+fYlZSRrfZ0Jc4WPh84y1vGAHet gzy437e2ENB3TnY29OPZmDJWoaqOB20Ehg1IzAr97Ndlvl7skduvLPXvzbyycoKrul9T E3WQ== 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=qu1cWWOpj3G0r4nNHcgZZKGc5gNhe43Ypt9aGttVtpY=; b=vz1HSzcExSAl9vduktp7p8ny9BaX4TRqVjZI66eWDPqZuUtTvBj1Aru8P/SHsl/Z1W 5+b0CSPnH+I74idBpM2VAlhyQJ+NvTZ284h4EoZg0BogDPJ+lqUzXtvrkfwSbpVaETH1 Bt/8lDVhJVfdLFXGKILMmvVXToa8pZK8lAUspMzdR8ByJOgpW/C+HE9B0+5DdgIFLqWA IfvPXt4GghOxgSeRjk3k0xJUnGeXL+7Lj51y0Er3QDvtVXKa6w/YlVo13iWeDqUtdK0u 7BMDhNTtXHu59USrjl/5hOaXk9RhQyAgB8ak5hNv0AhS/z85UQZAkusinb5UwoQZnqtU Eivw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=0U6YxJoG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 t191-20020a6381c8000000b0043abd68507esi25612410pgd.392.2022.10.22.01.36.41; Sat, 22 Oct 2022 01:36: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=0U6YxJoG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S233951AbiJVIb4 (ORCPT + 99 others); Sat, 22 Oct 2022 04:31:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37770 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233975AbiJVI3D (ORCPT ); Sat, 22 Oct 2022 04: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 DF4452E1B81; Sat, 22 Oct 2022 01:01: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 ams.source.kernel.org (Postfix) with ESMTPS id 54931B82E22; Sat, 22 Oct 2022 07:50:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AA0D3C433C1; Sat, 22 Oct 2022 07:50:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425026; bh=ZW56IyUsCRsziNQEfsWwDsPjl+wsRj6O0UcTVdXwLao=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0U6YxJoGlw648W7/dcFwx4xiTjhrTn1TcMVdPQN/UKIj/9DvXfu1X9DY1ygc1r8Wx Do1zM0io553BIpPX9Eb/uKDXBf1c2nxFXGA3taLktTqZEsyFK8ZPzqLrqfZ99BklEZ auRf78XJt/UkfurhSy+8hstAm7/9Y3XgEhcH2n6Y= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Gerd Hoffmann , Thomas Zimmermann , Sasha Levin Subject: [PATCH 5.19 324/717] drm/bochs: fix blanking Date: Sat, 22 Oct 2022 09:23:23 +0200 Message-Id: <20221022072508.871256734@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376214481922527?= X-GMAIL-MSGID: =?utf-8?q?1747376214481922527?= From: Gerd Hoffmann [ Upstream commit e740ceb53e4579a7a4063712cebecac3c343b189 ] VGA_IS1_RC is the color mode register (VGA_IS1_RM the one for monochrome mode, note C vs. M at the end). So when using VGA_IS1_RC make sure the vga device is actually in color mode and set the corresponding bit in the misc register. Reproducible when booting VMs in UEFI mode with some edk2 versions (edk2 fix is on the way too). Doesn't happen in BIOS mode because in that case the vgabios already flips the bit. Fixes: 250e743915d4 ("drm/bochs: Add screen blanking support") Signed-off-by: Gerd Hoffmann Acked-by: Thomas Zimmermann Link: http://patchwork.freedesktop.org/patch/msgid/20220906142957.2763577-1-kraxel@redhat.com Signed-off-by: Sasha Levin --- drivers/gpu/drm/tiny/bochs.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/gpu/drm/tiny/bochs.c b/drivers/gpu/drm/tiny/bochs.c index ed971c8bb446..0cedb6f6f559 100644 --- a/drivers/gpu/drm/tiny/bochs.c +++ b/drivers/gpu/drm/tiny/bochs.c @@ -306,6 +306,8 @@ static void bochs_hw_fini(struct drm_device *dev) static void bochs_hw_blank(struct bochs_device *bochs, bool blank) { DRM_DEBUG_DRIVER("hw_blank %d\n", blank); + /* enable color bit (so VGA_IS1_RC access works) */ + bochs_vga_writeb(bochs, VGA_MIS_W, VGA_MIS_COLOR); /* discard ar_flip_flop */ (void)bochs_vga_readb(bochs, VGA_IS1_RC); /* blank or unblank; we need only update index and set 0x20 */ From patchwork Sat Oct 22 07:23: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: 7386 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1096740wrr; Sat, 22 Oct 2022 01:05:51 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5LF3F7IvRa2MbIt1QzicNPJfSLsrK1wZOHaJlyvOTm5+j+zEI3SCnXSs+dqexOlmFwhw0K X-Received: by 2002:a63:8ac8:0:b0:46e:c3dd:69df with SMTP id y191-20020a638ac8000000b0046ec3dd69dfmr4794714pgd.539.1666425951310; Sat, 22 Oct 2022 01:05:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666425951; cv=none; d=google.com; s=arc-20160816; b=PfqVsqt/L0LSN62+hNad7waslMU6XQN0cPl2k7cgh7JEYdU/FBVZ3VyykPmXdgMSM6 hkb7RLYlD8R7tgIUqvq9DQ2R7VKhvVkluQOuIkdJNHyr78KqDBq7Qu9xUprT+0Mc5tms Di/uLWt+2vitWwGAcs4nf50NB7uBsdVvKQC9Qogesna4scyW9Uz9650TE36dMcGkYw3k M6SMWPDKGh1Ezqa0b0P5XRDzrp/rAdn5xd3TbRmhSU2QrTmNA8fp9YVIr/P4PRcTJnmN 3RhKDLlvfjuEtjh4iR/PXQvBvXUxZkm0uEHFvlEVA9GppiirLoQQtIGRHCadQnYFI+le 2mtQ== 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=ejt8yajdp9EcIzKBEyU543bXI3/Ej33IDreG1/lpdoI=; b=KjHiYi79IW9r/md9DdTPQlqEE/kB8o31DoCDjIYZP90vuJrFKD7o3ubagctrTql961 eMN5/Cc656uJ2iZx01Azgc6MLZE6FFnkgMRmEV3zIK/4yGhAbEgapOkL6d9HHUG0QmUq gxr6vpfcFzY4P+lVuNkWPE32rd5X9vDghE6DIujjJM8onTXRj1JThver7SC4W/f3g2Ck YqttdGHWYoCWt5ODUdvNEGCeYzuxako5Zk0943qQEdW82RP1AlgMG+sWwa3Vn+17fPSw hf1DOOnJ1akzigo20XqRu1AYX9ygTXuSnloB/ntKPU6C33O/IU0vTz6JvuVfRZe+OZSa uSOQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=TxyFfoc3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 bk13-20020a056a02028d00b0046040a8c03bsi26326530pgb.660.2022.10.22.01.05.35; Sat, 22 Oct 2022 01: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=TxyFfoc3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S233028AbiJVIEk (ORCPT + 99 others); Sat, 22 Oct 2022 04:04:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36828 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232550AbiJVH7L (ORCPT ); Sat, 22 Oct 2022 03:59: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 70EBB1AFAA7; Sat, 22 Oct 2022 00:49: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 3BB51B82E28; Sat, 22 Oct 2022 07:49:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A10A7C433C1; Sat, 22 Oct 2022 07:48:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424939; bh=gcxnBUSa9foL5EqXXsgqGWDnGsdIU5fZNBC3EUE3+VA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TxyFfoc3MTsa007Fm7Uy6todYx/t0CCzq5RrRHnfClFTpezB7BYEF5q5jj3tPnqJr vrAUCueQwGuES41NBLpQsaVi+nrMMDYHrI/jJi8TSKi1O6WEaYW9U5wTGXIiWpCPKQ d6VBSh3CQ35WCgYpjcDOLEHUBfqd8QSFGACY+Yac= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, AngeloGioacchino Del Regno , Mark Brown , Sasha Levin Subject: [PATCH 5.19 325/717] ASoC: SOF: mediatek: mt8195: Import namespace SND_SOC_SOF_MTK_COMMON Date: Sat, 22 Oct 2022 09:23:24 +0200 Message-Id: <20221022072508.941708621@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747374258283237476?= X-GMAIL-MSGID: =?utf-8?q?1747374258283237476?= From: AngeloGioacchino Del Regno [ Upstream commit 404bec4c8f6c38ae5fa208344f1086d38026e93d ] Here we're using function mtk_adsp_dump() from mtk-adsp-common: explicitly import its namespace. Fixes: 3a054f90e955 ("ASoC: SOF: mediatek: Add mt8195 debug dump") Signed-off-by: AngeloGioacchino Del Regno Link: https://lore.kernel.org/r/20220906092727.37324-3-angelogioacchino.delregno@collabora.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- sound/soc/sof/mediatek/mt8195/mt8195.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sound/soc/sof/mediatek/mt8195/mt8195.c b/sound/soc/sof/mediatek/mt8195/mt8195.c index 30111ab23bf5..30ab2274fbf8 100644 --- a/sound/soc/sof/mediatek/mt8195/mt8195.c +++ b/sound/soc/sof/mediatek/mt8195/mt8195.c @@ -634,4 +634,5 @@ static struct platform_driver snd_sof_of_mt8195_driver = { module_platform_driver(snd_sof_of_mt8195_driver); MODULE_IMPORT_NS(SND_SOC_SOF_XTENSA); +MODULE_IMPORT_NS(SND_SOC_SOF_MTK_COMMON); MODULE_LICENSE("Dual BSD/GPL"); From patchwork Sat Oct 22 07:23: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: 7389 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1096844wrr; Sat, 22 Oct 2022 01:06:09 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5uYTLNWtUfjy2cSlQPJxZ1t4nvazG5UykDEZFjfwWc83RWP73V5C4+xS2GTt4gigis4E8v X-Received: by 2002:a17:90b:1643:b0:212:d286:bb13 with SMTP id il3-20020a17090b164300b00212d286bb13mr7437588pjb.11.1666425969285; Sat, 22 Oct 2022 01:06:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666425969; cv=none; d=google.com; s=arc-20160816; b=RJs8y01nq5l71iSOhLTEj5dvcSDs1jjI92wTw0ctXHdlX9Gd5yvT7J2Etq6yM6vQTs 7Jfy9N03Cmzqem8hcT3hoHDxv3eSgImrsKdQfC3GsOAH/mvEu7k2lw415KQucnNXsB9g GIpADExxBGTJBTH4zfl/qW+j+AGbGiQmHu/zD10wEqKWulBKiFTcT+bIFSOtnVq6foUF AZxbx49G9dnR/OkI7DAy23JI+GEwfPpA4WdAfAF3Fv89/TGcqVjbnPsoGvqjqZKf10q1 USfBqgC330IRF0GFeGYFsG81Zl7dl9aTO7TxsysEk8f+Dz4rwZpcfl6jLwJFjp49n9fY I9Fg== 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=UC5xUnD5vN2q0wJSEAC9uPW+rEyu7hJbWyi7VoOERw0=; b=qGeltTAKNOGiCdu7UJtnbp0ESTsp0gH+OUYPsFLviVdZ1e0iRL2SL3y4Xjq9mL+Dfn tUO+tPY1oI2aGvMcs9l16TANI/0p59VYf/N3BNGKmgO9anZaAwzKtOXjjIvEmZ+H2FBV tIzEaUzHL59jhRmAkm1tXW3hHlqUr63Y9HmozMT8l01aoeqZwgaQtAKFb/wvDzsLHXcb +wX3UZFfJgJUYW/VnXozRmlEvM2/UzCOuoHDyoTeIegp37RFReaaj9FjZdRTCVCHZmQl rwwIjpaQJtJ3HUOE2+p7fYYuFI6Zix/mvoaw8GUcfv5xfI7K37fhAm1PJP7tQLDAs+n4 NgfA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=LXP6qcPO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 v190-20020a6389c7000000b0044c7a49befesi24926607pgd.258.2022.10.22.01.05.53; Sat, 22 Oct 2022 01:06: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=LXP6qcPO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S232535AbiJVIFV (ORCPT + 99 others); Sat, 22 Oct 2022 04:05:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47932 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232589AbiJVH7N (ORCPT ); Sat, 22 Oct 2022 03:59: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 9129031232; Sat, 22 Oct 2022 00:49: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 4F322B82DF6; Sat, 22 Oct 2022 07:49:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B3288C433C1; Sat, 22 Oct 2022 07:49:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424969; bh=Qx7YqYDAslYo7Yv+XWnm5lJu4CbNEUcbSjGorjTbQ7k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LXP6qcPO8lswE66ETg1coe7vaUvIyd12O/uYLpq3YGFeVqfAn9lD5v92aPB5zgsRB 9/OyrJobX2gEKLyf296BHQinga8jt4/bi8ZJeg7oHZ0LEA2YpQDm1dU8AqHwo8slmj eS0XhaIP6ubs84WPunYpIdd7xzMYh8p9PLH4rMgM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Liang He , Tomi Valkeinen , Sasha Levin Subject: [PATCH 5.19 326/717] drm/omap: dss: Fix refcount leak bugs Date: Sat, 22 Oct 2022 09:23:25 +0200 Message-Id: <20221022072509.072284582@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747374277080255135?= X-GMAIL-MSGID: =?utf-8?q?1747374277080255135?= From: Liang He [ Upstream commit 8b42057e62120813ebe9274f508fa785b7cab33a ] In dss_init_ports() and __dss_uninit_ports(), we should call of_node_put() for the reference returned by of_graph_get_port_by_id() in fail path or when it is not used anymore. Fixes: 09bffa6e5192 ("drm: omap: use common OF graph helpers") Signed-off-by: Liang He Signed-off-by: Tomi Valkeinen Link: https://patchwork.freedesktop.org/patch/msgid/20220722144348.1306569-1-windhl@126.com Signed-off-by: Sasha Levin --- drivers/gpu/drm/omapdrm/dss/dss.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/gpu/drm/omapdrm/dss/dss.c b/drivers/gpu/drm/omapdrm/dss/dss.c index 0399f3390a0a..c4febb861910 100644 --- a/drivers/gpu/drm/omapdrm/dss/dss.c +++ b/drivers/gpu/drm/omapdrm/dss/dss.c @@ -1176,6 +1176,7 @@ static void __dss_uninit_ports(struct dss_device *dss, unsigned int num_ports) default: break; } + of_node_put(port); } } @@ -1208,11 +1209,13 @@ static int dss_init_ports(struct dss_device *dss) default: break; } + of_node_put(port); } return 0; error: + of_node_put(port); __dss_uninit_ports(dss, i); return r; } From patchwork Sat Oct 22 07:23: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: 7403 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1097240wrr; Sat, 22 Oct 2022 01:07:10 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7Ec630TaPWSHcVxm9866w4AtSziA+fXn6+YOYhoEEF+/rSNifumgDRQT0VHTsB/s3fVoX/ X-Received: by 2002:a05:6a00:88f:b0:530:dec:81fd with SMTP id q15-20020a056a00088f00b005300dec81fdmr23568412pfj.64.1666426019687; Sat, 22 Oct 2022 01:06:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666426019; cv=none; d=google.com; s=arc-20160816; b=x7rdQxRpxhvpq0o5SM9WuJEv1aOgibzPKC0g4TmlyMHIFECpD6wluc6LkDUBYwq8PW OST0KGp/huvPJSCNoXWnyxKWjgSFqD6yzere2y7fom2AE19rtb7VvFRu8eBNt9BVfNwR 6AGLcmwJyeBcCAffde63nLV1imP6hsXgfK5Jum/cDlJH4TkcCLBYtIcv0d//HVTGmXzs S8SPYShu4PtxpZOd7V0qwnTmS4jNkELKThvDNEoeCQSBLhr04L3yY/nwO1OxV7JjhpRJ m0mcUNhgsxHYuofGEEtm6/CftxIcnJ0+rrpAaDcqroe+hELZ1bruvagaYBZCZIicF1ov grOg== 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=izM7hl+4kSZE1BGEwOqban3+G7ebJ85ZO56F1crhC24=; b=PGQlUrJVwSnPkIIIJXXtXtKJroDbBdptFP8efLbugTGAJkfIG1jBwrRjIKJX/zTWmw eEymyToZvduDCkdTXo7hGVQTbHYJxsxeN5i4XoOYXd7jzrbI8Azm2iime0SNLS7WUjfT YyOw/1dXuF6QoBQcquhsNaTB11FE84B42Tf6iub+QnT/nrAPiSyEDIOeXQ6g1JaJpZV/ xhgrazd0T1kANpjlkBdGZ3qDu2x3BwdjTUsVOqxZeiPMjl5C/nwpGL70m1Rjab8S80wT GTwMR0en/ixZ7ECbC9pF4OIqMpvEco1MA0zF5Y05ZAyUCLKF6ParTUNCNnr2tCN5AYFD 2p+g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=q74jiVVv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 pc1-20020a17090b3b8100b00212221d926bsi2706501pjb.150.2022.10.22.01.06.47; Sat, 22 Oct 2022 01:06: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=q74jiVVv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S232466AbiJVIG1 (ORCPT + 99 others); Sat, 22 Oct 2022 04:06:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33538 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232821AbiJVIAB (ORCPT ); Sat, 22 Oct 2022 04:00:01 -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 42DE81A9118; Sat, 22 Oct 2022 00:50: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 F37C6B82E22; Sat, 22 Oct 2022 07:49:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 61929C433D7; Sat, 22 Oct 2022 07:49:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424998; bh=bHH5Vz9WUGOiTeAeeQ+WA7OaZoShJlUuxzwNps9q4Fs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=q74jiVVvn+zf0WRBc1MO2gU2O19xu9G151oug8af/6jlh54eYbi4LrL5KQhz5U9KT rBg0LHfyQvuhqVRbV7HltIzeoop9RT21WpEQuhkEVZv5ImoGhcCLr64b0luNpYj0n2 EAVrgtVLf0+TmehszVjur9lI2cS1xPRIVeyzMAJ8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Rafael Mendonca , Alex Deucher , Sasha Levin Subject: [PATCH 5.19 327/717] drm/amdgpu: Fix memory leak in hpd_rx_irq_create_workqueue() Date: Sat, 22 Oct 2022 09:23:26 +0200 Message-Id: <20221022072509.187763601@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747374330118436373?= X-GMAIL-MSGID: =?utf-8?q?1747374330118436373?= From: Rafael Mendonca [ Upstream commit 7136f956c73c4ba50bfeb61653dfd6a9669ea915 ] If construction of the array of work queues to handle hpd_rx_irq offload work fails, we need to unwind. Destroy all the created workqueues and the allocated memory for the hpd_rx_irq_offload_work_queue struct array. Fixes: 8e794421bc98 ("drm/amd/display: Fork thread to offload work of hpd_rx_irq") Signed-off-by: Rafael Mendonca Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin --- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c index d752aadd34bf..612970a9fe65 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c @@ -1363,13 +1363,21 @@ static struct hpd_rx_irq_offload_work_queue *hpd_rx_irq_create_workqueue(struct if (hpd_rx_offload_wq[i].wq == NULL) { DRM_ERROR("create amdgpu_dm_hpd_rx_offload_wq fail!"); - return NULL; + goto out_err; } spin_lock_init(&hpd_rx_offload_wq[i].offload_lock); } return hpd_rx_offload_wq; + +out_err: + for (i = 0; i < max_caps; i++) { + if (hpd_rx_offload_wq[i].wq) + destroy_workqueue(hpd_rx_offload_wq[i].wq); + } + kfree(hpd_rx_offload_wq); + return NULL; } struct amdgpu_stutter_quirk { From patchwork Sat Oct 22 07:23: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: 7405 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1097312wrr; Sat, 22 Oct 2022 01:07:23 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5TY08l0HjNOVOPbx3FZMFvJ3ZaYBYLKSlVs9FrESBqr4cGSBqcwJtVqsg31BVVCTYxuNoN X-Received: by 2002:a63:2352:0:b0:46b:1dac:bc83 with SMTP id u18-20020a632352000000b0046b1dacbc83mr20233821pgm.98.1666426043460; Sat, 22 Oct 2022 01:07:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666426043; cv=none; d=google.com; s=arc-20160816; b=HKz8ac1Cyd3cFqXaxZpsVfTrdckgV0/wrVUB9d5WMJsyDtyrKS3aAi+ZQ9EWy11ti9 pKNwJDhUjPeWASYvTXR2GXa3PV8sJDbLAka8n1UlIZbFH41Zv4jIqtuXrhpfO5w9snRV E852jQwo5H3DVTd2XX9VDtC2+XmrH5vlN0J3iGX88vLrWQeaAr+s8OyzNau9uQANQzLP lqR2p3UJlD4aY5rtEZmM8luYVntcGX8/2daINayaVdw4ysYCCHbMnIj0sTZC/jnRcSvg 63natQMaXsVkRaQUjO2WcohPikJ+bBF3lOhfTfQTJB2SPv0yI0GI70QsgEqZ2gCs2MGz 0huw== 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=U6nWnqz9KWoXfskAhzpsF2EhfEB0Sft67m14RPU65sg=; b=bhfeHdcLyIhjUKIk7+Ov2gLAUW8A75nu2C7dZ41/+m1eYI+IkS8BQilbANdimRwpXP ko010ptArd9GJAA7KMEgnvH+cbpla/o/9v4WDxcXGAt59AuvbplfqG4sas7TJJJ1Gwrc HnxNNLlqEawNxvP/MZbi/UqIN9NEgEaeLx5jFt9OA/WWx+EJAAjrH/JXG72MiA0jE1Kf B+xyF8O7aBFXTaLDn/Jx3Eksqi6XKi1d5IAN6+au43BidI3aM6GHofsoL1zecBqSBEc+ LC+fuGyttY0DhIf+KRIAzmwIMOd6DBFN6wvdzlHGGArAkhtcmvXuUTD821SmdIN0dHtl L53Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=GmG0glR1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 h11-20020a056a00170b00b00565cb1ebdbcsi30632155pfc.277.2022.10.22.01.07.10; Sat, 22 Oct 2022 01:07: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=GmG0glR1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S232618AbiJVIGp (ORCPT + 99 others); Sat, 22 Oct 2022 04:06:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39544 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232911AbiJVIAP (ORCPT ); Sat, 22 Oct 2022 04:00: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 772AB24CC04; Sat, 22 Oct 2022 00:50:25 -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 2EA27B82E1F; Sat, 22 Oct 2022 07:50:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 770D8C433D6; Sat, 22 Oct 2022 07:50:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425009; bh=CUPY4O+CKLsV9H/zO+hL/T9LV5w7NgSzOSfvf/6/Fb4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GmG0glR1fNnxIvvic2W+CF0lTjwWqEmxdARaXoOYY99nWB1YXHGXwrYGvVFQVwtJF fKzPfCJ7cox3p+ZwnFUkeH1gjPGL9OAtP6+6zhs5Tq8G6CuTuyz+vxMue2dTDipNIn hlbdmYotJrCJxy8AKrw7u2SB7Tz/7AXfA08PC3T0= 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 5.19 328/717] mmc: au1xmmc: Fix an error handling path in au1xmmc_probe() Date: Sat, 22 Oct 2022 09:23:27 +0200 Message-Id: <20221022072509.354373855@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747374355031956342?= X-GMAIL-MSGID: =?utf-8?q?1747374355031956342?= 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 a9a0837153d8..c88b039dc9fb 100644 --- a/drivers/mmc/host/au1xmmc.c +++ b/drivers/mmc/host/au1xmmc.c @@ -1097,8 +1097,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 Sat Oct 22 07:23: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: 7548 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1105890wrr; Sat, 22 Oct 2022 01:36:27 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5W3DnENzeh3DECSqphgTkirw92BpC5fgS8s27gJFXTxTf8umYcoZyVY/CvjmIHoyUyhp2S X-Received: by 2002:a05:6a00:1412:b0:557:d887:2025 with SMTP id l18-20020a056a00141200b00557d8872025mr23249559pfu.39.1666427786735; Sat, 22 Oct 2022 01:36:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666427786; cv=none; d=google.com; s=arc-20160816; b=rrW8KMtZsab+cwfPjLlTxM/ePDfSiS6x4ivjWc89gZu2TRLNXnosQFnPruE3OL3pMG 4ME9wBHzXDy99m+eGXaw7iAW9+GI1a03ZKSdrETjtj5gcC/A2kzQDWPMF56i85h6a0cn KX5E/S6qSO2cEuBrzIKs/HKYmRc6qN0yDR8i3T9FVg1etN8ZvEGJXzomQaOWxWu2C6RK GIEZFn7z5fCIGdUm1oFLTGsFywP6C7027glFsb/FCCFOLQcAk81B9AUJnoRHz8qibgoE MT7PzJthknjory09Xe837S33S+fRhtXLxKWmOxcN4/jQkJwaAH+/n6tbPtZy1PNBBatU 2Asg== 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=ZeIJKrwyPc0cOIgWlTV2wtQrElNlHhj6dlq4k//Eb3E=; b=UprzPb+hwaaUM45CZ9vPRMN2GatPahhx3EO+7paWVGWzSR6vGCX77oHI0wSQjeDDa7 oKFoznfAW02xCeooZQ7y7No0lvTO8R/VibSldebGGm0kjHo1qZcsjJux+zXCVFp9MJ6T yWbM7SaSLka64QmNimcWPaDeCCyFdoz47nnOl1eORhD1F24eAFYb+N6EcYHcS4WqAL7L 2A7dRVjisP+MRQoJg8g3Hvb4zZh1yS00acKMHBCe2bP1Ik0InkOxCT/yaHn+CrGLjW8B wGg4qLeF8dSTk/u8taeacbSgTjB/jxZubotvcwxHGr1dwaCNTFluSAmHqpecQ5lho0Y1 36Fw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Wa6Xjzgi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 l12-20020a056a0016cc00b005281e5606b2si29283584pfc.32.2022.10.22.01.36.11; Sat, 22 Oct 2022 01:36: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=Wa6Xjzgi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S233453AbiJVIRt (ORCPT + 99 others); Sat, 22 Oct 2022 04:17:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51498 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234010AbiJVIPy (ORCPT ); Sat, 22 Oct 2022 04:15: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 610042DAC3B; Sat, 22 Oct 2022 00:56: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 11F1860B1F; Sat, 22 Oct 2022 07:50:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 24640C433C1; Sat, 22 Oct 2022 07:50:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425012; bh=dNMunzMMumve21E4L5a/WJb3XjIry962Cna+gvU05lc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Wa6XjzgiAyAlVtMU9V9qJOnOUQ+Ixa0054pR71yviIay4uvABqqOxfODBBQ/QjW/K VG113qQx9kL8vFubSbyJezmggllDuzqmwIi8ptSt9/zgmrM3EDZpATq1bcd0gdP99V Omn8ZZbOqWeB9/5l4y5juN+byOFIR/8gV2Vcvq1g= 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 5.19 329/717] ASoC: eureka-tlv320: Hold reference returned from of_find_xxx API Date: Sat, 22 Oct 2022 09:23:28 +0200 Message-Id: <20221022072509.441930545@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376182601321981?= X-GMAIL-MSGID: =?utf-8?q?1747376182601321981?= 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 8b61582753c8..9af4c4a35eb1 100644 --- a/sound/soc/fsl/eukrea-tlv320.c +++ b/sound/soc/fsl/eukrea-tlv320.c @@ -86,7 +86,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) { @@ -143,7 +143,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 | @@ -158,10 +158,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; @@ -178,6 +179,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 Sat Oct 22 07:23: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: 7430 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1097885wrr; Sat, 22 Oct 2022 01:09:04 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6c/GDvej5sDT735OX/tvkq+BpW6uofTIisQ0wByMQCSxMnG/5RFhAP9en8blKz3tNkTxdn X-Received: by 2002:a63:2a86:0:b0:46a:eaba:f1f3 with SMTP id q128-20020a632a86000000b0046aeabaf1f3mr19382648pgq.79.1666426143779; Sat, 22 Oct 2022 01:09:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666426143; cv=none; d=google.com; s=arc-20160816; b=IS9ekA8DoIElaxbsp3cA7BN2kCKbkmGDyFKNdFugK5IAZMoisyKwxBwwk0vvJmU4mE CYcq7nUKACugpB739WVrxw5glX30a7kEUGRniKkihNsMvmM3gxw5fj6p4flsRSJUgIjs L3tNY/5inU0ht9OI3YMWORsQnsy4+meW29FTiMYlgLfWWEE4BCGnOUSaQS0bcbb8CZ+R djy9bgK7KTH64Fe79E24p7Ithm94LQjK8rcGB9aig+lYUyAA55ugOcaQRcOgrm0BLeIz JU7Fhw6iN/Nwbqwpm205TIgx/+pwaiScBLrtC6BubSwyvu0StegHLke0ZXVQkWF5FezN vCaw== 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=e3AuUzPe4EUkZ2qxQflwwEBZZqbX2opKgSxdQqKBj1M=; b=QA01b361+hjPEaydsAQggbtGnQoLENkT7LL98bE33OcRtLIRm7/5hMq8XKG6MJwcKB 49ihHL5PmAvTqiHu6s5OL8G/BrDQ/GN6P+DJsAEo5zPwEoyXvcJhGIAdotbUtpmzowVN bIvPT7aLdpIXyWnXGsSNAYO0xCJ+etPuC/T6kl200Qn5r0CIw8YmkVqDRFv2Lj2QT/bQ W8VD+Uv3tuoA8DPWvSwemv22C017Btok9nqQFJBL8hyU8C47sL1t+DjLyER5ypCPE9IZ g4fr2ipWi2ApvLgsfoIK0G572SMEUFNYH4LfilojPYSbunrHwkiVkJ4ucpWH/8fQ6QdS i6VQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=abH4jQAp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 q4-20020a056a00150400b00565cb1ebdb2si29291366pfu.267.2022.10.22.01.08.49; Sat, 22 Oct 2022 01:09: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=abH4jQAp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S232871AbiJVIIb (ORCPT + 99 others); Sat, 22 Oct 2022 04:08:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42324 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232996AbiJVIEg (ORCPT ); Sat, 22 Oct 2022 04:04: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 212532C56A4; Sat, 22 Oct 2022 00:52: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 9828160B39; Sat, 22 Oct 2022 07:50:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A85A6C433C1; Sat, 22 Oct 2022 07:50:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425015; bh=UJm+gn1TcHPDC6D7HJCQhNP5qveQ9yG2fJZsrvDSvBA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=abH4jQApVUH57BNHX5aIDuO8sXvXv43H0Fq7F4mfty4WVnMgLqlu9FWesu/jhvgyv a7XqrsBrCmNuffStRA9ik/jrEZuVrkkF2PsvcxLrNe7BZOsuyGK9j1P/yVm0dKQ0yB n9lKV1EeO/sbfThbTKGdCpczRMUUw8h5TPA+PFvs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Marijn Suijten , Yassine Oudjana , Dmitry Baryshkov , Rob Clark , Sasha Levin Subject: [PATCH 5.19 330/717] drm/msm: lookup the ICC paths in both mdp5/dpu and mdss devices Date: Sat, 22 Oct 2022 09:23:29 +0200 Message-Id: <20221022072509.522131513@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747374460120623116?= X-GMAIL-MSGID: =?utf-8?q?1747374460120623116?= From: Dmitry Baryshkov [ Upstream commit 5ccdcecaf8f732f593e359ebfb65de96b11bae66 ] The commit 6874f48bb8b0 ("drm/msm: make mdp5/dpu devices master components") changed the MDP5 driver to look for the interconnect paths in the MDSS device rather than in the MDP5 device itself. This was left unnoticed since on my testing devices the interconnects probably didn't reach the sync state. Rather than just using the MDP5 device for ICC path lookups for the MDP5 devices, introduce an additional helper to check both MDP5/DPU and MDSS nodes. This will be helpful for the MDP5->DPU conversion, since the driver will have to check both nodes. Fixes: 6874f48bb8b0 ("drm/msm: make mdp5/dpu devices master components") Reported-by: Marijn Suijten Reported-by: Yassine Oudjana Signed-off-by: Dmitry Baryshkov Tested-by: Marijn Suijten # On sdm630 Tested-by: Yassine Oudjana # msm8996 Patchwork: https://patchwork.freedesktop.org/patch/496488/ Link: https://lore.kernel.org/r/20220805115630.506391-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 | 7 ++----- drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c | 9 +++------ drivers/gpu/drm/msm/msm_drv.h | 2 ++ drivers/gpu/drm/msm/msm_io_utils.c | 22 ++++++++++++++++++++++ 4 files changed, 29 insertions(+), 11 deletions(-) diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c index e23e2552e802..9eff6c2b1917 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c @@ -383,12 +383,9 @@ static int dpu_kms_parse_data_bus_icc_path(struct dpu_kms *dpu_kms) struct icc_path *path1; struct drm_device *dev = dpu_kms->dev; struct device *dpu_dev = dev->dev; - struct device *mdss_dev = dpu_dev->parent; - /* Interconnects are a part of MDSS device tree binding, not the - * MDP/DPU device. */ - path0 = of_icc_get(mdss_dev, "mdp0-mem"); - path1 = of_icc_get(mdss_dev, "mdp1-mem"); + path0 = msm_icc_get(dpu_dev, "mdp0-mem"); + path1 = msm_icc_get(dpu_dev, "mdp1-mem"); if (IS_ERR_OR_NULL(path0)) return PTR_ERR_OR_ZERO(path0); diff --git a/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c b/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c index 3d5621a68f85..b0c372fef5d5 100644 --- a/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c +++ b/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c @@ -921,12 +921,9 @@ static int mdp5_init(struct platform_device *pdev, struct drm_device *dev) static int mdp5_setup_interconnect(struct platform_device *pdev) { - /* Interconnects are a part of MDSS device tree binding, not the - * MDP5 device. */ - struct device *mdss_dev = pdev->dev.parent; - struct icc_path *path0 = of_icc_get(mdss_dev, "mdp0-mem"); - struct icc_path *path1 = of_icc_get(mdss_dev, "mdp1-mem"); - struct icc_path *path_rot = of_icc_get(mdss_dev, "rotator-mem"); + struct icc_path *path0 = msm_icc_get(&pdev->dev, "mdp0-mem"); + struct icc_path *path1 = msm_icc_get(&pdev->dev, "mdp1-mem"); + struct icc_path *path_rot = msm_icc_get(&pdev->dev, "rotator-mem"); if (IS_ERR(path0)) return PTR_ERR(path0); diff --git a/drivers/gpu/drm/msm/msm_drv.h b/drivers/gpu/drm/msm/msm_drv.h index 099a67d10c3a..17e8b6571f6f 100644 --- a/drivers/gpu/drm/msm/msm_drv.h +++ b/drivers/gpu/drm/msm/msm_drv.h @@ -442,6 +442,8 @@ void __iomem *msm_ioremap_size(struct platform_device *pdev, const char *name, phys_addr_t *size); void __iomem *msm_ioremap_quiet(struct platform_device *pdev, const char *name); +struct icc_path *msm_icc_get(struct device *dev, const char *name); + #define msm_writel(data, addr) writel((data), (addr)) #define msm_readl(addr) readl((addr)) diff --git a/drivers/gpu/drm/msm/msm_io_utils.c b/drivers/gpu/drm/msm/msm_io_utils.c index 7b504617833a..d02cd29ce829 100644 --- a/drivers/gpu/drm/msm/msm_io_utils.c +++ b/drivers/gpu/drm/msm/msm_io_utils.c @@ -5,6 +5,8 @@ * Author: Rob Clark */ +#include + #include "msm_drv.h" /* @@ -124,3 +126,23 @@ void msm_hrtimer_work_init(struct msm_hrtimer_work *work, work->worker = worker; kthread_init_work(&work->work, fn); } + +struct icc_path *msm_icc_get(struct device *dev, const char *name) +{ + struct device *mdss_dev = dev->parent; + struct icc_path *path; + + path = of_icc_get(dev, name); + if (path) + return path; + + /* + * If there are no interconnects attached to the corresponding device + * node, of_icc_get() will return NULL. + * + * If the MDP5/DPU device node doesn't have interconnects, lookup the + * path in the parent (MDSS) device. + */ + return of_icc_get(mdss_dev, name); + +} From patchwork Sat Oct 22 07:23: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: 7408 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1097405wrr; Sat, 22 Oct 2022 01:07:38 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7uzJWvFh+P5iV3gmuSMQIr3SvymUJZ6sjTeVW8l7cPYYXPyL8aQFXn2PDmiifkOTz+FFmD X-Received: by 2002:a63:8a42:0:b0:460:58ec:cc66 with SMTP id y63-20020a638a42000000b0046058eccc66mr19533574pgd.195.1666426058192; Sat, 22 Oct 2022 01:07:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666426058; cv=none; d=google.com; s=arc-20160816; b=CMb6VlwnJpjqu6B0bnd4UNToQF565MYLI/WGm7VzTFXXHbvvW0QNrWQ9+Bu2KMon6E 6IMZM+nyOZc0sUpiDyfGELXz2QUohFbdqq7F0r8XV3jkF7ZKlLexSWIs/R28WGxCmZpj DYu1XbTtrF2be+bKQQs5WgJwFwPQ5tu5S5x1Y4E+t+AlN1RgKQMecOHmQkXTJA3v/DfY +LcK7PuUy17dC0KZ4KMLvkFDcWhSmUuyHh8N/n7JyFKkWPL7ZN79qYuz0uBWGguUpQhv 6YgoIUsaig0yJ5zoCNgzg2rqUf04poQHWqvF0mblY478/rW2Hxgbedin2sX0NJhUVRHJ VJlw== 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=Z/zqO4/op+/8xsSl3O1KyLZ0nnQ1L0VgsXTCSkQXiTA=; b=fytNnNxpo0V5UlZ3HtNb+0NzI2IFahDR6NhUH986s6COq/9yGSr3rFAZlielf2Cxvc 1hNnn9IZbUUg2onGAkses9WLzBuNiUJSM8dvFUYvx88iMcVAngtgvyD1eBg/t+z1CWiz i1Cpp8gGGPaEUE7Z+81KfO3VetPrU0o0dwWZh+W4FmNEiZsVlO4QTI7dkEXHqHI7GzFx ugH4aeUn8D89Yadw8V05A6PPChI7HUCfqrxJP7LziuVptDc9BCYeFfVvQhEE+l1Fmw7+ l3BJiCBUW1K86/FNC/wLjZZeApcGEtu3ZvusxLt6QCgQpVmdzKT4WnVEPsVaAH4F3s/1 pIVg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=dTO8kjhr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 o3-20020a17090a55c300b0020d3d140013si9087733pjm.182.2022.10.22.01.07.25; Sat, 22 Oct 2022 01:07: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=dTO8kjhr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S232898AbiJVIHI (ORCPT + 99 others); Sat, 22 Oct 2022 04:07:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42350 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233002AbiJVIAd (ORCPT ); Sat, 22 Oct 2022 04:00: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 D031C270817; Sat, 22 Oct 2022 00:50: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 2B1D9B82E25; Sat, 22 Oct 2022 07:50:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6CD2AC433D6; Sat, 22 Oct 2022 07:50:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425017; bh=2qny8U+OxldqIkanBdlw9qWsDz2FDX0aNOYt6HTSGfY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dTO8kjhrxW7D60CcriB/Nj/4cfoTSHql6gXTRZIteS+8AfzPaCV49e/3Axwitx28F +nFIdhJV1f5QxtbdgxeEMrqb4PMRNeWru4mAr+34/DeA/gZHCsfSjYFOefM4udZ+R6 GJo9AlcbP9bcy4Wo3zPrRjytwG5KqT4J/dB1hQyI= 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 5.19 331/717] drm/msm/dpu: index dpu_kms->hw_vbif using vbif_idx Date: Sat, 22 Oct 2022 09:23:30 +0200 Message-Id: <20221022072509.611304972@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747374370370708275?= X-GMAIL-MSGID: =?utf-8?q?1747374370370708275?= 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 9eff6c2b1917..8902d3615ca9 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c @@ -825,12 +825,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; } } } @@ -1132,7 +1130,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 21d20373eb8b..a18fb649301c 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_vbif.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_vbif.c @@ -11,6 +11,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 @@ -148,20 +156,15 @@ 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; 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) { DRM_DEBUG_ATOMIC("invalid arguments vbif %d mdp %d\n", vbif != NULL, mdp != NULL); @@ -204,7 +207,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; @@ -216,13 +219,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 Sat Oct 22 07:23: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: 7411 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1097452wrr; Sat, 22 Oct 2022 01:07:49 -0700 (PDT) X-Google-Smtp-Source: AMsMyM64usg40wwWR/u0/iCa0d4Iqq6lq66LLS/z0bWTrvo8gKqQSELvSt67/YgGcc0vZv6XFNRS X-Received: by 2002:a17:903:32c9:b0:186:883f:ffdb with SMTP id i9-20020a17090332c900b00186883fffdbmr3306335plr.135.1666426069437; Sat, 22 Oct 2022 01:07:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666426069; cv=none; d=google.com; s=arc-20160816; b=v7GZBE+fNVhv5TNhWZet1cUhk8joO9HurFDy9jgWG/idGJrGjoKMl+eDS9gVSH+oRh gpon57Wjf2J2+BEWLFISiDffOoVswgQ8MxJ91S8I9xQXFgf4+lavXVgb6RwDNjs4+qjY Eg3SYxpBxJEcNRhKtxOj+6H781im5j3ztxhE0gLWK8mAdr0WH/rDos1mjvPP1UrQ8bgS jDd1pYuyn55UAQ+XNAjXdnrM238bpO6H10BWskFaX4ndGVGxtM9VtySHbQKW1EOSw92+ 6oB6irQ06WYr5izeAg/oNLgNsNYieCV9m/gOfTjVyzt8x6kAE5pfLamZOnPJUBXy0ApA BGfA== 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=fM0FVpQuZrBDu9a2iRTZRTCMebAGXTHC3H5gOPUHqJA=; b=iUyIgmVfi4un+qG5qHBOzpzJtzYwsQk/dcDD2Du+ALb3lJjqgLPpTbClWfGS/1GLQw pTnHCAfTktlqLgKXNW8nGRP8twu0wB2M8+c/Lxgq2hn5fYV31BFPaGxvwID2se4Kwhw3 i4ACiwm1eES382w1v0WakwLFjrKnZHGnz3Rc+TCww+tx7KHC4L45bRkbzPzGRNIWW57H N6FFkbjHesknldt87lzWhUJALkF8n1tQZgV2NuMPhx6Hc+t7iaScG3uxYESryrP5COXZ +u7vvJOsj8F1B1XqpwjQpF0dhVCeGWLGrrRD4ryVSEH+w9R7RV1Cis0F/foNw+J1yyOZ C9IQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=gWfHPER+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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-20020a17090a558200b0020af39f326fsi2133570pji.133.2022.10.22.01.07.37; Sat, 22 Oct 2022 01:07: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=gWfHPER+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S232917AbiJVIHP (ORCPT + 99 others); Sat, 22 Oct 2022 04:07:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39560 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232330AbiJVIBB (ORCPT ); Sat, 22 Oct 2022 04:01:01 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B6ACC290681; Sat, 22 Oct 2022 00:50: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 ams.source.kernel.org (Postfix) with ESMTPS id 10F22B82E28; Sat, 22 Oct 2022 07:50:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4D313C433D6; Sat, 22 Oct 2022 07:50:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425020; bh=iHwbAIKGTFm2iePSccsgJpuXwAdrLKOvAqCJRJ1QZhE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gWfHPER+swwzta6BPhIQ8QD4RYTKmGeYQl/Mpe9dUHk1lRENvtH/3rBwj/dsp504E 8NKQcQy9gXegJj0BYXrMSu2UhGpUEz31M5yZAg4eolf0wI2tC/QxoD7J+QH/vJiaGJ 0WzirN9IHjHCbRrZn9Uh7xzx3kEeMMkUFaj4BhpI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kuogee Hsieh , Stephen Boyd , Abhinav Kumar , Dmitry Baryshkov , Rob Clark , Sasha Levin Subject: [PATCH 5.19 332/717] drm/msm/dp: correct 1.62G link rate at dp_catalog_ctrl_config_msa() Date: Sat, 22 Oct 2022 09:23:31 +0200 Message-Id: <20221022072509.689881431@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747374381995390545?= X-GMAIL-MSGID: =?utf-8?q?1747374381995390545?= From: Kuogee Hsieh [ Upstream commit aa0bff10af1c4b92e6b56e3e1b7f81c660d3ba78 ] At current implementation there is an extra 0 at 1.62G link rate which cause no correct pixel_div selected for 1.62G link rate to calculate mvid and nvid. This patch delete the extra 0 to have mvid and nvid be calculated correctly. Changes in v2: -- fix Fixes tag's text Changes in v3: -- fix misspelling of "Reviewed-by" Fixes: 937f941ca06f ("drm/msm/dp: Use qmp phy for DP PLL and PHY") Signed-off-by: Kuogee Hsieh Reviewed-by: Stephen Boyd Reviewed-by: Abhinav Kumar Patchwork: https://patchwork.freedesktop.org/patch/499328/ Link: https://lore.kernel.org/r/1661372150-3764-1-git-send-email-quic_khsieh@quicinc.com [DB: rewrapped commit message] Signed-off-by: Dmitry Baryshkov Signed-off-by: Rob Clark Signed-off-by: Sasha Levin --- drivers/gpu/drm/msm/dp/dp_catalog.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/msm/dp/dp_catalog.c b/drivers/gpu/drm/msm/dp/dp_catalog.c index 7257515871a9..676279d0ca8d 100644 --- a/drivers/gpu/drm/msm/dp/dp_catalog.c +++ b/drivers/gpu/drm/msm/dp/dp_catalog.c @@ -431,7 +431,7 @@ void dp_catalog_ctrl_config_msa(struct dp_catalog *dp_catalog, if (rate == link_rate_hbr3) pixel_div = 6; - else if (rate == 1620000 || rate == 270000) + else if (rate == 162000 || rate == 270000) pixel_div = 2; else if (rate == link_rate_hbr2) pixel_div = 4; From patchwork Sat Oct 22 07:23: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: 7865 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1162641wrr; Sat, 22 Oct 2022 04:33:02 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4zXuGRty7lJXo9AtabCQAupLKEFzKaxmoUWhGTlEsJy5RpuxcuXlzJ6Dsos1Fyh07V0Mnx X-Received: by 2002:a63:fd09:0:b0:464:4ec8:89b3 with SMTP id d9-20020a63fd09000000b004644ec889b3mr19893012pgh.175.1666438382255; Sat, 22 Oct 2022 04:33:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666438382; cv=none; d=google.com; s=arc-20160816; b=z1ohqsp2i8mAVohorTXoaINVzywwMZD+kb5U+SpAv0RWSNVC8OeydRM2IrS6nRCcA4 bnieWXGlcSMZoJoglj50uNTKp0Ad3TXucX6LDykj9ju0c4IwAXBoQKxwUitFPz8jSLae 7pAr2fmHl9l1amhMdMgcLPvHGyKmexoQEdQnIZT8c+5qCa2AJjzm/YSDmkbvhzdVN3yi ouGTULYaNGYDrK5g6WhsUedszbAkbjOaCTcYq9hsy1xNW/omJepb/cQPEQNJv3CjB2jV P5prPxmEtUa2jD7Mwt50kgTbOIqJ2/PCYUGnUc6J7CxXQ3qi9KBeMMCSM8bHVFcESXQd f8Ag== 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=p84jcEu+Qzl5MCFY6lj5JtqZFoFBXeuOPa10FMEQLBU=; b=MTbcsMqsLIK2cPk+bEtlio19l3yrdfoEHP/uvY8puYElCaRqphslPCDR5vl8rfiTE9 0/oK+m97EjJr4vp3DUlQ3n15ewt4t+u9xKMkuF2L+EKYzO39MZLutf25+jtV4mjhF11I rrzjA1HH0uQszLl8YPfNar5YEtgeyl9ARGreN4EsacGSDDj6/jq7YiQxNsQgAF2k8eu+ PbdEX/GR2NjipWoP0nd80sVKdpJ50N1jOok9FgJ9tpC9rhrviiqvj4nZuhUxtOvys44x DRR4/6KreQvy9yyaTxsa3Q5Ag8aNc4j+5vJlIP0StSi8UJBbQtoxdX3U2QOoon8T2fzS b3Yw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=sh0bSzyH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 q4-20020a654944000000b0044a3d657f53si29216987pgs.92.2022.10.22.04.32.49; Sat, 22 Oct 2022 04:33: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=sh0bSzyH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S230319AbiJVLWG (ORCPT + 99 others); Sat, 22 Oct 2022 07:22:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33122 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230286AbiJVLVo (ORCPT ); Sat, 22 Oct 2022 07:21:44 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 94245238244; Sat, 22 Oct 2022 03:50:22 -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 sin.source.kernel.org (Postfix) with ESMTPS id F1198CE2CA3; Sat, 22 Oct 2022 07:50:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 10EE1C433D6; Sat, 22 Oct 2022 07:50:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425023; bh=mVlXKDyloWHczG4w8BODEuzPi+MoNX5tHp/3T8IM120=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sh0bSzyHHMKUv5eCZ6JbbRarLP+IbqlW73NGf8cvWSG4pY2XyhCZgPEt5x32l8xuq +1zajEQn9VOqCiPXRDpyRTwo9LhLR+ijuNIWp952EVwiGhgbgFDRx/GEpO7Uh3dCM/ NzBQyirJoVLHkwe/pZ1m2IbFdoEQsHMA8R7MjI24= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Takashi Iwai , Sasha Levin Subject: [PATCH 5.19 333/717] ALSA: usb-audio: Properly refcounting clock rate Date: Sat, 22 Oct 2022 09:23:32 +0200 Message-Id: <20221022072509.781401249@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 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?1747387293117003839?= X-GMAIL-MSGID: =?utf-8?q?1747387293117003839?= From: Takashi Iwai [ Upstream commit 9a737e7f8b371e97eb649904276407cee2c9cf30 ] We fixed the bug introduced by the patch for managing the shared clocks at the commit 809f44a0cc5a ("ALSA: usb-audio: Clear fixed clock rate at closing EP"), but it was merely a workaround. By this change, the clock reference rate is cleared at each EP close, hence the still remaining EP may need a re-setup of rate unnecessarily. This patch introduces the proper refcounting for the clock reference object so that the clock setup is done only when needed. Fixes: 809f44a0cc5a ("ALSA: usb-audio: Clear fixed clock rate at closing EP") Fixes: c11117b634f4 ("ALSA: usb-audio: Refcount multiple accesses on the single clock") Link: https://lore.kernel.org/r/20220920181126.4912-1-tiwai@suse.de Signed-off-by: Takashi Iwai Signed-off-by: Sasha Levin --- sound/usb/endpoint.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) --- a/sound/usb/endpoint.c +++ b/sound/usb/endpoint.c @@ -39,6 +39,7 @@ struct snd_usb_iface_ref { struct snd_usb_clock_ref { unsigned char clock; atomic_t locked; + int opened; int rate; struct list_head list; }; @@ -802,6 +803,7 @@ snd_usb_endpoint_open(struct snd_usb_aud ep = NULL; goto unlock; } + ep->clock_ref->opened++; } ep->cur_audiofmt = fp; @@ -925,8 +927,10 @@ void snd_usb_endpoint_close(struct snd_u endpoint_set_interface(chip, ep, false); if (!--ep->opened) { - if (ep->clock_ref && !atomic_read(&ep->clock_ref->locked)) - ep->clock_ref->rate = 0; + if (ep->clock_ref) { + if (!--ep->clock_ref->opened) + ep->clock_ref->rate = 0; + } ep->iface = 0; ep->altsetting = 0; ep->cur_audiofmt = NULL; @@ -1633,8 +1637,7 @@ void snd_usb_endpoint_stop(struct snd_us WRITE_ONCE(ep->sync_source->sync_sink, NULL); stop_urbs(ep, false, keep_pending); if (ep->clock_ref) - if (!atomic_dec_return(&ep->clock_ref->locked)) - ep->clock_ref->rate = 0; + atomic_dec(&ep->clock_ref->locked); } } From patchwork Sat Oct 22 07:23: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: 7383 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1096682wrr; Sat, 22 Oct 2022 01:05:41 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4+LaVPSX1TF17bCAFH3SDzCohfi+6JQfXwVOZA0mEYFNFOkipyyV2mGslqHP4qRxJ+xHZD X-Received: by 2002:a65:6d1a:0:b0:3fb:2109:7b87 with SMTP id bf26-20020a656d1a000000b003fb21097b87mr19274680pgb.127.1666425941070; Sat, 22 Oct 2022 01:05:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666425941; cv=none; d=google.com; s=arc-20160816; b=pFduAR5I2l43bhjGPvGoD6ULN5N4amvhpCXdp/j0Ue09GBxO3MQGd8+3GAHoUyTz3B TibXu8rV57VC6Avm2niN/12U58FXo4WXq1aNxQi7pSJ1JDfzFfqoJoMkC5WDRDrv6939 TNk7GN0YAfes8h/6yD9GwKVBUEmznuU5Gwdt4b42LdzmpI7Geu2PH0qKIoH084+WQ9B2 2fKLTIfJ2rkN909B8mTySuHD295Ar9RwN0KNsDIoPEb4yIg49EMqVpF54sidkQj9BIbx K2aR2bJcsdR/la9jP2GzYpBj/5AKpKIXoNe1zght9HKmrw97yLBijLmIfkq0THDj41yS 3orA== 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=DOuvRinasGs+eBIL69O1zy47APGnMPHF0l9YuIdI0kk=; b=pEKAQpOlMStlwaek45REPwdaivpkh33Mxp1kVvmTt54FKrEHoMKDejKfCbAITLWhgk lrsxpU3qBZnX4gM7KiJ+z5LD3YVaBsuNLWIa6cPanuy8lq74wB0ky2JjCAlxrSYelqsa dHB4X99EzDb6p1c8E0ZayTZNT48S5wKPLF8X5KJJpVYdRoTxFFRrogOr1yRjLFxW/Ymk dyHI2TpgzfdmLUL/QfNZrdhN9XqlCkmPgJ/QmY3qUxbxszDFw2WrWJ1HXr9ANJRhiu1H RroXQlF1nEJYUY1CzhqPw+Ru1YmKEy1UbkJSWZ/xe7/0+l+11pFizRvQuX6OXpoTIEwp ejBQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=EQYwhsGG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 o2-20020a170902d4c200b0018552c4f4c3si17823437plg.615.2022.10.22.01.05.26; Sat, 22 Oct 2022 01:05: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=EQYwhsGG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S232935AbiJVIE2 (ORCPT + 99 others); Sat, 22 Oct 2022 04:04:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37786 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232439AbiJVH7A (ORCPT ); Sat, 22 Oct 2022 03:59: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 2CC8A173FE8; Sat, 22 Oct 2022 00:49: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 314D460AC7; Sat, 22 Oct 2022 07:49:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4879BC433C1; Sat, 22 Oct 2022 07:49:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424941; bh=xvO8OBdejBy1K8qqYfbWb8o0/2MXHQoNgGR1UEb5JqQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EQYwhsGGjLj3UMBFgDAZZHSx24aCMm9iORVKTQ+RVS/6AjwhQW8Fr054abjsegjFQ a2w7Z/F8R6EV/f6gpUT4jsLr87XnCf6al/umTxty/gXreuCWAusCzkDMdbUg63s3ms TAHejG+6Juv+BaDjLQKyNezZufrQuTWWJry+7s90= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Rafael Mendonca , Martin Krastev , Zack Rusin , Sasha Levin Subject: [PATCH 5.19 334/717] drm/vmwgfx: Fix memory leak in vmw_mksstat_add_ioctl() Date: Sat, 22 Oct 2022 09:23:33 +0200 Message-Id: <20221022072509.880642724@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747374247678803059?= X-GMAIL-MSGID: =?utf-8?q?1747374247678803059?= From: Rafael Mendonca [ Upstream commit a40c7f61d12fbd1e785e59140b9efd57127c0c33 ] If the copy of the description string from userspace fails, then the page for the instance descriptor doesn't get freed before returning -EFAULT, which leads to a memleak. Fixes: 7a7a933edd6c ("drm/vmwgfx: Introduce VMware mks-guest-stats") Signed-off-by: Rafael Mendonca Reviewed-by: Martin Krastev Signed-off-by: Zack Rusin Link: https://patchwork.freedesktop.org/patch/msgid/20220916204751.720716-1-rafaelmendsr@gmail.com Signed-off-by: Sasha Levin --- drivers/gpu/drm/vmwgfx/vmwgfx_msg.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_msg.c b/drivers/gpu/drm/vmwgfx/vmwgfx_msg.c index 2aceac7856e2..089046fa21be 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_msg.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_msg.c @@ -1076,6 +1076,7 @@ int vmw_mksstat_add_ioctl(struct drm_device *dev, void *data, if (desc_len < 0) { atomic_set(&dev_priv->mksstat_user_pids[slot], 0); + __free_page(page); return -EFAULT; } From patchwork Sat Oct 22 07:23: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: 7393 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1096986wrr; Sat, 22 Oct 2022 01:06:35 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7zUgThDbnQY+v00tGLXGF1a3XeedRIkQPFZBFIAVoeIP1z7P6eSmcY7BRrvWSyOCPumOTc X-Received: by 2002:a63:444f:0:b0:464:3985:3c92 with SMTP id t15-20020a63444f000000b0046439853c92mr19880166pgk.412.1666425994873; Sat, 22 Oct 2022 01:06:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666425994; cv=none; d=google.com; s=arc-20160816; b=q+1WHwnB3qzwhHTB3U2wQendMN249mQqTBYQMTIj3bRrY2ldXPAPHe6k2kpc11+iH3 V3rf8CwPzW2mVI2uT/QLwoYRmv0kXgEChm5XX9fSpKV7dBuaiDy4T/mZE92sLnDQ0/00 01vKAR3ptBONRILvqX4Pdj3U2vttOekeDmhGyE8IlBhcQVup2FOS2TyM2l8PGktNc+jM +FivY6y6zyZJxNrJN8s4k65rGDTU33jNiXHbJ9nqpfIH80Ee3drav7MbtSKvtRUpkVbL BCe5GatI9nRWLjApZZ1ceZlXhJzmyfmobkcA0DtiXaFQk4CGiTvOEiUzsRlYivrXaMto XVYA== 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=kKssT54iXdTw+sGEw/GYDLI/l88X8MfuNzcPo5RXrI4=; b=FdcxSatmRsAbbJd0zxbWNdZ3jAtsh9vbCqFl2m25twufeAu78+BOXGG0yw5TetraOJ ZCNmjZHEstL3UIEc5nTryhQVeKylmyipr864PU4TSIU2Tfeye7Jo/djmt8yNqYvIoY0f YzkM0SFjrFKxINBmRK9+3xBwOvckNMTzlEYHViSnR4k5tn6NIpTQWn3g8hAZvCdArW40 Ym5QyVMDyJS8vqpd0hFgMAtZcJ53cCqdLDjCL9SFxZ2ecreg0EzXrosUkzfAuS/1ikcm 87VlRkGn6bwp4rOQcN33H+gNKR7YJgjDyCnE2dA5ad0ijSVDh0Vm7DXE2jgGoZF6LGTa J9rw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="EMr/FNl+"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 h9-20020a63df49000000b0042b90c1d31dsi28005282pgj.829.2022.10.22.01.06.20; Sat, 22 Oct 2022 01:06: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="EMr/FNl+"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S232607AbiJVIFc (ORCPT + 99 others); Sat, 22 Oct 2022 04:05:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47924 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232447AbiJVH7A (ORCPT ); Sat, 22 Oct 2022 03:59:00 -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 AA52355AF; Sat, 22 Oct 2022 00:49: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 ams.source.kernel.org (Postfix) with ESMTPS id 87CB5B82DF6; Sat, 22 Oct 2022 07:49:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DA82CC433D7; Sat, 22 Oct 2022 07:49:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424944; bh=t9a02up3UmCRf+tLpcInPigc4BFh75HEwd8CGe1RyE4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EMr/FNl+tB74Vh21bXjSBPWVIUMaUxmO9/qjBq3Qr4Bp6+irnrRf7e7AY89Q25f17 BZQ9kCxBX2UAt40FOKs00J3RX6Wu5UzXsFoQIGf8NHSWbvoCSjjSSHg7RVX57qgR96 aloK2LaGJ2alRmF0D8/nl+oxvWpvGLImz4PiIbik= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dan Carpenter , Chia-I Wu , Gerd Hoffmann , Sasha Levin Subject: [PATCH 5.19 335/717] virtio-gpu: fix shift wrapping bug in virtio_gpu_fence_event_create() Date: Sat, 22 Oct 2022 09:23:34 +0200 Message-Id: <20221022072510.011098256@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747374303946615407?= X-GMAIL-MSGID: =?utf-8?q?1747374303946615407?= From: Dan Carpenter [ Upstream commit 37a78445763a5921bb54e9bad01937d0dfa521c1 ] The ->ring_idx_mask variable is a u64 so static checkers, Smatch in this case, complain if the BIT() is not also a u64. drivers/gpu/drm/virtio/virtgpu_ioctl.c:50 virtio_gpu_fence_event_create() warn: should '(1 << ring_idx)' be a 64 bit type? Fixes: cd7f5ca33585 ("drm/virtio: implement context init: add virtio_gpu_fence_event") Signed-off-by: Dan Carpenter Reviewed-by: Chia-I Wu Link: http://patchwork.freedesktop.org/patch/msgid/YygN7jY0GdUSQSy0@kili Signed-off-by: Gerd Hoffmann Signed-off-by: Sasha Levin --- drivers/gpu/drm/virtio/virtgpu_ioctl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/virtio/virtgpu_ioctl.c b/drivers/gpu/drm/virtio/virtgpu_ioctl.c index 3b1701607aae..5d05093014ac 100644 --- a/drivers/gpu/drm/virtio/virtgpu_ioctl.c +++ b/drivers/gpu/drm/virtio/virtgpu_ioctl.c @@ -47,7 +47,7 @@ static int virtio_gpu_fence_event_create(struct drm_device *dev, struct virtio_gpu_fence_event *e = NULL; int ret; - if (!(vfpriv->ring_idx_mask & (1 << ring_idx))) + if (!(vfpriv->ring_idx_mask & BIT_ULL(ring_idx))) return 0; e = kzalloc(sizeof(*e), GFP_KERNEL); From patchwork Sat Oct 22 07:23: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: 7417 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1097593wrr; Sat, 22 Oct 2022 01:08:11 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4psEB9aPxkedyKY8rSODycBfpWrCWAfA43eGATsDi4Ub+T0GRDDAiLFlDuXjCHORUNZhQr X-Received: by 2002:a05:6a00:1742:b0:565:c73a:90de with SMTP id j2-20020a056a00174200b00565c73a90demr23983525pfc.68.1666426090833; Sat, 22 Oct 2022 01:08:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666426090; cv=none; d=google.com; s=arc-20160816; b=CLGmLKyYvFcywsUCTJuLX1I9qenvyDYn6yRJq+wReRnJhTD3MaGrsRM05m5iILWd3j UWGtPMk2dkeo98RpycquYM/BnD6pPg1MvLvTjklhwYANJZb3uMxVi/ziaS6LBmytwNp9 MuPH2znW0dMKb7OmbZ3HJWpX6c/ktzL7zCPay+om8MrCNd00DjYLK6DrP9yScjl4ecj6 va7ZswYjvFFkF3uy0199/q8T9CxqIIkEsxq4XTtvxp0tnfD5HMegoUYr8LzkkdcESrYs +csHnFUmdZ8gAcpJJBchzGG8jiRCEgs/CCIld1/NqNVNHFmnJH7uY+vI3DcZKyTQTXMZ ZBdA== 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=ehuRqQuKzxhFY64W3JO9dYQ512+WDi9UkwTt2cPdiAo=; b=0RQjp7fQix61qq/sCuTqn3ZYcbI22tvDs8mUGybsJyotA8+8sWOCgVg8mdebVNipBJ zkxfjsA3HuM7CbhrAM1/DA0MUNS5l1nCz5iCbtDbb3J5UqxvWmuTSxWoYkbyWZzzkYxf 8oJ8Tx+wpOOqLC8erxB3nztpnw4q0WV95oQxCXZJ30hSO3Q99W/SW+aqmQMYpbn9qfDk It6KMXMtp+0/hSxZhhut/nwq+vTyFhojiGtIPZUTzm0qIRMSrFPEs6lrlaeZkZWfCcpt 7QOd5Yo9zaXdSoC5YOOu5dBJOsSd+wa2q4z38wyYlcC9dRjVnpgFtBbHzELa2Wby62lE Q+kA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="IBK6/10b"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 u185-20020a6385c2000000b00463dede6203si1852775pgd.699.2022.10.22.01.07.57; Sat, 22 Oct 2022 01:08: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="IBK6/10b"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S232723AbiJVIHo (ORCPT + 99 others); Sat, 22 Oct 2022 04:07:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42504 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232733AbiJVIEF (ORCPT ); Sat, 22 Oct 2022 04:04: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 EC74C2D20DD; Sat, 22 Oct 2022 00:51: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 36B03B82DF0; Sat, 22 Oct 2022 07:49:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9EBCBC433C1; Sat, 22 Oct 2022 07:49:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424947; bh=/KXZ6TtpDb4MRpdGoI3eHmCgdlt22zSQ2OvKcABdU/c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IBK6/10b16xb76icKQyFOXy/Sp0hQ++I5NdtB3d/TybsHysSyGBGEI/Ae5i4F+JbE mV8VFpF1kc9hEBZ09DovH8zdaeOe/Ds9bAouZ3zIixL6hqzsCNzRkh8WC+xYsP77Fk c0gKYqJn8PbrhAD6HL/XKG4SrHVWELJFC9v3hyKA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Srinivas Kandagatla , Mark Brown , Sasha Levin Subject: [PATCH 5.19 336/717] ASoC: codecs: tx-macro: fix kcontrol put Date: Sat, 22 Oct 2022 09:23:35 +0200 Message-Id: <20221022072510.096164409@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747374404521507345?= X-GMAIL-MSGID: =?utf-8?q?1747374404521507345?= From: Srinivas Kandagatla [ Upstream commit c1057a08af438e0cf5450c1d977a3011198ed2f8 ] tx_macro_tx_mixer_put() and tx_macro_dec_mode_put() currently returns zero eventhough it changes the value. Fix this, so that change notifications are sent correctly. Fixes: d207bdea0ca9 ("ASoC: codecs: lpass-tx-macro: add dapm widgets and route") Signed-off-by: Srinivas Kandagatla Link: https://lore.kernel.org/r/20220906170112.1984-6-srinivas.kandagatla@linaro.org Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- sound/soc/codecs/lpass-tx-macro.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/sound/soc/codecs/lpass-tx-macro.c b/sound/soc/codecs/lpass-tx-macro.c index 55503ba480bb..e162a08d9945 100644 --- a/sound/soc/codecs/lpass-tx-macro.c +++ b/sound/soc/codecs/lpass-tx-macro.c @@ -823,17 +823,23 @@ static int tx_macro_tx_mixer_put(struct snd_kcontrol *kcontrol, struct tx_macro *tx = snd_soc_component_get_drvdata(component); if (enable) { + if (tx->active_decimator[dai_id] == dec_id) + return 0; + set_bit(dec_id, &tx->active_ch_mask[dai_id]); tx->active_ch_cnt[dai_id]++; tx->active_decimator[dai_id] = dec_id; } else { + if (tx->active_decimator[dai_id] == -1) + return 0; + tx->active_ch_cnt[dai_id]--; clear_bit(dec_id, &tx->active_ch_mask[dai_id]); tx->active_decimator[dai_id] = -1; } snd_soc_dapm_mixer_update_power(widget->dapm, kcontrol, enable, update); - return 0; + return 1; } static int tx_macro_enable_dec(struct snd_soc_dapm_widget *w, @@ -1019,9 +1025,12 @@ static int tx_macro_dec_mode_put(struct snd_kcontrol *kcontrol, int path = e->shift_l; struct tx_macro *tx = snd_soc_component_get_drvdata(component); + if (tx->dec_mode[path] == value) + return 0; + tx->dec_mode[path] = value; - return 0; + return 1; } static int tx_macro_get_bcs(struct snd_kcontrol *kcontrol, From patchwork Sat Oct 22 07:23: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: 7415 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1097546wrr; Sat, 22 Oct 2022 01:08:03 -0700 (PDT) X-Google-Smtp-Source: AMsMyM50Tg7OFb+d/I++tRlC9Ek7ed+/Sc1vBJbxXh6SPiQ7/Zdi/WkzXQKSnlfxl8qLCs8RdipQ X-Received: by 2002:a17:90b:38c3:b0:20d:406e:26d9 with SMTP id nn3-20020a17090b38c300b0020d406e26d9mr27120377pjb.121.1666426083521; Sat, 22 Oct 2022 01:08:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666426083; cv=none; d=google.com; s=arc-20160816; b=q5XARww2b5sHCauDaxHLzEh9zGKEd7T+MkVMpyPwSfbdorGABZPS6dzUcIrAIE6115 h6YqchBWr2VLLs7N5TckTQASAGozy3YnXYa2NwnhW0gHQJaEBhc3Yzb1Y6bpP8q9VS06 FqbJp13P6CI0kgQMeDU2FMf+qHmVGxjPBy6wvIXS8hUdnQYuk2z+c5WiCBtaDDSoHmMk BY9CSLMzYSXo8v7hEkEiJEPMBX34ZVyWZZNvSgesk1xUpLgiwxgKRxk+YHd+EgOM5mhY S+fiSEBdjHviHpCUJLmjYlppZEGGbLF1skyJb7QntXIBgUgugZhzmFrK9lDHlN0skBLK ox6w== 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=9Ycj3RlJkZhC+LSxdpGzHKVaEHC2EedUHyf2k1jHE6I=; b=sGDDzn+uqgb4NRY53LOK5qXshLX4sf03b8ift9ozvZ5K51UTRzE2IlruhhOlC6ex0u VGR7JuDD4ejCoJAMHTTZObj/E4KHGSTQxk9FDrQXskL3JS2DxTp/4091OajsMwBZMgSQ ZAmFqVm8o+TZw2VzICqQuCHU1IbbtBiR3VNrh9DP3phDAJMDAzG3LgVSKFbFTkivZixt CxNDkoiL+nbfP8cMbbv70/YFwiNhRaihWpYDoPeQB827ADp33BRmLtJXJ2SXu+Fniy8w Dy0LGZdPr0Q+2dSCXZuGN1YUCfJ2A3zlK4uc1Mx8p8ZG65/RgE52ZJM5wwzosC/7M75S tkPw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=iptKyllN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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-20020a170902bb8600b00176b8830921si23384784pls.294.2022.10.22.01.07.51; Sat, 22 Oct 2022 01:08: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=iptKyllN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S232950AbiJVIHg (ORCPT + 99 others); Sat, 22 Oct 2022 04:07:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42346 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232559AbiJVIC0 (ORCPT ); Sat, 22 Oct 2022 04:02:26 -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 594F82A5202; Sat, 22 Oct 2022 00:51: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 7ECC860B0A; Sat, 22 Oct 2022 07:49:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8F693C433D6; Sat, 22 Oct 2022 07:49:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424949; bh=tFoKgWJaqjUw4lxxvnzsr2/zSpgY2MqNnWOONxKS3dU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iptKyllNOLL7glTLX0lYUaqZc79GgiKuJGxzT4Fa/pAU3plkCOauHscIi3rru4U6D ZPQ8jChzYLWWTHQkE0JKM51t4mZ2HjH/g0V7EgfFyZjndHdXSNd+zKGxEybMKPcSBm X0hkvv2cpg0FZ720qRLRcnjwIb99jcb601TBHHpo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dan Carpenter , Christophe JAILLET , Mark Brown , Sasha Levin Subject: [PATCH 5.19 337/717] ASoC: da7219: Fix an error handling path in da7219_register_dai_clks() Date: Sat, 22 Oct 2022 09:23:36 +0200 Message-Id: <20221022072510.214461373@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747374396947224014?= X-GMAIL-MSGID: =?utf-8?q?1747374396947224014?= From: Christophe JAILLET [ Upstream commit abb4e4349afe7eecdb0499582f1c777031e3a7c8 ] If clk_hw_register() fails, the corresponding clk should not be unregistered. To handle errors from loops, clean up partial iterations before doing the goto. So add a clk_hw_unregister(). Then use a while (--i >= 0) loop in the unwind section. Fixes: 78013a1cf297 ("ASoC: da7219: Fix clock handling around codec level probe") Reported-by: Dan Carpenter Signed-off-by: Christophe JAILLET Reviewed-by: Dan Carpenter Link: https://lore.kernel.org/r/e4acceab57a0d9e477a8d5890a45c5309e553e7c.1663875789.git.christophe.jaillet@wanadoo.fr Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- sound/soc/codecs/da7219.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sound/soc/codecs/da7219.c b/sound/soc/codecs/da7219.c index 7fdef38ed8cd..1bfba7ef51ce 100644 --- a/sound/soc/codecs/da7219.c +++ b/sound/soc/codecs/da7219.c @@ -2196,6 +2196,7 @@ static int da7219_register_dai_clks(struct snd_soc_component *component) dai_clk_lookup = clkdev_hw_create(dai_clk_hw, init.name, "%s", dev_name(dev)); if (!dai_clk_lookup) { + clk_hw_unregister(dai_clk_hw); ret = -ENOMEM; goto err; } else { @@ -2217,12 +2218,12 @@ static int da7219_register_dai_clks(struct snd_soc_component *component) return 0; err: - do { + while (--i >= 0) { if (da7219->dai_clks_lookup[i]) clkdev_drop(da7219->dai_clks_lookup[i]); clk_hw_unregister(&da7219->dai_clks_hw[i]); - } while (i-- > 0); + } if (np) kfree(da7219->clk_hw_data); From patchwork Sat Oct 22 07:23: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: 7385 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1096730wrr; Sat, 22 Oct 2022 01:05:49 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6beMk22tpbbxizbRdqKFZwqAiUxh9xX9dOa/pnVNKU15xr4dKaZYrMQ0TrCGLmIIr4Yk7b X-Received: by 2002:a63:e755:0:b0:46e:c2ac:5fd1 with SMTP id j21-20020a63e755000000b0046ec2ac5fd1mr4836920pgk.184.1666425949554; Sat, 22 Oct 2022 01:05:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666425949; cv=none; d=google.com; s=arc-20160816; b=Gubmpp8EXP0JP9JcHtpR8Fw+wCq6UD25dXLYdiwHhe7UYx6Dbw7PBhaDxszNMyPU1f MqoHHrf3ms93W2N69imjCMFVjouiigcRxS9PCsIzSX5UbfKqbaLhoxHHwzaaIZD3XVtc TSgsyjQOQNkTF7709oiCzTYnVmKQrZIqxGupxVGLtkbz9BozY0xVad8vE0XceTY+N1WB ysMaB1e1xpXb2BP1PFM07NYY+U+iQkxWVQr3P0yOCNV1XKNGFl2DFb34kMey/xRJKCHX x6pNBMn+MR1UZTTTI3zMs9X90R7RDZFtHsyv+p+hviC+xgLwsD4/RbZjnREfzIo70/WD ffoA== 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=s4aS4XaRu1bhUNVY0OLHl+T+zWzBYN5ZpMtqv8Lm1sM=; b=m0jVI9u9pY+yXNTkM3aBygflPYOdgX6dFAvBVzwXgjaKm7L8CILO/zzPKsHIONy1iv LT13pi/vrHdt2HZALU2e26oDfOsLyAUA10xrYgye4RSZFPKvV0X3AFjhmf+DwwHLNNzE fsBAgRjWiCc43GBqMFeAzb8IzLjWTZfp+u3QAprYpA7W8z9QreU4rdOTlvn+TWln4MVq mj2DN7hxQy/xSdE/c2TIR0biVMCFy0tJgOxjIGwpNDi968r0I65ChCIjzV1Ir0W1YzXf 6Frixtns7ntj8rmt601odgniyqD6MuupA2LEDlrjVcw927+DW250bXhYPj+4JPc1HHgK BXNg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=14OMXf4U; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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-20020a632043000000b00438894246e8si27225392pgm.169.2022.10.22.01.05.33; Sat, 22 Oct 2022 01:05: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=14OMXf4U; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S232993AbiJVIEf (ORCPT + 99 others); Sat, 22 Oct 2022 04:04:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47420 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232475AbiJVH7D (ORCPT ); Sat, 22 Oct 2022 03:59: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 F1540B71; Sat, 22 Oct 2022 00:49: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 ams.source.kernel.org (Postfix) with ESMTPS id EEF7CB82E0C; Sat, 22 Oct 2022 07:49:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2D172C433D6; Sat, 22 Oct 2022 07:49:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424952; bh=D3pgGgzO7UPi97hX7mChXw0CmsUbUFVWqqVAoDheCr8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=14OMXf4UGaoWZeWCMxtf+5GCLD8X2djExB5J8PR7c2b8b2VHS8pipgJAOthlSqqnY //E8MGnqt1QPTqJOA7S0XyJNWJkAk5cZ5pSL0bCjaSAVfUofRUmhXOfpwhnpYRHVvi /qdVN7pGZejBN0SD20uIu99a2QInxZEbVKQPGfMA= 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 5.19 338/717] ALSA: dmaengine: increment buffer pointer atomically Date: Sat, 22 Oct 2022 09:23:37 +0200 Message-Id: <20221022072510.288484702@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747374256453425255?= X-GMAIL-MSGID: =?utf-8?q?1747374256453425255?= 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 af6f717e1e7e..c6ccb75036ae 100644 --- a/sound/core/pcm_dmaengine.c +++ b/sound/core/pcm_dmaengine.c @@ -131,12 +131,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 Sat Oct 22 07:23: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: 7388 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1096783wrr; Sat, 22 Oct 2022 01:05:58 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6GsGxkqro5g9LO+KSgrv1zi6iUlR/ucurgrpL7uGdXjgYEjA4gkK9cPiLzKLjlNADjKXko X-Received: by 2002:a17:90b:1644:b0:20d:459b:9d81 with SMTP id il4-20020a17090b164400b0020d459b9d81mr26480667pjb.196.1666425958534; Sat, 22 Oct 2022 01:05:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666425958; cv=none; d=google.com; s=arc-20160816; b=ysK2RilPlFS1+h54rBGuONv4x89G2iI9qCKoSyD+9lgyo4vpga/muQgcz5b+b5ZKLu XDyd5/FcPOz73AjfUu1pilJ4aI5nyruN8V8Cn8TtC3nbQ4zBAO8PlY3cqrAJ/3fwq4hV itBGm+uCXrGheRRZ6ecD95UGq4FTJIPVsaldP4EWseXkCJJ7fxnxdLS8AA4Xb6yZ/oJX FsMPLFWsPr9vvIy9ErrK5mlW7Rd4iAQSn6QUJaaHB4wZyu4PkMcXHI8t0+WtO5jlEogI O6PmHspPhZDtG26S7fg09UcczVRI6MQux7GH+FvJYRNQ23LmglQIDDmtd1+l/fOExkS2 2t6Q== 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=QJQp++MzUms/1JVp2+81Qm4114iR+ppLOFcZgdXVtis=; b=D2y2NLRqZw7SLPfJPDmaThIPnw8P098uookBdChEoAYdPCxomGdf3oETpLj1ZnI2vW T9NnMxzRxzc9hJcSvu0WnDzcOCvri7rMXxWdWK1cuBElxKEPWtzNTihaHjidhW71xer6 K7SkTadMPrz+/ZAGYTXsf78os+pjGMS5d5TVx6ziU8y82FxtJpB5OOvRKMiY1NgqE02W DZhwtz76A0ztlFKaukzIk8UBlnpuMtHO84iBPDNrx2tjrvwcnXaw9XyWtFCimKyIpMLF b+blSLykNF+VnvSyRti4YzKR6Xdf8QI1wWQNXHZzTb03tjhTHf8JBDLu3v/Yx1Mss+VM HWTA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=CDenJxzs; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 66-20020a630245000000b0046ea4ef43d2si7413840pgc.378.2022.10.22.01.05.42; Sat, 22 Oct 2022 01:05: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=CDenJxzs; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S230416AbiJVIFO (ORCPT + 99 others); Sat, 22 Oct 2022 04:05:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35426 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232500AbiJVH7F (ORCPT ); Sat, 22 Oct 2022 03:59: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 AE158260A; Sat, 22 Oct 2022 00:49: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 dfw.source.kernel.org (Postfix) with ESMTPS id 010E160B28; Sat, 22 Oct 2022 07:49:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0E9F9C433C1; Sat, 22 Oct 2022 07:49:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424955; bh=HHebO/JQrjiVOVr4n+bmDjcuNofUzDO5209bu/y3qb8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CDenJxzs3wkxg5hgxfvcgrn3jO3EYQ/ngGuhvNazWBgVjyHeGNjUKGNK11mi+bcZ4 DsRNinCjIifJaW4qKic9o1KhhEEM3r1SIOsuL1lUyMLgF3FDF5MX81litgNlxAIzft /Hs7MNU8x+rsHnscof4vXQzl37gl0VWwVjnA0Hkg= 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 5.19 339/717] mmc: wmt-sdmmc: Fix an error handling path in wmt_mci_probe() Date: Sat, 22 Oct 2022 09:23:38 +0200 Message-Id: <20221022072510.368646260@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747374265936025741?= X-GMAIL-MSGID: =?utf-8?q?1747374265936025741?= 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 163ac9df8cca..9b5c503e3a3f 100644 --- a/drivers/mmc/host/wmt-sdmmc.c +++ b/drivers/mmc/host/wmt-sdmmc.c @@ -846,7 +846,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); @@ -863,6 +863,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 Sat Oct 22 07:23: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: 7390 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1096895wrr; Sat, 22 Oct 2022 01:06:19 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6eeNGBfqryTiYhGOCv09CPLtBz/9qfd1khc20mSGbsbcnVifjtWJah0Z65DsKA/k+Iy4zw X-Received: by 2002:a63:1609:0:b0:45c:7c1c:4e7d with SMTP id w9-20020a631609000000b0045c7c1c4e7dmr19355672pgl.265.1666425978834; Sat, 22 Oct 2022 01:06:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666425978; cv=none; d=google.com; s=arc-20160816; b=PhTssdy9BYJSkoGW9KbBQxhxT7Ef777ASdyE4jU9HbLRmKwtG3nmYieP/emDa9eC2H 5l6Iq3MEeGdmtZ62lgOj21abYxTxqOFXqESvnx0zLgLEK8ZBWnSb+SGTay0k78WbwY+P K+tpMMqDXp4gYK2zM7xnBDPAdXJGT/ba0TF+3MDEWbVeCSPqnYbbaFjSjqafrlbRRnvh MhpKK8FzfRE4Em2J11r4ab+MsKHINSpvdp1achIikLEEFKLG5ZntgWYDbMAfjHKILMnm K/lwFRff/iNib9zouyb6dNmCKA7hsh6iI8vzKEKIKDmOnRc0M6wR5JdlG/RSZkgGl044 fTew== 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=htVDlM9O0/rYPgH0zrwyW6+et2JLuQSMWamPnGXEtpA=; b=w5Eu31Z4swH90mtYoB35Rhmq4EtIuzoLXVhiI0h9V7Hu1tyef7u2MO7zgOcMlBRTb4 0rXh8N+gz77lrZy3UOzRGzMIcaijKO2OY8B1kojMXQIoYMhERcqYY3kkv1thrMP1laDY JYMDINBqtH7U3LuK2lY0Ngn1pu+Ms5ig8aQYMhTMqXMMIYh64i7qk8grWPHM75j3RnWf fYQtaGjIObGwZbSkHXFU7oavtohItGbQuVcxG2Cl0+DH2aV3EmhlZsvCjhAdP2izowny 2FHq/7QEq3g0B7Sc9qguQ+f9NFfgl0v4MLy2bOK3nt3v4zn5iSMzkdaRCSFzARq3bPmO eWAA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=V17xEvmm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 g5-20020a056a0023c500b00537fe344fa8si30450409pfc.34.2022.10.22.01.06.05; Sat, 22 Oct 2022 01:06: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=V17xEvmm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S232649AbiJVIFh (ORCPT + 99 others); Sat, 22 Oct 2022 04:05:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52012 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232602AbiJVH7P (ORCPT ); Sat, 22 Oct 2022 03:59: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 2365733865; Sat, 22 Oct 2022 00:49: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 BFE4C60B39; Sat, 22 Oct 2022 07:49:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BEBF7C433C1; Sat, 22 Oct 2022 07:49:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424958; bh=ZFXv7aOzeRfU+Zq9neF3kSmBsWRostughYrYNDVdW2A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=V17xEvmmxkE/ZHgfr9/zFkGZgXM6hIG6npl65fOkqOKxHvhhq9irdUfyzXu24VgaU o1jrC2PXk6FpVeAAdW4BpKbiYtCaqZ8EeNGhEYeMYylMJFim2pvOANrmbwag1y+4Lb c+6EjxgauuLsGRw/Par/+94gBLCs545dFyD6cHUE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zhang Qilong , Olivier Moysan , Mark Brown , Sasha Levin Subject: [PATCH 5.19 340/717] ASoC: stm32: dfsdm: Fix PM disable depth imbalance in stm32_adfsdm_probe Date: Sat, 22 Oct 2022 09:23:39 +0200 Message-Id: <20221022072510.464360383@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747374287186867785?= X-GMAIL-MSGID: =?utf-8?q?1747374287186867785?= From: Zhang Qilong [ Upstream commit b9a0da5b2edcae2a901b85c8cc42efc5bec4bd7b ] 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 stm32_adfsdm_probe. Fixes:98e500a12f934 ("ASoC: stm32: dfsdm: add pm_runtime support for audio") Signed-off-by: Zhang Qilong Reviewed-by: Olivier Moysan Link: https://lore.kernel.org/r/20220927142601.64266-2-zhangqilong3@huawei.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- sound/soc/stm/stm32_adfsdm.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/sound/soc/stm/stm32_adfsdm.c b/sound/soc/stm/stm32_adfsdm.c index 6ee714542b84..c0f964891b58 100644 --- a/sound/soc/stm/stm32_adfsdm.c +++ b/sound/soc/stm/stm32_adfsdm.c @@ -334,8 +334,6 @@ static int stm32_adfsdm_probe(struct platform_device *pdev) dev_set_drvdata(&pdev->dev, priv); - pm_runtime_enable(&pdev->dev); - ret = devm_snd_soc_register_component(&pdev->dev, &stm32_adfsdm_dai_component, &priv->dai_drv, 1); @@ -365,9 +363,13 @@ static int stm32_adfsdm_probe(struct platform_device *pdev) #endif ret = snd_soc_add_component(component, NULL, 0); - if (ret < 0) + if (ret < 0) { dev_err(&pdev->dev, "%s: Failed to register PCM platform\n", __func__); + return ret; + } + + pm_runtime_enable(&pdev->dev); return ret; } From patchwork Sat Oct 22 07:23: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: 7749 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1113262wrr; Sat, 22 Oct 2022 02:03:02 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7WN/KXFakbnhdkfKyblv7GHbXGsKilQwjK1x/tiN7O5qfBLCII7VE8m50muYjavwYApmJ+ X-Received: by 2002:a17:90b:1d8c:b0:212:e08d:7390 with SMTP id pf12-20020a17090b1d8c00b00212e08d7390mr2960510pjb.168.1666429362400; Sat, 22 Oct 2022 02:02:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666429362; cv=none; d=google.com; s=arc-20160816; b=e1XKNwMApY2sRSRadQJgnTC9aMW68TfpJHkz3ZgGRfT1XaVIISbJVIVPb0zq+HusF9 M0qRqUGsreRxyfmc+mkVxc1f3Au19EdEZdGRm9vw5SCKuqCpHYzAmxbzu435e2ZEBDhg zqX5wrfEDdBbtaM8Ehd2ni1giplW8Bj/1U8fshk0KYIW1+odVrgDxV5g8sH+UwEJ10sI MGx8/YBUU+vrZObCeCGnO5koANhTAUjpJktNtsp+nybc8GpXXK3cnV6fjQJ9Eq7szp7A 8YVeiziaetxGr4nRCUatUr+oR5o1iWFJg4iI3zpqqUqKwS3gCkQQCnQUP48VEfqknoQQ Od7w== 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=vuo8cZ4WRnrb+Ri91yCQesl98W1XkSSqVtbSDNebb4E=; b=DgCawBdsrZ5OyuRQ0lSuY3zAPcmwmVTXuWmnKkD+zHHD1lmqcHQZgU2ZOfOXbaAzUi QX1HubR/21imb4WqZ13AHLhfn+csRCH/9ktgB4mSOwBZNpXE23tn62MCa2OZ22xWf8G2 ijqwSWOtRywEoiTzmPVksfnHkulU8dIh+wDPh3pDgSGpfn819Tg2gfAVn7hN0WFa4G+o pXbgQ28CgeAW+bZPrJTR9jKHK6FKmqhtx3ZUtAVG1CswTXucrD+auOwsm5amRkBeOBqt ZxZX7uPljLwr5DgrDtcehrDMJxWhBtv9XfbtNDZ90+1bETrinLL/JJV9CxTLret2ZWu+ ax/g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=LqeTczgi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 q13-20020a63cc4d000000b0043895127033si28089079pgi.335.2022.10.22.02.02.26; Sat, 22 Oct 2022 02:02: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=LqeTczgi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S235038AbiJVI6e (ORCPT + 99 others); Sat, 22 Oct 2022 04:58:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50586 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231749AbiJVI5r (ORCPT ); Sat, 22 Oct 2022 04:57:47 -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 E8C6CF53FB; Sat, 22 Oct 2022 01:15: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 7DC7E60AC7; Sat, 22 Oct 2022 07:49:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6AD89C433C1; Sat, 22 Oct 2022 07:49:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424960; bh=gvy+AFjkeW4zfEWxGpVygqiYoy0/OwkUtGWZjzI5AQU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LqeTczgi13ZoZqZhR3tURjRbFkw7KittIIlTGBMDl0MRDoBIgqXfWSQ8oi5axfrOr /2kogDZXI7y7pkFbasMEQjLGAe34pAK8ABaf0rzZyKuk4jRiOxGmCxW7zMuJ3weOZX +n8rDsGTGyjvrsQh4DnNj6nyWikV5IrqG6BL6JQU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zhang Qilong , Olivier Moysan , Mark Brown , Sasha Levin Subject: [PATCH 5.19 341/717] ASoC: stm32: spdifrx: Fix PM disable depth imbalance in stm32_spdifrx_probe Date: Sat, 22 Oct 2022 09:23:40 +0200 Message-Id: <20221022072510.568088669@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747377835178524461?= X-GMAIL-MSGID: =?utf-8?q?1747377835178524461?= From: Zhang Qilong [ Upstream commit 0325cc0ac7980e1c7b744aab8df59afab6daeb43 ] 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 stm32_spdifrx_probe. Fixes:ac5e3efd55868 ("ASoC: stm32: spdifrx: add pm_runtime support") Signed-off-by: Zhang Qilong Reviewed-by: Olivier Moysan Link: https://lore.kernel.org/r/20220927142601.64266-3-zhangqilong3@huawei.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- sound/soc/stm/stm32_spdifrx.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sound/soc/stm/stm32_spdifrx.c b/sound/soc/stm/stm32_spdifrx.c index 6f7882c4fe6a..60be4894e5fd 100644 --- a/sound/soc/stm/stm32_spdifrx.c +++ b/sound/soc/stm/stm32_spdifrx.c @@ -1001,8 +1001,6 @@ static int stm32_spdifrx_probe(struct platform_device *pdev) udelay(2); reset_control_deassert(rst); - pm_runtime_enable(&pdev->dev); - pcm_config = &stm32_spdifrx_pcm_config; ret = snd_dmaengine_pcm_register(&pdev->dev, pcm_config, 0); if (ret) @@ -1035,6 +1033,8 @@ static int stm32_spdifrx_probe(struct platform_device *pdev) FIELD_GET(SPDIFRX_VERR_MIN_MASK, ver)); } + pm_runtime_enable(&pdev->dev); + return ret; error: From patchwork Sat Oct 22 07:23: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: 7496 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1104884wrr; Sat, 22 Oct 2022 01:33:37 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6DTF5rtCaJmNi1GO5omwEH6sn+NCPTpr0t9h8iCm+jyOLC3oVn2i3FBa11FkGVeNkSZmnw X-Received: by 2002:a17:903:2c2:b0:182:df88:e6d3 with SMTP id s2-20020a17090302c200b00182df88e6d3mr23257093plk.81.1666427617152; Sat, 22 Oct 2022 01:33:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666427617; cv=none; d=google.com; s=arc-20160816; b=lCBiDSPga6x78JhGlQe+kay96tkGVU4UwyH0ebhEW4aH4t28pxL0oLYZbeoZFcbN9r l5WBRnx6bS+JGq3jDMyxyS9EoSpkNY144eEXjTF4Nzbf40e5hYEXjoDxJdebOhfmn1cq Q4vmlFyKcCaAeYx5kPTypgxNzF8vd12OKo/FCjcgPB/HWpd2G7EGIWqA4jv+w5TCGo1E POWVz2+skGoeNxu4wmx3gnY3Gs+2w4fV2HK5IyOLNP+u90Lx59wDA+adBnWrJt4dhjhl Li27WasYY4/mKVCfGpKxhQ0Zj+5sSyOSFBEr/y4JaoNA5wKHurBLhVmKwwKUczxuVLWs 6OZQ== 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=vondqIHf/2k2dUxnFsHbwwbGYnqqgMuEvoeIbS9HJCo=; b=v2hGsd1IFhBwDxB6HTYzL3KhaqDn0bEoBy+YcqnmRmsa1J/7SrlRbGk2RoxeYgZrOy BclTl+HoIgT6uTPq8P2oDnGlkMbkikhrBqE4nulD1uhIUlvtdYTOTsU6uV3RAQYbGV03 1yJ70AD5uuhddDN5eipDcFfKZtVt6Rjfmo+b68/DYbimacXn5QUHjG8BSjzB47m8vMQs SNkqA2+3GvlZ+8zwYpkxyV5RH1h6ragiTht8IOnHhmwt57JLR1e2C06PP9AC7dXz/WhG n0OgCUc9QxyU8Gb23oNCD3lKr4UIjmHRU3I1A4o3TERV/Vlww/NNfrmaJnep3LHxefb0 Be6w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Bw1gEx4A; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 w12-20020a637b0c000000b00451f4443fbbsi28771824pgc.315.2022.10.22.01.33.23; Sat, 22 Oct 2022 01:33: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=Bw1gEx4A; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S233601AbiJVISu (ORCPT + 99 others); Sat, 22 Oct 2022 04:18:50 -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 S234104AbiJVIQO (ORCPT ); Sat, 22 Oct 2022 04:16:14 -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 D21A32CCA2F; Sat, 22 Oct 2022 00:57: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 12DBFB82DF3; Sat, 22 Oct 2022 07:49:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 60C0AC433C1; Sat, 22 Oct 2022 07:49:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424963; bh=79Re3s7HyL5x8jX9VgKMr7GKBE2eiA+WCJ2eP4LQ32k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Bw1gEx4AI9fqWfaGQDuMbJ4msiwhQBbAVXAxr5PcaAt7yXCB/yWi2K1XpVczHzhU2 EPut0HESDwH6bWfTbfvxlVSWuoCyXgJiW1oLkEzcpmI9h8QDvphJOfs1leicUSD2nu fTj/tuWNaDPvB6QDJ4t+av0THrQ1BfyB5Qd+QQqM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zhang Qilong , Olivier Moysan , Mark Brown , Sasha Levin Subject: [PATCH 5.19 342/717] ASoC: stm: Fix PM disable depth imbalance in stm32_i2s_probe Date: Sat, 22 Oct 2022 09:23:41 +0200 Message-Id: <20221022072510.648177769@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376005154554838?= X-GMAIL-MSGID: =?utf-8?q?1747376005154554838?= From: Zhang Qilong [ Upstream commit 93618e5e05a3ce4aa6750268c5025bdb4cb7dc6e ] 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 stm32_i2s_probe. Fixes:32a956a1fadf ("ASoC: stm32: i2s: add pm_runtime support") Signed-off-by: Zhang Qilong Reviewed-by: Olivier Moysan Link: https://lore.kernel.org/r/20220927142640.64647-1-zhangqilong3@huawei.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- sound/soc/stm/stm32_i2s.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sound/soc/stm/stm32_i2s.c b/sound/soc/stm/stm32_i2s.c index ac5dff4d1677..d9e622f4c422 100644 --- a/sound/soc/stm/stm32_i2s.c +++ b/sound/soc/stm/stm32_i2s.c @@ -1135,8 +1135,6 @@ static int stm32_i2s_probe(struct platform_device *pdev) return dev_err_probe(&pdev->dev, PTR_ERR(i2s->regmap), "Regmap init error\n"); - pm_runtime_enable(&pdev->dev); - ret = snd_dmaengine_pcm_register(&pdev->dev, &stm32_i2s_pcm_config, 0); if (ret) return dev_err_probe(&pdev->dev, ret, "PCM DMA register error\n"); @@ -1179,6 +1177,8 @@ static int stm32_i2s_probe(struct platform_device *pdev) FIELD_GET(I2S_VERR_MIN_MASK, val)); } + pm_runtime_enable(&pdev->dev); + return ret; error: From patchwork Sat Oct 22 07:23: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: 7397 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1097090wrr; Sat, 22 Oct 2022 01:06:46 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6THjB77HLjs08Z1fI/+fCID69TAjMBPApmLzQuGSTD0reWL6wgGCSuLFXefRAPJlCuXK1+ X-Received: by 2002:a63:6c01:0:b0:429:ea6e:486d with SMTP id h1-20020a636c01000000b00429ea6e486dmr19103478pgc.247.1666426006071; Sat, 22 Oct 2022 01:06:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666426006; cv=none; d=google.com; s=arc-20160816; b=fVVW4+6IfjusE1TCTwJ1pGiYn65EK7G5kck3PWVvgU171Kw8y4qntI1z7mJ5aXIiKg aTnXiZohpCMumxoRZBOyOZ2FalwGekSbzMXrcsKP9V+RHDmcU3TAGg/70Xv/0v5oCVcJ mDV1eZnUXw/sEOhclJjQ17Bk3Xg3Q+jmEfRpDy/jsjGtNp/sHP2jj1x/SaiXroU7rJuw qqQvJxasE2VriPmh8myzDWpgkKuoTzXRQKObZO22u1S+XKf2zs/Uq+ARAmsDPc186t/6 U/hSocQm4KaSwrfSEBsdgQ+VOT77qagctW8SEkUvr9Creu/Juh21GRG7cEB6/YXV+T+c fIMw== 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=eJ1xBfSDiLxLA79EM2qP/YWCwwrrhzC/RUlyHFhO/vI=; b=LvENbc85DeseHRlg8WBilW6vl3ODRIqE2E2xpgabltQl57qQ1qcIS+TDxhlBnxknlN EX7TL3fQcEOx+zHuDm2zMEYkuzBAZuFE3pSD61/wxd5JqFjVci/qf71kKW1p6bllDtMG T1AzNfQkX31E5ExDovklWcXQ+ndUWVR1r+azg95LRnnXV2iNacC5ZTVObk4/MPu16Brj aE5UF0k22ACRKuWNPBaX7tfbBoEW5aQ3bXnvILYngpudy3Jr7Pk5xZpg/tijSQnF/O08 ldi0DJ0YhqsIFrNQRmI3D+mI15VW9YktMIk53gtSncLCBKRsfkjLQAhu1a4iCVuhfzq7 hCiw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=uDlCMbge; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 19-20020a630413000000b00439d071c11fsi26441505pge.118.2022.10.22.01.06.31; Sat, 22 Oct 2022 01:06: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=uDlCMbge; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S232762AbiJVIF4 (ORCPT + 99 others); Sat, 22 Oct 2022 04:05:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49754 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232665AbiJVH73 (ORCPT ); Sat, 22 Oct 2022 03:59: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 716D255C4B; Sat, 22 Oct 2022 00:49: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 0F30260B09; Sat, 22 Oct 2022 07:49:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 111F3C433D6; Sat, 22 Oct 2022 07:49:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424966; bh=WUE8FJWJv8eYvKiyEOnorlpexel6MZMk7An450XUA2s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uDlCMbge/2EcMOKu1PYFX1ifvMDDL7wKBJZdjz7pUrWU+kuUeCcRBp8nZOaiwZfCS iG6tP0/uofGmxBq4WbYeTcb8b8nVlmSkzUleB04SKxeumHjq5NOS3qe+q/zu6bN+VJ HYo9pODsguY1va95e8smvvhQfBkblO9/8XTCUnaY= 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 5.19 343/717] ASoC: wm8997: Fix PM disable depth imbalance in wm8997_probe Date: Sat, 22 Oct 2022 09:23:42 +0200 Message-Id: <20221022072510.723567530@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747374316038901925?= X-GMAIL-MSGID: =?utf-8?q?1747374316038901925?= 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 38ef631d1a1f..c8c711e555c0 100644 --- a/sound/soc/codecs/wm8997.c +++ b/sound/soc/codecs/wm8997.c @@ -1162,9 +1162,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); @@ -1183,6 +1180,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 Sat Oct 22 07:23: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: 7418 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1097599wrr; Sat, 22 Oct 2022 01:08:13 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6setanKqMS0mF5lUR5KosvQ+SWmpXA3neDI63OPYUg25XgdrPXaieDiDgVUXlZlckHdp7p X-Received: by 2002:a17:903:1251:b0:17f:7f78:e71c with SMTP id u17-20020a170903125100b0017f7f78e71cmr23489952plh.147.1666426093161; Sat, 22 Oct 2022 01:08:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666426093; cv=none; d=google.com; s=arc-20160816; b=QjwU4EMXrpUfXEjVJDZIJYsXYvzeYr6P+RerZLzDZU/3l75X3DAYJTl6tIWTTIQoj4 HVNOqtnWbF/O28uZaP1yZqcqV0pREaIQg8thvDdNQ1tz1I3N/AFB5MMnvoFXlWL+rc0S rlJJX6f+vUuOk7KO37FShCEnew8fYLtetawesYJB89nzR9FXwflgwQtODfEqc63y+mBg ahKE3HWZMxlsBpOYV7C+WUNgnekvblqf1lJLKCR0cU9DOsKttASvKqtjAdAxrkJTn3q3 GRjPBYOFtcV/wYlSJwHsJ0uZUzPZBCyLMuGx7HVHp0oNJsbMumzFyvx9sHOSrH4slsE/ PfIA== 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=jPKV0BnWv4tLymD7ks4G6BxLvMaO8VvRhEUt9Dzoehc=; b=iRdyvVIyQsZgO9gnLBwQxujByB0UcL37lwSqiKBQPLX3kE72wr0U4kJUonX50C6Eau yKqhO0fsJHcE3tW8+rNLOJ58MQ/oJKgekk4jMnXm5Q8FebHaQwEwcEnIMkENwNbG9b2f eclxEuA3AHvqUlVRlNgEw+AJl6ZWE1sae977zjeEcBCb2+8PZTZ4tJ8Jl3iDPtdVm1LZ Vtm8ysFxU7pbtoTOVJ4Slws5IkNca06EUnjY8W/lATCbqs4DCS/Yi5c0EBI3CSBFoY0K 8weIaz/uQ9hWZVkwUCFRdQL+bV27ovRT9/LUx0ttKaI8yHqHC+DV63NSunxgvTv6bqZd r8zg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=C4TYIsGo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 q34-20020a635c22000000b0043c9db24662si28159610pgb.269.2022.10.22.01.07.59; Sat, 22 Oct 2022 01:08: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=C4TYIsGo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S232774AbiJVIHq (ORCPT + 99 others); Sat, 22 Oct 2022 04:07:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42344 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232717AbiJVIED (ORCPT ); Sat, 22 Oct 2022 04:04: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 D01892A4E35; Sat, 22 Oct 2022 00:51: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 53214B82DF1; Sat, 22 Oct 2022 07:49:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A9622C433C1; Sat, 22 Oct 2022 07:49:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424972; bh=RKozKmBB0JBkOoa/PJoj7yI411/Su3O6UrAsmEnlFdM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=C4TYIsGoAdmaj4LMKiJB+iP0PNqRCYCdufenGnQdf572JKq03rT/kb8aPsvnbxG1c MiVSh9FSu5sjIGOB0iLESQX7Mp+ionxYO+WBQgwIupeB0s0Qax6M2d8LRxaeyKq2Yb o3aC2DzO5PnHPQQPnEANEUAAPSAG6152Ha08ylCQ= 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 5.19 344/717] ASoC: wm5110: Fix PM disable depth imbalance in wm5110_probe Date: Sat, 22 Oct 2022 09:23:43 +0200 Message-Id: <20221022072510.810189432@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747374407084781690?= X-GMAIL-MSGID: =?utf-8?q?1747374407084781690?= 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 4ab7a672f8de..1b0da02b5c79 100644 --- a/sound/soc/codecs/wm5110.c +++ b/sound/soc/codecs/wm5110.c @@ -2458,9 +2458,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); @@ -2493,6 +2490,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 Sat Oct 22 07:23: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: 7391 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1096921wrr; Sat, 22 Oct 2022 01:06:22 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6j/PnZLyx9IcQMtmqtp6dAXKO3f7NEHg7f/LqR7/lkBsFkiayAz3SdAl8rKOVmQcnuHDYx X-Received: by 2002:a17:90b:3a86:b0:20d:616f:4bb6 with SMTP id om6-20020a17090b3a8600b0020d616f4bb6mr63230884pjb.238.1666425982750; Sat, 22 Oct 2022 01:06:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666425982; cv=none; d=google.com; s=arc-20160816; b=Oq2zKzB5HPO8IJiuEG6Da5X4I8z5fj97SqBhZVA6RFpNSw5+HO7Rrgz3NyAjIMWL9M 3ksXZuJj7khmUJbobRzzJhlGJ+c3K840d9zPGIeL0InLZekqr5VxAUN7hkVThYavu8cu Y2aQ186lzH0MZnRMbsuw+9qGH+3bVME2LX03X1Xj+4jQahaaogUxcgUSRFo/PANhP51N QUeW+W7a+ODwFFwTMytvciNz2rsVMcVeVbGS/eGJKwZ1SgXIC0F19zQ8ww/l3zZWRIFw atVtIUveSjeLNM3CfJn3uFhjXBT62wTwBYNMwN7Sz8829McB21XlaXnsDwdfYcFts5Us X9VQ== 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=twiZxK3+TxEjl5y40j1QWKQpH3pJIVkRwesLMdO4XrI=; b=kkbBEh3YRyRzrZLeI2SOA0eNh0JZOYnQ65ejD2F7EO7vv1fMW4P9edsB84Qg3d542P My4dfkVanVgxrSmQzsX0HNwGKJ1hcsX2zkRp5zlJapapQAXr6RdWzo1dHKBLVnXmm0we 1aPO0rkV1gT/HeU5G5o1iraGnRE/d7WQO3OiZJ8oqnbw/MBJACs5H/cWihNzt04BGYxn nQxygvVQlsNaFFZo+M1KS7b3lW68Tju6/kZBHZ0OfsqDXysLZDAqo8ardNQBTP7OgNOQ +CacPA4c9TAX8imRf4UY/cVmKQRxFt6/eINLZ0iZytmgAh+3STC6IHBJsri2IFAN+dGX 3uhA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=y3CPSAri; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 s6-20020a17090302c600b0017b2fe7de33si28647827plk.10.2022.10.22.01.06.08; Sat, 22 Oct 2022 01:06: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=y3CPSAri; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S232724AbiJVIFl (ORCPT + 99 others); Sat, 22 Oct 2022 04:05:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37944 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232616AbiJVH7S (ORCPT ); Sat, 22 Oct 2022 03:59: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 87AFB481D5; Sat, 22 Oct 2022 00:49:37 -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 D06D6B82E11; Sat, 22 Oct 2022 07:49:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4C28FC433C1; Sat, 22 Oct 2022 07:49:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424974; bh=aXOJd5qAGKmElHBXtL7r7fI/AuxnCb5+iFF5hnrwRjI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=y3CPSAriFzOL1P8Xq0e/SMgxGy2y0Zas1IMB1/HPZ3ucytp/2JOgSCxwYQG8k5uJC SiYMWqW+gdWCzyDr8yl8xSOrn7JDqkWESS179JTv5+/LQImiTm50b5GzO/XRB1lSKV OcitlvZ3PQDlSrYFW14+uYNpiMV/cJDSSRO5ewQA= 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 5.19 345/717] ASoC: wm5102: Fix PM disable depth imbalance in wm5102_probe Date: Sat, 22 Oct 2022 09:23:44 +0200 Message-Id: <20221022072510.886620660@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747374291210109942?= X-GMAIL-MSGID: =?utf-8?q?1747374291210109942?= 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 b034df47a5ef..e92daeba11f2 100644 --- a/sound/soc/codecs/wm5102.c +++ b/sound/soc/codecs/wm5102.c @@ -2100,9 +2100,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); @@ -2135,6 +2132,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 Sat Oct 22 07:23: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: 7692 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1109200wrr; Sat, 22 Oct 2022 01:47:32 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5168nc2sGFKr8kvQ95stVUiEsW3UczhPwDlWdx3T5TbTL0e0vp8zVLtwpAhLOpQoVpLp/g X-Received: by 2002:a17:907:808:b0:730:54cc:b597 with SMTP id wv8-20020a170907080800b0073054ccb597mr19035911ejb.434.1666428452615; Sat, 22 Oct 2022 01:47:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666428452; cv=none; d=google.com; s=arc-20160816; b=UNBOKZYa8Sf9CqMdRgNSoPPObS/x5Q2MaZQMcFPNnfZMBjUgXuOWgxlIpFJOk7eCAQ VzZVkhL4UPbhFCBepNywpPIpsImnuBJgub8KkYEPhhvOdw+ytEE3ZHAi/YtbZytRxA1R uTUXj7QBmYk828ZjU7Jqrfu5PI0hdgBBfyq5s55kmulGuTluEyPiXksbciCM/Sw35S+r X3K2vyg2BWf+++cOlDZAa0mfXUmpUt9cyMnr8/3RphjlaOf4NbPicmvBl0Rt8reAn5hj h2L0IK5FGeTEuPVduT6kpYIKc2Bt558Wgmp0OYYZkph5mVu2BdTxw56bd2SahZeB4hzX Re5A== 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=mgctZY9hovJ7vSONoeOa0q44K80Wcy4UrpkPL70jZXo=; b=Xhl5+5r6D66xFmA5DRvWRKB098CQfnXBuifNdy/7fwlmBP6lQLYp3lsP8DirbYpa3u a+3mNJHBTGfhAvkHfQyf3JkSlb5MW+4g43irrnRCA7on64EAlQgQ0Ln+jPJWU+e1ZMDj Jlshw8eqygQdWmMak9OviJ2vZvPMeg7LMO/wj6vFhIDAUhnVaZjKvGpbgG8qCFdEL2Pv VPYuYzrjKWNnHTpLjOcNZeQQiZ02k/aOvdB66FTozftfdDcf9sQtlZqC9GyeY91bEzXd r1AtxrhbEmwKWqlH1leSS89g814j7iUYsfpWbVlDNDcy1d+3XkJHM1n+gbNbQ11oVbtF HIxw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=qOjb5HI0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 hc42-20020a17090716aa00b0079194297b1bsi16750152ejc.815.2022.10.22.01.47.08; Sat, 22 Oct 2022 01:47: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=qOjb5HI0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S234198AbiJVIqO (ORCPT + 99 others); Sat, 22 Oct 2022 04:46:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52874 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234915AbiJVIoB (ORCPT ); Sat, 22 Oct 2022 04:44:01 -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 08A1B2E96B0; Sat, 22 Oct 2022 01:07: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 8D376B82E0C; Sat, 22 Oct 2022 07:49:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DF8CAC433D6; Sat, 22 Oct 2022 07:49:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424977; bh=/DO/MJLKGlxxqHVavgVn6SazxotEdrvId6km3FQ0/N8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qOjb5HI0DtqH/aI+BLrpGRCM+sAqU33Og9kp923XiHH6FcHPziecHbBbS9eWU8IdJ LTjuMpe6qS9OBVCHZ94pjxdA3HgXa0MoWF9TDR36TYZvFR8r2t4hSSToy+IARNaSZR 1ygnIOBVlsqN2zgpp/A+bls/VBv2rL2KimK3HOdI= 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 5.19 346/717] ASoC: mt6660: Fix PM disable depth imbalance in mt6660_i2c_probe Date: Sat, 22 Oct 2022 09:23:45 +0200 Message-Id: <20221022072510.953833349@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376881262409431?= X-GMAIL-MSGID: =?utf-8?q?1747376881262409431?= From: Zhang Qilong [ Upstream commit b73f11e895e140537e7f8c7251211ccd3ce0782b ] 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 mt6660_i2c_probe. Fixes:f289e55c6eeb4 ("ASoC: Add MediaTek MT6660 Speaker Amp Driver") Signed-off-by: Zhang Qilong Link: https://lore.kernel.org/r/20220928160116.125020-5-zhangqilong3@huawei.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- sound/soc/codecs/mt6660.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/sound/soc/codecs/mt6660.c b/sound/soc/codecs/mt6660.c index ba11555796ad..45e0df13afb9 100644 --- a/sound/soc/codecs/mt6660.c +++ b/sound/soc/codecs/mt6660.c @@ -503,13 +503,17 @@ static int mt6660_i2c_probe(struct i2c_client *client) dev_err(chip->dev, "read chip revision fail\n"); goto probe_fail; } - pm_runtime_set_active(chip->dev); - pm_runtime_enable(chip->dev); ret = devm_snd_soc_register_component(chip->dev, &mt6660_component_driver, &mt6660_codec_dai, 1); + if (!ret) { + pm_runtime_set_active(chip->dev); + pm_runtime_enable(chip->dev); + } + return ret; + probe_fail: _mt6660_chip_power_on(chip, 0); mutex_destroy(&chip->io_lock); From patchwork Sat Oct 22 07:23: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: 7396 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1097087wrr; Sat, 22 Oct 2022 01:06:46 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7nNnVULV87MV/1krp1Ew+JxR9p19wN8zrcxEd3MheFoiOc2WLB0oK1o1Uzr29n4hW9hKOr X-Received: by 2002:a17:90b:33c3:b0:20a:ebc3:6514 with SMTP id lk3-20020a17090b33c300b0020aebc36514mr61963587pjb.147.1666426005919; Sat, 22 Oct 2022 01:06:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666426005; cv=none; d=google.com; s=arc-20160816; b=vz9ZIFR67M1ZEmqbHBl+h2R3bhD8PfgwmkmYvlVxfnrC9NXsDfl5KdnxyWlnvR1d12 kUdrro+islcpxQRUjtowir1nKLsDf9YvpSN5qmokt47dsbtzPaP3wF56cUR3HKcOZFX4 7MtBGnpoNMiA5XD/vEDVMJyHS/8Y35n6vkReKIqq9C3kMrUszHWp17hzlVGGMflDPhXP ebqTIWWeufJV5X6AKyPkjkIbf7sEbmxmGDBwIhWLkHiN3c2W24UVb/NmwdaJwKePU0DW Y+vIuge27uTHB2ACRJpMaEefqI7UbmJGsPRJnQddUI1aEoGDg+EJHH0IlIPssFMyQIQF PdKQ== 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=6SwdAG27AfUmRTQdWkAPa+ezJzmYcoDJbWpupl3Gkrc=; b=a/CjUk1FOz0mkE8Wk9WMVo6uVYAncI0o0dNvlqy7BVBtVvC186029L9SK8/x0mGA7t NmtLlGTDO5wCulvMTqARTJ8nHGaIEQKz9HayNrDTssedeURUKz2dWkbDjz/BXtHngGUS lScrXnuTs059opQkkzanDNNYZK/iXMDivD9OGgiIj0IaJf2Gm/E5xBl8vNC23r3ZGpYf t3VASBMXqi3C0Acakvr6dFpaZ+Ie1TSa5XlnfiMLWVyM4qYKy1EXKTKqjBpG/6MLl7zi MPGr2AWwGe3XZbDeRsJoZLJP2EdryxUy1BE8PdDoibjbsMA6a9HYxO9LUjIYYjkfSOt+ +9Mw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="xv/Gulr3"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 z14-20020a170902d54e00b00183f6ff535dsi27375191plf.490.2022.10.22.01.06.32; Sat, 22 Oct 2022 01:06: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="xv/Gulr3"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S232823AbiJVIGG (ORCPT + 99 others); Sat, 22 Oct 2022 04:06:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34814 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232720AbiJVH7o (ORCPT ); Sat, 22 Oct 2022 03: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 67CDA1CFC7; Sat, 22 Oct 2022 00:49: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 BD7EE60B1F; Sat, 22 Oct 2022 07:49:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A53BAC433C1; Sat, 22 Oct 2022 07:49:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424980; bh=gg1wQswyGA90Rm8bnUp+ZwCqX2EINFwKWxmb5fEPtvA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xv/Gulr3m+ENM7TkkV0GsHfDEcEOccLsRhjVJbAP1a+B8WF6SfKvcSGfMSPJLJhGk PesUsD3FhxcyrzL5+c6JEd6FApjZo+FDHdMwutdVJlkceDRKA9XD0LiLJHNJOhTLS3 CJ/WXyCwcuQZMelImL2AYIl4b32tqn0rjfzoZwgE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Brent Lu , Takashi Iwai , Sasha Levin Subject: [PATCH 5.19 347/717] ALSA: hda/hdmi: Dont skip notification handling during PM operation Date: Sat, 22 Oct 2022 09:23:46 +0200 Message-Id: <20221022072511.020405718@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747374315481991476?= X-GMAIL-MSGID: =?utf-8?q?1747374315481991476?= From: Takashi Iwai [ Upstream commit 5226c7b9784eee215e3914f440b3c2e1764f67a8 ] The HDMI driver skips the notification handling from the graphics driver when the codec driver is being in the PM operation. This behavior was introduced by the commit eb399d3c99d8 ("ALSA: hda - Skip ELD notification during PM process"). This skip may cause a problem, as we may miss the ELD update when the connection/disconnection happens right at the runtime-PM operation of the audio codec. Although this workaround was valid at that time, it's no longer true; the fix was required just because the ELD update procedure needed to wake up the audio codec, which had lead to a runtime-resume during a runtime-suspend. Meanwhile, the ELD update procedure doesn't need a codec wake up any longer since the commit 788d441a164c ("ALSA: hda - Use component ops for i915 HDMI/DP audio jack handling"); i.e. there is no much reason for skipping the notification. Let's drop those checks for addressing the missing notification. Fixes: 788d441a164c ("ALSA: hda - Use component ops for i915 HDMI/DP audio jack handling") Reported-by: Brent Lu Link: https://lore.kernel.org/r/20220927135807.4097052-1-brent.lu@intel.com Link: https://lore.kernel.org/r/20221001074809.7461-1-tiwai@suse.de Signed-off-by: Takashi Iwai Signed-off-by: Sasha Levin --- sound/pci/hda/patch_hdmi.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c index c239d9dbbaef..63c0c84348d0 100644 --- a/sound/pci/hda/patch_hdmi.c +++ b/sound/pci/hda/patch_hdmi.c @@ -2747,9 +2747,6 @@ static void generic_acomp_pin_eld_notify(void *audio_ptr, int port, int dev_id) */ if (codec->core.dev.power.power_state.event == PM_EVENT_SUSPEND) return; - /* ditto during suspend/resume process itself */ - if (snd_hdac_is_in_pm(&codec->core)) - return; check_presence_and_report(codec, pin_nid, dev_id); } @@ -2933,9 +2930,6 @@ static void intel_pin_eld_notify(void *audio_ptr, int port, int pipe) */ if (codec->core.dev.power.power_state.event == PM_EVENT_SUSPEND) return; - /* ditto during suspend/resume process itself */ - if (snd_hdac_is_in_pm(&codec->core)) - return; snd_hdac_i915_set_bclk(&codec->bus->core); check_presence_and_report(codec, pin_nid, dev_id); From patchwork Sat Oct 22 07:23: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: 7429 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1097855wrr; Sat, 22 Oct 2022 01:08:57 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5ic/oHPNlHXh6bqcNbhUfeayfcJXqH0QYdxlDZVMyEheSENZ8M5CxDB+Nfcg5DMjCw93uQ X-Received: by 2002:a17:90a:d390:b0:20d:3b10:3811 with SMTP id q16-20020a17090ad39000b0020d3b103811mr63365378pju.211.1666426137282; Sat, 22 Oct 2022 01:08:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666426137; cv=none; d=google.com; s=arc-20160816; b=0hK1FLeY/olnXKS9W7Z9SUoCxWK0SZ0uiz2rLUJb9kHnaBzt+aGQb2MuCjuzLx6hhd 3xM5WSBqb+QiZAk9ZUNhRRbbmUMGTXr1i2i30rZOapIEARKK7+vy6oM4rqlKmjNi0yoU JwyEyIm2eqYe2g/EXbVbp36D+/7D53HaRD76S0wRCjLCclIDxrp8Pjrv+tOg3JiJYFe+ YSKiQo0Ba1e+z5Eg7H/rfTXK/pgdqcA3dk2HKYgGv3t2WTrwRrahiLDt+A+NRulglDoY fzbIP53lk041bgk7WeM95HY2Qk71ZvwoZFECH0z4HEZptc4uQpBhq8myoNgyS2ULq6Tz r4kA== 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=bmMYGpE/OttY3f+exiH2AeqASrzonovclRl1wXdDvKw=; b=tP3Coq3Q6GEgYfhOOxeH1ac7RAMJepJOUaVwrmyfxiGlECEWLa5rFh3XipIBAcGt/R UkJlPNWiaUGVuCxsVlyFClK7bKBztVOrnYAqN8ZlseuLxeQITo7lkIJ126YHMav7BpgU 0NtnOLoERuKD+Mnl1kmifTPouJZyrYq4BZLDs8RP6IiNLl5NchcbzkYIQvCkqzDWKOoq 7X5fTsWvvm4bfHhR4XONNXUBgf031MZoR8CMV1GKyqYd7qcVUwLipSigPTmX0gpnG/Ki ZCgBS1z7GXFGgz8wsWeqNhvNTwpM1ty4XfcodpqYnEwqbfJmtkCEtzwe30szvRP6xPCz HM2A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=n1ojZjYJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 k25-20020a635619000000b0043946964302si29208826pgb.173.2022.10.22.01.08.44; Sat, 22 Oct 2022 01:08: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=n1ojZjYJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S233071AbiJVII2 (ORCPT + 99 others); Sat, 22 Oct 2022 04:08:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57152 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233005AbiJVIEh (ORCPT ); Sat, 22 Oct 2022 04:04:37 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 769892C56A2; Sat, 22 Oct 2022 00:52: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 5AB7860B27; Sat, 22 Oct 2022 07:49:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 705F5C433C1; Sat, 22 Oct 2022 07:49:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424982; bh=Vq582+ZZfZeJ50akCNDAGdJDlR6WOX/d4TZ2XfKNEBA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=n1ojZjYJ+WKoGRnVqkopJHz02L/p5rWgxmMEsDCJEISCgXRdZd7FV+C207mc4pNjD XaC3Mcmx83bZzBr4hfJ8EcO9L/WQkbtHdNSoY77P9RMjoFi/UOuXt2nu3Mok+ZnQsn For+ErqK6JMEkPChwWaQV+eHV4j2FiMEeO/J3wVI= 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 5.19 348/717] memory: pl353-smc: Fix refcount leak bug in pl353_smc_probe() Date: Sat, 22 Oct 2022 09:23:47 +0200 Message-Id: <20221022072511.097903821@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747374453591075619?= X-GMAIL-MSGID: =?utf-8?q?1747374453591075619?= From: Liang He [ Upstream commit 61b3c876c1cbdb1efd1f52a1f348580e6e14efb6 ] The break of for_each_available_child_of_node() needs a corresponding of_node_put() when the reference 'child' is not used anymore. Here we do not need to call of_node_put() in fail path as '!match' means no break. While the of_platform_device_create() will created a new reference by 'child' but it has considered the refcounting. Fixes: fee10bd22678 ("memory: pl353: Add driver for arm pl353 static memory controller") Signed-off-by: Liang He Signed-off-by: Krzysztof Kozlowski Link: https://lore.kernel.org/r/20220716031324.447680-1-windhl@126.com Signed-off-by: Sasha Levin --- drivers/memory/pl353-smc.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/memory/pl353-smc.c b/drivers/memory/pl353-smc.c index f84b98278745..d39ee7d06665 100644 --- a/drivers/memory/pl353-smc.c +++ b/drivers/memory/pl353-smc.c @@ -122,6 +122,7 @@ static int pl353_smc_probe(struct amba_device *adev, const struct amba_id *id) } of_platform_device_create(child, NULL, &adev->dev); + of_node_put(child); return 0; From patchwork Sat Oct 22 07:23: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: 7518 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1105139wrr; Sat, 22 Oct 2022 01:34:13 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7yaBo15TrH2x9atHmctAxc/KZMWU+aUOze4+n5H0mIQRgdyfzUlvhsXdK/hZMRwrP0BcUh X-Received: by 2002:a17:902:c410:b0:17f:8d9b:7e68 with SMTP id k16-20020a170902c41000b0017f8d9b7e68mr24062686plk.133.1666427653001; Sat, 22 Oct 2022 01:34:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666427652; cv=none; d=google.com; s=arc-20160816; b=qW3Dam95ykl/xddubEwsuNuESyfp2PGBsn3QjtWGR73zQ4T/97RhsJKMbQuADlb0PD nQi+RSX8hOF20pjB0Iv8M3YeCW+zuE21Otn3J5YnMQZQQh+oMeBFCla/UCGErQbWYhc4 VqiIehEKOOgKmdy6xhzp45yJvrZk7kz0VmJj61BBibB1fTyWucFVKEIZ/DfRCfkbbcdW Nsl+DKCmL6QXVRJtpnhAOxhxEEcqxNj1xWv9cwr8WPaOVp/EgATNHZKPhcqmXBBDZ8Ri UfqyDGhZpV9AJzN+vzs685gOkH/zjSsHhb1lAe9jgJnR++uQdTEzqD9UFVCX3LHqx9Ri nLaQ== 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=/xAzDuWRkkCz2MxtJs9KWWASaDi6g7o7uywWNFAWqGs=; b=qlYtxZIoA7r/14O4X97FxmLelxuhA1ihXeYKqpIRLZ9mV7vgWoW4xMtKLKS+NB0Wh6 HkM+0sbUbHmWJdBETQokiVouV0j8oaWhKRhXQBj/DWjPx4xHczMaRSTCpIkhFjsZkCye BCQJixrorMjVyo5vxsGOWa+EjEoq7jqBw5ezEnBNYrh6p6ciL72gs/QLXzUVIBrQ0ole CBPWj35ME0GhjOW9PiVBJu3m3k+xxvo23UtmWuimqJ7bkn7kjtP5xJ7Jkz94Ribyurmz m0pCKqpI1DRfn7Si2jfsD5DyQ783sRlRyYIVUbnqU1CtjTSZ5XhOWhe02pVTjJOvWOiY Z8eA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=geNApx98; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 pj4-20020a17090b4f4400b001fe1cc52234si9679833pjb.67.2022.10.22.01.33.55; Sat, 22 Oct 2022 01:34: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=geNApx98; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S233809AbiJVIVQ (ORCPT + 99 others); Sat, 22 Oct 2022 04:21:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44336 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233797AbiJVITo (ORCPT ); Sat, 22 Oct 2022 04:19:44 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 07FD22DE461; Sat, 22 Oct 2022 00:58: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 B0F79B82DEF; Sat, 22 Oct 2022 07:49:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0D37BC433D6; Sat, 22 Oct 2022 07:49:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424985; bh=VDRe/5Hbi95puk/YwoQKy5coXP8NgEp+rB9ALswaBwg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=geNApx98+8y52WChecnzNJ5W1XFPnKSNGY251SlLxqIHF33FvizogYOF3LD4qOHLK MLRCQwLH2U4RR7pEDrK6zlGqgY6IIfEBafDwHL+unctAq5RWMbViq+4aTgbLw6cAGb u45alUgL1TBZUSUkvWg9/etvAHiZ7vzwPuNYAkDk= 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 5.19 349/717] memory: of: Fix refcount leak bug in of_get_ddr_timings() Date: Sat, 22 Oct 2022 09:23:48 +0200 Message-Id: <20221022072511.162072362@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376042680049664?= X-GMAIL-MSGID: =?utf-8?q?1747376042680049664?= 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 dbdf87bc0b78..8e2ef4bf6b17 100644 --- a/drivers/memory/of_memory.c +++ b/drivers/memory/of_memory.c @@ -134,6 +134,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 Sat Oct 22 07:23: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: 7398 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1097102wrr; Sat, 22 Oct 2022 01:06:48 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5fDTD/FvecYOcEUV+SCTs1WiSlhjS8/hX0q87IgPLWeDdHSJKrntl3DbfqI3JCS0YGF6nq X-Received: by 2002:a05:6a00:16c4:b0:535:890:d4a with SMTP id l4-20020a056a0016c400b0053508900d4amr23463824pfc.0.1666426008385; Sat, 22 Oct 2022 01:06:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666426008; cv=none; d=google.com; s=arc-20160816; b=GmN8/LbHTf0bWOqU/MaBE/hE5YMc5GEOozyGjyg2O0mw/90Hj8chlZk7qmoqCiCkH2 hED7zTPosnTN3pHw+2iOpWCgw2LDAwzNPu/L/oykaAE5Y+ZA81MNDGKKR6fIfbR5uN/d FqwHWiVG/k3qYxTvWDa5h9FGQv58FdTbEYRnsD7FlTFxD8tuvZy8yMVPI/+58+Ehj5Kb lGLB0QNYBLgvrE5+GNkNXqm72QFweXFFtF5noDmk8xl0Hba97iIXB43Ot7IPD3mGikYX SAhf8Dkmfc/shLACXmNwOXYU+tNugwwnXB3gddNbxCulHpgG8VfPd7kiAkJCNmM2zdF/ xVtw== 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=6qBwUb7thyirpD9KqnPUESV5l109RMeTAv2/wp4CRD0=; b=DDOj0esqeOHb+2MQq+X3MlDdB10DcRufxWhHCtVjsOIJLUtyijaeKCdlFgB/NWV+lG dlusKxCiQUCYElIOB55BsF9FVG/5zL7iFFcneiZm6avoixqU5iTxaUxx+tV7A3hDW87E X7H6q7qPcsA+eTUAD9n6aapKkOLZEhFVGOLzf64lybXhkBvubwC0HBfNekRSA+ZfVBgc kXwvMTPuTynSNlpF9AKTHYtdLv1TNkyRLjy9w0uCDlKk6lgEGQ0RgArCu5Mjce5me45+ r4L0L+S+XEA9Kh4CVW1aC9/yjoAxDJeQw1XU6GeMZzsHEN0vNci3wygtXE0FL8U/L9rp 9/Tw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=XTie77Rx; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 h185-20020a6383c2000000b00460fbf095b6si25947997pge.562.2022.10.22.01.06.34; Sat, 22 Oct 2022 01:06: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=XTie77Rx; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S232702AbiJVIGM (ORCPT + 99 others); Sat, 22 Oct 2022 04:06:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40078 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232738AbiJVH7q (ORCPT ); Sat, 22 Oct 2022 03:59: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 8F0DE72975; Sat, 22 Oct 2022 00:49: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 61C2DB82DF6; Sat, 22 Oct 2022 07:49:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B6F0FC433D7; Sat, 22 Oct 2022 07:49:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424988; bh=EDcfOZ9GiROdzrYcCV/i2Qx1Q4cPalUM4Bdj4HFS6+A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XTie77RxBdAB48J9HR9mrbCedZbWfA1OfbgSP4E1Ra4bTt990L8rfucwz3pPYKYC+ kjfYldXgBhsV3R3bp4b+PGt5y/voKT7e89mBWG15faUrysw02OFpxJciDak6IlBS38 fY8U55JAwNBdz3IRo3HVtn/5SZS/aQFSxgDFYoxc= 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 5.19 350/717] memory: of: Fix refcount leak bug in of_lpddr3_get_ddr_timings() Date: Sat, 22 Oct 2022 09:23:49 +0200 Message-Id: <20221022072511.220388639@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747374318110572094?= X-GMAIL-MSGID: =?utf-8?q?1747374318110572094?= From: Liang He [ Upstream commit 48af14fb0eaa63d9aa68f59fb0b205ec55a95636 ] 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: 976897dd96db ("memory: Extend of_memory with LPDDR3 support") Signed-off-by: Liang He Signed-off-by: Krzysztof Kozlowski Link: https://lore.kernel.org/r/20220719085640.1210583-2-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 8e2ef4bf6b17..fcd20d85d385 100644 --- a/drivers/memory/of_memory.c +++ b/drivers/memory/of_memory.c @@ -285,6 +285,7 @@ const struct lpddr3_timings if (of_device_is_compatible(np_tim, tim_compat)) { if (of_lpddr3_do_get_timings(np_tim, &timings[i])) { devm_kfree(dev, timings); + of_node_put(np_tim); goto default_timings; } i++; From patchwork Sat Oct 22 07:23: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: 7395 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1097055wrr; Sat, 22 Oct 2022 01:06:41 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4P1vajVyIEqv7bB/urlysIdYBtRrIlRQJpWH7BkSiZkc9HXVtAHfzYTr83dU3E/jwi73KO X-Received: by 2002:a17:90b:3e82:b0:20d:2fa1:d071 with SMTP id rj2-20020a17090b3e8200b0020d2fa1d071mr62481192pjb.58.1666426001286; Sat, 22 Oct 2022 01:06:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666426001; cv=none; d=google.com; s=arc-20160816; b=OtZoSvbn9gl0L0h4T4YggRNWn+qmGrCvLR+wWA2Cdm9G7Uozw+/IDqb5OV2hfk4Rjn 64NQPMblTMLlAokps609/Dsav7Oj8QjxeFZjdmNZs1zsdgkoA1pj2Xaw+I2dpUVo2g21 J+zeuSuAjfWZjWItRYzzsoTSKy6UYQPaFXBpDJze7Gc/h75W0VSQbomOCvSySBfP0BFN 3k+abnhUGxdWhjp6oSXfjSiAuKiH9mvWgkfGQKMzAx/LrZQr0NzYClBkfLbvE33UZf4C b/Of/2LnT4eIP2meIMmKDwd6eX2puYD5VnYWiOxWGzhwqJagtHRdpDvc5LumUZv4zrME KSLw== 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=EE4IxnV8LsII/VS2kG4DSx6NzDPbom4LFJ2hAI1GLFU=; b=CFYiT7y6yOkataF8zmQq3DzcVwTrGV9pxqagBZc1GhuG6/Kl4uThKmScIfQbSPPiHg BuAPvLpAiE+SfjexCzNXNy1mL4h8Jizm+v5zDR1V9J3LT+qSY8hDdkQKmdrcHoaXwNJk bd61h9uRbBV7EK4bFxBPCtcWURKO7b8VzFCmN1bTDfUAafTLdGj7fziaNxN3JgpN+23Z Wc20dk9zN0j8Cr7SGiW+PgVcgagmjGkHrS9LeVS/GKQI1p0EL3AncAlD4sS3jw2vQm6/ wydymSBa2wwgQJcj9guUXJA9WgQ7XnFJn8yXPcZhkDpfwaUOBh5BQ6/i4IAAOk4GaqjZ yILg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=BzAtGnuz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 n11-20020a634d4b000000b004386d70cf15si25776930pgl.206.2022.10.22.01.06.27; Sat, 22 Oct 2022 01:06: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=BzAtGnuz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S232776AbiJVIGB (ORCPT + 99 others); Sat, 22 Oct 2022 04:06:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48632 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232708AbiJVH7m (ORCPT ); Sat, 22 Oct 2022 03:59: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 BF5DAFC1C9; Sat, 22 Oct 2022 00:49: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 3E08860B28; Sat, 22 Oct 2022 07:49:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 54AD5C433D7; Sat, 22 Oct 2022 07:49:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424990; bh=j2FU4rD3Ftcr09PDebDiLe2go+wH3L/m5kM1bnd19uA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BzAtGnuzlIQyGHfBz45n/WzXYi86oF4ahJjjqZT7PFy9EQ8CQWCpzNuYmBVHSGSUY KG7HHCpOITFqbsb6t+bU5lBvQWowsN0RDdQS9wX8WrnK8zWN07H0QwaaW/3T0XCn9Y ExXB9JEUlWpLQGhewGPsCeTxY6TNoG9ppRFPTgEA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jeff Layton , Amir Goldstein , Al Viro , Sasha Levin Subject: [PATCH 5.19 351/717] locks: fix TOCTOU race when granting write lease Date: Sat, 22 Oct 2022 09:23:50 +0200 Message-Id: <20221022072511.297825603@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747374310760023152?= X-GMAIL-MSGID: =?utf-8?q?1747374310760023152?= From: Amir Goldstein [ Upstream commit d6da19c9cace63290ccfccb1fc35151ffefc0bec ] Thread A trying to acquire a write lease checks the value of i_readcount and i_writecount in check_conflicting_open() to verify that its own fd is the only fd referencing the file. Thread B trying to open the file for read will call break_lease() in do_dentry_open() before incrementing i_readcount, which leaves a small window where thread A can acquire the write lease and then thread B completes the open of the file for read without breaking the write lease that was acquired by thread A. Fix this race by incrementing i_readcount before checking for existing leases, same as the case with i_writecount. Use a helper put_file_access() to decrement i_readcount or i_writecount in do_dentry_open() and __fput(). Fixes: 387e3746d01c ("locks: eliminate false positive conflicts for write lease") Reviewed-by: Jeff Layton Signed-off-by: Amir Goldstein Signed-off-by: Al Viro Signed-off-by: Sasha Levin --- fs/file_table.c | 7 +------ fs/internal.h | 10 ++++++++++ fs/open.c | 11 ++++------- 3 files changed, 15 insertions(+), 13 deletions(-) diff --git a/fs/file_table.c b/fs/file_table.c index 5424e3a8df5f..543a501b0247 100644 --- a/fs/file_table.c +++ b/fs/file_table.c @@ -321,12 +321,7 @@ static void __fput(struct file *file) } fops_put(file->f_op); put_pid(file->f_owner.pid); - if ((mode & (FMODE_READ | FMODE_WRITE)) == FMODE_READ) - i_readcount_dec(inode); - if (mode & FMODE_WRITER) { - put_write_access(inode); - __mnt_drop_write(mnt); - } + put_file_access(file); dput(dentry); if (unlikely(mode & FMODE_NEED_UNMOUNT)) dissolve_on_fput(mnt); diff --git a/fs/internal.h b/fs/internal.h index 3e206d3e317c..4372d67a3753 100644 --- a/fs/internal.h +++ b/fs/internal.h @@ -102,6 +102,16 @@ extern void chroot_fs_refs(const struct path *, const struct path *); extern struct file *alloc_empty_file(int, const struct cred *); extern struct file *alloc_empty_file_noaccount(int, const struct cred *); +static inline void put_file_access(struct file *file) +{ + if ((file->f_mode & (FMODE_READ | FMODE_WRITE)) == FMODE_READ) { + i_readcount_dec(file->f_inode); + } else if (file->f_mode & FMODE_WRITER) { + put_write_access(file->f_inode); + __mnt_drop_write(file->f_path.mnt); + } +} + /* * super.c */ diff --git a/fs/open.c b/fs/open.c index 1d57fbde2feb..5874258b54bd 100644 --- a/fs/open.c +++ b/fs/open.c @@ -810,7 +810,9 @@ static int do_dentry_open(struct file *f, return 0; } - if (f->f_mode & FMODE_WRITE && !special_file(inode->i_mode)) { + if ((f->f_mode & (FMODE_READ | FMODE_WRITE)) == FMODE_READ) { + i_readcount_inc(inode); + } else if (f->f_mode & FMODE_WRITE && !special_file(inode->i_mode)) { error = get_write_access(inode); if (unlikely(error)) goto cleanup_file; @@ -850,8 +852,6 @@ static int do_dentry_open(struct file *f, goto cleanup_all; } f->f_mode |= FMODE_OPENED; - if ((f->f_mode & (FMODE_READ | FMODE_WRITE)) == FMODE_READ) - i_readcount_inc(inode); if ((f->f_mode & FMODE_READ) && likely(f->f_op->read || f->f_op->read_iter)) f->f_mode |= FMODE_CAN_READ; @@ -902,10 +902,7 @@ static int do_dentry_open(struct file *f, if (WARN_ON_ONCE(error > 0)) error = -EINVAL; fops_put(f->f_op); - if (f->f_mode & FMODE_WRITER) { - put_write_access(inode); - __mnt_drop_write(f->f_path.mnt); - } + put_file_access(f); cleanup_file: path_put(&f->f_path); f->f_path.mnt = NULL; From patchwork Sat Oct 22 07:23: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: 7553 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1105943wrr; Sat, 22 Oct 2022 01:36:34 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6CDqkn7JwgjD9696D2Sv47Lx/KMRb+CMX5e+oRrCev5k0FFXzxCv/AA/3CWtWO8zUvWjFE X-Received: by 2002:a05:6a02:28b:b0:439:19d6:fad5 with SMTP id bk11-20020a056a02028b00b0043919d6fad5mr20263568pgb.591.1666427794586; Sat, 22 Oct 2022 01:36:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666427794; cv=none; d=google.com; s=arc-20160816; b=xZYBNOEM0HAyHjXZ9ncXT9zyIPJOywks2AK39xlM1rDt/2gIChF/NAladQcZOZ21qe kqjlGTnGUKmThYRwD46TOp7Z3s/cZ/D6Yw81Ph8qrBJQThyMtZtUcrrGOSkbAWoqP4hv N1g9hd/DrID5V0r3BNwtANYZll3MFlQeDrgz6x7anxk1ZzYKZDgTLHSY3skEYEIWeKlD FReKTibq1ygogvtzcSwoY4n6ajcgvgWLeQvEJ2NZMl33/6oDUYGz/f89YygUPGZYj12b Bc1kgSaGlwxYFEfIVRZ0mhrnOzywFMFXIdNdm2yNkhn9WPMHEIg7/swa2Ni6Z38ZwF7o jZUA== 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=FzmyfoUN3jOwm5ugmT9vrDIPu7CJRmVoV+4TDNIdZg4=; b=CxW39PYa8mEiJGhila/lGnzrLSNrXNgG9jkplQemR7urK8Yp8sDV7P5W2RBVq3LR/Z 57WqH+tXmo6rq76dy2/suHJLGuMU9hJcOZ6iCtzDksEk+0qaJAFbwDniAMpYzweC39oR vJuW1FTzPtd6bna2fkuAcPDOi0wcLrmzqsiwEa85B0kzhHNWCxDJfTrLqOpuBKCAm0P6 n5pjNO5seUD3tZ2p5HCn81eeO+ID8RYvmp9WrXn+YxSODVe63LF3CQnHrCbL2tuGGq0R +qr//zWbxDPr2Gv9t6DcwRXyk/eI7GGgZVRuAkSf5m+0p1j6+mkZc24lHrp1VN40A4ZE 1E0Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=kkGVWq0P; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 n1-20020a170902e54100b001786a4a4c98si29743920plf.371.2022.10.22.01.36.18; Sat, 22 Oct 2022 01: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=kkGVWq0P; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S229913AbiJVIbN (ORCPT + 99 others); Sat, 22 Oct 2022 04:31:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37788 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230000AbiJVI2T (ORCPT ); Sat, 22 Oct 2022 04: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 56B552D6540; Sat, 22 Oct 2022 01:01: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 8D657B82E17; Sat, 22 Oct 2022 07:49:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0214CC433D7; Sat, 22 Oct 2022 07:49:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424993; bh=XQAYMWo06//zIHjMBtnXreMiMDYguIyBbLd57r3zYXE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kkGVWq0PBZxzGX55+9eD9Y8tpyoeZJ2TTrVc0HiS+qJ4uVJhskW4EiFFW2rLVBhWx XjGDckeXtZwu908LZ3vTpDLsvshFC8xCLF7fP8yqXMJoWuipiHbzELpSNYTbuJ9vpF HX/d/3Qp/VK6xoCLLhIbWhZ5utNIKpyDMwv7sR6M= 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 5.19 352/717] soc: qcom: smsm: Fix refcount leak bugs in qcom_smsm_probe() Date: Sat, 22 Oct 2022 09:23:51 +0200 Message-Id: <20221022072511.394210487@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376191083105244?= X-GMAIL-MSGID: =?utf-8?q?1747376191083105244?= 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 9df9bba242f3..3e8994d6110e 100644 --- a/drivers/soc/qcom/smsm.c +++ b/drivers/soc/qcom/smsm.c @@ -526,7 +526,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 */ @@ -534,13 +534,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 */ @@ -548,13 +549,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 */ @@ -565,7 +567,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. */ @@ -595,16 +598,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 Sat Oct 22 07:23: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: 7770 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1121048wrr; Sat, 22 Oct 2022 02:27:19 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4R4RHMM469YJCGC48i3ZQ7tG+jpEtolFwVwKhcuKn3UHlKngwQYhYwlEWXTGXMBg/qRfH0 X-Received: by 2002:a05:6a00:1c99:b0:562:6292:9e4e with SMTP id y25-20020a056a001c9900b0056262929e4emr23877878pfw.22.1666430839488; Sat, 22 Oct 2022 02:27:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666430839; cv=none; d=google.com; s=arc-20160816; b=W5dA7S/6CRbL+W6auByEPvny6vp3zkCWOsC6uu9NHSFF+HSfcx9sQDKH2ooUYestDX We2edkJJpzbpY91J6S5MD+duEnDrRbyZTuEBSTCoxszJK2ZEGJzKGcJ8FQJ0VpcM4R2w ZILlV43/UxaPG53Yw+GrztIukNUNFw+08Q1bfAo4I42d6f6Sdfam0icPC9PkfTT3YcNe rOFIZPDPpIiZM1B5LCehx76vKzQ+15hejYc5I9bME/5kFbgUasRWgNdsEqpP6mNr7Idu 2rbyxW4Q1ufJE2aVx5heifPjAEkovE+nR6pmO3nsJnYAZSTqWXtYmtaNuy4yGu3LFexN UARw== 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=k3PzK0abBm+JtQPkVhDNc9iNsk/dPFRF72EgCCjLfK0=; b=sSq3ClnfZwYfPAzE4jwxzvFOho+CfsQFE5w9Trln2NSjSAbhyrIMgubrw5AKN3FQAW PHLYiAoBWvsTYoXUUMl6J/9bS7wH+d2EneIskLoEdwTucIK2fXxlGg6Z8uZ+Agb/3tMa XA5fyVLHD5Da3sGH9EoK6UKH3aOWK2Q4+Fi/jwwMKoHN7gUGRLf0RqoIOZOKbyfEqsZk fpLohZLbevRF51YgxqN+y7RLtRPK0JwfCz6bflODbZrvq6LdMRLZPCjPizuY9rRtRpeC tpzFLrTfF2gFATX2yUdn9Hgmxv0+wd/hHWvcZi29JK3bgo8tehUNdztKxXH4ah8UFBpV +KHQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=GdX4p6vK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 22-20020a630b16000000b0045a07a7c790si28309894pgl.740.2022.10.22.02.27.06; Sat, 22 Oct 2022 02:27: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=GdX4p6vK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S235129AbiJVJDw (ORCPT + 99 others); Sat, 22 Oct 2022 05:03:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51766 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235000AbiJVJDP (ORCPT ); Sat, 22 Oct 2022 05:03:15 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B4EB12FA5DD; Sat, 22 Oct 2022 01:18: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 B4B3F60B24; Sat, 22 Oct 2022 07:49:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C9A80C433C1; Sat, 22 Oct 2022 07:49:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424996; bh=OIyPrmQIsCOKB3WtDB3t9YMhRPWseYg73YUNm3OcaiI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GdX4p6vKVwqTSNfWVaGN2W02qApZvz38XqjebpiyS/7TGny9b9FIj+2isHl5gupbh IKNw+fHX6KaDg/7f6ZNeu04Q9en/0VlF0rHpbAn6aY7Qw2NS38wD4knQG42fA/pVQr ECv+XyP2NRTlUk2BCCxuBDvOGNpvVUKaTCynuDlY= 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 5.19 353/717] soc: qcom: smem_state: Add refcounting for the state->of_node Date: Sat, 22 Oct 2022 09:23:52 +0200 Message-Id: <20221022072511.527968726@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747379383775921056?= X-GMAIL-MSGID: =?utf-8?q?1747379383775921056?= 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 31faf4aa868e..e848cc9a3cf8 100644 --- a/drivers/soc/qcom/smem_state.c +++ b/drivers/soc/qcom/smem_state.c @@ -136,6 +136,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); } @@ -205,7 +206,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 Sat Oct 22 07:23: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: 7402 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1097226wrr; Sat, 22 Oct 2022 01:07:07 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7jYAR+lkCXnE12kVXBRk1ULRxovYys8urziMa4NFzsx/XblTtBlS5hcVkJ2JGQzxn+opyS X-Received: by 2002:a05:6a00:23d2:b0:565:84d7:64c3 with SMTP id g18-20020a056a0023d200b0056584d764c3mr23401305pfc.20.1666426027553; Sat, 22 Oct 2022 01:07:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666426027; cv=none; d=google.com; s=arc-20160816; b=aV+pTkRG2hPZmR0BzRRjbIg2MrF/MmUnqksQNEz/zvMAPktp+bdXlFo1X/jEVvsDis xNl3TD9kQvS/Laa7dJpe9ysdiqWqJBch80XhbO7aP5C7BHW7QtyyYwihnSJ8l42hOuxc Sj7JyzB/azCQ5RILtUn+4QAMxzdrRkPVTqr0KdS2a55RIjd7EF3FzcgNGPQWGhQrYkeD ZoRTaikyIk1IGKFaYGC8gbpY0R853q1uSYFZYtaDlAhRf+IV3okiv5rsUHuu6yZ3Dgji 9TmMz7ukTt6Smzx352A62rzysR7ajbWVXKEJqMLTTO1SWCt98sHY4kZz8nrEuZnpBNtY 1Luw== 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=NrBL3ENCTdOxN6ol3CHSaDZRBXkk++eqee14V63mAqs=; b=vKDpNld35YXi70tsPiUZ7pTDg010AHt7MT/LQhEmI4D8uCQxx0J2e4ER3aloiie9s6 vK5B17FSR3yM1oOw4Yk2EeWyCrQePNBBxO/mlEJhV1uQ67WB7P9Uw6EC8sdmi0CsbzK7 08aBLkVfhbkAEeM+te7iojC99pTlpUniNKtTf/9UVHT3lfhZLQTnYhEY8jlpQDOY+ZIL 2VudaSkbywpV1CiuBhdFTlXP/bT1imvB0i7/XTLmbDHaUvZ/j2t99Y1i7qU7qoW/+b8o QfUNrdHGheI+r12OWLo+yEM+eC+ZxtEZJKRNWcQR+jNVHd/LcqojUZXotHir+OpLWVzb reQw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=soyMxvvS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 l191-20020a6391c8000000b00460358671e2si27089044pge.547.2022.10.22.01.06.54; Sat, 22 Oct 2022 01:07: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=soyMxvvS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S232865AbiJVIGd (ORCPT + 99 others); Sat, 22 Oct 2022 04:06:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35400 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232842AbiJVIAD (ORCPT ); Sat, 22 Oct 2022 04:00: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 4C80314EC7F; Sat, 22 Oct 2022 00:50: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 F351460ADB; Sat, 22 Oct 2022 07:50:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0C941C433C1; Sat, 22 Oct 2022 07:50:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425001; bh=886F7+QHCEAnDMEkfjueOSSJcarr3O9tSlES4/xq6vE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=soyMxvvS23cSbGkpnTyhJlJ0LCO5iuHdHqxZA4tIhAusYouP3MX1r6aX4l90oPH2R ZS3Oc29zjhK80mjJ8Fbwo43s0ZKWnGlLdydKmA/hCEJ1RI1cb5p59upZ3oEwbFSBdO 8q+DKe0afX/Xl+pZjoDDNWei8IhfryF1wbCuwPhA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Lucas Stach , Marco Felsch , Shawn Guo , Sasha Levin Subject: [PATCH 5.19 354/717] ARM: dts: imx6qdl-kontron-samx6i: hook up DDC i2c bus Date: Sat, 22 Oct 2022 09:23:53 +0200 Message-Id: <20221022072511.680808682@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747374338675959333?= X-GMAIL-MSGID: =?utf-8?q?1747374338675959333?= From: Lucas Stach [ Upstream commit afd8f77957e3e83adf21d9229c61ff37f44a177a ] i2c2 is routed to the pins dedicated as DDC in the module standard. Reduce clock rate to 100kHz to be in line with VESA standard and hook this bus up to the HDMI node. Fixes: 708ed2649ad8 ("ARM: dts: imx6qdl-kontron-samx6i: increase i2c-frequency") Signed-off-by: Lucas Stach [m.felsch@pengutronix.de: add fixes line] Signed-off-by: Marco Felsch Signed-off-by: Shawn Guo Signed-off-by: Sasha Levin --- arch/arm/boot/dts/imx6qdl-kontron-samx6i.dtsi | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/arch/arm/boot/dts/imx6qdl-kontron-samx6i.dtsi b/arch/arm/boot/dts/imx6qdl-kontron-samx6i.dtsi index 6b791d515e29..683f6e58ab23 100644 --- a/arch/arm/boot/dts/imx6qdl-kontron-samx6i.dtsi +++ b/arch/arm/boot/dts/imx6qdl-kontron-samx6i.dtsi @@ -263,6 +263,10 @@ phy-reset-gpios = <&gpio1 25 GPIO_ACTIVE_LOW>; }; +&hdmi { + ddc-i2c-bus = <&i2c2>; +}; + &i2c_intern { pmic@8 { compatible = "fsl,pfuze100"; @@ -387,7 +391,7 @@ /* HDMI_CTRL */ &i2c2 { - clock-frequency = <375000>; + clock-frequency = <100000>; pinctrl-names = "default"; pinctrl-0 = <&pinctrl_i2c2>; }; From patchwork Sat Oct 22 07:23: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: 7400 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1097149wrr; Sat, 22 Oct 2022 01:06:57 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6/hTq7drk4EWZm+KHgBalPm0HSG3GJ4nARIZ+FB26ZX2f3Um0smXLlabFVDC3uNgmbDj87 X-Received: by 2002:a62:ea0d:0:b0:55f:8624:4d8b with SMTP id t13-20020a62ea0d000000b0055f86244d8bmr23177348pfh.74.1666426016864; Sat, 22 Oct 2022 01:06:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666426016; cv=none; d=google.com; s=arc-20160816; b=C1hd3AN/FkPuHvnxzdNLhTU/GAhf69y0qaIaiFmYvfN/2hYoZlaCeZoxGEua0eM1J7 5KhJBj82jO8PUeCM62aM9gFb91BAwyB4AVGKID4TtIinVTRtd8C/wUx75NVMCVZTrDSB NrF+t+f3ceLo+1Fvl+w9DTNrN8p6daiiAyyKkgQ1fYvleSXwes/AzGeijMSqIm0JdYgQ 7C4ysF5Debj/7gbNKSoInwMgTlr46h+BbGF3jhBlxtF7RbRVYtRqfUlmGZardioBQjKe iIgxBMHy2UC1kYwiSrN+MUIw1920Jp3uDWrSTvd45tIvpk3dbQOun/vB+bRwF+EyFfda Gk/g== 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=D4s/+2ZInGn0yzmeTsgVfFd9MJGcANUTJ7EWXecoe7s=; b=BSBVoCNKYWbvSG2doN/CiT4lY5nezTiNdIRXL5s3HTlDBuFapbIu1LZnFvJC/0FD8P 46Qby31JEsFCuz9ZpEL70j30hvdx/JPnjkdFYhAtsWdJLUAHSSy1gGCD5xvWkhgHa82X UNoQrGCfnp4GhI8Fit4gPlNhL4iC/VFCBgWRdZH4rkm7MmteU6MLjw8ryMPaYtG+ZsJR XMRIlaFhNKNKrXob6aEu0HDrW9QWCcyu95SujWwfhVR5hV2CYIEWzualvSeCXt/xMR+D OYDJPpwxW2b17Dn1CVkJQtzmteYtVXaREWZq22pR/skNOXqG1rPKGsbojejoLjkcRX3m R5kQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=cOhkFjvI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 h191-20020a6383c8000000b0046ade103856si26655065pge.308.2022.10.22.01.06.44; Sat, 22 Oct 2022 01:06: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=cOhkFjvI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S232422AbiJVIGV (ORCPT + 99 others); Sat, 22 Oct 2022 04:06:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39560 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232807AbiJVH75 (ORCPT ); Sat, 22 Oct 2022 03:59:57 -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 403D855C5E; Sat, 22 Oct 2022 00:50: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 8FDBD60ADD; Sat, 22 Oct 2022 07:50:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A4226C4347C; Sat, 22 Oct 2022 07:50:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425004; bh=0W0DPC96UQVJK7c3z8nHQBdkuOIdZZVm8tIXy8mpT1w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cOhkFjvIrsBQu4orvUc2maihudKUK2IMksQTsT67X1pnVwPONPikGh8jQ5Ae7OIc6 +FFieKXMxE0DfffcLUCgJN7E29bC0pu+PhH0iw7Q/gVh6xoFSVnBRaJ3TCLEA271Rp 3ysn660MPMkXKpURnbw0A7kMUQNRZ0ftGuKs9yOA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Biju Das , Geert Uytterhoeven , Sasha Levin Subject: [PATCH 5.19 355/717] arm64: dts: renesas: r9a07g044: Fix SCI{Rx,Tx} interrupt types Date: Sat, 22 Oct 2022 09:23:54 +0200 Message-Id: <20221022072511.772168721@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747374327102806097?= X-GMAIL-MSGID: =?utf-8?q?1747374327102806097?= From: Biju Das [ Upstream commit f3b7bc89c97b98aa6f157d5f296695af8940a5ac ] As per the latest RZ/G2L Hardware User's Manual (Rev.1.10 Apr, 2022), the interrupt type of SCI{Rx,Tx} is edge triggered. Signed-off-by: Biju Das Fixes: f9a2adcc9e908907 ("arm64: dts: renesas: r9a07g044: Add SCI[0-1] nodes") Link: https://lore.kernel.org/r/20220802101534.1401342-1-biju.das.jz@bp.renesas.com Signed-off-by: Geert Uytterhoeven Signed-off-by: Sasha Levin --- arch/arm64/boot/dts/renesas/r9a07g044.dtsi | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/arch/arm64/boot/dts/renesas/r9a07g044.dtsi b/arch/arm64/boot/dts/renesas/r9a07g044.dtsi index 3652e511160f..265140b20dad 100644 --- a/arch/arm64/boot/dts/renesas/r9a07g044.dtsi +++ b/arch/arm64/boot/dts/renesas/r9a07g044.dtsi @@ -394,8 +394,8 @@ compatible = "renesas,r9a07g044-sci", "renesas,sci"; reg = <0 0x1004d000 0 0x400>; interrupts = , - , - , + , + , ; interrupt-names = "eri", "rxi", "txi", "tei"; clocks = <&cpg CPG_MOD R9A07G044_SCI0_CLKP>; @@ -409,8 +409,8 @@ compatible = "renesas,r9a07g044-sci", "renesas,sci"; reg = <0 0x1004d400 0 0x400>; interrupts = , - , - , + , + , ; interrupt-names = "eri", "rxi", "txi", "tei"; clocks = <&cpg CPG_MOD R9A07G044_SCI1_CLKP>; From patchwork Sat Oct 22 07:23: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: 7440 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1098313wrr; Sat, 22 Oct 2022 01:10:23 -0700 (PDT) X-Google-Smtp-Source: AMsMyM43il/6a1BmW2eSVqVZ/wSiPQmqZkX/07XX7ayCLda9GI+HGbPUcL9zePovB4Myc1vQMjXE X-Received: by 2002:a63:5243:0:b0:43c:96a:8528 with SMTP id s3-20020a635243000000b0043c096a8528mr19419366pgl.47.1666426222947; Sat, 22 Oct 2022 01:10:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666426222; cv=none; d=google.com; s=arc-20160816; b=BJVUmQQYLllWaZJpUq3B3ZXQsQotOpqtVJDm2EENdGRNcFBxz4NyOL3Ao6mzevTjSF PhU2WHkdp5EbMoLDBpt/4gT6VJYtx6oCagaVUNMEigVe0GEhj81tNU9sjansdKHXb/41 33y0AnT3OuNeh10CGKGB49nEeMRMOusb0cdV1gqBXFDSKPScTj/C+2A/9vTENbsNMNJ2 XOOGbrJyd83UBJnLJ41GRcNuzW5kyCXG0mUKGDNlVX81xDB9hndSYaWsdXJkchjoGTTn c+2A/ZFo4qHhTo0nbhhi501nvwsytQaUZPsEXeHhZuWHh1PKxqtTgU/OkoocfFj35f8p 9B8w== 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=tT/5BeCtmidUnrCLzSkGCK4eSqYfyK43qBEGpDqPELE=; b=gnidOBzG4Xr7jlYPVbBwwT4OC0qcAbiBQ5U5vq2YVi1Dd4r4enKZRHhq9Rf5Q04enK JwqdJxHTY9WigzIYXKqRrkxzsjdB6sJMkD6l6BVMfl+LbPBCjZGFOky3c6N4INvw8Ptc I5/YpbJ93SAjIRQ66cc1EjQgBvC5GEFjKzXc/vZjai+hzxgWfXowa7V19C8+vbwgO7DI VMXeRF72CWGB8S5H7X+YHc34tnN2LfNZtdMCmYK1iwLjO9RmA7XlUeEfNzZxLWcr83pM qJmdPGYT9QhkQCeJoG3BCjzOH2KM+DiycfRlikKJwohBISVYfkflJVbMbhvzQuikd+5x ztcg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="OAd/8Xi6"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 t7-20020a655547000000b0044189a7cf37si30864952pgr.323.2022.10.22.01.10.09; Sat, 22 Oct 2022 01:10: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="OAd/8Xi6"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S233219AbiJVIJS (ORCPT + 99 others); Sat, 22 Oct 2022 04:09:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42706 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233147AbiJVIE7 (ORCPT ); Sat, 22 Oct 2022 04:04: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 6D3CF2D52C6; Sat, 22 Oct 2022 00:52: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 ams.source.kernel.org (Postfix) with ESMTPS id DABC6B82DB3; Sat, 22 Oct 2022 07:50:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4DC8BC433C1; Sat, 22 Oct 2022 07:50:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425006; bh=c1xY/qMcHNGfQqyM08AF1PaqbOnjTpK1gy3WE9ZEijM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OAd/8Xi6xgZLSZaHkNp8UYMl6k86Joi54CC607HfQ5n2Nui/eF9aMEIPuSANCQLmV YHxEjuTodU3y2M4i2rTOM9g8mq4A/G37jCGgwlcK11/NU10Bxp9ZMEwFfbWl3d9dWq o8r9CASzAryjyNcwexQIKvbFEccXKqLH3Gb+Fokg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Biju Das , Geert Uytterhoeven , Sasha Levin Subject: [PATCH 5.19 356/717] arm64: dts: renesas: r9a07g054: Fix SCI{Rx,Tx} interrupt types Date: Sat, 22 Oct 2022 09:23:55 +0200 Message-Id: <20221022072511.855347979@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747374543094074568?= X-GMAIL-MSGID: =?utf-8?q?1747374543094074568?= From: Biju Das [ Upstream commit 13dec051c7f139eef345c55a60941843e72128f1 ] As per the RZ/V2L Hardware User's Manual (Rev.1.00 Nov, 2021), the interrupt type of SCI{Rx,Tx} is edge triggered. Signed-off-by: Biju Das Fixes: 7c2b8198f4f321df ("arm64: dts: renesas: Add initial DTSI for RZ/V2L SoC") Link: https://lore.kernel.org/r/20220802101534.1401342-2-biju.das.jz@bp.renesas.com Signed-off-by: Geert Uytterhoeven Signed-off-by: Sasha Levin --- arch/arm64/boot/dts/renesas/r9a07g054.dtsi | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/arch/arm64/boot/dts/renesas/r9a07g054.dtsi b/arch/arm64/boot/dts/renesas/r9a07g054.dtsi index 4d6b9d7684c9..d0eeca4f6aa1 100644 --- a/arch/arm64/boot/dts/renesas/r9a07g054.dtsi +++ b/arch/arm64/boot/dts/renesas/r9a07g054.dtsi @@ -399,8 +399,8 @@ compatible = "renesas,r9a07g054-sci", "renesas,sci"; reg = <0 0x1004d000 0 0x400>; interrupts = , - , - , + , + , ; interrupt-names = "eri", "rxi", "txi", "tei"; clocks = <&cpg CPG_MOD R9A07G054_SCI0_CLKP>; @@ -414,8 +414,8 @@ compatible = "renesas,r9a07g054-sci", "renesas,sci"; reg = <0 0x1004d400 0 0x400>; interrupts = , - , - , + , + , ; interrupt-names = "eri", "rxi", "txi", "tei"; clocks = <&cpg CPG_MOD R9A07G054_SCI1_CLKP>; From patchwork Sat Oct 22 07:23: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: 7444 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1098369wrr; Sat, 22 Oct 2022 01:10:35 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7UrUkhlnf8mza+QTRdqjmH9LXdL2BEShNB7641YNjENUcbNRl8pR0gq0NgVuXWrYnf0+jY X-Received: by 2002:a17:902:f708:b0:178:9b70:310b with SMTP id h8-20020a170902f70800b001789b70310bmr22948531plo.65.1666426235267; Sat, 22 Oct 2022 01:10:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666426235; cv=none; d=google.com; s=arc-20160816; b=qqDdTb57GPSa0tCgOAtIOgfRBNThs6Hfsh8uL0484VkYay6/Z6+qcNs8qfWP/x6v+H HFuurKaZQW1QTvCPm1fIMU3iYry7/KMMOJB41cMGTlH1UW5tpD7XBULELTw8EG9PiA5r S/9dRLgdwENNP7pICX1dltUG7QaYag9tCOIfiPvgZ131kwOzBCm9wcT3gS+9RlgTG2Yg e10PtmH+k+D6Xe7LSwwnkpn96CTqKUhnZQF39iHF8nVvH+NRLvEwEE7XWH3UIXMejqK/ FYLTXRQ8CiJQ9zXbHus+evBaRCjDOQHdehpuSYkNt+5PlocPSo4+orPB7OrVfG+yC5+v rU0Q== 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=06NlYGXRDe7yST3NhZqq5zRJKwcUofngVLw+kJznSzg=; b=AVaJv7uzUeeLq2pNhx255vA8NQcUlXv+Lz3X+Yf0XDjoXjbhEjjVTelb0ig7e9ALiC TkixKqFxY9y/LM37Q2fqGAfT+5ea4ZEIpbdXv9CGR9b8AVM8U9zcEyIwqQS+Fb24NvoU nJX1Y2hyng/sIzPC8pSIzLcLbBTHgWeFA/5SX/fD96V4YFbloiQARczgKpb6MeHk6Ak6 Y6mz96SWfUOYtfbSnRqa1EobNM19rVnOiGbjjafFGRhXlTBUeX06DDOZyJmpwsJBrdPq bMRVq/1mo5YhW/d0ztuSLA4ttcFOR0HukTGigExig6FzZ3WEDW+YlIOv8IkQNMBucLWv tSpQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=rj0W9REf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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-20020a65538b000000b0045c398db4e6si28293724pgq.600.2022.10.22.01.10.21; Sat, 22 Oct 2022 01:10: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=rj0W9REf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S233247AbiJVIJZ (ORCPT + 99 others); Sat, 22 Oct 2022 04:09:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51602 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233190AbiJVIFJ (ORCPT ); Sat, 22 Oct 2022 04:05:09 -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 C36512C2AD2; Sat, 22 Oct 2022 00:52: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 78985B82E10; Sat, 22 Oct 2022 07:52:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 94620C433D6; Sat, 22 Oct 2022 07:52:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425123; bh=Q4JHJu+FS1cZcSaWDMVIpJu42fBheHX5lVnvNO+s2IA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rj0W9REfjslsVncivrFIPtUU/0ekkWCWNP1v96W5fnnvXavxApsRokmVrf7vHC1uo 65btLfGSVB0n4Fk0+rl/EAN+dPH57S15AooubfBUyXfHcDdoE/WU6/VncWgAgcJZTB j6B1GQruK4tz6c76v/8OV8s/rkMte7uJnMqK5muM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Biju Das , Geert Uytterhoeven , Sasha Levin Subject: [PATCH 5.19 357/717] arm64: dts: renesas: r9a07g043: Fix SCI{Rx,Tx} interrupt types Date: Sat, 22 Oct 2022 09:23:56 +0200 Message-Id: <20221022072511.919091215@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747374555696401334?= X-GMAIL-MSGID: =?utf-8?q?1747374555696401334?= From: Biju Das [ Upstream commit 72a482dbaec4b9e4d54b81be6bdb8c016fd2f4bd ] As per the RZ/G2UL Hardware User's Manual (Rev.1.00 Apr, 2022), the interrupt type of SCI{Rx,Tx} is edge triggered. Signed-off-by: Biju Das Fixes: cf40c9689e5109bf ("arm64: dts: renesas: Add initial DTSI for RZ/G2UL SoC") Link: https://lore.kernel.org/r/20220802101534.1401342-3-biju.das.jz@bp.renesas.com Signed-off-by: Geert Uytterhoeven Signed-off-by: Sasha Levin --- arch/arm64/boot/dts/renesas/r9a07g043.dtsi | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/arch/arm64/boot/dts/renesas/r9a07g043.dtsi b/arch/arm64/boot/dts/renesas/r9a07g043.dtsi index b31fb713ae4d..434ae73664a2 100644 --- a/arch/arm64/boot/dts/renesas/r9a07g043.dtsi +++ b/arch/arm64/boot/dts/renesas/r9a07g043.dtsi @@ -334,8 +334,8 @@ compatible = "renesas,r9a07g043-sci", "renesas,sci"; reg = <0 0x1004d000 0 0x400>; interrupts = , - , - , + , + , ; interrupt-names = "eri", "rxi", "txi", "tei"; clocks = <&cpg CPG_MOD R9A07G043_SCI0_CLKP>; @@ -349,8 +349,8 @@ compatible = "renesas,r9a07g043-sci", "renesas,sci"; reg = <0 0x1004d400 0 0x400>; interrupts = , - , - , + , + , ; interrupt-names = "eri", "rxi", "txi", "tei"; clocks = <&cpg CPG_MOD R9A07G043_SCI1_CLKP>; From patchwork Sat Oct 22 07:23: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: 7410 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1097428wrr; Sat, 22 Oct 2022 01:07:43 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7iSrz61MVeIr7ZV2IOOETEYb8Gv9kqvfIr5A2pliUxX3vj3N3jQf0WBsiN0CWqiKOiHLoy X-Received: by 2002:a17:903:181:b0:185:5696:97c2 with SMTP id z1-20020a170903018100b00185569697c2mr23157445plg.160.1666426063544; Sat, 22 Oct 2022 01:07:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666426063; cv=none; d=google.com; s=arc-20160816; b=Spq/CzaEtTZjPiuDKVXQ+HTy53YJfCZ/qcNjgJ3wDPrr3T934SiTZhuewnYplputJE Bi6IwL9zSYK3PI8upxqNHkr3RyA2+SiisNZGHSASkhUuAm4EP4NMmUxRjP4F+UsNneVE iYONFwki8dltuG5KSc+ShmMq2rqIB94RVW7BkwME8r+WFpXPYASPPFuOHTLg7kYxEilJ LauvkezL/AZo3AM/fAQAI3Pa5A7GE1D83SC41ZFipSCD3sWEvRVoyTHMXDvwKeGmdWNg w3VcG70jhUQM9EEE/+68tB45T4U943CR1bdzJk83H5Qw3QPWnLJbcvOT09JoT645ZAPj RPNA== 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=ftP7/47bL4D3cZB7ZTG0EdUYxGIF2/OGMuJXTM8t8hs=; b=pNPs7yBhYrr+n9MmpG/+EmR46KeBPRNsX4etXf9/6VjqIIMQRYN9kJtURg72QLIqKA eMD2JMsXUTHD80UNeGDG6YknptUrwOIHTr3PvzcV6GDDYfKa7ZZgis33gE+FtNzR+Hha yh2cyithzKpkPNSc6zvMH4Rb366EjMSJyRr7wsQaMsnVZcnWsMfrZafe8JrvO/HmymDp 2vBaBMGocjMuyc3z0rQTz3GVlFLhKsT4HP+OFuxTqlkdLJTyYy8eT1a650KrlMUdXslw FjVJOXRB4wyJ2DCkHXn3tiwAWs3OmcKEM891TNHaQDV1b6Fc6T9Mc1BBZBDViitYPqR3 TO7A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=IWyCT6lL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 d14-20020a17090ad3ce00b001f31f339134si1834807pjw.152.2022.10.22.01.07.30; Sat, 22 Oct 2022 01:07: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=IWyCT6lL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S232907AbiJVIHL (ORCPT + 99 others); Sat, 22 Oct 2022 04:07:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39544 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232302AbiJVIA4 (ORCPT ); Sat, 22 Oct 2022 04:00: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 72FA9269092; Sat, 22 Oct 2022 00:50: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 CF6E0B82E1C; Sat, 22 Oct 2022 07:50:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4BD5DC433C1; Sat, 22 Oct 2022 07:50:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425028; bh=av6IIo9dQWWrz+gy2p6l7x7pffWvKphYgpbV9re8afE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IWyCT6lLSQma5kOPRg2d9VZNYF9K/Y2aupsJQM8VvestievJbqu0ofqK4VgTF29xd Q85ozAlMtf+Dn/8A3eWebWS1DljwXBadX/FJxhZrSoIhsvIyMEjvcCaAAKI+Fl03Ev TMmVmy7Q3wQ09N5HBHV534ArfuRFj3pRyDW6VJFs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Chanho Park , Krzysztof Kozlowski , Chanwoo Choi , Sasha Levin Subject: [PATCH 5.19 358/717] dt-bindings: clock: exynosautov9: correct clock numbering of peric0/c1 Date: Sat, 22 Oct 2022 09:23:57 +0200 Message-Id: <20221022072512.006484747@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747374376053164910?= X-GMAIL-MSGID: =?utf-8?q?1747374376053164910?= From: Chanho Park [ Upstream commit b6740089b740b842d5e6ff55b4b2c3bf5961c69a ] There are duplicated definitions of peric0 and peric1 cmu blocks. Thus, they should be defined correctly as numerical order. Fixes: 680e1c8370a2 ("dt-bindings: clock: add clock binding definitions for Exynos Auto v9") Signed-off-by: Chanho Park Reviewed-by: Krzysztof Kozlowski Acked-by: Chanwoo Choi Signed-off-by: Krzysztof Kozlowski Link: https://lore.kernel.org/r/20220727021357.152421-2-chanho61.park@samsung.com Signed-off-by: Sasha Levin --- .../dt-bindings/clock/samsung,exynosautov9.h | 56 +++++++++---------- 1 file changed, 28 insertions(+), 28 deletions(-) diff --git a/include/dt-bindings/clock/samsung,exynosautov9.h b/include/dt-bindings/clock/samsung,exynosautov9.h index ea9f91b4eb1a..a7db6516593f 100644 --- a/include/dt-bindings/clock/samsung,exynosautov9.h +++ b/include/dt-bindings/clock/samsung,exynosautov9.h @@ -226,21 +226,21 @@ #define CLK_GOUT_PERIC0_IPCLK_8 28 #define CLK_GOUT_PERIC0_IPCLK_9 29 #define CLK_GOUT_PERIC0_IPCLK_10 30 -#define CLK_GOUT_PERIC0_IPCLK_11 30 -#define CLK_GOUT_PERIC0_PCLK_0 31 -#define CLK_GOUT_PERIC0_PCLK_1 32 -#define CLK_GOUT_PERIC0_PCLK_2 33 -#define CLK_GOUT_PERIC0_PCLK_3 34 -#define CLK_GOUT_PERIC0_PCLK_4 35 -#define CLK_GOUT_PERIC0_PCLK_5 36 -#define CLK_GOUT_PERIC0_PCLK_6 37 -#define CLK_GOUT_PERIC0_PCLK_7 38 -#define CLK_GOUT_PERIC0_PCLK_8 39 -#define CLK_GOUT_PERIC0_PCLK_9 40 -#define CLK_GOUT_PERIC0_PCLK_10 41 -#define CLK_GOUT_PERIC0_PCLK_11 42 +#define CLK_GOUT_PERIC0_IPCLK_11 31 +#define CLK_GOUT_PERIC0_PCLK_0 32 +#define CLK_GOUT_PERIC0_PCLK_1 33 +#define CLK_GOUT_PERIC0_PCLK_2 34 +#define CLK_GOUT_PERIC0_PCLK_3 35 +#define CLK_GOUT_PERIC0_PCLK_4 36 +#define CLK_GOUT_PERIC0_PCLK_5 37 +#define CLK_GOUT_PERIC0_PCLK_6 38 +#define CLK_GOUT_PERIC0_PCLK_7 39 +#define CLK_GOUT_PERIC0_PCLK_8 40 +#define CLK_GOUT_PERIC0_PCLK_9 41 +#define CLK_GOUT_PERIC0_PCLK_10 42 +#define CLK_GOUT_PERIC0_PCLK_11 43 -#define PERIC0_NR_CLK 43 +#define PERIC0_NR_CLK 44 /* CMU_PERIC1 */ #define CLK_MOUT_PERIC1_BUS_USER 1 @@ -272,21 +272,21 @@ #define CLK_GOUT_PERIC1_IPCLK_8 28 #define CLK_GOUT_PERIC1_IPCLK_9 29 #define CLK_GOUT_PERIC1_IPCLK_10 30 -#define CLK_GOUT_PERIC1_IPCLK_11 30 -#define CLK_GOUT_PERIC1_PCLK_0 31 -#define CLK_GOUT_PERIC1_PCLK_1 32 -#define CLK_GOUT_PERIC1_PCLK_2 33 -#define CLK_GOUT_PERIC1_PCLK_3 34 -#define CLK_GOUT_PERIC1_PCLK_4 35 -#define CLK_GOUT_PERIC1_PCLK_5 36 -#define CLK_GOUT_PERIC1_PCLK_6 37 -#define CLK_GOUT_PERIC1_PCLK_7 38 -#define CLK_GOUT_PERIC1_PCLK_8 39 -#define CLK_GOUT_PERIC1_PCLK_9 40 -#define CLK_GOUT_PERIC1_PCLK_10 41 -#define CLK_GOUT_PERIC1_PCLK_11 42 +#define CLK_GOUT_PERIC1_IPCLK_11 31 +#define CLK_GOUT_PERIC1_PCLK_0 32 +#define CLK_GOUT_PERIC1_PCLK_1 33 +#define CLK_GOUT_PERIC1_PCLK_2 34 +#define CLK_GOUT_PERIC1_PCLK_3 35 +#define CLK_GOUT_PERIC1_PCLK_4 36 +#define CLK_GOUT_PERIC1_PCLK_5 37 +#define CLK_GOUT_PERIC1_PCLK_6 38 +#define CLK_GOUT_PERIC1_PCLK_7 39 +#define CLK_GOUT_PERIC1_PCLK_8 40 +#define CLK_GOUT_PERIC1_PCLK_9 41 +#define CLK_GOUT_PERIC1_PCLK_10 42 +#define CLK_GOUT_PERIC1_PCLK_11 43 -#define PERIC1_NR_CLK 43 +#define PERIC1_NR_CLK 44 /* CMU_PERIS */ #define CLK_MOUT_PERIS_BUS_USER 1 From patchwork Sat Oct 22 07:23:58 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 7423 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1097733wrr; Sat, 22 Oct 2022 01:08:34 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6j25wjtmay133HSSHW7BDLGDdsCn59wgt1s7OnoK3e/gNucq5PTPY7uogEvtKOMe3Omo4c X-Received: by 2002:a17:90a:4bcb:b0:212:def0:cb00 with SMTP id u11-20020a17090a4bcb00b00212def0cb00mr3135757pjl.61.1666426114272; Sat, 22 Oct 2022 01:08:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666426114; cv=none; d=google.com; s=arc-20160816; b=KFeB4CjAF47crxL7R4yYptYaPjf+OoeXXBYGDzxXaQC3+ZiYTR3jliKVXpk9RsoaSQ qrBDDWzfWMzsI/S/JHVS9totDh0iFQcOUnJHis5CmgMM85DPu76yIdLPY/pGxqwUjhwj crFW9TWeo2a+F64VugLOtVFk1QjU4nmHwSpVc9AYxs8Hq6I6dt8BhTVn9VBlF2OzeNnx TxWjNFX5Qgo0YUIXYMMZjG0iN0DcwN1/TkEPDkaltefF9T6Rh9UfIWOZkNuP5NoAcCjg 4NESUfiKZ6pzi+iyNfudjli9BJgI5JOxt7W9QJOLtr7P/Ke79ztIl5VZuT6yz2tWpsVm A08w== 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=h+a5YAgccLkR7dyR8q9IlortEJc9AweQhhTpFOXjWrc=; b=QZgB3JBgHULpYQ8i2Iz53mYmVuPhISVKv/Q1GR4hiq8s7q/EbUsjqzW9wcxbnT62jY 21S1xVg4Bk6lAwOVHCmi30QujMrlYq0v+NLk/nqRawYN6ApAY6rJfraEBjPcM87Yxdnp oCC4ce0tDOkyW1qNV9q5D2U8gyq09v3U8Jr7xYouBlELvbAAypyAyKkn2P4z3H5UxGJ+ yYGXTlUN6v5EyRYpCITqvdpO3Gws3uT4LgBImD800rxtCemXZAF7gKLBePgJnNZWfw+a R2aLG6fxpG8QGyS+4h85UZzrcvEriRmnNiZ8IfPgsBqz/NMM+flsNiS0v0sJcPzY+PZI Khag== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=BHk1wcLl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 b13-20020a6541cd000000b00461ec258b85si28125451pgq.566.2022.10.22.01.08.21; Sat, 22 Oct 2022 01:08: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=BHk1wcLl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S233015AbiJVIIB (ORCPT + 99 others); Sat, 22 Oct 2022 04:08:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57840 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232810AbiJVIEP (ORCPT ); Sat, 22 Oct 2022 04:04:15 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9B5522CE62E; Sat, 22 Oct 2022 00:51: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 C7772B82E25; Sat, 22 Oct 2022 07:51:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B4A7AC433C1; Sat, 22 Oct 2022 07:50:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425060; bh=WmmLy4E8An3OoQIhgPyQEWi6R0z+s9ZmI4f2V31hoR8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BHk1wcLlDBgNVhqxJt3z5BmiQ3Lja12lxUzxyq/NCSxSnQswJA//oeR8lJS/A2pox +FOscGXeBxTqUUAhvbaiKTL0MCBq+TmzygUDXs/Hv3CZCnoA0vxP0iSni74ffLg+5L l9a3s52KvlRoKAm0VwJvpL7Fk63Hp3bCHyvdijd0= 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 5.19 359/717] ARM: dts: turris-omnia: Fix mpp26 pin name and comment Date: Sat, 22 Oct 2022 09:23:58 +0200 Message-Id: <20221022072512.073781286@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747374429378053112?= X-GMAIL-MSGID: =?utf-8?q?1747374429378053112?= 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 f4878df39753..487dece2033c 100644 --- a/arch/arm/boot/dts/armada-385-turris-omnia.dts +++ b/arch/arm/boot/dts/armada-385-turris-omnia.dts @@ -478,7 +478,7 @@ marvell,function = "spi0"; }; - spi0cs1_pins: spi0cs1-pins { + spi0cs2_pins: spi0cs2-pins { marvell,pins = "mpp26"; marvell,function = "spi0"; }; @@ -513,7 +513,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 Sat Oct 22 07:23: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: 7508 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1104988wrr; Sat, 22 Oct 2022 01:33:51 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4xLUWdR/OPi+ZO3Lepa4RLe/mL8ynNOsrc8Tb6jiXMREmZIUcCQT+EtSRJ+voiArZz/y4P X-Received: by 2002:a63:1d0f:0:b0:46e:e211:5433 with SMTP id d15-20020a631d0f000000b0046ee2115433mr716541pgd.324.1666427631094; Sat, 22 Oct 2022 01:33:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666427631; cv=none; d=google.com; s=arc-20160816; b=pomqQbwjz7i79eZk3hZrP0HpemaSBsLLdnSB3fvaApsIV6lElh1wjGygMJ2dKG9qLf b8vmiNw2hOzAqG+6i3QNyunBYJHnfCf+fe2SD+yDLifyi0eKvLlEwlsJUwGp8uyjxCPZ +t/4y8XWpm7z5OKdHudEkNG3a6mgD+NVa/SEzlLByanUdjHSCxT/j8bJanxva9PVu62t BCefjsGfQIbaca262dfZeq48kabIKUopttguGWi+sEG9xYRfgB//UOH7T4ZmKnsoXs+V Hccq70du9mUYMhl/lfjn/RfZmEkL4pR1o89wzngtEluOEKwVMEylnMvZikwombfqXUwF 1LQg== 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=k+JnyXveQseUUrN6Bxb/JpCy8OMVY+mawOR/4KbDIwfybuVYOHiRuaAGXnavX1cXCH OA07icOSHCIxpQkN4tms8x/xPOweuDopLZRZrPHkjMHK7jk4BCHdBdagly8r+3KkmamW cMCW0CM32g+7BQt3Bn/QM/vYYURX8cC2kzyO542gilfWKGon4Ns6SjviRqtUb4cOhn6J M5jd9nipMEeOKbiBYJfTCYB1eTIQ7JoP+addFN9D26QT41FgAU9jqbvW7qzu+NUYzKAX rFi6u2BvMQaJwYBkBeeah4Eer7wBMtZLm1ZyavOq0YAABCxgHZt5aShrpe3Pf79PB8L9 zAXw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="KgRiq/Xf"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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-20020a17090a459400b0020b127afe7dsi1985989pjg.70.2022.10.22.01.33.33; Sat, 22 Oct 2022 01:33: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="KgRiq/Xf"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S233486AbiJVIUK (ORCPT + 99 others); Sat, 22 Oct 2022 04:20:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48884 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233395AbiJVISX (ORCPT ); Sat, 22 Oct 2022 04:18:23 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D84432DD78D; Sat, 22 Oct 2022 00:57: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 E1DB060B28; Sat, 22 Oct 2022 07:51:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CC667C433D6; Sat, 22 Oct 2022 07:51:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425094; bh=BBEZSL/kEaLKT0nn3CDJDaoaCe8MaFX+1kU7JZ+z9Ck=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KgRiq/XfINKJGQKX+dpteipttJAqA4u+POBmo0NcXj88yzDUMouSONZls4j08p32o 1HmbgRYJVDVjwn6Z4bNlb797y4clwT3abdVbSZtZdt10dK0U67W2kS/0vYCQA5GlSg IEc620PyvwIt+BkBQUEwhmHlhNTicbptd4x82EbE= 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 5.19 360/717] ARM: dts: kirkwood: lsxl: fix serial line Date: Sat, 22 Oct 2022 09:23:59 +0200 Message-Id: <20221022072512.135209312@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376019698171234?= X-GMAIL-MSGID: =?utf-8?q?1747376019698171234?= 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 Sat Oct 22 07:24: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: 7708 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1109459wrr; Sat, 22 Oct 2022 01:48:38 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5lGj4kVa/+9SAfBOerDMaywZsL+HOIE65t9mVMMwozVHNp4tR79k0TLIROO04kAu+hc2H3 X-Received: by 2002:a05:6402:b5a:b0:458:f4c6:8039 with SMTP id bx26-20020a0564020b5a00b00458f4c68039mr21284034edb.349.1666428518697; Sat, 22 Oct 2022 01:48:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666428518; cv=none; d=google.com; s=arc-20160816; b=i/jae0wpfNZMoKNB22gO0orp4Ej1UcSvYG45VJZLNURIVVx8lcmfivZ3025MkWo6pO 0sOv5Pw7GZnUjRR10icI+uvRVpGXfJHrd2FH0+sILpp6Q7JcL4hVa4PWQL0XZhme/iZp ouKiJ1vHwE+fGFBpVDx5tTdHZUn+HzCCmraR4jnOLsUgxE8nZK1BaCwaJs4KiEbI0Y9d 8PSxvULWbvgir+6M+Hup+wlojY5FQg0AuA/oZAe6eq9iqd10oVAKL4q+N3i+wMzZVLGN b6j2c5bxv78r2YKrIl9GhIb/xDgbWVXdYrZZNLINX2OlrxAifpZ3f1wdDzQfYgiychmi fRQw== 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=k2ly98YlK9qJjmmWSL6uolhflSVClvkBfLaBkCZ7HtqA0dVEHBGZWiVceh/nVOJu1H 30qernYKLiUVvVQluAArVuCoAUaHRiKfYlsfIXqmL0KJ0q6zEzDoa/FRvKSe+Pq7my/G 3QPhc68kfhbLR9SV2x15zLqTdc3j5CtvD7vSHyyFYaQcYWS7H5+ocnkmxZ4A3R4on2w2 21WAA3UBN/jOmJfhurVfGcEDqoZOBWyc+VJkjfAsEOO0ddR4n8Nr9GUdt6WmPp7rsS33 G/ID0QjP0YIm2BMJuzS/mkBUHyWbTfeHjec2tdY+cRsomz3SDcLJGXBtUqzWyQscOALO fcmA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=orCeGXA7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 sd42-20020a1709076e2a00b0078dcdbb3e87si22718196ejc.530.2022.10.22.01.48.14; Sat, 22 Oct 2022 01:48: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=orCeGXA7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S234759AbiJVIrq (ORCPT + 99 others); Sat, 22 Oct 2022 04:47:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46714 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235048AbiJVIoV (ORCPT ); Sat, 22 Oct 2022 04:44:21 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D1F572EBBA0; Sat, 22 Oct 2022 01:08: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 449C560ACE; Sat, 22 Oct 2022 07:51:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 568EDC4347C; Sat, 22 Oct 2022 07:51:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425105; bh=RLkQdPDMRCOU/IECOAC2hHaLhoeqjEyfi9vzRWGTaUE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=orCeGXA7Dd4dJLO5xrORmJLTZlOgFzJ1At3uhE2a8TEdYM60qBvAeFR+VqMFOeMSo 3vRfvnRY08Zj9zAp/MHT0OGZfHIfVi9KXTBZ5dEnzaB4bne47l9KhF8H7Qn8uYPxj3 53IDyX3Og2fSdclPQpVbWQxShK917okYsgjW4W2E= 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 5.19 361/717] ARM: dts: kirkwood: lsxl: remove first ethernet port Date: Sat, 22 Oct 2022 09:24:00 +0200 Message-Id: <20221022072512.209230122@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376950208173649?= X-GMAIL-MSGID: =?utf-8?q?1747376950208173649?= 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 Sat Oct 22 07:24: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: 7442 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1098345wrr; Sat, 22 Oct 2022 01:10:29 -0700 (PDT) X-Google-Smtp-Source: AMsMyM42ErCLRQB4ZJnSNBEQe75mzP6LBN0ero1nycebB64NreA6A/JSdsSgVqPJ+LUEFuXtnTin X-Received: by 2002:a17:90b:254b:b0:200:a860:5bf9 with SMTP id nw11-20020a17090b254b00b00200a8605bf9mr61129829pjb.176.1666426218752; Sat, 22 Oct 2022 01:10:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666426218; cv=none; d=google.com; s=arc-20160816; b=vaGMf1Cqg097ywhl1332E6rm4XIhXXjLaia0+GnQ4s6Ubb0SOFpSA1MUIVY1Gi8UGC oKC2cf3E9iquog/7ocOD0QZaZLeg/RUqy+AUaw8jo5PEuELjeU/y6g+KylmKYKeh86sM g6edeSP0OQfIreNJ2Kn1trYYEMY2gQ5v3ZCineoKYyq5O5gS95XYp/T2A0Z8SHgL8o98 IfIf9U4ZebuqqLzb9G0oDrY3fYtRilAfKnscSOood1301AFgA4j709RnnXfBpTS6Eq7N DLYBrGIObM7k5oGJee39dBBAEzNNCuIdUND33rQLsVv3A7os/tUGGoQc4X9ndmlIEdu1 oDxQ== 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=pkrMs2rdLhuQgKq4b+2NrXu9jWtiCntCVFsB62B/Fvs=; b=ulQih2/jUbZC9H32bTK5SZpBYCiXfjj3h6EmHRtcTfMaYcWRdgqZxT0ll24L72rFSA bh5wLVGPo3n6/MC399w+EmkcLo9kjZ4pjqQe21NjL1wExYpOShpVZnDT0SijSp7WGevM cFL08aoXgit3cGR6+UaENUkl6jVQH+Qu589xFnhkeNJ7j4Jsi1v6cE1xL1fPejDsQjKt NnsbwoyZIanfBl+HC7Y0Kh60UOGa6ANXghEOWKRw7j7wOd7EfoDk7jDAxwEn2Bfk3Lp/ tviNOV03i//H090XQ2xf+S+werU6ZYNLD5IiM1yWCSkffQso9ArcGue5Lo9ThN+SxayL ASpw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=V9JVKIKo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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-20020a056a0002c600b0056615a18b20si25311922pft.250.2022.10.22.01.10.05; Sat, 22 Oct 2022 01:10: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=V9JVKIKo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S232915AbiJVIIj (ORCPT + 99 others); Sat, 22 Oct 2022 04:08:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42350 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233019AbiJVIEj (ORCPT ); Sat, 22 Oct 2022 04:04: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 8AB402D37FC; Sat, 22 Oct 2022 00:52: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 E5C6460B80; Sat, 22 Oct 2022 07:51:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CF531C433D7; Sat, 22 Oct 2022 07:51:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425108; bh=3i1Ed3bk0XkELjKa8ysuyW1Wad/0dMDZaLkwWHH547Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=V9JVKIKov24Hr0ly3q1g9QhO1x4GsGtaCq07Adl/Bc6BNIITo8+0xkGqoK0nHLUNV kG7OLzauQzoDE/JrPpwYfcKG3N6tmgFAC8YwxzxLSjPsolbxfkDVQeF+yiv6pfyS+w 6Ttv22+D8LDNULEf1KjLV8ThsPG7QjIE2hVrAv4U= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, kernel test robot , Randy Dunlap , Dan Williams , Ben Widawsky , Jonathan Cameron , linux-ia64@vger.kernel.org, Arnd Bergmann , Keith Mannthey , Andrew Morton , Sasha Levin Subject: [PATCH 5.19 362/717] ia64: export memory_add_physaddr_to_nid to fix cxl build error Date: Sat, 22 Oct 2022 09:24:01 +0200 Message-Id: <20221022072512.283950772@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747374538872754943?= X-GMAIL-MSGID: =?utf-8?q?1747374538872754943?= From: Randy Dunlap [ Upstream commit 97c318bfbe84efded246e80428054f300042f110 ] cxl_pmem.ko uses memory_add_physaddr_to_nid() but ia64 does not export it, so this causes a build error: ERROR: modpost: "memory_add_physaddr_to_nid" [drivers/cxl/cxl_pmem.ko] undefined! Fix this by exporting that function. Fixes: 8c2676a5870a ("hot-add-mem x86_64: memory_add_physaddr_to_nid node fixup") Reported-by: kernel test robot Signed-off-by: Randy Dunlap Cc: Dan Williams Cc: Ben Widawsky Cc: Jonathan Cameron Cc: linux-ia64@vger.kernel.org Cc: Arnd Bergmann Cc: Keith Mannthey Cc: Andrew Morton Signed-off-by: Arnd Bergmann Signed-off-by: Sasha Levin --- arch/ia64/mm/numa.c | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/ia64/mm/numa.c b/arch/ia64/mm/numa.c index d6579ec3ea32..4c7b1f50e3b7 100644 --- a/arch/ia64/mm/numa.c +++ b/arch/ia64/mm/numa.c @@ -75,5 +75,6 @@ int memory_add_physaddr_to_nid(u64 addr) return 0; return nid; } +EXPORT_SYMBOL(memory_add_physaddr_to_nid); #endif #endif From patchwork Sat Oct 22 07:24: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: 7647 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1107765wrr; Sat, 22 Oct 2022 01:42:01 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7FVkQrBpCayS63EXZYd+E3WFxuGqhMwU/b5vO9MqKICWUeCEJNBJpFYVuOve1AyRTTxLur X-Received: by 2002:a17:907:7244:b0:78d:cedc:7a9e with SMTP id ds4-20020a170907724400b0078dcedc7a9emr18848837ejc.600.1666428121010; Sat, 22 Oct 2022 01:42:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666428121; cv=none; d=google.com; s=arc-20160816; b=TNWg/NAjB30jnDjkqHcoAPNMSDd/X9/0SMz/a5NvyCctuq20qwmdTdCG2pxrkD+DM5 9tAdNRpS96K/YB+RKv1L3vj4rvnypRGjFihl7YsSz0lc2MBhIL1X6DPwNkY1d9y7Fjv3 htmksvVb/mCBZmGJZkm3GTjUoH8oGqY0E7oVpOBv0Fflvn1cTepVKkrLHaZYK1oIG0fl IPA9tffsDNF1g2MoaXS+NCyvnayU6LXfFrgHRBqLLQxX5eC8KdvcLmUrPR40DA3Afh1M goJW0BLQmZlL2toTxK/h6tpMK1rmoVj1xgaoh+PtRoHWGY0sCwzVOqmlTdqKOE1lRd1D /EXQ== 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=cZ7RgpCuSZ5qwstItwTGUw/LkawfrvTGgQvyyWQhkjU=; b=xmcMjw8G9c9i4/NQiIlclnkeDDx1BcG4ZeDoynSowxd/7f8KN3Ar4AKKGqFDXe9LPf /wtrWDIlBpXgFB+pk6pLNuT7mL5KnBmvcgxAlIuaXxTBjW4ojWzYzFrODft1SDDoQhCy ADE6wyg8x7fq2uiusexgmE2SfiYgZlHLYglSNNqGgGoKpWQcG1WEQM2M8KLJdOh/FwuJ RhAesJ1pGsYokf95/qiHhtVAoTraAdpmo15i58zDC5z6iRQW2ElITPfyeKMjeC8wpjKn AQTs1atwg2oW191V6J/82DqHuAAwXVkB9fskiGhkoEDFgc7K4L8E0sOsu2icJulob5aJ gL6A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=A3YyxOnp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 qa6-20020a170907868600b007836ec6999dsi23497891ejc.904.2022.10.22.01.41.33; Sat, 22 Oct 2022 01:42: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=A3YyxOnp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S234352AbiJVIha (ORCPT + 99 others); Sat, 22 Oct 2022 04:37:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58030 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233880AbiJVIbh (ORCPT ); Sat, 22 Oct 2022 04:31: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 2A4312E5E13; Sat, 22 Oct 2022 01:03: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 9288360B49; Sat, 22 Oct 2022 07:51:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A5FACC433C1; Sat, 22 Oct 2022 07:51:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425111; bh=L07KiKZDECLETthVLMJmTtvE8NKrJZSQVDnbc0zkDzs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=A3YyxOnpUgZxpvED4kztSAWk62qIpa1DqLEhG7rswgsnioBFWYFJyFH4GPCiuxty1 iZ6KDF/IvASIci7HE44oR4WSs54TJ+uY7h0R4H81JM91see21tqi/28p6eJ9f9CmI0 Za/RfvECiaQZcE4LJ73hRsffvA0hX4QvUZaTPSn0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Necip Fazil Yildiran , Dmitry Osipenko , Sasha Levin Subject: [PATCH 5.19 363/717] soc/tegra: fuse: Drop Kconfig dependency on TEGRA20_APB_DMA Date: Sat, 22 Oct 2022 09:24:02 +0200 Message-Id: <20221022072512.378187134@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376533277302294?= X-GMAIL-MSGID: =?utf-8?q?1747376533277302294?= From: Dmitry Osipenko [ Upstream commit 2254182807fc09ba9dec9a42ef239e373796f1b2 ] The DMA subsystem could be entirely disabled in Kconfig and then the TEGRA20_APB_DMA option isn't available too. Hence kernel configuration fails if DMADEVICES Kconfig option is disabled due to the unsatisfiable dependency. The FUSE driver isn't a critical driver and currently it only provides NVMEM interface to userspace which isn't known to be widely used, and thus, it's fine if FUSE driver fails to load. Let's remove the erroneous Kconfig dependency and let the FUSE driver to fail the probing if DMA is unavailable. Fixes: 19d41e5e9c68 ("soc/tegra: fuse: Add APB DMA dependency for Tegra20") Reported-by: Necip Fazil Yildiran Link: https://bugzilla.kernel.org/show_bug.cgi?id=209301 Signed-off-by: Dmitry Osipenko Signed-off-by: Sasha Levin --- drivers/soc/tegra/Kconfig | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/soc/tegra/Kconfig b/drivers/soc/tegra/Kconfig index 5725c8ef0406..6f601227da3c 100644 --- a/drivers/soc/tegra/Kconfig +++ b/drivers/soc/tegra/Kconfig @@ -136,7 +136,6 @@ config SOC_TEGRA_FUSE def_bool y depends on ARCH_TEGRA select SOC_BUS - select TEGRA20_APB_DMA if ARCH_TEGRA_2x_SOC config SOC_TEGRA_FLOWCTRL bool From patchwork Sat Oct 22 07:24: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: 7431 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1098283wrr; Sat, 22 Oct 2022 01:10:19 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6ZDKQLUSLErEHR4VFUNK77ZfzUV57Ixk+JyDFuKklB+TZnGcRnyDFEOtMCNdnXzaUtNVrz X-Received: by 2002:aa7:88c4:0:b0:563:9fe9:5da9 with SMTP id k4-20020aa788c4000000b005639fe95da9mr23198813pff.41.1666426218750; Sat, 22 Oct 2022 01:10:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666426218; cv=none; d=google.com; s=arc-20160816; b=i23KmLEQg52ZJb6Cp1S5yykMSd7awsFn7JokXYKNqwl9mLG7xRqqMnyzmqHL9sknpr yQiOPFEk5C503DXo2sPeP9FRkF2go+BOuXc2FFKomNfwW0+SB3mryuGEQc0kVpywVmbz rrs7jMx/6HV2VStbKGrEM2q9gY+We2ozloKT9r+7pBI408g+rf6EI7kmdQcwBRmi/cNZ Mldg0/XTLV7FlX8g9tti6lgOQeZ7nSUMd+awXX4N3ouIdi9yZZCRqqHt7ZQc01HpUHST 7tDL15mRyjvs2HLpTexVmtiVsGoMQENLpLJ09EJOhtj0sBmVPvQwJoWX2QexO7xr/MxF pfJA== 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=uJqiSsJwzkO5urx1UieP6vufcgUH8giwbC32mgqCAAk=; b=BydL1p2zc3GmpP0lqlBK7xSSkYftivBVi20fiLIK8mz+XyNF4BPVt9BQ7goPwIVFoq W0usPbpU/g0fnd9lshk17YNH8Tq0CIhgRXOUAo0h974LTkx+t3jz1Fx0apBJl5QyT0xf ql3hGYpfQ5/j2OKOr+1dRr/CMVSU8EmlSZNDCSKZ0+WEP7yOnExfWLkvButUm1TuagkT VpB2/TaqrlItrBeVyyzyT95adedJcgPG5sIaFvLwXHAb2RMPr6fD9z9dewKpftJLEcwn 5Gw98MJ2aHJh38BICIYzZELiuk1NpEk3wlKryOqz3sIISbYqSVdXgYq+hFcYhKSKICUA prVA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=RVznnhEi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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-20020a170902788600b001782da3312asi25953757pll.299.2022.10.22.01.10.05; Sat, 22 Oct 2022 01:10: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=RVznnhEi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S233114AbiJVII6 (ORCPT + 99 others); Sat, 22 Oct 2022 04:08:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58556 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233070AbiJVIEr (ORCPT ); Sat, 22 Oct 2022 04:04:47 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B50982C5691; Sat, 22 Oct 2022 00:52: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 9821160AFA; Sat, 22 Oct 2022 07:51:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6EE39C433C1; Sat, 22 Oct 2022 07:51:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425114; bh=k/0uoSHWawpsg9nFOcifCvqikP2Riu3JdAP2ZeH8ki8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RVznnhEigNrZIvONi9tNhZzMM4dZexSAAwnD8s955RpXTPSqZeEL4/Q4TIBkf1DEm QJQ4yBa/1+dX7txEoCOotsQ3ES+L15958EFzBy/01BoG+jk9o+EB2afGSZmW3zVidg eM+w3gy2SY9edROcvGab3QNZfK6qClSZzLLTJAlw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Matt Ranostay , Vignesh Raghavendra , Vaishnav Achath , Sasha Levin Subject: [PATCH 5.19 364/717] arm64: dts: ti: k3-j7200: fix main pinmux range Date: Sat, 22 Oct 2022 09:24:03 +0200 Message-Id: <20221022072512.557784295@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747374538808088258?= X-GMAIL-MSGID: =?utf-8?q?1747374538808088258?= From: Matt Ranostay [ Upstream commit 0d0a0b4413460383331088b2203ba09a6971bc3a ] Range size of 0x2b4 was incorrect since there isn't 173 configurable pins for muxing. Additionally there is a non-addressable region in the mapping which requires splitting into two ranges. main_pmx0 -> 67 pins main_pmx1 -> 3 pins Fixes: d361ed88455f ("arm64: dts: ti: Add support for J7200 SoC") Signed-off-by: Matt Ranostay Signed-off-by: Vignesh Raghavendra Tested-by: Vaishnav Achath Link: https://lore.kernel.org/r/20220919205723.8342-1-mranostay@ti.com Signed-off-by: Sasha Levin --- arch/arm64/boot/dts/ti/k3-j7200-common-proc-board.dts | 10 ++++++---- arch/arm64/boot/dts/ti/k3-j7200-main.dtsi | 11 ++++++++++- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/arch/arm64/boot/dts/ti/k3-j7200-common-proc-board.dts b/arch/arm64/boot/dts/ti/k3-j7200-common-proc-board.dts index 121975dc8239..7e8552fd2b6a 100644 --- a/arch/arm64/boot/dts/ti/k3-j7200-common-proc-board.dts +++ b/arch/arm64/boot/dts/ti/k3-j7200-common-proc-board.dts @@ -134,15 +134,17 @@ >; }; - main_usbss0_pins_default: main-usbss0-pins-default { + vdd_sd_dv_pins_default: vdd-sd-dv-pins-default { pinctrl-single,pins = < - J721E_IOPAD(0x120, PIN_OUTPUT, 0) /* (T4) USB0_DRVVBUS */ + J721E_IOPAD(0xd0, PIN_OUTPUT, 7) /* (T5) SPI0_D1.GPIO0_55 */ >; }; +}; - vdd_sd_dv_pins_default: vdd-sd-dv-pins-default { +&main_pmx1 { + main_usbss0_pins_default: main-usbss0-pins-default { pinctrl-single,pins = < - J721E_IOPAD(0xd0, PIN_OUTPUT, 7) /* (T5) SPI0_D1.GPIO0_55 */ + J721E_IOPAD(0x04, PIN_OUTPUT, 0) /* (T4) USB0_DRVVBUS */ >; }; }; diff --git a/arch/arm64/boot/dts/ti/k3-j7200-main.dtsi b/arch/arm64/boot/dts/ti/k3-j7200-main.dtsi index 16684a2f054d..e12a53f1857f 100644 --- a/arch/arm64/boot/dts/ti/k3-j7200-main.dtsi +++ b/arch/arm64/boot/dts/ti/k3-j7200-main.dtsi @@ -295,7 +295,16 @@ main_pmx0: pinctrl@11c000 { compatible = "pinctrl-single"; /* Proxy 0 addressing */ - reg = <0x00 0x11c000 0x00 0x2b4>; + reg = <0x00 0x11c000 0x00 0x10c>; + #pinctrl-cells = <1>; + pinctrl-single,register-width = <32>; + pinctrl-single,function-mask = <0xffffffff>; + }; + + main_pmx1: pinctrl@11c11c { + compatible = "pinctrl-single"; + /* Proxy 0 addressing */ + reg = <0x00 0x11c11c 0x00 0xc>; #pinctrl-cells = <1>; pinctrl-single,register-width = <32>; pinctrl-single,function-mask = <0xffffffff>; From patchwork Sat Oct 22 07:24: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: 7441 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1098338wrr; Sat, 22 Oct 2022 01:10:28 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5dVedboTynk6MF8CsSfrdNsGes3Ubdkf1pgSCYZdhqcwi2t1IvykeOjixdAwPd6I2YcGgW X-Received: by 2002:a63:8942:0:b0:46e:c02e:2eaf with SMTP id v63-20020a638942000000b0046ec02e2eafmr5319041pgd.394.1666426228151; Sat, 22 Oct 2022 01:10:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666426228; cv=none; d=google.com; s=arc-20160816; b=H65ompl16N764BLlYtKxCd+T6fUEQXWb3rLHY8T8lG4b6qlFlVn+ETYnzX+v5z01Lw 7V5tmoV2IH3Acx/07fFMoEDgpmWF5OUohSMla649DeW+WLbPK9mz9Hz6QvP6tsAKIW3J 8Xfjq9RGi4sY1brdT+EQ9ujn+BC8YwsxEbvUtYV3AelK+vLwUQ5IfZNtjGi87XhvZxh8 wk8QHQaSXvNNa0zWrML9mt+7ypHfhc0uYUh+jeGgmn5Br/e3mfXoZLpxNYJ3mo6GEPGv GSf8cm8qPjsY5EA+LdoHcQd4/du5lUv9Bzyly0vyyPxEqWiG7vXZ2ViYI3a49ybeQDAl LSaQ== 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=9hDnIix6GWYmz+B6MeKnYhITO20a9u4dPyrwg4Ovq+4=; b=E4yRcnX01YiZX7Hdl0Ev6mRtjMdU0DHX22pTjIBGY4ABBzGMAgYP0pnsBUhfFnPYT2 xmoS7Mfap67RSEl6DzYHZfqw4LnTNpO7gAaK+Yoa2358+vCb2PCXiRRgTbVSXg9p+OAs bgvwS65AeW81m9EbI5Q/W8zCvIV6pdkbjOpWxde023RtWNJfr158/Bt4Sx2NgS1+ovpi By13zA7BlZzbExJb4frgvCOmuF9fmaxGLM5JHuR45kmMSp6Z+2Ob5N3jcyaAt+0aJszz 5Q5Rf/Jm+n6ri9I26jUU3d/D2sgQt1YNwEls/1hDHBqmB5N3wfJuDRu2raEUW1vLwHNy nVlQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=BCoU6HR5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 25-20020a631459000000b0045a8ae629d3si28228500pgu.199.2022.10.22.01.10.15; Sat, 22 Oct 2022 01:10: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=BCoU6HR5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S233232AbiJVIJW (ORCPT + 99 others); Sat, 22 Oct 2022 04:09:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60066 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233167AbiJVIFC (ORCPT ); Sat, 22 Oct 2022 04:05:02 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2131C2D52D7; Sat, 22 Oct 2022 00:52: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 3E1CDB82E0B; Sat, 22 Oct 2022 07:51:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8B679C433C1; Sat, 22 Oct 2022 07:51:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425116; bh=rhYqXIfMI++3S0ARFZg5jaYFP/KX9+BPprlJaA2RASY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BCoU6HR5BaFCVrCWIN6ZjSfTf+g6pfpNiLzUaugyxhK62DBALKIMsALDCR1AG2LH/ TFXRDCmloqAhi2HoH2DFH5dkl3BdBZ8Wl+fUiFh7yPwVr9kz8e0b17u5+IpGhkMTjZ LoWp8UPWECMwqne/NxYXmR7714dbT6N0kn93FnPU= 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 5.19 365/717] ARM: dts: exynos: correct s5k6a3 reset polarity on Midas family Date: Sat, 22 Oct 2022 09:24:04 +0200 Message-Id: <20221022072512.715375978@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747374548412180583?= X-GMAIL-MSGID: =?utf-8?q?1747374548412180583?= 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 23f50c9be527..6ca9108b7633 100644 --- a/arch/arm/boot/dts/exynos4412-midas.dtsi +++ b/arch/arm/boot/dts/exynos4412-midas.dtsi @@ -585,7 +585,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 Sat Oct 22 07:24: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: 7447 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1098420wrr; Sat, 22 Oct 2022 01:10:46 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6d/+ba4VpFz7JOm2j2yamUuQwuJGflFaGgpBGnvmr23SvDctkmy9Qz52MH6SQEQoFit7Z4 X-Received: by 2002:a05:6a00:234d:b0:561:ec04:e77e with SMTP id j13-20020a056a00234d00b00561ec04e77emr23585035pfj.14.1666426246453; Sat, 22 Oct 2022 01:10:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666426246; cv=none; d=google.com; s=arc-20160816; b=QffW3gombdGAi0ikcNx9GTyQpjO8pGMOu0xTp/iw+YGRpywOd9SfNMeBkqKIELz//f hT4Pdpq8Joe4l24Dg2eO5V0qwdnfZyfHUIw3GZQzcdneMVBAgoMT2GYEsmdF8bsExKO1 WXK1KIsELn/5NJOt2uLUdXIBoS7YqJuRDwmPElPHw9MBd4genXsydt2GYGxb0a+Q20Sp 9rn+H/onql+8SZG6bb1CI5O+xagthCS0zRrEJ8MnoVKqYwJ6xU4kFKFFQVwfA6OwOmvA 0eV4QfH7NenqnCVxuKTPjjHx+yKfF+V20avI3kIWkpvv0QOgA/LVYmgqmzsPSzYSFfUH 7hyA== 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=7Ghtq5bbbwsmzPu6MUITrXPi/Fu7kLwFbKRmfXvCXk0=; b=CHd4YTCah/xwRttrOATLMHzPK8t6Ts8kIRvM2bXEtASb0dhqpS9zpj/OX07jlzBRzL Y3WLlo80ROmmaqNrfmHcUujp3PrI9E3tk+v00RZee+iUGb0i/GrmcoOq1ZAiH1ODQSSP ip5IzbzbEeusNu1TWUmtCLJSHcRqYBulkSrFL0peUGazRRp08kpEohkYizN3gxguunk4 aWv5/aboDw5l53i/W/yJI0fssV+jKi3PeXu4zobkwsRmwcXWlzGNFYurtXrtH0q757HX HLXiDg03Jwd0yKzNekVWFt/uOv6Qho4ymd9sY4srBDtm5ij3vGARmXU1zOAwSQYXTQtJ lRZg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=nmUo0hMw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 s15-20020a63214f000000b0045fd7ef7478si26222872pgm.851.2022.10.22.01.10.33; Sat, 22 Oct 2022 01:10: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=nmUo0hMw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S233362AbiJVIJi (ORCPT + 99 others); Sat, 22 Oct 2022 04:09:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60990 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232414AbiJVIFR (ORCPT ); Sat, 22 Oct 2022 04:05: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 72D282D52DA; Sat, 22 Oct 2022 00:52: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 4BD11B82DFB; Sat, 22 Oct 2022 07:52:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 83F68C433D6; Sat, 22 Oct 2022 07:51:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425120; bh=ecUngznMqnW5e4lWOlIz3hklrRoghLVGRnlS/7XReBU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nmUo0hMwlMMUDdV0mXSJg1Es7ouuZnOFFKOGJ7JSPSqdzs3A9lJs7p/0mM8sZDK8m Ip1c6zghlSpz2n42tYhPPq4avGmaJf2orxomMypWV2/gpJiG1Ig2pC4sM7ghKIOpo9 sRnUtwKqczXc41rg00yIVU171npAeJmjHnHaM0Mk= 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 5.19 366/717] ARM: Drop CMDLINE_* dependency on ATAGS Date: Sat, 22 Oct 2022 09:24:05 +0200 Message-Id: <20221022072512.795041613@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747374567619847708?= X-GMAIL-MSGID: =?utf-8?q?1747374567619847708?= 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 7630ba9cb6cc..ccc4706484d3 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -1653,7 +1653,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 Sat Oct 22 07:24: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: 7559 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1106038wrr; Sat, 22 Oct 2022 01:36:44 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4p4xLFgVJeuYIlHdBDVuhNb5l1mbu4JRJVmoP1YMVXhYi+yxoZ5tvGpLsTT724V9/KMzZK X-Received: by 2002:a05:6a00:1c82:b0:56b:1547:2068 with SMTP id y2-20020a056a001c8200b0056b15472068mr5762367pfw.55.1666427804608; Sat, 22 Oct 2022 01:36:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666427804; cv=none; d=google.com; s=arc-20160816; b=b2NL0c+RnnOSAWFy6vBznMH0r8NYUfLz+vRcvOnKEmra0gSoPSs91j/vVv06Gxdp6Z ww5OGTRgjPTyEeus89MXJuNHgz4fyDGiv9R1/tumpQ9en83AGr3gv6zLyhhigwtYsFDR ycs1MSP3GTP1MM5JjuEoch6jbcuujV12FwC0+3rQj5ym+YOt0pkG/hkX92mrP52psgzX v8X6xSGs+nmladX7KdpB30iV+1HW4hof4TwNggsWuYZFW3WFkdopJOp1/9PucpfcN335 +Vbabbt3Sqj/kT0WJWeitg9hmHFwhP8/JRAltBdI5Btvt1DyFdGgJ5NhojW6PBPg7CMb 8mAQ== 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=czCdAWdjZP1fMUidXkEEtHCrALz/g/OLJkcVi/g8ZG4=; b=yDloRNAN7J2Q1xDWZKADxGC0UFwgHEWaXL05bMJdr8LcncKkEwrKn7dCwBTw+/z0hp IaEsSDNF0UIRIk56l4djizuv3FG6tFMoL4+zKeBw/lNy1WBdYIJMV3EiNltmqEZ67Oz3 KWQsrNsZUhcZ72W6hBaBCrIjHzIyKxnHN5g0IxaAFNbeEoc3wdXxzIjqHD/oYfxdRsCe 6mmapaKvQ/NWS/G+3DSjuBgsiSoZDF3a5hW6EVgvUSSnoqtOxea/g5Z1cxmj3P5PO/fL vOHJy+hWIFS1bbgY/W0w2Q2ZdCbhyAL09VfbQmXz/DYaJHIhvhfIynVkFGtcY++MBpaR DJ4Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=CzcsI8av; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 l135-20020a633e8d000000b00461c9ed73b3si27092697pga.216.2022.10.22.01.36.27; Sat, 22 Oct 2022 01:36: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=CzcsI8av; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S233835AbiJVI00 (ORCPT + 99 others); Sat, 22 Oct 2022 04:26:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37780 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234117AbiJVIYs (ORCPT ); Sat, 22 Oct 2022 04:24: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 6EA4F5D8AE; Sat, 22 Oct 2022 01:00: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 F104F60B4A; Sat, 22 Oct 2022 07:50:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 128F1C433D7; Sat, 22 Oct 2022 07:50:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425031; bh=L/44Vb6nN7qL+IsEuzLFOvfeDrQ8j949JtBFWbHdaDQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CzcsI8avuisrdwkN4UkgIikEyRXI3lCpFA/v+rM0LLRiTugd6VUppH7yqTGMCwlnZ CA1vgVa1E42Tz7gLZ7MS98IHZFUohLS8CUBaGWC9l/XONMy0FTiyStlGT4jlz7tKQM 1MWCu6Z79LqDw63gkrWLLOvKH8kxwClKpzuKyFLU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Josh Triplett , Lukas Czerner , Theodore Tso , Sasha Levin Subject: [PATCH 5.19 367/717] ext4: dont run ext4lazyinit for read-only filesystems Date: Sat, 22 Oct 2022 09:24:06 +0200 Message-Id: <20221022072512.863837451@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376201384012592?= X-GMAIL-MSGID: =?utf-8?q?1747376201384012592?= From: Josh Triplett [ Upstream commit 426d15ad11419066f7042ffa8fbf1b5c21a1ecbe ] On a read-only filesystem, we won't invoke the block allocator, so we don't need to prefetch the block bitmaps. This avoids starting and running the ext4lazyinit thread at all on a system with no read-write ext4 filesystems (for instance, a container VM with read-only filesystems underneath an overlayfs). Fixes: 21175ca434c5 ("ext4: make prefetch_block_bitmaps default") Signed-off-by: Josh Triplett Reviewed-by: Lukas Czerner Link: https://lore.kernel.org/r/48b41da1498fcac3287e2e06b660680646c1c050.1659323972.git.josh@joshtriplett.org Signed-off-by: Theodore Ts'o Signed-off-by: Sasha Levin --- fs/ext4/super.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/fs/ext4/super.c b/fs/ext4/super.c index fd358e5f88ff..5cacd513d0df 100644 --- a/fs/ext4/super.c +++ b/fs/ext4/super.c @@ -3953,9 +3953,9 @@ int ext4_register_li_request(struct super_block *sb, goto out; } - if (test_opt(sb, NO_PREFETCH_BLOCK_BITMAPS) && - (first_not_zeroed == ngroups || sb_rdonly(sb) || - !test_opt(sb, INIT_INODE_TABLE))) + if (sb_rdonly(sb) || + (test_opt(sb, NO_PREFETCH_BLOCK_BITMAPS) && + (first_not_zeroed == ngroups || !test_opt(sb, INIT_INODE_TABLE)))) goto out; elr = ext4_li_request_new(sb, first_not_zeroed); From patchwork Sat Oct 22 07:24: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: 7414 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1097526wrr; Sat, 22 Oct 2022 01:08:00 -0700 (PDT) X-Google-Smtp-Source: AMsMyM741twH9/K8+HbIss7xBO1IoOorecYT0B3PAckWs731Lz1XpJAEY6bv/0kCzVsnGU02885a X-Received: by 2002:a17:90b:33ce:b0:20d:7450:6b49 with SMTP id lk14-20020a17090b33ce00b0020d74506b49mr26959460pjb.128.1666426080082; Sat, 22 Oct 2022 01:08:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666426080; cv=none; d=google.com; s=arc-20160816; b=yvpdo62zBg0y0BxObStf/ta7Uw1lHxPX0ZbBwSsY1kmryIiMaOpC2y+kSUZ4pM+JL2 qaclHk5TiFORqMMwkaxMdQBAHSkg9KKkMXqWP0c0zIxoH+eeMM3wrQlzqJlY9+Wwa4jF dvxoV8q0DWMBL0MgomvUR9ccz5NyjtItR+RhV5M3iPO9isQ14efVqJCykcqeT0ocWdlP 5+mHl9DIY+thqYJT2pdL02O6aUepqZYN2tdQDIxA9QhwsAHNTlhK8xJ0LccVBwXTFlUd XpjOJTAzrdZNN9N4m0+egc62as/jQC7x5cN5jUnbLR91h3FHT/TX6PAL5HgsSUZgpqi0 1slw== 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=KFROSJJjFgccw96HrbeDZh6Dpxva2ic22JeceO98VCM=; b=BVEqES7g1IevATYkNCS0meB941ZG6eMLdXDIVy9nABABYpzhKY0wwF9cgs7wJSk5EK cLCMHWCCzM1x6hJNgRSJcnGbz4hVl/r0/Vm+GN1Hxu4nwWNQDhL0ynUebG5i090bSVOO 5PJAF0x6/883Ca607GLXvhtiUKPIfyV6dfzLMCSWC8ojx6rfU2oU0Ux8kfuKSCK7FHh+ P8rNjw5sq4SluKVY1IfYOl9HjBHSOlhsx8al2XspO7EXnAlgN0cIzF2EgK0PkHj8cvlh E4jpKDbG+RQ2qZw1BLY5xSb+bRS9wUsuu3fFdifZVtiM5RA/+aZv1IZxb3MztQSuvdoi YAjA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=V9jMPfhb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 a35-20020a631a23000000b004610dceef13si26044656pga.336.2022.10.22.01.07.47; Sat, 22 Oct 2022 01:08: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=V9jMPfhb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S232939AbiJVIHa (ORCPT + 99 others); Sat, 22 Oct 2022 04:07:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36830 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232441AbiJVIC3 (ORCPT ); Sat, 22 Oct 2022 04:02:29 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 26FA52A38AF; Sat, 22 Oct 2022 00:51: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 32D53B82DF6; Sat, 22 Oct 2022 07:50:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A2230C433D6; Sat, 22 Oct 2022 07:50:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425034; bh=MMAtz0tiIEGxwOeY5liGyCLMqd2w/HCwnE9fieN4BrI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=V9jMPfhb7fbe44LCWW4QgjNsHJvYgh7fk4Ysn3tELncgL089IctxPVJgSly82kkBw kheZTyvhIGaQlvQvwxEoStQoypyxO0zonqroWcvHJom/XeLhjoSoI2NRJNQPi3Qb+m OMFa3DsCOYQsNCOzVQYzIamecbqcJ9wAPj/OFXp4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mark Rutland , Li Huafei , Ard Biesheuvel , Will Deacon , Catalin Marinas , Sasha Levin Subject: [PATCH 5.19 368/717] arm64: ftrace: fix module PLTs with mcount Date: Sat, 22 Oct 2022 09:24:07 +0200 Message-Id: <20221022072512.933785606@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747374393133381008?= X-GMAIL-MSGID: =?utf-8?q?1747374393133381008?= From: Mark Rutland [ Upstream commit 8cfb08575c6d4585f1ce0deeb189e5c824776b04 ] Li Huafei reports that mcount-based ftrace with module PLTs was broken by commit: a6253579977e4c6f ("arm64: ftrace: consistently handle PLTs.") When a module PLTs are used and a module is loaded sufficiently far away from the kernel, we'll create PLTs for any branches which are out-of-range. These are separate from the special ftrace trampoline PLTs, which the module PLT code doesn't directly manipulate. When mcount is in use this is a problem, as each mcount callsite in a module will be initialized to point to a module PLT, but since commit a6253579977e4c6f ftrace_make_nop() will assume that the callsite has been initialized to point to the special ftrace trampoline PLT, and ftrace_find_callable_addr() rejects other cases. This means that when ftrace tries to initialize a callsite via ftrace_make_nop(), the call to ftrace_find_callable_addr() will find that the `_mcount` stub is out-of-range and is not handled by the ftrace PLT, resulting in a splat: | ftrace_test: loading out-of-tree module taints kernel. | ftrace: no module PLT for _mcount | ------------[ ftrace bug ]------------ | ftrace failed to modify | [] 0xffff800029180014 | actual: 44:00:00:94 | Initializing ftrace call sites | ftrace record flags: 2000000 | (0) | expected tramp: ffff80000802eb3c | ------------[ cut here ]------------ | WARNING: CPU: 3 PID: 157 at kernel/trace/ftrace.c:2120 ftrace_bug+0x94/0x270 | Modules linked in: | CPU: 3 PID: 157 Comm: insmod Tainted: G O 6.0.0-rc6-00151-gcd722513a189-dirty #22 | Hardware name: linux,dummy-virt (DT) | pstate: 60000005 (nZCv daif -PAN -UAO -TCO -DIT -SSBS BTYPE=--) | pc : ftrace_bug+0x94/0x270 | lr : ftrace_bug+0x21c/0x270 | sp : ffff80000b2bbaf0 | x29: ffff80000b2bbaf0 x28: 0000000000000000 x27: ffff0000c4d38000 | x26: 0000000000000001 x25: ffff800009d7e000 x24: ffff0000c4d86e00 | x23: 0000000002000000 x22: ffff80000a62b000 x21: ffff8000098ebea8 | x20: ffff0000c4d38000 x19: ffff80000aa24158 x18: ffffffffffffffff | x17: 0000000000000000 x16: 0a0d2d2d2d2d2d2d x15: ffff800009aa9118 | x14: 0000000000000000 x13: 6333626532303830 x12: 3030303866666666 | x11: 203a706d61727420 x10: 6465746365707865 x9 : 3362653230383030 | x8 : c0000000ffffefff x7 : 0000000000017fe8 x6 : 000000000000bff4 | x5 : 0000000000057fa8 x4 : 0000000000000000 x3 : 0000000000000001 | x2 : ad2cb14bb5438900 x1 : 0000000000000000 x0 : 0000000000000022 | Call trace: | ftrace_bug+0x94/0x270 | ftrace_process_locs+0x308/0x430 | ftrace_module_init+0x44/0x60 | load_module+0x15b4/0x1ce8 | __do_sys_init_module+0x1ec/0x238 | __arm64_sys_init_module+0x24/0x30 | invoke_syscall+0x54/0x118 | el0_svc_common.constprop.4+0x84/0x100 | do_el0_svc+0x3c/0xd0 | el0_svc+0x1c/0x50 | el0t_64_sync_handler+0x90/0xb8 | el0t_64_sync+0x15c/0x160 | ---[ end trace 0000000000000000 ]--- | ---------test_init----------- Fix this by reverting to the old behaviour of ignoring the old instruction when initialising an mcount callsite in a module, which was the behaviour prior to commit a6253579977e4c6f. Signed-off-by: Mark Rutland Fixes: a6253579977e ("arm64: ftrace: consistently handle PLTs.") Reported-by: Li Huafei Link: https://lore.kernel.org/linux-arm-kernel/20220929094134.99512-1-lihuafei1@huawei.com Cc: Ard Biesheuvel Cc: Will Deacon Link: https://lore.kernel.org/r/20220929134525.798593-1-mark.rutland@arm.com Signed-off-by: Catalin Marinas Signed-off-by: Sasha Levin --- arch/arm64/kernel/ftrace.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/arch/arm64/kernel/ftrace.c b/arch/arm64/kernel/ftrace.c index ea5dc7c90f46..b49ba9a24bcc 100644 --- a/arch/arm64/kernel/ftrace.c +++ b/arch/arm64/kernel/ftrace.c @@ -217,11 +217,26 @@ int ftrace_make_nop(struct module *mod, struct dyn_ftrace *rec, unsigned long pc = rec->ip; u32 old = 0, new; + new = aarch64_insn_gen_nop(); + + /* + * When using mcount, callsites in modules may have been initalized to + * call an arbitrary module PLT (which redirects to the _mcount stub) + * rather than the ftrace PLT we'll use at runtime (which redirects to + * the ftrace trampoline). We can ignore the old PLT when initializing + * the callsite. + * + * Note: 'mod' is only set at module load time. + */ + if (!IS_ENABLED(CONFIG_DYNAMIC_FTRACE_WITH_REGS) && + IS_ENABLED(CONFIG_ARM64_MODULE_PLTS) && mod) { + return aarch64_insn_patch_text_nosync((void *)pc, new); + } + if (!ftrace_find_callable_addr(rec, mod, &addr)) return -EINVAL; old = aarch64_insn_gen_branch_imm(pc, addr, AARCH64_INSN_BRANCH_LINK); - new = aarch64_insn_gen_nop(); return ftrace_modify_code(pc, old, new, true); } From patchwork Sat Oct 22 07:24: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: 7454 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1098593wrr; Sat, 22 Oct 2022 01:11:23 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7QuCZcjBKuCjBETDPCFR+AbFE/RECWEuughI6FBUsytCBqNZdsdItoqCOKC8EvC9KMXU5r X-Received: by 2002:a05:6a00:140d:b0:528:5a5a:d846 with SMTP id l13-20020a056a00140d00b005285a5ad846mr2078090pfu.9.1666426283035; Sat, 22 Oct 2022 01:11:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666426283; cv=none; d=google.com; s=arc-20160816; b=fM8rvz31Nk9NXYjpf6vBJIgxyms8DgKjvKnLoLVcD3veBNn2kEZ8Xs98S6EE+FPl6v PIHHUPZIZhfhxiI1iDp3X3n5Fk5XYJ7ki0OvLyGmzgFz+4skssipal0y0kAvQtEeANSc WTB6fsiJFw4Kk9w9RRu8FS+ogUQFflJtBVq+k20vXNZYoJZOoJeC/fxIRRmPH9tLrMhZ TvUv2ivsEpsHhiqKWC55Y6JNwklEXFy3ekGcaCRzdWiG2WmVuOF8vp/VYBPCmnpRMwtE PsCysGa6Z/7LQ6R1Jy85+UennNTjmIXwYr8zKhVmVt/KG0MMA+tW2NIrpeTd95A+M04i p/8w== 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=1UWyL/yx1wbXJMjZrYIK+febCbR2ELpYgE4BwE+cpXk=; b=apCloRtMMXvK2krn26gdjaupKBnTXcvvs9ijN7yOgR40+lFOT5zvlSuPTW1PnZ/HBE TaVmicEj0J8aVoSoiSxfzcOZSyY5OJjMgIUVqTo8oI0pnIIvUJzCZWDMUJHmvTdtkFlK TuPfk0tHCRxfLVr19mRGhAC8UarGCBWzYXTqksF7n17+0gL+/g1L531cqvMp2IYUZpdZ cBiR0O8kG7fWEFBeoyPwGGO4vrBjpCM0r00qh365Hq9aPV125aBCRQwCQP0OnDWDUyfl XwduZ/Az/wuFMB6jXSWdZlFBiPrezgO1woMdep60rarBQIHMoRQIyDxy67IGmBo5M/u1 6gpw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=k6dlImjy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 l12-20020a056a0016cc00b005281e5606b2si29264013pfc.32.2022.10.22.01.11.07; Sat, 22 Oct 2022 01:11: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=k6dlImjy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S232973AbiJVIKN (ORCPT + 99 others); Sat, 22 Oct 2022 04:10:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51794 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232822AbiJVIGF (ORCPT ); Sat, 22 Oct 2022 04:06: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 AD7032C6E1F; Sat, 22 Oct 2022 00:52: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 13192B82E2C; Sat, 22 Oct 2022 07:50:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6C711C433C1; Sat, 22 Oct 2022 07:50:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425036; bh=ai7WfVWVVq/rsQxbxqD2P3T55B+WLzqUqFD0GQQ004k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=k6dlImjyRRGoTafyrybcRYHprtNp7yNZtITMA6KbMwzoR4m6nm2FgAdFASGJTt7vR LQjtzxMBIgCYPtZdyCbm6e/J/+yK49KOkRO6KKE3la/ta4TzA0QYptyLrthmaGp92q WlrHBNyn0MU94/5Xc5i7X+4f/Re3DsR1DKRTUvOc= 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 5.19 369/717] ARM: dts: exynos: fix polarity of VBUS GPIO of Origen Date: Sat, 22 Oct 2022 09:24:08 +0200 Message-Id: <20221022072513.004199583@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747374606294790937?= X-GMAIL-MSGID: =?utf-8?q?1747374606294790937?= 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 6db09dba07ff..a3905e27b9cd 100644 --- a/arch/arm/boot/dts/exynos4412-origen.dts +++ b/arch/arm/boot/dts/exynos4412-origen.dts @@ -95,7 +95,7 @@ }; &ehci { - samsung,vbus-gpio = <&gpx3 5 1>; + samsung,vbus-gpio = <&gpx3 5 GPIO_ACTIVE_HIGH>; status = "okay"; phys = <&exynos_usbphy 2>, <&exynos_usbphy 3>; phy-names = "hsic0", "hsic1"; From patchwork Sat Oct 22 07:24: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: 7437 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1098281wrr; Sat, 22 Oct 2022 01:10:19 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6KN9ZGNcuOmeHea4182UmvWXLBH6di0XPyhUawmDYmKMfhmY8lBWWmWwaq0FZSWDCtw2zq X-Received: by 2002:a05:6a00:23c5:b0:563:a0f0:e4d1 with SMTP id g5-20020a056a0023c500b00563a0f0e4d1mr23175093pfc.62.1666426218746; Sat, 22 Oct 2022 01:10:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666426218; cv=none; d=google.com; s=arc-20160816; b=a/xaFzFxCfeshyBzd5v9FuNkEmukLDfPDcn0INOLqypZ5B6bYO88Gcyu8emR7hVg/K pXso9dB7fe9OJIc5RaVpUjIUtsMmHhG9v42EkRodCX1ddXEuiNx1MorkLHfagGtsoyYK qWxG/rlNnqXH9n8QpqvXuHS4BX+HHKYQ7WCHA2LGoh8WBWbTsYh5e+YS5xQ7r7vR22u4 jCsrn9lpDPklqqaazv9GRr98JdiZrw2S3PhhxiFWD7CA5Vvl1u5Ml28FgIeDiNg4EI26 WdyN0xtzyQEv0QJG4DFpreA9mqhVua0WvAEbDjEJ0hIAJVmM1h+d6BPmqgYvq4wGL4tc LrsQ== 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=uQg71iq/Uwj+Q9KrNFPfHhzpBQhZzjRCMum5xiInvqY=; b=zyxnLIjd1AWsfPHI3HAv7HOKYBq1oEXuwTV5e4s3MUGkqXwdLTLNmrnObQm2kdC4fs I0cQY4ixpZ88tYOPVdN3jn3Kt1xHzUfJOukvMIh8HaI7+vKmkZOk9+LEg0bJuwDPAsnU iDpMz7U4bhBQ0JI8GLufDQNdL1RsDr/EV2/DynYzi5T2IvqYDvWx+lVBDhyAP5Mxg4mH 47lVa5JCDkQr+MhUC8W6l2iDUJDpqiTTsQeGuCIL3oMeq8I2iGMOdy4/fI5fX/pByCaH jQyrZP4tn59twYJsFl0ErWv08zuEE5BQ6VCsVs6kqzMzbo/RiISxfqo+fW2yY4+oRqaa sKXg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=wGRftH11; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 y13-20020a056a00190d00b005363fa9e126si29573029pfi.358.2022.10.22.01.10.05; Sat, 22 Oct 2022 01:10: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=wGRftH11; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S233142AbiJVIJC (ORCPT + 99 others); Sat, 22 Oct 2022 04:09:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43758 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233066AbiJVIEr (ORCPT ); Sat, 22 Oct 2022 04:04:47 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B39572D2C15; Sat, 22 Oct 2022 00:52:22 -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 48C5560AC3; Sat, 22 Oct 2022 07:50:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3F121C433D6; Sat, 22 Oct 2022 07:50:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425039; bh=Imcg6PqxiqOEVbjHUWQaLIebpbzwPLsygt+cDDqgv/E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wGRftH11scr546Gz42q2505T2gV5lgH2wfkSK7abWLqiqIMr8WVde3yYo7KhvDlwL Us+sYi/BErGM6KaiejYmHMr6XXKH67pCBAuZAZqLln7JOBNDeI7sncVLIBjQrcjiI5 YGDfcL6Bb28g0plkR+6wtJzlnWZnUDgAWwDpIBDA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Darrick J. Wong" , "Matthew Wilcox (Oracle)" , Sasha Levin Subject: [PATCH 5.19 370/717] iomap: iomap: fix memory corruption when recording errors during writeback Date: Sat, 22 Oct 2022 09:24:09 +0200 Message-Id: <20221022072513.059596689@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747374538906982995?= X-GMAIL-MSGID: =?utf-8?q?1747374538906982995?= From: Darrick J. Wong [ Upstream commit 3d5f3ba1ac28059bdf7000cae2403e4e984308d2 ] Every now and then I see this crash on arm64: Unable to handle kernel NULL pointer dereference at virtual address 00000000000000f8 Buffer I/O error on dev dm-0, logical block 8733687, async page read Mem abort info: ESR = 0x0000000096000006 EC = 0x25: DABT (current EL), IL = 32 bits SET = 0, FnV = 0 EA = 0, S1PTW = 0 FSC = 0x06: level 2 translation fault Data abort info: ISV = 0, ISS = 0x00000006 CM = 0, WnR = 0 user pgtable: 64k pages, 42-bit VAs, pgdp=0000000139750000 [00000000000000f8] pgd=0000000000000000, p4d=0000000000000000, pud=0000000000000000, pmd=0000000000000000 Internal error: Oops: 96000006 [#1] PREEMPT SMP Buffer I/O error on dev dm-0, logical block 8733688, async page read Dumping ftrace buffer: Buffer I/O error on dev dm-0, logical block 8733689, async page read (ftrace buffer empty) XFS (dm-0): log I/O error -5 Modules linked in: dm_thin_pool dm_persistent_data XFS (dm-0): Metadata I/O Error (0x1) detected at xfs_trans_read_buf_map+0x1ec/0x590 [xfs] (fs/xfs/xfs_trans_buf.c:296). dm_bio_prison XFS (dm-0): Please unmount the filesystem and rectify the problem(s) XFS (dm-0): xfs_imap_lookup: xfs_ialloc_read_agi() returned error -5, agno 0 dm_bufio dm_log_writes xfs nft_chain_nat xt_REDIRECT nf_nat nf_conntrack nf_defrag_ipv6 nf_defrag_ipv4 ip6t_REJECT potentially unexpected fatal signal 6. nf_reject_ipv6 potentially unexpected fatal signal 6. ipt_REJECT nf_reject_ipv4 CPU: 1 PID: 122166 Comm: fsstress Tainted: G W 6.0.0-rc5-djwa #rc5 3004c9f1de887ebae86015f2677638ce51ee7 rpcsec_gss_krb5 auth_rpcgss xt_tcpudp ip_set_hash_ip ip_set_hash_net xt_set nft_compat ip_set_hash_mac ip_set nf_tables Hardware name: QEMU KVM Virtual Machine, BIOS 1.5.1 06/16/2021 pstate: 60001000 (nZCv daif -PAN -UAO -TCO -DIT +SSBS BTYPE=--) ip_tables pc : 000003fd6d7df200 x_tables lr : 000003fd6d7df1ec overlay nfsv4 CPU: 0 PID: 54031 Comm: u4:3 Tainted: G W 6.0.0-rc5-djwa #rc5 3004c9f1de887ebae86015f2677638ce51ee7405 Hardware name: QEMU KVM Virtual Machine, BIOS 1.5.1 06/16/2021 Workqueue: writeback wb_workfn sp : 000003ffd9522fd0 (flush-253:0) pstate: 60401005 (nZCv daif +PAN -UAO -TCO -DIT +SSBS BTYPE=--) pc : errseq_set+0x1c/0x100 x29: 000003ffd9522fd0 x28: 0000000000000023 x27: 000002acefeb6780 x26: 0000000000000005 x25: 0000000000000001 x24: 0000000000000000 x23: 00000000ffffffff x22: 0000000000000005 lr : __filemap_set_wb_err+0x24/0xe0 x21: 0000000000000006 sp : fffffe000f80f760 x29: fffffe000f80f760 x28: 0000000000000003 x27: fffffe000f80f9f8 x26: 0000000002523000 x25: 00000000fffffffb x24: fffffe000f80f868 x23: fffffe000f80fbb0 x22: fffffc0180c26a78 x21: 0000000002530000 x20: 0000000000000000 x19: 0000000000000000 x18: 0000000000000000 x17: 0000000000000000 x16: 0000000000000000 x15: 0000000000000000 x14: 0000000000000001 x13: 0000000000470af3 x12: fffffc0058f70000 x11: 0000000000000040 x10: 0000000000001b20 x9 : fffffe000836b288 x8 : fffffc00eb9fd480 x7 : 0000000000f83659 x6 : 0000000000000000 x5 : 0000000000000869 x4 : 0000000000000005 x3 : 00000000000000f8 x20: 000003fd6d740020 x19: 000000000001dd36 x18: 0000000000000001 x17: 000003fd6d78704c x16: 0000000000000001 x15: 000002acfac87668 x2 : 0000000000000ffa x1 : 00000000fffffffb x0 : 00000000000000f8 Call trace: errseq_set+0x1c/0x100 __filemap_set_wb_err+0x24/0xe0 iomap_do_writepage+0x5e4/0xd5c write_cache_pages+0x208/0x674 iomap_writepages+0x34/0x60 xfs_vm_writepages+0x8c/0xcc [xfs 7a861f39c43631f15d3a5884246ba5035d4ca78b] x14: 0000000000000000 x13: 2064656e72757465 x12: 0000000000002180 x11: 000003fd6d8a82d0 x10: 0000000000000000 x9 : 000003fd6d8ae288 x8 : 0000000000000083 x7 : 00000000ffffffff x6 : 00000000ffffffee x5 : 00000000fbad2887 x4 : 000003fd6d9abb58 x3 : 000003fd6d740020 x2 : 0000000000000006 x1 : 000000000001dd36 x0 : 0000000000000000 CPU: 1 PID: 122167 Comm: fsstress Tainted: G W 6.0.0-rc5-djwa #rc5 3004c9f1de887ebae86015f2677638ce51ee7 do_writepages+0x90/0x1c4 __writeback_single_inode+0x4c/0x4ac Hardware name: QEMU KVM Virtual Machine, BIOS 1.5.1 06/16/2021 writeback_sb_inodes+0x214/0x4ac wb_writeback+0xf4/0x3b0 pstate: 60001000 (nZCv daif -PAN -UAO -TCO -DIT +SSBS BTYPE=--) wb_workfn+0xfc/0x580 process_one_work+0x1e8/0x480 pc : 000003fd6d7df200 worker_thread+0x78/0x430 This crash is a result of iomap_writepage_map encountering some sort of error during writeback and wanting to set that error code in the file mapping so that fsync will report it. Unfortunately, the code dereferences folio->mapping after unlocking the folio, which means that another thread could have removed the page from the page cache (writeback doesn't hold the invalidation lock) and give it to somebody else. At best we crash the system like above; at worst, we corrupt memory or set an error on some other unsuspecting file while failing to record the problems with *this* file. Regardless, fix the problem by reporting the error to the inode mapping. NOTE: Commit 598ecfbaa742 lifted the XFS writeback code to iomap, so this fix should be backported to XFS in the 4.6-5.4 kernels in addition to iomap in the 5.5-5.19 kernels. Fixes: e735c0079465 ("iomap: Convert iomap_add_to_ioend() to take a folio") # 5.17 onward Fixes: 598ecfbaa742 ("iomap: lift the xfs writeback code to iomap") # 5.5-5.16, needs backporting Fixes: 150d5be09ce4 ("xfs: remove xfs_cancel_ioend") # 4.6-5.4, needs backporting Signed-off-by: Darrick J. Wong Reviewed-by: Matthew Wilcox (Oracle) Signed-off-by: Sasha Levin --- fs/iomap/buffered-io.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/iomap/buffered-io.c b/fs/iomap/buffered-io.c index d2a9f699e17e..f2f102dd5e6b 100644 --- a/fs/iomap/buffered-io.c +++ b/fs/iomap/buffered-io.c @@ -1412,7 +1412,7 @@ iomap_writepage_map(struct iomap_writepage_ctx *wpc, if (!count) folio_end_writeback(folio); done: - mapping_set_error(folio->mapping, error); + mapping_set_error(inode->i_mapping, error); return error; } From patchwork Sat Oct 22 07:24: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: 7457 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1098733wrr; Sat, 22 Oct 2022 01:11:36 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6exb9UBNStyFp5ngXvdQ0Q7S3Ca6KtFiVpvzk/mZvNF5sFBpw49w19yryGffTuAa532rYY X-Received: by 2002:a17:90b:2243:b0:20b:42a:4c0d with SMTP id hk3-20020a17090b224300b0020b042a4c0dmr60461828pjb.123.1666426296337; Sat, 22 Oct 2022 01:11:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666426296; cv=none; d=google.com; s=arc-20160816; b=nr5RN6dx35v2qsFDv2CxHUO+VqHK3Y9RrszX0fZzU3v8vtxGt7N7wXg/PgdEG8Lror wAlA4Ptxyasw9Dmz8FYXT0UGjOqeBPjQHMtt5P/3xPKvzBIk0uXgnCRn8SIc1mHQ2XyE k01O0x7R9QqYqvMDffnNJbgLbGVQkZqmRiU1WnQ6F12tlFsbas/csjMorfdfA5uG1g22 AdoxTn8765vSF23D6x8h2vjbJ9C/yGpJ4LYOLp6OOzBdR1IolX9BkxpT1GKiJ+crLtzk S2MTi8V6Fg7P5Bo8wdxj3jbz1+DHG1f7yObMHfTTsms6WT45vxhGfaBoNW4ug938goYS yrGQ== 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=yiHyHxaXRiamXsW2lLwtKJDwqpHIv92lN+SEkjIUik0=; b=WiQzpCkkLR1sO/6HnAXIhBIm5QqxEn70xTG8i/UJZD/wACBFfd+oUxjngn6u4xYeyF 56n/wm67YFPf1qjBCki3Hd/nmA0ZzSKhljx3zIgtgiAbsILbUfDA31rZMtXHul+9u3F6 OSLxjRqHDJVao4eU0vYrx8USP8Yc4s4be+uydoOPLE1eg/3S3i2RWtUvGFg1r7/lY+Y5 pvbTVD+f2CYwxhyb7VbS0MVJ35Z/OXHSn3XrPDOvfjGDZAF/uPH6RGMdvycPQa/6wM+8 /dqCTVcvt6hUY0quJVfb6aVnY9nyrTcJpMpdbDaKzBtD71+3Rl+CUJLrcskkcunjkWd4 jWEA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=mGsg0Uk6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 z5-20020a63c045000000b0043af57e5d16si25413857pgi.724.2022.10.22.01.11.23; Sat, 22 Oct 2022 01:11: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=mGsg0Uk6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S233118AbiJVIKo (ORCPT + 99 others); Sat, 22 Oct 2022 04:10:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42678 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232747AbiJVIGS (ORCPT ); Sat, 22 Oct 2022 04:06: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 947D82D654C; Sat, 22 Oct 2022 00:53: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 1A4D0B82E2D; Sat, 22 Oct 2022 07:50:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7DF8DC433D6; Sat, 22 Oct 2022 07:50:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425042; bh=yZP95DtfbEuB45jO+/d/Bt3Iwte+iLoWTwCTK7jL7/E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mGsg0Uk6aHIqx9NoUoXb+lZU+keoZYoXsUAdzdAHZYZZKDKklI8bWPLLANBkOCsQF HCOBSMHuCIB/ajU8gOMbZDYcDYU1GdpOFhC63QlNR/J3o75+aDO+LcHbp/Be0RLiCY 5jVkWJ7B/3JLbN+h7B8HtHDe5YGIsDQBxm4STwXU= 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 5.19 371/717] iio: adc: at91-sama5d2_adc: fix AT91_SAMA5D2_MR_TRACKTIM_MAX Date: Sat, 22 Oct 2022 09:24:10 +0200 Message-Id: <20221022072513.127559109@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747374620450795909?= X-GMAIL-MSGID: =?utf-8?q?1747374620450795909?= 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 b764823ce57e..32b6f157b803 100644 --- a/drivers/iio/adc/at91-sama5d2_adc.c +++ b/drivers/iio/adc/at91-sama5d2_adc.c @@ -77,7 +77,7 @@ struct at91_adc_reg_layout { #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 Sat Oct 22 07:24: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: 7413 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1097513wrr; Sat, 22 Oct 2022 01:07:58 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6p0k6G3WwOa0RcSxRNR0hcXPPUp+Uko9KSd0KFvyBc8uZamW0KROI3OU+fAOMamq33dMwn X-Received: by 2002:a17:902:ed82:b0:178:5653:ecfb with SMTP id e2-20020a170902ed8200b001785653ecfbmr23356087plj.58.1666426078068; Sat, 22 Oct 2022 01:07:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666426078; cv=none; d=google.com; s=arc-20160816; b=Hbhwk5wgiH++C33xAdfv99ah4n3cin1de+Kbr9iHyp0V/Mtx6qKH9l8LpfbTQV5KxC AjUXCQOS4DRtlJS0pvG5OhVFYwmxrYHYSW4mzdAnRKUBzpgXj/cHrJszuxv9oEn9gdHV xLqIXSRqUmxhcN8GVSuaN9vPMXRcN3ByLaZ+v37kEVZIBPF8hR7Y3bum3vqfl/mcXSuz tDYwfb5fUyPotyHEQWJiHe9JY5R+cz76HF0vPZmejbwjQ0UDvPssCa++KVtXnInK71MA wkHkdWTLAITbDUoOlJBefJNcqaAW4qzEHgJTtmj9ffA1bX1WqaBYhZVci7i/bV1Hz1nu 03Zw== 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=oRt+whfwsnI/uN2WYCDt/r3jXpQV5fLuFL2/TucVDKw=; b=mH+Dq/YzjkqyZEer3jZrWEUQDAzVr9ZzA5k+Cyw8I/EsL7ykpYaux3LdBzZ0XXTwPI N8DiY0mNv7Ow9rkrUn6hga0SRU9+o/uLChvBpKOemBsZIAZmOZBm2KzWbdBkPqppJmPy UKL0Z25OYgWhJsTnnVouqY5HhbFmoQu75bWItZf6zDpHQ7j0cSSARTpUHQsdje2hQB/1 sv3OgAZ70wwosFkK1lEq9sQbt11QIiQRWBkBe80AvNj0jcKGoptBe1UlrnbKU5I+xtYN HqKXB9gnxh6S0g/yvP137VzkNk+Svy/OFq5D6XKmBYgJMu6drPcWw2FmI81gkBhmjOSk iIzQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=FTq5uIOs; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 d17-20020a056a00199100b0056b972a8cfasi264779pfl.121.2022.10.22.01.07.45; Sat, 22 Oct 2022 01:07: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=FTq5uIOs; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S232659AbiJVIHY (ORCPT + 99 others); Sat, 22 Oct 2022 04:07:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36826 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232560AbiJVIC0 (ORCPT ); Sat, 22 Oct 2022 04:02: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 26A292A389D; Sat, 22 Oct 2022 00:51: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 00275B82E2E; Sat, 22 Oct 2022 07:50:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 56FB6C433C1; Sat, 22 Oct 2022 07:50:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425045; bh=fovrxAuJ3o96EOTwBjosV8bf3uk9mILlEB7h0L0riGY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FTq5uIOsyejF94AIvQtqM4JOT7D6eyYS4/0KEvSmNCijXijNLRdmSuNSWM0ZslHw9 LNWkGfTXzBvoyXwrHexQWS6P5z6Aa17CU1Ui0zjvitsEqYINWrp4r/92f8nMoOVYuT e/zHjuSj+2qQTyyMUi5jW92O6Iq+RuswDnpYdssY= 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 5.19 372/717] iio: adc: at91-sama5d2_adc: check return status for pressure and touch Date: Sat, 22 Oct 2022 09:24:11 +0200 Message-Id: <20221022072513.311158038@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747374391306183008?= X-GMAIL-MSGID: =?utf-8?q?1747374391306183008?= 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 32b6f157b803..c3301c749164 100644 --- a/drivers/iio/adc/at91-sama5d2_adc.c +++ b/drivers/iio/adc/at91-sama5d2_adc.c @@ -1544,8 +1544,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); @@ -1558,8 +1560,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 Sat Oct 22 07:24: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: 7506 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1104958wrr; Sat, 22 Oct 2022 01:33:47 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4Mz9UF8hNwL5bC6XN8SZ+wNu7F4k89pam5s0J5sA2cOR5luKuMq3hrMqgJfahzy0zX9ORC X-Received: by 2002:a17:90b:2248:b0:210:10dc:a314 with SMTP id hk8-20020a17090b224800b0021010dca314mr18924470pjb.15.1666427626735; Sat, 22 Oct 2022 01:33:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666427626; cv=none; d=google.com; s=arc-20160816; b=OvAKrKXwwWRmUOna/9yuBkoW+se+tkBoa41HYDd+/nKIY7vrSICdj2E+1UXuYmtl2R WzEsONn7o3mDhfPi2pgq5oVg5vxpx4Eoo1F/6rbXtZgbe9XYSUPBTzsxG642EHHFft20 XE0bFnt6plxXCzYlqhyXMhn7ZfxO5zHpUMHzEePqsKftKwisGqr0RE8DbB7lvNYrVC2W x6h+FO9adtNErq4Q8PieTtKBrK4Je99JZz5Z/P4FFKrFynZDFjI9+xR7dZmvhEyiLVMs 7auMWzymRHmrQ3HifZjipEEbeqY0oEg3OmCrEacN7r+DwtaFefGNJUvUZT66K0kUai1S rs8g== 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=oIYcP9MbZ8jQ+ZapSZP4fgSTtZ1TblbgMIlXbyApZX0=; b=a4BI+7TdVoYcQoOboEPK9NHfa7tYe9XGEqHECxqnaeowLU7FbXECxuU26UXje2eq4x hEdLRE5uagCX7scnzH93uUK0Ru2+v7VVAhS8LlC6225+SNylADOtsRWsDK19RRsB0u5p fkP2Vn88ka3l+9esJnANmm4d0yVDb6q+iNWrjOAMXwvaVE0fDiNVfnpaz/OnJ7Rpw6MC uNoUl2RQEBR36vQaPo8iGNCITuSb7MuFiW9XqrKAQgdeYwgzPgjJl6PTeWaimrcQhKFx mGZi3YrUSzozPc+AQcOWsFwVaGabuLOGxzJWFId5f23AFP6epipzm2qLyb1TTcLX9Qa1 w0cA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=QYGGOcM8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 q9-20020a056a00084900b005631a77268esi29750403pfk.79.2022.10.22.01.33.31; Sat, 22 Oct 2022 01:33: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=QYGGOcM8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S233173AbiJVIUF (ORCPT + 99 others); Sat, 22 Oct 2022 04:20:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48814 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233420AbiJVIRn (ORCPT ); Sat, 22 Oct 2022 04:17:43 -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 7938F2DCB20; Sat, 22 Oct 2022 00: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 ams.source.kernel.org (Postfix) with ESMTPS id CEEBEB82E20; Sat, 22 Oct 2022 07:50:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2D62EC4314A; Sat, 22 Oct 2022 07:50:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425048; bh=vztPcq+ueD48m1OWcvEhlTUc1YYDivfSgveLuANnp5k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QYGGOcM8clajXlOnYN2ZOq8S02oG8NmvOYa4i9kpwAOK74b7pSOJnUyXRr7BqGFWT OtXmBbktJOHzCjVZmqtFiT68xknUbpLKkk7Tr8wCYirIBKjxnN3u5zgUjyRxjBtC7u e1CAvVqGSAPnN2TopA/ZWlN2JqVA6ozQnmJutNYA= 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 5.19 373/717] iio: adc: at91-sama5d2_adc: lock around oversampling and sample freq Date: Sat, 22 Oct 2022 09:24:12 +0200 Message-Id: <20221022072513.514936648@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376015076705313?= X-GMAIL-MSGID: =?utf-8?q?1747376015076705313?= From: Claudiu Beznea [ Upstream commit 9780a23ed5a0a0a63683e078f576719a98d4fb70 ] .read_raw()/.write_raw() could be called asynchronously from user space or other in kernel drivers. Without locking on st->lock these could be called asynchronously while there is a conversion in progress. Read will be harmless but changing registers while conversion is in progress may lead to inconsistent results. Thus, to avoid this lock st->lock. Fixes: 27e177190891 ("iio:adc:at91_adc8xx: introduce new atmel adc driver") 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-4-claudiu.beznea@microchip.com Signed-off-by: Jonathan Cameron Signed-off-by: Sasha Levin --- drivers/iio/adc/at91-sama5d2_adc.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/drivers/iio/adc/at91-sama5d2_adc.c b/drivers/iio/adc/at91-sama5d2_adc.c index c3301c749164..40a95d2fd5c8 100644 --- a/drivers/iio/adc/at91-sama5d2_adc.c +++ b/drivers/iio/adc/at91-sama5d2_adc.c @@ -1542,10 +1542,10 @@ static int at91_adc_read_info_raw(struct iio_dev *indio_dev, ret = at91_adc_read_position(st, chan->channel, &tmp_val); *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); + mutex_unlock(&st->lock); + iio_device_release_direct_mode(indio_dev); return ret; } @@ -1558,10 +1558,10 @@ static int at91_adc_read_info_raw(struct iio_dev *indio_dev, ret = at91_adc_read_pressure(st, chan->channel, &tmp_val); *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); + mutex_unlock(&st->lock); + iio_device_release_direct_mode(indio_dev); return ret; } @@ -1650,16 +1650,20 @@ static int at91_adc_write_raw(struct iio_dev *indio_dev, /* if no change, optimize out */ if (val == st->oversampling_ratio) return 0; + mutex_lock(&st->lock); st->oversampling_ratio = val; /* update ratio */ at91_adc_config_emr(st); + mutex_unlock(&st->lock); return 0; case IIO_CHAN_INFO_SAMP_FREQ: if (val < st->soc_info.min_sample_rate || val > st->soc_info.max_sample_rate) return -EINVAL; + mutex_lock(&st->lock); at91_adc_setup_samp_freq(indio_dev, val); + mutex_unlock(&st->lock); return 0; default: return -EINVAL; From patchwork Sat Oct 22 07:24: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: 7461 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1098788wrr; Sat, 22 Oct 2022 01:11:45 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5kM3CkL/f0n0f5DcnZRYZB8DkCDvFUF1LA6qOf7xM/S1Y90xiMTbiJnEw93dDrgppVg11L X-Received: by 2002:a63:2352:0:b0:46b:1dac:bc83 with SMTP id u18-20020a632352000000b0046b1dacbc83mr20245496pgm.98.1666426305682; Sat, 22 Oct 2022 01:11:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666426305; cv=none; d=google.com; s=arc-20160816; b=O89oZGTYkvW4fCUSHjT6ZVqSuMSdtbZDTCJDq4Dth8FC8lRq+hP5s7F57oGbEBbWhe hL0m+sJP08c8FUe5K9sa7M7oW7YQrCtsqgFBfaAzqMKIG8ht/NoICZ3YHQhYK6brEvfz Ywxaifj59LJvG2WDKLqnnjSaiTk+mtP06dpPMJmvaRL7TjgraCwxejps9x0Q3ihGhHqu oAlhkJBaE9pBrBP/Xeh5TEDFQRfddD8Us4grvWga/jyqpJzYJuse9HufP/lBXYh0SFQn Lx/fsgFNWOeCJ91amrFAPVfviinv+Ru7eAO/g5BFCYVzekKNDfBt0kfR8ctcaS9JhI9O kCmQ== 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=aY4dDMRGDIrdeGsl4J2vD8V0fLOSTwCOyHuIyE60E3Y=; b=bsblrA4tPjsrHQha2Al+neOD87HMhhFXwuiIJGw6xEJRSs0xTl6qEwQ06wybg1UDM3 Cbn8ZCLHQjo4drYa71kTVCxpilLBRO6Y50pju+QWc6h0ua4HR+4zcflTQQsLth3V1ZLL 2haUT+C234XefDJai6XeYR8Wrc3/8BTdgoaKsBo+h4q2cQZXhmKYuXvcJzmC2FyA/zy7 K0acEtXh8H9eW9nXM2hdMgzYYPlvC0zCkWFqzdODO+gj9Pt7abLkzxkpn+KQ07Ji03z2 fBzVUYJDazw0ArnT/+co84e01mBwkFGpftgZi8Y2EhHDO+V2TjLChjpawobfPKAwDLsK /NEA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=IVlvQNJD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 q18-20020a170902b11200b0017139f381c9si25568773plr.569.2022.10.22.01.11.33; Sat, 22 Oct 2022 01:11: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=IVlvQNJD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S233073AbiJVIKc (ORCPT + 99 others); Sat, 22 Oct 2022 04:10:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56074 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232779AbiJVIGQ (ORCPT ); Sat, 22 Oct 2022 04:06:16 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B31392C56B5; Sat, 22 Oct 2022 00:52: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 2A08B60B45; Sat, 22 Oct 2022 07:50:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3B953C433D6; Sat, 22 Oct 2022 07:50:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425051; bh=G4pxLuOgm4U8RKN+k7teTdDepbV+IuCMTLkZMjfLEMs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IVlvQNJDmLdObYf2mAr6AhOkaoBjTsmopsnMH1enwU1laz267J8fcPADUOS07A27I 9cWRWwotsPsd/JVPgTuZIl49UFiQ+2mUIy5iM4uOMGpADw0k9M6ER9dF41n8guRE6j g7zg5/QeOruBsnPhAS6xn/NxkDvLEZYxFCyEcy2k= 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 5.19 374/717] iio: adc: at91-sama5d2_adc: disable/prepare buffer on suspend/resume Date: Sat, 22 Oct 2022 09:24:13 +0200 Message-Id: <20221022072513.673305871@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747374629993085048?= X-GMAIL-MSGID: =?utf-8?q?1747374629993085048?= From: Claudiu Beznea [ Upstream commit 808175e21d9b7f866eda742e8970f27b78afe5db ] In case triggered buffers are enabled while system is suspended they will not work anymore after resume. For this call at91_adc_buffer_postdisable() on suspend and at91_adc_buffer_prepare() on resume. On tests it has been seen that at91_adc_buffer_postdisable() call is not necessary but it has been kept because it also does the book keeping for DMA. On resume path there is no need to call at91_adc_configure_touch() as it is embedded in at91_adc_buffer_prepare(). Fixes: 073c662017f2f ("iio: adc: at91-sama5d2_adc: add support for DMA") Signed-off-by: Claudiu Beznea Link: https://lore.kernel.org/r/20220803102855.2191070-5-claudiu.beznea@microchip.com Signed-off-by: Jonathan Cameron Signed-off-by: Sasha Levin --- drivers/iio/adc/at91-sama5d2_adc.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/iio/adc/at91-sama5d2_adc.c b/drivers/iio/adc/at91-sama5d2_adc.c index 40a95d2fd5c8..2c087d52f164 100644 --- a/drivers/iio/adc/at91-sama5d2_adc.c +++ b/drivers/iio/adc/at91-sama5d2_adc.c @@ -2116,6 +2116,9 @@ static __maybe_unused int at91_adc_suspend(struct device *dev) struct iio_dev *indio_dev = dev_get_drvdata(dev); struct at91_adc_state *st = iio_priv(indio_dev); + if (iio_buffer_enabled(indio_dev)) + at91_adc_buffer_postdisable(indio_dev); + /* * Do a sofware reset of the ADC before we go to suspend. * this will ensure that all pins are free from being muxed by the ADC @@ -2159,14 +2162,11 @@ static __maybe_unused int at91_adc_resume(struct device *dev) if (!iio_buffer_enabled(indio_dev)) return 0; - /* check if we are enabling triggered buffer or the touchscreen */ - if (at91_adc_current_chan_is_touch(indio_dev)) - return at91_adc_configure_touch(st, true); - else - return at91_adc_configure_trigger(st->trig, true); + ret = at91_adc_buffer_prepare(indio_dev); + if (ret) + goto vref_disable_resume; - /* not needed but more explicit */ - return 0; + return at91_adc_configure_trigger(st->trig, true); vref_disable_resume: regulator_disable(st->vref); From patchwork Sat Oct 22 07:24:14 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 7416 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1097577wrr; Sat, 22 Oct 2022 01:08:08 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5CfGMNJozo1GOvGxuL5UCYqis3bxAuYpBGW2h5bgZzYjLH13gFL9UUhMd27jD9BnchmiVF X-Received: by 2002:a63:5a5e:0:b0:434:b739:206f with SMTP id k30-20020a635a5e000000b00434b739206fmr19400053pgm.82.1666426088155; Sat, 22 Oct 2022 01:08:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666426088; cv=none; d=google.com; s=arc-20160816; b=RpJ+8phYkb0lzUMqwniHnMcf9jd5AREgPp7pycZXg39l6UVaqi8SqnbMg57TUityRI ngBzmkcmJWplosqhCSdTcHboOSCBFrL2mFFb/tmDygcbTdXhdu+mcQlqFOmPckRHVYV/ jp5NyA58DyIXBAZj0UmnL2ojF4N7Yw2t0JrwLes44S4C/DJweHB2yZaHV4TGx9eRHP8t RnERw8fv9b30amUqqT+aCp5OsjgGyzIlx7ynq6gx2slpugLrfIiHw01mCxTOAVOa5yUk N7fY3cWwwd+It6PrxRT1P0Lz0IdXJqr7fkZmVkfFbcs9ygCLphor2xQCZr0JbWiCJMqb tQew== 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=+oE0JZb+KeUDsBGWPQnlpL7ruZ/m6k8pTnDTqBWtrX4=; b=1BRdRnlsq7hrBlgeADxAM07t+c9HKKtwyLdWo3YiunK8D61ijeXs4DlZUOAVuMg/wB 2ja3Uq1dHYI84gMcUbX00SJsMtQ6dXC8+rChN4hnOojg9BAb3cd4TQPpcn9gt0GlmU2X T7xjo4RVkUTtAkjk6pN6RHpMKyfR9fspOvE4tbcDenK7Psw+yuyEIkS+DmgUs49l135O eFLNEqRkJ2fWHwbCkGC6KVO2cPj3N2VLFBElaXymV2YRcIio+LX9myA7JjVwG+aNEYcN 4luGOOFqE5QYXbRTPlLIqA/ghNuiQMMp4WmqWCxGYkti5UMYagoKFzBZ50UyjyDEPLLe O5Rg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=y14zJNrr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 x4-20020a1709027c0400b0018528837336si25460372pll.425.2022.10.22.01.07.54; Sat, 22 Oct 2022 01:08: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=y14zJNrr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S232956AbiJVIHj (ORCPT + 99 others); Sat, 22 Oct 2022 04:07:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56074 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232493AbiJVIDW (ORCPT ); Sat, 22 Oct 2022 04:03:22 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 84F37152026; Sat, 22 Oct 2022 00:51: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 ADD69B82E18; Sat, 22 Oct 2022 07:50:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 23A95C433C1; Sat, 22 Oct 2022 07:50:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425054; bh=c/IdW/mBpyQMgYTrCHuboL6q7PPhJdh3DFEoIvN0a1c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=y14zJNrrt4ebpDbaeuFYMrc3wGK51fGNnydqAwd6h4fOdEshlyq33yhiZoqCewxUo FvbgAKx5C00qOTHnha24zw/JZvl+h5J241MoZ1X/HQNgVbGxf6n7/jeIaSQdWLC+Gv tHztABVnWD80uM8xjqXMnjCXLFYt+YT3fdRi9bWY= 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 5.19 375/717] iio: inkern: only release the device node when done with it Date: Sat, 22 Oct 2022 09:24:14 +0200 Message-Id: <20221022072513.751398027@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747374402055092291?= X-GMAIL-MSGID: =?utf-8?q?1747374402055092291?= 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 df74765d33dc..9d87057794fc 100644 --- a/drivers/iio/inkern.c +++ b/drivers/iio/inkern.c @@ -165,9 +165,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; @@ -175,6 +176,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 Sat Oct 22 07:24:15 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 7774 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1121156wrr; Sat, 22 Oct 2022 02:27:40 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4eqBbjBcISVlXg77vmT7+cga8RpFN3Vwi9WBcRz/wffFHzGjU9CBRd9vA+dx2rBoQuKQrC X-Received: by 2002:a17:90b:4c48:b0:20d:5c55:b8a8 with SMTP id np8-20020a17090b4c4800b0020d5c55b8a8mr27605354pjb.207.1666430859977; Sat, 22 Oct 2022 02:27:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666430859; cv=none; d=google.com; s=arc-20160816; b=t0NaAm6VhsnadiLWDXgxSj1DzJd3oueuDoVwe8MA/7mbE4zfKEnzbneqQ+2lm6CfBh 70lR3IZ1DPj0xsrK/BOQQ9yKtrfvZCy9Avg1ztHCyp4Jj3FyLTDVO9YgkCJu55s0r2Io OIZFCTE7xTyRX98JMRsDVothAFHolz3cU6+XeFPdt3lw7lpWTEUx+9eemO1B9Eo8Ym9k nt2AM73aql8Ptde7zNtL8SJjaOYx4CQ1WEBLxRmdByH6Qt8Rx3RskW1IKCkQVCR/YJ75 1KQSA3lmzIUJIel1b0Mgn6E14htJjBtHJQNAgH7qTfTxP+PdmcUJrhdg5ekQQY3Z4X1E Enxw== 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=MGz/Ny3qnn4Iw68vhpXp4rtzdB/NBnC/zXgaZPyC/wo=; b=ePOaXFAp8fzd97EvoMiRquo79Vlu0tgTgxdf81+a6ND/iMQ7VcwtE048OK9VNXHpUm 91rAZNrCY3XFWCv2w1Vj79kA6WL8+FDA4M6SRBkY2Ky85zdNuu8G24zMitsSkaq2cWS2 0qyBR4ndvEpbi28LZUJYHQpZJXU+qUA+pnwDiGdmMmBAnjCErjciUFdjOOVd6YMs3v6N YyuuubXdgdHhxPmd2Sers0HOqyBj9QjRvoVUaQfLLctyVwdIpOrRVDO0Ph7rdsii01Td IK9hTW8GlAq7exNCEt86zHfkyk2SwkT8EzdBAPpYURYpLhZoLDudx1ssGY6ukwZWE42C p0tQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=RRCqyv67; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 a25-20020a631a19000000b0045166930a46si29978817pga.609.2022.10.22.02.27.27; Sat, 22 Oct 2022 02:27: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=RRCqyv67; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231954AbiJVJFn (ORCPT + 99 others); Sat, 22 Oct 2022 05:05:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33032 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235170AbiJVJD5 (ORCPT ); Sat, 22 Oct 2022 05:03:57 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7F5CA2DCB04; Sat, 22 Oct 2022 01:19: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 6C7B5B82E34; Sat, 22 Oct 2022 07:50:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D4101C433B5; Sat, 22 Oct 2022 07:50:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425057; bh=daM7vcIsZKr7FdXlFX6dxhQkjn98nSSipw3bhrJuVxY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RRCqyv67aQ03PR72dCVeTty/NZ03j+KtBl/f18TPgIOt66njwzbrI05VuliRFNk2a y/1yLVv+D4vwDPrtOou8RC9hrqHXmndplhzOou+OSslN9r6pkdSFSeGfYKernQ475U L7+py7Z/t5Z0g6AtRfCj1QsAa32hbpIcATmLQLYM= 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?= , Andy Shevchenko , Jonathan Cameron , Sasha Levin Subject: [PATCH 5.19 376/717] iio: inkern: fix return value in devm_of_iio_channel_get_by_name() Date: Sat, 22 Oct 2022 09:24:15 +0200 Message-Id: <20221022072513.816258648@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747379405242119951?= X-GMAIL-MSGID: =?utf-8?q?1747379405242119951?= From: Nuno Sá [ Upstream commit 9e878dbc0e8322f8b2f5ab0093c1e89926362dbe ] of_iio_channel_get_by_name() can either return NULL or an error pointer so that only doing IS_ERR() is not enough. Fix it by checking the NULL pointer case and return -ENODEV in that case. Note this is done like this so that users of the function (which only check for error pointers) do not need to be changed. This is not ideal since we are losing error codes and as such, in a follow up change, things will be unified so that of_iio_channel_get_by_name() only returns error codes. Fixes: 6e39b145cef7 ("iio: provide of_iio_channel_get_by_name() and devm_ version it") Signed-off-by: Nuno Sá Reviewed-by: Andy Shevchenko Link: https://lore.kernel.org/r/20220715122903.332535-3-nuno.sa@analog.com Signed-off-by: Jonathan Cameron Signed-off-by: Sasha Levin --- drivers/iio/inkern.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/iio/inkern.c b/drivers/iio/inkern.c index 9d87057794fc..87fd2a0d44f2 100644 --- a/drivers/iio/inkern.c +++ b/drivers/iio/inkern.c @@ -412,6 +412,8 @@ struct iio_channel *devm_of_iio_channel_get_by_name(struct device *dev, channel = of_iio_channel_get_by_name(np, channel_name); if (IS_ERR(channel)) return channel; + if (!channel) + return ERR_PTR(-ENODEV); ret = devm_add_action_or_reset(dev, devm_iio_channel_free, channel); if (ret) From patchwork Sat Oct 22 07:24: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: 7750 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1113499wrr; Sat, 22 Oct 2022 02:03:45 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5uHVo7jpj0HZeXtg6iXGQWsMIBSIifVDo2sandA0s6at9QlFLmMf47IvAir2t6yZxuU/+v X-Received: by 2002:a05:6a00:1d26:b0:54e:8c81:9f64 with SMTP id a38-20020a056a001d2600b0054e8c819f64mr23626969pfx.58.1666429424757; Sat, 22 Oct 2022 02:03:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666429424; cv=none; d=google.com; s=arc-20160816; b=K0bQCdhnzEJZo0S7UClr0L5JR7LcIDbqAbQ+i2Zvq+iQASt4Brq6EXmjrgyr7hqVCr /9OAizO62vbM5Plcjku+XU5MIVZOnhVHK2WiOFrl5WhiXykNk8btvfuAHtu2ZNpfdD9a fe/lsJtaWxMt2/Cgy/8CiwyOQssLgyuyBP1FWR7IJRxph7KWizMZt8ZHPkFT0soPO+/a KyOUu0G1eYJYb9nVo7DqVA5bX3hQGrGllIU0JDU22EYhRaGft+u/oIfdCgLGrOX7uWDU b8AGLBXkX0GraJkLw5w/FUHNKJPb6kmdn2IOhmsQZQ4R0/5Dk0olP/upA/b12G1NtCFr Mt+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=mxGcgZm4Sp3DBgNeKHYZzgaELuUy0MqZ3v8B/tccCz4=; b=XfWHf6yaZ03ngJExzlTW02B5CEcdKc7grmPgruv2uW1guxsOBaa40fl7ggSCJ7WB9T HcU6bOmZsA77rsSwL7vus31XqHjFbp96oZjk8hWPnsTdaAEvXn8tzwni2U2+hTqCBQC9 ELfa6NvByDizASbC9V8pLKPfdtlqW8u3maMhiV5/8f2vBc76HtMldfaYTXtZFf5Jj9je opC7VHa6fRaXjMCDjpbLXwIHO0EmOifYGxvr2Id3fhcArWpdNnn9mjfwop+imMf21rQF WlXoMDZ8Ube7nkXh73SSZ5371COaxTUtJyKpQCTp5sa84nmrrHiw+c1QCXjG5bb6UYFv 5Wcw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=SHyhNPNd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 m5-20020a632605000000b00460d04d9decsi28000138pgm.496.2022.10.22.02.03.31; Sat, 22 Oct 2022 02:03: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=SHyhNPNd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S232089AbiJVI7b (ORCPT + 99 others); Sat, 22 Oct 2022 04:59:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32932 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234979AbiJVI6p (ORCPT ); Sat, 22 Oct 2022 04:58: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 76013246C19; Sat, 22 Oct 2022 01:15: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 170F460AFD; Sat, 22 Oct 2022 07:51:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1D8FBC433D7; Sat, 22 Oct 2022 07:51:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425063; bh=4abi/4jNdBNqhiqGWlFSGmL+b4osVMnf3UouVuJY5sQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SHyhNPNdXEr5KU/zjtMhaW4LpQq+xR6tPTJyS0oc/hKlPTVHXb5sgdf75H1sw9kik yQ6vRPieVNOeYVbIUlWL93S41i142R2MgXwQ9Q5E5mSdA72xFUqALx2MZ/xOotoAL3 i4fvPPc917zeVS8jZ+8dT7x4YsFOqjJoK3Pqd2tA= 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 5.19 377/717] iio: ABI: Fix wrong format of differential capacitance channel ABI. Date: Sat, 22 Oct 2022 09:24:16 +0200 Message-Id: <20221022072513.877298878@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747377900743482534?= X-GMAIL-MSGID: =?utf-8?q?1747377900743482534?= 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 d4ccc68fdcf0..b19ff517e5d6 100644 --- a/Documentation/ABI/testing/sysfs-bus-iio +++ b/Documentation/ABI/testing/sysfs-bus-iio @@ -188,7 +188,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 Sat Oct 22 07:24: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: 7419 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1097603wrr; Sat, 22 Oct 2022 01:08:15 -0700 (PDT) X-Google-Smtp-Source: AMsMyM63ulJ5Z9uOMdHM83u4V4FOheJ+SDMeymBuXdFI1UTkPl6ldDQl4g7g1WbL6gZEuUlppJBy X-Received: by 2002:a05:6a00:2191:b0:56a:fd17:6723 with SMTP id h17-20020a056a00219100b0056afd176723mr6088880pfi.4.1666426095401; Sat, 22 Oct 2022 01:08:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666426095; cv=none; d=google.com; s=arc-20160816; b=I7kOxGYqMnfebJUJDeAiy2EtfHvhiWBZBbp1whlaFMYq94TQZZvbSniKGNCY5jbEF1 i4IyA1sLP8cVIWfIDPK03HES68mKZ8wAtf0I3gX7fPBJ4nRtAWUMhMavyFTCkqgZiAYC C0Ma6w7jiGxlctAf6ohLLoZNVTCIP5vLxdrtgoRDXR6T7QAvYmWH3qMl9oL9yZT2nb4s l57KgfDCgU+Oy+rHVCjwDzxzOBIfo3d9nweLWGidr9p6oMz1bGlwJUjQA6wgmrgyx2dE AzzPP6/bKEfUFzDJCqQicozc7axN0WRiTbV4S9+DRxEBnIPj12ItvfuH3uVmQwRjXyy+ a/rQ== 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=z+PHrGBK/ycuAA1DAeuKjEyTpt59n0MQfKZqu7GKssw=; b=W6Jf3llxrkV5IsHDmSVSaB5oP0FtYT2SLjJhxThifBRWh1q7NWHEQwlCAQNKb4ZtLl vrg4xhZ7mt62swiHoU3QoWq3H9OOlL2O2UDYRoETsd0Ei2vN4UBjW6su23ZM5sgwt+f4 EXQxYKVz2oAO3/A6x2DFOZH1xRs1DuWOymBV2wisSUDl9qLGhI6hCNDriD1P8gAh59+F Bok/IRkl4/ChHYZX4P4f1iNLczahOeIWD1AXezegfZ3b8kh7pbEAPJklmallBj8b7pa6 Bmvm7nxZO16Tm7pkl+j6dkP5bNtwpgV+S7Q3WzEqqvbW8G7TUPjDZBwUHjjZOEgWarj4 RzUA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=MSnK4u9T; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 j12-20020a63cf0c000000b00434c05007d5si28001289pgg.845.2022.10.22.01.08.02; Sat, 22 Oct 2022 01:08: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=MSnK4u9T; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S232986AbiJVIHt (ORCPT + 99 others); Sat, 22 Oct 2022 04:07:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42868 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232763AbiJVIEK (ORCPT ); Sat, 22 Oct 2022 04:04: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 570BA2A4E1A; Sat, 22 Oct 2022 00:51: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 A11A1B82E38; Sat, 22 Oct 2022 07:51:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DF419C433D6; Sat, 22 Oct 2022 07:51:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425066; bh=iBB9h9YvKlo2kBA38TF8vV6C0UBNbRscfhurjMCwveY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MSnK4u9TKNzZbpOdoNGwSHi4Z8qjXJOcLs+J8czEfLzgbNTrvZszU4mSfpBd6fhPO JhRgRl0gRosytHhTDZdcgwo2kvi08zkE2/iH76nsMwTo5EKmzS/nuhEU7466AdWvWo XLJrD7c0SuGSWLI0t5CaWaYQD5ZmVKxk0NLTYQqg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jakob Hauser , Linus Walleij , Andy Shevchenko , Jonathan Cameron , Sasha Levin Subject: [PATCH 5.19 378/717] iio: magnetometer: yas530: Change data type of hard_offsets to signed Date: Sat, 22 Oct 2022 09:24:17 +0200 Message-Id: <20221022072513.929591657@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747374409133102194?= X-GMAIL-MSGID: =?utf-8?q?1747374409133102194?= From: Jakob Hauser [ Upstream commit e137fafc8985cf152a4bb6f18ae83ebb06816df1 ] The "hard_offsets" are currently unsigned u8 but they should be signed as they can get negative. They are signed in function yas5xx_meaure_offsets() and in the Yamaha drivers [1][2]. [1] https://github.com/NovaFusion/android_kernel_samsung_golden/blob/cm-12.1/drivers/sensor/compass/yas.h#L156 [2] https://github.com/msm8916-mainline/android_kernel_qcom_msm8916/blob/GT-I9195I/drivers/iio/magnetometer/yas_mag_drv-yas532.c#L91 Fixes: de8860b1ed47 ("iio: magnetometer: Add driver for Yamaha YAS530") Signed-off-by: Jakob Hauser Reviewed-by: Linus Walleij Reviewed-by: Andy Shevchenko Link: https://lore.kernel.org/r/40f052bf6491457d0c5c0ed4c3534dc6fa251c3c.1660337264.git.jahau@rocketmail.com Signed-off-by: Jonathan Cameron Signed-off-by: Sasha Levin --- drivers/iio/magnetometer/yamaha-yas530.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/iio/magnetometer/yamaha-yas530.c b/drivers/iio/magnetometer/yamaha-yas530.c index b2bc637150bf..40192aa46b04 100644 --- a/drivers/iio/magnetometer/yamaha-yas530.c +++ b/drivers/iio/magnetometer/yamaha-yas530.c @@ -132,7 +132,7 @@ struct yas5xx { unsigned int version; char name[16]; struct yas5xx_calibration calibration; - u8 hard_offsets[3]; + s8 hard_offsets[3]; struct iio_mount_matrix orientation; struct regmap *map; struct regulator_bulk_data regs[2]; From patchwork Sat Oct 22 07:24: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: 7603 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1106532wrr; Sat, 22 Oct 2022 01:38:13 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5ljA9XjDT16Nls7UTCRsKB55e1gJYlO2OEbFMyiHh9Nf7jAIHesp8dmMri25idUg3Os0N+ X-Received: by 2002:a05:6a00:16c8:b0:53b:3b9f:7283 with SMTP id l8-20020a056a0016c800b0053b3b9f7283mr23242887pfc.46.1666427892876; Sat, 22 Oct 2022 01:38:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666427892; cv=none; d=google.com; s=arc-20160816; b=1EWGYzGqKl0GBUOrxAXgr5VO//plMh11SGzpPGrduzoYA2e7VSZOYgCwy7gzbu30s1 hTdyNrLZ0c7oeTRnPvoERVT849+GJ9e9zZE5jn+pE+3WRaDdhdRac+SA1M36+EQNPn80 rOIzu6ZyvDgrxKoXfz2uY6fW06kw5Lb0g9jXQy2NVuhKL1ZWy++jASwMwJUXSPPiqd2D LgSxII1uHZokISWqQfaNnGEFD98b/3GXlLACF2U1vuz2kFFMHvXWT6PSNowHeJb2nWsN ZKmKHHJltGajIqaNrIQ2s3xXWfJ6H61Sk/BYBQLxNZ+WJaqvNYEhPtuTcw2def2AcIev C0GA== 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=FxUojSLRVQ6I+jUK6VWzPRbcjQ8KmtEX4iO6Xq7Hkx8=; b=BgeZm54G+SWMT24JKjjMohSWUnrq+7Dm6AaaijFyjzIYHLzC+K03mzQjrW31ajzQhc xwia6vPIsLb7HcI1/nWciBu00+qRs39RhJ+mtEmtCB0Rai3REd1O31p0JchQZjeU1E9/ YTZU9wyW3Q5E2yqqgofqqLNEu01dp1sSiHYUYRkfluxUphCFNy5Acc8UP/27Wt0c7Zhd srfmkzq4IqR9hHfsbQ86wihEeYwI2wEpP1HAriy1596ih5SNwJyAWPoimkYLnopPAEU5 nFFwq4H4iUcc4AbN++w0qMYPg03EKlDvPMPWCMqQ+xu7hCQ/jRfbk2R0qxQKojckq/+B aB6w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=mwokMRQ5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 t37-20020a056a0013a500b0056b86567ce9si1224706pfg.347.2022.10.22.01.37.54; Sat, 22 Oct 2022 01:38: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=mwokMRQ5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S230497AbiJVIf7 (ORCPT + 99 others); Sat, 22 Oct 2022 04:35:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58088 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234227AbiJVIaE (ORCPT ); Sat, 22 Oct 2022 04:30: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 881832E32D9; Sat, 22 Oct 2022 01: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 050E4B82E11; Sat, 22 Oct 2022 07:51:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D038CC433C1; Sat, 22 Oct 2022 07:51:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425069; bh=GGfMeq0Y2E3Tt4hU/JXQhleUHqj5ipTavMY9Ad79xMM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mwokMRQ52ijagpbWduhcQ0KHynY0dxHloom3b1Ysm4s+FQYhh/jCKm/tNp6EMsIjX dToLN1Hrcmt/vKqQs2wJm4v+ojlJQsi0hssjT+vhQLviTR8Phi+3AZkIwt4FXns+i5 TWdeBszFwiogub75Ks+5pSBm6MXi0ALyM6DvmA8M= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Aharon Landau , Leon Romanovsky , Sasha Levin Subject: [PATCH 5.19 379/717] RDMA/mlx5: Dont compare mkey tags in DEVX indirect mkey Date: Sat, 22 Oct 2022 09:24:18 +0200 Message-Id: <20221022072513.991553805@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376294200425078?= X-GMAIL-MSGID: =?utf-8?q?1747376294200425078?= From: Aharon Landau [ Upstream commit 13ad1125b941a5f257d9d3ae70485773abd34792 ] According to the ib spec: If the CI supports the Base Memory Management Extensions defined in this specification, the L_Key format must consist of: 24 bit index in the most significant bits of the R_Key, and 8 bit key in the least significant bits of the R_Key Through a successful Allocate L_Key verb invocation, the CI must let the consumer own the key portion of the returned R_Key Therefore, when creating a mkey using DEVX, the consumer is allowed to change the key part. The kernel should compare only the index part of a R_Key to determine equality with another R_Key. Adding capability in order not to break backward compatibility. Fixes: 534fd7aac56a ("IB/mlx5: Manage indirection mkey upon DEVX flow for ODP") Link: https://lore.kernel.org/r/3d669aacea85a3a15c3b3b953b3eaba3f80ef9be.1659255945.git.leonro@nvidia.com Signed-off-by: Aharon Landau Signed-off-by: Leon Romanovsky Signed-off-by: Sasha Levin --- drivers/infiniband/hw/mlx5/main.c | 3 +++ drivers/infiniband/hw/mlx5/odp.c | 3 ++- include/uapi/rdma/mlx5-abi.h | 1 + 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/infiniband/hw/mlx5/main.c b/drivers/infiniband/hw/mlx5/main.c index bb13164124fd..aa4a2a9cb0d5 100644 --- a/drivers/infiniband/hw/mlx5/main.c +++ b/drivers/infiniband/hw/mlx5/main.c @@ -1826,6 +1826,9 @@ static int set_ucontext_resp(struct ib_ucontext *uctx, if (MLX5_CAP_GEN(dev->mdev, drain_sigerr)) resp->comp_mask |= MLX5_IB_ALLOC_UCONTEXT_RESP_MASK_SQD2RTS; + resp->comp_mask |= + MLX5_IB_ALLOC_UCONTEXT_RESP_MASK_MKEY_UPDATE_TAG; + return 0; } diff --git a/drivers/infiniband/hw/mlx5/odp.c b/drivers/infiniband/hw/mlx5/odp.c index 84da5674e1ab..9151852f04a1 100644 --- a/drivers/infiniband/hw/mlx5/odp.c +++ b/drivers/infiniband/hw/mlx5/odp.c @@ -795,7 +795,8 @@ static bool mkey_is_eq(struct mlx5_ib_mkey *mmkey, u32 key) { if (!mmkey) return false; - if (mmkey->type == MLX5_MKEY_MW) + if (mmkey->type == MLX5_MKEY_MW || + mmkey->type == MLX5_MKEY_INDIRECT_DEVX) return mlx5_base_mkey(mmkey->key) == mlx5_base_mkey(key); return mmkey->key == key; } diff --git a/include/uapi/rdma/mlx5-abi.h b/include/uapi/rdma/mlx5-abi.h index 86be4a92b67b..a96b7d2770e1 100644 --- a/include/uapi/rdma/mlx5-abi.h +++ b/include/uapi/rdma/mlx5-abi.h @@ -104,6 +104,7 @@ enum mlx5_ib_alloc_ucontext_resp_mask { MLX5_IB_ALLOC_UCONTEXT_RESP_MASK_ECE = 1UL << 2, MLX5_IB_ALLOC_UCONTEXT_RESP_MASK_SQD2RTS = 1UL << 3, MLX5_IB_ALLOC_UCONTEXT_RESP_MASK_REAL_TIME_TS = 1UL << 4, + MLX5_IB_ALLOC_UCONTEXT_RESP_MASK_MKEY_UPDATE_TAG = 1UL << 5, }; enum mlx5_user_cmds_supp_uhw { From patchwork Sat Oct 22 07:24: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: 7438 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1098287wrr; Sat, 22 Oct 2022 01:10:19 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6vKluz+0siL2N23xz+B0bTkld97nldeMj77tT0jB/FVK6gLUKG6+sJiWJaV/xYsh0WAISr X-Received: by 2002:a17:90a:b00a:b0:203:87a3:9e70 with SMTP id x10-20020a17090ab00a00b0020387a39e70mr26557121pjq.218.1666426218762; Sat, 22 Oct 2022 01:10:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666426218; cv=none; d=google.com; s=arc-20160816; b=TVZaM3CqAk9FFZPyIpNIOJtDhMMYYSJkppxYqQIuSWl/EZwFs7v5F6GJ4X+4D1ewCz G66md3wQUjd4UHR6/jMR0MDXOe7CqBP+dRG7b+LRVOqPcL6E0blpilZlxPg3Nk0jiwmG TM+bBsE3Hkna1pBHoxAFrgW2Ah/vTFes7PTW7dRM6UvtX0NyemFZsMI9g/4NtmcAIRXT kpHJbRpscjjJdARwOfsByOU3a4g+Y+Hcbgxc9n1G+j91ou3r++TeHFhzFLrwzmKIyT/h v6OLuv4TdGVIiQb46ePUe6ZunwFK7k/G7KxOFnEwWQSrzYB86pNnCEiK8iwewpPEUN40 gV2A== 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=a6OXrutsy4iiEAR4LZgS+vLZK2oF+SHofZwrfhghfjY=; b=PH+3QabJLL8LREZGw+7REI5SJfixNeh1+WkXaISBhOr1NTkNY9rWv+k0j/OEXco/Vx w8fjfaSj0SyJAmxLkvtxTCCvdy8OC+pFPdV5Rs2VoLb83D0xEpOyv/RJ4iGCqpjgvpvI kMjqPgIk3DU8626HzVRMiVllH/3EuEmsDyRT/9cr7rQ7dx2zhZl0Kpeinj0XoLxeN1Le CkXVVjfwoz5vyXwP8K6RGyIzcgr885AzVINccz62WayH/Ibo7zn0Lu+JdS8eZ/XRkJMU 5I4wtl/NsmF017kLlclXE+1HcSnaH5vM+qGKF6uSHA1Vbe+1rMxLdr06huDWyJ0efe8e pRsg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ATh5wt7U; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 c12-20020a170903234c00b0017f792fe3edsi30230366plh.266.2022.10.22.01.10.05; Sat, 22 Oct 2022 01:10: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=ATh5wt7U; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S233176AbiJVIJI (ORCPT + 99 others); Sat, 22 Oct 2022 04:09:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60734 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233101AbiJVIEv (ORCPT ); Sat, 22 Oct 2022 04:04:51 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 78CBF2C634E; Sat, 22 Oct 2022 00:52: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 1C45FB82DF7; Sat, 22 Oct 2022 07:51:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 32016C433C1; Sat, 22 Oct 2022 07:51:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425072; bh=qI6XQaN06IuKoof2ZGO7xbX8GPjKLgwHHsphrLlDk3M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ATh5wt7Uvfxh1LkZI5iJI+rnj9uJ5zCL9JsXgMcdE2VgC32mGwsasxgDKJgfpTbtM k7UNNGF5dDZIAeNRGQQTN3ZJhXn4hlvY27Gn3GmkwlA619Tmh67RBAgPLsdOBTFCJG zOCfw18/jYkhm3Ss4Z3Ggrd39sxHLQ2+C8vYcZhA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Thinh Nguyen , Sasha Levin Subject: [PATCH 5.19 380/717] usb: common: debug: Check non-standard control requests Date: Sat, 22 Oct 2022 09:24:19 +0200 Message-Id: <20221022072514.062890391@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747374538678731804?= X-GMAIL-MSGID: =?utf-8?q?1747374538678731804?= From: Thinh Nguyen [ Upstream commit b6155eaf6b05e558218b44b88a6cad03f15a586c ] Previously usb_decode_ctrl() only decodes standard control requests, but it was used for non-standard requests also. If it's non-standard or unknown standard bRequest, print the Setup data values. Fixes: af32423a2d86 ("usb: dwc3: trace: decode ctrl request") Signed-off-by: Thinh Nguyen Link: https://lore.kernel.org/r/8d6a30f2f2f953eff833a5bc5aac640a4cc2fc9f.1658971571.git.Thinh.Nguyen@synopsys.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/usb/common/debug.c | 96 +++++++++++++++++++++++++------------- 1 file changed, 64 insertions(+), 32 deletions(-) diff --git a/drivers/usb/common/debug.c b/drivers/usb/common/debug.c index 075f6b1b2a1a..f204cec8d380 100644 --- a/drivers/usb/common/debug.c +++ b/drivers/usb/common/debug.c @@ -208,30 +208,28 @@ static void usb_decode_set_isoch_delay(__u8 wValue, char *str, size_t size) snprintf(str, size, "Set Isochronous Delay(Delay = %d ns)", wValue); } -/** - * usb_decode_ctrl - Returns human readable representation of control request. - * @str: buffer to return a human-readable representation of control request. - * This buffer should have about 200 bytes. - * @size: size of str buffer. - * @bRequestType: matches the USB bmRequestType field - * @bRequest: matches the USB bRequest field - * @wValue: matches the USB wValue field (CPU byte order) - * @wIndex: matches the USB wIndex field (CPU byte order) - * @wLength: matches the USB wLength field (CPU byte order) - * - * Function returns decoded, formatted and human-readable description of - * control request packet. - * - * The usage scenario for this is for tracepoints, so function as a return - * use the same value as in parameters. This approach allows to use this - * function in TP_printk - * - * Important: wValue, wIndex, wLength parameters before invoking this function - * should be processed by le16_to_cpu macro. - */ -const char *usb_decode_ctrl(char *str, size_t size, __u8 bRequestType, - __u8 bRequest, __u16 wValue, __u16 wIndex, - __u16 wLength) +static void usb_decode_ctrl_generic(char *str, size_t size, __u8 bRequestType, + __u8 bRequest, __u16 wValue, __u16 wIndex, + __u16 wLength) +{ + u8 recip = bRequestType & USB_RECIP_MASK; + u8 type = bRequestType & USB_TYPE_MASK; + + snprintf(str, size, + "Type=%s Recipient=%s Dir=%s bRequest=%u wValue=%u wIndex=%u wLength=%u", + (type == USB_TYPE_STANDARD) ? "Standard" : + (type == USB_TYPE_VENDOR) ? "Vendor" : + (type == USB_TYPE_CLASS) ? "Class" : "Unknown", + (recip == USB_RECIP_DEVICE) ? "Device" : + (recip == USB_RECIP_INTERFACE) ? "Interface" : + (recip == USB_RECIP_ENDPOINT) ? "Endpoint" : "Unknown", + (bRequestType & USB_DIR_IN) ? "IN" : "OUT", + bRequest, wValue, wIndex, wLength); +} + +static void usb_decode_ctrl_standard(char *str, size_t size, __u8 bRequestType, + __u8 bRequest, __u16 wValue, __u16 wIndex, + __u16 wLength) { switch (bRequest) { case USB_REQ_GET_STATUS: @@ -272,14 +270,48 @@ const char *usb_decode_ctrl(char *str, size_t size, __u8 bRequestType, usb_decode_set_isoch_delay(wValue, str, size); break; default: - snprintf(str, size, "%02x %02x %02x %02x %02x %02x %02x %02x", - bRequestType, bRequest, - (u8)(cpu_to_le16(wValue) & 0xff), - (u8)(cpu_to_le16(wValue) >> 8), - (u8)(cpu_to_le16(wIndex) & 0xff), - (u8)(cpu_to_le16(wIndex) >> 8), - (u8)(cpu_to_le16(wLength) & 0xff), - (u8)(cpu_to_le16(wLength) >> 8)); + usb_decode_ctrl_generic(str, size, bRequestType, bRequest, + wValue, wIndex, wLength); + break; + } +} + +/** + * usb_decode_ctrl - Returns human readable representation of control request. + * @str: buffer to return a human-readable representation of control request. + * This buffer should have about 200 bytes. + * @size: size of str buffer. + * @bRequestType: matches the USB bmRequestType field + * @bRequest: matches the USB bRequest field + * @wValue: matches the USB wValue field (CPU byte order) + * @wIndex: matches the USB wIndex field (CPU byte order) + * @wLength: matches the USB wLength field (CPU byte order) + * + * Function returns decoded, formatted and human-readable description of + * control request packet. + * + * The usage scenario for this is for tracepoints, so function as a return + * use the same value as in parameters. This approach allows to use this + * function in TP_printk + * + * Important: wValue, wIndex, wLength parameters before invoking this function + * should be processed by le16_to_cpu macro. + */ +const char *usb_decode_ctrl(char *str, size_t size, __u8 bRequestType, + __u8 bRequest, __u16 wValue, __u16 wIndex, + __u16 wLength) +{ + switch (bRequestType & USB_TYPE_MASK) { + case USB_TYPE_STANDARD: + usb_decode_ctrl_standard(str, size, bRequestType, bRequest, + wValue, wIndex, wLength); + break; + case USB_TYPE_VENDOR: + case USB_TYPE_CLASS: + default: + usb_decode_ctrl_generic(str, size, bRequestType, bRequest, + wValue, wIndex, wLength); + break; } return str; From patchwork Sat Oct 22 07:24: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: 7843 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1153695wrr; Sat, 22 Oct 2022 04:06:27 -0700 (PDT) X-Google-Smtp-Source: AMsMyM76M0v2njfaSgPsEXSNX0djs9A/n3ODRlfsEnKVRAdgcGqPP4VtEaRMFj5+lrPbDVwP9qGQ X-Received: by 2002:a17:907:2bec:b0:78d:8bd0:61ee with SMTP id gv44-20020a1709072bec00b0078d8bd061eemr20173067ejc.669.1666436787398; Sat, 22 Oct 2022 04:06:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666436787; cv=none; d=google.com; s=arc-20160816; b=QEbrxpzISWW7f66GSYomoTmQXFsAELq1sZ8x3JA7WDE7/1R7uvk8w09PTEsCUEzNEm noHH14ifevrSijPxNWmoS9XHNOiL+hdQUwFYWoADU+Itchiu3IEnZlbS8JfHn+Q5FZXE V16EZuozO01hgRcWMmpnSkjb3COSKBLZNhq4MeqtpovIqOb15pGYmiALKOuCgxLlF2ZM hLTIcn/Qjf5lc/rI/hf0dLsww2Y8JTlcNvsC79ff0xGX4EENcplatUMyvphH4uIdOUGk Dddto5TvPtY1XcgPFrsyD5/+nqzXvaWrPzbaA6lE1yZFS+SrFH8F8YAa/VZ8AERvcG1Q 2rCw== 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=YepjPZ/t+MCEPPZTFgrI/o/66+Pt4E1x6AtaHKSGv6o=; b=iDuRRgvDlyHVIeKwn4N+DPqAsiylXOOoWzR08iMCnUQz2ob/4haQTQRlnosF2hJik/ tFVtKXD9/3axcWOKx/xr4KVp5KTLOdUJsg1S+ff0KMklrobuNtQcizOtbV78iTvKzfwp 5fMu65D+t8KC6kSS+VzbNm6JxeXh1272wSiRPTMUVVk0mQXuEgiUo7J8SCzSyjoaiXVV FoH4KPXqfOayud13iIGb1qSMNxYw6QMsftCslB68GQMXNogujqB+BDfC02ps3O5KDY7n rc/MNJvVfWskq7PErvaFIjcxrNRACgPGKI5HYT3+HeG8Wc3oWEAXoyPv6iH09msE5HSY 0PWQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=2UPPkWEO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 q10-20020a170906678a00b0078da83673a3si19462617ejp.138.2022.10.22.04.06.02; Sat, 22 Oct 2022 04:06: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=2UPPkWEO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S230078AbiJVK7T (ORCPT + 99 others); Sat, 22 Oct 2022 06:59:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34964 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230494AbiJVK6m (ORCPT ); Sat, 22 Oct 2022 06:58:42 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 745CC2E9E34; Sat, 22 Oct 2022 03:17: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 20181B82DF6; Sat, 22 Oct 2022 07:51:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 25DC0C433C1; Sat, 22 Oct 2022 07:51:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425075; bh=iyKhAeS+fL/4paGpY198m4bprWGcYWFl+THorYYK8i8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=2UPPkWEO/lWymHKNOq5sS423ER7qDfqzYWKgpiiYUyeHFhD7HbJ9t2L02NPMZlxBX CyPJOncFVBBmDrVVuVYjedTjNg2EoxLT5I2/F0vrxnxs8TNTl2YgvTzJCc5TDUe0OF Fw8YmwHHruvKgjXxFYLLtU5bTHBPRJWhQ5Xojsd8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Liang He , Neil Armstrong , Martin Blumenstingl , Stephen Boyd , Sasha Levin Subject: [PATCH 5.19 381/717] clk: meson: Hold reference returned by of_get_parent() Date: Sat, 22 Oct 2022 09:24:20 +0200 Message-Id: <20221022072514.134126867@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 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?1747385621030673001?= X-GMAIL-MSGID: =?utf-8?q?1747385621030673001?= From: Liang He [ Upstream commit 89ab396d712f7c91fe94f55cff23460426f5fc81 ] We should hold the reference returned by of_get_parent() and use it to call of_node_put() for refcount balance. Fixes: 88e2da81241e ("clk: meson: aoclk: refactor common code into dedicated file") Fixes: 6682bd4d443f ("clk: meson: factorise meson64 peripheral clock controller drivers") Fixes: bb6eddd1d28c ("clk: meson: meson8b: use the HHI syscon if available") Signed-off-by: Liang He Link: https://lore.kernel.org/r/20220628141038.168383-1-windhl@126.com Reviewed-by: Neil Armstrong Reviewed-by: Martin Blumenstingl Signed-off-by: Stephen Boyd Signed-off-by: Sasha Levin --- drivers/clk/meson/meson-aoclk.c | 5 ++++- drivers/clk/meson/meson-eeclk.c | 5 ++++- drivers/clk/meson/meson8b.c | 5 ++++- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/drivers/clk/meson/meson-aoclk.c b/drivers/clk/meson/meson-aoclk.c index 27cd2c1f3f61..434cd8f9de82 100644 --- a/drivers/clk/meson/meson-aoclk.c +++ b/drivers/clk/meson/meson-aoclk.c @@ -38,6 +38,7 @@ int meson_aoclkc_probe(struct platform_device *pdev) struct meson_aoclk_reset_controller *rstc; struct meson_aoclk_data *data; struct device *dev = &pdev->dev; + struct device_node *np; struct regmap *regmap; int ret, clkid; @@ -49,7 +50,9 @@ int meson_aoclkc_probe(struct platform_device *pdev) if (!rstc) return -ENOMEM; - regmap = syscon_node_to_regmap(of_get_parent(dev->of_node)); + np = of_get_parent(dev->of_node); + regmap = syscon_node_to_regmap(np); + of_node_put(np); if (IS_ERR(regmap)) { dev_err(dev, "failed to get regmap\n"); return PTR_ERR(regmap); diff --git a/drivers/clk/meson/meson-eeclk.c b/drivers/clk/meson/meson-eeclk.c index 8d5a5dab955a..0e5e6b57eb20 100644 --- a/drivers/clk/meson/meson-eeclk.c +++ b/drivers/clk/meson/meson-eeclk.c @@ -18,6 +18,7 @@ int meson_eeclkc_probe(struct platform_device *pdev) { const struct meson_eeclkc_data *data; struct device *dev = &pdev->dev; + struct device_node *np; struct regmap *map; int ret, i; @@ -26,7 +27,9 @@ int meson_eeclkc_probe(struct platform_device *pdev) return -EINVAL; /* Get the hhi system controller node */ - map = syscon_node_to_regmap(of_get_parent(dev->of_node)); + np = of_get_parent(dev->of_node); + map = syscon_node_to_regmap(np); + of_node_put(np); if (IS_ERR(map)) { dev_err(dev, "failed to get HHI regmap\n"); diff --git a/drivers/clk/meson/meson8b.c b/drivers/clk/meson/meson8b.c index 8f3b7a94a667..827e78fb16a8 100644 --- a/drivers/clk/meson/meson8b.c +++ b/drivers/clk/meson/meson8b.c @@ -3792,12 +3792,15 @@ static void __init meson8b_clkc_init_common(struct device_node *np, struct clk_hw_onecell_data *clk_hw_onecell_data) { struct meson8b_clk_reset *rstc; + struct device_node *parent_np; const char *notifier_clk_name; struct clk *notifier_clk; struct regmap *map; int i, ret; - map = syscon_node_to_regmap(of_get_parent(np)); + parent_np = of_get_parent(np); + map = syscon_node_to_regmap(parent_np); + of_node_put(parent_np); if (IS_ERR(map)) { pr_err("failed to get HHI regmap - Trying obsolete regs\n"); return; From patchwork Sat Oct 22 07:24: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: 7771 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1121088wrr; Sat, 22 Oct 2022 02:27:27 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5X24gEIZ0NoaY32pvC8FWX9zJlDHv1tyR8RcKu9PWm71EbZerC66rlq63h8lSfuQPtqKjH X-Received: by 2002:a05:6a00:174a:b0:562:781f:eca3 with SMTP id j10-20020a056a00174a00b00562781feca3mr23080931pfc.41.1666430847295; Sat, 22 Oct 2022 02:27:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666430847; cv=none; d=google.com; s=arc-20160816; b=Jim4DQZt/NcYq2PwNT9GyzB+TnoqlN034ODVKHh2o5HGYOr+G9F4TEab8r7yd7LypC cKsOJ6ZBJX//FNfjXvb2mMh8AjPZ+QOtehu++H43dIo1Up5aOij9knCWAasHFmt/e3VQ /LRkOeL91XVB25T2+/WU7tBKG8CG6B1OHYQoZUm9XsiKvJqIhwJq8ar/5N0uHUoicxgk M/f8DCV1NqRn6lcpn8a1lO8gl9RwD2uyr/xjTdAp+aAQpS49ZPbkaH2rfzEzZD+SLqVI UnWxOf9UUFMtVFutRlnRe9+1UAwFVffyu3DDc3E/TDGTP35rG48iVl5Q90l/8w70F6eY yrAQ== 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=MK5VI+3GBq8LdKsjE6o7xvZVfSAcQ8o/y+v9hNNFJts=; b=0TtvD6FuKgXxFU8rPPsvq2aSkHricUdBk6zdchu2MmYAXaUgVqAOL8qv2v4il2ZSpD /5CGdrEh4jPW1tRxBhKD1pTsJT0IufhqXVwiFmpeD22j101Ms/nqd9MnbBWQEahyuKDN hJ0E4cFjY662MSM7/7UfOolwmuvCJLdOTDkmOlCcinm/XVJzkQU3wkiitOsYePFPjPVj TId8Qymw6AtwOzcoiM7RZMFjVxB5YK5q/fGtFYPukhrbV1noNYIqHZvepoaoTYxNng1f DkK8ZujmLWh/oJKvYZ8NcXSDTODnQYZg6tZ8yh3WXj8THqvamWvVcRnBDa6ZmIvN3VC9 m5CQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=JxzKIfy4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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-20020a170902ced200b001865dfb6774si11670600plg.458.2022.10.22.02.27.14; Sat, 22 Oct 2022 02:27: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=JxzKIfy4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S233577AbiJVJFa (ORCPT + 99 others); Sat, 22 Oct 2022 05:05:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58746 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235139AbiJVJDy (ORCPT ); Sat, 22 Oct 2022 05:03: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 3623A2FACFB; Sat, 22 Oct 2022 01:19: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 489CD60ADB; Sat, 22 Oct 2022 07:51:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5341BC433D7; Sat, 22 Oct 2022 07:51:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425078; bh=mgfxMUrqtSlUZHIjEaaKuLvZ8O/qKzLSst2rHPmyHgE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JxzKIfy4NFP9DHHg8O1lEK05g8c0KaxCxFZoCIatyGYsGxlyWZwzFEn+lHNTYtDiu SWg62ZBYbGGsbi1psTRqxAC6qudfT0uiPXXtZj6zTAqFQAppPolIoywFPReeRn1+4L KJ3GR8J5/dQRGB4/Dmct1neLooWYfEs+xscjnvJA= 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 5.19 382/717] clk: st: Hold reference returned by of_get_parent() Date: Sat, 22 Oct 2022 09:24:21 +0200 Message-Id: <20221022072514.301189135@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747379392231498828?= X-GMAIL-MSGID: =?utf-8?q?1747379392231498828?= From: Liang He [ Upstream commit 429973306f860470cbbb8402c8c53143b450faba ] We should hold the reference returned by of_get_parent() and use it to call of_node_put() for refcount balance. Fixes: 3efe64ef5186 ("clk: st: clkgen-fsyn: search reg within node or parent") Fixes: 810251b0d36a ("clk: st: clkgen-mux: search reg within node or parent") Signed-off-by: Liang He Link: https://lore.kernel.org/r/20220628142416.169808-1-windhl@126.com Signed-off-by: Stephen Boyd Signed-off-by: Sasha Levin --- drivers/clk/st/clkgen-fsyn.c | 5 ++++- drivers/clk/st/clkgen-mux.c | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/clk/st/clkgen-fsyn.c b/drivers/clk/st/clkgen-fsyn.c index 582a22c04919..d820292a381d 100644 --- a/drivers/clk/st/clkgen-fsyn.c +++ b/drivers/clk/st/clkgen-fsyn.c @@ -987,6 +987,7 @@ static void __init st_of_quadfs_setup(struct device_node *np, const char *pll_name, *clk_parent_name; void __iomem *reg; spinlock_t *lock; + struct device_node *parent_np; /* * First check for reg property within the node to keep backward @@ -994,7 +995,9 @@ static void __init st_of_quadfs_setup(struct device_node *np, */ reg = of_iomap(np, 0); if (!reg) { - reg = of_iomap(of_get_parent(np), 0); + parent_np = of_get_parent(np); + reg = of_iomap(parent_np, 0); + of_node_put(parent_np); if (!reg) { pr_err("%s: Failed to get base address\n", __func__); return; diff --git a/drivers/clk/st/clkgen-mux.c b/drivers/clk/st/clkgen-mux.c index ee39af7a0b72..596e939ad905 100644 --- a/drivers/clk/st/clkgen-mux.c +++ b/drivers/clk/st/clkgen-mux.c @@ -56,6 +56,7 @@ static void __init st_of_clkgen_mux_setup(struct device_node *np, void __iomem *reg; const char **parents; int num_parents = 0; + struct device_node *parent_np; /* * First check for reg property within the node to keep backward @@ -63,7 +64,9 @@ static void __init st_of_clkgen_mux_setup(struct device_node *np, */ reg = of_iomap(np, 0); if (!reg) { - reg = of_iomap(of_get_parent(np), 0); + parent_np = of_get_parent(np); + reg = of_iomap(parent_np, 0); + of_node_put(parent_np); if (!reg) { pr_err("%s: Failed to get base address\n", __func__); return; From patchwork Sat Oct 22 07:24: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: 7432 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1098282wrr; Sat, 22 Oct 2022 01:10:19 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6/Z5rB9nRf4fXphPdenzWUH3SHUm4gP9aLJmIzNv8Ohv7spCmAABp+hG1bdVou9fljV88S X-Received: by 2002:a17:902:b942:b0:178:be25:203f with SMTP id h2-20020a170902b94200b00178be25203fmr23685724pls.101.1666426218762; Sat, 22 Oct 2022 01:10:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666426218; cv=none; d=google.com; s=arc-20160816; b=Au4Xq4kqvqi0HtQfypjSKCKrPCv6LOhbyvdTKpdOXs7Do8V7OvJvx4X2pgAIsDu1aq 4yjbLhH7HzL72TCKJr+17cyE5JQWK9Rj1EChkNk3i8iR1w5OmQ9Do4xRbxZmuBa3B9In R3WDEME4Kcm31CAYkc5UETYvyOMG/vP+RqETocikUFI0VRIXNjC8b3F8BMF4c1nXrcub WHoN7ftNOrFui9o4kQN5ihGN55mMjOJBXHzqtCbGCx8dVUApu9a/x4ra9gpy0vG5b/e8 J5tiWcIwWijaRNj68zRGWIWzh0B/4LKlOd0eHAJc0bEAxJn06hzm2fxkW22P0e8b0teR ePzQ== 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=67YBjDUrOaqwwQhvLBhano/hvSZAX1/tbJxeOYqhBM4=; b=ADr1dI90+gn6K/bdUBMH3XmBpwYcvx9Y0hZnaU7Dpu6CKAF8W8sRlM/5bsCoDr+lqP 0hhw70XpUPc23nA7aqgWtg3ng5VZTto6QtkfxiSoBvKzYMSnDjNm8LenwoSPYvFj9UN0 kQHnJxGpqeNr1GTbDn3Ox2BtG42aCrZ5iP2YcATjo6mnbvXwn3/uzGfEG54fzvTuhgaU rhb3VfJUYiOkGJy2b1J1UUtE2TjiTFGlaHCG9t5aZY/xywfJhc0qW0PtWowwyGa9m/Fa Bt2RAKU/ysuIIWyot9oIDGibj+CqE6iTeAza1ejdsHsaTl7I+iJTUZ137GFTPqtQrTdf T0Lg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=q2cwCJ8W; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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-20020a170902694300b00176a87603dbsi25012710plt.156.2022.10.22.01.10.05; Sat, 22 Oct 2022 01:10: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=q2cwCJ8W; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S232631AbiJVIIf (ORCPT + 99 others); Sat, 22 Oct 2022 04:08:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42352 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233020AbiJVIEj (ORCPT ); Sat, 22 Oct 2022 04:04: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 8E9572EF7D; Sat, 22 Oct 2022 00:52: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 3A64FB82E07; Sat, 22 Oct 2022 07:51:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6DA95C433D6; Sat, 22 Oct 2022 07:51:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425081; bh=YJMbba9RS1wYiGgs1JTsRQFq9wLF0YY2JGinQe5+YHA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=q2cwCJ8WyOsInsXa0S1svV1K0mIKRp1vE1RfuU6t/YcjzWj70SYcuxEIvtbuavZ2k 7mfwwMbMON4ZK40afIKxSkOTM38HKmlkdu1MDXd0cCttuAC3/hMVC9x05vKypEj26s TDdUXVm9qUD/+SbB8xzmzQy/9PVjzRJUU9AD9Rnw= 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 5.19 383/717] clk: oxnas: Hold reference returned by of_get_parent() Date: Sat, 22 Oct 2022 09:24:22 +0200 Message-Id: <20221022072514.451489914@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747374538610822327?= X-GMAIL-MSGID: =?utf-8?q?1747374538610822327?= 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 cda5e258355b..584e293156ad 100644 --- a/drivers/clk/clk-oxnas.c +++ b/drivers/clk/clk-oxnas.c @@ -207,7 +207,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; struct regmap *regmap; int ret; @@ -215,7 +215,9 @@ static int oxnas_stdclk_probe(struct platform_device *pdev) data = of_device_get_match_data(&pdev->dev); - 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 Sat Oct 22 07:24: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: 7562 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1106054wrr; Sat, 22 Oct 2022 01:36:46 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4VbWCNfxyuDfRG8Pja7eb5bsAGS5YpW3z2Fj4h/sgu7ltUlVyKtpxxQqYW/8fYVTkyQITV X-Received: by 2002:a17:902:eb8c:b0:186:7fb5:2143 with SMTP id q12-20020a170902eb8c00b001867fb52143mr5884724plg.30.1666427806448; Sat, 22 Oct 2022 01:36:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666427806; cv=none; d=google.com; s=arc-20160816; b=kxbCXAjvyEc+QWlXsIB20QXBNvF1K40pPkcV3MRydaJu+o3aUp3fT8r8ck+FyUOrOk E0VecplPshRO0ZozUlN84XpFFJtpGPrbp8SpXlSzVMBq/HZ0PMyOC+ZJoRvPbDgF2o4Y 2g5lZzfEob0v0/xyVEZrC54lvdMskqaS7TSfa59f4VNH+fnH1ffCTMe55ZCrgeFkSq5+ go4Gk4I8zJ5i4NgVX7YDqshaMU7YU4aDV5b3hcb9MplupAZ06RFRD3kU+ZAPwLyRSWkx k/UNH4uoXo7YdhAA6YtZqxIzjP+ZgoKxq5tFd6PctEXnRi79wMwPj5y6WysA1FDTkGLa yUYg== 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=sa80NSPQSaH4bfWbBGrqekGf6W5J0b4651s/9jV0G48=; b=F5QDI+cErMa+Sr/BWtRcQobp1j8H2E8nTtvqtEZXSRWU0Zg/NvZ5gj1GcO58edeI9J uy5dxcavdMqKA+4fJET0M7n3RZixUjSlzVTocIuPCWxrFohoFZmBYYemwc+WjjQql1FQ DKXrj+LuKm3jME/OMiOn5pfqjvx1YhnpXJHaFSvdatJmYMEkl68XOZTPUEvhzHuw5UfT qYuoDvud45XUfa5nYpLCFiRIIk+xSQdMY+07ljrWK5e+13Bb2rY29XEGTRp9DEAgW9jO 97ch+F4By0mi8hCakuACBOtNWiRh07hpmn1MsW/pt80HGjOeLgo842L9x9R/Gbw4zl9l aseA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Vor8+8fB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 d2-20020a170902654200b00179c5d02ba1si24579132pln.442.2022.10.22.01.36.29; Sat, 22 Oct 2022 01:36: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=Vor8+8fB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S233464AbiJVIVb (ORCPT + 99 others); Sat, 22 Oct 2022 04:21:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50226 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233833AbiJVITv (ORCPT ); Sat, 22 Oct 2022 04:19:51 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 01B242DF463; Sat, 22 Oct 2022 00:58: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 F0D5960AD7; Sat, 22 Oct 2022 07:51:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B1F73C433D6; Sat, 22 Oct 2022 07:51:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425085; bh=OIJs8jEJDlE4X49d2dwxy8tysOIHP5M9KVrpH9pEbiM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Vor8+8fB2olDE800GsBcmmAESl54nD9AqezAayB1fp9vPEKp3cRdwD+JqxxiXQc6/ AYkpofKE2ZhDFwaKNKHb54fDouOK7QCGj4EnBDk+ixxQpnQN4untmZvQj0CbNFL16f f4T9GiTq+pvgVzuikKNQWuOWbZa2VKYs0jSd/4Vs= 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 5.19 384/717] clk: qoriq: Hold reference returned by of_get_parent() Date: Sat, 22 Oct 2022 09:24:23 +0200 Message-Id: <20221022072514.536010465@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376203537368718?= X-GMAIL-MSGID: =?utf-8?q?1747376203537368718?= From: Liang He [ Upstream commit a8ea4273bc26256ce3cce83164f0f51c5bf6e127 ] In legacy_init_clockgen(), we need to hold the reference returned by of_get_parent() and use it to call of_node_put() for refcount balance. Beside, in create_sysclk(), we need to call of_node_put() on 'sysclk' also for refcount balance. Fixes: 0dfc86b3173f ("clk: qoriq: Move chip-specific knowledge into driver") Signed-off-by: Liang He Link: https://lore.kernel.org/r/20220628143851.171299-1-windhl@126.com Signed-off-by: Stephen Boyd Signed-off-by: Sasha Levin --- drivers/clk/clk-qoriq.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/clk/clk-qoriq.c b/drivers/clk/clk-qoriq.c index 88898b97a443..5eddb9f0d6bd 100644 --- a/drivers/clk/clk-qoriq.c +++ b/drivers/clk/clk-qoriq.c @@ -1063,8 +1063,13 @@ static void __init _clockgen_init(struct device_node *np, bool legacy); */ static void __init legacy_init_clockgen(struct device_node *np) { - if (!clockgen.node) - _clockgen_init(of_get_parent(np), true); + if (!clockgen.node) { + struct device_node *parent_np; + + parent_np = of_get_parent(np); + _clockgen_init(parent_np, true); + of_node_put(parent_np); + } } /* Legacy node */ @@ -1159,6 +1164,7 @@ static struct clk * __init create_sysclk(const char *name) sysclk = of_get_child_by_name(clockgen.node, "sysclk"); if (sysclk) { clk = sysclk_from_fixed(sysclk, name); + of_node_put(sysclk); if (!IS_ERR(clk)) return clk; } From patchwork Sat Oct 22 07:24: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: 7433 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1098285wrr; Sat, 22 Oct 2022 01:10:19 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5E4LduIYTe0yCQ8uq25CFtfG3xFbEOnMrGzuEDXUBVxFUcGuQV2tlRksi08cc9FjrRXx3Q X-Received: by 2002:a17:902:e9c2:b0:186:79dc:7d87 with SMTP id 2-20020a170902e9c200b0018679dc7d87mr6825307plk.59.1666426218810; Sat, 22 Oct 2022 01:10:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666426218; cv=none; d=google.com; s=arc-20160816; b=QDfPCmfLY50VZaeU89xicJrFg/3fNgFoktP+tch7pcIt9NABrvBMb7LOfTrhDD3vML +JAQlTqsdJzFSXyM/whMMFCzTac1LGdZ0aet3t4Wgf+S2iYALoARCqvf6Haio4ZB9I4O AL0QuZ3l/kYBFfiLkE/UbR65z/MBHUS2iW/M463y3HUshs8b64I9esMC2IbL/u0QmkSS lgdURYwTiegtYFi7i4wLNiYEKomypFKEafHuUG/O19qfNXN9ZNR8T5U9EI0wPyoO4Pzs OAdlPphk8J5aoOT2cD/+sbIPAAY+kZyUKRSzQNeJx15a77Kk2Z5m2XBSOGBMzTHMi9Wx 2miQ== 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=eUkHvBttQaI6RxRBPfjIsjMYp6pz05z4rUI/rZUDaCc=; b=Rf/z2BcpTI5GCxCgBMrQKzBRp6yRkDc5RfdSgE7iQCi9TOIOn3cJetZ5YjCAi54Lvr mNyIX2slifFtJxlJluP2NPdiYVYr+GVLtrEqUqMy2tpvfbeXVZGPNkEXZX41HGlp7OyW Q6V6QlHhuR+jt+tPLyE61oGNK5aIyibYozSjfdD6ietDgt7FAvdGXFkX5HdeX9B0uZfy 3/q78TB3aXbUkfPdWWVZM4nlR9r9RzFiPtMyp2aRyMQR+PnemJutmkVGmpO4Mlj3D0kU CFAVQMrKPFOTqGo2v3HNhk0rYgssxiTyAayjJ3Q+gIPGfBFK778jUGY0scgQDvfw0L90 L5QQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=YTFDb4nO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 b14-20020a170902b60e00b00176a2d5ae14si25803174pls.363.2022.10.22.01.10.05; Sat, 22 Oct 2022 01:10: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=YTFDb4nO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S233159AbiJVIJF (ORCPT + 99 others); Sat, 22 Oct 2022 04:09:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60728 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233098AbiJVIEv (ORCPT ); Sat, 22 Oct 2022 04:04: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 783142CE633; Sat, 22 Oct 2022 00:52: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 9E54AB80E44; Sat, 22 Oct 2022 07:51:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B5B06C433D6; Sat, 22 Oct 2022 07:51:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425088; bh=aMhgMqMGgRl1+zscEHQn3kdfGb1OaQRYRmBXmXDblFE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YTFDb4nOOQRNILVx/vm2FgjCu9M6NnRqPxszTVTBivvxeIQcEk4HaEFD2oGciY1YE AADJOEyfXjRDw6DRFvrhN9IfB4nuJ5sFtrn80vqxTrKKTrX8t+lY+F7vEolB08RQ1c H10eBEJlxpAcljIanrrFlsknD6KA9t6GziEvhPwM= 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 5.19 385/717] clk: berlin: Add of_node_put() for of_get_parent() Date: Sat, 22 Oct 2022 09:24:24 +0200 Message-Id: <20221022072514.593575782@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747374538586833667?= X-GMAIL-MSGID: =?utf-8?q?1747374538586833667?= 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 bccdfa00fd37..67a9edbba29c 100644 --- a/drivers/clk/berlin/bg2.c +++ b/drivers/clk/berlin/bg2.c @@ -500,12 +500,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 e9518d35f262..dd2784bb75b6 100644 --- a/drivers/clk/berlin/bg2q.c +++ b/drivers/clk/berlin/bg2q.c @@ -286,19 +286,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 Sat Oct 22 07:24: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: 7846 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1154069wrr; Sat, 22 Oct 2022 04:07:32 -0700 (PDT) X-Google-Smtp-Source: AMsMyM47qt64bed7NZVMybuNFB4zb+dWBJQFDbiCI5haLtTQY2gWibxadhMEupWyjYCUqzbKu25e X-Received: by 2002:a17:907:a4e:b0:77d:94d:8148 with SMTP id be14-20020a1709070a4e00b0077d094d8148mr18873690ejc.607.1666436851855; Sat, 22 Oct 2022 04:07:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666436851; cv=none; d=google.com; s=arc-20160816; b=PO4JtcgN0muIYG/ZV4kOGncAdGubkIMQyGf8MU6ciR+UkT4Au/1qOlgYZ1hZ2CLrK0 Vov0nIz/4qPyAFL9nw1ZfdZZEiUfcAft2ueGYn8paj1aAIq/P0FeBp8jFM+9vDkAb7wR sAT308csBV+67pnWo09V/9LjNZrkqlm9Xlg7a5cGnbA47TcC8zov4IPyyAxVDLyxDTSM pkAMKWAIeBla1uYRA5LXkl8rYeQo5JaHIzb9t5/O6AoF/zopZTTw9pj1ugGgRUaKF7gY 7KKm+t0g6S+wakA4Jn06PLOkZg8kFJT8et9j6nlVG4lDrpcCFB1yoKqxiWAAaLDdAtye riRg== 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=4BIP7yCJkEfhe91Lk7KXrUGr2g1NopchynjnoQZ5RxI=; b=vv2kkTlwi827bhesaXPo4NxUMR49MnouQx1PAxQ8JRtoPAdvvH9ydTB/2YYFObFhXA dvQZhzlJhWMwxiH4xOpLxz+N+OGLgj63SI3y9Dyg/fYptQAInm1wfBYH2g0shhWO1BJs McuJYtJshr7DON6kf8jRY9lu+8usOgRIc7U/N5gPfli8M7bInknu3QoIuchh0oTA7S1O EFDgSPRT86o9Reo8zDFz2LUYec2TEc1ci5OuEI1T+xHEH4/ez5KlkDzkCK7TsZRtYR11 l4RoANM9s03GkCBRRJFXjG/a17dmTNldOyk12HG4UVjUYjyC8q7tkzmR6Oehf0gOxY0y BbLw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=WQjIPg+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 s19-20020aa7cb13000000b0045829a1c0b3si18445815edt.251.2022.10.22.04.07.06; Sat, 22 Oct 2022 04:07: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=WQjIPg+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 S230520AbiJVLDW (ORCPT + 99 others); Sat, 22 Oct 2022 07:03:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57666 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230470AbiJVLCl (ORCPT ); Sat, 22 Oct 2022 07:02:41 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 003D22FACEA; Sat, 22 Oct 2022 03:21: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 A8E4DB82E0E; Sat, 22 Oct 2022 07:51:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id ECF21C433D6; Sat, 22 Oct 2022 07:51:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425091; bh=I0US6l38rqGsDxa7m8QNmS8D7lDmiOG+/urZP2mhyxI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WQjIPg+nVcMy+f+EIpot44TI4IhwhdxxzSE7/LsDJJOx0uyOkpLCAPDojeCXmG+rq Pq0T2Xyau0W1YqH0j8FmUpSy1Z5KFzjPOyRicFV78y7aIyIyC4UmfEksX6dYVRggG2 SEH2bOl3eJRdkwMbvPvkA4fWH4mPVLLTW3GlXiiE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Liang He , Orson Zhai , Stephen Boyd , Sasha Levin Subject: [PATCH 5.19 386/717] clk: sprd: Hold reference returned by of_get_parent() Date: Sat, 22 Oct 2022 09:24:25 +0200 Message-Id: <20221022072514.654609744@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 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?1747385688343836821?= X-GMAIL-MSGID: =?utf-8?q?1747385688343836821?= From: Liang He [ Upstream commit 91e6455bf715fb1558a0bf8f645ec1c131254a3c ] We should hold the reference returned by of_get_parent() and use it to call of_node_put() for refcount balance. Fixes: f95e8c7923d1 ("clk: sprd: support to get regmap from parent node") Signed-off-by: Liang He Link: https://lore.kernel.org/r/20220704004729.272481-1-windhl@126.com Reviewed-by: Orson Zhai Signed-off-by: Stephen Boyd Signed-off-by: Sasha Levin --- drivers/clk/sprd/common.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/clk/sprd/common.c b/drivers/clk/sprd/common.c index d620bbbcdfc8..ce81e4087a8f 100644 --- a/drivers/clk/sprd/common.c +++ b/drivers/clk/sprd/common.c @@ -41,7 +41,7 @@ int sprd_clk_regmap_init(struct platform_device *pdev, { void __iomem *base; struct device *dev = &pdev->dev; - struct device_node *node = dev->of_node; + struct device_node *node = dev->of_node, *np; struct regmap *regmap; if (of_find_property(node, "sprd,syscon", NULL)) { @@ -50,9 +50,10 @@ int sprd_clk_regmap_init(struct platform_device *pdev, pr_err("%s: failed to get syscon regmap\n", __func__); return PTR_ERR(regmap); } - } else if (of_device_is_compatible(of_get_parent(dev->of_node), - "syscon")) { - regmap = device_node_to_regmap(of_get_parent(dev->of_node)); + } else if (of_device_is_compatible(np = of_get_parent(node), "syscon") || + (of_node_put(np), 0)) { + regmap = device_node_to_regmap(np); + of_node_put(np); if (IS_ERR(regmap)) { dev_err(dev, "failed to get regmap from its parent.\n"); return PTR_ERR(regmap); From patchwork Sat Oct 22 07:24: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: 7470 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1099029wrr; Sat, 22 Oct 2022 01:12:27 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6IQBeAwJUueIONvYW01VMrNJyHMsZbFgojgZn/VR0XONAJDAmA+MmQw7O62VuIW6SynRT0 X-Received: by 2002:a17:902:edcd:b0:17a:6fa:228d with SMTP id q13-20020a170902edcd00b0017a06fa228dmr23201733plk.29.1666426346852; Sat, 22 Oct 2022 01:12:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666426346; cv=none; d=google.com; s=arc-20160816; b=ZjTSiQdhJSTwf3oaP9I0wMOvETc/lIpXAmO/rBA+Rz5eiAazZeji0SqobpmRK0aBej gTB3KPIJsM3qbh8cPhM5HYvCGv3gkMr7lZSno9x2JdFekzmY+8rFl33SZ6V3BKtryMfF LOh2mfE6z9RpZ3VzQYwd0Hx90dAUyQNwUHutMo8+saLKb8NKXgIWq5/A/Zkw9MXBX75m l/LALuKfiYGEaI2kSfK/kSks01hmuHWr1xXuWiOChonmg9T167bI6lQxWbDfsckRQ+pt j3zZ73gfpdniuurNzlIexObEo7IZ076c2SF31PG8gnJ7lFT+ZwrmiyQZ/bzFTGvlf/vY BVTQ== 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=jsEfyFQKirU94htMd9BNVsMLlD45vinhDMQosHu/5eY=; b=uvED0xHgsxxIh2vBPL23s0U9TeLg1BHCBDVtJubMVN1pfFGSCpbflUTBALZvcGhwfc GBWWQNYlgCR2pEBlmZkQW6UHXAJ0fQEkg/ref1zPC/8QU+tfE9xBazqCFMCNIrRC8zCy DlgEYdwjcv0ebl1IVcOJp4GuKNwiQs8aAVlXySRFN7UsxrsmNAvmWu2hKNRuROglzjDR BOn2VW0QbZyEuCrJfv4MNCc31rhbgtV8tYcZS1/9X+uyQioihAFkpVXc6QudBKgkieHg PcdIHKni4QswZSrxMaF/rgSE3roFSuNkWDj7asERHMdjBfVLgSMcljxHd+n8puZFmvDx t5qA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=FvIysgFX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 o15-20020a17090a3d4f00b0020addb2c6e7si2248801pjf.85.2022.10.22.01.12.14; Sat, 22 Oct 2022 01:12: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=FvIysgFX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S233213AbiJVILm (ORCPT + 99 others); Sat, 22 Oct 2022 04:11:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53796 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233396AbiJVIJo (ORCPT ); Sat, 22 Oct 2022 04:09:44 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9D4FF66F21; Sat, 22 Oct 2022 00:54: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 dfw.source.kernel.org (Postfix) with ESMTPS id B4EEE60B09; Sat, 22 Oct 2022 07:51:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C531AC433D6; Sat, 22 Oct 2022 07:51:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425097; bh=I9d031I2SDmf36pt9nJFhqyJf4Vp12w30552pTi83wQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FvIysgFXbeQLcKBYoHgoFWnQfhzL1d3MDSeeUDYoWjE1yFQFmpINDnUmDI2O5jZvR zhL5oz3iuS5DdFz8jynzVTMdKGbEiINfLAQ9vHDupmRSWO0g1Nqva2DkY2ZrPFpFE7 cP+W6fDM+luFZqF0VjdsFMU6jZJeAFP2oeqDK2SI= 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 5.19 387/717] clk: tegra: Fix refcount leak in tegra210_clock_init Date: Sat, 22 Oct 2022 09:24:26 +0200 Message-Id: <20221022072514.701973517@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747374672729042128?= X-GMAIL-MSGID: =?utf-8?q?1747374672729042128?= 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 b9099012dc7b..499f999e91e1 100644 --- a/drivers/clk/tegra/clk-tegra210.c +++ b/drivers/clk/tegra/clk-tegra210.c @@ -3748,6 +3748,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 Sat Oct 22 07:24: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: 7435 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1098288wrr; Sat, 22 Oct 2022 01:10:19 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5z1OQJ0kMV9t5s/cJGJicv79kfL1N7uw6ZrCLqiUcodI7+25H7CgPc3HvWOQYHx+YHgo4u X-Received: by 2002:a05:6a00:1344:b0:565:e95c:6da4 with SMTP id k4-20020a056a00134400b00565e95c6da4mr23086171pfu.45.1666426219012; Sat, 22 Oct 2022 01:10:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666426219; cv=none; d=google.com; s=arc-20160816; b=lV2sQYjjZ3nJBV5xqeSdsP6kb0e7m56MMveYwLNW5wSEdlqLsXjaW6X/+M6uUd6OAd BObk6c+nNGZXkEZBWAZGhYWyFtFXHnbLNNg1wtFIJHnxYaoT7vaFJPYGXSQdOffJxhgs uctNy70HHa+/Hr83klh+x2WSAPvVHyEjxHyUnJEx8veCegCQ5UJP6AaqqB7cfVq5Ivnv oQqh4ajVjsvj3vndvu+7xxn0qHWRa7luBcsFT5Hykj+67aDvFA8TwKsJdMGBOzrUvxCh 6wDxik4et3A+4oPeDE9QtVLCga5mCYM/Swb2weDmsECyVgYOKgTeg47o+8fNf9ZgExcG ZVHg== 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=ZGWNBlpJ/VY/Xf7CXYrOhZ4mFqAF0xjOiYVXc81WScI=; b=ZmIEsQuSCf7flxP+Z9vX1RWuCG4phTf7w/0CSmTgkCPTPLAqKG4+ylITiezBKNM2vA ZrHuhrALuXQobUAW8AwuVNVPqFhToHLgmzd5yvWUrWPyiRh/1jyw+HeW48KrOeELuF+K RizgP0p4DlmqJOdI4AuZW3i9LO9En3PKN2e5Yi9ui/QpGYxqS5t4CyuZAM4Deo+XyCdl xoJkFlOWFkc7oKNLL2HXKXvP316EBO2hK/M59jGbcM8+6IKInP6g7BZvS75HEu/4nt5/ HmJR+E6lomXdWfIB2xf2ZL28rl4OxWwm5PI0fq+Wuj0crI0NrW1a2La9MGWoZQg2b5QB uf4Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=oP+DdJ0w; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 c7-20020a170902d48700b0017ed3e829fcsi30737489plg.365.2022.10.22.01.10.06; Sat, 22 Oct 2022 01:10: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=oP+DdJ0w; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S233189AbiJVIJK (ORCPT + 99 others); Sat, 22 Oct 2022 04:09:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57152 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233118AbiJVIEz (ORCPT ); Sat, 22 Oct 2022 04:04: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 72CE62D446C; Sat, 22 Oct 2022 00:52: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 ams.source.kernel.org (Postfix) with ESMTPS id 5ED65B82E18; Sat, 22 Oct 2022 07:51:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 79F14C433C1; Sat, 22 Oct 2022 07:51:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425100; bh=r+FwyI0dw6wnWyUmx0/wuU+uiVosvkZ0FGImdLGy/tQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oP+DdJ0wUIDr8GQLJ2eoW5y4CJlwefDwqpbaaj8tqsfrt3PgKuOMKFjacNijbdqFL GP8seGR75wm1NoFPLEi/1gNuQJlbTzj2VtiKUoNsphr4l0tKThXWEJBq75h/zvgec8 WRoobg09LiIBPRDbNRPnhjbUyw78XxinhqMOR3m4= 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 5.19 388/717] clk: tegra: Fix refcount leak in tegra114_clock_init Date: Sat, 22 Oct 2022 09:24:27 +0200 Message-Id: <20221022072514.747723901@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747374538725777015?= X-GMAIL-MSGID: =?utf-8?q?1747374538725777015?= 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 ef718c4b3826..f7405a58877e 100644 --- a/drivers/clk/tegra/clk-tegra114.c +++ b/drivers/clk/tegra/clk-tegra114.c @@ -1317,6 +1317,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 Sat Oct 22 07:24: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: 7788 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1122680wrr; Sat, 22 Oct 2022 02:31:38 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7YIA9wAxiCL03XRIyXC255rXY8iatP1fCrBt4sFISMGeQqjMsXvog+PEervZheBbCgS2Ou X-Received: by 2002:a17:906:9c82:b0:781:5752:4f2b with SMTP id fj2-20020a1709069c8200b0078157524f2bmr18661260ejc.561.1666431097936; Sat, 22 Oct 2022 02:31:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666431097; cv=none; d=google.com; s=arc-20160816; b=YLJhXSmW93UPO5kpwprPaSGkoUnzoi03LLWA7xzJPsDi2V9dVlM4TYkIz5WOdsy9Sn Q+Rt5ed+B4ddZNsZ3pGC5ouJxqvx65eZ68FaDdYV9A7DxXQH8fo2wMA0lz6bGPHEB8Vv 42jIMu+Pe/eNJqI8sEA/4wGgqxwFOsyZPIwChG/wLFbZl2V3Jbmmjks5aDrD4YT+49AV xucFXXqjr9LbXXfI/6AaDfkFKIMr7048CQOe72j71I0JUDNI9/Q9HyTX82MxzkrqcFlp DSKJOVcGjoEbTtlRTtEAwSXDVKzVDdrQT1TRtoToCHTTZ07N97eFMSvUQX+Osmo5dOCy SJeA== 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=TCifrgbVIhF6IG3IN/+rWiGab9iYhQuo/bM3ZkfqbCs=; b=cen2YGSRvdqUxH1C6nfMuzsrMFf7Ex2Ai+kBXELnE9bb0bJRbh1qjcizvQxroyzDWZ IaaXWYJ8L6+gAgz0crS8npW8ay9vFzbgkxmRsqA/DAsb4OB9hHG1HuB+uaVBqLDBwou/ UVM7bgKOhLLtWCzrZdXoCkRPmORkd75DfZMy5568XlICBjTTfvK6VD3ipwMlmT47cUAN wp3qWURWosTLjrRsQ8ZRVo/Urvg1t7gfmCN4WyoeVCh0Rnjtvk5RgHwx1aB8rFNhNNQz AdbxBfNguBuhQu5ZaPatV+XAcsiJTQ+sjswcPaJs9pytAkfTuRBoEzojXgooMXgnA6Co zobw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=KinvGyGv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 cn25-20020a0564020cb900b0045d53f8ea52si17698881edb.1.2022.10.22.02.31.13; Sat, 22 Oct 2022 02:31: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=KinvGyGv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231245AbiJVJPi (ORCPT + 99 others); Sat, 22 Oct 2022 05:15:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59118 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230474AbiJVJO5 (ORCPT ); Sat, 22 Oct 2022 05:14:57 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 11A242C64A; Sat, 22 Oct 2022 01:29: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 9011F60B79; Sat, 22 Oct 2022 07:51:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 94311C433C1; Sat, 22 Oct 2022 07:51:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425103; bh=jY5QCfw7xTXd3ZKXFT3BA0Dy8YBjTPowLa9k7IVWMjg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KinvGyGv8pYOg0vqWQ0fcQg1+z7y5LRzRqHbSqyhFfOKB70j23hrStZkPTTsRzf7s xWd3ItHETRRWs0jhoopDyJHWVxSqj2jtP8ykp2KuIwA8slBXz8yy1urqwbKrnm89Vu gyWIGdCSeNOqv98ccix1Toxht9ewdFq0AO1a//qg= 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 5.19 389/717] clk: tegra20: Fix refcount leak in tegra20_clock_init Date: Sat, 22 Oct 2022 09:24:28 +0200 Message-Id: <20221022072514.805820361@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747379655174922277?= X-GMAIL-MSGID: =?utf-8?q?1747379655174922277?= 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 be3c33441cfc..8a4514f6d503 100644 --- a/drivers/clk/tegra/clk-tegra20.c +++ b/drivers/clk/tegra/clk-tegra20.c @@ -1131,6 +1131,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 Sat Oct 22 07:24: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: 7501 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1104914wrr; Sat, 22 Oct 2022 01:33:42 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7OzC4dVrom1kTXwLuMo9DrxLlRAf/fMgIeod6cdr5Oxe++BdqTJUUqyYmT5hmO7NGTJhDR X-Received: by 2002:a63:4f15:0:b0:455:ede1:d8c9 with SMTP id d21-20020a634f15000000b00455ede1d8c9mr19935356pgb.452.1666427622355; Sat, 22 Oct 2022 01:33:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666427622; cv=none; d=google.com; s=arc-20160816; b=K+dxndq6PgNq9sisGJf8pbKAdGtlnXHNH393rEXfddNLi0BaFFRT55cWoiylwHsOPP yUVBfu1uJ39x69tdL9JJ6FG1M8FcFn6FxP/tAbNaW8pSHXTNElvn/bKmjljqDGKdz+8L 4fowFR8Qs8J4byEPGs0dODAkiFI6afDZSiDIyx6ujNkUxIJepNvqptqMNDwRcwZS+an3 mUlY5dCzSiZ5Y8GzIuUEzVNIKPK69qa3BF18xlpl15N9ORYrvI5lj2E8G8J8muW/xIXI bMGkrp3wMb+KulB80ESgn+ZfvKnPO9SiLDokwU3woPt3lAWwqT48GeBdbpJXpXEVcRf5 Xczg== 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=vn07Zkh87WBT0/WvegA0YM5axsg7u8Oxnd7ijTj0+Ys=; b=WXT7508bs0Fz0TKNr3v7Y5f86qQLdIwIf7JoE+oMIZnQDl1sgVMerjSsLZuNxJsz6e xajPEjQHcbvd4i86AAL+u3ZTY6g2vieo0W94Hsjt6vPx/ad0FLx4JY85FJvZGo/cU59+ YRy4k3sG3bBM8RenTVTK3ORIPYVjaOSfvhCz62wvhB31olfVrvPXRxQlHfVqyHLcFMkf XhndCY34OtOo1u5pz9gtYQ1w6NFKg9m2BKCB2kOp/1ZocBltH5V4rawFfB1YcqT+0Yad Ns4O3pf5pLnYbUtzfFFRmswrJ7+Z85+6jOlI749wk73R8gf2rS3N4D0lwLMWESDyoJLB 3isQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=cM13yZIq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 o124-20020a625a82000000b0056282b4a984si27424689pfb.126.2022.10.22.01.33.26; Sat, 22 Oct 2022 01:33: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=cM13yZIq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S233482AbiJVIRe (ORCPT + 99 others); Sat, 22 Oct 2022 04:17:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55956 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233989AbiJVIPt (ORCPT ); Sat, 22 Oct 2022 04:15:49 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4AFBE2DAC18; Sat, 22 Oct 2022 00: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 8D9B060AFA; Sat, 22 Oct 2022 07:53:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7D657C433D6; Sat, 22 Oct 2022 07:53:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425217; bh=nVPF//z9VOfbszAt81xC8YMEOhgGA/XDispQHBKGje8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cM13yZIqSQY2/0IR8WmcPIg1eFU51bgpdYm3FGQJlgBrLHtex9GF54yQR3AiUtMvV 8fW0GVKfBKHeKraEFLxQPzBRKePOLjo+qizh1nBPzSXKMc7vDLQi2XOfZYzVK2ZW3k gu9UmDq9HVGVLnuztB78qjx7fRK1aXD3RArsJsWI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Chanho Park , Krzysztof Kozlowski , Chanwoo Choi , Sasha Levin Subject: [PATCH 5.19 390/717] clk: samsung: exynosautov9: correct register offsets of peric0/c1 Date: Sat, 22 Oct 2022 09:24:29 +0200 Message-Id: <20221022072514.856922055@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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,UPPERCASE_50_75 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?1747376010416088515?= X-GMAIL-MSGID: =?utf-8?q?1747376010416088515?= From: Chanho Park [ Upstream commit 67d98943408bce835185688cb75ebbb45b91e572 ] Some register offsets of peric0 and peric1 cmu blocks need to be corrected and re-ordered by numerical order. Fixes: f2dd366992d0 ("clk: samsung: exynosautov9: add cmu_peric0 clock support") Fixes: b35f27fe73d8 ("clk: samsung: exynosautov9: add cmu_peric1 clock support") Signed-off-by: Chanho Park Reviewed-by: Krzysztof Kozlowski Acked-by: Chanwoo Choi Signed-off-by: Krzysztof Kozlowski Link: https://lore.kernel.org/r/20220727021357.152421-4-chanho61.park@samsung.com Signed-off-by: Sasha Levin --- drivers/clk/samsung/clk-exynosautov9.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/drivers/clk/samsung/clk-exynosautov9.c b/drivers/clk/samsung/clk-exynosautov9.c index d9e1f8e4a7b4..487a71b32a00 100644 --- a/drivers/clk/samsung/clk-exynosautov9.c +++ b/drivers/clk/samsung/clk-exynosautov9.c @@ -1170,9 +1170,9 @@ static const struct samsung_cmu_info fsys2_cmu_info __initconst = { #define CLK_CON_GAT_GOUT_BLK_PERIC0_UID_PERIC0_TOP0_IPCLKPORT_PCLK_2 0x2058 #define CLK_CON_GAT_GOUT_BLK_PERIC0_UID_PERIC0_TOP0_IPCLKPORT_PCLK_3 0x205c #define CLK_CON_GAT_GOUT_BLK_PERIC0_UID_PERIC0_TOP0_IPCLKPORT_PCLK_4 0x2060 -#define CLK_CON_GAT_GOUT_BLK_PERIC0_UID_PERIC0_TOP0_IPCLKPORT_PCLK_7 0x206c #define CLK_CON_GAT_GOUT_BLK_PERIC0_UID_PERIC0_TOP0_IPCLKPORT_PCLK_5 0x2064 #define CLK_CON_GAT_GOUT_BLK_PERIC0_UID_PERIC0_TOP0_IPCLKPORT_PCLK_6 0x2068 +#define CLK_CON_GAT_GOUT_BLK_PERIC0_UID_PERIC0_TOP0_IPCLKPORT_PCLK_7 0x206c #define CLK_CON_GAT_GOUT_BLK_PERIC0_UID_PERIC0_TOP0_IPCLKPORT_PCLK_8 0x2070 #define CLK_CON_GAT_GOUT_BLK_PERIC0_UID_PERIC0_TOP0_IPCLKPORT_PCLK_9 0x2074 #define CLK_CON_GAT_GOUT_BLK_PERIC0_UID_PERIC0_TOP0_IPCLKPORT_PCLK_10 0x204c @@ -1418,14 +1418,14 @@ static const struct samsung_cmu_info peric0_cmu_info __initconst = { #define CLK_CON_GAT_GOUT_BLK_PERIC1_UID_PERIC1_TOP0_IPCLKPORT_IPCLK_11 0x2020 #define CLK_CON_GAT_GOUT_BLK_PERIC1_UID_PERIC1_TOP0_IPCLKPORT_PCLK_0 0x2044 #define CLK_CON_GAT_GOUT_BLK_PERIC1_UID_PERIC1_TOP0_IPCLKPORT_PCLK_1 0x2048 -#define CLK_CON_GAT_GOUT_BLK_PERIC1_UID_PERIC1_TOP0_IPCLKPORT_PCLK_2 0x2058 -#define CLK_CON_GAT_GOUT_BLK_PERIC1_UID_PERIC1_TOP0_IPCLKPORT_PCLK_3 0x205c -#define CLK_CON_GAT_GOUT_BLK_PERIC1_UID_PERIC1_TOP0_IPCLKPORT_PCLK_4 0x2060 -#define CLK_CON_GAT_GOUT_BLK_PERIC1_UID_PERIC1_TOP0_IPCLKPORT_PCLK_7 0x206c -#define CLK_CON_GAT_GOUT_BLK_PERIC1_UID_PERIC1_TOP0_IPCLKPORT_PCLK_5 0x2064 -#define CLK_CON_GAT_GOUT_BLK_PERIC1_UID_PERIC1_TOP0_IPCLKPORT_PCLK_6 0x2068 -#define CLK_CON_GAT_GOUT_BLK_PERIC1_UID_PERIC1_TOP0_IPCLKPORT_PCLK_8 0x2070 -#define CLK_CON_GAT_GOUT_BLK_PERIC1_UID_PERIC1_TOP0_IPCLKPORT_PCLK_9 0x2074 +#define CLK_CON_GAT_GOUT_BLK_PERIC1_UID_PERIC1_TOP0_IPCLKPORT_PCLK_2 0x2054 +#define CLK_CON_GAT_GOUT_BLK_PERIC1_UID_PERIC1_TOP0_IPCLKPORT_PCLK_3 0x2058 +#define CLK_CON_GAT_GOUT_BLK_PERIC1_UID_PERIC1_TOP0_IPCLKPORT_PCLK_4 0x205c +#define CLK_CON_GAT_GOUT_BLK_PERIC1_UID_PERIC1_TOP0_IPCLKPORT_PCLK_5 0x2060 +#define CLK_CON_GAT_GOUT_BLK_PERIC1_UID_PERIC1_TOP0_IPCLKPORT_PCLK_6 0x2064 +#define CLK_CON_GAT_GOUT_BLK_PERIC1_UID_PERIC1_TOP0_IPCLKPORT_PCLK_7 0x2068 +#define CLK_CON_GAT_GOUT_BLK_PERIC1_UID_PERIC1_TOP0_IPCLKPORT_PCLK_8 0x206c +#define CLK_CON_GAT_GOUT_BLK_PERIC1_UID_PERIC1_TOP0_IPCLKPORT_PCLK_9 0x2070 #define CLK_CON_GAT_GOUT_BLK_PERIC1_UID_PERIC1_TOP0_IPCLKPORT_PCLK_10 0x204c #define CLK_CON_GAT_GOUT_BLK_PERIC1_UID_PERIC1_TOP0_IPCLKPORT_PCLK_11 0x2050 @@ -1463,9 +1463,9 @@ static const unsigned long peric1_clk_regs[] __initconst = { CLK_CON_GAT_GOUT_BLK_PERIC1_UID_PERIC1_TOP0_IPCLKPORT_PCLK_2, CLK_CON_GAT_GOUT_BLK_PERIC1_UID_PERIC1_TOP0_IPCLKPORT_PCLK_3, CLK_CON_GAT_GOUT_BLK_PERIC1_UID_PERIC1_TOP0_IPCLKPORT_PCLK_4, - CLK_CON_GAT_GOUT_BLK_PERIC1_UID_PERIC1_TOP0_IPCLKPORT_PCLK_7, CLK_CON_GAT_GOUT_BLK_PERIC1_UID_PERIC1_TOP0_IPCLKPORT_PCLK_5, CLK_CON_GAT_GOUT_BLK_PERIC1_UID_PERIC1_TOP0_IPCLKPORT_PCLK_6, + CLK_CON_GAT_GOUT_BLK_PERIC1_UID_PERIC1_TOP0_IPCLKPORT_PCLK_7, CLK_CON_GAT_GOUT_BLK_PERIC1_UID_PERIC1_TOP0_IPCLKPORT_PCLK_8, CLK_CON_GAT_GOUT_BLK_PERIC1_UID_PERIC1_TOP0_IPCLKPORT_PCLK_9, CLK_CON_GAT_GOUT_BLK_PERIC1_UID_PERIC1_TOP0_IPCLKPORT_PCLK_10, From patchwork Sat Oct 22 07:24: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: 7625 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1107499wrr; Sat, 22 Oct 2022 01:41:06 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5X8/Z4np8A9VYFJgnGao6owMu5WWzBc+3ZET66ce3422oOAsuIlNMkMvDm6ClrxSblk3xE X-Received: by 2002:aa7:c054:0:b0:453:98c6:f6c4 with SMTP id k20-20020aa7c054000000b0045398c6f6c4mr21141568edo.2.1666428066750; Sat, 22 Oct 2022 01:41:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666428066; cv=none; d=google.com; s=arc-20160816; b=KXmZu+3CgwiDdUnvjLHIaOoVJ9y4pBlP2AuKiJX3+4IIPbIKNH+hOWKdzYzgA1AGKd 02eCCRhr5G5KsPN92ebvtwKz0JJTOt/AEDhYHnfEc3zY7hglO7dEL+azONbGEwjj58qw MzgC90uMUSB/W3wJ2qfhljbOzijcbzejtdfnZC30dJGLq3pxv4G9kWLn10fxg3SveBYX AdeC8DJMC+0QLoegVs1A3Au3GrC9ukwj6ydol9D421NdXiwR4+ywzGvHgSUTBx84TH2q cHdapmwE391JkpF1bQMrm/iS8Ewdo+NZcgLOdzysKl/gkeSI8S66tHe3Pjzs5dxnZP+j tM2Q== 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=lmx/nv93+kUb6SouQSoeHr3oc8jzJ7zazO2KrXqcVXI=; b=tHWvjgWZyFFyfwvwOTHwcQ/OmAlBbkZoClxiYsoNj6sB2nOKIHF+iAfmFmth9yKqYw oGLu4bbqwAHGSFfq9LbHCH5yfICyipUj6Oub5rqRNqYnFJeVqUp63yWrUEJArV9wsNf1 glGb9AoEB569pCNS2WXjm9FLg2NVn1G6jiSPW4DttC4cKuh1mKQ2L3MHMN93au+QknpA 3tcf/VLsu2vrfBr4a4mu2c+UqRl1dnEzu65P4oTwKL2YO/AghInixBGbyzIl1yvgjfij jhMTJG3kDT56EE/GnjH9kqYKw4NoLCx1VbGpa7Uc+COqm8y2mctfZXI6IB3yH+Eqms/t blxQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=se8kFrR+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 di17-20020a170906731100b0078d8f2658e3si24375867ejc.833.2022.10.22.01.40.38; Sat, 22 Oct 2022 01:41: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=se8kFrR+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S234400AbiJVIhw (ORCPT + 99 others); Sat, 22 Oct 2022 04:37:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58086 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233975AbiJVIcB (ORCPT ); Sat, 22 Oct 2022 04:32: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 CC9412D1291; Sat, 22 Oct 2022 01:03: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 ACC8060B85; Sat, 22 Oct 2022 07:52:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C0833C433D6; Sat, 22 Oct 2022 07:52:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425126; bh=9+NtXeXBvF4Ebv92J6wPhWRQ5nQ9JXpxZQzq7UfEEhk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=se8kFrR+Tnb7m4fGuv5BJN8cheUgpttA7SYT6+ZySAkSRSeu2624WBO0KjE0Y7I0s gn+zZ2cTQd0Sz+yHm95PRaoxfyFIZrH1WjEf1PmU/p9wvJieEefJbZnaopYcj6QX7A /kp9GI/PMrl4KPDtadB8MxJg19CpuqZjvDHlnG00= 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 5.19 391/717] HSI: omap_ssi: Fix refcount leak in ssi_probe Date: Sat, 22 Oct 2022 09:24:30 +0200 Message-Id: <20221022072514.915402050@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376476458364815?= X-GMAIL-MSGID: =?utf-8?q?1747376476458364815?= 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 44a3f5660c10..eb9820158318 100644 --- a/drivers/hsi/controllers/omap_ssi_core.c +++ b/drivers/hsi/controllers/omap_ssi_core.c @@ -524,6 +524,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 Sat Oct 22 07:24: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: 7443 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1098368wrr; Sat, 22 Oct 2022 01:10:35 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4CbSSpBkUbjL7PJPgIyOLH0SAF34yVc0ymUJ2k8qg6GbulgLRzeAqgoKvPljfbgz6jdiDh X-Received: by 2002:a65:4b85:0:b0:46e:c3bd:e499 with SMTP id t5-20020a654b85000000b0046ec3bde499mr4733710pgq.21.1666426235257; Sat, 22 Oct 2022 01:10:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666426235; cv=none; d=google.com; s=arc-20160816; b=PpTfxxGqpZbyPAvh+IZSD/XGvhGUIIAic9KurNvAChmIFW7srLbs5EcQUdNm624SyI KvLBDJd6Hy+CNS7dUJwrCjsY7JIVX3yYQTQJKjV7U/BCfkEwRG5Y9zwVqJiUdfnbPIEw JYZDGWdbcc42y4CmyODBx/z0m1SgEZGWusxKsXBz9hA8+5zl5hMVqLiEASh1D58ml1R1 8eLVlrMd0V7yMGsRbuM4hwXDj7bTnaMrzrfLxPkaXd/F6wzY26oo8S0VhVyyrEnJVkTu mjHfJcNxpFOA5WOgUmV/9ZQxkAflETzYG0bvfyhA4jqqtr2RLM+wL6IOA80oy2hpbjjl iyTg== 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=lVIRB4zSXTqsZ4333e2G/+ZzELZX6fWdMt5VVrtzZnc=; b=tXe+8wgmGZIFDC5mQkLaFShFkjwQrWZQt2QfRHpnIFb+4gohhsA6tnTk4UYk0tEfo0 P0mU1Kq5xCWn/GSjBRPcCds3moXDmp0S67BTdMCuHVb2sXWhL4C8oGHWO7jFPjD13NOa taMAc5B1e9N2dfOJEMC0H5A95bs99u6QOm+z+EXBTnm+nxZhDEy83WD7gZ/Wl/EasUvy +Ars8KZq9l88pO2mzAhHlDQGnALpmpV//PZw04VoypyDTH/lBXKhcAIkKzgPHVtvWmd6 62n575DEnm5JuCer2D4QXLZlLNY/a1pdB+pkVRJDZBOZPmO+zFCcibBUh8pxaYXtwZg+ iGnQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="lHxp/0+s"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 y2-20020a17090a86c200b0020c4fd9306bsi1961989pjv.166.2022.10.22.01.10.21; Sat, 22 Oct 2022 01:10: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="lHxp/0+s"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S233271AbiJVIJ2 (ORCPT + 99 others); Sat, 22 Oct 2022 04:09:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57834 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232424AbiJVIFN (ORCPT ); Sat, 22 Oct 2022 04:05:13 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C8B1E5A3DC; Sat, 22 Oct 2022 00:52: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 7020860B89; Sat, 22 Oct 2022 07:52:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 86490C433B5; Sat, 22 Oct 2022 07:52:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425157; bh=K4roTK2fnCmQiAynGRZx39W2zSKfyzroDBihQQeCMlI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lHxp/0+sOp+5y7Ldg2+BjBaJJpCI5E8n2tZjJhPDuEppzXL3BFbhmJs7F7QtKfA+V MpsDsbTaR0Nwajku0HFdBW6ukpx9tRN5SX1+yOAQK4lnIlZpTBpWiXjrn/Rh0otpDq SQE+sO9Hidg1ZzFrQEzQHGoqKbV0uijB0PaAc6EQ= 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 5.19 392/717] HSI: omap_ssi_port: Fix dma_map_sg error check Date: Sat, 22 Oct 2022 09:24:31 +0200 Message-Id: <20221022072514.987704762@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747374555712898528?= X-GMAIL-MSGID: =?utf-8?q?1747374555712898528?= 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 a0cb5be246e1..b9495b720f1b 100644 --- a/drivers/hsi/controllers/omap_ssi_port.c +++ b/drivers/hsi/controllers/omap_ssi_port.c @@ -230,10 +230,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 | @@ -247,10 +247,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 Sat Oct 22 07:24: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: 7466 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1098906wrr; Sat, 22 Oct 2022 01:12:07 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4KZNNycFi9S3E1/p+4hOsvPhai9VUkXi26mbQOiZqkkrcEMRBKpNsMuaOCgYiSsY4iawtc X-Received: by 2002:a17:90b:4b8b:b0:20d:ac2f:8bb2 with SMTP id lr11-20020a17090b4b8b00b0020dac2f8bb2mr53302438pjb.194.1666426326758; Sat, 22 Oct 2022 01:12:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666426326; cv=none; d=google.com; s=arc-20160816; b=AIAJqmoP4dXSzRY/uSAUHVKXAOpCF6+AHjhn6cay1agK0ikUL9b3FSSwetO/4bu2va 1h7MpxPfJqKCDJmdfGgnGKNKE4kABDGuZpODlovq8aXb9rob2P2YAdHZNx+w8MKAypjb RBaBHkZ83WYUrPTcX3bEOP5LfyAWu4nsoWMCjlNPsa2/28Th43kEbCEEoNrdfMndHMoL zVeeYZFxtcIsVvbpEwDuBBZIL+63GImU4pc5OhKSLdv7R1JSQXnewsVIYvdKuY6OfeN/ Nbbps316KT+hCwbUcD0b3d23XjGjBYuSEs1jou642GVnuFNgMDDvcmb0+39WM5bA+ZZ8 DOXQ== 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=S3B424mCGqfKzAf3lqDAeEddOod/1fhdiZV0JbxECm0=; b=vKlhsLTkL/F29E21BajX8HZVw6u6IEZhxyYyCydNwydlTMGlCSODOtHLNQ1WULvivE tzgHumA1ej+oexEiE+e88KIuw+3hKN+al/ZTwDAX/AD6X/2BjHEhzBMJKcSzON+xPci0 gVWmNgmZ+uJFwP0HEWZ6yJlYVkmHjnDh/hv7PYbhDi5iYMBnegXzp1vSWZVhbZMU7q3s Tjfa7B5g/Q39bAtdl2QF0dpT3EMmj29WFZAzQRUIvkOyuVn3zTTKcPjR3L5eh1aeYvmi S1NitOqIjmJ7FhLd3Ncbxcx2qaxt/Q2hQB+OlO0IoXb9nkkGWL20Eie50ETJC7gZCuQ1 Wp8g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=QxjFhwCK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 my6-20020a17090b4c8600b002038e75bdccsi9606104pjb.173.2022.10.22.01.11.54; Sat, 22 Oct 2022 01:12: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=QxjFhwCK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S233320AbiJVILW (ORCPT + 99 others); Sat, 22 Oct 2022 04:11:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60728 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233285AbiJVIJ3 (ORCPT ); Sat, 22 Oct 2022 04:09:29 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 29A572D447E; Sat, 22 Oct 2022 00:53: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 1B67060B81; Sat, 22 Oct 2022 07:53:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D4194C433C1; Sat, 22 Oct 2022 07:53:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425189; bh=0einq7fTqgMqNK76jwkzXls/v3g3vDEhp3UU2sIhUVs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QxjFhwCKN8NaJ9wXDeNsX2JztWkxxD8NyWib3qiGSE+qjmDbcJwAZld5MD9pOTdlj M0L1eUmJTPVPDTxE4jo6yjZecUe6QM421WFtw6ipN/Wjuj9alRsWuMwgkbMCOSBnvj KuhcqrYw4slasZlVnYXd84oeE6EtA0ZGif1At6A0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Marijn Suijten , Alexey Minnekhanov , Stephen Boyd , Bjorn Andersson , Sasha Levin Subject: [PATCH 5.19 393/717] clk: qcom: gcc-sdm660: Use floor ops for SDCC1 clock Date: Sat, 22 Oct 2022 09:24:32 +0200 Message-Id: <20221022072515.071366224@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747374652215855692?= X-GMAIL-MSGID: =?utf-8?q?1747374652215855692?= From: Marijn Suijten [ Upstream commit 6956c18f4ad9200aa945f7ea37d65a05afc49d51 ] In commit 3f905469c8ce ("clk: qcom: gcc: Use floor ops for SDCC clocks") floor ops were applied to SDCC2 only, but flooring is also required on the SDCC1 apps clock which is used by the eMMC card on Sony's Nile platform, and otherwise result in the typicial "Card appears overclocked" warnings observed on many other platforms before: mmc0: Card appears overclocked; req 52000000 Hz, actual 100000000 Hz mmc0: Card appears overclocked; req 52000000 Hz, actual 100000000 Hz mmc0: Card appears overclocked; req 104000000 Hz, actual 192000000 Hz Fixes: f2a76a2955c0 ("clk: qcom: Add Global Clock controller (GCC) driver for SDM660") Signed-off-by: Marijn Suijten Tested-by: Alexey Minnekhanov Reviewed-by: Stephen Boyd Signed-off-by: Bjorn Andersson Link: https://lore.kernel.org/r/20220714203822.186448-1-marijn.suijten@somainline.org Signed-off-by: Sasha Levin --- drivers/clk/qcom/gcc-sdm660.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/clk/qcom/gcc-sdm660.c b/drivers/clk/qcom/gcc-sdm660.c index 9b97425008ce..db918c92a522 100644 --- a/drivers/clk/qcom/gcc-sdm660.c +++ b/drivers/clk/qcom/gcc-sdm660.c @@ -757,7 +757,7 @@ static struct clk_rcg2 sdcc1_apps_clk_src = { .name = "sdcc1_apps_clk_src", .parent_data = gcc_parent_data_xo_gpll0_gpll4_gpll0_early_div, .num_parents = ARRAY_SIZE(gcc_parent_data_xo_gpll0_gpll4_gpll0_early_div), - .ops = &clk_rcg2_ops, + .ops = &clk_rcg2_floor_ops, }, }; From patchwork Sat Oct 22 07:24: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: 7777 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1121286wrr; Sat, 22 Oct 2022 02:28:06 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4n/G88ZyojiCfcDfEiAR9/bOzmv4uA7oh6KghbZC6bG7poVfkErt/6G2lslykozwIGdKtN X-Received: by 2002:a17:90b:1bc9:b0:20d:b990:5028 with SMTP id oa9-20020a17090b1bc900b0020db9905028mr51508989pjb.111.1666430885764; Sat, 22 Oct 2022 02:28:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666430885; cv=none; d=google.com; s=arc-20160816; b=VMKkr7Kd+tP6Wyp9MfVKko+pLCkoAbQmw1ggrywMgV0rPNrKqzEE9sUv2sTZlIG20y EEiYszYdpGiR0CDrPMSjhgTcPeQN67RVIMp6j8szLRUa6Vb1yhY4n7Wt8h6NncvXb0Kh T/+eWlbTQQH0lVtFt1x3B6todSo1HQRC1hN3utjwVfN0W5Wubsm7FlXlQZ/XJczqhqgU Su3dhzfmCIKK9BvzpS995cHtXNVtBCrtJ6LqgKuCCCkFGB1dwKG7sOhXH1/ZQb/8oZNm nwynakZiGo6lbSRVPo7vlBcs+S2k1Ye20LaBY5W21vqKLkgIeVk6xx7ioZltfLzQ5hqb Crvw== 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=hwwLhRUER/Hbc51qCZ2z7Lv8XVtEnEqs7MyOVIS1IQE=; b=Z9aXccu1KLvLqnaM9CoQH8tOLI5uObe50Ii2199anlm5VZ/Y9CklCyMKMOS8PdXRqB Gwm2Q4pWGUg9+gC4M2KT054nPHU/HBIcyH8IEzczpWiKXUtETinH16dm3z1RExjI9L8N iqCiqHw4Bx/jRZIO0F11mqWXTOmQ1GGDVaqD777a3OBIPMieavTm3I4oMP5UoDXB72km X0ePQrBFMe/NMneIjK0zd7F7cOCtwTeJuFFahMPvM4krR4LQZW7cesNt6YHbz3xX4jiO ZiQT0ou07bxP9E8a+C5FA8l+sTaF+Yqgd8OqUJDIsdHWy5AStc2BPR4kihzhTuNA9TYo 1Kgg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=xByQgtxM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 c13-20020a63d14d000000b00439e032756fsi25022639pgj.65.2022.10.22.02.27.53; Sat, 22 Oct 2022 02:28: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=xByQgtxM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S229936AbiJVJEc (ORCPT + 99 others); Sat, 22 Oct 2022 05:04:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58322 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235080AbiJVJDY (ORCPT ); Sat, 22 Oct 2022 05:03:24 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E39842FACE1; Sat, 22 Oct 2022 01:18: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 C781D60B84; Sat, 22 Oct 2022 07:53:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CC0A2C433D6; Sat, 22 Oct 2022 07:53:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425198; bh=WTP5UwOckZbMbSXMx2VCri9AardoaYuqySbMaS2HOr4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xByQgtxMxZVMgBztxVoe/uh6UpRusSxqVD+yVNqIDpJEVIsdzHZL6fPGwHqTyW77F rEHYD7zmoVXn2gHftouBo7+BdpRhAm27trw3dsHv1df9KyCb0jGdq8buryUhHylGfO btxveMjdW8JIBZOpDStj0fjM9M7BnqR3EGQgG1yo= 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 5.19 394/717] media: exynos4-is: fimc-is: Add of_node_put() when breaking out of loop Date: Sat, 22 Oct 2022 09:24:33 +0200 Message-Id: <20221022072515.184860811@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747379432375555340?= X-GMAIL-MSGID: =?utf-8?q?1747379432375555340?= 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/samsung/exynos4-is/fimc-is.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/media/platform/samsung/exynos4-is/fimc-is.c b/drivers/media/platform/samsung/exynos4-is/fimc-is.c index e3072d69c49f..a7704ff069d6 100644 --- a/drivers/media/platform/samsung/exynos4-is/fimc-is.c +++ b/drivers/media/platform/samsung/exynos4-is/fimc-is.c @@ -213,6 +213,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 Sat Oct 22 07:24: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: 7473 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1099111wrr; Sat, 22 Oct 2022 01:12:41 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5thLdue35giwt0UHCJjLipt8/ezLjXGDf8CoP+TcwHBBHVlYFfHM7Wp+FS6poQp+lftDno X-Received: by 2002:a17:90b:1808:b0:20d:4e7f:5f53 with SMTP id lw8-20020a17090b180800b0020d4e7f5f53mr61371667pjb.170.1666426361397; Sat, 22 Oct 2022 01:12:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666426361; cv=none; d=google.com; s=arc-20160816; b=pTnxRqoTtq0SNmjjyPuhUDwd8IoTfixDN+kll8Shx4TvA2DshbMONI0DMOOaDm+6Rt CcN4AmlsRDZKmSquiEx/6c1JIotYqGHAs+/9FGakFwP+In3ZNmUP+0ngYFgM5fc2Dtfk FkD9pCG+dvPrgzmhjp8Grv1eRp6pfNPCnc5/AIdbojx+uw88E9iRPkbhWAATCJIrxkPC uZBOPBl1njbXRRsTq0ZYO4JF59heSla9Us8AAbm0iIwUiuKzJuVyv8iHNSWDlJ/2smyy JTTe8c96AhHrpxgwvw5KWSt22Ry7U7nhjLBu4KHwf1D7KOdx6asFhIgnwaMt2mjZJm9n VyQA== 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=SvvFDPIRagDwQAw7oBOyp2vi2gZF403zm7RAQR3gSzc=; b=I25BCqfnlQwfrPMlAnvPfXT1ROBi/iiOCBFI9POPL9fykL3Pc4/Z8hbMoFrX73/ZxJ 6RQ4oY1JKh3EJ6/+Le+yymxO+4nbCxmyEW0CK8A1QD/InbzWb/hA7jrjYd59zbfDHxzl jEdVObXxACL9yu3cmIA6fmzjhAxKcYPsoeqqrfdaishjPO6RinutnHw472J+Sc5JcQt+ oCa5CFZGcJKOj5Oi3JScdpPFDgpQNpKes4jz1afSaxVUlVY7s4ltQjWirrMnjAAXJlB0 zl+qLIMZklYE8EfKZ4SmEZPzjvul+tPFyUgV9fmq5jCejxVrvCdR+RN37fvVjSQR53CX gbwQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=cPw8gRNn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 cx19-20020a17090afd9300b0020a755f2b83si2030921pjb.100.2022.10.22.01.12.29; Sat, 22 Oct 2022 01:12: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=cPw8gRNn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S233204AbiJVIL7 (ORCPT + 99 others); Sat, 22 Oct 2022 04:11:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54208 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233427AbiJVIJt (ORCPT ); Sat, 22 Oct 2022 04:09:49 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EDB572CA7EC; Sat, 22 Oct 2022 00:54: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 ED92060B82; Sat, 22 Oct 2022 07:53:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E80AFC433D7; Sat, 22 Oct 2022 07:53:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425201; bh=hqNac0gTxsglYnMmGMAxm6Y4F9sO9iFM2+9XX3B3yuA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cPw8gRNnJFNA8JT//uCCmL6Fw5UMkO/RgqHinJW0/HR/i89BIbd+pEcLsgKM47c3/ dQzwgZbRt9SZjogJwdI6M0+FPx3bsGoWX5WYTo+aMq92/hf+QwVJ5tMrz599xnqRhn cintvDN5QY9kpDTVlbp8OooJFK4EwULOgN5vPaf8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Shubhrajyoti Datta , Sasha Levin Subject: [PATCH 5.19 395/717] tty: xilinx_uartps: Fix the ignore_status Date: Sat, 22 Oct 2022 09:24:34 +0200 Message-Id: <20221022072515.268051620@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747374688321073498?= X-GMAIL-MSGID: =?utf-8?q?1747374688321073498?= 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 9e01fe6c0ab8..e08d2c3305ba 100644 --- a/drivers/tty/serial/xilinx_uartps.c +++ b/drivers/tty/serial/xilinx_uartps.c @@ -361,6 +361,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 Sat Oct 22 07:24: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: 7474 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1099135wrr; Sat, 22 Oct 2022 01:12:44 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5Ba73R6MN90/BleweQYFeHs8NkVDQ+7mY1xBs90OznXCj9nrsvmI2ohsxauNhbld6ztD9I X-Received: by 2002:a63:5b48:0:b0:458:1e98:c862 with SMTP id l8-20020a635b48000000b004581e98c862mr19247390pgm.568.1666426363643; Sat, 22 Oct 2022 01:12:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666426363; cv=none; d=google.com; s=arc-20160816; b=ehxteNj3EZVSEVNE1hHZNXrbvAWEeTKyG8vXqHR890jZMI7mR403eoImAwoy5oJDQn pJwJ0i/vo54Kdok8NR3MzgWxwXxYyZ8NvBvWKPQ9pwHSIHNUGgHyylV2pwpKnEfLNDs+ N5D/aFZ8b2X2FHkQ/RnLL2gQjN02J9D72Ku3EfuVCXT+kEiig79i4nqVCaC3tS2hUFz2 u0CreKHCa1+rBCmxNAEcWryFh5jmQe4KRlzONcU3ei1GtIEWS8gCq2OjsU/RYLfkRRJe Ghtz0r3qYc0t5JWS4YM24IoOnYC5zP/lMQJIfFpD/hbmxPijkYEx7PFgUkk0bwnd4xie BLPA== 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=3viQ+CRsNT0rjUrCnxkPWU6zA3n++RiqlwMnSU3nPDQ=; b=JUCHsNNd+CiRoWGVQmK/0Ju+0IiXw7T8C2E+Iv3Csk0Via+blpofAt7hFB53FjT80z rRxxRTJqrgmgfx9zN0wGpwVRGB2t6J4hmOtuV5Iw4wg00axVtyJ/lT22tRTDIoKrrfL1 dfmUplLXG5GCnI+ZDW6Er8sAbo5D6+OACBh47A5HAaMNz9OsrrsmPfL/xfWf5PEVHqBY JdfiF3o8ymynvtQuP2oTZoQtu5YQIqRE65zfHca43JM+LVRd/Fmx8XM9y8ExWRaMV5P7 swUtXCdDPnxRgLZBMgQKd0P1tpf66YqFWxyED+H/LfsQFTjE+x/uIbozxt0y531KEEe/ gGGQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Ma0u69Hy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 z5-20020a056a00240500b00561f40cc9f3si28114918pfh.262.2022.10.22.01.12.30; Sat, 22 Oct 2022 01:12: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=Ma0u69Hy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S233143AbiJVIMH (ORCPT + 99 others); Sat, 22 Oct 2022 04:12:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35456 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233444AbiJVIJv (ORCPT ); Sat, 22 Oct 2022 04:09:51 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B0D2F2AD9; Sat, 22 Oct 2022 00:54: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 42AD360B80; Sat, 22 Oct 2022 07:53:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 05368C433C1; Sat, 22 Oct 2022 07:53:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425204; bh=07aoPt2PLdRmIbDV/BxqUEGxeJXB49RcibykP7o7QNU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ma0u69HycetUov90DbXV8HjuRd/BZ1HCAUetAEseUaxIkekKzOyZoMuHIeRjaiQe2 YTjlwUUVXG8jMnP5tt9LTRZTW2bGuomiIqJKxJUDro87Tsp3IrIRJukbzYfNKqKoKo FS3HAY8313KA9q9SGtmdVnRAOgN3c3PIOvh0IOr4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ming Qian , Hans Verkuil , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.19 396/717] media: amphion: insert picture startcode after seek for vc1g format Date: Sat, 22 Oct 2022 09:24:35 +0200 Message-Id: <20221022072515.335312598@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747374690895798620?= X-GMAIL-MSGID: =?utf-8?q?1747374690895798620?= From: Ming Qian [ Upstream commit f7fd6c318c8a5d06bf3fe611f30763d62eaaf7f0 ] For format vc1, the amphion vpu requires driver to help insert some custom startcode before sequence and frame. the startcode is different for vc1l and vc1g format. But the sequence startcode is only needed at the beginning, and it's not expected after seek. driver need to treat the codec header and the first frame after seek as a normal frame, and insert picture startcode for it. In previous patch, I just fix it for vc1l format, and should fix the similar issue for vc1g too. Fixes: e670f5d672ef (media: amphion: only insert the first sequence startcode for vc1l format) Signed-off-by: Ming Qian Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin --- drivers/media/platform/amphion/vpu_malone.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/platform/amphion/vpu_malone.c b/drivers/media/platform/amphion/vpu_malone.c index 542bbe361bd8..10553dd93c29 100644 --- a/drivers/media/platform/amphion/vpu_malone.c +++ b/drivers/media/platform/amphion/vpu_malone.c @@ -1277,7 +1277,7 @@ static int vpu_malone_insert_scode_vc1_g_pic(struct malone_scode_t *scode) vbuf = to_vb2_v4l2_buffer(scode->vb); data = vb2_plane_vaddr(scode->vb, 0); - if (vbuf->sequence == 0 || vpu_vb_is_codecconfig(vbuf)) + if (scode->inst->total_input_count == 0 || vpu_vb_is_codecconfig(vbuf)) return 0; if (MALONE_VC1_CONTAIN_NAL(*data)) return 0; From patchwork Sat Oct 22 07:24: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: 7847 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1154085wrr; Sat, 22 Oct 2022 04:07:34 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5LrfBGb/0xUetWud9Mw72GmLNMYLbWs3wGrjiYH2E9Bf8fZo5o+CZguhjUN4yEWazG5cgO X-Received: by 2002:a62:5e81:0:b0:563:1f18:62ab with SMTP id s123-20020a625e81000000b005631f1862abmr23617499pfb.76.1666436853677; Sat, 22 Oct 2022 04:07:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666436853; cv=none; d=google.com; s=arc-20160816; b=gf07ZIRCwjd6WoTHLZLRCLiHmRSDnBZp/7o0XPnMXveUFtGbF1JGPZSK85q82FfXGj nyQiQLTYd35OHTyzuKbbnyFBqkm5Jdpcm4L8ijVFEvo3XAEtK0r/kvKd6r113rzXQ0jz xyr6vNQ2AhRhT7La4dhtcs2gFMhu5NXz5EeQCaT6XNZnl5VUa4vgFYN38igO6R28nyIC 4ObjT8l0LBuTGSinN6oNJlvxkys65ayukR3uF1IhA06vwuid/CAAIJ+ybQeGaxSrGj5J RJzH1fzbExyzzTPrUUtE2CeMG/dWcbTAhGdS6fUL0VibBW6exEWPS3uEuaQiUSQGWQZL dL9g== 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=hrsQIDMejoYUUZQTJ29BcdTSyH1+pok7Kf5yJ81Sqi0=; b=O0t1RYscBj0enJaIaPx0p46XvkpWWesFOnPOgrYFBPO0fa6QpK4+boUD51Ia6Uz/L0 Lsu2vKpqh4GsCtHG5UZtM2KXvLYf62ib8UjC4N5EiptxfbMLAwodW18JhsCFRjl460id g5zC7d766m3DT7CyWqNNUHRpL6v0wlRYhARozyrRS+WMP41BA0l32rgfcBZ7kA3ra/LX C8QAgTvtS4w8shxwaiMyC/ELQL+NifU3LtZ/nV8NK3S2RykVkxGXeVOlFBHeP2H8i1PY EqSMrm1Rlw7bFYEYAIl8dUusahQCX3WYwbDC0QhLi2pKHKpCrKdIFzdRWuUqg46+cK54 cWrw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=hswTckQR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 b12-20020a6541cc000000b00464a9874658si29935360pgq.6.2022.10.22.04.07.21; Sat, 22 Oct 2022 04:07: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=hswTckQR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S230490AbiJVLDc (ORCPT + 99 others); Sat, 22 Oct 2022 07:03:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51252 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230476AbiJVLCl (ORCPT ); Sat, 22 Oct 2022 07:02:41 -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 F40DC2FACE2; Sat, 22 Oct 2022 03:21: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 093F3B82DF7; Sat, 22 Oct 2022 07:53:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 57DEEC433C1; Sat, 22 Oct 2022 07:53:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425207; bh=KnC0eVRrajGhZ5HIxfCVZGcjDmnvlTYo6SUexl+tkS8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hswTckQR3a/keiU8FJ3bgflkKuv1NbMzn8ggvRJVETZbZjnlSNe4DvDxqeSNmawNR DTFpULLH+d5hugidJX5D7LVB1jGO6DhraZ2+IUkESqMk4FhCRTyAn7i2NNwnL1cvMR snYMc5X18MQZWZQB/MNP7r2Uovd293PHOtMw4Fko= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ming Qian , Hans Verkuil , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.19 397/717] media: amphion: adjust the encoders value range of gop size Date: Sat, 22 Oct 2022 09:24:36 +0200 Message-Id: <20221022072515.402386581@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 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?1747385689850253417?= X-GMAIL-MSGID: =?utf-8?q?1747385689850253417?= From: Ming Qian [ Upstream commit 996f4e89fabe44ab9ac0aabb0697aeecbe717eca ] adjust the value range of gop size from [0, 65535] to [1, 8000]. when the gop size is set to a too large value, it may affect the encoded picture quality. so constrain it to a reasonable range. Fixes: 0401e659c1f92 ("media: amphion: add v4l2 m2m vpu encoder stateful driver") Signed-off-by: Ming Qian Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin --- drivers/media/platform/amphion/venc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/platform/amphion/venc.c b/drivers/media/platform/amphion/venc.c index 43d61d82f58c..0f21a181c1de 100644 --- a/drivers/media/platform/amphion/venc.c +++ b/drivers/media/platform/amphion/venc.c @@ -644,7 +644,7 @@ static int venc_ctrl_init(struct vpu_inst *inst) BITRATE_DEFAULT_PEAK); v4l2_ctrl_new_std(&inst->ctrl_handler, &venc_ctrl_ops, - V4L2_CID_MPEG_VIDEO_GOP_SIZE, 0, (1 << 16) - 1, 1, 30); + V4L2_CID_MPEG_VIDEO_GOP_SIZE, 1, 8000, 1, 30); v4l2_ctrl_new_std(&inst->ctrl_handler, &venc_ctrl_ops, V4L2_CID_MPEG_VIDEO_B_FRAMES, 0, 4, 1, 0); From patchwork Sat Oct 22 07:24: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: 7848 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1154117wrr; Sat, 22 Oct 2022 04:07:37 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5SLChkcKVNEbnyTv8tx/G9yGsMl7dq7sTLmo5vTca8tON92QAR48ccB/4xTX20AfKk1I6n X-Received: by 2002:aa7:8b13:0:b0:55f:69de:d17c with SMTP id f19-20020aa78b13000000b0055f69ded17cmr23596381pfd.20.1666436856873; Sat, 22 Oct 2022 04:07:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666436856; cv=none; d=google.com; s=arc-20160816; b=DaCg2kNUyvjU/LhZHzzczt4WktSaiwMkArbax3Un/t1+zZYwVE+8jf5Nfz4UZOP+Ri opr31W4SFPbyQIWHatcKBNlZwIk0090TW8wiayTK6qSVyZy0Jg0jm/3l/LkqwDQTlvQk BO1SPg55TJz0REyNuOxmitllGASCdE4g8/aggUzPpb1VsPCfHg/FgrKKIjLEHq03/6q7 ZN0J6LZlNQ6sAmQLmKYmZUfXaVAghmbYZoqKwnJKpjr2LQUujZtljtT2l0fQRmNXLD2c HzjE8OEhIDpAqqxvHu6JllLMfN8FwLJu5ADxh/hOdhDs8EGCt1tb60EvoLqfAxaEWQ7R /8Ag== 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=RhT0EvohbRLuAjC8lXdzii5Ee0Y6C2nS9gJLL4MEaFA=; b=jRiYHOEUuHL2WWmLKjumyr5Csf2/CCwjjXyhKf2VF4dfRamcveJVyFpmsU36+7LtIW MLf19CcKPpdKh6WoVuOoPn6Fo3sCgAB/BOpJUbYoHRd7OQx4sxvlkffkM4GJcTjiuax4 A6bynbT2R+ow2bv8Gn4u/oP5mdqdBFk83vsCRyxNdVk6NIgmj+0pSEVaqY42bTQ4WaeQ XP0qydmmmoVOlT3i3ZMdRlZTIfYFiwQYv90o2LG0d7cpx9m+i90urI0X6RlEsHlOazs0 sQPeinpymoVeULPWmaKB8+8wMRupCJU11aKLmpIXGUShj0Yj+z5fynL489gEPvtWjDoA sE1Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="YTh/jYIz"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 d21-20020a056a0024d500b00565ec924efasi28466806pfv.365.2022.10.22.04.07.24; Sat, 22 Oct 2022 04:07: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="YTh/jYIz"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231150AbiJVLDh (ORCPT + 99 others); Sat, 22 Oct 2022 07:03:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59914 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229918AbiJVLCm (ORCPT ); Sat, 22 Oct 2022 07:02: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 7F3F22FA5F1; Sat, 22 Oct 2022 03:21: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 17C89B82DFB; Sat, 22 Oct 2022 07:53:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 534ACC433D6; Sat, 22 Oct 2022 07:53:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425210; bh=h5rZI2DhtyRw6JJ9HZ5Nms1rZq9aonnNTsh+tp6sooA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YTh/jYIz+yZ5iHvht3bMcRkjEciWsjQ1Q/TIUuA8gCkQhUsCjNEORcgP5fGJ/uwfs sAQ/mJlO4CCNoeGFpwEcmubqSnHxtZYEUnLIPcLYzFF7m6HU97NJks/MB0ehUvywxM +wz+V7LMQquAdUDkVfOUEP/96DYyFPrHh2jDcGcw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ming Qian , Hans Verkuil , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.19 398/717] media: amphion: dont change the colorspace reported by decoder. Date: Sat, 22 Oct 2022 09:24:37 +0200 Message-Id: <20221022072515.462478704@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 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?1747385693892751718?= X-GMAIL-MSGID: =?utf-8?q?1747385693892751718?= From: Ming Qian [ Upstream commit 61c2698ee60630c6a7d2e99850fa81ff6450270a ] decoder will report the colorspace information which is parsed from the sequence header, if they are unspecified, just let application to determine it, don't change it in driver. Fixes: 6de8d628df6ef ("media: amphion: add v4l2 m2m vpu decoder stateful driver") Signed-off-by: Ming Qian Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin --- drivers/media/platform/amphion/vdec.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/media/platform/amphion/vdec.c b/drivers/media/platform/amphion/vdec.c index 44dbca0fe17f..6d6842ff12e2 100644 --- a/drivers/media/platform/amphion/vdec.c +++ b/drivers/media/platform/amphion/vdec.c @@ -808,14 +808,6 @@ static void vdec_init_fmt(struct vpu_inst *inst) inst->cap_format.field = V4L2_FIELD_NONE; else inst->cap_format.field = V4L2_FIELD_SEQ_TB; - if (vdec->codec_info.color_primaries == V4L2_COLORSPACE_DEFAULT) - vdec->codec_info.color_primaries = V4L2_COLORSPACE_REC709; - if (vdec->codec_info.transfer_chars == V4L2_XFER_FUNC_DEFAULT) - vdec->codec_info.transfer_chars = V4L2_XFER_FUNC_709; - if (vdec->codec_info.matrix_coeffs == V4L2_YCBCR_ENC_DEFAULT) - vdec->codec_info.matrix_coeffs = V4L2_YCBCR_ENC_709; - if (vdec->codec_info.full_range == V4L2_QUANTIZATION_DEFAULT) - vdec->codec_info.full_range = V4L2_QUANTIZATION_LIM_RANGE; } static void vdec_init_crop(struct vpu_inst *inst) @@ -1556,6 +1548,14 @@ static int vdec_get_debug_info(struct vpu_inst *inst, char *str, u32 size, u32 i vdec->codec_info.frame_rate.numerator, vdec->codec_info.frame_rate.denominator); break; + case 9: + num = scnprintf(str, size, "colorspace: %d, %d, %d, %d (%d)\n", + vdec->codec_info.color_primaries, + vdec->codec_info.transfer_chars, + vdec->codec_info.matrix_coeffs, + vdec->codec_info.full_range, + vdec->codec_info.vui_present); + break; default: break; } From patchwork Sat Oct 22 07:24: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: 7599 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1106420wrr; Sat, 22 Oct 2022 01:37:49 -0700 (PDT) X-Google-Smtp-Source: AMsMyM57N5ra7TMlkEP3u2q+iA+BBfnjqPLn7yXif9FI4dv1l6P1WKkdrq2e1uIYpLFcnR182J80 X-Received: by 2002:aa7:cad5:0:b0:454:88dc:2c22 with SMTP id l21-20020aa7cad5000000b0045488dc2c22mr21411932edt.352.1666427869210; Sat, 22 Oct 2022 01:37:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666427869; cv=none; d=google.com; s=arc-20160816; b=Ua78Q4iLK7Y8s/6+dhPtZN0DiNrIi6Gjvgwvhdw5KzIM/KJHmeudW1VRE/pqYM0wy5 hkxXWGZYRJ/JHorJhbBCrG1ghrkqY5Y5u7GhX1xAEd9Fye4XsRblFSU5ewoJEIelByH7 OtKxO3NtJM4Q7D6r35idzaSZ5cW3sn36c4MZVu5ltrQ/5e5a2q6jgyAAgm4hTSsCbDvl 4lb/z7UgRzLxZmXrwSGl4QYk1I/PaNbjdwaRwysUyMfBCj7TH79+we6HwENvjYH/AMWN EQBbZUqWH3m0P8ykAA2KCPhUA6nBkqJ9ix+DwxAxNQUhdT3+GAAkqivHIEx199vsqFMk q0JQ== 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=LiYjwJdFtqPlD8Rk4Ug7TMKWtvMyRTsMVBjPcR+fRkc=; b=RFldpIG6IvLTOkR46U8K0jiVG4jYTeDcvJRv1Aznbi0/RjX0MyXR6JLyziSbTpCQsk LL4RS2VFD3bveVwF3gCFhyYOHx58mPGtRSQcuzTj5rVrJx6xD306gWinA87RfnDkO2OV 63Q6H7dpYw1Ta2qTrHCZc8EwA86TPvspIjKcvL4R6MK3XCsPL2DAvblRMk7KX586NWTr cN1M4hYryFTDyhuqDcZBAT1HenJAiHMPipQi4Wxpii+yGb1IGuMQOm4nU8zRs6VLLJLv OBJr07+MMPLZV4ZRzp3SGua2GrgyoR5csTcWIDKDPquttT+EslBYosoqrBsnzQJ6XdM4 OuUw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Fbsq+3EL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 js6-20020a17090797c600b0078b2fed72b9si18922532ejc.111.2022.10.22.01.37.25; Sat, 22 Oct 2022 01:37: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=Fbsq+3EL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S234083AbiJVIdS (ORCPT + 99 others); Sat, 22 Oct 2022 04:33:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39186 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234147AbiJVI3r (ORCPT ); Sat, 22 Oct 2022 04:29: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 92CF4804BC; Sat, 22 Oct 2022 01: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 2594FB82D9F; Sat, 22 Oct 2022 07:53:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6BE4FC4314B; Sat, 22 Oct 2022 07:53:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425213; bh=PZgXAmve0+9tpL8ySnD8fCg3VhGqRFl3MW4egjYXpyA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Fbsq+3ELGDwR09M5GSkucOZCgCspJyOJ7qSA3D1ZBf/cJRxB65ap65d6fZZBalgw4 htiZRueanqwJmGDctr6VVS77WxipGK6/hGic/Hwq++G4Kubdwhnr7wkIUslA1iCKLU 8jBOJQfdTT33FmF58z2+JAzBCuN78Fb5BslkxPe8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ming Qian , Hans Verkuil , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.19 399/717] media: amphion: fix a bug that vpu core may not resume after suspend Date: Sat, 22 Oct 2022 09:24:38 +0200 Message-Id: <20221022072515.523812141@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376269436464231?= X-GMAIL-MSGID: =?utf-8?q?1747376269436464231?= From: Ming Qian [ Upstream commit 0202a665bf17fbe98fed954944aabbcb4f14a4cc ] driver will enable the vpu core when request the first instance on the core. one vpu core can only support 8 streaming instances in the same time, the instance won't be added to core's list before streamon. so the actual instance count may be greater then the number in the core's list. in pm resume callback, driver will resume the core immediately if core's list is not empty. but this check is not accurate, if suspend during one instance is requested, but not streamon, then after suspend, the core won't be resume, and led to instance failure. use the request_count instead of the core's list to check whether is the core needed to resume immediately after suspend. And it can make the pm suspend and resume callback more clear. Fixes: 9f599f351e86 ("media: amphion: add vpu core driver") Signed-off-by: Ming Qian Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin --- drivers/media/platform/amphion/vpu.h | 1 - drivers/media/platform/amphion/vpu_core.c | 84 ++++++++++++----------- drivers/media/platform/amphion/vpu_core.h | 1 + drivers/media/platform/amphion/vpu_dbg.c | 9 ++- 4 files changed, 51 insertions(+), 44 deletions(-) diff --git a/drivers/media/platform/amphion/vpu.h b/drivers/media/platform/amphion/vpu.h index f914de6ed81e..beac0309ca8d 100644 --- a/drivers/media/platform/amphion/vpu.h +++ b/drivers/media/platform/amphion/vpu.h @@ -119,7 +119,6 @@ struct vpu_mbox { enum vpu_core_state { VPU_CORE_DEINIT = 0, VPU_CORE_ACTIVE, - VPU_CORE_SNAPSHOT, VPU_CORE_HANG }; diff --git a/drivers/media/platform/amphion/vpu_core.c b/drivers/media/platform/amphion/vpu_core.c index 51a764713159..21a416b8e483 100644 --- a/drivers/media/platform/amphion/vpu_core.c +++ b/drivers/media/platform/amphion/vpu_core.c @@ -89,7 +89,7 @@ static int vpu_core_boot_done(struct vpu_core *core) core->supported_instance_count = min(core->supported_instance_count, count); } core->fw_version = fw_version; - core->state = VPU_CORE_ACTIVE; + vpu_core_set_state(core, VPU_CORE_ACTIVE); return 0; } @@ -172,10 +172,26 @@ int vpu_alloc_dma(struct vpu_core *core, struct vpu_buffer *buf) return __vpu_alloc_dma(core->dev, buf); } -static void vpu_core_check_hang(struct vpu_core *core) +void vpu_core_set_state(struct vpu_core *core, enum vpu_core_state state) { - if (core->hang_mask) - core->state = VPU_CORE_HANG; + if (state != core->state) + vpu_trace(core->dev, "vpu core state change from %d to %d\n", core->state, state); + core->state = state; + if (core->state == VPU_CORE_DEINIT) + core->hang_mask = 0; +} + +static void vpu_core_update_state(struct vpu_core *core) +{ + if (!vpu_iface_get_power_state(core)) { + if (core->request_count) + vpu_core_set_state(core, VPU_CORE_HANG); + else + vpu_core_set_state(core, VPU_CORE_DEINIT); + + } else if (core->state == VPU_CORE_ACTIVE && core->hang_mask) { + vpu_core_set_state(core, VPU_CORE_HANG); + } } static struct vpu_core *vpu_core_find_proper_by_type(struct vpu_dev *vpu, u32 type) @@ -188,11 +204,13 @@ static struct vpu_core *vpu_core_find_proper_by_type(struct vpu_dev *vpu, u32 ty dev_dbg(c->dev, "instance_mask = 0x%lx, state = %d\n", c->instance_mask, c->state); if (c->type != type) continue; + mutex_lock(&c->lock); + vpu_core_update_state(c); + mutex_unlock(&c->lock); if (c->state == VPU_CORE_DEINIT) { core = c; break; } - vpu_core_check_hang(c); if (c->state != VPU_CORE_ACTIVE) continue; if (c->request_count < request_count) { @@ -412,6 +430,12 @@ int vpu_inst_register(struct vpu_inst *inst) } mutex_lock(&core->lock); + if (core->state != VPU_CORE_ACTIVE) { + dev_err(core->dev, "vpu core is not active, state = %d\n", core->state); + ret = -EINVAL; + goto exit; + } + if (inst->id >= 0 && inst->id < core->supported_instance_count) goto exit; @@ -453,7 +477,7 @@ int vpu_inst_unregister(struct vpu_inst *inst) vpu_core_release_instance(core, inst->id); inst->id = VPU_INST_NULL_ID; } - vpu_core_check_hang(core); + vpu_core_update_state(core); if (core->state == VPU_CORE_HANG && !core->instance_mask) { int err; @@ -462,7 +486,7 @@ int vpu_inst_unregister(struct vpu_inst *inst) err = vpu_core_sw_reset(core); mutex_lock(&core->lock); if (!err) { - core->state = VPU_CORE_ACTIVE; + vpu_core_set_state(core, VPU_CORE_ACTIVE); core->hang_mask = 0; } } @@ -612,7 +636,7 @@ static int vpu_core_probe(struct platform_device *pdev) mutex_init(&core->cmd_lock); init_completion(&core->cmp); init_waitqueue_head(&core->ack_wq); - core->state = VPU_CORE_DEINIT; + vpu_core_set_state(core, VPU_CORE_DEINIT); core->res = of_device_get_match_data(dev); if (!core->res) @@ -761,33 +785,18 @@ static int __maybe_unused vpu_core_resume(struct device *dev) mutex_lock(&core->lock); pm_runtime_resume_and_get(dev); vpu_core_get_vpu(core); - if (core->state != VPU_CORE_SNAPSHOT) - goto exit; - if (!vpu_iface_get_power_state(core)) { - if (!list_empty(&core->instances)) { + if (core->request_count) { + if (!vpu_iface_get_power_state(core)) ret = vpu_core_boot(core, false); - if (ret) { - dev_err(core->dev, "%s boot fail\n", __func__); - core->state = VPU_CORE_DEINIT; - goto exit; - } - } else { - core->state = VPU_CORE_DEINIT; - } - } else { - if (!list_empty(&core->instances)) { + else ret = vpu_core_sw_reset(core); - if (ret) { - dev_err(core->dev, "%s sw_reset fail\n", __func__); - core->state = VPU_CORE_HANG; - goto exit; - } + if (ret) { + dev_err(core->dev, "resume fail\n"); + vpu_core_set_state(core, VPU_CORE_HANG); } - core->state = VPU_CORE_ACTIVE; } - -exit: + vpu_core_update_state(core); pm_runtime_put_sync(dev); mutex_unlock(&core->lock); @@ -801,18 +810,11 @@ static int __maybe_unused vpu_core_suspend(struct device *dev) int ret = 0; mutex_lock(&core->lock); - if (core->state == VPU_CORE_ACTIVE) { - if (!list_empty(&core->instances)) { - ret = vpu_core_snapshot(core); - if (ret) { - mutex_unlock(&core->lock); - return ret; - } - } - - core->state = VPU_CORE_SNAPSHOT; - } + if (core->request_count) + ret = vpu_core_snapshot(core); mutex_unlock(&core->lock); + if (ret) + return ret; vpu_core_cancel_work(core); diff --git a/drivers/media/platform/amphion/vpu_core.h b/drivers/media/platform/amphion/vpu_core.h index 00a662997da4..65b562642603 100644 --- a/drivers/media/platform/amphion/vpu_core.h +++ b/drivers/media/platform/amphion/vpu_core.h @@ -11,5 +11,6 @@ u32 csr_readl(struct vpu_core *core, u32 reg); int vpu_alloc_dma(struct vpu_core *core, struct vpu_buffer *buf); void vpu_free_dma(struct vpu_buffer *buf); struct vpu_inst *vpu_core_find_instance(struct vpu_core *core, u32 index); +void vpu_core_set_state(struct vpu_core *core, enum vpu_core_state state); #endif diff --git a/drivers/media/platform/amphion/vpu_dbg.c b/drivers/media/platform/amphion/vpu_dbg.c index da62bd718fb8..ad41060ce46e 100644 --- a/drivers/media/platform/amphion/vpu_dbg.c +++ b/drivers/media/platform/amphion/vpu_dbg.c @@ -15,6 +15,7 @@ #include #include "vpu.h" #include "vpu_defs.h" +#include "vpu_core.h" #include "vpu_helpers.h" #include "vpu_cmds.h" #include "vpu_rpc.h" @@ -233,6 +234,10 @@ static int vpu_dbg_core(struct seq_file *s, void *data) if (seq_write(s, str, num)) return 0; + num = scnprintf(str, sizeof(str), "power %s\n", + vpu_iface_get_power_state(core) ? "on" : "off"); + if (seq_write(s, str, num)) + return 0; num = scnprintf(str, sizeof(str), "state = %d\n", core->state); if (seq_write(s, str, num)) return 0; @@ -346,10 +351,10 @@ static ssize_t vpu_dbg_core_write(struct file *file, pm_runtime_resume_and_get(core->dev); mutex_lock(&core->lock); - if (core->state != VPU_CORE_DEINIT && !core->instance_mask) { + if (vpu_iface_get_power_state(core) && !core->request_count) { dev_info(core->dev, "reset\n"); if (!vpu_core_sw_reset(core)) { - core->state = VPU_CORE_ACTIVE; + vpu_core_set_state(core, VPU_CORE_ACTIVE); core->hang_mask = 0; } } From patchwork Sat Oct 22 07:24: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: 7445 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1098389wrr; Sat, 22 Oct 2022 01:10:40 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5URMr5d4YIKQhXc+wfajmFNPw3cAQtW+/P2YmCkXwqY8ZIToudRHVVKRjm9dERTt7lwxid X-Received: by 2002:a05:6a00:a94:b0:562:dcbb:47c3 with SMTP id b20-20020a056a000a9400b00562dcbb47c3mr23697850pfl.79.1666426239720; Sat, 22 Oct 2022 01:10:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666426239; cv=none; d=google.com; s=arc-20160816; b=hztBr7zWsM0q6b4NH94U2WQgvNsgyfrSnzoQeRg2vJUB36Dcny2FeupkwrDpyx5Lbi 7VCEo1+Qg3sW7+BFWU6VewHKwl5XOHBrFu3H0447b+qtRko8Q5eTvy0n5Le1IlfHMwAW nC5KumFbjfZh19x8ixpUCFH+VaxLbZPy+Nw5K/e8PrCkZ5w6qtSYOcL7MvFlrm4sH62T uPEtdP3Z4dFLihPdjFCvSJ86pmF2nbHJe/hFa+VzrVXB3E80PBKvYqYevueeh3vK3bD/ 8uHRCxWomf+BKCs6isp5Xn5KVk54umBkNohB09OhpDqnIUWe5Te4/9wlSk8+2q/F058i EYBQ== 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=XhWVOrWp1pGGSeEQALigQ8X9+kgy5G8IEinUpuJjHGU=; b=PDMxbiQ53NpA1eTy+l2UNeKimrlo/bmnG87KyAWD1ENv8LPVFqF6rao3QPqwtVDmYK Gxx/2wCW3UOUfVyEptme5z3DBHmAYVpy8RfUvpF5N+Lmwfb84V4xtqesugzJ8BNX0Poe POKmgUB/JS5HGPYpJIE+hD2UstTnqxMetmmv2jrh9vG4XcU0nGh2LMAKWYBpiZjQ1OHu 14iLbUzowUx918n9Fw3aplDkjAS4H+jlC4NhpA0FYEEdyzyNt835mDzpDTKkC6kVitIY EKRcC4tMcb3xk1C0pPDY5IOQ9CdS9VTLGq/FxYvruZ6yC+y8bWs3L7NwDtNx1ZJ+tVk8 s14w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=lXYArmOD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 s15-20020a056a00194f00b00562db93e317si25088573pfk.114.2022.10.22.01.10.26; Sat, 22 Oct 2022 01:10: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=lXYArmOD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S233294AbiJVIJb (ORCPT + 99 others); Sat, 22 Oct 2022 04:09:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44302 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232394AbiJVIFN (ORCPT ); Sat, 22 Oct 2022 04:05: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 DFB082D52FA; Sat, 22 Oct 2022 00:52: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 68A98B82DF1; Sat, 22 Oct 2022 07:52:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B1CAAC433D6; Sat, 22 Oct 2022 07:52:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425129; bh=lU1rMge4AvOB32EqEc1cYUnGuxCTzQQf26R06XK4qiY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lXYArmODH0feiJPoNYwwe31eQNeaO0aGoNx4fvnZjDi/PE1U+6DYflOzKDddoHsR/ GKXEUfvKL4a+9tNZDgh38qkuM+EbOb2q0KxuPo3ZpXRU8kG7e6wnb1PQjYYFYwNZFU z6TDV19zJdMnKDB71ZEw/71oemPSx3NOX86kIGLs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Xu Qiang , Neil Armstrong , Hans Verkuil , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.19 400/717] media: meson: vdec: add missing clk_disable_unprepare on error in vdec_hevc_start() Date: Sat, 22 Oct 2022 09:24:39 +0200 Message-Id: <20221022072515.568243594@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747374560868680008?= X-GMAIL-MSGID: =?utf-8?q?1747374560868680008?= From: Xu Qiang [ Upstream commit 4029372233e13e281f8c387f279f9f064ced3810 ] Add the missing clk_disable_unprepare() before return from vdec_hevc_start() in the error handling case. Fixes: 823a7300340e (“media: meson: vdec: add common HEVC decoder support”) Signed-off-by: Xu Qiang Reviewed-by: Neil Armstrong Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin --- drivers/staging/media/meson/vdec/vdec_hevc.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/staging/media/meson/vdec/vdec_hevc.c b/drivers/staging/media/meson/vdec/vdec_hevc.c index 9530e580e57a..afced435c907 100644 --- a/drivers/staging/media/meson/vdec/vdec_hevc.c +++ b/drivers/staging/media/meson/vdec/vdec_hevc.c @@ -167,8 +167,12 @@ static int vdec_hevc_start(struct amvdec_session *sess) clk_set_rate(core->vdec_hevc_clk, 666666666); ret = clk_prepare_enable(core->vdec_hevc_clk); - if (ret) + if (ret) { + if (core->platform->revision == VDEC_REVISION_G12A || + core->platform->revision == VDEC_REVISION_SM1) + clk_disable_unprepare(core->vdec_hevcf_clk); return ret; + } if (core->platform->revision == VDEC_REVISION_SM1) regmap_update_bits(core->regmap_ao, AO_RTI_GEN_PWR_SLEEP0, From patchwork Sat Oct 22 07:24:40 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 7775 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1121172wrr; Sat, 22 Oct 2022 02:27:42 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6QhJ3XYWXUXny3WgpOW9hpYc37DN7bYCvd7oMR7rkYi1WraBgdcX2QkyPaI4E9M07bC2kj X-Received: by 2002:a17:902:8549:b0:178:6399:3e0f with SMTP id d9-20020a170902854900b0017863993e0fmr23776030plo.35.1666430862609; Sat, 22 Oct 2022 02:27:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666430862; cv=none; d=google.com; s=arc-20160816; b=xhoXcCWynt1dvEdxUBsg3XbQQFnVpV4JjcFl66/WUOGFB78htsCKnW/2iumRgzYqk8 RZvzW8GKS5VhQBNz+Erp+GCBtfjk2e31DW4zADDt8cP60ofeBg0ycHs8Hn9YzZKd5Kuw 8UiWbI3yOI+XsC9u5DMUS4AZJnrOvZwStHsf+XnixNryrU2Ev6yy6gE2zWYzikQ3MrGw znkoO1ubqotz1XCzCwpjYOH4cSoYBJxFXUE5DJGhf5ma906hbxW8KkubOZKP7AM5waTF DSLOksxeMGVSfeEWqsR6AGcW1pEDN30qVV6DtbtLa+7mONx0dfZ5aZtnRiUQJT9Eyc1C Pmxw== 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=vPmUZR37KVt48WYO+HoY6W2LnkjmmRglasnRjQn55o8=; b=xmEpAvV+sJE44MkKhB+khZY3rCk5XnQBP3rNybVb8DGwDoC1d3/CAE11vT0oDxChMu 6CozHEQmP+N6etKoIctierhbZekZV9OSfSsD7LZTNh/4bQD7n3D0xppcphBa5l4u3L3d 3USm2L5jhaR3cDiLuvED+88UyLO0Wa8v6hLnlWkiiYckjSPPEz6UYyAhrfERQB5ti3A9 swQWg3GjhmYN3ljJYXYsQpb7vZnIqBJrywFl2jDb79jUOUC1FTKKjuP1kzVO6pVF1KOh ZhMAFZwv4eS1GsleH1I+QBMzlAj4mkChQU4Kj76YuXR9gSuQu+w3z2V4Fd2P2NuMj+xs cuHw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=IbdR4liL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 j197-20020a636ece000000b004625c2dbc5csi28056310pgc.718.2022.10.22.02.27.30; Sat, 22 Oct 2022 02:27: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=IbdR4liL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S229728AbiJVJFv (ORCPT + 99 others); Sat, 22 Oct 2022 05:05:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55176 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235182AbiJVJD7 (ORCPT ); Sat, 22 Oct 2022 05:03: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 983142DCB14; Sat, 22 Oct 2022 01:19: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 dfw.source.kernel.org (Postfix) with ESMTPS id 6E54360B46; Sat, 22 Oct 2022 07:52:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7F278C433D6; Sat, 22 Oct 2022 07:52:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425131; bh=2YJw/yBjlgev6diveFfBgF/728Fx9jneejbWKbbzwbE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IbdR4liLH00bcVwx/JynChDwrr4CJn7r5tbbj2Z1Z+tTWwcyWIZMjbm0A0fWfcRv9 X4RF/BlthOOLZQ53PUAZrl/aFYTnd8M2/FTS7VrVtZq8jm24p1qmIgSlcW0rAsF2Bn HaD6MHLc8v1aaRAYzXWthw6lZjeVztOSn7ReonKA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?utf-8?b?Sm9zw6kgRXhww7NzaXRv?= , Ricardo Ribalda , Laurent Pinchart , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.19 401/717] media: uvcvideo: Fix memory leak in uvc_gpio_parse Date: Sat, 22 Oct 2022 09:24:40 +0200 Message-Id: <20221022072515.606512137@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747379408259403047?= X-GMAIL-MSGID: =?utf-8?q?1747379408259403047?= From: José Expósito [ Upstream commit f0f078457f18f10696888f8d0e6aba9deb9cde92 ] Previously the unit buffer was allocated before checking the IRQ for privacy GPIO. In case of error, the unit buffer was leaked. Allocate the unit buffer after the IRQ to avoid it. Addresses-Coverity-ID: 1474639 ("Resource leak") Fixes: 2886477ff987 ("media: uvcvideo: Implement UVC_EXT_GPIO_UNIT") Signed-off-by: José Expósito Reviewed-by: Ricardo Ribalda Signed-off-by: Laurent Pinchart Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin --- drivers/media/usb/uvc/uvc_driver.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/media/usb/uvc/uvc_driver.c b/drivers/media/usb/uvc/uvc_driver.c index 6c86faecbea2..28ee45e879ff 100644 --- a/drivers/media/usb/uvc/uvc_driver.c +++ b/drivers/media/usb/uvc/uvc_driver.c @@ -1538,10 +1538,6 @@ static int uvc_gpio_parse(struct uvc_device *dev) if (IS_ERR_OR_NULL(gpio_privacy)) return PTR_ERR_OR_ZERO(gpio_privacy); - unit = uvc_alloc_entity(UVC_EXT_GPIO_UNIT, UVC_EXT_GPIO_UNIT_ID, 0, 1); - if (!unit) - return -ENOMEM; - irq = gpiod_to_irq(gpio_privacy); if (irq < 0) { if (irq != EPROBE_DEFER) @@ -1550,6 +1546,10 @@ static int uvc_gpio_parse(struct uvc_device *dev) return irq; } + unit = uvc_alloc_entity(UVC_EXT_GPIO_UNIT, UVC_EXT_GPIO_UNIT_ID, 0, 1); + if (!unit) + return -ENOMEM; + unit->gpio.gpio_privacy = gpio_privacy; unit->gpio.irq = irq; unit->gpio.bControlSize = 1; From patchwork Sat Oct 22 07:24: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: 7436 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1098286wrr; Sat, 22 Oct 2022 01:10:19 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7F85v0C1xx3P8HBtQexIrcYSmNUXR1O8XnVjI/RWjOfpYN+cLIPgT5CpoDIJoJsyU1ujPA X-Received: by 2002:a17:902:848c:b0:17a:b4c0:a02b with SMTP id c12-20020a170902848c00b0017ab4c0a02bmr22988519plo.122.1666426218800; Sat, 22 Oct 2022 01:10:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666426218; cv=none; d=google.com; s=arc-20160816; b=WiOz4aoXpKCNZrHxZ9yXWhPLz5Jq0EZkjFDQ5AN7g1+YVaRb1c9sIJ2q74cx+Axif1 e9YfnEWIcOW1ulRp/qM/fCvdn7w3BmNQ31TT5A7N6aWv3LANOJ2ENNONLeH7x9BiF418 4y9aOpbxFmkvGZpfuz5wXyM1OY1cMsgxW7RjId59CAxocxi75lz0ayxjkLu3jSsYNW0o CsD4lG9QAlx2lH8bWXsEXIEDcLK/si9tHb3Lgq4den4alKR5WD50DVntm2VCU5pgggBq 6jpvBLz/xOTwuWdcHQpiX1LGh5R9vBpNu58srdCzaKxx5n+LmzMgaKEiPyHoTqiqNzqN g8Ag== 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=MzFprXzDYl9W6M4ZmHYRuAQ1Yx9NW9ndfIBlAv0LdlE=; b=YP4747l1BtfUfRint6KlOXvepib5rAXDMWTjjkwcOCEhn1gUnUe6k3ymmf/TOCoWn7 E0xMd4zzssdUqFynEL+xE//0DA/dm4zSQEYGNaDFkl//41iHNFcX3Gcg5VgY6h5/9ify SrjnorJffi3uRCKfOOqjZ7aTcoiUmZIwuL0pSstsiAGjwftX/yrlqvHhJu3xbeTMfs7T S0ZnazhqiA8lOZv4cJg9Q88XmxYHSc7k1cSVhPHioh+498wvFnfMtEcsnq6H7ZPhrrH1 K36ZLm8cpy+C0QXdb1AnUggK3vN2z813+uS0GG9ep+1U3RypI6r2qu4mnfz408BBRvk3 WKsw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=jPJB6in5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 p4-20020a170902ebc400b00178627f172csi4490461plg.348.2022.10.22.01.10.05; Sat, 22 Oct 2022 01:10: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=jPJB6in5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S232948AbiJVIIw (ORCPT + 99 others); Sat, 22 Oct 2022 04:08:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60038 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233049AbiJVIEq (ORCPT ); Sat, 22 Oct 2022 04:04:46 -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 1D7A72C4CAF; Sat, 22 Oct 2022 00:52: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 213D160B6B; Sat, 22 Oct 2022 07:52:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 38774C433C1; Sat, 22 Oct 2022 07:52:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425134; bh=PsFauO4JCKT7a/SR3XyCwaQSaNErUbHMqu5GtQzlL6k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jPJB6in5mfF9bmxMwp1WZRJb0PqdrSi1NTVGtdS1SurFueqrEbPiCIUfq22yKfcND 5qgStE1yEf9UQF+kIYJzdcEnF2BqPQ5pbYOgbhLKK51R9eKz4tlWg+8x631yWX6gWl Be1ysSfJUbJIXAbe4u5Rrqd/kjWNrtlZpbiEGvsE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Yunke Cao , Ricardo Ribalda , Laurent Pinchart , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.19 402/717] media: uvcvideo: Use entity get_cur in uvc_ctrl_set Date: Sat, 22 Oct 2022 09:24:41 +0200 Message-Id: <20221022072515.662032461@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747374538751928509?= X-GMAIL-MSGID: =?utf-8?q?1747374538751928509?= From: Yunke Cao [ Upstream commit 5f36851c36b30f713f588ed2b60aa7b4512e2c76 ] Entity controls should get_cur using an entity-defined function instead of via a query. Fix this in uvc_ctrl_set. Fixes: 65900c581d01 ("media: uvcvideo: Allow entity-defined get_info and get_cur") Signed-off-by: Yunke Cao Reviewed-by: Ricardo Ribalda Signed-off-by: Laurent Pinchart Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin --- drivers/media/usb/uvc/uvc_ctrl.c | 83 ++++++++++++++++++-------------- 1 file changed, 46 insertions(+), 37 deletions(-) diff --git a/drivers/media/usb/uvc/uvc_ctrl.c b/drivers/media/usb/uvc/uvc_ctrl.c index 0e78233fc8a0..44071040d764 100644 --- a/drivers/media/usb/uvc/uvc_ctrl.c +++ b/drivers/media/usb/uvc/uvc_ctrl.c @@ -963,36 +963,56 @@ static s32 __uvc_ctrl_get_value(struct uvc_control_mapping *mapping, return value; } -static int __uvc_ctrl_get(struct uvc_video_chain *chain, - struct uvc_control *ctrl, struct uvc_control_mapping *mapping, - s32 *value) +static int __uvc_ctrl_load_cur(struct uvc_video_chain *chain, + struct uvc_control *ctrl) { + u8 *data; int ret; - if ((ctrl->info.flags & UVC_CTRL_FLAG_GET_CUR) == 0) - return -EACCES; + if (ctrl->loaded) + return 0; - if (!ctrl->loaded) { - if (ctrl->entity->get_cur) { - ret = ctrl->entity->get_cur(chain->dev, - ctrl->entity, - ctrl->info.selector, - uvc_ctrl_data(ctrl, UVC_CTRL_DATA_CURRENT), - ctrl->info.size); - } else { - ret = uvc_query_ctrl(chain->dev, UVC_GET_CUR, - ctrl->entity->id, - chain->dev->intfnum, - ctrl->info.selector, - uvc_ctrl_data(ctrl, UVC_CTRL_DATA_CURRENT), - ctrl->info.size); - } - if (ret < 0) - return ret; + data = uvc_ctrl_data(ctrl, UVC_CTRL_DATA_CURRENT); + if ((ctrl->info.flags & UVC_CTRL_FLAG_GET_CUR) == 0) { + memset(data, 0, ctrl->info.size); ctrl->loaded = 1; + + return 0; } + if (ctrl->entity->get_cur) + ret = ctrl->entity->get_cur(chain->dev, ctrl->entity, + ctrl->info.selector, data, + ctrl->info.size); + else + ret = uvc_query_ctrl(chain->dev, UVC_GET_CUR, + ctrl->entity->id, chain->dev->intfnum, + ctrl->info.selector, data, + ctrl->info.size); + + if (ret < 0) + return ret; + + ctrl->loaded = 1; + + return ret; +} + +static int __uvc_ctrl_get(struct uvc_video_chain *chain, + struct uvc_control *ctrl, + struct uvc_control_mapping *mapping, + s32 *value) +{ + int ret; + + if ((ctrl->info.flags & UVC_CTRL_FLAG_GET_CUR) == 0) + return -EACCES; + + ret = __uvc_ctrl_load_cur(chain, ctrl); + if (ret < 0) + return ret; + *value = __uvc_ctrl_get_value(mapping, uvc_ctrl_data(ctrl, UVC_CTRL_DATA_CURRENT)); @@ -1783,21 +1803,10 @@ int uvc_ctrl_set(struct uvc_fh *handle, * needs to be loaded from the device to perform the read-modify-write * operation. */ - if (!ctrl->loaded && (ctrl->info.size * 8) != mapping->size) { - if ((ctrl->info.flags & UVC_CTRL_FLAG_GET_CUR) == 0) { - memset(uvc_ctrl_data(ctrl, UVC_CTRL_DATA_CURRENT), - 0, ctrl->info.size); - } else { - ret = uvc_query_ctrl(chain->dev, UVC_GET_CUR, - ctrl->entity->id, chain->dev->intfnum, - ctrl->info.selector, - uvc_ctrl_data(ctrl, UVC_CTRL_DATA_CURRENT), - ctrl->info.size); - if (ret < 0) - return ret; - } - - ctrl->loaded = 1; + if ((ctrl->info.size * 8) != mapping->size) { + ret = __uvc_ctrl_load_cur(chain, ctrl); + if (ret < 0) + return ret; } /* Backup the current value in case we need to rollback later. */ From patchwork Sat Oct 22 07:24: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: 7449 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1098441wrr; Sat, 22 Oct 2022 01:10:50 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5ukORCnIebGZzb9Xp8SOD0e0ay7Qygy0NZw8TXpV3zFOjMQ6WIHnTKUVPiMntvP78lJyFZ X-Received: by 2002:a65:464b:0:b0:42c:b0:9643 with SMTP id k11-20020a65464b000000b0042c00b09643mr20136859pgr.232.1666426250243; Sat, 22 Oct 2022 01:10:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666426250; cv=none; d=google.com; s=arc-20160816; b=wm7BuR8V44r85VEXIipoH8PWRqXx0rcMsqcuQD+hstlUTPpowLLLyljPE1KaS/z8SH ATzoIZ3GwcmvW1PTTxKed5fjkesjcQd9yCz/4r5h3wvDRcROy7p3hovj5IM6X7WOtq0Q CFutSPGuZK2civYt4f20Cw/DB1xXqN4N6CmVQY4coBtWfumcQEbA8fyMO2cLdXyB0hZW pfDG99N5/wR2CTt8lfs4GUcKtjOEE70OEc/UmAIJcUOB0JlzqReCoLQtpQr6zyX63fTS nf3LUxZ4PffEEgPp2ZiGZ2FxH7qHmv2931z59G3n/iKxi67ynVNb4SueZWqVP1H6OG9p pDxA== 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=HVcroQFYgJ+KygxA544ve0GUT+uG9RQyqVeEvFJfVhE=; b=Vg/dR2rKvf6KC0L0skIrULYJnhKK/k1x3TmaKfptjm2dmJ3Ssi20A4IS7V161328j4 0NYJUFHauOo4Aadu1sKT9BmGINVpX08eit1dQOxe3QLdS2mxlV0yqv140yW0NRYT0ugJ AKEbyF/k++jgh+D3s/qnr+48/KmfW87OLFHfPP1/NGqukuHBXO6VOsRfOiPULp9/fEhC QvKpOPFdWfhKb5HfEEBJhv76g9akq77wKnyCp60FQNQEIxwY73xjJSyG/yUF9Ow+rKBa 4S8wD6Z/dfrPz1FgAyMUad/uHM8aA7sbAzTS8/kIRDA8rkPu7QGA06kNAcg1KCeTYwJ+ GCdA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=j07urjt1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 m18-20020a056a00081200b00565de49c28esi30478543pfk.57.2022.10.22.01.10.37; Sat, 22 Oct 2022 01:10: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=j07urjt1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S233429AbiJVIJu (ORCPT + 99 others); Sat, 22 Oct 2022 04:09:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35454 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232537AbiJVIFV (ORCPT ); Sat, 22 Oct 2022 04:05:21 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 70E152C6E0D; Sat, 22 Oct 2022 00:52: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 757BAB82D9F; Sat, 22 Oct 2022 07:52:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E7A78C433D6; Sat, 22 Oct 2022 07:52:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425137; bh=nmvG3vBy2Gnd/UxyKgj0D3lIpS0zVnyNZ2NZnicV560=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=j07urjt1Ot1jNuQnTZ6vY+AMuNmZKB1a66DGG2Bp0vm2h+ShN6yO/we6k6QVyXYdE AYrL/k8vpeqWJUUtO5A/sUZWHBnrJUafqlE9Advjsk7jrn+apq5+PDbJZQbl5/7DYp uJqIi7fseLSKrziH2g0qYHSJDuzctpFJeJshhy5s= 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 5.19 403/717] media: xilinx: vipp: Fix refcount leak in xvip_graph_dma_init Date: Sat, 22 Oct 2022 09:24:42 +0200 Message-Id: <20221022072515.722008557@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747374571489429931?= X-GMAIL-MSGID: =?utf-8?q?1747374571489429931?= 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 f34f8b077e03..0a16c218a50a 100644 --- a/drivers/media/platform/xilinx/xilinx-vipp.c +++ b/drivers/media/platform/xilinx/xilinx-vipp.c @@ -471,7 +471,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) { @@ -481,13 +481,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 Sat Oct 22 07:24: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: 7450 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1098484wrr; Sat, 22 Oct 2022 01:10:59 -0700 (PDT) X-Google-Smtp-Source: AMsMyM65LSiTuGn6aYN27TSkt5dPUUQ+FphpjE+/dvvgmSX3s1hgQfY6YBtleON/2niE7m6TGu7s X-Received: by 2002:a17:903:1110:b0:178:9f67:b543 with SMTP id n16-20020a170903111000b001789f67b543mr23021345plh.131.1666426259091; Sat, 22 Oct 2022 01:10:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666426259; cv=none; d=google.com; s=arc-20160816; b=eDFLRvfXMNveruAjrOVvhV/ag7whKoNxm/c9NULtynXyYZDHg+gbrEgLDaBVp8xmQn XQBM4s6D6DuqLDMJ345gJ2CCuu2N5v+jU7iB6wlB1BPNoi5mxPAuUpaD7/w6PiIl3LOs AHAut1n2a52jCVEakCDQ9osrdcxKDwZQCJvQmkLxBjGGrE0Am2vBH58XGYOxF8WsxTEP CPVbQiTjaWkCgK+q8B2NCr0vpfKpGaB43u1DLfcax3hCKSNR5ZfGoEr8ZsMR2IAM7Jy6 MmXtQthZj2XKSujtijPQXp6xHmCwNW/6EW+/+2TkfFvIQGbUfXXcf82DCrfLdtBLwQk0 GqoQ== 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=MHOZcZ+/nSkBk0GaA9CqWCnOOrJFKrGLMdhAcImCEtc=; b=mtiaM4R1EyGv8KkcI7UnGdKJgbrwJNbC7nt6k5eLN9UrhFNV4oAu8lTojz9kgEPiiH GKT5cwUeqZTf1H2FPd1JeVG7EYQn2L46U9nyNBcQG25l3AoV1rtSRqnexSUNwSbWv9Mx XZHqrc2nGa+OjMwmAlB9ctKTfNzZwrkjvwNfdZM94BV3ijxVt+wzK9zhFCeDg/VlGhY3 Om41AyK207y4TIhzH5GF29WGFQE2EE8itEq5oNQH9wQTBe0ROKol5PuS0/pcBv9ZMUYh It0W4gLz21Lu7ibhZT9RzLYVQQ+/WgyDG1vRI7niLhfsTpc8glMjL3/YxRNd3yrvMj3F BaKA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Jgf2xstF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 l27-20020a63ba5b000000b00434b19dc958si1648957pgu.349.2022.10.22.01.10.45; Sat, 22 Oct 2022 01:10: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=Jgf2xstF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S233463AbiJVIJx (ORCPT + 99 others); Sat, 22 Oct 2022 04:09:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37136 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232629AbiJVIFf (ORCPT ); Sat, 22 Oct 2022 04:05: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 D936F2C6E1E; Sat, 22 Oct 2022 00:52: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 A58BAB82E07; Sat, 22 Oct 2022 07:52:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F33ECC43140; Sat, 22 Oct 2022 07:52:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425140; bh=AaZSzvYv1XZWsFuV8C2YDIeqSY8bFZR2WRCjfZv866Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Jgf2xstFq8DdLz5BsW9nEnU0v4PnDS0AO0Vv4pHbTWuPMsiirSL7oW4+zR8LYa+2+ xhatT/G52Owl11qQA4REiDDe/QGHBLW3UhNOIgyAIiud2k8Y9gnMcCscJc3yKjyjoh 1Zwjp79BRo2oAg8dqGGj4/gz+/Mw+JtCeZp3sAbc= 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 5.19 404/717] RDMA/rxe: Fix "kernel NULL pointer dereference" error Date: Sat, 22 Oct 2022 09:24:43 +0200 Message-Id: <20221022072515.791526756@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747374580914638633?= X-GMAIL-MSGID: =?utf-8?q?1747374580914638633?= 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 fd706dc3009d..173a4253406b 100644 --- a/drivers/infiniband/sw/rxe/rxe_qp.c +++ b/drivers/infiniband/sw/rxe/rxe_qp.c @@ -794,7 +794,9 @@ static void rxe_qp_do_cleanup(struct work_struct *work) 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 Sat Oct 22 07:24: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: 7452 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1098538wrr; Sat, 22 Oct 2022 01:11:10 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5kf97DAFbrOLQl7ucRSGzfAihWsKafF2Sfp3rMfQ7ql/ZN4hw4PYhgAyP62WKCEWSVx308 X-Received: by 2002:a63:985:0:b0:46e:e3b7:65ca with SMTP id 127-20020a630985000000b0046ee3b765camr501878pgj.331.1666426270216; Sat, 22 Oct 2022 01:11:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666426270; cv=none; d=google.com; s=arc-20160816; b=qDkvM/R0EwPinVgTHNZQtwgkonh2XdeAbmEZnrNqdYQ/nF38vUM3L7hATc5D4JypcM e/hGyz4jQHx0f39O04XU3Q7fiogjlS/OfWI8iEL5QaZ9D0yyXBXLpLGkaozHTxMTXyVA KVIkYUo/VZAjBrB+aKI+GagDrQs9LXAtk5Q6JLPCa3syzUpSWALI9WJm1L74jPba3Hge ktLVIjdZQdKiA92Y7i42GORSXeSJ0g0+/uhd/bNsi/8cs546IUbSfo1DemqALfSAE/4l I+Cuaj2iWTO3TMbDCa4UCRKY3b+x1ExpIANBcFJVjUCO9YE6aDmxwmsrylXo9CUZG2xO aeQA== 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=Jo4LxztqhG3TGDeH/XBSdrhsmlnRSRXyUgIbFDGUZjo=; b=NuQRoVX1VyDX3fxHNiw57/s54DmFnwPD7+YX61tvmQIacVzt4Gp4SZkr26TgO4R+qC Ae6bjw7xuRjwmK3oevEdg7oqNNqHJgA0QIC94dT3iaX8ZvdPFrjxwqcbSM8P9m/jpR1Z b6d/15X70CujL3SuGnQCC42+53yeY39KNmu3jfZYAjXHG7WrcEIs99tqUqMC4KbcXaf6 T8F2zjx8Q+ZhVZBsReW+8YrHVupXYa2aHSsZaFo8WR7tXa6gfFMBxPX90+PierWaO+Cu hpFlxXgejLOwi4KTJ7ocR2iT7msNNEW3KGKSJX2xburLxz+z04431bNIkZkM7S/M0AXJ IR0g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=n3jgRCkX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 e4-20020a170902b78400b0017f7de32cc2si25634977pls.129.2022.10.22.01.10.54; Sat, 22 Oct 2022 01:11: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=n3jgRCkX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S233502AbiJVIKD (ORCPT + 99 others); Sat, 22 Oct 2022 04:10:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60218 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232791AbiJVIGC (ORCPT ); Sat, 22 Oct 2022 04:06:02 -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 E01812C6E3F; Sat, 22 Oct 2022 00:52: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 A4C39B82DFD; Sat, 22 Oct 2022 07:52:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CAD40C433C1; Sat, 22 Oct 2022 07:52:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425143; bh=3R8E4rVNPKIXYCymFwwbRF9R67xBhTsT1o8q8+WQvN4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=n3jgRCkXrqdR1QaEUPm9cXZxG13J/pF3Fx5F75ph581ly2CV6srx6vXMOaptXDgra qQ2G9jn0t9hyF6q0Ci4j6OzFr3k00lUUSq4MtBBOlT29yfD4LZEcDf/enH9UZkL7zw AWMIYs/UOamtZNoWtMh2mHgUzhev7L5/SMlxZGD0= 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 5.19 405/717] RDMA/rxe: Fix the error caused by qp->sk Date: Sat, 22 Oct 2022 09:24:44 +0200 Message-Id: <20221022072515.868172641@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747374592619990148?= X-GMAIL-MSGID: =?utf-8?q?1747374592619990148?= 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 173a4253406b..3df2db893dd3 100644 --- a/drivers/infiniband/sw/rxe/rxe_qp.c +++ b/drivers/infiniband/sw/rxe/rxe_qp.c @@ -832,8 +832,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 Sat Oct 22 07:24:45 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 7439 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1098289wrr; Sat, 22 Oct 2022 01:10:19 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7HliEUFq9ejMMKv7OkuS8YMu/ge8IffqMqN8VWNUm4rnZr+7oJOIHsh7gtg9TFXm3TaMZD X-Received: by 2002:a63:d145:0:b0:443:c25f:5dd5 with SMTP id c5-20020a63d145000000b00443c25f5dd5mr19621502pgj.554.1666426219290; Sat, 22 Oct 2022 01:10:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666426219; cv=none; d=google.com; s=arc-20160816; b=vOZ8L4i4s29IUF99V6CECAG44IYQt2xmGSH4tCrrS60mNulmclHMVI7KlP3w46J8Ut v7FOJJvcCDVokMhdn6ABL+GuQZuJCiXUuABg8eUQTrsBhcN6iZ9S3WdMsXx/y+m2djeo jAL8qviqsjqXpLrag3TOGt1DkStFEJS73dJXotTA5Dnk/SamMolkmGbw892AYGdFRLNA aOFVTvMBk8+HWbybYB1LT4rQ0AZLRRzfkNdVydoBRcEjM+fokUmZfrWmVoLv0SGo9VXV KtZRfUgU5aMElNwC8kLZPkAHVQf0N8+vHFZs2fk6lRlxoQZYwipBcmX+3P58iSKzkmcb +tsA== 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=1do91zy/QwzyjNEui/ffbNraRH1cttQQJW7EHx/Phmw=; b=xV/rOszxlcbb+COHG6RG29YTDpHHC8YQUe4Hx4gef5uu63HBLAt8I4GGjjSIyrvuBm P3rnPnJV3MnWrc6Jr/jiFz69zCTY+BFTK5SQNqOIPE2ouge7iNTVWULRk+w4dehwz6QC blZwc2k7UqHycQEm2enAA2qbJhODJC73zXj90MUaOc7jtlaBGJ2IQw7GxBTSJJbkVerY NUu6v5M2PNlbZQyKK6Vky+4Tp44aTgbE6w/O7xGMXUiRnQoJi35Vya97cmzWpm1yfWLS tjVZja8XuEp9i5JQ/KHtCDIX9qtkJJ7EhKKFqPWJi6MLckTRL8JQzMeZuN9h9FBlT681 yitg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=LhQY8T0T; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 s15-20020a056a00178f00b00536ee478380si31310773pfg.7.2022.10.22.01.10.06; Sat, 22 Oct 2022 01:10: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=LhQY8T0T; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S233205AbiJVIJP (ORCPT + 99 others); Sat, 22 Oct 2022 04:09:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57474 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233126AbiJVIEz (ORCPT ); Sat, 22 Oct 2022 04:04:55 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 208B72D447B; Sat, 22 Oct 2022 00:52: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 C564F60AC3; Sat, 22 Oct 2022 07:52:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C9E8DC433C1; Sat, 22 Oct 2022 07:52:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425146; bh=WowgQztTNsEsUrr75qTilpPvrPbPyfSJgZpDw7HExZI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LhQY8T0TeNEYLikFWkwFRNsVpN0C02hbgXGw/Cd7xKNZzSs7YuNG0BM4/MmXA1Xdu +xWvor2MzwHZ8p23P2hp2uDVQfl9vi2ZBgue3CTL3O8hAfT46e7ucWWrVFdZUTb4PR qgaJrLDJSA9XaEGgbEoPx2mSF0/esLyXwDJ4X6xI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, AngeloGioacchino Del Regno , Bo-Chen Chen , " =?utf-8?q?N=C3=ADcolas_F_=2E__R_?= =?utf-8?q?=2E__A_=2E__Prado?= " , Stephen Boyd , Sasha Levin Subject: [PATCH 5.19 406/717] clk: mediatek: clk-mt8195-vdo0: Set rate on vdo0_dp_intf0_dp_intfs parent Date: Sat, 22 Oct 2022 09:24:45 +0200 Message-Id: <20221022072515.937196337@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 required=5.0 tests=BAD_ENC_HEADER,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?1747374539036181474?= X-GMAIL-MSGID: =?utf-8?q?1747374539036181474?= From: AngeloGioacchino Del Regno [ Upstream commit 3f0dadd230cc2630202a977fe52cd1dd7a7579a7 ] Add the CLK_SET_RATE_PARENT flag to the CLK_VDO0_DP_INTF0_DP_INTF clock: this is required to trigger clock source selection on CLK_TOP_EDP, while avoiding to manage the enablement of the former separately from the latter in the displayport driver. Fixes: 70282c90d4a2 ("clk: mediatek: Add MT8195 vdosys0 clock support") Signed-off-by: AngeloGioacchino Del Regno Tested-by: Bo-Chen Chen Reviewed-by: Bo-Chen Chen Signed-off-by: Nícolas F. R. A. Prado Link: https://lore.kernel.org/r/20220816193257.658487-2-nfraprado@collabora.com Signed-off-by: Stephen Boyd Signed-off-by: Sasha Levin --- drivers/clk/mediatek/clk-mt8195-vdo0.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/clk/mediatek/clk-mt8195-vdo0.c b/drivers/clk/mediatek/clk-mt8195-vdo0.c index 261a7f76dd3c..07b46bfd5040 100644 --- a/drivers/clk/mediatek/clk-mt8195-vdo0.c +++ b/drivers/clk/mediatek/clk-mt8195-vdo0.c @@ -37,6 +37,10 @@ static const struct mtk_gate_regs vdo0_2_cg_regs = { #define GATE_VDO0_2(_id, _name, _parent, _shift) \ GATE_MTK(_id, _name, _parent, &vdo0_2_cg_regs, _shift, &mtk_clk_gate_ops_setclr) +#define GATE_VDO0_2_FLAGS(_id, _name, _parent, _shift, _flags) \ + GATE_MTK_FLAGS(_id, _name, _parent, &vdo0_2_cg_regs, _shift, \ + &mtk_clk_gate_ops_setclr, _flags) + static const struct mtk_gate vdo0_clks[] = { /* VDO0_0 */ GATE_VDO0_0(CLK_VDO0_DISP_OVL0, "vdo0_disp_ovl0", "top_vpp", 0), @@ -85,7 +89,8 @@ static const struct mtk_gate vdo0_clks[] = { /* VDO0_2 */ GATE_VDO0_2(CLK_VDO0_DSI0_DSI, "vdo0_dsi0_dsi", "top_dsi_occ", 0), GATE_VDO0_2(CLK_VDO0_DSI1_DSI, "vdo0_dsi1_dsi", "top_dsi_occ", 8), - GATE_VDO0_2(CLK_VDO0_DP_INTF0_DP_INTF, "vdo0_dp_intf0_dp_intf", "top_edp", 16), + GATE_VDO0_2_FLAGS(CLK_VDO0_DP_INTF0_DP_INTF, "vdo0_dp_intf0_dp_intf", + "top_edp", 16, CLK_SET_RATE_PARENT), }; static int clk_mt8195_vdo0_probe(struct platform_device *pdev) From patchwork Sat Oct 22 07:24:46 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 7764 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1120971wrr; Sat, 22 Oct 2022 02:27:03 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5//ECiwAF7vC2DtbrWlzT0wkyE5uPJBrydbHZ4dweSGYHlGBd0qjwLcfOApl6GYoAOWGFL X-Received: by 2002:a17:90b:4f87:b0:212:effe:bdd7 with SMTP id qe7-20020a17090b4f8700b00212effebdd7mr174383pjb.66.1666430823683; Sat, 22 Oct 2022 02:27:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666430823; cv=none; d=google.com; s=arc-20160816; b=K8PpPhyvn/lqFmyQ6BB82dFOW70TsRf8WPDto3a1BijdKsEtOr7QfNA86g4tlqTo55 pFM7iitZa7uPYxsTseMU07alIH6x10tqLXs1anFzcgURQKO6zrSiYdi5vdjFH7qAOS+J weyoy2Yo8jZSDbsel8t44hcTXdRbsZ6htGwddNwp3KLuHBpD1Y6uadtJBT6avwIUos8y NGXyqPslEKAjlcNAkDmim0ByEHa+ck/rdgMLC1pPBQPVsPoPoIKo+joTAB40/JQkqJzC VW3IALzpAqeqAuoJDGuXPjkLhZRK4cfGjIEQcFeM8nLur/z2o51TdFwxIHHAT4QAXn47 bOXA== 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=xcaWfqNDmOVLdeVF2tK6bZOHJBJmspAALR/QGSsfSLk=; b=XT9hSy6pI/TfrymglyD+IwuA3sCGuOi6n0szhFyp9Z8iumrbv9a+XDjr/aHhwdD0m6 m4G7VFUU2GxqsTfG0j3PZIS7AK0SazMaXgxmCzM/i/sidtQ32FJxFRDomEvPhfq2Za0X 5w6MzSlUgLeqjFcDcjN+nMrmUtFCJ3IEJYJ6EgHYu87yYQQQX12y8f8hJi7kiz7u1y9q d9J1qdgodPxDqDJX6GrOQ9DdGpPPOue868izT4BZd/5p3ta6hOSPPOqMHfvBo14Jv6l4 r8aPxq+oLoKrZI/LXlNQetrtWe5UfgdSNT+elFo0IqZZ/c4XKO94MAn4tuusi863ffOK gnxQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=CCUDfcxJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 u20-20020a63b554000000b0046ec7b397e1si4024763pgo.759.2022.10.22.02.26.50; Sat, 22 Oct 2022 02:27: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=CCUDfcxJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231584AbiJVJEZ (ORCPT + 99 others); Sat, 22 Oct 2022 05:04:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36940 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235021AbiJVJDT (ORCPT ); Sat, 22 Oct 2022 05:03:19 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E5D052FACD1; Sat, 22 Oct 2022 01:18: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 001A960B27; Sat, 22 Oct 2022 07:52:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CA873C433D6; Sat, 22 Oct 2022 07:52:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425149; bh=V8S7SxBGkVwHx+dCHsBMJlF/8c04H0jASveOhijYiOU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CCUDfcxJSUQhf4D9cMTOoOGjRNPmPIqYLUxQJPRyfQlrpePI/fb8KUaZ+d63c5kRk aTcMuQZACZyOchXc1kmXXH+AD/3/bB/4r3FbM5Dz5uJVT6RW+0amPid2huOL2QUlUL vvi40sSzunW7aIJahqMrEnKJPj9c6Ldsj1sN0Oyc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, AngeloGioacchino Del Regno , Bo-Chen Chen , " =?utf-8?q?N=C3=ADcolas_F_=2E__R_?= =?utf-8?q?=2E__A_=2E__Prado?= " , Stephen Boyd , Sasha Levin Subject: [PATCH 5.19 407/717] clk: mediatek: clk-mt8195-vdo1: Reparent and set rate on vdo1_dpintfs parent Date: Sat, 22 Oct 2022 09:24:46 +0200 Message-Id: <20221022072516.020571043@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 required=5.0 tests=BAD_ENC_HEADER,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?1747379367310866543?= X-GMAIL-MSGID: =?utf-8?q?1747379367310866543?= From: AngeloGioacchino Del Regno [ Upstream commit f24d71feb206631116ff9adaa6d43650c5dd8849 ] Like it was done for the vdo0_dp_intf0_dp_intf clock (used for eDP), add the CLK_SET_RATE_PARENT flag to CLK_VDO1_DPINTF (used for DP) and also fix its parent clock name as it has to be "top_dp" for two reasons: - This is its real parent! - Likewise to eDP/VDO0 counterpart, we need clock source selection on CLK_TOP_DP. Fixes: 269987505ba9 ("clk: mediatek: Add MT8195 vdosys1 clock support") Signed-off-by: AngeloGioacchino Del Regno Tested-by: Bo-Chen Chen Reviewed-by: Bo-Chen Chen Signed-off-by: Nícolas F. R. A. Prado Link: https://lore.kernel.org/r/20220816193257.658487-3-nfraprado@collabora.com Signed-off-by: Stephen Boyd Signed-off-by: Sasha Levin --- drivers/clk/mediatek/clk-mt8195-vdo1.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/clk/mediatek/clk-mt8195-vdo1.c b/drivers/clk/mediatek/clk-mt8195-vdo1.c index 3378487d2c90..d54d7726d186 100644 --- a/drivers/clk/mediatek/clk-mt8195-vdo1.c +++ b/drivers/clk/mediatek/clk-mt8195-vdo1.c @@ -43,6 +43,10 @@ static const struct mtk_gate_regs vdo1_3_cg_regs = { #define GATE_VDO1_2(_id, _name, _parent, _shift) \ GATE_MTK(_id, _name, _parent, &vdo1_2_cg_regs, _shift, &mtk_clk_gate_ops_setclr) +#define GATE_VDO1_2_FLAGS(_id, _name, _parent, _shift, _flags) \ + GATE_MTK_FLAGS(_id, _name, _parent, &vdo1_2_cg_regs, _shift, \ + &mtk_clk_gate_ops_setclr, _flags) + #define GATE_VDO1_3(_id, _name, _parent, _shift) \ GATE_MTK(_id, _name, _parent, &vdo1_3_cg_regs, _shift, &mtk_clk_gate_ops_setclr) @@ -99,7 +103,7 @@ static const struct mtk_gate vdo1_clks[] = { GATE_VDO1_2(CLK_VDO1_DISP_MONITOR_DPI0, "vdo1_disp_monitor_dpi0", "top_vpp", 1), GATE_VDO1_2(CLK_VDO1_DPI1, "vdo1_dpi1", "top_vpp", 8), GATE_VDO1_2(CLK_VDO1_DISP_MONITOR_DPI1, "vdo1_disp_monitor_dpi1", "top_vpp", 9), - GATE_VDO1_2(CLK_VDO1_DPINTF, "vdo1_dpintf", "top_vpp", 16), + GATE_VDO1_2_FLAGS(CLK_VDO1_DPINTF, "vdo1_dpintf", "top_dp", 16, CLK_SET_RATE_PARENT), GATE_VDO1_2(CLK_VDO1_DISP_MONITOR_DPINTF, "vdo1_disp_monitor_dpintf", "top_vpp", 17), /* VDO1_3 */ GATE_VDO1_3(CLK_VDO1_26M_SLOW, "vdo1_26m_slow", "clk26m", 8), From patchwork Sat Oct 22 07:24: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: 7448 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1098426wrr; Sat, 22 Oct 2022 01:10:47 -0700 (PDT) X-Google-Smtp-Source: AMsMyM66BHqxeeia+3jECxCnXg6Y9dwzNq1NWaxDrwbLX91PoLJPxYqIRNOAICQuowCUqZ/cSIjG X-Received: by 2002:a17:902:d590:b0:185:4875:ae29 with SMTP id k16-20020a170902d59000b001854875ae29mr23544823plh.27.1666426247483; Sat, 22 Oct 2022 01:10:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666426247; cv=none; d=google.com; s=arc-20160816; b=trn/z8Df+OQK9OJbIlF5poxCxP0aa24F9jByBj7h081X0Opu2g1m+0hp7g8gFDcK46 TM4m3JvCFxx4yt7TXqOdykyCVJ0Y0EG8H7Lmo9lxxcQZhiLBmDLVupSVX/nlvb9C1HL8 xX9YkEg3yglQFtBOvXW2lP3N2f5iRKd03fEgnjnNj0PbMtjI46DUNqH23sd1OmV78ELq W5S5fz+l3wyYXMM3dOLy+fq4HlZTpvL4k6mDkohYT348h4LN4Jqr7eGjSQdVi1ivTeEw sNlpAq9tRlzq9fFRvR54i6JP+aNCDbckpLiMEp2usXimGiRUUuavD3951ezvw2aUKzmg g2ZQ== 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=YfWoGz1BEDhJZqZ6j3ppXnRls7Bhp87PQLfuRWZ9aGw=; b=BvBViT9olZXn8rzktfrpZhh2uMG3P8ouHTWVw39BLo5Ylv96XW8K5ltMY79FrPDh5R gb3eULoaOmO2BSg+utQ4dd3VMgymSxPCXoJ0Njh1ymo8phSxkc2ClVMUDIR1v8H/j+s1 8c4Vv7vDCrPRZ+kE9jvt3CR8z7XTzblQVhsdA/o8hFVH13ll2Qm9TF0wQBqYCm7PjJza SOwVwdLZGcQsvqRbi9i0Qy9+NGCS4fqrXjS8rcNFvleWVwHDoOkQ6CFF231jfwLxuPf/ ZIBtYHLYoWhNoB3qpSWM5eWtoNXh2av/atLb9TtDbl7Hp+v/eUjpNimOUaI1eACCp41h ILYQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=wNkC0wjw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 4-20020a630c44000000b0043980f3cf24si28912602pgm.296.2022.10.22.01.10.34; Sat, 22 Oct 2022 01:10: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=wNkC0wjw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S233389AbiJVIJo (ORCPT + 99 others); Sat, 22 Oct 2022 04:09:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35854 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232550AbiJVIFW (ORCPT ); Sat, 22 Oct 2022 04:05:22 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0B1002C6E8E; Sat, 22 Oct 2022 00:52: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 7C3BCB82DF2; Sat, 22 Oct 2022 07:52:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DBDC3C433D6; Sat, 22 Oct 2022 07:52:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425152; bh=sIvt6Q5ADMtSIQaGyIODco+c4upAoP+Lc8sLREVpzxM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wNkC0wjwAfvu6Bwrsr1YyLcYNkz8vwYdATxXIMDvNM/vtmQ8IIyfbmbfJnGlYiKVi U8162R8bXrDZ3ZBwKYCc1iDkDWjYjeTxE2efYh1hmrMW1LjC5RZkVqIV16aqjjQ/KU SrtuSP3mcrlxfilou1VDZgiK6BI0xXU71rH31bas= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, AngeloGioacchino Del Regno , Matthias Brugger , Stephen Boyd , Sasha Levin Subject: [PATCH 5.19 408/717] clk: mediatek: mt8195-infra_ao: Set pwrmcu clocks as critical Date: Sat, 22 Oct 2022 09:24:47 +0200 Message-Id: <20221022072516.092104126@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747374568588601289?= X-GMAIL-MSGID: =?utf-8?q?1747374568588601289?= From: AngeloGioacchino Del Regno [ Upstream commit 3f10f49cd9f8ab6471639d4ca2c6db9451121779 ] The pwrmcu is responsible for power management and idle states in SSPM: on older SoCs this was managed in Linux drivers like sspm/mcupm/eemgpu but, at least on MT8195, this functionality was transferred to the ATF firmware. For this reason, turning off the pwrmcu related clocks from the kernel will lead to unability to resume the platform after suspend and other currently unknown PM related side-effects. Set the PWRMCU and PWRMCU_BUS_H clocks as critical to prevent the kernel from turning them off, fixing the aforementioned issue. Fixes: e2edf59dec0b ("clk: mediatek: Add MT8195 infrastructure clock support") Signed-off-by: AngeloGioacchino Del Regno Link: https://lore.kernel.org/r/20220719093316.37253-1-angelogioacchino.delregno@collabora.com Reviewed-by: Matthias Brugger Signed-off-by: Stephen Boyd Signed-off-by: Sasha Levin --- drivers/clk/mediatek/clk-mt8195-infra_ao.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/drivers/clk/mediatek/clk-mt8195-infra_ao.c b/drivers/clk/mediatek/clk-mt8195-infra_ao.c index 8ebe3b9415c4..0faa876815e8 100644 --- a/drivers/clk/mediatek/clk-mt8195-infra_ao.c +++ b/drivers/clk/mediatek/clk-mt8195-infra_ao.c @@ -54,8 +54,12 @@ static const struct mtk_gate_regs infra_ao4_cg_regs = { #define GATE_INFRA_AO1(_id, _name, _parent, _shift) \ GATE_INFRA_AO1_FLAGS(_id, _name, _parent, _shift, 0) +#define GATE_INFRA_AO2_FLAGS(_id, _name, _parent, _shift, _flag) \ + GATE_MTK_FLAGS(_id, _name, _parent, &infra_ao2_cg_regs, _shift, \ + &mtk_clk_gate_ops_setclr, _flag) + #define GATE_INFRA_AO2(_id, _name, _parent, _shift) \ - GATE_MTK(_id, _name, _parent, &infra_ao2_cg_regs, _shift, &mtk_clk_gate_ops_setclr) + GATE_INFRA_AO2_FLAGS(_id, _name, _parent, _shift, 0) #define GATE_INFRA_AO3_FLAGS(_id, _name, _parent, _shift, _flag) \ GATE_MTK_FLAGS(_id, _name, _parent, &infra_ao3_cg_regs, _shift, \ @@ -135,8 +139,11 @@ static const struct mtk_gate infra_ao_clks[] = { GATE_INFRA_AO2(CLK_INFRA_AO_UNIPRO_SYS, "infra_ao_unipro_sys", "top_ufs", 11), GATE_INFRA_AO2(CLK_INFRA_AO_UNIPRO_TICK, "infra_ao_unipro_tick", "top_ufs_tick1us", 12), GATE_INFRA_AO2(CLK_INFRA_AO_UFS_MP_SAP_B, "infra_ao_ufs_mp_sap_b", "top_ufs_mp_sap_cfg", 13), - GATE_INFRA_AO2(CLK_INFRA_AO_PWRMCU, "infra_ao_pwrmcu", "top_pwrmcu", 15), - GATE_INFRA_AO2(CLK_INFRA_AO_PWRMCU_BUS_H, "infra_ao_pwrmcu_bus_h", "top_axi", 17), + /* pwrmcu is used by ATF for platform PM: clocks must never be disabled by the kernel */ + GATE_INFRA_AO2_FLAGS(CLK_INFRA_AO_PWRMCU, "infra_ao_pwrmcu", "top_pwrmcu", 15, + CLK_IS_CRITICAL), + GATE_INFRA_AO2_FLAGS(CLK_INFRA_AO_PWRMCU_BUS_H, "infra_ao_pwrmcu_bus_h", "top_axi", 17, + CLK_IS_CRITICAL), GATE_INFRA_AO2(CLK_INFRA_AO_APDMA_B, "infra_ao_apdma_b", "top_axi", 18), GATE_INFRA_AO2(CLK_INFRA_AO_SPI4, "infra_ao_spi4", "top_spi", 25), GATE_INFRA_AO2(CLK_INFRA_AO_SPI5, "infra_ao_spi5", "top_spi", 26), From patchwork Sat Oct 22 07:24: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: 7668 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1108182wrr; Sat, 22 Oct 2022 01:43:43 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4/yIZSrgPhBAxzV6Mk0e04OTZ5W4PFH61/1vV5U2H2XqDUMO6bmmmPO+YLZALw0MG+4S4R X-Received: by 2002:a17:907:70a:b0:750:bf91:caa3 with SMTP id xb10-20020a170907070a00b00750bf91caa3mr18723347ejb.711.1666428222906; Sat, 22 Oct 2022 01:43:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666428222; cv=none; d=google.com; s=arc-20160816; b=rKXVZjYymdqiEd2MfT7eHvckX8QK5+NZwkGcrq9tmAElHrYhZ9HTz+G0ruDqqy8ozO 8L8Ng+AYa601kTHSCdF1kBZ2zZYeD6G5PFZhG3SAo1NVsqpfVkR39oLOur0UraMP93xt wOB6crTfRTcLiMgSQWKGrx0ppMUPmONhQMtoG8gTcrm6KR4YjGLumWgtF6E22MtCMO99 g+HpGIVwOH7tL1fbjlNqwUEwkUDuVUInv2UA/QCz9KUCNK7YVu6nvi7JRYc5A2HhREhV sWLt3TUYvQ5QcZQ8mYgUkXU3bglCKezhLZDmqy4ot8aO9k48AHQSog/3WOn1X5ESZL6T DvBg== 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=0UOl1aiHxfbl5y0qLe8snXEwurKvOUmX+LG+chHolj0=; b=yq8uTDGZJnE5YLUIXbkO1SCBR5qIhQCsH3dgPkKWu91UdYvW9Vlb05nrbIgXsjFjTw zpRNmireHQy3h6g8EUaj7AoPTtPJFnK6FA2bRLif0HkKLa3c0YWGX1LWzq9ICvxI8YHF qJ7fKFO+jELg7LC9o0CLDj7uNnCAGIG4NkhrT43UAhRBV1xTOCvnuQIbYBNk8yzabtaF K6okoBZYh/7hvLD3emSUMnxyHHeEaAlxRjVnRGVMrK2q3FVuYVXDBTLOHgsRqhLE6exh nPyAMtjwQiLQF2xvdwt0yTGtGKYlk0cCfXuWZf4C+UUM5bQsSIdlzOCU/BpSlHZGTnr7 4bKg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=gPW3MBKA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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-20020a170906369000b0078dbed58d26si2328759ejc.635.2022.10.22.01.43.17; Sat, 22 Oct 2022 01: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=gPW3MBKA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S234662AbiJVImG (ORCPT + 99 others); Sat, 22 Oct 2022 04:42:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56220 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234499AbiJVIiu (ORCPT ); Sat, 22 Oct 2022 04:38:50 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C2A7B1A7A22; Sat, 22 Oct 2022 01:05: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 A681860B6B; Sat, 22 Oct 2022 07:52:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B7395C433D6; Sat, 22 Oct 2022 07:52:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425155; bh=Wmphf3AsPlAzcTCjF/2Rty8KRXokQysKlrzKnN12nkM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gPW3MBKAiTTCiaR+/RAiRDK3VisNuvgnzdSOv2ehBVcHoBHm62rfUCDYFdArZhwNH vzi6/YbS6/KJC6iXwT80JhmoRaKOpm7uXwFhK0SAtRpj9wY6fveEPejdTl56xhAi9H BeTHFVXOWZgCLhTVKZ7MqoGtvlcKJiD+M4DTZstw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Frederic Barrat , Hangyu Hua , Sasha Levin Subject: [PATCH 5.19 409/717] misc: ocxl: fix possible refcount leak in afu_ioctl() Date: Sat, 22 Oct 2022 09:24:48 +0200 Message-Id: <20221022072516.153083178@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376640039436801?= X-GMAIL-MSGID: =?utf-8?q?1747376640039436801?= From: Hangyu Hua [ Upstream commit c3b69ba5114c860d730870c03ab4ee45276e5e35 ] eventfd_ctx_put need to be called to put the refcount that gotten by eventfd_ctx_fdget when ocxl_irq_set_handler fails. Fixes: 060146614643 ("ocxl: move event_fd handling to frontend") Acked-by: Frederic Barrat Signed-off-by: Hangyu Hua Link: https://lore.kernel.org/r/20220824082600.36159-1-hbh25y@gmail.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/misc/ocxl/file.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/misc/ocxl/file.c b/drivers/misc/ocxl/file.c index 6777c419a8da..d46dba2df5a1 100644 --- a/drivers/misc/ocxl/file.c +++ b/drivers/misc/ocxl/file.c @@ -257,6 +257,8 @@ static long afu_ioctl(struct file *file, unsigned int cmd, if (IS_ERR(ev_ctx)) return PTR_ERR(ev_ctx); rc = ocxl_irq_set_handler(ctx, irq_id, irq_handler, irq_free, ev_ctx); + if (rc) + eventfd_ctx_put(ev_ctx); break; case OCXL_IOCTL_GET_METADATA: From patchwork Sat Oct 22 07:24: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: 7453 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1098551wrr; Sat, 22 Oct 2022 01:11:12 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6HOP8iedOik1HBUTsiuhzxNbQAlucH4xUZyqztwFjA515P4xoEvJlVAY2nIT+8n1HHUjiE X-Received: by 2002:a17:90b:3890:b0:20a:9ab0:6fa2 with SMTP id mu16-20020a17090b389000b0020a9ab06fa2mr63861640pjb.49.1666426272595; Sat, 22 Oct 2022 01:11:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666426272; cv=none; d=google.com; s=arc-20160816; b=0fdg2NaDWFArZMy++p4nL9Zs8lQLsHf2uEpqve9ZpejVS7tK8/ljUSPtYtps0gFchK XFUXanOj8D9smwX0hd9G55GIx/VBU4rC5s2kaPoFpCJUmEwc9PyuMYdBXNhxg6zne173 +vwNnpZ4HrElE8p5wVG90QhopGH+BEJw9teic8UeNq809iHbvHitTIxEZmjIYP/R4PuT EHfKCrinD/XVSth/RgakZ6IUCgCOsYtnAZe8C0iHYwu0JqUUSyzL01Oa02JaJAqsRZxo 8V4VP26rZIJRvfshRzP7Z7GbWdXYMca9t/ZfhMvEj1lgfDoGzPhNnksCFxEFe0jyW5WL sHKw== 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=zgOhxCVA+GWC6bDkrHoHwHBw7MqggW9lv+q5t0AaaRM=; b=P0+L3NvgjySJl/NXwONzaLPR6IjPBUpGB7EBRpUw4S0LSWYO8TC8UpNi3YZSXt6/hv CiDdWLakFcFYWdO9miIl/oWrms3Rfv++zHj32YWwlNnUB9rCLohQSEnhHvaWvT+5IO8V Ihu1WfSnmduBIbQYMnWdLcUcDX+DaLMVWOkCx1kbG9oUMQY/RRL2xEajjvEp6AYnS+Hd XkdtRKeinH8yRq3a5JvlnWztEUU4dFZNfpi3sk053ZqMavL+UIrLdng5Yv4waQI5HCJi K7Uo8U+G1JDBDbBLyD0HAHWlIsh3HsFxUtmqh3l1mu5L+p4WdJqduwOTx2SXcKhB+oZ2 eX3Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=U+BY4A4k; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 u185-20020a6385c2000000b00463dede6203si1858515pgd.699.2022.10.22.01.10.57; Sat, 22 Oct 2022 01: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=U+BY4A4k; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S232406AbiJVIKG (ORCPT + 99 others); Sat, 22 Oct 2022 04:10:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58556 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232804AbiJVIGE (ORCPT ); Sat, 22 Oct 2022 04:06: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 A89352C2ADE; Sat, 22 Oct 2022 00:52: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 F2A61B82E16; Sat, 22 Oct 2022 07:52:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 51BAAC433D7; Sat, 22 Oct 2022 07:52:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425160; bh=eRxJ1kJpepxUkHWp5jwbtxrvWiVTvKzPrLq8OH8PndI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=U+BY4A4kr5Z0Zd+82Z3kxunPMiFf9voTuXVAAFc0qeE9E6mUz0CZeddy2YH6mXI16 k8sHERaL78gI/sajzGhJIDWWmolW5zvyWLeWec+nDtrwZdgEyyMGMdKzk5sVqzmP4+ JJPRfwdOqpS7Mx/pq3qSD1iZRsHHwBfC6pQR29WQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dan Carpenter , Xu Yilun , Sasha Levin Subject: [PATCH 5.19 410/717] fpga: prevent integer overflow in dfl_feature_ioctl_set_irq() Date: Sat, 22 Oct 2022 09:24:49 +0200 Message-Id: <20221022072516.217478075@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747374595247663623?= X-GMAIL-MSGID: =?utf-8?q?1747374595247663623?= From: Dan Carpenter [ Upstream commit 939bc5453b8cbdde9f1e5110ce8309aedb1b501a ] The "hdr.count * sizeof(s32)" multiplication can overflow on 32 bit systems leading to memory corruption. Use array_size() to fix that. Fixes: 322b598be4d9 ("fpga: dfl: introduce interrupt trigger setting API") Signed-off-by: Dan Carpenter Acked-by: Xu Yilun Link: https://lore.kernel.org/r/YxBAtYCM38dM7yzI@kili Signed-off-by: Xu Yilun Signed-off-by: Sasha Levin --- drivers/fpga/dfl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/fpga/dfl.c b/drivers/fpga/dfl.c index 6bff39ff21a0..eabaf495a481 100644 --- a/drivers/fpga/dfl.c +++ b/drivers/fpga/dfl.c @@ -1866,7 +1866,7 @@ long dfl_feature_ioctl_set_irq(struct platform_device *pdev, return -EINVAL; fds = memdup_user((void __user *)(arg + sizeof(hdr)), - hdr.count * sizeof(s32)); + array_size(hdr.count, sizeof(s32))); if (IS_ERR(fds)) return PTR_ERR(fds); From patchwork Sat Oct 22 07:24: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: 7823 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1146219wrr; Sat, 22 Oct 2022 03:43:22 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4/pxtYL/Ehfx3CPyH45VIB8pvmwKr+bCcyrWADFztsX0tUZ4+9CiP6lh005lkgcoRZgx9a X-Received: by 2002:a17:907:5ce:b0:730:bae0:deb with SMTP id wg14-20020a17090705ce00b00730bae00debmr20072640ejb.181.1666435402071; Sat, 22 Oct 2022 03:43:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666435402; cv=none; d=google.com; s=arc-20160816; b=Fg8G1uxKlUSye3BbJE+4QH54DI8ljvuOyeGyx89p7PKZSMU65YyoStxxPsByf9vXNN JnJ1X4nYWf4ucF8bT8wzGYw+ewQ8A/F9bCGZterXVgtARd5NA9pQbsw5OMvf5L01uN9u WVOiTULDJnknED1JZg/Ls7uwo9IX1n/5tUWO9NDo4K51n+W7KhMkTAIxwu9fedzX5Cfa uTHwDySaASW7X14K69xSFr74w+wEjuusF3Ax//zRNhYNaooyrozW3bsEQqKbJiJGU4pw Rv7S9oEHVY+wRj20E7u7uC2yf+R/H1WvnLPSkhOj96j/AkurXxAw8RAQgah4qO75IkZU YCVw== 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=tQ/2cN2dVdxtM9R05EdPqznY/sl318+yYPfPDAqNWig=; b=wdnXJfOjtGsiQNRCzWfHQ0+j14U1nI9w6PazJVsviFn/YZMf7TJZmX/cuLZYTEJez6 zxlVdt2puwIWHDI5SYe31qNNwhxsUJAymv1NEqOd29raaphH80t0grrZwLu6OHgjY8q4 2Tbf6V08cuQK2rwwObCn4ucWp2ulu3k4bb4w6mwgwa0BBBaDrThiRnVMND6A21+taift vRqHwsOp0kHNBTp0IreSw5+OLmqMj92jq5RKF71Y55wTCZeZ5HPEB4vSbssSv98lCEcW KvY981eom3lMkNwoU9xRx2ykM6Cchhpa29Lrgb7zqs6TFogGG40Xld/MqTEB3bkcB8d/ c5tw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=RUjxoYZx; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 sg13-20020a170907a40d00b0078e2d2d1a67si19822682ejc.344.2022.10.22.03.42.57; Sat, 22 Oct 2022 03:43: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=RUjxoYZx; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S230351AbiJVKc4 (ORCPT + 99 others); Sat, 22 Oct 2022 06:32:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54658 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230373AbiJVKcl (ORCPT ); Sat, 22 Oct 2022 06:32:41 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 10C423235CD; Sat, 22 Oct 2022 02:48: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 6A85860B0A; Sat, 22 Oct 2022 07:52:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 28C68C433C1; Sat, 22 Oct 2022 07:52:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425163; bh=PiM5G2FI8VQ/X/sDFT0sCf2uTCLjmCF8dIB0FZuzEo4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RUjxoYZx//+22+ogmrr6XIvUsLbZiLwcYiTnxVySCHvi8zEG8lm+BePoWbnpuxoS8 q3bVo0jjIZP8rt9cAEKF6I7n+9BfyWX0afcbW0dumKQ36P1eHFjISjmmEKpv7dy2d1 OiZn/NwPSWDkst5x79ujM2WUUOiTLBLIVzRGRbLQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Markus Reichl , Michael Riesch , Peter Geis , Samuel Holland , Vinod Koul , Sasha Levin Subject: [PATCH 5.19 411/717] phy: rockchip-inno-usb2: Return zero after otg sync Date: Sat, 22 Oct 2022 09:24:50 +0200 Message-Id: <20221022072516.272003002@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 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?1747384168093395495?= X-GMAIL-MSGID: =?utf-8?q?1747384168093395495?= From: Peter Geis [ Upstream commit f340ed8664a55a467850ec1689996e63d9ee971a ] The otg sync state patch reuses the ret variable, but fails to set it to zero after use. This leads to a situation when the otg port is in peripheral mode where the otg phy aborts halfway through setup. It also fails to account for a failure to register the extcon notifier. Fix this by using our own variable and skipping otg sync in case of failure. Fixes: 8dc60f8da22f ("phy: rockchip-inno-usb2: Sync initial otg state") Reported-by: Markus Reichl Reported-by: Michael Riesch Signed-off-by: Peter Geis Tested-by: Michael Riesch Tested-by: Markus Reichl Reviewed-by: Samuel Holland Link: https://lore.kernel.org/r/20220902184543.1234835-1-pgwipeout@gmail.com Signed-off-by: Vinod Koul Signed-off-by: Sasha Levin --- drivers/phy/rockchip/phy-rockchip-inno-usb2.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/phy/rockchip/phy-rockchip-inno-usb2.c b/drivers/phy/rockchip/phy-rockchip-inno-usb2.c index 5223d4c9afdf..39f14a5b78cd 100644 --- a/drivers/phy/rockchip/phy-rockchip-inno-usb2.c +++ b/drivers/phy/rockchip/phy-rockchip-inno-usb2.c @@ -1124,7 +1124,7 @@ static int rockchip_usb2phy_otg_port_init(struct rockchip_usb2phy *rphy, struct rockchip_usb2phy_port *rport, struct device_node *child_np) { - int ret; + int ret, id; rport->port_id = USB2PHY_PORT_OTG; rport->port_cfg = &rphy->phy_cfg->port_cfgs[USB2PHY_PORT_OTG]; @@ -1162,13 +1162,15 @@ static int rockchip_usb2phy_otg_port_init(struct rockchip_usb2phy *rphy, ret = devm_extcon_register_notifier(rphy->dev, rphy->edev, EXTCON_USB_HOST, &rport->event_nb); - if (ret) + if (ret) { dev_err(rphy->dev, "register USB HOST notifier failed\n"); + goto out; + } if (!of_property_read_bool(rphy->dev->of_node, "extcon")) { /* do initial sync of usb state */ - ret = property_enabled(rphy->grf, &rport->port_cfg->utmi_id); - extcon_set_state_sync(rphy->edev, EXTCON_USB_HOST, !ret); + id = property_enabled(rphy->grf, &rport->port_cfg->utmi_id); + extcon_set_state_sync(rphy->edev, EXTCON_USB_HOST, !id); } } From patchwork Sat Oct 22 07:24: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: 7463 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1098830wrr; Sat, 22 Oct 2022 01:11:54 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4QjgEc8BmrxBhnPKV/eAtJdzkHjNpVm4L977z+p2oKcMFKJKJs0UxFTGpI8NhzPAPJ2e8J X-Received: by 2002:a17:902:cecf:b0:185:475a:4073 with SMTP id d15-20020a170902cecf00b00185475a4073mr23572883plg.60.1666426314378; Sat, 22 Oct 2022 01:11:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666426314; cv=none; d=google.com; s=arc-20160816; b=en0D2ZyrdaLzw0bWAxsUYZDc7tqhy+vR4rxkpOApaDtqZJd8f5dfFvSsZaByS4meLX J9mS12R+h9fRCN+SfpBG6K77kVITSwa+f1qNlcEeHjm33purkUvVOmg5uhFReMyghYAX MwHf6J03rMU1I/T6LcUW5vF0rTzVVy6rZcwMoyqECgv9ah56GMQpjFdcqgAinSKp4/rX 0gd3HCLkj+KYfvxvXynpnfbfLOEdbvGNJ15ffqARZIdSAfdD76+egBsDXDfsHDMQaFpq ODCsHUN+nmLFUQbX1CMXONHMC0MKi8yxG6eg4yE1F2GDMJJzokFbtj2MNoyf9tWZ2Db9 gRhw== 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=F0ZW0k//9OnPv/YFGK1/u1Uwtm1TX/Jr7ByLNI0XqQo=; b=LWx62JCzfogN8Ql3i/7Js5nDbrynpJkGbm7uJm9jzy90ieUzeUhkTWwwmtJ34ARwaz cfGLm92ws2vLiCsX/07A2u06yu+fVPKPrpkBuqh/ikahDcNQ8Q5uAPqf8kG0YwOenr4u 5ZJvJg7wJZjxDH7/CYfi3jpNBhScNquyZLPGOTBS6D1Tj5/D35wWRV5lzxlRJal4LrPA pI8I/fjD64/6CgV/2KaxsmKamK5F0pubMoUuW4fuZ0EgEeix+k9gZtdr0jO2vHmPtPJV OQcUk34L7D4R6iq8WM69fanDg2jdyRFligPsmvTfFqnT7rDFebg6Qw7LXPUHDEUP03L1 Z2kQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=naz7o3c0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 c20-20020a170902849400b001748ede4e05si26571419plo.119.2022.10.22.01.11.41; Sat, 22 Oct 2022 01:11: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=naz7o3c0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S233257AbiJVILG (ORCPT + 99 others); Sat, 22 Oct 2022 04:11:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57152 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233074AbiJVII2 (ORCPT ); Sat, 22 Oct 2022 04:08:28 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 98AEA2CB8BA; Sat, 22 Oct 2022 00:53:37 -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 8789860B83; Sat, 22 Oct 2022 07:52:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8531FC43470; Sat, 22 Oct 2022 07:52:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425167; bh=k9UmSSd24VoHD4EdvwgqSONVwGFzHEbaHDORRiPVUfQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=naz7o3c014gL0BG8ejmgL+BXYtjb6VfmbAl6bnX1uycoTAvNsFtgzY3bxlfnQ14OO fLlVbyh/okQGAHZBXEdNmOXumvkprRxaz4Khl3DgIuzc7tAWzA+d9OCTXNgxjpMKK0 cWpmizbahHcHoPPvTPVQtTDD/3g1pZnJ7pe+lYxQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Fenghua Yu , Dave Jiang , Vinod Koul , dmaengine@vger.kernel.org, Jerry Snitselaar , Sasha Levin Subject: [PATCH 5.19 412/717] dmaengine: idxd: avoid deadlock in process_misc_interrupts() Date: Sat, 22 Oct 2022 09:24:51 +0200 Message-Id: <20221022072516.329391173@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747374638898013343?= X-GMAIL-MSGID: =?utf-8?q?1747374638898013343?= From: Jerry Snitselaar [ Upstream commit 407171717a4f4d2d80825584643374a2dfdb0540 ] idxd_device_clear_state() now grabs the idxd->dev_lock itself, so don't grab the lock prior to calling it. This was seen in testing after dmar fault occurred on system, resulting in lockup stack traces. Cc: Fenghua Yu Cc: Dave Jiang Cc: Vinod Koul Cc: dmaengine@vger.kernel.org Fixes: cf4ac3fef338 ("dmaengine: idxd: fix lockdep warning on device driver removal") Signed-off-by: Jerry Snitselaar Reviewed-by: Dave Jiang Link: https://lore.kernel.org/r/20220823163709.2102468-1-jsnitsel@redhat.com Signed-off-by: Vinod Koul Signed-off-by: Sasha Levin --- drivers/dma/idxd/irq.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/dma/idxd/irq.c b/drivers/dma/idxd/irq.c index 743ead5ebc57..5b9921475be6 100644 --- a/drivers/dma/idxd/irq.c +++ b/drivers/dma/idxd/irq.c @@ -324,13 +324,11 @@ static int process_misc_interrupts(struct idxd_device *idxd, u32 cause) idxd->state = IDXD_DEV_HALTED; idxd_wqs_quiesce(idxd); idxd_wqs_unmap_portal(idxd); - spin_lock(&idxd->dev_lock); idxd_device_clear_state(idxd); dev_err(&idxd->pdev->dev, "idxd halted, need %s.\n", gensts.reset_type == IDXD_DEVICE_RESET_FLR ? "FLR" : "system reset"); - spin_unlock(&idxd->dev_lock); return -ENXIO; } } From patchwork Sat Oct 22 07:24: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: 7456 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1098661wrr; Sat, 22 Oct 2022 01:11:28 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4Tonn7xb7WXbSCFBuOz5ZB3TOYOkNbQ/qWjMR61sngYQ0MbJxIkoy++K482CyI9dU8x4Al X-Received: by 2002:a17:902:7b95:b0:178:ab50:76b5 with SMTP id w21-20020a1709027b9500b00178ab5076b5mr23451664pll.161.1666426288662; Sat, 22 Oct 2022 01:11:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666426288; cv=none; d=google.com; s=arc-20160816; b=DjYu6U2szP1y9G5ovRlWw64Ylu1nDqvy38J6Dz3YhUnznW+hJjtuPZmeYpoBW1We/G TKVkLOFPUm5MmnqrQfZKmXprPnzbDK4BTKK6ssdbEw4l3FiiyHvIThQyxsptupquD5KC gDqUy25b27XbYwnI86h5ZWX4Bkkq3jduziRpF5z9iWXlNpttihgbqcvBZ7UCfhCBwJOC jyH8spdJbT9Mc0+/A6pCWQXfIlIk4+Y60u/XrpREYiAu5GKj/94wNjheK166e95onM1O kdAyoP8Tj2PMBxwPLq7DR5uXqHSl7epU0mFcoI9Z4WVyKXXRvoNZNs7J9n5kVvoFE3Ao i49g== 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=PrgHe7CX1UwWMIO4mMhjm7t1RjA3aOW7qy6jtVcGhNU=; b=y4WMqJxcRShxbPuxqMh2H4/Ffs0LtelGu2XJfhANv7qXfGrA0FQWAj2+GMNXF6XFiz 3vtIOwvhRKxs3VUjMYEfKThLQfp+lV9il1oBm0W9yVervhZhfvg2R5RIDLMq2Ptxc7Zp oE7CDp3wmmEUfNN8ITfmssit8WpBhpvuWnqnOIHKW8UZ8fVJISVAjJmDRYMoyhko+MnU RgnFrGZyaNAtWq2HyBzjx3KvthAuAUwww9rfyuB7Mpa7XTX+gPBkab4FT6sTEonfbE1r Px+iqeRthd2q0wC1fE5x+nNXe3XTtAwio8uDXLKxJFuPzEjxMS8OU9AVn9Wx0L4CNier lIbw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=rCdKbpT5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 hk1-20020a17090b224100b001fd81d07d0esi10770337pjb.123.2022.10.22.01.11.16; Sat, 22 Oct 2022 01:11: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=rCdKbpT5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S233056AbiJVIK1 (ORCPT + 99 others); Sat, 22 Oct 2022 04:10:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59032 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232716AbiJVIGI (ORCPT ); Sat, 22 Oct 2022 04:06:08 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 53F082D52CC; Sat, 22 Oct 2022 00:53: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 24D59B82DB3; Sat, 22 Oct 2022 07:52:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 73D98C4314B; Sat, 22 Oct 2022 07:52:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425169; bh=rMbA6/oW/i/Lu6KasqXn0fbJlBZXxf0bUD+LrqGkdqU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rCdKbpT5vCmi73gFiF/r36ixxXHNYgA5NoQeBtioYP4Vgh5B8NGZWszkqEyQf0Pwt e4p0irRa33JQ9zXdC1DA6HpDPpd273Pv89pu++/LwLo4XYHdeE6KvMRuN+OUb7RE0I sfv/W7FaYHANr2qiMYDaBF9rgyM7SzJLYJHWiJD8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jie Hai , Zhou Wang , Vinod Koul , Sasha Levin Subject: [PATCH 5.19 413/717] dmaengine: hisilicon: Disable channels when unregister hisi_dma Date: Sat, 22 Oct 2022 09:24:52 +0200 Message-Id: <20221022072516.391491350@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747374612511852828?= X-GMAIL-MSGID: =?utf-8?q?1747374612511852828?= From: Jie Hai [ Upstream commit e3bdaa04ada31f46d0586df83a2789b8913053c5 ] When hisi_dma is unloaded or unbinded, all of channels should be disabled. This patch disables DMA channels when driver is unloaded or unbinded. Fixes: e9f08b65250d ("dmaengine: hisilicon: Add Kunpeng DMA engine support") Signed-off-by: Jie Hai Acked-by: Zhou Wang Link: https://lore.kernel.org/r/20220830062251.52993-2-haijie1@huawei.com Signed-off-by: Vinod Koul Signed-off-by: Sasha Levin --- drivers/dma/hisi_dma.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/drivers/dma/hisi_dma.c b/drivers/dma/hisi_dma.c index 43817ced3a3e..98bc488893cc 100644 --- a/drivers/dma/hisi_dma.c +++ b/drivers/dma/hisi_dma.c @@ -180,7 +180,8 @@ static void hisi_dma_reset_qp_point(struct hisi_dma_dev *hdma_dev, u32 index) hisi_dma_chan_write(hdma_dev->base, HISI_DMA_CQ_HEAD_PTR, index, 0); } -static void hisi_dma_reset_hw_chan(struct hisi_dma_chan *chan) +static void hisi_dma_reset_or_disable_hw_chan(struct hisi_dma_chan *chan, + bool disable) { struct hisi_dma_dev *hdma_dev = chan->hdma_dev; u32 index = chan->qp_num, tmp; @@ -201,8 +202,11 @@ static void hisi_dma_reset_hw_chan(struct hisi_dma_chan *chan) hisi_dma_do_reset(hdma_dev, index); hisi_dma_reset_qp_point(hdma_dev, index); hisi_dma_pause_dma(hdma_dev, index, false); - hisi_dma_enable_dma(hdma_dev, index, true); - hisi_dma_unmask_irq(hdma_dev, index); + + if (!disable) { + hisi_dma_enable_dma(hdma_dev, index, true); + hisi_dma_unmask_irq(hdma_dev, index); + } ret = readl_relaxed_poll_timeout(hdma_dev->base + HISI_DMA_Q_FSM_STS + index * HISI_DMA_OFFSET, tmp, @@ -218,7 +222,7 @@ static void hisi_dma_free_chan_resources(struct dma_chan *c) struct hisi_dma_chan *chan = to_hisi_dma_chan(c); struct hisi_dma_dev *hdma_dev = chan->hdma_dev; - hisi_dma_reset_hw_chan(chan); + hisi_dma_reset_or_disable_hw_chan(chan, false); vchan_free_chan_resources(&chan->vc); memset(chan->sq, 0, sizeof(struct hisi_dma_sqe) * hdma_dev->chan_depth); @@ -394,7 +398,7 @@ static void hisi_dma_enable_qp(struct hisi_dma_dev *hdma_dev, u32 qp_index) static void hisi_dma_disable_qp(struct hisi_dma_dev *hdma_dev, u32 qp_index) { - hisi_dma_reset_hw_chan(&hdma_dev->chan[qp_index]); + hisi_dma_reset_or_disable_hw_chan(&hdma_dev->chan[qp_index], true); } static void hisi_dma_enable_qps(struct hisi_dma_dev *hdma_dev) From patchwork Sat Oct 22 07:24: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: 7581 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1106298wrr; Sat, 22 Oct 2022 01:37:27 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5expE9aKinEHzILPZL30p19ZX1r9pxtm8noH+ZCA5Br7Gae97c3BjJhYhvjSH3xekPMDDy X-Received: by 2002:a05:6402:1808:b0:461:52dd:499c with SMTP id g8-20020a056402180800b0046152dd499cmr5895111edy.120.1666427847135; Sat, 22 Oct 2022 01:37:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666427847; cv=none; d=google.com; s=arc-20160816; b=M4jv6ZGN1Mt6QY8l79peRqH9vnMZeTdrAvrqGpZfUMjtEYDFqVMFKGBWv/N6zY2j8d +IxzBG1r18SgEfSYthEqSQt59wBtPv72SayzQLMRyjFpbUOcoGnZMcKbcnHZf+28nv18 W9h4TvexOLDO3zYZiU8fxYJDhx7xceQ0a9acJ8qSGXKdwAolgfn7tUsgVwmjJzU6yO3W JqnuoOYsEiimGNRaa542XweCAzc/pjoC1zh0iIX0N7wul1uXZ1xrIWD+eIaSu4mb6+eB I4g8kgDmtst4JVOPmyBNQvp3wOgAu6dniJYLnfSMc7jf9G+XMauF3DAZDY2SZ7UrfrUb xceA== 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=DNPMDxDPD2lYiT8qMnosRbZhEcz8fSp7m4z5gW6kwQs=; b=BIzLfZvKj7R2VrAyM6grYNit07rkrf9fxnBKnEcr8zYiLSOZCANSgWN5SDLuYNAbeo b/s2WCs0O4QKn7/oGEDkOxa8FWy9VAJkuB6LuKFhW4ATMWVRO9fAb397eRwtxmdH8270 hdbHo+RlHoPl/DGfA+HT4RIsLH7XMp2ANAsH3Vi9310w+5u/iLTnfsJQFgV+ixVdPtx/ 58pFkCqFdyl6LcTozbaU/C2d72lvOy+Za0jrCXSoIrUOa+E/3Yx+0VGPZ8k1axyj6DE2 HmGBT+4ZKNnNM8x2BBf4fz8wqlb09tIr5PYyro1YOHVh30teq9piRAkcWt1n81Zqet0A WHTw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=DeZbex+v; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 l24-20020a056402231800b0045909f3bb10si18882770eda.283.2022.10.22.01.36.58; Sat, 22 Oct 2022 01:37: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=DeZbex+v; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S234039AbiJVIch (ORCPT + 99 others); Sat, 22 Oct 2022 04:32:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39732 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234038AbiJVI3R (ORCPT ); Sat, 22 Oct 2022 04: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 9025F2E32C6; Sat, 22 Oct 2022 01: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 C578EB80E44; Sat, 22 Oct 2022 07:52:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2B81CC433C1; Sat, 22 Oct 2022 07:52:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425172; bh=+vbNUCQv8UUCMwCDsqLsnnb70lWBjwdQNQ0Y+msAdpk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DeZbex+vFRtidyJQLiM6SJF3yyIWZD+HnKVRQO8bVtdaCPHooi6mumalweH1ddmM+ hsz9ro9PIzNnmaTbExqJsXLkaQR5aPTy2bm5tPTjOkwo79byo5puxWzUuwqUdDwMhP MzYaKOrgOH1AWLnUN2/zRA9jJe265uSlWSFfWZEw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jie Hai , Zhou Wang , Vinod Koul , Sasha Levin Subject: [PATCH 5.19 414/717] dmaengine: hisilicon: Fix CQ head update Date: Sat, 22 Oct 2022 09:24:53 +0200 Message-Id: <20221022072516.474402112@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376245866005379?= X-GMAIL-MSGID: =?utf-8?q?1747376245866005379?= From: Jie Hai [ Upstream commit 94477a79cf80e8ab55b68f14bc579a12ddea1e0b ] After completion of data transfer of one or multiple descriptors, the completion status and the current head pointer to submission queue are written into the CQ and interrupt can be generated to inform the software. In interrupt process CQ is read and cq_head is updated. hisi_dma_irq updates cq_head only when the completion status is success. When an abnormal interrupt reports, cq_head will not update which will cause subsequent interrupt processes read the error CQ and never report the correct status. This patch updates cq_head whenever CQ is accessed. Fixes: e9f08b65250d ("dmaengine: hisilicon: Add Kunpeng DMA engine support") Signed-off-by: Jie Hai Acked-by: Zhou Wang Link: https://lore.kernel.org/r/20220830062251.52993-3-haijie1@huawei.com Signed-off-by: Vinod Koul Signed-off-by: Sasha Levin --- drivers/dma/hisi_dma.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/dma/hisi_dma.c b/drivers/dma/hisi_dma.c index 98bc488893cc..837f7e4adfa6 100644 --- a/drivers/dma/hisi_dma.c +++ b/drivers/dma/hisi_dma.c @@ -436,12 +436,10 @@ static irqreturn_t hisi_dma_irq(int irq, void *data) desc = chan->desc; cqe = chan->cq + chan->cq_head; if (desc) { + chan->cq_head = (chan->cq_head + 1) % hdma_dev->chan_depth; + hisi_dma_chan_write(hdma_dev->base, HISI_DMA_CQ_HEAD_PTR, + chan->qp_num, chan->cq_head); if (FIELD_GET(STATUS_MASK, cqe->w0) == STATUS_SUCC) { - chan->cq_head = (chan->cq_head + 1) % - hdma_dev->chan_depth; - hisi_dma_chan_write(hdma_dev->base, - HISI_DMA_CQ_HEAD_PTR, chan->qp_num, - chan->cq_head); vchan_cookie_complete(&desc->vd); } else { dev_err(&hdma_dev->pdev->dev, "task error!\n"); From patchwork Sat Oct 22 07:24: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: 7465 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1098883wrr; Sat, 22 Oct 2022 01:12:03 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5nPvLXUaGCpP2fKgahYIs0S1V8/iwAPawB6WbDpWmamoWNJIvPq0ZmToBF6Ok87HMke0YA X-Received: by 2002:a17:902:bd46:b0:17e:8ee5:7b61 with SMTP id b6-20020a170902bd4600b0017e8ee57b61mr23697857plx.44.1666426323653; Sat, 22 Oct 2022 01:12:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666426323; cv=none; d=google.com; s=arc-20160816; b=eRdBQo2jT6Bm3z6UGZFWFjJxIA/EMG+MDdVFEC10/6rZQBBYHpwQH1qL2YQqgxr3Dj lcwilPJF30OpACulII10DvNxdJ0ry1V7+dxJ4tQZ3MfsYLhy6oiqzZzfeyjap1srrbRx T2UKiUudbLk5bCNIDO7FEKY+cdlRxxn9hyeJLVUUORdbDcE7plCYt9Af4T7xTnwjtbLD 2FWxXCQ4k7t0AGL9j/cjPflYm1yhh5cGdVJR3sk/VpI/m1RuNaAZTnjYl4UbqiwH2bAV /gmQc9qFZRfyrYHi11vatcMYpcjdqdDXT4OIylZEj9ZJmoTTB2M7y+Gy7szT6328ll1Q n8Sw== 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=0wsrwGAhHMGMCbkHoA4N+gkqwOt0onh8W5TqDi5vMcY=; b=dF/HpSSC4OorxFaWjO1IwfDo2WdtnFILm+9ALEWcj8pntPMh1NYjocGJSTwNQw4772 hFaZpkYm4MjGD8IeTD6+UJbuDqFygb7oc8cULijfZ7bgeO3FKBHqaL3Uk6hO4eoDdHRd xm9eoSFTLNzdnD3/5rCrXTjj07BOPJxxaWLA20GgHtLxL6/0YQZ5TlGfB+9Eta8oIq/r JsdI6XDpH2kwCSuZvvBbl3i2VSqYiE4iLEGS7G8Dwtc1e7mi2vSQzWmbwbCUxJOiUQir N5o21K4YaQK08OiplVulbVhm4lxdKT7NagGQVLOYOTQsY7o7qyctxaPrco3loTKZxTE5 4lAw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=y8kD9+xs; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 j3-20020a625503000000b00542c772d478si26497580pfb.247.2022.10.22.01.11.50; Sat, 22 Oct 2022 01:12: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=y8kD9+xs; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S233309AbiJVILP (ORCPT + 99 others); Sat, 22 Oct 2022 04:11:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37532 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233097AbiJVIIq (ORCPT ); Sat, 22 Oct 2022 04:08:46 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BE7792CB8A7; Sat, 22 Oct 2022 00:53:52 -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 A9F0460AC3; Sat, 22 Oct 2022 07:52:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C272FC433D6; Sat, 22 Oct 2022 07:52:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425175; bh=s3BcNo+4Mt/v+RbVxnDPFg5Kc5akKszf8xfXcrWrnLk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=y8kD9+xsTezoj63fW16AQrcvZPXMh6dCC+2CkFVSUC51qmdcYr07y5+LPZoeMTPy5 mYygFIo53dsmu53GQ+cIQ0wZuvbuDd3MKhkBHsrVSa9nA3RigV8dBZHgei41/MBpfw P9ydp7SMF6uY53FusmYTLDBmHvaUanseGnmRfIcA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jie Hai , Zhou Wang , Vinod Koul , Sasha Levin Subject: [PATCH 5.19 415/717] dmaengine: hisilicon: Add multi-thread support for a DMA channel Date: Sat, 22 Oct 2022 09:24:54 +0200 Message-Id: <20221022072516.545626629@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747374648900499239?= X-GMAIL-MSGID: =?utf-8?q?1747374648900499239?= From: Jie Hai [ Upstream commit 2cbb95883c990d0002a77e13d3278913ab26ad79 ] When we get a DMA channel and try to use it in multiple threads it will cause oops and hanging the system. % echo 100 > /sys/module/dmatest/parameters/threads_per_chan % echo 100 > /sys/module/dmatest/parameters/iterations % echo 1 > /sys/module/dmatest/parameters/run [383493.327077] Unable to handle kernel paging request at virtual address dead000000000108 [383493.335103] Mem abort info: [383493.335103] ESR = 0x96000044 [383493.335105] EC = 0x25: DABT (current EL), IL = 32 bits [383493.335107] SET = 0, FnV = 0 [383493.335108] EA = 0, S1PTW = 0 [383493.335109] FSC = 0x04: level 0 translation fault [383493.335110] Data abort info: [383493.335111] ISV = 0, ISS = 0x00000044 [383493.364739] CM = 0, WnR = 1 [383493.367793] [dead000000000108] address between user and kernel address ranges [383493.375021] Internal error: Oops: 96000044 [#1] PREEMPT SMP [383493.437574] CPU: 63 PID: 27895 Comm: dma0chan0-copy2 Kdump: loaded Tainted: GO 5.17.0-rc4+ #2 [383493.457851] pstate: 204000c9 (nzCv daIF +PAN -UAO -TCO -DIT -SSBS BTYPE=--) [383493.465331] pc : vchan_tx_submit+0x64/0xa0 [383493.469957] lr : vchan_tx_submit+0x34/0xa0 This occurs because the transmission timed out, and that's due to data race. Each thread rewrite channels's descriptor as soon as device_issue_pending is called. It leads to the situation that the driver thinks that it uses the right descriptor in interrupt handler while channels's descriptor has been changed by other thread. The descriptor which in fact reported interrupt will not be handled any more, as well as its tx->callback. That's why timeout reports. With current fixes channels' descriptor changes it's value only when it has been used. A new descriptor is acquired from vc->desc_issued queue that is already filled with descriptors that are ready to be sent. Threads have no direct access to DMA channel descriptor. In case of channel's descriptor is busy, try to submit to HW again when a descriptor is completed. In this case, vc->desc_issued may be empty when hisi_dma_start_transfer is called, so delete error reporting on this. Now it is just possible to queue a descriptor for further processing. Fixes: e9f08b65250d ("dmaengine: hisilicon: Add Kunpeng DMA engine support") Signed-off-by: Jie Hai Acked-by: Zhou Wang Link: https://lore.kernel.org/r/20220830062251.52993-4-haijie1@huawei.com Signed-off-by: Vinod Koul Signed-off-by: Sasha Levin --- drivers/dma/hisi_dma.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/dma/hisi_dma.c b/drivers/dma/hisi_dma.c index 837f7e4adfa6..0233b42143c7 100644 --- a/drivers/dma/hisi_dma.c +++ b/drivers/dma/hisi_dma.c @@ -271,7 +271,6 @@ static void hisi_dma_start_transfer(struct hisi_dma_chan *chan) vd = vchan_next_desc(&chan->vc); if (!vd) { - dev_err(&hdma_dev->pdev->dev, "no issued task!\n"); chan->desc = NULL; return; } @@ -303,7 +302,7 @@ static void hisi_dma_issue_pending(struct dma_chan *c) spin_lock_irqsave(&chan->vc.lock, flags); - if (vchan_issue_pending(&chan->vc)) + if (vchan_issue_pending(&chan->vc) && !chan->desc) hisi_dma_start_transfer(chan); spin_unlock_irqrestore(&chan->vc.lock, flags); @@ -441,11 +440,10 @@ static irqreturn_t hisi_dma_irq(int irq, void *data) chan->qp_num, chan->cq_head); if (FIELD_GET(STATUS_MASK, cqe->w0) == STATUS_SUCC) { vchan_cookie_complete(&desc->vd); + hisi_dma_start_transfer(chan); } else { dev_err(&hdma_dev->pdev->dev, "task error!\n"); } - - chan->desc = NULL; } spin_unlock(&chan->vc.lock); From patchwork Sat Oct 22 07:24: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: 7455 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1098630wrr; Sat, 22 Oct 2022 01:11:27 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4Y3xZdpDTJob8dMuIhKmv0BmXzZQ8e/nlHIZU7B5p9Zv0Om/Pdl45eKDTDzeHfF/nJqs8x X-Received: by 2002:a17:90a:bd01:b0:205:fa9c:1cfc with SMTP id y1-20020a17090abd0100b00205fa9c1cfcmr63254879pjr.116.1666426287014; Sat, 22 Oct 2022 01:11:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666426287; cv=none; d=google.com; s=arc-20160816; b=JFWSHo+mw2+5nqSvEqeGbNOBppG6U78xEuVYVOdTLcx4zdBSaIrRHIAP9e6aT3Wb6X ZEh11uIBjZ5yWpSRhesm7gRxoxlT6tYqbGZRW/9NLgjvKoa1tvhf6orVY8zTiIaZvZ7T fY4IjBbxh4aB/zPTPtGDRXIcj2ihVNpXfU6kGTm2Ha27WHgjU5SZTxEg/SE8B6QYPWFj XXYvGy4VyWLgfOtLk3lz0KlwRNI7VCsSiuezayXboNydhQNHEc3pkqHvt54bE2JG+Fmd E/LNnxwcUkVyU1NukkDaVczKlkZNAgBIEObILmWigj+8NjIcpHOo9xirNISNdSoQYjuP LUIA== 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=d1iHjBmYVefgoFKeQ96nLRwl9b6TLPErveY9hV1aOic=; b=MDkxBq6qeimKZ03ebdywzmkiKSP48AxTdVouhwRq23KFSR/7p1IKpn6ZaRM8OJQfXh gSl7uTKpWNNeZ3Ilr7LuHGoSX+rRI/uT4BD9ZEoX3znLJj9S9JFKSLsv5Pc9tLwrIpB4 GpBE7hmXyTMQP8SyFp1EZBewdbGcirQAiwObkztNXdGvrkYQn+R0RTYZcR0WS+QPeSrD d9pM9UCg6FljVcWI6bGDi5RMAtv0S4ZryMyGZleMaO+jtvBEgWf2xUrIvoijGe8jp/1i m4Mo7fIaZrDt0o2YcfOsqyzUPhWUN1sdCCYd8FoYz+WgTybITpxwWv0HAuXYfmW8opFs 05Ew== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=qFCPkfdk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 j12-20020a170903024c00b00179ec1d9eb4si34851600plh.112.2022.10.22.01.11.14; Sat, 22 Oct 2022 01:11: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=qFCPkfdk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S233005AbiJVIKU (ORCPT + 99 others); Sat, 22 Oct 2022 04:10:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34660 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232825AbiJVIGG (ORCPT ); Sat, 22 Oct 2022 04:06:06 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 53F6E2D52D1; Sat, 22 Oct 2022 00:53: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 E7A85B82DF1; Sat, 22 Oct 2022 07:52:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5EE28C433D6; Sat, 22 Oct 2022 07:52:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425177; bh=vpqfbiunWovxa5YCg5882NV1JJiUtyPwMIje/6zZPJA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qFCPkfdksa00J3N81jhrmrP3e5nabk09v5RII6n94OzKGIkm8WfSk/EHb19b8NJH0 MLoqsVMyfwfR4HzrE7lj52GuQMpuIIAqLdoNEjxzWpiIkJazRbp9gxax4ZHJcCi1Y6 mx7nYLg84M1eqbm3ZbGmHDTeEGurMWocOQiznRwc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dan Carpenter , Sasha Levin Subject: [PATCH 5.19 416/717] usb: gadget: f_fs: stricter integer overflow checks Date: Sat, 22 Oct 2022 09:24:55 +0200 Message-Id: <20221022072516.609281185@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747374610235459502?= X-GMAIL-MSGID: =?utf-8?q?1747374610235459502?= From: Dan Carpenter [ Upstream commit f57004b9d96755cd6a243b51c267be4016b4563c ] This from static analysis. The vla_item() takes a size and adds it to the total. It has a built in integer overflow check so if it encounters an integer overflow anywhere then it records the total as SIZE_MAX. However there is an issue here because the "lang_count*(needed_count+1)" multiplication can overflow. Technically the "lang_count + 1" addition could overflow too, but that would be detected and is harmless. Fix both using the new size_add() and size_mul() functions. Fixes: e6f3862fa1ec ("usb: gadget: FunctionFS: Remove VLAIS usage from gadget code") Signed-off-by: Dan Carpenter Link: https://lore.kernel.org/r/YxDI3lMYomE7WCjn@kili Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/usb/gadget/function/f_fs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/usb/gadget/function/f_fs.c b/drivers/usb/gadget/function/f_fs.c index e0fa4b186ec6..36184a762527 100644 --- a/drivers/usb/gadget/function/f_fs.c +++ b/drivers/usb/gadget/function/f_fs.c @@ -2645,10 +2645,10 @@ static int __ffs_data_got_strings(struct ffs_data *ffs, unsigned i = 0; vla_group(d); vla_item(d, struct usb_gadget_strings *, stringtabs, - lang_count + 1); + size_add(lang_count, 1)); vla_item(d, struct usb_gadget_strings, stringtab, lang_count); vla_item(d, struct usb_string, strings, - lang_count*(needed_count+1)); + size_mul(lang_count, (needed_count + 1))); char *vlabuf = kmalloc(vla_group_size(d), GFP_KERNEL); From patchwork Sat Oct 22 07:24: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: 7807 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1139305wrr; Sat, 22 Oct 2022 03:21:58 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4iuiboMpv2GXVj2JAQFG8/bCAeMsyJaaRspsIDyqSXiJgb3THiXndE8DOIi63YEOAj5Gc3 X-Received: by 2002:a17:907:3f04:b0:741:4bf4:fe42 with SMTP id hq4-20020a1709073f0400b007414bf4fe42mr19839578ejc.664.1666434118125; Sat, 22 Oct 2022 03:21:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666434118; cv=none; d=google.com; s=arc-20160816; b=CvAmicDgOLP6GpkK1Ha7HKgDfGKX+Vt41UzdOB5o4rkxxPd1c6zKHzS1c6xmrM+FZ/ yCNNpsi2CpO+U4LXLiL8TweD78xZ3KQvYlRGEwph1eF96nl122OWjsAUtGDnoG7VT/5f lr7UvaNQIWSA+ystxLX/qS6BReBdnQvrAtYZNIlWO36Lze3m34NGlWYPw40lqkEhIzp6 F0vMskJ0SPJzbn4Q8gbFE52jzIHGcL7C3nrXrIijOwxszfUHVyLnUVQFchBMGeLnTVat 8k9hvOeDrXkU/aDGXatrYJsk4jPwNmsgCEZ3SLCRa3gVI15dXTHfCDrps7+39UCqn4fp 2UoQ== 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=Xe257ESVMWjRoUD+pbBPd+DmfH4zAbDtmevNwHwQndE=; b=CeDfRwZLn+RWtrZPkYgQE+CVXPaMhk/wioPtyfpeOS1zCW7Mc1K+RWbF7LdFHVWbzU y0NIOQEbrTSD+f0VWBa8y3LM8/NX4TiWe/cRg6Tlj9/7ZBUy+cogZ4Od/wmnE6iJdEeD h0jadzafT/FqDMH9/MJNzHJ1gRcX39le9dI9Xmyc67NvqCfc+uewqL73V6tiCFjaFG6C OoeNz2RU5E8I6a5BM/kBD57JG0uqFFNiw2hGNXbj22dHsp61bYL8EnvaiR3T6IfEsVZU boXwAx4C3JcHgdqE+JOP68e2CsIPqt8iiCgo14ISvd0wcP7jnsZcuEabao6HTQso0rvV QkBg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=wpa1+Tma; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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-20020a1709073f0f00b0078dcd8dfac5si22344827ejc.467.2022.10.22.03.21.32; Sat, 22 Oct 2022 03:21: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=wpa1+Tma; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S230207AbiJVKO0 (ORCPT + 99 others); Sat, 22 Oct 2022 06:14:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57914 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230300AbiJVKOB (ORCPT ); Sat, 22 Oct 2022 06:14:01 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 412EAB03FB; Sat, 22 Oct 2022 02:31: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 sin.source.kernel.org (Postfix) with ESMTPS id 07534CE2CAC; Sat, 22 Oct 2022 07:53:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E8C3BC433C1; Sat, 22 Oct 2022 07:52:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425180; bh=4wv5WtR//CDdsvxu8xL/5g2O2bXmliW8UL1zS+PsHLM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wpa1+Tmadnty8pzd3Gn6oYmMvMjwJzv7T/ZaZV2h0nEbNbKY0qAh5qC9frEhG2s+g xEzLIu/oTim3kMaur0cBjECfkPhin0tEtgNUz2I4Cr54IEDOUf/CRuM0g5+KRwXwO2 Tw7rEk15gOypjVLYIWMt/fvDzAn7Omz+d9TSYb+g= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, vincent.whitchurch@axis.com, Jason Baron , Daniel Vetter , Jim Cromie , Sasha Levin Subject: [PATCH 5.19 417/717] dyndbg: fix static_branch manipulation Date: Sat, 22 Oct 2022 09:24:56 +0200 Message-Id: <20221022072516.673209048@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 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?1747382821800744369?= X-GMAIL-MSGID: =?utf-8?q?1747382821800744369?= From: Jim Cromie [ Upstream commit ee879be38bc87f8cedc79ae2742958db6533ca59 ] In https://lore.kernel.org/lkml/20211209150910.GA23668@axis.com/ Vincent's patch commented on, and worked around, a bug toggling static_branch's, when a 2nd PRINTK-ish flag was added. The bug results in a premature static_branch_disable when the 1st of 2 flags was disabled. The cited commit computed newflags, but then in the JUMP_LABEL block, failed to use that result, instead using just one of the terms in it. Using newflags instead made the code work properly. This is Vincents test-case, reduced. It needs the 2nd flag to demonstrate the bug, but it's explanatory here. pt_test() { echo 5 > /sys/module/dynamic_debug/verbose site="module tcp" # just one callsite echo " $site =_ " > /proc/dynamic_debug/control # clear it # A B ~A ~B for flg in +T +p "-T #broke here" -p; do echo " $site $flg " > /proc/dynamic_debug/control done; # A B ~B ~A for flg in +T +p "-p #broke here" -T; do echo " $site $flg " > /proc/dynamic_debug/control done } pt_test Fixes: 84da83a6ffc0 dyndbg: combine flags & mask into a struct, simplify with it CC: vincent.whitchurch@axis.com Acked-by: Jason Baron Acked-by: Daniel Vetter Signed-off-by: Jim Cromie Link: https://lore.kernel.org/r/20220904214134.408619-2-jim.cromie@gmail.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- lib/dynamic_debug.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c index dd7f56af9aed..a56c1286ffa4 100644 --- a/lib/dynamic_debug.c +++ b/lib/dynamic_debug.c @@ -211,10 +211,11 @@ static int ddebug_change(const struct ddebug_query *query, continue; #ifdef CONFIG_JUMP_LABEL if (dp->flags & _DPRINTK_FLAGS_PRINT) { - if (!(modifiers->flags & _DPRINTK_FLAGS_PRINT)) + if (!(newflags & _DPRINTK_FLAGS_PRINT)) static_branch_disable(&dp->key.dd_key_true); - } else if (modifiers->flags & _DPRINTK_FLAGS_PRINT) + } else if (newflags & _DPRINTK_FLAGS_PRINT) { static_branch_enable(&dp->key.dd_key_true); + } #endif dp->flags = newflags; v4pr_info("changed %s:%d [%s]%s =%s\n", From patchwork Sat Oct 22 07:24: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: 7468 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1098957wrr; Sat, 22 Oct 2022 01:12:15 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7nYR3/RERz22rEfZRG8ElImjb6+Y7z7edgPaEPhk1lN4gGqS4+e5s96CCHRd1nvi4LJq8D X-Received: by 2002:a17:90b:4f4a:b0:20c:64e2:2bf1 with SMTP id pj10-20020a17090b4f4a00b0020c64e22bf1mr27998903pjb.30.1666426335531; Sat, 22 Oct 2022 01:12:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666426335; cv=none; d=google.com; s=arc-20160816; b=Emz6Prc493OD5R7894gtqCk26wkerq+5RfO57uiH6Fds1oR7E38ew86AknzEDNRaTN N4OkK1IOfXrrZn8n3wGVReuVEh8+O5EIVaJfkhmDKLjSmGs9hIe9snztoTvAbJKQFVgS 3hml6n432SXoKu6YCdiZZmT4DAQHt1mRnGGTFYajobEVN4wTWA9chTSiK8JEW8OEaCPV e8BddswvNlGVvPupjO/CMzyIRJu1ng1ymovScnMLAwqm4QTx3I2m6zw8qYkGa6e5KNPI LdPdoD70nbzofWZtncXYfSUXXN3ctKFlqgcndqNe8ZOYRLhXuelEwAuEyf0KWfvnRwlq OHLg== 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=jl55Qgzp+RLgEHvCwc7k6nsS6mMuqw05hq0ZPbqjkwU=; b=ghyELCbEbZs0UkMkvtFhECB8BQWx4kLJhjRiIzpqpRar7Wdk4Me5lT4wkE6NtHrPRF 814qmdYOK7RPZe3d6SgQ24juGQJDzgZURFhaMla1yotyB+ZVyNkyslw9fd/y78SsE4Nw 7bNP1bW+wJxUQ/T9jbGg7RbYxMYtV/ChhifuRpCHptSFI1TirrxMKnWera6ak9WYfSJQ bu7kPJzO88YUqmImXV99h7MZOcnf1ictTZCRdlikfP+rhcj6sK2Y3051S66N8kXpiO9W 0FPgeVlAMtkTqHReQKWpbygj6WUwvIR0HywYOXuldHiJwNYODggocItdScooOS6Soref 6czg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=e43sFtW7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 k11-20020a6555cb000000b00438b7cb3311si30351398pgs.501.2022.10.22.01.12.02; Sat, 22 Oct 2022 01:12: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=e43sFtW7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S233117AbiJVILc (ORCPT + 99 others); Sat, 22 Oct 2022 04:11:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37482 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233344AbiJVIJg (ORCPT ); Sat, 22 Oct 2022 04:09:36 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D64892D6E15; Sat, 22 Oct 2022 00:53:52 -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 7A95C60B39; Sat, 22 Oct 2022 07:53:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8B215C433D7; Sat, 22 Oct 2022 07:53:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425182; bh=2jkvL5g/HD5FsyAP8TMFn08xR4PzTjIkzrqUWM+1a30=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=e43sFtW7co/spGAnxKuTC1cw7SIxJEvnYFxlIQcEY1eT7dWvXKSQ4OqlznkiwCXSH TxlTjBaM8EqsztQcUy6H+M8BjWkL3iAuf5xaW+irXIEDyTdrhJsY1xjA1B0BrUA0C0 1+i9+Jf2FZ1VMeMsogURds1/WmSOyY8MkrJfUGMo= 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 5.19 418/717] dyndbg: fix module.dyndbg handling Date: Sat, 22 Oct 2022 09:24:57 +0200 Message-Id: <20221022072516.751121067@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747374661115103136?= X-GMAIL-MSGID: =?utf-8?q?1747374661115103136?= 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 dce631e678dd..f30b01aa9fa4 100644 --- a/include/linux/dynamic_debug.h +++ b/include/linux/dynamic_debug.h @@ -201,7 +201,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 Sat Oct 22 07:24: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: 7667 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1108175wrr; Sat, 22 Oct 2022 01:43:41 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4awiC0w3sVIWHKDQar7epy1hKDqO02ColW0EVCHbhKYAtM5T5yNQI0M2kPkyiMMStaCGK6 X-Received: by 2002:a17:906:2bc7:b0:72f:dc70:a3c6 with SMTP id n7-20020a1709062bc700b0072fdc70a3c6mr19335445ejg.645.1666428220902; Sat, 22 Oct 2022 01:43:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666428220; cv=none; d=google.com; s=arc-20160816; b=JEM1n99yu0d+FqT+cYuFq83zqVvc83xfXrtDOvXzAYJg8etwbw/zhx+vhCpYtenOAc Oe7Ou8GQweE0GnhFmLJFz1YJRAHNefU73ebd441muYUmMzLAKfevvyeE2oC6NO8OfaRx tMzHMFkzurRhEEfGbUX1u5xUsnj8Wi4t4h4bn48nu5ULXmZTpQw1hh1lUL2aUbH4SQhf SNqElKnuXzsntMmgbGR3/nwzsaLvaBO8EtLr+8FHnEep+6FxwwR3MjfRrw7X56+CELpQ YFI76fQr1xYaw/l5QvTCIJd1S41XrmtCQ5hZUpd1bwz9ihiQLwbLn3B4OxnhA3qwUWUe lP2Q== 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=DoNt0pXLagS07yM6N8Kcij3wYWGEjnGqJUWKkOcKf7A=; b=07HRlG5CTQ4tzF/YD+qANznVGXMk84Ez+zWG80cwSm7U0W9As3C6Mr0FK0ofjr+c5E K1DsgJPq7HzaGwRBEkrJGkFvS1P0ak3gp6rFsqb9tBEj7FUTkVjK4LYJa5+hzBEaXplF z0p/6tBtGEVZ3AnNFd0wEOJczcIXxdDSqAGoAP0ySV2gX5xTXwD0KlrdvXPwigK9/Kyg PMa5oFxYcCsfVR5VkmthEkEWAT8nveqx6PIHM/EdAcRDpJYPpEtR9N6P0NiaqjjvAJAT Vlt3z1QuZLqodIoxo/GreKZexnjidBvv6YXPYnM1xMuEOjDOT7+4W0xW2HIPA3cbarcr ZFqg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=xGnNSd8+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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-20020a1709065d0700b007316ac034a1si18846883ejt.831.2022.10.22.01.43.16; Sat, 22 Oct 2022 01:43: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=xGnNSd8+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S234733AbiJVIme (ORCPT + 99 others); Sat, 22 Oct 2022 04:42:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57240 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234608AbiJVIjT (ORCPT ); Sat, 22 Oct 2022 04:39: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 6DC141ACA8C; Sat, 22 Oct 2022 01:05:25 -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 5F86A60B7B; Sat, 22 Oct 2022 07:53:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 68D35C433D6; Sat, 22 Oct 2022 07:53:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425185; bh=sZH1AfOZE2dYsZSEtdB7yfve1BZph91UMlLwjQ5Fm+g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xGnNSd8+Oroq4P8RUBkpgjvsgAZpiQ+gRGWTpVp7HrXUwUXn4kFx7ZBa3XipBKjnv 1Roh3IxHME7xP9fCGk7+/X5aUIqO+8aVoi7enWzpCXebWnFrF7+lAVsynup9mDnQ7E BaW9/yYvhkV18kXS/7HAO96oTyRhfy0U1+v3GVJc= 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 5.19 419/717] dyndbg: let query-modname override actual module name Date: Sat, 22 Oct 2022 09:24:58 +0200 Message-Id: <20221022072516.841235504@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376637965540790?= X-GMAIL-MSGID: =?utf-8?q?1747376637965540790?= 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 a56c1286ffa4..4d168efcf779 100644 --- a/lib/dynamic_debug.c +++ b/lib/dynamic_debug.c @@ -384,10 +384,6 @@ static int ddebug_parse_query(char *words[], int nwords, return -EINVAL; } - if (modname) - /* support $modname.dyndbg= */ - query->module = modname; - for (i = 0; i < nwords; i += 2) { char *keyword = words[i]; char *arg = words[i+1]; @@ -428,6 +424,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 Sat Oct 22 07:24: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: 7486 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1104726wrr; Sat, 22 Oct 2022 01:33:14 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5f78s1vE5IJHGx57D3KGxS8lDJEMWz+SLIxf3Ds/dy4U1FcUBrRt5U9kmA5Gm5qbZlIrMy X-Received: by 2002:a17:90a:c90c:b0:20a:7179:b14f with SMTP id v12-20020a17090ac90c00b0020a7179b14fmr26555381pjt.58.1666427593805; Sat, 22 Oct 2022 01:33:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666427593; cv=none; d=google.com; s=arc-20160816; b=IQ+Oc9f/uxMxFf0bH1b5l2DWMtPkvgaNQHKMAUahQWwLEHc6XzXfhdrW1OjIwyrJVx YYlu3joarajp70xinWo4XWqGDvKy/mWxLuSskt6jjQijoetAamUSnzRL2L+cT6678MYz BHoByaf+Ad8w3Q8HYHzrgAn/EhuWJPsxIk8VX95GQtWNkjdzL4INu7nYt4e8XrsKrPL7 lpzE0jI4CdzBO28aueGtu0kp0valqWatysn/3X29SSNL1G//Q/64u8u6RDkNWKxAXWv9 nHWQ/8TZyg3KHTe4XTXmXnIB/GYqBLeLzd++Qnn4CjX6sKrRV4tG70wbzn0G8F1KXACZ KU2A== 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=RtCrQnx+KRSJl80kUbtRA+Q1YCgUyTG8MdhYOwkNRpw=; b=mHq56xHcO4yJ0kmxcqdvanyTxjDWzOLE9SIX/wZ8lBLytVLOewEpQ+MNtqLmUNPDBJ EwcTl4EbKZ17nkjXCWfKc07toNC0Hlb+UwkkYZeiVDF2nRUVZUpELDV99gt87MiiyKnr q7oI1WI5YBzxKPi5ZvDcbM45xwNsbDgAu8oj1Cry3PCJ1sbRVwrVg9AZq1ZI+5ilmFA6 0tnWuE4GHWA2R8WJysHqwF/e+5vVSabSUgjbCXzn/iZD4WxZ/8Ow75TeJbnxKkbLh+Rp 96MrmJimdf+lw34Y5xMbo7s6xRhO8r1qi22CDjdqMm96PeKDs1M/EY4/4hQ0G3jAgh1O NCsQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=qBe62dGd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 mw16-20020a17090b4d1000b0021071bf8d26si10716855pjb.29.2022.10.22.01.33.01; Sat, 22 Oct 2022 01:33: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=qBe62dGd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S233366AbiJVIQo (ORCPT + 99 others); Sat, 22 Oct 2022 04:16:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57620 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233564AbiJVIOR (ORCPT ); Sat, 22 Oct 2022 04:14: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 A8DDF2591D1; Sat, 22 Oct 2022 00: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 ams.source.kernel.org (Postfix) with ESMTPS id 9169AB82DF0; Sat, 22 Oct 2022 07:53:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F416BC433D7; Sat, 22 Oct 2022 07:53:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425192; bh=rRdn83gaQeaNkPFVcGa5S1CTqcpCTQhYS+1Lvk4tkVM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qBe62dGd5zHDpTfERNQnAWN+Y7ndLpwpg54pqY6nI4mL88VqdRBKaMgQN/PbCQzI5 TsJoLIgU8cHk4Y8K4ahlZ2QeWcNH6Rsbt4oIPtwcpp1QgLqUeHNnITQY5tG2mwYhIZ ziqW1EU/X1K9gRSC6g8c/P8Lt1umQ0TlEybs2RMg= 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 5.19 420/717] dyndbg: drop EXPORTed dynamic_debug_exec_queries Date: Sat, 22 Oct 2022 09:24:59 +0200 Message-Id: <20221022072516.923693262@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747375980583302632?= X-GMAIL-MSGID: =?utf-8?q?1747375980583302632?= From: Jim Cromie [ Upstream commit e26ef3af964acfea311403126acee8c56c89e26b ] This exported fn is unused, and will not be needed. Lets dump it. The export was added to let drm control pr_debugs, as part of using them to avoid drm_debug_enabled overheads. But its better to just implement the drm.debug bitmap interface, then its available for everyone. Fixes: a2d375eda771 ("dyndbg: refine export, rename to dynamic_debug_exec_queries()") Fixes: 4c0d77828d4f ("dyndbg: export ddebug_exec_queries") Acked-by: Jason Baron Acked-by: Daniel Vetter Signed-off-by: Jim Cromie Link: https://lore.kernel.org/r/20220904214134.408619-10-jim.cromie@gmail.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- include/linux/dynamic_debug.h | 9 --------- lib/dynamic_debug.c | 29 ----------------------------- 2 files changed, 38 deletions(-) diff --git a/include/linux/dynamic_debug.h b/include/linux/dynamic_debug.h index f30b01aa9fa4..8d9eec5f6d8b 100644 --- a/include/linux/dynamic_debug.h +++ b/include/linux/dynamic_debug.h @@ -55,9 +55,6 @@ struct _ddebug { #if defined(CONFIG_DYNAMIC_DEBUG_CORE) -/* exported for module authors to exercise >control */ -int dynamic_debug_exec_queries(const char *query, const char *modname); - int ddebug_add_module(struct _ddebug *tab, unsigned int n, const char *modname); extern int ddebug_remove_module(const char *mod_name); @@ -221,12 +218,6 @@ static inline int ddebug_dyndbg_module_param_cb(char *param, char *val, rowsize, groupsize, buf, len, ascii); \ } while (0) -static inline int dynamic_debug_exec_queries(const char *query, const char *modname) -{ - pr_warn("kernel not built with CONFIG_DYNAMIC_DEBUG_CORE\n"); - return 0; -} - #endif /* !CONFIG_DYNAMIC_DEBUG_CORE */ #endif diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c index 4d168efcf779..c9b3d9e5d470 100644 --- a/lib/dynamic_debug.c +++ b/lib/dynamic_debug.c @@ -557,35 +557,6 @@ static int ddebug_exec_queries(char *query, const char *modname) return nfound; } -/** - * dynamic_debug_exec_queries - select and change dynamic-debug prints - * @query: query-string described in admin-guide/dynamic-debug-howto - * @modname: string containing module name, usually &module.mod_name - * - * This uses the >/proc/dynamic_debug/control reader, allowing module - * authors to modify their dynamic-debug callsites. The modname is - * canonically struct module.mod_name, but can also be null or a - * module-wildcard, for example: "drm*". - */ -int dynamic_debug_exec_queries(const char *query, const char *modname) -{ - int rc; - char *qry; /* writable copy of query */ - - if (!query) { - pr_err("non-null query/command string expected\n"); - return -EINVAL; - } - qry = kstrndup(query, PAGE_SIZE, GFP_KERNEL); - if (!qry) - return -ENOMEM; - - rc = ddebug_exec_queries(qry, modname); - kfree(qry); - return rc; -} -EXPORT_SYMBOL_GPL(dynamic_debug_exec_queries); - #define PREFIX_SIZE 64 static int remaining(int wrote) From patchwork Sat Oct 22 07:25: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: 7469 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1098991wrr; Sat, 22 Oct 2022 01:12:22 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6cJs87f/xYriX9oljZWv8VLU+mO/mjj/WS/5JwSKLVbAljczQsf7K3yBVywKWh0OtujFc8 X-Received: by 2002:a17:90b:3c8f:b0:20d:959b:26f4 with SMTP id pv15-20020a17090b3c8f00b0020d959b26f4mr27137533pjb.104.1666426342019; Sat, 22 Oct 2022 01:12:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666426342; cv=none; d=google.com; s=arc-20160816; b=VVdoSJ15a6TiUpjidyuxs7komGHFs/jHTHs2n5cV2kEfXXRJCLoJBUZh9/JcFxX2vZ ia0dwSsTNrkf+Xt7eCdFY0OsmyLre+rGA1DB6axY2QWgXoFaG09U8ZzOs0fI//6ykVtU oj1BWXtivdmQWWNFuZReRu1PZ/BI4Upb38yx5BttDc257/E6AP3bwR79RF3C2J5gxJK0 wNTHWD2FpHnplcgqQbGhKCOPPmMyeIFbsBZI0pLoo62ZgkHkpBn1rPay4sYDWBUmA8xn QwyoTky3yIUrVUroe12gA9pg0s4jOtsncwRamN+sq79pnDUAw/LCrMao3vlxHfFHarEg wzag== 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=3hPtnjY5rWdYITFgvZSt9J7knOxt/7RWxSWPe0ow0as=; b=b7q7iOm7f079PWgsM7wJIHeIDcP6eDHuKOL8HRw8Zcg/h5qISQzlq7rGZ9W6CdkD+L AEPI7cWmmdCrGE5Gj6Bnyhov9VNTmHiBeRxxTvbKkyiQHRBPCpAWQSMLsXVf7kp65pdh yW3JuPuQdcErvWEqwSscnERxHeDWbXxDodRLXVUvjNB9PuzE+iJvEsoBRfzmatL81bza Vgb//OS1exiOKYz6wIPuTaAJ8dbh9AwsblESRDWzD10S74gp0zvC/QuONO4c13dfhW/s NoPzXeiB/tqeaMMvMHG4r3JrA4voiBcfpVd1+RNy9w2umxqGWsH8l2tBYdJ6NagZfMfc VRzQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=G2XKskj5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 e13-20020a170902d38d00b0017a0a815e17si24881137pld.487.2022.10.22.01.12.10; Sat, 22 Oct 2022 01:12: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=G2XKskj5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S233243AbiJVILg (ORCPT + 99 others); Sat, 22 Oct 2022 04:11:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60038 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233375AbiJVIJl (ORCPT ); Sat, 22 Oct 2022 04:09:41 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 780672CA7CD; Sat, 22 Oct 2022 00:54: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 CE1CC60B89; Sat, 22 Oct 2022 07:53:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D9E84C433D6; Sat, 22 Oct 2022 07:53:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425195; bh=ZfDWuQNfaD4Mxq/Q6X3O0/xnPSophpyyQ8qJFF0+MYw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=G2XKskj5W2f/72cNuDRNP3M5OXeRygQT3kVGCtT2AQURCz0KTYML50UGe2ufRwIzH aGCseJyvAmRhltUHztdrOiXAShfs6ythBxwO6pGQWyrFFVJeubH6VS7yAvSYvii7HD tv/FIZIYlCNDHKSt7p3q/UvzuaVSoSRK21U6XrX8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dang Huynh , Dmitry Baryshkov , Bjorn Andersson , Sasha Levin Subject: [PATCH 5.19 421/717] clk: qcom: sm6115: Select QCOM_GDSC Date: Sat, 22 Oct 2022 09:25:00 +0200 Message-Id: <20221022072516.991440414@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747374668244850319?= X-GMAIL-MSGID: =?utf-8?q?1747374668244850319?= From: Dang Huynh [ Upstream commit 50ee65dc512b9b5c4de354cf3b4dded34f46c571 ] While working on the Fxtec Pro1X device, this error shows up with my own minimal configuration: gcc-sm6115: probe of 1400000.clock-controller failed with error -38 The clock driver depends on CONFIG_QCOM_GDSC and after enabling that, the driver probes successfully. Signed-off-by: Dang Huynh Fixes: cbe63bfdc54f ("clk: qcom: Add Global Clock controller (GCC) Reviewed-by: Dmitry Baryshkov Signed-off-by: Bjorn Andersson Link: https://lore.kernel.org/r/20220910170207.1592220-1-danct12@riseup.net Signed-off-by: Sasha Levin --- drivers/clk/qcom/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/clk/qcom/Kconfig b/drivers/clk/qcom/Kconfig index bc4dcf356d82..b1b141abc01c 100644 --- a/drivers/clk/qcom/Kconfig +++ b/drivers/clk/qcom/Kconfig @@ -637,6 +637,7 @@ config SM_DISPCC_6350 config SM_GCC_6115 tristate "SM6115 and SM4250 Global Clock Controller" + select QCOM_GDSC help Support for the global clock controller on SM6115 and SM4250 devices. Say Y if you want to use peripheral devices such as UART, SPI, From patchwork Sat Oct 22 07:25: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: 7767 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1121024wrr; Sat, 22 Oct 2022 02:27:16 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7tx7t91KZQcTClRTnTtv+5av7QdcRO5/l0++2jGa0ZbEfXH1eI+4nUHd2tfMlI5Ck8afSM X-Received: by 2002:a17:903:234f:b0:17f:6711:1f9f with SMTP id c15-20020a170903234f00b0017f67111f9fmr22639378plh.32.1666430835978; Sat, 22 Oct 2022 02:27:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666430835; cv=none; d=google.com; s=arc-20160816; b=OyWZBqZwJAStsH19nZSTCnL5ht55a7OO/FLL3HdVWE3mrBUWBSAkrYcPmq+HAVigJp PxENAxf3538cdp1JEAN3VS72vyrOxq2u9ev5yCfaNf05HDV4c71eMZPvc2sRoMtR96CA 9+1GXOF2cbB+cNco9B2TdRNR6fJi4YiCJO3v7eRlJvFDsVib7v/KaSm7sq8OKknP6XJQ PnxM0UkNH14HZM9dp3GE+LsqIkS6gf3LeI1FnvBBksrVsFb/qHEpaBLaEndgC7neUrsQ rW1/bH15UUNpLORZRKzuAEhjFIVwJRZW64q1GixgJ7ZrulCdUv7syRb2TyuDFakuHCcy k4lw== 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=WjoXa8Zt14lxad46j760H2XqKZUIdxZYDgFPK+9gOJ0=; b=uGr+ByWuZrZ1ZPFd4Ikhdvdtj3H1/pHyRnhaJY/m60O4F9Xyxd/jt9FGKgK8PCy4ds MquqA2zDSgEndLC+ffRCYhT3+nFJxcjwEbaMy0RWZoT8XPw3jzdSN7I5iZE6nirpw+RN zWOzt2VWpnl4BfBI4lii/ZjX/8xTPaYMfSUqACYnHCEwdTYuD+fkPS+pjUzkdkNOnRhz u4rwMYbHeER5x9FI/fgcLmCBHoGNZYHTsgKFBEfo1FI4396g2E5OXRTRs5ZlXGRDabmb /aqnl/GFwLt3eXPVtRYZpaCploYI7iX436L/SQeE0qTj2d3jIwKJPAuTaI3Cwg12iDJc cofw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=hOjJVgEf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 me8-20020a17090b17c800b001fd7cab081bsi2756247pjb.125.2022.10.22.02.27.03; Sat, 22 Oct 2022 02:27: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=hOjJVgEf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S230483AbiJVJFL (ORCPT + 99 others); Sat, 22 Oct 2022 05:05:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37880 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235091AbiJVJDo (ORCPT ); Sat, 22 Oct 2022 05:03:44 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C70DA2FA5CC; Sat, 22 Oct 2022 01:18: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 3FF7760B89; Sat, 22 Oct 2022 07:55:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 52F31C4314C; Sat, 22 Oct 2022 07:55:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425320; bh=d4xHh/EUCkCOVmUiHgDNQoi2lFnlAt1QKWLdSYAR6Ls=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hOjJVgEfrCMMqjzeoHIvcXTA1aW8xUgqnn7Cl50jmtEc3/tmWpaeAel2BxrRMCIdU b7zRulekcm5mHEwdbTNNjEzPnqObb6WqwsxxDeqsLx9vN0PzkrhzXaBXhcLtCFzZe3 ozJYmWTj6smB3oil7MqQ/y8StrSmxRO8KYnOnqyI= 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 5.19 422/717] mtd: devices: docg3: check the return value of devm_ioremap() in the probe Date: Sat, 22 Oct 2022 09:25:01 +0200 Message-Id: <20221022072517.050464932@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747379380256924877?= X-GMAIL-MSGID: =?utf-8?q?1747379380256924877?= 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 5b0ae5ddad74..27c08f22dec8 100644 --- a/drivers/mtd/devices/docg3.c +++ b/drivers/mtd/devices/docg3.c @@ -1974,9 +1974,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 Sat Oct 22 07:25: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: 7575 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1106206wrr; Sat, 22 Oct 2022 01:37:16 -0700 (PDT) X-Google-Smtp-Source: AMsMyM70Pe0jZyW81TtZPRcUZP7S1KI1L3H3bnS3I6Zy9/HWXoYo4g6KK2P06SWx8qbFZ5shcMHo X-Received: by 2002:a17:907:2ceb:b0:78d:b765:c50d with SMTP id hz11-20020a1709072ceb00b0078db765c50dmr19075888ejc.73.1666427836220; Sat, 22 Oct 2022 01:37:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666427836; cv=none; d=google.com; s=arc-20160816; b=arQQYxbIESYzX5/NiPaVV2uEcvSXcFWvBmbdd6+sN1tzewMneQmexhDjgtXuobo+HZ qhha5UMxhew4u/DaeJDk4uTRGcfAH74F3K/JMMO4I5QRx7oJxmbyPNGMLEfoUV2MDR3T qd1/m6xSi84nVGVfxXd6cNi1abaZrL1n3cpTgCVG/4LZPJ1jAOSOyzWf+1LqsaDlvVEG bSA/rlnmExOeXED0vVz6aRXheKIEKs81Uzd2RJN4SIYD3uu1cUlHfyfmjHr24oT1leNF DqxnCRwn8pe5QKkOIaN8QAzL4j0gbZmvaU3tfrACo2UXi7WOBRIFBp7fT6pt+Sbb4kDK VEnw== 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=3OXnaUtfx85+PCDsFTyfPyDgLo+UACYInkWFlZ9sq9Y=; b=lFtfjZR6hB/1Z9CBThvIRfxoM03SO/mvySDHd7r5diK5+kEJI0ombo/bx5IlfeybX1 7aMITtioti8VIi++f9dq1rBhFtAZt6MB2L1t8k0iueBkbTjI8bgY0f/+E0ulDtR2IewR gCmlPlSoUJVYhiYdQ71NBMNDQ4OyZCJ/58UAmwryT6qiiICR0Jp0Bn9DaTRm2NC3Q1QH Wqr7iA/F/uTOqTWn3kONkzZMmOd/8h0cDAvBZ8reHxXOgEVoqFTGiBkTyJc2j9ugC4wn qe0oleWoIAYHVYOFGeoqADfAaQccUJe0q6ppOqvOzAa0w0Bc6wR4CoWl52DixQ/UZzPM VUng== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=HR5RZGFM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 jg37-20020a170907972500b00791a37e665esi11557577ejc.10.2022.10.22.01.36.49; Sat, 22 Oct 2022 01:37: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=HR5RZGFM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S234028AbiJVIcY (ORCPT + 99 others); Sat, 22 Oct 2022 04:32:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37082 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234024AbiJVI3O (ORCPT ); Sat, 22 Oct 2022 04:29:14 -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 D63F512D01; Sat, 22 Oct 2022 01:01: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 4177CB82E03; Sat, 22 Oct 2022 07:53:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 76F97C433D6; Sat, 22 Oct 2022 07:53:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425219; bh=b7nk5n+pn5dwuzcRGHt+Ga4aNSHt99eeLerkhnMnA88=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HR5RZGFMilMd19a7QviZsj8gTcu4W8Q3KGEFK9dn9YW9ZDaDgA6pl4AxhgHnLBITp 4eHl8Ew9YchOSYcYSq+cDe96eumNKjB1FbpYoumIg1jXHRDY+VlpEd/pcPVcF95lS+ G6Lc9nd72l44KNsNdOvee6+akIVrRl+WhHdMRpVI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dan Carpenter , "Gustavo A. R. Silva" , Mukesh Ojha , Mathieu Poirier , Sasha Levin Subject: [PATCH 5.19 423/717] remoteproc: Harden rproc_handle_vdev() against integer overflow Date: Sat, 22 Oct 2022 09:25:02 +0200 Message-Id: <20221022072517.109421152@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376234896113674?= X-GMAIL-MSGID: =?utf-8?q?1747376234896113674?= From: Dan Carpenter [ Upstream commit 7d7f8fe4e399519cc9ac68a475fec6d3a996341b ] The struct_size() macro protects against integer overflows but adding "+ rsc->config_len" introduces the risk of integer overflows again. Use size_add() to be safe. Fixes: c87846571587 ("remoteproc: use struct_size() helper") Signed-off-by: Dan Carpenter Reviewed-by: Gustavo A. R. Silva Reviewed-by: Mukesh Ojha Link: https://lore.kernel.org/r/YyMyoPoGOJUcEpZT@kili Signed-off-by: Mathieu Poirier Signed-off-by: Sasha Levin --- drivers/remoteproc/remoteproc_core.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/remoteproc/remoteproc_core.c b/drivers/remoteproc/remoteproc_core.c index 02a04ab34a23..9d86470df79b 100644 --- a/drivers/remoteproc/remoteproc_core.c +++ b/drivers/remoteproc/remoteproc_core.c @@ -518,12 +518,13 @@ static int rproc_handle_vdev(struct rproc *rproc, void *ptr, struct fw_rsc_vdev *rsc = ptr; struct device *dev = &rproc->dev; struct rproc_vdev *rvdev; + size_t rsc_size; int i, ret; char name[16]; /* make sure resource isn't truncated */ - if (struct_size(rsc, vring, rsc->num_of_vrings) + rsc->config_len > - avail) { + rsc_size = struct_size(rsc, vring, rsc->num_of_vrings); + if (size_add(rsc_size, rsc->config_len) > avail) { dev_err(dev, "vdev rsc is truncated\n"); return -EINVAL; } From patchwork Sat Oct 22 07:25: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: 7482 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1104381wrr; Sat, 22 Oct 2022 01:31:46 -0700 (PDT) X-Google-Smtp-Source: AMsMyM51eYvt8dejFz55RAwnCBKBWLTuWHEq9RYLO6klLAQ6GgAeaBYyv5iytaemndv2oy2q/g0U X-Received: by 2002:a17:90b:2643:b0:205:bd0d:bdff with SMTP id pa3-20020a17090b264300b00205bd0dbdffmr26433062pjb.99.1666427506022; Sat, 22 Oct 2022 01:31:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666427506; cv=none; d=google.com; s=arc-20160816; b=A8ThleO1yCzTNeozn7r3Q0L0LvkTVwA8HUcXDSS/XmQkddUrbXTFGqlkxaB0fNnl/A btxlDpykccsz2UwGf/zacIzxEJlD8UBWn0CnLkyj6UFwyqTgHzIuHwZBIbuEDHrQUP1m 3jCCt4/DTe4A784KOd9gecxaGmtxmLu8MArK+7TBpop6WMmeKtN23NcUBpfZyGR6Fsfl mSSZmigvxmJ5LQNGoC/QEmI6R71UOlftBSkdN0xW4rsdHrUTmBazc1QMoBpH22IwL6g3 AGEXEkIaT1rP4B0Vzj3U7iSsd5qc6Wuy/4AEK2WlXHJlv4mYKHiTU6ng15h2hJqZobeT /t0w== 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=b+5GxKKMva9AUUqwKXre1iUt58LUAQDxqegFIE1qj5s=; b=gLEtiqRQP+UDVtjy0Wcgeg72+AtX02o2O0E/77yrqxzRNYw7WgmRoH7yT0ImcPyN1u Py1NnyvV9DjJRqeVAPlMfHzw/EOw3TdlAwe2dg7X5Gagrvx0n5UU3Rni8r+VtABtoAd+ vhMFBrW46/AU5gIvXFa7mX/P9vZauiFguM5s4W8FFAPaMVJA65lTYQjFfCHZgv2Umtdz WF6xzEFDL7XD8ODjbzKRrrVCFj5xbzaVuIdjioNviA7fzCGyr72BxvKv9hY7mk6r8hcK PipGUJe+YDGY7f8Lrlc0StPp3Pf2KGFQMvXThlTkGdQDhP+1U41Au7Cqt6PIEy0Aovo8 n3XQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=qzDLZY7i; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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-20020a170902eccb00b00176db576dc0si33535273plh.147.2022.10.22.01.31.33; Sat, 22 Oct 2022 01:31: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=qzDLZY7i; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S233350AbiJVIMa (ORCPT + 99 others); Sat, 22 Oct 2022 04:12:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55340 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233036AbiJVIKX (ORCPT ); Sat, 22 Oct 2022 04:10:23 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D6ADC33A2B; Sat, 22 Oct 2022 00:54: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 4809060B90; Sat, 22 Oct 2022 07:54:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 36A3BC433C1; Sat, 22 Oct 2022 07:54:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425255; bh=mPVjszT3wboNXS/Hfwq1BXiLQmXtBUP5WVrK5S+6wHQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qzDLZY7iXNC1M1E6l98n6mnf6/gelwi7XGeuaqqzHeD78AmxDTWCJoAsFIcraPh29 cvqRpjotvKmBc5zsaIgDm16mzWUSP+1x9z8FJUkSxycNXTRFqAWLPZinljNlVM9Cr3 xHdsTuMsFJzdUHRARM06Hwu3FQMtwjbzjonWYzr4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Liang He , Vinod Koul , Sasha Levin Subject: [PATCH 5.19 424/717] phy: amlogic: phy-meson-axg-mipi-pcie-analog: Hold reference returned by of_get_parent() Date: Sat, 22 Oct 2022 09:25:03 +0200 Message-Id: <20221022072517.169860831@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747375888385059791?= X-GMAIL-MSGID: =?utf-8?q?1747375888385059791?= From: Liang He [ Upstream commit c4c349be07aeec5f397a349046dc5fc0f2657691 ] As the of_get_parent() will increase the refcount of the node->parent and the reference will be discarded, so we should hold the reference with which we can decrease the refcount when done. Fixes: 8eff8b4e22d9 ("phy: amlogic: phy-meson-axg-mipi-pcie-analog: add support for MIPI DSI analog") Signed-off-by: Liang He Link: https://lore.kernel.org/r/20220915093506.4009456-1-windhl@126.com Signed-off-by: Vinod Koul Signed-off-by: Sasha Levin --- drivers/phy/amlogic/phy-meson-axg-mipi-pcie-analog.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/phy/amlogic/phy-meson-axg-mipi-pcie-analog.c b/drivers/phy/amlogic/phy-meson-axg-mipi-pcie-analog.c index 1027ece6ca12..a3e1108b736d 100644 --- a/drivers/phy/amlogic/phy-meson-axg-mipi-pcie-analog.c +++ b/drivers/phy/amlogic/phy-meson-axg-mipi-pcie-analog.c @@ -197,7 +197,7 @@ static int phy_axg_mipi_pcie_analog_probe(struct platform_device *pdev) struct phy_provider *phy; struct device *dev = &pdev->dev; struct phy_axg_mipi_pcie_analog_priv *priv; - struct device_node *np = dev->of_node; + struct device_node *np = dev->of_node, *parent_np; struct regmap *map; int ret; @@ -206,7 +206,9 @@ static int phy_axg_mipi_pcie_analog_probe(struct platform_device *pdev) return -ENOMEM; /* Get the hhi system controller node */ - map = syscon_node_to_regmap(of_get_parent(dev->of_node)); + parent_np = of_get_parent(dev->of_node); + map = syscon_node_to_regmap(parent_np); + of_node_put(parent_np); if (IS_ERR(map)) { dev_err(dev, "failed to get HHI regmap\n"); From patchwork Sat Oct 22 07:25: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: 7484 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1104716wrr; Sat, 22 Oct 2022 01:33:11 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4s8lw0oo2jLmJR9GtokCd7DCi6v1EagScyY58ZeVAVlhcHPHd2tV/33xacn1xXZKcEgkCa X-Received: by 2002:a65:6e0d:0:b0:42d:707c:94ee with SMTP id bd13-20020a656e0d000000b0042d707c94eemr19036750pgb.260.1666427590797; Sat, 22 Oct 2022 01:33:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666427590; cv=none; d=google.com; s=arc-20160816; b=G0qCOptFfVlJd5wf7u/fnP2BbQSAKEjAAtVrxUAMnb4BawDN7pxtZvx1DMyqL4BmKQ AekysMJVAcdg47vffZNLW4k7hlQUVgZ3qLDJEo0lI/9h7RYIZ7tvNA23mh/Ej5lIc3EA lOyg1/jG6XTPKi2ANLfxAEsrlLpqGagSnLRNOlbo64b0IsF1fs63k3OHqFqrj2OYWuFW TXU/dF+zgaMXKywOI+6AlV89Ib0TKAdoHxSqMmrV2K11BJomb7phob6dEKbGbaR3xVpW wQ1sAiUPLgyl8gxLb+p2LqsW+8Xx05x5jJj6OOAt3rtchpxmg4YuvzqnicfCfwmr/FWl xiig== 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=cCN4ryWoc/Wc2GzjGDNwJlDAbUrfOv18RRlOtznM2AA=; b=isnlpxIIqhsoU7nUvHPYy37kT+66uQhl0t7g1mxb4VhVZ/CyIfRyBYq5VnV11CcDL0 XWhIQwSh7+U0qiANnQhjxj3Z3X3C4Jd7rpW/yYyc2u1pvChMfOrciA1xGuIznLYQE2kG xCIq0asS4vG5M1Ijt8kDjSwHmIAiun83KlZvoEimq+1CrZY7eJ2OTK03qfehDipCpesN VLsIiKkIEcSB0qUcQJRdIazD9hma62Fh0W51MKRtqC/QCAYjM61be81A25S+8ffz0Apt uYGVR36KdHRSjatqm+BSODr2dPR2BBf3PX8Nx6VaK3j2m2PysMzsEHL4My0Om3d8bpn1 4vAA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=OQhlTRgJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 o15-20020a17090a3d4f00b0020addb2c6e7si2285822pjf.85.2022.10.22.01.32.57; Sat, 22 Oct 2022 01:33: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=OQhlTRgJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S234135AbiJVIQV (ORCPT + 99 others); Sat, 22 Oct 2022 04:16:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57594 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233146AbiJVIL5 (ORCPT ); Sat, 22 Oct 2022 04:11:57 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DF9D855094; Sat, 22 Oct 2022 00:54:52 -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 3BA0560B30; Sat, 22 Oct 2022 07:54:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 35334C433D6; Sat, 22 Oct 2022 07:54:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425289; bh=joD3mbfUiz/qsnrMG3CKx0XowThncKwMs1kwZheyZHE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OQhlTRgJQ33FvndK2U3lI6Q1bc6uBN2wQmsXw2wZEa/d6J3R4ti5NiBTSRVqm/0+w zTfpxnloPVILawKVtQ8s+schz+RgwuEfKsGiV56akpFr1aCxzqlqwnDGQk+l9beR+M uPY5nx2Bs1STT5QFMYnEnw/fzUD+BUWeL5heEo5Q= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Chunfeng Yun , AngeloGioacchino Del Regno , Vinod Koul , Sasha Levin Subject: [PATCH 5.19 425/717] phy: phy-mtk-tphy: fix the phy type setting issue Date: Sat, 22 Oct 2022 09:25:04 +0200 Message-Id: <20221022072517.221613126@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747375977445812109?= X-GMAIL-MSGID: =?utf-8?q?1747375977445812109?= From: Chunfeng Yun [ Upstream commit 931c05a8cb1be029ef2fbc1e4af313d4cb297c47 ] The PHY type is not set if the index is non zero, prepare type value according to the index, like as mask value. Fixes: 39099a443358 ("phy: phy-mtk-tphy: support type switch by pericfg") Signed-off-by: Chunfeng Yun Reviewed-by: AngeloGioacchino Del Regno Link: https://lore.kernel.org/r/20220914060746.10004-7-chunfeng.yun@mediatek.com Signed-off-by: Vinod Koul Signed-off-by: Sasha Levin --- drivers/phy/mediatek/phy-mtk-tphy.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/phy/mediatek/phy-mtk-tphy.c b/drivers/phy/mediatek/phy-mtk-tphy.c index 8ee7682b8e93..bdffc21858f6 100644 --- a/drivers/phy/mediatek/phy-mtk-tphy.c +++ b/drivers/phy/mediatek/phy-mtk-tphy.c @@ -906,7 +906,7 @@ static int phy_type_syscon_get(struct mtk_phy_instance *instance, static int phy_type_set(struct mtk_phy_instance *instance) { int type; - u32 mask; + u32 offset; if (!instance->type_sw) return 0; @@ -929,8 +929,9 @@ static int phy_type_set(struct mtk_phy_instance *instance) return 0; } - mask = RG_PHY_SW_TYPE << (instance->type_sw_index * BITS_PER_BYTE); - regmap_update_bits(instance->type_sw, instance->type_sw_reg, mask, type); + offset = instance->type_sw_index * BITS_PER_BYTE; + regmap_update_bits(instance->type_sw, instance->type_sw_reg, + RG_PHY_SW_TYPE << offset, type << offset); return 0; } From patchwork Sat Oct 22 07:25: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: 7845 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1154029wrr; Sat, 22 Oct 2022 04:07:22 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6cVF4pdbyHK3ffMDb+RLz1s6GYKGDJSUkEQcGzhgJ86LIEXgIHjtda+samNaFdjI+G8ztb X-Received: by 2002:a17:907:2e0d:b0:78e:314:9d88 with SMTP id ig13-20020a1709072e0d00b0078e03149d88mr19784412ejc.54.1666436842838; Sat, 22 Oct 2022 04:07:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666436842; cv=none; d=google.com; s=arc-20160816; b=R2XiON3Y25Kmhr66pbQ7A6N9JQv8Wbe8Feypc/N20401Nwn13Mtm4MSxSSrLZQTd5H q7oE7mr74LOCs/F1nIExJQUgGHtr3CJS2UtSmcoMe/AECM9iiyHQYzbmw5nu2Gjxqpy7 +ngwT6IMQC12pQRd/FbRYLUYQyDYk8pXSrvCIa/6lt3iP/cYmj4JmePVi7TFGj8CSdlT 6QI7yqLoi6x32M/UD326WOFM/Zbes09vuvHOyaFzih4HiaPG/sFYBDQunuGQ9IyrIzV+ XsHjLHJ8rqfrLK/+M4+FuMqvt5UrI5avIdkPKCQD2JSx1ksQqHPJyMoKVmAyvcUXcpWf 90ig== 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=cpMcjDTV9x8uURe/ZNs17adrE3pPe29XLOyQVuyJoNE=; b=gOlebzIzwG1QYSq+qQi3PzNHw9ZFUcpa6+PXQdhD5wnaBgz0pVI3R5blwKxXYwy/aK zydTki3SbNcBJSfWmuTyicM3zJedupz4CR8CWnot27le+iLs7q88rGvr3DSYx6e//PzH bYwSPviLkuFppG8j+EC2KbEA3Aeuc8e1lbqeN1Ft81Ed1w2DiT7XiYjOP0wUgKnXLXCJ RyPnr1CSZhBNSMe3Bdiyy9k68QJEISpeBsyAMw8SgSdjBTZ9wjF2kmzcgj3wCRIMhOIY xWh72zdeUfpRT/JYNf9HG42Q2jNrOufYzgwc9aWLWUCrZZ6wCNSvysUlLUyHzyMybKv1 Kj3g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=JTaNWvZs; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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-20020a056402050f00b00457fc1bcf12si19667078edv.183.2022.10.22.04.06.59; Sat, 22 Oct 2022 04:07: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=JTaNWvZs; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S230526AbiJVLDQ (ORCPT + 99 others); Sat, 22 Oct 2022 07:03:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52042 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229707AbiJVLCk (ORCPT ); Sat, 22 Oct 2022 07:02:40 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F3F9D2FA5FA; Sat, 22 Oct 2022 03:21: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 88A69B82E0B; Sat, 22 Oct 2022 07:55:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D19C4C433C1; Sat, 22 Oct 2022 07:55:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425301; bh=9BePWnK8/VkHjNuHRA8V9IPoLddrvuN0dJOkG015dOo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JTaNWvZsEa3Gjz4Jq5Q0SqKR7JD/X8pS+SLitewNRRR+QSXSGXNlqPmmJLyOKhCLa SmLw7bb2fqxUEHJQZaNlQzZYN1FxINAW/f218Z/YfNk3wrEA1IgmNqe6gBwftD7UYx KvfgVGBDvvzsvV4Z08I34rnlGv5rcRODSbmIw3eY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Martin Blumenstingl , Miquel Raynal , Sasha Levin Subject: [PATCH 5.19 426/717] mtd: rawnand: intel: Read the chip-select line from the correct OF node Date: Sat, 22 Oct 2022 09:25:05 +0200 Message-Id: <20221022072517.275649060@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 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?1747385678978165764?= X-GMAIL-MSGID: =?utf-8?q?1747385678978165764?= From: Martin Blumenstingl [ Upstream commit bfc618fcc3f167ad082053e81e9d664e724c6288 ] The chip select has to be read from the flash node which is a child node of the NAND controller. Fixes: 0b1039f016e8a3 ("mtd: rawnand: Add NAND controller support on Intel LGM SoC") Signed-off-by: Martin Blumenstingl Signed-off-by: Miquel Raynal Link: https://lore.kernel.org/linux-mtd/20220702231227.1579176-4-martin.blumenstingl@googlemail.com Signed-off-by: Sasha Levin --- drivers/mtd/nand/raw/intel-nand-controller.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/drivers/mtd/nand/raw/intel-nand-controller.c b/drivers/mtd/nand/raw/intel-nand-controller.c index e91b879b32bd..3df3f32423f9 100644 --- a/drivers/mtd/nand/raw/intel-nand-controller.c +++ b/drivers/mtd/nand/raw/intel-nand-controller.c @@ -16,6 +16,7 @@ #include #include +#include #include #include #include @@ -580,6 +581,7 @@ static int ebu_nand_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; struct ebu_nand_controller *ebu_host; + struct device_node *chip_np; struct nand_chip *nand; struct mtd_info *mtd; struct resource *res; @@ -604,7 +606,12 @@ static int ebu_nand_probe(struct platform_device *pdev) if (IS_ERR(ebu_host->hsnand)) return PTR_ERR(ebu_host->hsnand); - ret = device_property_read_u32(dev, "reg", &cs); + chip_np = of_get_next_child(dev->of_node, NULL); + if (!chip_np) + return dev_err_probe(dev, -EINVAL, + "Could not find child node for the NAND chip\n"); + + ret = of_property_read_u32(chip_np, "reg", &cs); if (ret) { dev_err(dev, "failed to get chip select: %d\n", ret); return ret; @@ -660,7 +667,7 @@ static int ebu_nand_probe(struct platform_device *pdev) writel(ebu_host->cs[cs].addr_sel | EBU_ADDR_MASK(5) | EBU_ADDR_SEL_REGEN, ebu_host->ebu + EBU_ADDR_SEL(cs)); - nand_set_flash_node(&ebu_host->chip, dev->of_node); + nand_set_flash_node(&ebu_host->chip, chip_np); mtd = nand_to_mtd(&ebu_host->chip); if (!mtd->name) { From patchwork Sat Oct 22 07:25: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: 7669 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1108233wrr; Sat, 22 Oct 2022 01:43:59 -0700 (PDT) X-Google-Smtp-Source: AMsMyM45328Z59uY4osGHxVaLGQeoZ2wYe5bq8WMD6PMK6TmxgqvRdgmxeeC+IAr+dVU8HIpuhLK X-Received: by 2002:a17:907:3d9e:b0:791:8933:f9fc with SMTP id he30-20020a1709073d9e00b007918933f9fcmr19447158ejc.111.1666428239507; Sat, 22 Oct 2022 01:43:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666428239; cv=none; d=google.com; s=arc-20160816; b=NEVlqFF74UATaL1UNFLbzhLDEezmxb+btmqyTFAZHwq7uO3ryoYwnmS9tp0ui467qZ KuImoMfi4efIQWAEDfgHk9q+eIbEtU6V1riOLv1bSQe3HwnN6NADvh6ebVG6tg7GIziC T+FqmxmFKWqwt8HPos64DolJeNELTzOtfDR1ZYWgMmQ9KhvH1zF/Y9YzLo4AeKSngKWL lkAnBcAkFk2tdZeZgMjUTHPDeXzsVDnD9VMTyN6xq2iuI67re370KuF+io43iRT0I5oA jk89rnrBHiuwlKtAMcFR/sUfTVhEbBy1dZEwNA/upoA5sZWbwWBgii21Kjsh8yz4uxUg hlSg== 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=cstszvTH+x0VbidHtB7mmVeReYCiuZlP3o1Ahlyj3N0=; b=YbO9590+nz0cCDUAeQ5q3VFWkV6MWGXAVD+bUqREMGz4Bv/ffbOPgWsHzJ4S+R2BC9 lGdFMxwFvr4lfYeXtyHppRNKAjnDsu1ZrIPk+FSYd9MiBkJ2Hal3/LW7Wh9ERXKkPJME 4hKlosItPQtUZG9+vl9zqrw83HkENgjfWcQgITvpH8Ops4GN0EssrNukzygEd/6Krtru O2oqtSV+o/0ZkJNoLXWIqbLnGW/OarV+lpzX029Eve2UA8IwfPZLPhep3JKp/fu5C74K U++Uw4SZjQUWRfjUZVqByCSmr28svJHF0gfmhhCN9C7yIEl03dXKmh6CzO/W2y+FwuXo N/CA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Joqec5TS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 hz6-20020a1709072ce600b00791a67e4c04si9511558ejc.31.2022.10.22.01.43.34; Sat, 22 Oct 2022 01:43: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=Joqec5TS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S234740AbiJVImh (ORCPT + 99 others); Sat, 22 Oct 2022 04:42:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52126 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234848AbiJVIkZ (ORCPT ); Sat, 22 Oct 2022 04:40:25 -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 5B6812D446C; Sat, 22 Oct 2022 01:06: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 C178A60B4D; Sat, 22 Oct 2022 07:55:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C5398C4314C; Sat, 22 Oct 2022 07:55:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425304; bh=qv6GhL++iCfHg3FVW2VZhiZ6RiB16PZ7hQc1kPHkqT8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Joqec5TSQvDMyuNv+hs4Pyc64oBftmnpyq561RLU9/ICHJKYoSfblbgdYloW9cn1K tonMOxp4uGB2OLr67qy89ps/IWqCuw7vWCveuaxgU9rEuOJvN/+SXsKx3KXtHj/5jp VlT9nhOY2FpOeisuVaRpcVtlGwQiZO9lxl9m8F5M= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Martin Blumenstingl , Miquel Raynal , Sasha Levin Subject: [PATCH 5.19 427/717] mtd: rawnand: intel: Remove undocumented compatible string Date: Sat, 22 Oct 2022 09:25:06 +0200 Message-Id: <20221022072517.324662751@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376657569810730?= X-GMAIL-MSGID: =?utf-8?q?1747376657569810730?= From: Martin Blumenstingl [ Upstream commit 68c02ebaa34d41063ccbbc789a352537ddc3cd8a ] The "intel,nand-controller" compatible string is not part of the dt-bindings. Remove it from the driver as it's not supposed to be used without any documentation for it. Fixes: 0b1039f016e8a3 ("mtd: rawnand: Add NAND controller support on Intel LGM SoC") Signed-off-by: Martin Blumenstingl Signed-off-by: Miquel Raynal Link: https://lore.kernel.org/linux-mtd/20220702231227.1579176-5-martin.blumenstingl@googlemail.com Signed-off-by: Sasha Levin --- drivers/mtd/nand/raw/intel-nand-controller.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/mtd/nand/raw/intel-nand-controller.c b/drivers/mtd/nand/raw/intel-nand-controller.c index 3df3f32423f9..056835fd4562 100644 --- a/drivers/mtd/nand/raw/intel-nand-controller.c +++ b/drivers/mtd/nand/raw/intel-nand-controller.c @@ -723,7 +723,6 @@ static int ebu_nand_remove(struct platform_device *pdev) } static const struct of_device_id ebu_nand_match[] = { - { .compatible = "intel,nand-controller" }, { .compatible = "intel,lgm-ebunand" }, {} }; From patchwork Sat Oct 22 07:25: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: 7487 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1104756wrr; Sat, 22 Oct 2022 01:33:19 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4wGavESPlwb47DZKuXSCKpTpulWaKiMVtsW33pnJ47BuJVgNstDMPkBakNK2TjwHFbxcDx X-Received: by 2002:a05:6a00:13a1:b0:563:4c5:c3dd with SMTP id t33-20020a056a0013a100b0056304c5c3ddmr23732216pfg.5.1666427598877; Sat, 22 Oct 2022 01:33:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666427598; cv=none; d=google.com; s=arc-20160816; b=B7GqWPqEAcgHA0Fp5I1TcDlqlWxsh5TlbOYNlsVRUmwwbqRV1sMJIi4gz0fETEZghH pNAn/9nH5tCAFXJubukwSbW+L5AGXl82bFZrA6jOXUhk7igEMOUQipPpZSlEhNmQDkI0 6NUte8h7T8MbhTAPUwitK5gHVP0G+mAXvdMPAGQXGZxsAgNQyYmWyop8ASYVFJprqC5s JtkcbUSdLlDBoWYuf5j2+yalwBXm5k+8VyE3729dxeawPkZ6ufuv7MnOmYAnVLcT6zE3 +QA8X67s8diZ875AwPp1j2aK3O1jBPHaVfmL5+5+P50waX1j+/4ico25rwXm7AAKbV9J 05dg== 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=Ogp5IC53I/2HrgAV8Jz/BBsPe8LoVHks+gjNFQThP1Y=; b=eP23l9KQsz2wqpAKZYn7/MiWXUFHTl0p8vz/yU+OlSLAhHUa1bUGMTcB3eM+TVZjUf 4P3H8JrlkPOHKh9bVr/K0J0Li1cO6zapxo+HxVM1lpPf6ckcPgwDhPQahuh1uL/2/qch Bt9WqNqGjbuhuUT558wByS1fgQCQ8zwhqVZ1oheqT/ia7U32ygNXvY2oFgnw7aHgPs/q m0/fjU/hHb57i0ER9ZxNvSgk8xg4sYGW9DtL0iTnilJm2U/So1NfYkTACltMN6XNFtcc fE13a06LU97GekyOVNkqcOTRkLeTzGjYfKF+d7x5DMug5JUyMs3zRCD1bt+g0N6rnYRA Mfhw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=1t5E43vE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 z1-20020a170903018100b0017336c464ecsi30560752plg.407.2022.10.22.01.33.03; Sat, 22 Oct 2022 01:33: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=1t5E43vE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S233394AbiJVIQs (ORCPT + 99 others); Sat, 22 Oct 2022 04:16:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48236 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233599AbiJVIOd (ORCPT ); Sat, 22 Oct 2022 04:14:33 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F28BE18F275; Sat, 22 Oct 2022 00:55: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 92B0DB82E1F; Sat, 22 Oct 2022 07:55:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B1F0BC433C1; Sat, 22 Oct 2022 07:55:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425307; bh=WFVjG+q3vUFosN6VOG2U+vIcJlTIVoQCqEg0IL9VlxE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1t5E43vE5o/Dp2mito80Rv7OfYpC7QPbFKT7+gxpAdj1aQttrd1U8U4i3eqy4B12c 4K9+SLt+TIS8XHhYvlUooLa9V9OKpSAWosm9QN98VyyrN8mJMVS8+3kvL2dK+tRD65 nMxQGev8LVr7La4v1Pc2uSareaurSG/prBSdHX00= 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?= , =?utf-8?q?Marek_Beh=C3=BAn?= , Miquel Raynal , Sasha Levin Subject: [PATCH 5.19 428/717] mtd: rawnand: fsl_elbc: Fix none ECC mode Date: Sat, 22 Oct 2022 09:25:07 +0200 Message-Id: <20221022072517.367302516@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747375985900404263?= X-GMAIL-MSGID: =?utf-8?q?1747375985900404263?= From: Pali Rohár [ Upstream commit 049e43b9fd8fd2966940485da163d67e96ee3fea ] Commit f6424c22aa36 ("mtd: rawnand: fsl_elbc: Make SW ECC work") added support for specifying ECC mode via DTS and skipping autodetection. But it broke explicit specification of HW ECC mode in DTS as correct settings for HW ECC mode are applied only when NONE mode or nothing was specified in DTS file. Also it started aliasing NONE mode to be same as when ECC mode was not specified and disallowed usage of ON_DIE mode. Fix all these issues. Use autodetection of ECC mode only in case when mode was really not specified in DTS file by checking that ecc value is invalid. Set HW ECC settings either when HW ECC was specified in DTS or it was autodetected. And do not fail when ON_DIE mode is set. Fixes: f6424c22aa36 ("mtd: rawnand: fsl_elbc: Make SW ECC work") Signed-off-by: Pali Rohár Reviewed-by: Marek Behún Reviewed-by: Marek Behún Signed-off-by: Miquel Raynal Link: https://lore.kernel.org/linux-mtd/20220707184328.3845-1-pali@kernel.org Signed-off-by: Sasha Levin --- drivers/mtd/nand/raw/fsl_elbc_nand.c | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/drivers/mtd/nand/raw/fsl_elbc_nand.c b/drivers/mtd/nand/raw/fsl_elbc_nand.c index aab93b9e6052..a18d121396aa 100644 --- a/drivers/mtd/nand/raw/fsl_elbc_nand.c +++ b/drivers/mtd/nand/raw/fsl_elbc_nand.c @@ -726,36 +726,40 @@ static int fsl_elbc_attach_chip(struct nand_chip *chip) struct fsl_lbc_regs __iomem *lbc = ctrl->regs; unsigned int al; - switch (chip->ecc.engine_type) { /* * if ECC was not chosen in DT, decide whether to use HW or SW ECC from * CS Base Register */ - case NAND_ECC_ENGINE_TYPE_NONE: + if (chip->ecc.engine_type == NAND_ECC_ENGINE_TYPE_INVALID) { /* If CS Base Register selects full hardware ECC then use it */ if ((in_be32(&lbc->bank[priv->bank].br) & BR_DECC) == BR_DECC_CHK_GEN) { - chip->ecc.read_page = fsl_elbc_read_page; - chip->ecc.write_page = fsl_elbc_write_page; - chip->ecc.write_subpage = fsl_elbc_write_subpage; - chip->ecc.engine_type = NAND_ECC_ENGINE_TYPE_ON_HOST; - mtd_set_ooblayout(mtd, &fsl_elbc_ooblayout_ops); - chip->ecc.size = 512; - chip->ecc.bytes = 3; - chip->ecc.strength = 1; } else { /* otherwise fall back to default software ECC */ chip->ecc.engine_type = NAND_ECC_ENGINE_TYPE_SOFT; chip->ecc.algo = NAND_ECC_ALGO_HAMMING; } + } + + switch (chip->ecc.engine_type) { + /* if HW ECC was chosen, setup ecc and oob layout */ + case NAND_ECC_ENGINE_TYPE_ON_HOST: + chip->ecc.read_page = fsl_elbc_read_page; + chip->ecc.write_page = fsl_elbc_write_page; + chip->ecc.write_subpage = fsl_elbc_write_subpage; + mtd_set_ooblayout(mtd, &fsl_elbc_ooblayout_ops); + chip->ecc.size = 512; + chip->ecc.bytes = 3; + chip->ecc.strength = 1; break; - /* if SW ECC was chosen in DT, we do not need to set anything here */ + /* if none or SW ECC was chosen, we do not need to set anything here */ + case NAND_ECC_ENGINE_TYPE_NONE: case NAND_ECC_ENGINE_TYPE_SOFT: + case NAND_ECC_ENGINE_TYPE_ON_DIE: break; - /* should we also implement *_ECC_ENGINE_CONTROLLER to do as above? */ default: return -EINVAL; } From patchwork Sat Oct 22 07:25: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: 7821 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1142720wrr; Sat, 22 Oct 2022 03:32:26 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4fx9cJn02PPWevxwtbBEKP6+yjVyA+8ingilt3V+slvhQd8PRqeoxYE17bj5WdO2x3Vf8B X-Received: by 2002:aa7:da0a:0:b0:461:135e:7298 with SMTP id r10-20020aa7da0a000000b00461135e7298mr10271042eds.242.1666434746231; Sat, 22 Oct 2022 03:32:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666434746; cv=none; d=google.com; s=arc-20160816; b=SfS0eZiQBL/qEDe5mzoQWjfigZRI4X+Y08D4azdnUhYa0LWaUr2e15gqilvEKABnxa yCZiUczcNbOLxOyVfSfQXqxTOh6POzJQ4Mxngz6zLeYnx3Hg+0MTeXujLWyhRIl54Yd3 cZw/OsNeBbpJ91lpsH6rd9YqUeT6A9VkSLQahxR74LSYmqCkE/AoG9oDoGt2NiXAWuTL IGZdkU6pEHPrjN25wv1EQMXCEqXNkCKQ/6cy3j+n/9q+jgHl/bbbj85lV46E/nku2S98 ibk08BNjppRjfo6eZwCVTECir7dIwpbpLnDF1vNHn0xj3Rj7bNgVHUwqKwvrgnDcxm58 GyQA== 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=OKb6pagJqGv6XGonOE+A5HuRdbZLcpYZ50iLxFBZEFc=; b=ppKOMbr0oZHrnYszJR/neOmoToP6YX7EiX9btwI5Ex83F2nv0kFbNczd4SyqUNJI6G 4Z/5TqlOxfrNMyED/kJIFJHQjbwRUkWsPS/uejm2km504ML4uZHCn6mwl7qiFWuOqP01 xMZOCDiV0FKs2zrk0Q+sn7Dm1Bd34m1zuiV6gqq/+E1bKqRJFR0lDKPmjdo/ziOh0TUY LaJJe5vhvU7zcWAAkbazyTCG+WQaks4Q0FOmpy4zKxT2iys2X44U+3qFNSX3KK+MonGT 8hy2L/8/EzHsKHwKABB5LQ4SshiddXjdt6w6N50JCNCy7wyTJ1dwK+tPrmbgRu/QrL/m qy0Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=oiGWoUf1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 j6-20020a05640211c600b00459548157c7si26771388edw.407.2022.10.22.03.32.00; Sat, 22 Oct 2022 03:32: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=oiGWoUf1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S230291AbiJVK23 (ORCPT + 99 others); Sat, 22 Oct 2022 06:28:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50550 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230451AbiJVK2E (ORCPT ); Sat, 22 Oct 2022 06:28:04 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 73DAA5FD9; Sat, 22 Oct 2022 02:43: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 256A460B30; Sat, 22 Oct 2022 07:55:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2ADE1C433D6; Sat, 22 Oct 2022 07:55:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425310; bh=wWXmUfQsWl/BOGukxiVcuupxl738fHREnxjFfoLzZno=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oiGWoUf1MiM6y1Zdq3fJv+chamRSIj+tSOGS6NyOE5Kwhbj5IGv2dUckmhTU0cAd6 WSrRvWOmQr3qMbjLfm7veaR3CXwP5OKNZOhfKeMT6y4FH/0ftI2SMs0wXtoGbz6Bwt uQU+5wG3MxH9h8HIf9HR49JEYt2sQCz5loRsewOU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sindhu-Devale , Shiraz Saleem , Leon Romanovsky , Sasha Levin Subject: [PATCH 5.19 429/717] RDMA/irdma: Align AE id codes to correct flush code and event Date: Sat, 22 Oct 2022 09:25:08 +0200 Message-Id: <20221022072517.410378276@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 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?1747383480138103877?= X-GMAIL-MSGID: =?utf-8?q?1747383480138103877?= From: Sindhu-Devale [ Upstream commit 7f51a961f8c6b84752a48e950074a8c4a0808d91 ] A number of asynchronous event (AE) ids were not aligned to the correct flush_code and event_type. Fix these up so that the correct IBV error and event codes are returned to application. Also, add handling for new AE ids like IRDMA_AE_INVALID_REQUEST to return the correct WC error code. Fixes: 44d9e52977a1 ("RDMA/irdma: Implement device initialization definitions") Signed-off-by: Sindhu-Devale Signed-off-by: Shiraz Saleem Link: https://lore.kernel.org/r/20220907191324.1173-2-shiraz.saleem@intel.com Signed-off-by: Leon Romanovsky Signed-off-by: Sasha Levin --- drivers/infiniband/hw/irdma/defs.h | 1 + drivers/infiniband/hw/irdma/hw.c | 51 +++++++++++++++++------------ drivers/infiniband/hw/irdma/type.h | 1 + drivers/infiniband/hw/irdma/user.h | 1 + drivers/infiniband/hw/irdma/utils.c | 3 ++ drivers/infiniband/hw/irdma/verbs.c | 2 ++ 6 files changed, 38 insertions(+), 21 deletions(-) diff --git a/drivers/infiniband/hw/irdma/defs.h b/drivers/infiniband/hw/irdma/defs.h index e03e03082a5f..c1906cab5c8a 100644 --- a/drivers/infiniband/hw/irdma/defs.h +++ b/drivers/infiniband/hw/irdma/defs.h @@ -314,6 +314,7 @@ enum irdma_cqp_op_type { #define IRDMA_AE_IB_REMOTE_ACCESS_ERROR 0x020d #define IRDMA_AE_IB_REMOTE_OP_ERROR 0x020e #define IRDMA_AE_WQE_LSMM_TOO_LONG 0x0220 +#define IRDMA_AE_INVALID_REQUEST 0x0223 #define IRDMA_AE_DDP_INVALID_MSN_GAP_IN_MSN 0x0301 #define IRDMA_AE_DDP_UBE_DDP_MESSAGE_TOO_LONG_FOR_AVAILABLE_BUFFER 0x0303 #define IRDMA_AE_DDP_UBE_INVALID_DDP_VERSION 0x0304 diff --git a/drivers/infiniband/hw/irdma/hw.c b/drivers/infiniband/hw/irdma/hw.c index 6bba1335993a..971cc7a7f3bc 100644 --- a/drivers/infiniband/hw/irdma/hw.c +++ b/drivers/infiniband/hw/irdma/hw.c @@ -138,59 +138,68 @@ static void irdma_set_flush_fields(struct irdma_sc_qp *qp, qp->event_type = IRDMA_QP_EVENT_CATASTROPHIC; switch (info->ae_id) { - case IRDMA_AE_AMP_UNALLOCATED_STAG: case IRDMA_AE_AMP_BOUNDS_VIOLATION: case IRDMA_AE_AMP_INVALID_STAG: - qp->event_type = IRDMA_QP_EVENT_ACCESS_ERR; - fallthrough; + case IRDMA_AE_AMP_RIGHTS_VIOLATION: + case IRDMA_AE_AMP_UNALLOCATED_STAG: case IRDMA_AE_AMP_BAD_PD: - case IRDMA_AE_UDA_XMIT_BAD_PD: + case IRDMA_AE_AMP_BAD_QP: + case IRDMA_AE_AMP_BAD_STAG_KEY: + case IRDMA_AE_AMP_BAD_STAG_INDEX: + case IRDMA_AE_AMP_TO_WRAP: + case IRDMA_AE_PRIV_OPERATION_DENIED: qp->flush_code = FLUSH_PROT_ERR; + qp->event_type = IRDMA_QP_EVENT_ACCESS_ERR; break; - case IRDMA_AE_AMP_BAD_QP: + case IRDMA_AE_UDA_XMIT_BAD_PD: case IRDMA_AE_WQE_UNEXPECTED_OPCODE: qp->flush_code = FLUSH_LOC_QP_OP_ERR; + qp->event_type = IRDMA_QP_EVENT_CATASTROPHIC; + break; + case IRDMA_AE_UDA_XMIT_DGRAM_TOO_LONG: + case IRDMA_AE_UDA_XMIT_DGRAM_TOO_SHORT: + case IRDMA_AE_UDA_L4LEN_INVALID: + case IRDMA_AE_DDP_UBE_INVALID_MO: + case IRDMA_AE_DDP_UBE_DDP_MESSAGE_TOO_LONG_FOR_AVAILABLE_BUFFER: + qp->flush_code = FLUSH_LOC_LEN_ERR; + qp->event_type = IRDMA_QP_EVENT_CATASTROPHIC; break; - case IRDMA_AE_AMP_BAD_STAG_KEY: - case IRDMA_AE_AMP_BAD_STAG_INDEX: - case IRDMA_AE_AMP_TO_WRAP: - case IRDMA_AE_AMP_RIGHTS_VIOLATION: case IRDMA_AE_AMP_INVALIDATE_NO_REMOTE_ACCESS_RIGHTS: - case IRDMA_AE_PRIV_OPERATION_DENIED: - case IRDMA_AE_IB_INVALID_REQUEST: case IRDMA_AE_IB_REMOTE_ACCESS_ERROR: qp->flush_code = FLUSH_REM_ACCESS_ERR; qp->event_type = IRDMA_QP_EVENT_ACCESS_ERR; break; case IRDMA_AE_LLP_SEGMENT_TOO_SMALL: - case IRDMA_AE_DDP_UBE_DDP_MESSAGE_TOO_LONG_FOR_AVAILABLE_BUFFER: - case IRDMA_AE_UDA_XMIT_DGRAM_TOO_LONG: - case IRDMA_AE_UDA_XMIT_DGRAM_TOO_SHORT: - case IRDMA_AE_UDA_L4LEN_INVALID: + case IRDMA_AE_LLP_RECEIVED_MPA_CRC_ERROR: case IRDMA_AE_ROCE_RSP_LENGTH_ERROR: - qp->flush_code = FLUSH_LOC_LEN_ERR; + case IRDMA_AE_IB_REMOTE_OP_ERROR: + qp->flush_code = FLUSH_REM_OP_ERR; + qp->event_type = IRDMA_QP_EVENT_CATASTROPHIC; break; case IRDMA_AE_LCE_QP_CATASTROPHIC: qp->flush_code = FLUSH_FATAL_ERR; + qp->event_type = IRDMA_QP_EVENT_CATASTROPHIC; break; - case IRDMA_AE_DDP_UBE_INVALID_MO: case IRDMA_AE_IB_RREQ_AND_Q1_FULL: - case IRDMA_AE_LLP_RECEIVED_MPA_CRC_ERROR: qp->flush_code = FLUSH_GENERAL_ERR; break; case IRDMA_AE_LLP_TOO_MANY_RETRIES: qp->flush_code = FLUSH_RETRY_EXC_ERR; + qp->event_type = IRDMA_QP_EVENT_CATASTROPHIC; break; case IRDMA_AE_AMP_MWBIND_INVALID_RIGHTS: case IRDMA_AE_AMP_MWBIND_BIND_DISABLED: case IRDMA_AE_AMP_MWBIND_INVALID_BOUNDS: qp->flush_code = FLUSH_MW_BIND_ERR; + qp->event_type = IRDMA_QP_EVENT_ACCESS_ERR; break; - case IRDMA_AE_IB_REMOTE_OP_ERROR: - qp->flush_code = FLUSH_REM_OP_ERR; + case IRDMA_AE_IB_INVALID_REQUEST: + qp->flush_code = FLUSH_REM_INV_REQ_ERR; + qp->event_type = IRDMA_QP_EVENT_REQ_ERR; break; default: - qp->flush_code = FLUSH_FATAL_ERR; + qp->flush_code = FLUSH_GENERAL_ERR; + qp->event_type = IRDMA_QP_EVENT_CATASTROPHIC; break; } } diff --git a/drivers/infiniband/hw/irdma/type.h b/drivers/infiniband/hw/irdma/type.h index 9e7b8ecb137a..517d41a1c289 100644 --- a/drivers/infiniband/hw/irdma/type.h +++ b/drivers/infiniband/hw/irdma/type.h @@ -98,6 +98,7 @@ enum irdma_term_mpa_errors { enum irdma_qp_event_type { IRDMA_QP_EVENT_CATASTROPHIC, IRDMA_QP_EVENT_ACCESS_ERR, + IRDMA_QP_EVENT_REQ_ERR, }; enum irdma_hw_stats_index_32b { diff --git a/drivers/infiniband/hw/irdma/user.h b/drivers/infiniband/hw/irdma/user.h index ddd0ebbdd7d5..2ef61923c926 100644 --- a/drivers/infiniband/hw/irdma/user.h +++ b/drivers/infiniband/hw/irdma/user.h @@ -103,6 +103,7 @@ enum irdma_flush_opcode { FLUSH_FATAL_ERR, FLUSH_RETRY_EXC_ERR, FLUSH_MW_BIND_ERR, + FLUSH_REM_INV_REQ_ERR, }; enum irdma_cmpl_status { diff --git a/drivers/infiniband/hw/irdma/utils.c b/drivers/infiniband/hw/irdma/utils.c index f4d774451160..c9513b9fc42d 100644 --- a/drivers/infiniband/hw/irdma/utils.c +++ b/drivers/infiniband/hw/irdma/utils.c @@ -2478,6 +2478,9 @@ void irdma_ib_qp_event(struct irdma_qp *iwqp, enum irdma_qp_event_type event) case IRDMA_QP_EVENT_ACCESS_ERR: ibevent.event = IB_EVENT_QP_ACCESS_ERR; break; + case IRDMA_QP_EVENT_REQ_ERR: + ibevent.event = IB_EVENT_QP_REQ_ERR; + break; } ibevent.device = iwqp->ibqp.device; ibevent.element.qp = &iwqp->ibqp; diff --git a/drivers/infiniband/hw/irdma/verbs.c b/drivers/infiniband/hw/irdma/verbs.c index ab73d1715f99..7cd50147de1d 100644 --- a/drivers/infiniband/hw/irdma/verbs.c +++ b/drivers/infiniband/hw/irdma/verbs.c @@ -3307,6 +3307,8 @@ static enum ib_wc_status irdma_flush_err_to_ib_wc_status(enum irdma_flush_opcode return IB_WC_RETRY_EXC_ERR; case FLUSH_MW_BIND_ERR: return IB_WC_MW_BIND_ERR; + case FLUSH_REM_INV_REQ_ERR: + return IB_WC_REM_INV_REQ_ERR; case FLUSH_FATAL_ERR: default: return IB_WC_FATAL_ERR; From patchwork Sat Oct 22 07:25: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: 7505 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1104943wrr; Sat, 22 Oct 2022 01:33:46 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6fbXmc0hBT2KHsBZq7L2n1bMXoFvqNBn3B0AcNGuTBs+Rksqag5OudE6w7vBBuJRTRszur X-Received: by 2002:a17:902:8549:b0:178:6399:3e0f with SMTP id d9-20020a170902854900b0017863993e0fmr23613465plo.35.1666427625827; Sat, 22 Oct 2022 01:33:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666427625; cv=none; d=google.com; s=arc-20160816; b=htcSWdMDJxWP1Jw0QD2MjTk0nKSkO9wPmrGPeuY7JSVPKdnO+NcOa2QWGRMFaR2s/B z8dml9MJCcvAmFY726VYxOF6gGDOar472v2VHZ3DTSc0goC9lJDtzxp5130o4CKLk3Kw xg4HPmIZh9cpGqeE2EC2vdH374b9IpwnxiriVGS+OpFJwn3VxCdq6rD3Hpe2zVSZOHXr 3yIV1LRifh+APSqOC4q4wHYGncuLLAND7Sl1zJO8rikBTjVotxplgSVUh45au4ySyO/h oROnAKNIbkSFV/i8CjgC3P0Fw48ECGmPww0PmuPLkwlzlI7FlfWzhvJfOROLAsBLYTve DgHQ== 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=eEih2cFVv2yjwcEd+n0JrLJLpHmpcE1sdXmhS0NzqqE=; b=iz655lnOf3mvyybOBi40PS+D6xFs1PgtNWr7RWPlZqEmRwzHFQubiZtl8eOD4goMLE +joAJ4/cqHwdtvGNiAtk0EZ8wwxRZYjkqAvSIu+WB7MBDLoY2oL/ldhaEKty3mpl+ffF sxwOe/hlZ9GOW1avmdK/4AS/ei6WuqBrk+2g2m1lvxNuOx/UiqAkRnSuDYeTgjsxjnS1 iLFW68TRyZLUYTSbfemLSCrQeLYmaDVaq4uwY1etW0S3g68Hx55mtcHjC407Qe2Rg4Iv 99Eam2hi3n4Z4IoZ+mvM7S0L7z0muLUOkPHs8V2MaUJOYVGVysNTrH8uWl9uMj7f8aP8 NjUQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=xrqI85Fa; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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-20020a170902b68300b001782ecb617dsi25807515pls.412.2022.10.22.01.33.29; Sat, 22 Oct 2022 01:33: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=xrqI85Fa; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S229934AbiJVITy (ORCPT + 99 others); Sat, 22 Oct 2022 04:19:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49172 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233442AbiJVIQ7 (ORCPT ); Sat, 22 Oct 2022 04:16:59 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7534AA3B67; Sat, 22 Oct 2022 00:57: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 706E560B88; Sat, 22 Oct 2022 07:55:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 02280C433D6; Sat, 22 Oct 2022 07:55:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425313; bh=1aF+wunZsI3eYUauDVodWioKatZGavxsgr93VDvBbls=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xrqI85FatA9P3VmLHQbD0AJXOUBF2HRnSUKR0Zclrnq6w8lhEFjnn6l3HcYN+lHtI 8BammQBtSII9L059dFFXNYNJIdv4H0Z/Up+zapq3mr7VcUB6N/ltSItl2I16qX627R gUxCWAfSVvy97lCh1rpSF5VWkt0B5Kc3lSND2Dgg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dan Carpenter , Shiraz Saleem , Leon Romanovsky , Sasha Levin Subject: [PATCH 5.19 430/717] RDMA/irdma: Validate udata inlen and outlen Date: Sat, 22 Oct 2022 09:25:09 +0200 Message-Id: <20221022072517.451916155@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376013931601049?= X-GMAIL-MSGID: =?utf-8?q?1747376013931601049?= From: Shiraz Saleem [ Upstream commit 34acb833cc83bdea912a160ff99b537e62bb4cf3 ] Currently ib_copy_from_udata and ib_copy_to_udata could underfill the request and response buffer if the user-space passes an undersized value for udata->inlen or udata->outlen respectively [1] This could lead to undesirable behavior. Zero initing the buffer only goes as far as preventing using the buffer uninitialized. Validate udata->inlen and udata->outlen passed from user-space to ensure they are at least the required minimum size. [1] https://lore.kernel.org/linux-rdma/MWHPR11MB0029F37D40D9D4A993F8F549E9D79@MWHPR11MB0029.namprd11.prod.outlook.com/ Fixes: b48c24c2d710 ("RDMA/irdma: Implement device supported verb APIs") Reported-by: Dan Carpenter Signed-off-by: Shiraz Saleem Link: https://lore.kernel.org/r/20220907191324.1173-3-shiraz.saleem@intel.com Signed-off-by: Leon Romanovsky Signed-off-by: Sasha Levin --- drivers/infiniband/hw/irdma/verbs.c | 67 ++++++++++++++++++++++++++--- 1 file changed, 60 insertions(+), 7 deletions(-) diff --git a/drivers/infiniband/hw/irdma/verbs.c b/drivers/infiniband/hw/irdma/verbs.c index 7cd50147de1d..c5652efb3df2 100644 --- a/drivers/infiniband/hw/irdma/verbs.c +++ b/drivers/infiniband/hw/irdma/verbs.c @@ -299,13 +299,19 @@ static void irdma_alloc_push_page(struct irdma_qp *iwqp) static int irdma_alloc_ucontext(struct ib_ucontext *uctx, struct ib_udata *udata) { +#define IRDMA_ALLOC_UCTX_MIN_REQ_LEN offsetofend(struct irdma_alloc_ucontext_req, rsvd8) +#define IRDMA_ALLOC_UCTX_MIN_RESP_LEN offsetofend(struct irdma_alloc_ucontext_resp, rsvd) struct ib_device *ibdev = uctx->device; struct irdma_device *iwdev = to_iwdev(ibdev); - struct irdma_alloc_ucontext_req req; + struct irdma_alloc_ucontext_req req = {}; struct irdma_alloc_ucontext_resp uresp = {}; struct irdma_ucontext *ucontext = to_ucontext(uctx); struct irdma_uk_attrs *uk_attrs; + if (udata->inlen < IRDMA_ALLOC_UCTX_MIN_REQ_LEN || + udata->outlen < IRDMA_ALLOC_UCTX_MIN_RESP_LEN) + return -EINVAL; + if (ib_copy_from_udata(&req, udata, min(sizeof(req), udata->inlen))) return -EINVAL; @@ -317,7 +323,7 @@ static int irdma_alloc_ucontext(struct ib_ucontext *uctx, uk_attrs = &iwdev->rf->sc_dev.hw_attrs.uk_attrs; /* GEN_1 legacy support with libi40iw */ - if (udata->outlen < sizeof(uresp)) { + if (udata->outlen == IRDMA_ALLOC_UCTX_MIN_RESP_LEN) { if (uk_attrs->hw_rev != IRDMA_GEN_1) return -EOPNOTSUPP; @@ -389,6 +395,7 @@ static void irdma_dealloc_ucontext(struct ib_ucontext *context) */ static int irdma_alloc_pd(struct ib_pd *pd, struct ib_udata *udata) { +#define IRDMA_ALLOC_PD_MIN_RESP_LEN offsetofend(struct irdma_alloc_pd_resp, rsvd) struct irdma_pd *iwpd = to_iwpd(pd); struct irdma_device *iwdev = to_iwdev(pd->device); struct irdma_sc_dev *dev = &iwdev->rf->sc_dev; @@ -398,6 +405,9 @@ static int irdma_alloc_pd(struct ib_pd *pd, struct ib_udata *udata) u32 pd_id = 0; int err; + if (udata && udata->outlen < IRDMA_ALLOC_PD_MIN_RESP_LEN) + return -EINVAL; + err = irdma_alloc_rsrc(rf, rf->allocated_pds, rf->max_pd, &pd_id, &rf->next_pd); if (err) @@ -814,12 +824,14 @@ static int irdma_create_qp(struct ib_qp *ibqp, struct ib_qp_init_attr *init_attr, struct ib_udata *udata) { +#define IRDMA_CREATE_QP_MIN_REQ_LEN offsetofend(struct irdma_create_qp_req, user_compl_ctx) +#define IRDMA_CREATE_QP_MIN_RESP_LEN offsetofend(struct irdma_create_qp_resp, rsvd) struct ib_pd *ibpd = ibqp->pd; struct irdma_pd *iwpd = to_iwpd(ibpd); struct irdma_device *iwdev = to_iwdev(ibpd->device); struct irdma_pci_f *rf = iwdev->rf; struct irdma_qp *iwqp = to_iwqp(ibqp); - struct irdma_create_qp_req req; + struct irdma_create_qp_req req = {}; struct irdma_create_qp_resp uresp = {}; u32 qp_num = 0; int err_code; @@ -836,6 +848,10 @@ static int irdma_create_qp(struct ib_qp *ibqp, if (err_code) return err_code; + if (udata && (udata->inlen < IRDMA_CREATE_QP_MIN_REQ_LEN || + udata->outlen < IRDMA_CREATE_QP_MIN_RESP_LEN)) + return -EINVAL; + sq_size = init_attr->cap.max_send_wr; rq_size = init_attr->cap.max_recv_wr; @@ -1120,6 +1136,8 @@ static int irdma_query_pkey(struct ib_device *ibdev, u32 port, u16 index, int irdma_modify_qp_roce(struct ib_qp *ibqp, struct ib_qp_attr *attr, int attr_mask, struct ib_udata *udata) { +#define IRDMA_MODIFY_QP_MIN_REQ_LEN offsetofend(struct irdma_modify_qp_req, rq_flush) +#define IRDMA_MODIFY_QP_MIN_RESP_LEN offsetofend(struct irdma_modify_qp_resp, push_valid) struct irdma_pd *iwpd = to_iwpd(ibqp->pd); struct irdma_qp *iwqp = to_iwqp(ibqp); struct irdma_device *iwdev = iwqp->iwdev; @@ -1138,6 +1156,13 @@ int irdma_modify_qp_roce(struct ib_qp *ibqp, struct ib_qp_attr *attr, roce_info = &iwqp->roce_info; udp_info = &iwqp->udp_info; + if (udata) { + /* udata inlen/outlen can be 0 when supporting legacy libi40iw */ + if ((udata->inlen && udata->inlen < IRDMA_MODIFY_QP_MIN_REQ_LEN) || + (udata->outlen && udata->outlen < IRDMA_MODIFY_QP_MIN_RESP_LEN)) + return -EINVAL; + } + if (attr_mask & ~IB_QP_ATTR_STANDARD_BITS) return -EOPNOTSUPP; @@ -1374,7 +1399,7 @@ int irdma_modify_qp_roce(struct ib_qp *ibqp, struct ib_qp_attr *attr, if (iwqp->iwarp_state == IRDMA_QP_STATE_ERROR) { spin_unlock_irqrestore(&iwqp->lock, flags); - if (udata) { + if (udata && udata->inlen) { if (ib_copy_from_udata(&ureq, udata, min(sizeof(ureq), udata->inlen))) return -EINVAL; @@ -1426,7 +1451,7 @@ int irdma_modify_qp_roce(struct ib_qp *ibqp, struct ib_qp_attr *attr, } else { iwqp->ibqp_state = attr->qp_state; } - if (udata && dev->hw_attrs.uk_attrs.hw_rev >= IRDMA_GEN_2) { + if (udata && udata->outlen && dev->hw_attrs.uk_attrs.hw_rev >= IRDMA_GEN_2) { struct irdma_ucontext *ucontext; ucontext = rdma_udata_to_drv_context(udata, @@ -1466,6 +1491,8 @@ int irdma_modify_qp_roce(struct ib_qp *ibqp, struct ib_qp_attr *attr, int irdma_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr, int attr_mask, struct ib_udata *udata) { +#define IRDMA_MODIFY_QP_MIN_REQ_LEN offsetofend(struct irdma_modify_qp_req, rq_flush) +#define IRDMA_MODIFY_QP_MIN_RESP_LEN offsetofend(struct irdma_modify_qp_resp, push_valid) struct irdma_qp *iwqp = to_iwqp(ibqp); struct irdma_device *iwdev = iwqp->iwdev; struct irdma_sc_dev *dev = &iwdev->rf->sc_dev; @@ -1480,6 +1507,13 @@ int irdma_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr, int attr_mask, int err; unsigned long flags; + if (udata) { + /* udata inlen/outlen can be 0 when supporting legacy libi40iw */ + if ((udata->inlen && udata->inlen < IRDMA_MODIFY_QP_MIN_REQ_LEN) || + (udata->outlen && udata->outlen < IRDMA_MODIFY_QP_MIN_RESP_LEN)) + return -EINVAL; + } + if (attr_mask & ~IB_QP_ATTR_STANDARD_BITS) return -EOPNOTSUPP; @@ -1565,7 +1599,7 @@ int irdma_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr, int attr_mask, case IB_QPS_RESET: if (iwqp->iwarp_state == IRDMA_QP_STATE_ERROR) { spin_unlock_irqrestore(&iwqp->lock, flags); - if (udata) { + if (udata && udata->inlen) { if (ib_copy_from_udata(&ureq, udata, min(sizeof(ureq), udata->inlen))) return -EINVAL; @@ -1662,7 +1696,7 @@ int irdma_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr, int attr_mask, } } } - if (attr_mask & IB_QP_STATE && udata && + if (attr_mask & IB_QP_STATE && udata && udata->outlen && dev->hw_attrs.uk_attrs.hw_rev >= IRDMA_GEN_2) { struct irdma_ucontext *ucontext; @@ -1797,6 +1831,7 @@ static int irdma_destroy_cq(struct ib_cq *ib_cq, struct ib_udata *udata) static int irdma_resize_cq(struct ib_cq *ibcq, int entries, struct ib_udata *udata) { +#define IRDMA_RESIZE_CQ_MIN_REQ_LEN offsetofend(struct irdma_resize_cq_req, user_cq_buffer) struct irdma_cq *iwcq = to_iwcq(ibcq); struct irdma_sc_dev *dev = iwcq->sc_cq.dev; struct irdma_cqp_request *cqp_request; @@ -1819,6 +1854,9 @@ static int irdma_resize_cq(struct ib_cq *ibcq, int entries, IRDMA_FEATURE_CQ_RESIZE)) return -EOPNOTSUPP; + if (udata && udata->inlen < IRDMA_RESIZE_CQ_MIN_REQ_LEN) + return -EINVAL; + if (entries > rf->max_cqe) return -EINVAL; @@ -1951,6 +1989,8 @@ static int irdma_create_cq(struct ib_cq *ibcq, const struct ib_cq_init_attr *attr, struct ib_udata *udata) { +#define IRDMA_CREATE_CQ_MIN_REQ_LEN offsetofend(struct irdma_create_cq_req, user_cq_buf) +#define IRDMA_CREATE_CQ_MIN_RESP_LEN offsetofend(struct irdma_create_cq_resp, cq_size) struct ib_device *ibdev = ibcq->device; struct irdma_device *iwdev = to_iwdev(ibdev); struct irdma_pci_f *rf = iwdev->rf; @@ -1969,6 +2009,11 @@ static int irdma_create_cq(struct ib_cq *ibcq, err_code = cq_validate_flags(attr->flags, dev->hw_attrs.uk_attrs.hw_rev); if (err_code) return err_code; + + if (udata && (udata->inlen < IRDMA_CREATE_CQ_MIN_REQ_LEN || + udata->outlen < IRDMA_CREATE_CQ_MIN_RESP_LEN)) + return -EINVAL; + err_code = irdma_alloc_rsrc(rf, rf->allocated_cqs, rf->max_cq, &cq_num, &rf->next_cq); if (err_code) @@ -2738,6 +2783,7 @@ static struct ib_mr *irdma_reg_user_mr(struct ib_pd *pd, u64 start, u64 len, u64 virt, int access, struct ib_udata *udata) { +#define IRDMA_MEM_REG_MIN_REQ_LEN offsetofend(struct irdma_mem_reg_req, sq_pages) struct irdma_device *iwdev = to_iwdev(pd->device); struct irdma_ucontext *ucontext; struct irdma_pble_alloc *palloc; @@ -2755,6 +2801,9 @@ static struct ib_mr *irdma_reg_user_mr(struct ib_pd *pd, u64 start, u64 len, if (len > iwdev->rf->sc_dev.hw_attrs.max_mr_size) return ERR_PTR(-EINVAL); + if (udata->inlen < IRDMA_MEM_REG_MIN_REQ_LEN) + return ERR_PTR(-EINVAL); + region = ib_umem_get(pd->device, start, len, access); if (IS_ERR(region)) { @@ -4290,12 +4339,16 @@ static int irdma_create_user_ah(struct ib_ah *ibah, struct rdma_ah_init_attr *attr, struct ib_udata *udata) { +#define IRDMA_CREATE_AH_MIN_RESP_LEN offsetofend(struct irdma_create_ah_resp, rsvd) struct irdma_ah *ah = container_of(ibah, struct irdma_ah, ibah); struct irdma_device *iwdev = to_iwdev(ibah->pd->device); struct irdma_create_ah_resp uresp; struct irdma_ah *parent_ah; int err; + if (udata && udata->outlen < IRDMA_CREATE_AH_MIN_RESP_LEN) + return -EINVAL; + err = irdma_setup_ah(ibah, attr); if (err) return err; From patchwork Sat Oct 22 07:25: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: 7511 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1105003wrr; Sat, 22 Oct 2022 01:33:53 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4OPINSxuqOj5QN1c3onv6OvFFX+4/8AMNc5NKjpERZN1Tkg5mXpOK1Q26qyDTAzDI2OQMZ X-Received: by 2002:a05:6402:5510:b0:459:5ea:9bc0 with SMTP id fi16-20020a056402551000b0045905ea9bc0mr20874641edb.152.1666427633376; Sat, 22 Oct 2022 01:33:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666427633; cv=none; d=google.com; s=arc-20160816; b=q3QVUcj30IXM5MSYMkm+qu5/RvIkYYikNXh9sjvFHpTqWUNG4nN301wRAHgijdVpTm e3rJ+oI/KGD+qkcf4ap/yqN6rV5y6SEGl0ut9GHo2sChXmOaCBhyUFqYjUUM3+ah+2f7 4hO2o5/ONWteCm/06+DfCv0xTKaGWP4cSEIKCbjBeUHRTiaDXucOq9ryL62yt2T/pbmq QnRHazAFdUnJhnt6AfFWpJ9Ks9Jp78FlCl9FrAik3uGitf7MtB/f7iRhCx5DgV4QZLcY zSu/yPEQrwu25NdK2MC2zFOW3WP9Cd/Yux0s251m2dRp1L+ehlDWIti0330/sQ0Gi7AO 4Kvw== 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=x/C8ngJOJXA2TllicwwHUY+axUQoFEe2+vpUnLTk3Fg=; b=y794mrFE/z788iZsulaxCU8Sn07H21HJsUBuTshO6WQomN+os2Sy/fBkAEs21u3qvU /iShFp/968I5UvGROp79VW+WmcbBR7go5KPPFVBOQ78PT2tNQJ91e6sMA79UC+HRLO3T Bsn0eMxXz3JgXvDP3aQ2njP7uL5iEmb3HWc63ypP+SgkBrKhibpGeVepmzM7hGbOvI7+ 6sYvlKmLvUy/YsF/n6uFeq3cLi0gA/H3eILDZe4Z3JUAV8TYLB6AMozZ+cCDSs5HmZHr hQqKu/JGZpRfsMGZqvyafgc+qJ7tGEFz2n7nWePtd476DDvfMA5WGy0ihit/KWMXF2Ng XsvQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=qlYtqOTx; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 ho6-20020a1709070e8600b0078d484e0e79si25783722ejc.481.2022.10.22.01.33.24; Sat, 22 Oct 2022 01:33: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=qlYtqOTx; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S233610AbiJVISy (ORCPT + 99 others); Sat, 22 Oct 2022 04:18:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51498 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234113AbiJVIQQ (ORCPT ); Sat, 22 Oct 2022 04:16:16 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E59662CCA14; Sat, 22 Oct 2022 00:57: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 880B660B09; Sat, 22 Oct 2022 07:55:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 75970C433D7; Sat, 22 Oct 2022 07:55:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425317; bh=DTxLj2qZk1GdpPUnu3tsMQyL5o4/02omjiqHhRkiaNU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qlYtqOTxEd3MiE3SCOhHAqjLscaoiQP6U2dkNklQ1NjKToCjqfQ1NcYkGL0TOfHZO Udqkq8gblDaX912hdGJBF8XQSLre++fnCKjU49ZUV3eAQKCtAbqeNYVBDBlJXXoEFd MRjM6TqNb0KtDxDt+os9slNe8AbPACP3bh5GGa7o= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Xiao Yang , Bart Van Assche , Leon Romanovsky , Sasha Levin Subject: [PATCH 5.19 431/717] RDMA/srp: Fix srp_abort() Date: Sat, 22 Oct 2022 09:25:10 +0200 Message-Id: <20221022072517.488627490@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376022324570844?= X-GMAIL-MSGID: =?utf-8?q?1747376022324570844?= From: Bart Van Assche [ Upstream commit 6dbe4a8dead84de474483910b02ec9e6a10fc1a9 ] Fix the code for converting a SCSI command pointer into an SRP request pointer. Cc: Xiao Yang Fixes: ad215aaea4f9 ("RDMA/srp: Make struct scsi_cmnd and struct srp_request adjacent") Signed-off-by: Bart Van Assche Link: https://lore.kernel.org/r/20220908233139.3042628-1-bvanassche@acm.org Signed-off-by: Leon Romanovsky Signed-off-by: Sasha Levin --- drivers/infiniband/ulp/srp/ib_srp.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/infiniband/ulp/srp/ib_srp.c b/drivers/infiniband/ulp/srp/ib_srp.c index 3d9c108d73ad..c3fa65977b3e 100644 --- a/drivers/infiniband/ulp/srp/ib_srp.c +++ b/drivers/infiniband/ulp/srp/ib_srp.c @@ -2790,7 +2790,7 @@ static int srp_send_tsk_mgmt(struct srp_rdma_ch *ch, u64 req_tag, u64 lun, static int srp_abort(struct scsi_cmnd *scmnd) { struct srp_target_port *target = host_to_target(scmnd->device->host); - struct srp_request *req = (struct srp_request *) scmnd->host_scribble; + struct srp_request *req = scsi_cmd_priv(scmnd); u32 tag; u16 ch_idx; struct srp_rdma_ch *ch; @@ -2798,8 +2798,6 @@ static int srp_abort(struct scsi_cmnd *scmnd) shost_printk(KERN_ERR, target->scsi_host, "SRP abort called\n"); - if (!req) - return SUCCESS; tag = blk_mq_unique_tag(scsi_cmd_to_rq(scmnd)); ch_idx = blk_mq_unique_tag_to_hwq(tag); if (WARN_ON_ONCE(ch_idx >= target->ch_count)) From patchwork Sat Oct 22 07:25: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: 7763 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1120933wrr; Sat, 22 Oct 2022 02:26:57 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4c64ayBwVX7+g3MbGIzn2UmGPITrvM5R4pWTCYZsnSEByAejzMRZB2gIo5IhVnefI/hds4 X-Received: by 2002:a17:906:6791:b0:78d:4051:fcf0 with SMTP id q17-20020a170906679100b0078d4051fcf0mr19064713ejp.591.1666430817137; Sat, 22 Oct 2022 02:26:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666430817; cv=none; d=google.com; s=arc-20160816; b=FFRt+ftqEjbvU0hu62tYSUvNbdKGDKyD4Qn+cyuHrqARNd8P6NPqGhiu3AL29LsM2M JRB6PdTsiq30YdQBzXwRTxT5jmdyehvJ80SdCGNmxBl3SZ1YxLDO8LCenNboCYs13sd8 NwAZLmSNnpC/0hJw9nryrF1v5ejcFU+gsZRzPhMaWbL3IqxYDRqCHAEowKR03TXYoSfi aqV72DgWy8H6QLrGsyq1kXuLCheDFMU7nIsOqTH7EbSumIsDTSkOacCqptHd/x31hwCe 0KIFHPQ0b3YndPxSlPAcZLuyJ8Mriiac+Ut78ploJiFYGpXNgGRyrEgbykQzUSeWbMxF B1qA== 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=yDzZDLBfeQwxQKhsiXI9kjlEHRYagcfeA4ctb4wIQxo=; b=NTtj+spb3ZW7007yRRbG8WgI/5Odhv7qE/hXfWpSMJj1YwjSIqZwfyYW5niVU8CBf4 8DDS8q1GUoRPFxOyrWAoLRoIW2OHTmOIufzMRGkZeDZzBCeCetyI5YU6v6sUDJPpsQO7 REIAaVcIksmea58K3JLMYzhGZwv4yEPom4nNHyGiFQzDgY2WjHhWwEfuH6aBohGcn11I ygnzMi2Y03wjDBgHc1EdHdK1GiEMQa1rIIhy8KYV2eS/HbwH/ozMBokGRcx9NXE6ngmP m+qF2TQkcV4PKTPi6Ycd6/2suSNqK0B2d6ZcIO5RxLbxKN2UW58HXrajDEHf5aRQQJXu rpQA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=QE5Ghe9f; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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-20020aa7ccca000000b004612220a97fsi4862275edt.100.2022.10.22.02.26.32; Sat, 22 Oct 2022 02:26: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=QE5Ghe9f; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S230470AbiJVJEU (ORCPT + 99 others); Sat, 22 Oct 2022 05:04:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33640 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235032AbiJVJDU (ORCPT ); Sat, 22 Oct 2022 05:03:20 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 044912FA5E1; Sat, 22 Oct 2022 01:18: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 4C422B82DFD; Sat, 22 Oct 2022 07:53:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AC875C433C1; Sat, 22 Oct 2022 07:53:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425223; bh=obz5FPNMsHHx1sO6B0yQTmd5pxFcPPFY4b0ZdeXu71Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QE5Ghe9fw9X4Li+OMQwX14UCMrM/oa2QAtc4Z9L8VcdrLAbjK1cJZN6CELtcW+HXs IMy+IhW+ZrCA31niQAbJOfhjPGqqACFzGYvUMu2lUg8XXGtGJFu0aNVql6R3HIG8qo SQOdtwIgfEoccsztNTtwvxye5BNjFdObPfY4lgho= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Olga Kornievskaia , Bernard Metzler , Leon Romanovsky , Sasha Levin Subject: [PATCH 5.19 432/717] RDMA/siw: Always consume all skbuf data in sk_data_ready() upcall. Date: Sat, 22 Oct 2022 09:25:11 +0200 Message-Id: <20221022072517.532630166@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747379360130662398?= X-GMAIL-MSGID: =?utf-8?q?1747379360130662398?= From: Bernard Metzler [ Upstream commit 754209850df8367c954ac1de7671c7430b1f342c ] For header and trailer/padding processing, siw did not consume new skb data until minimum amount present to fill current header or trailer structure, including potential payload padding. Not consuming any data during upcall may cause a receive stall, since tcp_read_sock() is not upcalling again if no new data arrive. A NFSoRDMA client got stuck at RDMA Write reception of unaligned payload, if the current skb did contain only the expected 3 padding bytes, but not the 4 bytes CRC trailer. Expecting 4 more bytes already arrived in another skb, and not consuming those 3 bytes in the current upcall left the Write incomplete, waiting for the CRC forever. Fixes: 8b6a361b8c48 ("rdma/siw: receive path") Reported-by: Olga Kornievskaia Tested-by: Olga Kornievskaia Signed-off-by: Bernard Metzler Link: https://lore.kernel.org/r/20220920081202.223629-1-bmt@zurich.ibm.com Signed-off-by: Leon Romanovsky Signed-off-by: Sasha Levin --- drivers/infiniband/sw/siw/siw_qp_rx.c | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/drivers/infiniband/sw/siw/siw_qp_rx.c b/drivers/infiniband/sw/siw/siw_qp_rx.c index 875ea6f1b04a..fd721cc19682 100644 --- a/drivers/infiniband/sw/siw/siw_qp_rx.c +++ b/drivers/infiniband/sw/siw/siw_qp_rx.c @@ -961,27 +961,28 @@ int siw_proc_terminate(struct siw_qp *qp) static int siw_get_trailer(struct siw_qp *qp, struct siw_rx_stream *srx) { struct sk_buff *skb = srx->skb; + int avail = min(srx->skb_new, srx->fpdu_part_rem); u8 *tbuf = (u8 *)&srx->trailer.crc - srx->pad; __wsum crc_in, crc_own = 0; siw_dbg_qp(qp, "expected %d, available %d, pad %u\n", srx->fpdu_part_rem, srx->skb_new, srx->pad); - if (srx->skb_new < srx->fpdu_part_rem) - return -EAGAIN; - - skb_copy_bits(skb, srx->skb_offset, tbuf, srx->fpdu_part_rem); + skb_copy_bits(skb, srx->skb_offset, tbuf, avail); - if (srx->mpa_crc_hd && srx->pad) - crypto_shash_update(srx->mpa_crc_hd, tbuf, srx->pad); + srx->skb_new -= avail; + srx->skb_offset += avail; + srx->skb_copied += avail; + srx->fpdu_part_rem -= avail; - srx->skb_new -= srx->fpdu_part_rem; - srx->skb_offset += srx->fpdu_part_rem; - srx->skb_copied += srx->fpdu_part_rem; + if (srx->fpdu_part_rem) + return -EAGAIN; if (!srx->mpa_crc_hd) return 0; + if (srx->pad) + crypto_shash_update(srx->mpa_crc_hd, tbuf, srx->pad); /* * CRC32 is computed, transmitted and received directly in NBO, * so there's never a reason to convert byte order. @@ -1083,10 +1084,9 @@ static int siw_get_hdr(struct siw_rx_stream *srx) * completely received. */ if (iwarp_pktinfo[opcode].hdr_len > sizeof(struct iwarp_ctrl_tagged)) { - bytes = iwarp_pktinfo[opcode].hdr_len - MIN_DDP_HDR; + int hdrlen = iwarp_pktinfo[opcode].hdr_len; - if (srx->skb_new < bytes) - return -EAGAIN; + bytes = min_t(int, hdrlen - MIN_DDP_HDR, srx->skb_new); skb_copy_bits(skb, srx->skb_offset, (char *)c_hdr + srx->fpdu_part_rcvd, bytes); @@ -1096,6 +1096,9 @@ static int siw_get_hdr(struct siw_rx_stream *srx) srx->skb_new -= bytes; srx->skb_offset += bytes; srx->skb_copied += bytes; + + if (srx->fpdu_part_rcvd < hdrlen) + return -EAGAIN; } /* From patchwork Sat Oct 22 07:25: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: 7577 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1106275wrr; Sat, 22 Oct 2022 01:37:24 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6M3xZXi9aeH1fJKkK9tpHtY6DTiuQB5BXfeT5mW5t3CcyNKH4VcPSvRGNRXyeYILAqWpaj X-Received: by 2002:a17:906:58c7:b0:722:f4bf:cb75 with SMTP id e7-20020a17090658c700b00722f4bfcb75mr19023908ejs.450.1666427833434; Sat, 22 Oct 2022 01:37:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666427833; cv=none; d=google.com; s=arc-20160816; b=zS7MQDJum+4HCqShXPxaF3YKZRBoxlDr9pfY2hCr80HusWwxBQ5vayO9cjQ4lE/0+I I5SZMUCACd2MIg3ydyfz02eXgZXcLGvVyUgXWi1we2mROqbi4zcpqcFyUhGE+03yAIH6 VCw1R7LGt8JvqM6Ahe2HameEzbzTaY0Vaox28E/hsXZhX5NS+6i+dRGz1d6KYXh4RndT t0UZAa6yMDtCTRlfn3pbMnQt6blxbg55NTjrhB8SpXS/WmLyWXKAv9xEzAZ5nfPLV6Em zEKpRyKP58jeKn/aeRaVVu5YCcbqmeGIG58NvhXR6aqx9XX1JCtr2Foai+awjHn38L8A WN9Q== 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=WuHcgaNB7AD0dlIy3T/zniGXed44No87gpLgAs9eJaI=; b=YtX2nULEx+Jchn/if2P+yknI0t80+actjLc+qcSKq20LS9G+zmPw+WDh7oa9HQiEVX P9Yjt/jMxQIajyKnCJnOla33E2UvErufFBiYoaGME/u6usEsujs4SVg3RDZVWpvC8Td1 aRMr2Kb/sd3o15hQSp6l2lNn+19AgFqrwAOauWMGN/lSWwAe5/qNwjKjYuKY/lBD8jzL //Sx4l0LCPbE4achV07poThUmutVnUfuW1a3AM7I7mhfbbrDv/q8RcbQPJpa8luJbjIP tACXbDz3y4GkbD/M0bwHH9NGUCjKbipdd7HmW/T24F66Cr5pOrtSOyDP8p9PIQCSQmYD yt2g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=HjtWpkAh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 go11-20020a1709070d8b00b0078ac0d5d03esi19041861ejc.562.2022.10.22.01.36.44; Sat, 22 Oct 2022 01:37: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=HjtWpkAh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S233980AbiJVIcC (ORCPT + 99 others); Sat, 22 Oct 2022 04:32:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51326 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233987AbiJVI3G (ORCPT ); Sat, 22 Oct 2022 04:29: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 B9E5F2CB88B; Sat, 22 Oct 2022 01:01: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 52845B82E07; Sat, 22 Oct 2022 07:53:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AC416C433D6; Sat, 22 Oct 2022 07:53:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425226; bh=QuHmkVD5GrEIany+pQ95OQ4C3Xd093q6+PFGtcYblMY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HjtWpkAhRNoAb0dcNMfmbedHD5DZFCT/Z3oxjeIA1hGcgx94hPpf/ba+d9BJU7JJ9 ZjOHIF6vVcVqDMgXxBZTs1EH+vzMYCe/Iqv1yNuhbO9ohpYJRHpWx66WkfVkHsc1tw f4sfrGAmlb85VUU2V6KIEZKr9Hbp5h/X6xbLB4JM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Olga Kornievskaia , Bernard Metzler , Leon Romanovsky , Sasha Levin Subject: [PATCH 5.19 433/717] RDMA/siw: Fix QP destroy to wait for all references dropped. Date: Sat, 22 Oct 2022 09:25:12 +0200 Message-Id: <20221022072517.571666640@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376232032276300?= X-GMAIL-MSGID: =?utf-8?q?1747376232032276300?= From: Bernard Metzler [ Upstream commit a3c278807a459e6f50afee6971cabe74cccfb490 ] Delay QP destroy completion until all siw references to QP are dropped. The calling RDMA core will free QP structure after successful return from siw_qp_destroy() call, so siw must not hold any remaining reference to the QP upon return. A use-after-free was encountered in xfstest generic/460, while testing NFSoRDMA. Here, after a TCP connection drop by peer, the triggered siw_cm_work_handler got delayed until after QP destroy call, referencing a QP which has already freed. Fixes: 303ae1cdfdf7 ("rdma/siw: application interface") Reported-by: Olga Kornievskaia Signed-off-by: Bernard Metzler Link: https://lore.kernel.org/r/20220920082503.224189-1-bmt@zurich.ibm.com Signed-off-by: Leon Romanovsky Signed-off-by: Sasha Levin --- drivers/infiniband/sw/siw/siw.h | 1 + drivers/infiniband/sw/siw/siw_qp.c | 2 +- drivers/infiniband/sw/siw/siw_verbs.c | 3 +++ 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/infiniband/sw/siw/siw.h b/drivers/infiniband/sw/siw/siw.h index df03d84c6868..2f3a9cda3850 100644 --- a/drivers/infiniband/sw/siw/siw.h +++ b/drivers/infiniband/sw/siw/siw.h @@ -418,6 +418,7 @@ struct siw_qp { struct ib_qp base_qp; struct siw_device *sdev; struct kref ref; + struct completion qp_free; struct list_head devq; int tx_cpu; struct siw_qp_attrs attrs; diff --git a/drivers/infiniband/sw/siw/siw_qp.c b/drivers/infiniband/sw/siw/siw_qp.c index 7e01f2438afc..e6f634971228 100644 --- a/drivers/infiniband/sw/siw/siw_qp.c +++ b/drivers/infiniband/sw/siw/siw_qp.c @@ -1342,6 +1342,6 @@ void siw_free_qp(struct kref *ref) vfree(qp->orq); siw_put_tx_cpu(qp->tx_cpu); - + complete(&qp->qp_free); atomic_dec(&sdev->num_qp); } diff --git a/drivers/infiniband/sw/siw/siw_verbs.c b/drivers/infiniband/sw/siw/siw_verbs.c index 09316072b789..598dab44536b 100644 --- a/drivers/infiniband/sw/siw/siw_verbs.c +++ b/drivers/infiniband/sw/siw/siw_verbs.c @@ -480,6 +480,8 @@ int siw_create_qp(struct ib_qp *ibqp, struct ib_qp_init_attr *attrs, list_add_tail(&qp->devq, &sdev->qp_list); spin_unlock_irqrestore(&sdev->lock, flags); + init_completion(&qp->qp_free); + return 0; err_out_xa: @@ -624,6 +626,7 @@ int siw_destroy_qp(struct ib_qp *base_qp, struct ib_udata *udata) qp->scq = qp->rcq = NULL; siw_qp_put(qp); + wait_for_completion(&qp->qp_free); return 0; } From patchwork Sat Oct 22 07:25: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: 7571 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1106113wrr; Sat, 22 Oct 2022 01:36:59 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6l2MAFA6UJK8W0BOifoM+V2ZnBNFtBP7j1ecOmizfEJpdHsLswZfFMOuql3Rn4U+q6fizw X-Received: by 2002:a17:907:25c5:b0:782:978d:c3da with SMTP id ae5-20020a17090725c500b00782978dc3damr18860793ejc.623.1666427819425; Sat, 22 Oct 2022 01:36:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666427819; cv=none; d=google.com; s=arc-20160816; b=FSrmtIhSd9dFeHMtS11kQqmlNzI+gAyJzi2Uv4WcYKfW4bzSIXMFNsCRX+xKoWYEpi jdtXJbItoOYdCz5T3tioOmv7+KdNisqZYZ8FnzonMlY1Lxq9vTJgvO7RnKjjVe/BVUdx YGpbxNmNHi/lTIfG0HxNWVanb1CsfyY0mU5OBGJ90U3+InMPHjR8rjUQrN/rwc1NcOLQ DukWp0b24sZJatSY36FjrrCyDCnEFagxiAfs4PsS4d6g3Gfn7Rvkr5RJ9uWccd8qt7TH 0gtov3e65XpyKehuzgN3BiRGI8fiJE27pKGD6usGtXLdQUNwfRT/ggGlzWMv3XIhPfKJ tMpw== 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=t5IKKE7F2yTl0RQzm5WcZtOu1DxktQ6bENcOtZu8oM4=; b=CBQDDDKoUZRiSRtD96tk8tVe/0L/ZXEAQWmmSHejmngRwPXIqgk3A4N78/E+z/tV1L sFrV9F/fm7HEPSzGOCkwQ+irR6dl2YEe4PRT7tb+N3f7Zlk+t9DQ0KXPwXH+5ty1Pw9D NDjf7mPkuXylGygpVrCZ0RQqNUrUn8s3IGJowUx+Y26e+eyyMGo4e6Nj9EUXUlRMloHD U8j8yzh0wL/eqYloJ+XkidHGb/Uwbj+xkHVxQWzbKJfp84bVNq94t8kKRutBxtByUR8H vUhs+53v3sP+gJjOvOmRZ7qS4WnncTO+n7dlMTj4GTNmrAiNVvjA07bzmJQlua5FsRbA W4Lw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=d2pkKRPL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 cs20-20020a170906dc9400b00791bcf8aa61si10904456ejc.505.2022.10.22.01.36.28; Sat, 22 Oct 2022 01:36: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=d2pkKRPL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S233884AbiJVIbi (ORCPT + 99 others); Sat, 22 Oct 2022 04:31:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37076 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233934AbiJVI2r (ORCPT ); Sat, 22 Oct 2022 04:28: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 DCB532E2283; Sat, 22 Oct 2022 01:01: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 9525AB82E0D; Sat, 22 Oct 2022 07:53:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DCA55C433D6; Sat, 22 Oct 2022 07:53:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425229; bh=2jLg4sorREdD9Kh2cd4WxQmBKxAsrF1D/dWByB0ETJk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=d2pkKRPLkuBrYElwNUeQnguJXqrlwx2zvNbendNgiHqi0DV46vkNKAmiZbk5rdbGs nUgfBjxOHuCefQzlp9ef4q/hOKn9Aqk9Xb1PgFq6q17LSpBq+FOjS+/rKlO0t6rYUq Nbsf0WNSN6+tr2r9zSa4aPXpA4wGv/xewG62WfMQ= 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 5.19 434/717] ata: fix ata_id_sense_reporting_enabled() and ata_id_has_sense_reporting() Date: Sat, 22 Oct 2022 09:25:13 +0200 Message-Id: <20221022072517.606948532@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376217041379033?= X-GMAIL-MSGID: =?utf-8?q?1747376217041379033?= 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 21292b5bbb55..868bfd503aee 100644 --- a/include/linux/ata.h +++ b/include/linux/ata.h @@ -771,16 +771,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 Sat Oct 22 07:25: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: 7472 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1099084wrr; Sat, 22 Oct 2022 01:12:36 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5VmgvKmXHGm/UPu2lB8gnTy5xB1Wlf53lBQvzzvBIIMPb6CxXU4uCUfUl8kngdM3Q8bEGa X-Received: by 2002:a65:6e0e:0:b0:434:59e0:27d3 with SMTP id bd14-20020a656e0e000000b0043459e027d3mr19016390pgb.185.1666426356488; Sat, 22 Oct 2022 01:12:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666426356; cv=none; d=google.com; s=arc-20160816; b=sssNMqgR4QrOX6EenfJI50zVw7IsRSwmGiB2M2QU/zJS3ODvYppjnrr1SgXSAwKaNK 6d6fZ5DI5sIKuOW8crTtictw3iamCwNo9jI2MFS4IVaECWvUhCvs6KgecBpTrNj1UMIU wOrnk2ywNUPSdeqITmcTI1fDxBZcsIDkg6LlKRuccN1QGlzrdabHNQf6/+D2fwexkXm1 wGkpuo0tX6hujxX+y6UoCLYcE0yzpwG9jVMMHcmrNY4wTxRMYf55Pw2mlc/s9XfIJHp1 SJ42Ri59K/vvc4sP5DbR6VPMm5NrYLW2NHeu3cDrQr3bvFA3kKYiWlzS7UIWg3abkkqO 1Yfw== 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=Itv99EoVwD5CC0iuKs15PTjSGqpnhHwQxIkFy/4WXGc=; b=yHHqs2G0+Vcx+/XYxzIgb9Dl+Cz6PIh0Zgw5eQekSwRvMwT22dJPO1RETIeIg+MQsM H/OI8goz5J9rL2UxpYHWHKPSNaj1f/wLBNtvWhNWBjJsQz5ZGNl42FFiPW0aSWGdEo+c VKv+eTYLqqHmUfLadspkJVhy+QirOFG2EBbZ2a+mOVAa1eMnXboZEY7mgD6A3tGJxcyP uUDSmrBu2SE4BSEcPzqnCaQJONblswCN9qRu3p25bqFO1h8L9ghXd+OWvoWz75oKilMG 86NvhjZKcfWjh31BZqF/85x1eGowEL8ha58wruCcK1b9WXV2gL5hXESpmAGrLxZKEsOl treg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=S07jfrQ3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 ik19-20020a170902ab1300b00176934d4f3dsi23999081plb.468.2022.10.22.01.12.24; Sat, 22 Oct 2022 01:12: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=S07jfrQ3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S233290AbiJVILx (ORCPT + 99 others); Sat, 22 Oct 2022 04:11:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55494 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233407AbiJVIJp (ORCPT ); Sat, 22 Oct 2022 04:09:45 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DA9A9DF4A; Sat, 22 Oct 2022 00:54:25 -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 3584160B45; Sat, 22 Oct 2022 07:53:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3C643C433C1; Sat, 22 Oct 2022 07:53:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425232; bh=wgTpcZw6pHeLmUWIFLe8Y+4Afsn152FcGu5DNgbGAyI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=S07jfrQ3wdDYGYgRf8oJdyLNo5iZ7nB4DeKa+waU63wRtnPCqLcSlpjpa6sD554TN asOkTDNhe5NCk3VqAeKY5Ec+kcFqCwFGPV15v16LhFXZUmCJq9yIt7ntF5xTNtPWR+ rsGQnjwYshIv6bfx4ABJ0J+VhptMocZW91/gZ+Tk= 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 5.19 435/717] ata: fix ata_id_has_devslp() Date: Sat, 22 Oct 2022 09:25:14 +0200 Message-Id: <20221022072517.638616813@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747374683139927551?= X-GMAIL-MSGID: =?utf-8?q?1747374683139927551?= 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 868bfd503aee..bc136a43689f 100644 --- a/include/linux/ata.h +++ b/include/linux/ata.h @@ -566,6 +566,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) \ @@ -578,7 +582,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 Sat Oct 22 07:25: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: 7488 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1104786wrr; Sat, 22 Oct 2022 01:33:23 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7vJ5vonfDHCsdfsoUbZE4ExYbju+jMYiRUpCLRHxfdRIBaAGd94v39t7lz0OZqhWplZnbC X-Received: by 2002:a63:4282:0:b0:46e:9bac:6d9e with SMTP id p124-20020a634282000000b0046e9bac6d9emr10520152pga.334.1666427603176; Sat, 22 Oct 2022 01:33:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666427603; cv=none; d=google.com; s=arc-20160816; b=zFKs7YaZ49/C6XMJ/aeC4vY0wDDEu3uacE9YDNffsiB3fxf8H3qLmRvNavCAAcpJua V4Mvhz0JOt0AcfTE9NmWHY3GkRt51/m3VmWtXiR4rc2QaF9GF6MYLj97jt7Mieo2KyN9 hH8OcY265hcDnL42Smw21QMaBGloa1zcrN4OchxeGx1GqRUshuw+co7Xi3VYLPVBt4hO sKIXn5B9+0pFdVrb7XV0pX5tGQfGJeoqMucp319viX49KLxYuNbywDb/Bo9j+fWImwm9 BVYh7BRHqJM4A79VJJ5RdstM7jGnowzdYF87v5rTXy29MWVk2EuBt4Xv9lc/N9kvRxrz WSPQ== 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=6bGb9xh0CMBPZSOqD/eybkKkp+mExbT9ishSmmm8tUM=; b=huaTMhn6QbWIYWNXolnl8LS5QI2ukIwZ7hdOD8A1oNjIwRBq3SDBzi4uSHaTtRZaCU k0DvksPXgP+UgXo5mWOtRFho7fZ330JYq1OeIAhEQERCFJGy9w3Y6YJJE7xRkjmpG0c6 yMDRIsvHCCa/t0VwM4Suf8d/xrdoe4ixkK553+hakwbSykHSF/UeDv0OFYOgDHXlWdYc nO0umhyj7bsgIDUu+iN+HY3LS4FK8yl5j9rtEpJTC9jXwn5O+SmfJDWY01ZvqltWkULI WOTTwM5YF1fn4vT/CymueALjOQZ+mGVoqQSZBCLfr+KB6X2gw62+2ECbPHjVrstIK8wX kYJA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=TZBb+rGS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 j14-20020a170903024e00b0018280f67482si33243013plh.113.2022.10.22.01.33.07; Sat, 22 Oct 2022 01:33: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=TZBb+rGS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S233468AbiJVIRC (ORCPT + 99 others); Sat, 22 Oct 2022 04:17:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57614 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233798AbiJVIPL (ORCPT ); Sat, 22 Oct 2022 04:15:11 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E38302CA7E2; Sat, 22 Oct 2022 00:56: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 79E5860AC3; Sat, 22 Oct 2022 07:53:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 708F8C433D6; Sat, 22 Oct 2022 07:53:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425235; bh=RqMptm6VErJfkdlk9lLnznG/cTGLaJPV5tVwTLdwaP8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TZBb+rGSFDAJfp+L/OoWpQNb7WndHj0lnZDmBKY8X2Z2NeI7AC6XOUUIwinFw9Iw0 aj33mK/sEO0MS3I0SECxkyuw7h0pKTwZTyyUCC9sPLAdXPnqALz0UJ4DuL0J4lgw6Y cCQhZoZ6yLWr7m4ZvbwrWdNpqNMjp6X0V8z3DFUM= 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 5.19 436/717] ata: fix ata_id_has_ncq_autosense() Date: Sat, 22 Oct 2022 09:25:15 +0200 Message-Id: <20221022072517.671033784@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747375990387522237?= X-GMAIL-MSGID: =?utf-8?q?1747375990387522237?= 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 bc136a43689f..4845443e0f08 100644 --- a/include/linux/ata.h +++ b/include/linux/ata.h @@ -570,6 +570,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) \ @@ -582,8 +586,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 Sat Oct 22 07:25: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: 7478 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1100603wrr; Sat, 22 Oct 2022 01:17:48 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4aDigR82Rgtw2VtLjCL2CVMCtCTauqdIAhZ3zDncnFTIGjZsZhRRDC9KLoag81rDs8eQez X-Received: by 2002:a63:2c4c:0:b0:434:e001:89fd with SMTP id s73-20020a632c4c000000b00434e00189fdmr19536546pgs.444.1666426667776; Sat, 22 Oct 2022 01:17:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666426667; cv=none; d=google.com; s=arc-20160816; b=wK/KMIyHkmq/ePWHnHKiLu1uVQnBE0b/4p7axfRftk0P1c568c5jB+WBPITG25U3Ic XtGYEVwcMXu6MjuiZEkiiLLRX56w6avoGC3wuAOLOD5BIu/eVlPhWtvXBzA3OBZ8BrxF uLr41mnFfmdY8ZcvuSjC8sfCp9kzh9IIz6ZslB6U7MUqqvluULeFo0l5TcCdde1Rt2VA bN8dRHY8cguZTxFkq9CoY/o++fCoDdX/+xmIQdTYXTF/W1QmMhO45Rd9HHMOs7FE0xnF UNkuds7QkuJXCVEdcy4IQkyef4MwtgQHo3H4y+FFbbWvFU4dohIXGwbOn/kmtjP0dW5X 9IWA== 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=NhuL2svf/LZ8a4GBRIwNsrhtvZ+UH7LEa3sRLaDV/6o=; b=WrphkgZZ33RwVfBX1t5Pr/NYFhZk6qkVD7mCes0XYju9zv1Zfiy/CBx+d1y1Iyemzg t8HRPZdR1aqBz64lydTgHB4XHftAB5d/g/88SyQ8wpuk9XZMnDbKdUjn3LRNImrTWWQx kZMj6ODedy7ErhrnOsCNQ+41k69ckLsBFtQJ8in3t434yJW8ascMG1OdeRGonMm1fs0d lyW83Y22CGFN9UUppGRvsM6jeB2ot5dZDsVx6qZIFVMfRptsOITMCfiy9yvkZzxIp0sB YibDfL0KK/l9yyTpQfweMMUyLJ0RAMvw8AVLjmdRka/xP5wtuL6uwfQa5H2R1AAMhJkK x/sw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=vYjnVHp6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 lb16-20020a17090b4a5000b0020d4bb591dcsi10812454pjb.165.2022.10.22.01.17.35; Sat, 22 Oct 2022 01:17: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=vYjnVHp6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S233337AbiJVIMV (ORCPT + 99 others); Sat, 22 Oct 2022 04:12:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57554 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232685AbiJVIKK (ORCPT ); Sat, 22 Oct 2022 04:10:10 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CFB79357ED; Sat, 22 Oct 2022 00:54: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 8DD6460B4D; Sat, 22 Oct 2022 07:53:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 79462C433C1; Sat, 22 Oct 2022 07:53:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425239; bh=PmD6zO5UnGlyOotddJ1nz8tCENZ3//IlzNov9zWnXmY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vYjnVHp6OxXoQBClsKC0ozdpLJmB1kHxnOGXspcGNq8qt4YvSCmxSxlPK2fSaA+VE kT20GbwFuD8hMcsPhysyWwS0FtnPsuTBbkkY8bF/ek7uDPS1QSZx4UOJP8JpVwvYDZ mFq+dfifLXsBObKKK5ecfhmKsTVwVL4G6VHNQo0c= 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 5.19 437/717] ata: fix ata_id_has_dipm() Date: Sat, 22 Oct 2022 09:25:16 +0200 Message-Id: <20221022072517.703029680@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747375009796190869?= X-GMAIL-MSGID: =?utf-8?q?1747375009796190869?= 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 4845443e0f08..e3050e153a71 100644 --- a/include/linux/ata.h +++ b/include/linux/ata.h @@ -574,6 +574,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) \ @@ -597,17 +601,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 Sat Oct 22 07:25: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: 7471 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1099073wrr; Sat, 22 Oct 2022 01:12:35 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4Ygf8pMxN3VOCpYfKBDDcgkX+DBBkciPRrXcsTEmA+CpQf7elcyQsiSNdJi4+g86qaP57w X-Received: by 2002:a17:902:8bc1:b0:17a:a61:ce68 with SMTP id r1-20020a1709028bc100b0017a0a61ce68mr22948246plo.66.1666426354886; Sat, 22 Oct 2022 01:12:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666426354; cv=none; d=google.com; s=arc-20160816; b=iaRxd8ZO0KZU0PqTKS8xkyDGi2ZqcEALqg8YNQj+i8bOBvjhFwlIGwY4kxg08OxYja 4nXTeylBT23h5zNC+we2SfNAsot1+Xx5Z+ddNpC/KiLpTCFcTyzUxumqjxXSpq7RiyiC 6L4veicrPD+r1kdLeYCU1lSert7lxSKBQ16L/1ySzEqNimAueiIvWu2U5H2OtfctWmTZ qMuCPUYj4M8J0q2+WDsDbOBiVYXOVCmHLXG4Mk6G8nWuivqgAgTkVjsPGqL7kOw78Yqd LLjwElxz6lyvXF+EAM9bDhKPLvxGQHpORr8yLF5qGu+Lg+7jBkDq/4ePgCL6tW03m+5Y forQ== 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=o99ZjAm4QpAiPWKLYdRrUCTD/OzQRQLITAXuQuDl83o=; b=ffAqmUNfqmot5s1r0GiETWpDVmvufLPPpU2EGp5qWB9qG2uRBssvWywNnGbdF8tH2G 3N7GVjSW2SCAoTjJKFBdp0on1mmu4svXr19gSMoYa450mhTLITB7AFu5lVcOybqFquiW xalcpzLL02aX2K81nMRCRIl/VzXI/63B+pWy4gKxNdEm/gVMN2vEBDIMdy3E1jUOdyrZ T4CVjUCd/eqFz75/IXsEg3+TUXdiF8/lLUBfiMUgqhCl5EIXLv6MwaCvU1DqdRpvXb+S OOMIUt7TACDmNymqtyTvDi7UgvzT3o91eEFgTFIGQqL9UIBIKN/yRA+Lz0vDHs1v6ep1 ZYOQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=K8zTKIh4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 fh24-20020a17090b035800b00212dc2e1abesi2145017pjb.47.2022.10.22.01.12.21; Sat, 22 Oct 2022 01:12: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=K8zTKIh4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S232709AbiJVILt (ORCPT + 99 others); Sat, 22 Oct 2022 04:11:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55322 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233397AbiJVIJo (ORCPT ); Sat, 22 Oct 2022 04:09:44 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 08E9F2C6E8C; Sat, 22 Oct 2022 00:54: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 635B9B82E05; Sat, 22 Oct 2022 07:54:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 035E5C433B5; Sat, 22 Oct 2022 07:54:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425243; bh=2aSqJ9LbDxNENvjzdwzi9Im+SVsBxTeYEvCqP3aIeus=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=K8zTKIh4UCFOQqs/YlUJBKaFOdiUyz53wmZL+fFMjhiH3JgydvLuPw5UMy8oxtgLH qGXt0ainVaQCIYYru0uNQuOc9REJzgQ9Rkrr/EXIYu/srptje6NaPMpYpbF57xcQKh Gxq41c+hHFP0EIaKqdKEzd2toCVX9stltN5ZPv/Y= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dan Carpenter , Liang Yang , Miquel Raynal , Sasha Levin Subject: [PATCH 5.19 438/717] mtd: rawnand: meson: fix bit map use in meson_nfc_ecc_correct() Date: Sat, 22 Oct 2022 09:25:17 +0200 Message-Id: <20221022072517.733903211@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747374681585872505?= X-GMAIL-MSGID: =?utf-8?q?1747374681585872505?= From: Dan Carpenter [ Upstream commit 3e4ad3212cf22687410b1e8f4e68feec50646113 ] The meson_nfc_ecc_correct() function accidentally does a right shift instead of a left shift so it only works for BIT(0). Also use BIT_ULL() because "correct_bitmap" is a u64 and we want to avoid shift wrapping bugs. Fixes: 8fae856c5350 ("mtd: rawnand: meson: add support for Amlogic NAND flash controller") Signed-off-by: Dan Carpenter Acked-by: Liang Yang Signed-off-by: Miquel Raynal Link: https://lore.kernel.org/linux-mtd/YuI2zF1hP65+LE7r@kili Signed-off-by: Sasha Levin --- drivers/mtd/nand/raw/meson_nand.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/mtd/nand/raw/meson_nand.c b/drivers/mtd/nand/raw/meson_nand.c index 032180183339..b97adeee4cc1 100644 --- a/drivers/mtd/nand/raw/meson_nand.c +++ b/drivers/mtd/nand/raw/meson_nand.c @@ -454,7 +454,7 @@ static int meson_nfc_ecc_correct(struct nand_chip *nand, u32 *bitflips, if (ECC_ERR_CNT(*info) != ECC_UNCORRECTABLE) { mtd->ecc_stats.corrected += ECC_ERR_CNT(*info); *bitflips = max_t(u32, *bitflips, ECC_ERR_CNT(*info)); - *correct_bitmap |= 1 >> i; + *correct_bitmap |= BIT_ULL(i); continue; } if ((nand->options & NAND_NEED_SCRAMBLING) && @@ -800,7 +800,7 @@ static int meson_nfc_read_page_hwecc(struct nand_chip *nand, u8 *buf, u8 *data = buf + i * ecc->size; u8 *oob = nand->oob_poi + i * (ecc->bytes + 2); - if (correct_bitmap & (1 << i)) + if (correct_bitmap & BIT_ULL(i)) continue; ret = nand_check_erased_ecc_chunk(data, ecc->size, oob, ecc->bytes + 2, From patchwork Sat Oct 22 07:25:18 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 7476 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1099220wrr; Sat, 22 Oct 2022 01:13:02 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7x89MzDJiYnqDYxd2lVhu9XbFbNpIz+OE8stRrpPlAb4ihNM8I747NV7C1vflS+RHcYcET X-Received: by 2002:a05:6a00:248e:b0:563:7910:29b9 with SMTP id c14-20020a056a00248e00b00563791029b9mr23262328pfv.43.1666426381957; Sat, 22 Oct 2022 01:13:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666426381; cv=none; d=google.com; s=arc-20160816; b=ARTONobvKesJVd+IBU6vLWbmn5qdC4spYmiMSpyFGvwvGwx2wJhTEQocsqdsLrmskd u/mSmSTE8wMYXs+AtRpDg8a2VrIROSJSui/vsLNSMtWLArFK7AXD8Uh4q+j3k7tKoBDC thOLgF2aRqFSyRx6UagtERswdNGrcZE2oU+pzRhhdDnpVhpurVZRndKs+LZjQC3UpZTP F3gymorF1vhlifb6aVBAmmb+je1rXZkWgh57pcd1jtfB6cmT8MruGx0zMKFCPhQzNk19 GoBA9lCimDHtdOXBnhNC7N+wM/rR22bwUHrYcDx6oaCEIlTS31qXawjp+g6fsexVpOE4 JxKA== 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=kXK7Kg1sitz6gVQQCIRVGUXDPSpAuQwxrs5gca//c1k=; b=PW2eai4uvgXBr5KtrIwbmS1CCVvesyN4QBDcPbmmmI3kxb0aOJx0kWF95DYqK6VKdq 7uWlZUx/5hwShn0i/jKcvMZb5UhNYhH7gp9HHgN3HDJA2BQOAKaoq9HAoT0A6FeEOyXE ccMXzjW++JYHUClAilpy2DYTIkEbiwnIbM6ozpn4TE/Np6GYHdFpEwb7RvcetLzRDVkO /sedUVbzus85hjHBkjObb85+Jgu83Yda7LnGF22b+NYcKxWQOKGasuhgbq8OcKXmItiJ //g5NsokFgNuJBG3fkG0TxaWbw56YLfUJpLRA9JA6XmDIszU7lK68riz9HIP1UzRkP6r Ah/Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=jYD8dGs6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 y64-20020a626443000000b00563a8bc4987si26272692pfb.118.2022.10.22.01.12.48; Sat, 22 Oct 2022 01:13: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=jYD8dGs6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S233192AbiJVIMK (ORCPT + 99 others); Sat, 22 Oct 2022 04:12:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37142 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233479AbiJVIJz (ORCPT ); Sat, 22 Oct 2022 04:09:55 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2F75C2A413; Sat, 22 Oct 2022 00:54: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 D4E7A60B8E; Sat, 22 Oct 2022 07:54:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C33FEC433D6; Sat, 22 Oct 2022 07:54:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425246; bh=Fbe3KMtCdsW7s2zZrX5blXwHhz1QzTcZnQm6f1z/NVM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jYD8dGs6U4z1PRw+GkGrj9GQ8HAn+EkLLCEq2m8hPrENE+mKE/nytkKVWMHetBDBb FJ3Zcf+GzYGvpkHK62SjQ5/MGkR/uFvR6vv3VLjCRjtrSszmwYKzyf4Q/6vDxIC2xc 6jSy561uLycuo8Qz0MAxprStqKMg3p+Xqr8Zp3cM= 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 , Sasha Levin Subject: [PATCH 5.19 439/717] md: Replace snprintf with scnprintf Date: Sat, 22 Oct 2022 09:25:18 +0200 Message-Id: <20221022072517.765142728@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747374710099801143?= X-GMAIL-MSGID: =?utf-8?q?1747374710099801143?= From: Saurabh Sengar [ Upstream commit 1727fd5015d8f93474148f94e34cda5aa6ad4a43 ] 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: Sasha Levin --- drivers/md/raid0.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/md/raid0.c b/drivers/md/raid0.c index 78addfe4a0c9..857c49399c28 100644 --- a/drivers/md/raid0.c +++ b/drivers/md/raid0.c @@ -47,7 +47,7 @@ static void dump_zones(struct mddev *mddev) int len = 0; for (k = 0; k < conf->strip_zone[j].nb_dev; k++) - len += snprintf(line+len, 200-len, "%s%pg", k?"/":"", + len += scnprintf(line+len, 200-len, "%s%pg", k?"/":"", conf->devlist[j * raid_disks + k]->bdev); pr_debug("md: zone%d=[%s]\n", j, line); From patchwork Sat Oct 22 07:25: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: 7793 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1123872wrr; Sat, 22 Oct 2022 02:34:47 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5CrfW776lwdhxybf6P5a7iSqHKo56OVBggen46sx3fyey5UWds2jUx2zz+V6lCu5PHeP14 X-Received: by 2002:a17:906:730e:b0:78d:94ab:77c2 with SMTP id di14-20020a170906730e00b0078d94ab77c2mr19334522ejc.639.1666431287437; Sat, 22 Oct 2022 02:34:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666431287; cv=none; d=google.com; s=arc-20160816; b=UDACXiLQQUJ4/pbBWFajdY4UEGXygwyh9FVv3JARJRKpAflRMalzWVk3v9EAQmz7mx IDMDkBJZQT1FvclVh36zRrRFo/Gr4yFq35nGfiXabmn2sIa6mArdFR44BWdztIUNEa3w 2J8ROiDJW/Khxku/9QiSFQ+HjX0ZMpJpnM2xeZSA8+5PafpJw4vShphwULDb6NESUlHQ nZm4RHRbfW6EDIOPReD9rzouhMFis2CW01L1hTizfJZYik0Ug8/yOkKI23DC+9skSOoQ EMTODgstsg5Tts04YhP6PXGqc6OYqnnxzVpmOg3T8bI0Ahm7vjnH9zixcULQvSkn2o9b kCxQ== 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=Aiv41OAiLQVYbSDQor8+efxAmfzbonTHXY9YOEK91/0=; b=ZOEGBpqldpiBespcGUEwboaXX+amsuCBWV32iZXqava06zMIqn4fFYeeNE96U+9ubU LetsOTAyh/FOIgtQ/DRggOv44f+5d7iwcbz1TJVw9fX03oaIw16iVRfDGMMNc7wfh9sd t0x/ccieZVFRWI7vQ1uNCfjt9w/wch/7YYsEhfETYRg4GUS9GhhbpHXLnd37YpWEFu+k lfDsKsBt6Zu4Jfve69ZuMg0zP/CSWVHVasXgGOQ4/sZ+el7sdikyeoRU7LLtp2bUIS7U W8ggtKGRSdan7PQI7BUQNnZ26100Ui9VbUWyILG/o5UDq4EMur2uQMxd4oYeGyDlVWhO W0Gg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=qvgwAB0o; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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-20020a170906ccc100b007799e328e10si19961355ejb.999.2022.10.22.02.34.23; Sat, 22 Oct 2022 02:34: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=qvgwAB0o; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231327AbiJVJSR (ORCPT + 99 others); Sat, 22 Oct 2022 05:18:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40462 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231538AbiJVJRn (ORCPT ); Sat, 22 Oct 2022 05:17: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 CA95B300732; Sat, 22 Oct 2022 01:31: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 095C360B26; Sat, 22 Oct 2022 07:54:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EDF30C433C1; Sat, 22 Oct 2022 07:54:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425249; bh=r7PNaX5jg937K92lGyiHI6AtzHOXbs4MRgqduWtMwJ8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qvgwAB0oLcKPDLBq5ABvQo3SvJbeqG46i6ijZ43V/auglPliGfimCX5lNerl2xhac nuV4m9BFNwNtsRjLMKN6zbi6Iu+xxQInUDJnnu8wsGokNg06W50mdxO7scX1CWIQxP ye7dt1M+e2qCT3z00J3KQRKbL8wpx2DCW1Ix05dI= 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 5.19 440/717] md/raid5: Ensure stripe_fill happens on non-read IO with journal Date: Sat, 22 Oct 2022 09:25:19 +0200 Message-Id: <20221022072517.796434253@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747379853810599160?= X-GMAIL-MSGID: =?utf-8?q?1747379853810599160?= 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 1c1310d539f2..d6cad962669a 100644 --- a/drivers/md/raid5.c +++ b/drivers/md/raid5.c @@ -3951,7 +3951,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 Sat Oct 22 07:25: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: 7475 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1099188wrr; Sat, 22 Oct 2022 01:12:55 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5yFL/gQeACh0Oj65/XkZL/c/H1N6W+8+oMGv/kkhTN6Okm5TlvRZ2RnLENFxw2b9gDRNRv X-Received: by 2002:a17:90b:4c45:b0:20d:4ead:6e3b with SMTP id np5-20020a17090b4c4500b0020d4ead6e3bmr27452637pjb.76.1666426375083; Sat, 22 Oct 2022 01:12:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666426375; cv=none; d=google.com; s=arc-20160816; b=tne3MZqynhJb4bmNbsLMuYtxe6cL9Q5eak0+RQp//D+8LFJHjBtkKjnb9aOYeKrBhp cSMj5xlTl22QW5vMajBgG9/TIwMffNeTR0vEGjOEqqslKrTjY/Gsc/d0L/CI4XfZaQ1C K2HD6a2I0luNpwxxSP3UsuaLueqIXyIm6vbE9oizxtg3/1hEovqNXTHg4P2maggOVqUh h6k1ozEBaW2NAJ1RcsNMDRCAaYeXPSEvQ8l1B0kKQ1WfRwccokGnLQfCaaH699Rr0jx4 qU1TZcm6akCoHNMvgrZnrfK/BMKlg8EFYZW2BxVmFiMFTeNwqjobP+FG3kR8+pCQuu0U gj9A== 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=xJvKh8IasxDDkrZfCUukauT355MX79q4JM7JKGRtm3k=; b=k5VftxcItEoWJSxpnBQJ1JxIfQgij63Sfny2H5XHZGIF74g29E3cWX6lkrzG0/QFt+ 4HGIAyyL5ePTgNZAiB2FNKH08HSJ8xgjWdwKNGrRMfZ4K6VmF3sHLm0rUYbi2Pp1HZ3C 09Kd4QEAYfIA+UjQoeiSaxq42RTFVZJwTaveSZC9d9Wqv+ddukI7GowbX9B5YvimjzVj z8HxdF5dxZx7WMIjac3OFexcTzXzTsFKQxgVsSSboFrMymKhceKuDKHUkjpxm/X4VI7c x1tuuuM4nUFnXHawRc2ZPNA5DBOzNUdVqdm+O1seGM0zUZiPbg2aNHrx2xqkdPZqoho+ qqwA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=lYUcQ4DK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 q13-20020a17090311cd00b00172f8a4b3e1si30823326plh.81.2022.10.22.01.12.42; Sat, 22 Oct 2022 01: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=lYUcQ4DK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S232975AbiJVIMQ (ORCPT + 99 others); Sat, 22 Oct 2022 04:12:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37532 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233514AbiJVIKE (ORCPT ); Sat, 22 Oct 2022 04:10:04 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D7ECF360B8; Sat, 22 Oct 2022 00:54: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 311E260B83; Sat, 22 Oct 2022 07:54:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 244A7C433C1; Sat, 22 Oct 2022 07:54:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425252; bh=YcStJxjHg0fqIvmWcwiT7jzTU68fC8sbWFU0pppjLsA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lYUcQ4DKKYexnB1Cbt0VJmia5xka5gBhoEiJ8pRsFKQYHYuQ87XCztb/QI6x8Epm2 9+1C3IXw8UH7Xa2hRtCWELdR0iJIB3mPgHJWzorU7W1Sjvfi3SgMFiTqQvlR6KXYfS LtYfibP5t2OWIWfLLBZLiWByOQwPDFhzIBVDgako= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, David Sloan , Logan Gunthorpe , Christoph Hellwig , Guoqing Jiang , Song Liu , Sasha Levin Subject: [PATCH 5.19 441/717] md/raid5: Remove unnecessary bio_put() in raid5_read_one_chunk() Date: Sat, 22 Oct 2022 09:25:20 +0200 Message-Id: <20221022072517.827549241@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747374702651548926?= X-GMAIL-MSGID: =?utf-8?q?1747374702651548926?= From: David Sloan [ Upstream commit c66a6f41e09ad386fd2cce22b9cded837bbbc704 ] When running chunk-sized reads on disks with badblocks duplicate bio free/puts are observed: ============================================================================= BUG bio-200 (Not tainted): Object already free ----------------------------------------------------------------------------- Allocated in mempool_alloc_slab+0x17/0x20 age=3 cpu=2 pid=7504 __slab_alloc.constprop.0+0x5a/0xb0 kmem_cache_alloc+0x31e/0x330 mempool_alloc_slab+0x17/0x20 mempool_alloc+0x100/0x2b0 bio_alloc_bioset+0x181/0x460 do_mpage_readpage+0x776/0xd00 mpage_readahead+0x166/0x320 blkdev_readahead+0x15/0x20 read_pages+0x13f/0x5f0 page_cache_ra_unbounded+0x18d/0x220 force_page_cache_ra+0x181/0x1c0 page_cache_sync_ra+0x65/0xb0 filemap_get_pages+0x1df/0xaf0 filemap_read+0x1e1/0x700 blkdev_read_iter+0x1e5/0x330 vfs_read+0x42a/0x570 Freed in mempool_free_slab+0x17/0x20 age=3 cpu=2 pid=7504 kmem_cache_free+0x46d/0x490 mempool_free_slab+0x17/0x20 mempool_free+0x66/0x190 bio_free+0x78/0x90 bio_put+0x100/0x1a0 raid5_make_request+0x2259/0x2450 md_handle_request+0x402/0x600 md_submit_bio+0xd9/0x120 __submit_bio+0x11f/0x1b0 submit_bio_noacct_nocheck+0x204/0x480 submit_bio_noacct+0x32e/0xc70 submit_bio+0x98/0x1a0 mpage_readahead+0x250/0x320 blkdev_readahead+0x15/0x20 read_pages+0x13f/0x5f0 page_cache_ra_unbounded+0x18d/0x220 Slab 0xffffea000481b600 objects=21 used=0 fp=0xffff8881206d8940 flags=0x17ffffc0010201(locked|slab|head|node=0|zone=2|lastcpupid=0x1fffff) CPU: 0 PID: 34525 Comm: kworker/u24:2 Not tainted 6.0.0-rc2-localyes-265166-gf11c5343fa3f #143 Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.13.0-1ubuntu1.1 04/01/2014 Workqueue: raid5wq raid5_do_work Call Trace: dump_stack_lvl+0x5a/0x78 dump_stack+0x10/0x16 print_trailer+0x158/0x165 object_err+0x35/0x50 free_debug_processing.cold+0xb7/0xbe __slab_free+0x1ae/0x330 kmem_cache_free+0x46d/0x490 mempool_free_slab+0x17/0x20 mempool_free+0x66/0x190 bio_free+0x78/0x90 bio_put+0x100/0x1a0 mpage_end_io+0x36/0x150 bio_endio+0x2fd/0x360 md_end_io_acct+0x7e/0x90 bio_endio+0x2fd/0x360 handle_failed_stripe+0x960/0xb80 handle_stripe+0x1348/0x3760 handle_active_stripes.constprop.0+0x72a/0xaf0 raid5_do_work+0x177/0x330 process_one_work+0x616/0xb20 worker_thread+0x2bd/0x6f0 kthread+0x179/0x1b0 ret_from_fork+0x22/0x30 The double free is caused by an unnecessary bio_put() in the if(is_badblock(...)) error path in raid5_read_one_chunk(). The error path was moved ahead of bio_alloc_clone() in c82aa1b76787c ("md/raid5: move checking badblock before clone bio in raid5_read_one_chunk"). The previous code checked and freed align_bio which required a bio_put. After the move that is no longer needed as raid_bio is returned to the control of the common io path which performs its own endio resulting in a double free on bad device blocks. Fixes: c82aa1b76787c ("md/raid5: move checking badblock before clone bio in raid5_read_one_chunk") Signed-off-by: David Sloan Signed-off-by: Logan Gunthorpe Reviewed-by: Christoph Hellwig Acked-by: Guoqing Jiang Signed-off-by: Song Liu Signed-off-by: Sasha Levin --- drivers/md/raid5.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c index d6cad962669a..f498bd4af8c2 100644 --- a/drivers/md/raid5.c +++ b/drivers/md/raid5.c @@ -5446,7 +5446,6 @@ static int raid5_read_one_chunk(struct mddev *mddev, struct bio *raid_bio) if (is_badblock(rdev, sector, bio_sectors(raid_bio), &first_bad, &bad_sectors)) { - bio_put(raid_bio); rdev_dec_pending(rdev, mddev); return 0; } From patchwork Sat Oct 22 07:25: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: 7618 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1106835wrr; Sat, 22 Oct 2022 01:39:09 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7+cZBO/jbZ2NrDmOwdxS5mYOiZqwo39BAAKzKb2PJdb6tT8Rr8fAkxqoSy0jJ1yRFeO9Rg X-Received: by 2002:aa7:c40b:0:b0:45d:4492:a8cb with SMTP id j11-20020aa7c40b000000b0045d4492a8cbmr20878176edq.217.1666427949130; Sat, 22 Oct 2022 01:39:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666427949; cv=none; d=google.com; s=arc-20160816; b=ZbpBpGpwWrIiKXZcT6kJx1c5WLr7w2mRAbmC/spo2BvLAaGE+m4hJ9ocRxFlzxeOjx 4Ye81IzoU4eSPJan9tuPRL9Y8u9kVIcXmyjO+LioyyptyGAZ94zcp7Kbb8daK/dOq+PC /N306LWRNlPE9R14ZTbnQExzMl+eeMRuczNmj94I209w0kGFL13HkLt3a+s+6eh2AIgL ouXnezDScD8WgQeLtRkMl0/IMty9/YZmysf+MAOtKvQ6XicECGTyl/fLQl5no/iHVR0p EMByBHROXRVOM1YvXcAL/p1ZAX+bSaAylquWq7lty0RqYsqaLS/crJ9s5a/oiWeqKYG+ opEQ== 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=XQWTFWqPdrLlJyM9kTwxE6M4jvxIaSdeF7dUraf0DXY=; b=IKsfliXmfZHgOy2mJeL2iXEcRut0yr8/lmg6JHaTDWhNtDuqondp2uJSmcREK8z7/G Xi9jEfJjDZswDaHHGcWgLBmV14CKslcYAWbC1cFTee1y9n6CN5ErnItEFjp4IQyv4Dk+ aJ/WI0wTKq9lKefoT1G6vKXQmzbqJDvLE7R3TbbQIaLV1MwQm/a3rysDQPgo4UUeWepC 0Uf3L6TUJTVyVqf28aMpXZOCgbSh71O6jJKOkIUYGbXRLZVtPLga5KHwPIx+H8C+ZkLT lTJyAs4p4m1fKriEEbnS/M42b3ltdh03W6oJ8WxO909P6xelD/OJ1KQBdEnAbpdKn7Ma x4Lw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=kxayVuqs; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 sa26-20020a1709076d1a00b00741c0bd7061si22263972ejc.644.2022.10.22.01.38.44; Sat, 22 Oct 2022 01:39: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=kxayVuqs; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S234209AbiJVIg0 (ORCPT + 99 others); Sat, 22 Oct 2022 04:36:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58058 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234474AbiJVIa6 (ORCPT ); Sat, 22 Oct 2022 04:30:58 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2FF7029C3E2; Sat, 22 Oct 2022 01:02: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 48DDB60B81; Sat, 22 Oct 2022 07:54:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4DD4EC433D7; Sat, 22 Oct 2022 07:54:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425258; bh=PxotsaKLlKY7b4HcUMIZ3OuGfX1704mNrjuqwc66VrE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kxayVuqs/L4dWh00aiaXEIOxKMGSn5CHPmXJXXC1vYHwj5xjLsen9GI0wU1LfxSUs 6opnJFfCDPwFjvUK3F0FFb0wiqTwKkGVozbJ0gw0nMtAM979TF0zDAySvnss/0HMRr yeGcDF/0sNL1Hmezpou4yWhWB/kr8aFyNv7OpBHA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mark Zhang , Mark Bloch , Leon Romanovsky , Sasha Levin Subject: [PATCH 5.19 442/717] RDMA/cm: Use SLID in the work completion as the DLID in responder side Date: Sat, 22 Oct 2022 09:25:21 +0200 Message-Id: <20221022072517.860151769@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376353639991327?= X-GMAIL-MSGID: =?utf-8?q?1747376353639991327?= From: Mark Zhang [ Upstream commit b7d95040c13f61a4a6a859c5355faf583eff9658 ] The responder should always use WC's SLID as the dlid, to follow the IB SPEC section "13.5.4.2 COMMON RESPONSE ACTIONS": A responder always takes the following actions in constructing a response packet: - The SLID of the received packet is used as the DLID in the response packet. Fixes: ac3a949fb2ff ("IB/CM: Set appropriate slid and dlid when handling CM request") Signed-off-by: Mark Zhang Reviewed-by: Mark Bloch Link: https://lore.kernel.org/r/cd17c240231e059d2fc07c17dfe555d548b917eb.1662631201.git.leonro@nvidia.com Signed-off-by: Leon Romanovsky Signed-off-by: Sasha Levin --- drivers/infiniband/core/cm.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/infiniband/core/cm.c b/drivers/infiniband/core/cm.c index b985e0d9bc05..5c910f5c01b3 100644 --- a/drivers/infiniband/core/cm.c +++ b/drivers/infiniband/core/cm.c @@ -1632,14 +1632,13 @@ static void cm_path_set_rec_type(struct ib_device *ib_device, u32 port_num, static void cm_format_path_lid_from_req(struct cm_req_msg *req_msg, struct sa_path_rec *primary_path, - struct sa_path_rec *alt_path) + struct sa_path_rec *alt_path, + struct ib_wc *wc) { u32 lid; if (primary_path->rec_type != SA_PATH_REC_TYPE_OPA) { - sa_path_set_dlid(primary_path, - IBA_GET(CM_REQ_PRIMARY_LOCAL_PORT_LID, - req_msg)); + sa_path_set_dlid(primary_path, wc->slid); sa_path_set_slid(primary_path, IBA_GET(CM_REQ_PRIMARY_REMOTE_PORT_LID, req_msg)); @@ -1676,7 +1675,8 @@ static void cm_format_path_lid_from_req(struct cm_req_msg *req_msg, static void cm_format_paths_from_req(struct cm_req_msg *req_msg, struct sa_path_rec *primary_path, - struct sa_path_rec *alt_path) + struct sa_path_rec *alt_path, + struct ib_wc *wc) { primary_path->dgid = *IBA_GET_MEM_PTR(CM_REQ_PRIMARY_LOCAL_PORT_GID, req_msg); @@ -1734,7 +1734,7 @@ static void cm_format_paths_from_req(struct cm_req_msg *req_msg, if (sa_path_is_roce(alt_path)) alt_path->roce.route_resolved = false; } - cm_format_path_lid_from_req(req_msg, primary_path, alt_path); + cm_format_path_lid_from_req(req_msg, primary_path, alt_path, wc); } static u16 cm_get_bth_pkey(struct cm_work *work) @@ -2148,7 +2148,7 @@ static int cm_req_handler(struct cm_work *work) if (cm_req_has_alt_path(req_msg)) work->path[1].rec_type = work->path[0].rec_type; cm_format_paths_from_req(req_msg, &work->path[0], - &work->path[1]); + &work->path[1], work->mad_recv_wc->wc); if (cm_id_priv->av.ah_attr.type == RDMA_AH_ATTR_TYPE_ROCE) sa_path_set_dmac(&work->path[0], cm_id_priv->av.ah_attr.roce.dmac); From patchwork Sat Oct 22 07:25: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: 7477 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1100549wrr; Sat, 22 Oct 2022 01:17:36 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6zLk+rFCpZLWg2knEKTFGCo7sEEJyJ/TbM/gKhjZ+R+3QjGJVEMd1v947JsdgObMsi1qcD X-Received: by 2002:a17:902:8c81:b0:178:1701:cd with SMTP id t1-20020a1709028c8100b00178170100cdmr23788805plo.138.1666426656602; Sat, 22 Oct 2022 01:17:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666426656; cv=none; d=google.com; s=arc-20160816; b=Ihf7MiaKrMCwmlwWNQSYrZLJq0l60+wSdXnE6tpppyUZBHd8oWNJxOMiZBQOvSqJlb bUXCW/1rW6PiaCISw5dGEDT+CY6tclVSAl/XbV0qauLCjX1Wmu/7A7unKdNGQYWHXXn6 WHeU89MjGoH5ID4/OvH1KHIv/Vfk2S4nl7g3seB72kz+rh0TqGjzFd2TRda0QCyR8MjZ aIXSD+paqBSPCqZnlBNhsrN1wnM9/IYmzFdRPTOR6KP7mPNFZ1kLnYJWpj5fYvtx6b5R xjbH+JYqGnYFnMya2098pNtS9imHXoMtS4jTzjIpuj+fJ6RG1L1aBWgeb/XmRaPxPXAK Zqbw== 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=140KZRh9LACpHILqQQ4t5cICFNwZBFF4XqeBjeTeCTE=; b=ceNx+7hbdoFzUZsJAvZg0uBkWElofMkGD9IHgYrAti7lvTIct8HpxVdX9c1TPxAyQI DudN5I4qdHXmN/seUnzE3GOaPHBo4abKGuCKAtxQ+7OM4mhdy6UH+4YPWRiq81RGllGq 3ndG4oFR4+tvbqwwK0CVxVMLyGd3Fkt6kxyDjjUscMYXjqoqSI4Mgf4tDb4DmYOmB7WP 2nuNPi0CervQv9G9PCs33WfSfp0em/An9jmoPgrH9VIAg//Xaqznkczu+ghm+6lvdUXk KBml9MDwWVIhGvu/lcAYwUY0wMFdeKl2I2JrPCKv43mgNh5r0OxjW/aAwpsfGQko7qjp 8bbw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=kRj5ZjjK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 b22-20020a63d316000000b004636ce58db2si27728865pgg.776.2022.10.22.01.17.22; Sat, 22 Oct 2022 01:17: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=kRj5ZjjK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S233343AbiJVIM0 (ORCPT + 99 others); Sat, 22 Oct 2022 04:12:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57592 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232833AbiJVIKK (ORCPT ); Sat, 22 Oct 2022 04:10:10 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D4D771834C; Sat, 22 Oct 2022 00:54: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 E17CEB82E0B; Sat, 22 Oct 2022 07:54:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5956AC433D6; Sat, 22 Oct 2022 07:54:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425261; bh=W/qDAiByOmW1Y7CEAQjz9gU5fPmSyXrCb/xo6AYIas8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kRj5ZjjKrKElQ0Iryj0dz8aGZRzoKS7ajvembMVZJcbxIaSUVIqHS1POxc/L6JEdf 8Ztw4k5hhiz23powDVufy1O1VlS48PAIhql7rfLSEO8HpRS/1hxby8MbO422s6byPr AeIkCn40dZyN4Quc9n4imso4fOXV0DSEEoHHMEXo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Daisuke Matsuda , Leon Romanovsky , Sasha Levin Subject: [PATCH 5.19 443/717] IB: Set IOVA/LENGTH on IB_MR in core/uverbs layers Date: Sat, 22 Oct 2022 09:25:22 +0200 Message-Id: <20221022072517.901595870@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747374997720265973?= X-GMAIL-MSGID: =?utf-8?q?1747374997720265973?= From: Daisuke Matsuda [ Upstream commit 241f9a27e0fc0eaf23e3d52c8450f10648cd11f1 ] Set 'iova' and 'length' on ib_mr in ib_uverbs and ib_core layers to let all drivers have the members filled. Also, this commit removes redundancy in the respective drivers. Previously, commit 04c0a5fcfcf65 ("IB/uverbs: Set IOVA on IB MR in uverbs layer") changed to set 'iova', but seems to have missed 'length' and the ib_core layer at that time. Fixes: 04c0a5fcfcf65 ("IB/uverbs: Set IOVA on IB MR in uverbs layer") Signed-off-by: Daisuke Matsuda Link: https://lore.kernel.org/r/20220921080844.1616883-1-matsuda-daisuke@fujitsu.com Signed-off-by: Leon Romanovsky Signed-off-by: Sasha Levin --- drivers/infiniband/core/uverbs_cmd.c | 5 ++++- drivers/infiniband/core/verbs.c | 2 ++ drivers/infiniband/hw/hns/hns_roce_mr.c | 1 - drivers/infiniband/hw/mlx4/mr.c | 1 - 4 files changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/infiniband/core/uverbs_cmd.c b/drivers/infiniband/core/uverbs_cmd.c index 046376bd68e2..4796f6a8828c 100644 --- a/drivers/infiniband/core/uverbs_cmd.c +++ b/drivers/infiniband/core/uverbs_cmd.c @@ -739,6 +739,7 @@ static int ib_uverbs_reg_mr(struct uverbs_attr_bundle *attrs) mr->uobject = uobj; atomic_inc(&pd->usecnt); mr->iova = cmd.hca_va; + mr->length = cmd.length; rdma_restrack_new(&mr->res, RDMA_RESTRACK_MR); rdma_restrack_set_name(&mr->res, NULL); @@ -861,8 +862,10 @@ static int ib_uverbs_rereg_mr(struct uverbs_attr_bundle *attrs) mr->pd = new_pd; atomic_inc(&new_pd->usecnt); } - if (cmd.flags & IB_MR_REREG_TRANS) + if (cmd.flags & IB_MR_REREG_TRANS) { mr->iova = cmd.hca_va; + mr->length = cmd.length; + } } memset(&resp, 0, sizeof(resp)); diff --git a/drivers/infiniband/core/verbs.c b/drivers/infiniband/core/verbs.c index e54b3f1b730e..f8964c8cf0ad 100644 --- a/drivers/infiniband/core/verbs.c +++ b/drivers/infiniband/core/verbs.c @@ -2149,6 +2149,8 @@ struct ib_mr *ib_reg_user_mr(struct ib_pd *pd, u64 start, u64 length, mr->pd = pd; mr->dm = NULL; atomic_inc(&pd->usecnt); + mr->iova = virt_addr; + mr->length = length; rdma_restrack_new(&mr->res, RDMA_RESTRACK_MR); rdma_restrack_parent_name(&mr->res, &pd->res); diff --git a/drivers/infiniband/hw/hns/hns_roce_mr.c b/drivers/infiniband/hw/hns/hns_roce_mr.c index 867972c2a894..dedfa56f5773 100644 --- a/drivers/infiniband/hw/hns/hns_roce_mr.c +++ b/drivers/infiniband/hw/hns/hns_roce_mr.c @@ -249,7 +249,6 @@ struct ib_mr *hns_roce_reg_user_mr(struct ib_pd *pd, u64 start, u64 length, goto err_alloc_pbl; mr->ibmr.rkey = mr->ibmr.lkey = mr->key; - mr->ibmr.length = length; return &mr->ibmr; diff --git a/drivers/infiniband/hw/mlx4/mr.c b/drivers/infiniband/hw/mlx4/mr.c index 04a67b481608..a40bf58bcdd3 100644 --- a/drivers/infiniband/hw/mlx4/mr.c +++ b/drivers/infiniband/hw/mlx4/mr.c @@ -439,7 +439,6 @@ struct ib_mr *mlx4_ib_reg_user_mr(struct ib_pd *pd, u64 start, u64 length, goto err_mr; mr->ibmr.rkey = mr->ibmr.lkey = mr->mmr.key; - mr->ibmr.length = length; mr->ibmr.page_size = 1U << shift; return &mr->ibmr; From patchwork Sat Oct 22 07:25: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: 7842 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1153265wrr; Sat, 22 Oct 2022 04:05:12 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7JQ00sYgo3WoAinI/F0FdkkH5GMkZ1bywfRNI5UA+YKJMBbXUIcWiB1ELqLZMIntsjzcc6 X-Received: by 2002:a17:906:5daa:b0:791:8933:f9f0 with SMTP id n10-20020a1709065daa00b007918933f9f0mr19338642ejv.335.1666436711834; Sat, 22 Oct 2022 04:05:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666436711; cv=none; d=google.com; s=arc-20160816; b=dABnRQUUKKgbbnYEcc1otq7OHR9OXJkNL0/ITYeN284uD/V4m0JhuBBtIxUEdqgHwY vKP5xKC1lalJLcjgQnPAs8u9xwyX3YrpfIkV+HIBInuEZQLsvGjHOM0wx5UdV5U0+gMS P6u4anX0ftxFA4DCTxi0tPcOaggleiRpf40ob1YpCTD248hCuTw/wIZGKKlHgIfuzU3G HGdM3v1xTLHN7iANNFtf9LoRB95jfK3NpyDq5oLDnza2938IW5k2rVFlljc+0fbC/wsx Pec4ry3EKglOi46rfDyFJicPhp8GPZJBS7EpWQ/kw5NDFpaolTvFUl2YdrmdBZQveaSS +xqQ== 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=UQT/RBcMwYsllz3NtL9eyvzMx1/o4/tLqDof4NbQ7EA=; b=yLrqhjUq9hglgv0WpAUlVWo2QvG99KHWucyhD10hxvooOgvN7yztf+IrtfDF8XZlFA QUwt+IvME6+KZWcwMqslDry7UdbMz2yv77/li911VKoOmykHyBQNnXZl4P7j697hozN4 gVtWOUi/seEcbtBUUvbxgXA4etwzVSZfRgRZCAJevE/V3y/JOaLPzI9FvQj8tvtqQ51z RyPHMI/qvEu1gdH24U/KlTJud4yIiUxmZPYR/E+I/Iqm8EMVoTlnuWaOMnEi1dI5g3p4 Y+nhn+RTnIyUrng/NRpqvGZz/BrW4YRU/jOHkM64qtc5C3oEbbt0IOKXI6XWlN8c9rXU ZN2g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=khJ39P7w; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 g5-20020a056402090500b00457e6752422si19493139edz.189.2022.10.22.04.04.39; Sat, 22 Oct 2022 04:05: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=khJ39P7w; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S230000AbiJVK7Q (ORCPT + 99 others); Sat, 22 Oct 2022 06:59:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46418 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230253AbiJVK6p (ORCPT ); Sat, 22 Oct 2022 06:58:45 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2686D46D85; Sat, 22 Oct 2022 03:17: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 55029B82E05; Sat, 22 Oct 2022 07:54:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6B13BC433D6; Sat, 22 Oct 2022 07:54:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425265; bh=aRoHgLT18h88Rn43em+coJfcbxqhuSaOBcPrfYQ//0Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=khJ39P7ww19bhrsKyQWDEX5PalT+DcYk+zzFVH5uxOZVFll1TeDhRtOyMALa9alU6 5/10WmQ5LZvYMB+fBWDzbb9gtMfEah8NyApha9wnGUVgdVlAYCPzuSpke8ckYmZz0R siTnpdd8BlSd3XYnWCAwDVB0btyGbPp3sz61Z7CQ= 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 5.19 444/717] xhci: Dont show warning for reinit on known broken suspend Date: Sat, 22 Oct 2022 09:25:23 +0200 Message-Id: <20221022072517.931513104@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 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?1747385541163298516?= X-GMAIL-MSGID: =?utf-8?q?1747385541163298516?= 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 38649284ff88..a7ef675f00fd 100644 --- a/drivers/usb/host/xhci.c +++ b/drivers/usb/host/xhci.c @@ -1183,7 +1183,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 Sat Oct 22 07:25: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: 7483 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1104439wrr; Sat, 22 Oct 2022 01:31:59 -0700 (PDT) X-Google-Smtp-Source: AMsMyM46+WYuBty5Km5GPDmuB/PjugDRe5cY49cIkloLtZW6s3W9z4Z11dEUlrWOAWm8qqP1IhtQ X-Received: by 2002:a05:6a00:24c2:b0:52e:7181:a8a0 with SMTP id d2-20020a056a0024c200b0052e7181a8a0mr23530922pfv.57.1666427519003; Sat, 22 Oct 2022 01:31:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666427518; cv=none; d=google.com; s=arc-20160816; b=lprNpDbURZTZMMqJLeSwS1cQqAKecRjlTVOb8rt7AlD8oZLzhP7S9slF9Aa+4XcgnE L51np6Rl5nXkYjLhBZmLz/PE5hEwssyVDvgOCn4DtG7QB6A3aOCX0adOFofHsD3LmMjH VD56MQBBqYioihwN3KXljTOET0pXqIDdFgI7PgUA+XZ9pXsI6AYOmSExDNFb3QJkHOCP vui8Eje6jn24ipBaRl9nYPLeRZr5FY9YlTSX5KUbibB7CdhqLO91kxEasACDAgdhLr9W hrEnWxT8y2IrRtu3R7t0p+O6psm3g2PhsjvHEF7D3I6/V/Iz4d8tYxD5Lb47aoDbk3NT Y9QA== 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=GopUa9vsr1OxMVWo981lkrXIwnEQVOtAvY4d/Qv/5AE=; b=AplgSu0nXLXqEskrBr4yvGPxfZAm5L31d6Md3pSRPsGKBDBfIqA5pnoeJY0k5e6DPH DflxCGJat6F8Z3kj9toSsBLjFcCMEA9X6nPxwJOQkL0PWmlFuoIhkWMOyXv59qe0cppE 1+vkt1R5DqZXPBCKr9KWoaHTX10MCMMLYvpbFggdtSgzm19WrbQoPQylib0+E008JlCn QeiRRqjfsjUe0k0RlHLIzhYuv4V6Sl56+68Ij6Vy8CBiHvMzurVLneGayDbnhP4XeauZ BzDO7WbZRWFGOBIqEaiXiEcOgw1TVxqEt28g9L0HyVoKVr4tZMGGZVaTRdb3YqjojCta fWpg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="sNRRZpj/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 z11-20020a056a001d8b00b0055f08bf4276si25168694pfw.41.2022.10.22.01.31.46; Sat, 22 Oct 2022 01:31: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="sNRRZpj/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S233361AbiJVIMm (ORCPT + 99 others); Sat, 22 Oct 2022 04:12:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60224 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230424AbiJVIKk (ORCPT ); Sat, 22 Oct 2022 04:10:40 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6174C371A3; Sat, 22 Oct 2022 00:54: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 ams.source.kernel.org (Postfix) with ESMTPS id 7DC4AB82E16; Sat, 22 Oct 2022 07:54:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BF0B0C433D6; Sat, 22 Oct 2022 07:54:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425268; bh=0yp0MeoCQn55dZ0Ly+Cfe8r8xQVfv9yqt30m368kJ1M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sNRRZpj/NdGrNzVOHCPC/mqU7YdwfAc2Ur60N2gvwlPkPXYDxGk6H2UmyCPZ1Tb5b Tp8NP+phee5xO1yNggmN34Xb0l/VavgLmaImWJ1Gy1ZLQdGsRp26nlV53SB/ooTcD8 yt4DqjLNNZ/KjFxTmg7Ed1BmhuLVhwRBtQJYV6tk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Albert Briscoe , Sasha Levin Subject: [PATCH 5.19 445/717] usb: gadget: function: fix dangling pnp_string in f_printer.c Date: Sat, 22 Oct 2022 09:25:24 +0200 Message-Id: <20221022072517.968783270@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747375902214386565?= X-GMAIL-MSGID: =?utf-8?q?1747375902214386565?= 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 abec5c58f525..a881c69b1f2b 100644 --- a/drivers/usb/gadget/function/f_printer.c +++ b/drivers/usb/gadget/function/f_printer.c @@ -89,7 +89,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; }; @@ -1000,16 +1000,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 */ @@ -1475,7 +1475,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 Sat Oct 22 07:25: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: 7494 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1104863wrr; Sat, 22 Oct 2022 01:33:32 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4KDQ1eMld2eDQc7GChjhQfpV74n+RFUqLjikxQqH71LXnShpto/gUI8phVAjzKoUI7yhhT X-Received: by 2002:a63:9a11:0:b0:46e:dbd3:413 with SMTP id o17-20020a639a11000000b0046edbd30413mr1594523pge.240.1666427612610; Sat, 22 Oct 2022 01:33:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666427612; cv=none; d=google.com; s=arc-20160816; b=MsiHPxd0ceshLcomgwfFj7w2Vi07W+BSExFPfAQciORvSzcM02gXsHPqJ6OPVRk1F3 1VkG/6rOAjU9/4hfJEX/yWMyS+hvcKY0dvi1JOWyLdC+up6iMklenwvr08khTmW3OBvj TTeq/WEEkskT3Gj5AAzFbi8IffPViHBhxlbZlSr8ovA2t9Adp3gWwYiTnZaWs9gDUzvo 2cFYOxhWTpbc9oX6M3GG0MP2d9yePE7QMCHV2t4w3SrTfB/k4xS1PFNEB16zZcqjLsQw OzgUxCNKIkvDw449rn/s8njaqYbNBYIdqM78U9vcWhgaFcWjSg1GfEDOdJE9HaEQaMOk 1XaQ== 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=XuT5TTyckHEg+/1UkDNmqg7ZAbsohqsMt1/5UEYwdfk=; b=gL/Y3GFgJiYnF5oM44Xhp3w2O/pPrZ2qeeAPpU0Ts1/Tr6R4IAjyQp2rDr+2B4VGvX LiRngHvoYoGOFzeX6f5xRStA0KsboyDa9LJUVraLx02oiu9o6uH6GCKumUdHi5zEacSu noNtArldQTFam2Q0yBuFH9RLZdaSTs2LdSejAM8OHgY905q6UfLq7a9POvG/ZYs+jExN JsB1hPva6RIgtuGb8+M3ryYm2u94BWr6pM20VuXyAH3ukfp0XP0xs0Bgjk5/+yCGO0dO 3KnLmtsABKxh5HPXqR3vSU3qBdvi1C25Bo8ZGw62/MTHFrJPpq2v5Z419MG+O9/ETEOm M3TQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Srx8d79V; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 8-20020a631948000000b00462ed110adbsi30317244pgz.316.2022.10.22.01.33.20; Sat, 22 Oct 2022 01:33: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=Srx8d79V; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S233580AbiJVISX (ORCPT + 99 others); Sat, 22 Oct 2022 04:18:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38294 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234033AbiJVIP6 (ORCPT ); Sat, 22 Oct 2022 04:15: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 C210F2DB796; Sat, 22 Oct 2022 00:56: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 B893460AE6; Sat, 22 Oct 2022 07:54:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A69B5C433D6; Sat, 22 Oct 2022 07:54:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425271; bh=UIhXXYdwIpBrrDXc+TJvtBLDWPr6Ak8cvZrM8faBrUI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Srx8d79VdB31oyNr+goEWWA7w7yS4X9M22bDvetjmL8nFTeEcULAEF3qw1dhZ6Oz9 8puIMnLAfZwuheTg9up+BwEd7sL97rc2MudOK9Dxt/LxRF6Zg/PKVRXLyBCy30W261 smSoI9kvm5QvGLYO64AaxyLoS+LL2DHc202ZpmQQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dan Carpenter , Sasha Levin Subject: [PATCH 5.19 446/717] usb: dwc3: core: fix some leaks in probe Date: Sat, 22 Oct 2022 09:25:25 +0200 Message-Id: <20221022072518.008482544@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747375999967732014?= X-GMAIL-MSGID: =?utf-8?q?1747375999967732014?= From: Dan Carpenter [ Upstream commit 2a735e4b5580a2a6bbd6572109b4c4f163c57462 ] The dwc3_get_properties() function calls: dwc->usb_psy = power_supply_get_by_name(usb_psy_name); so there is some additional clean up required on these error paths. Fixes: 6f0764b5adea ("usb: dwc3: add a power supply for current control") Signed-off-by: Dan Carpenter Link: https://lore.kernel.org/r/YyxFYFnP53j9sCg+@kili Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/usb/dwc3/core.c | 58 +++++++++++++++++++++++++---------------- 1 file changed, 36 insertions(+), 22 deletions(-) diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c index ebf3afad378b..2419ef828f9b 100644 --- a/drivers/usb/dwc3/core.c +++ b/drivers/usb/dwc3/core.c @@ -1678,8 +1678,10 @@ static int dwc3_probe(struct platform_device *pdev) dwc3_get_properties(dwc); dwc->reset = devm_reset_control_array_get_optional_shared(dev); - if (IS_ERR(dwc->reset)) - return PTR_ERR(dwc->reset); + if (IS_ERR(dwc->reset)) { + ret = PTR_ERR(dwc->reset); + goto put_usb_psy; + } if (dev->of_node) { /* @@ -1689,45 +1691,57 @@ static int dwc3_probe(struct platform_device *pdev) * check for them to retain backwards compatibility. */ dwc->bus_clk = devm_clk_get_optional(dev, "bus_early"); - if (IS_ERR(dwc->bus_clk)) - return dev_err_probe(dev, PTR_ERR(dwc->bus_clk), - "could not get bus clock\n"); + if (IS_ERR(dwc->bus_clk)) { + ret = dev_err_probe(dev, PTR_ERR(dwc->bus_clk), + "could not get bus clock\n"); + goto put_usb_psy; + } if (dwc->bus_clk == NULL) { dwc->bus_clk = devm_clk_get_optional(dev, "bus_clk"); - if (IS_ERR(dwc->bus_clk)) - return dev_err_probe(dev, PTR_ERR(dwc->bus_clk), - "could not get bus clock\n"); + if (IS_ERR(dwc->bus_clk)) { + ret = dev_err_probe(dev, PTR_ERR(dwc->bus_clk), + "could not get bus clock\n"); + goto put_usb_psy; + } } dwc->ref_clk = devm_clk_get_optional(dev, "ref"); - if (IS_ERR(dwc->ref_clk)) - return dev_err_probe(dev, PTR_ERR(dwc->ref_clk), - "could not get ref clock\n"); + if (IS_ERR(dwc->ref_clk)) { + ret = dev_err_probe(dev, PTR_ERR(dwc->ref_clk), + "could not get ref clock\n"); + goto put_usb_psy; + } if (dwc->ref_clk == NULL) { dwc->ref_clk = devm_clk_get_optional(dev, "ref_clk"); - if (IS_ERR(dwc->ref_clk)) - return dev_err_probe(dev, PTR_ERR(dwc->ref_clk), - "could not get ref clock\n"); + if (IS_ERR(dwc->ref_clk)) { + ret = dev_err_probe(dev, PTR_ERR(dwc->ref_clk), + "could not get ref clock\n"); + goto put_usb_psy; + } } dwc->susp_clk = devm_clk_get_optional(dev, "suspend"); - if (IS_ERR(dwc->susp_clk)) - return dev_err_probe(dev, PTR_ERR(dwc->susp_clk), - "could not get suspend clock\n"); + if (IS_ERR(dwc->susp_clk)) { + ret = dev_err_probe(dev, PTR_ERR(dwc->susp_clk), + "could not get suspend clock\n"); + goto put_usb_psy; + } if (dwc->susp_clk == NULL) { dwc->susp_clk = devm_clk_get_optional(dev, "suspend_clk"); - if (IS_ERR(dwc->susp_clk)) - return dev_err_probe(dev, PTR_ERR(dwc->susp_clk), - "could not get suspend clock\n"); + if (IS_ERR(dwc->susp_clk)) { + ret = dev_err_probe(dev, PTR_ERR(dwc->susp_clk), + "could not get suspend clock\n"); + goto put_usb_psy; + } } } ret = reset_control_deassert(dwc->reset); if (ret) - return ret; + goto put_usb_psy; ret = dwc3_clk_enable(dwc); if (ret) @@ -1827,7 +1841,7 @@ static int dwc3_probe(struct platform_device *pdev) dwc3_clk_disable(dwc); assert_reset: reset_control_assert(dwc->reset); - +put_usb_psy: if (dwc->usb_psy) power_supply_put(dwc->usb_psy); From patchwork Sat Oct 22 07:25: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: 7480 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1101464wrr; Sat, 22 Oct 2022 01:21:01 -0700 (PDT) X-Google-Smtp-Source: AMsMyM48A7PiWZ3KwYuQiwpRUNZ5qHrMiZsaZH38gY+VePe0qLXZN+iDUi6Fi2hhuIesmyMCTDpF X-Received: by 2002:a05:6a00:2305:b0:565:60b0:40d9 with SMTP id h5-20020a056a00230500b0056560b040d9mr23062831pfh.77.1666426861642; Sat, 22 Oct 2022 01:21:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666426861; cv=none; d=google.com; s=arc-20160816; b=VT6dsArp6tbsiwpiqrvD6MOhC/zy8Yy6sQwgSD+gq9dOXc5WzNcFmaGY0GlnZfIXR2 Cp509y4bbo60HvI+pqrFD7+zhKlyBezhYqQKTKLjDCrB5CYteSm52CCohUNqdaKoq6Tc I2wSHd9ngKjl2rrdZGD4wBHDmY6U7vfWKiMp8PejYYIpVLsIxlWZ39nuJ8JiH0zQtN+W Te9f3unXj6tVcRyIbYjIGaIT+5ezfIZDQvUVT32RUOYvIDCGxCnriMorkiyIyyU27xxy e3EzCY1Vd3XQuqHx/KhzFf5M8NeBvsPHUMdKTOe+U5RUgkp0r3TgfuOoIS8YdwCPzLp9 whuQ== 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/ZhL/+2gwdWZCCCXosWejfzSNh7KUdlyhVqIkn4qE=; b=fxKkghAihWU1te0aVlFQeHDkQyzCUEKtxWRSqLjYxMdp2oBMOgARuM8KQdyOp+dsVn 2BVYNEd9mKO9rhArmPtaZNLQHzPhFT30SWbH6ItJne1eOLdDsi4IJ0w1yrs4Ht2AgyXC EjakzruTCiaQ6YHw4T6oqWcX55WQM2DK9nrUJakpTM7cnsbqNpZnoCea236FalhBGpug TTrmC2jUjy10nvb4LJqKkJTCeMswFzwFWB9hf10aSIDSnHwTUGkS29Nrs0TrO/TUC6vE toyOSbUqVCuTZvMR74N3QY8QavTVAk4k6XYszGyDER2i3TZLYSi9TSaDK7FWYAstEaMZ TI0Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=bKC2mKzE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 oj10-20020a17090b4d8a00b0020d887ded6esi9881924pjb.120.2022.10.22.01.20.48; Sat, 22 Oct 2022 01: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=bKC2mKzE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S233370AbiJVINQ (ORCPT + 99 others); Sat, 22 Oct 2022 04:13:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54406 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233308AbiJVILP (ORCPT ); Sat, 22 Oct 2022 04:11:15 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 35A7F42E50; Sat, 22 Oct 2022 00:54: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 DC5E560B09; Sat, 22 Oct 2022 07:54:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D22F8C433D6; Sat, 22 Oct 2022 07:54:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425274; bh=7DGMLTKFsU7+7Ad+NpWJf8+q3b2TJwi8QfsrxUDd5oo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bKC2mKzEk3DyJUY38R1Ax7izzoAQu2T7tNkp7gAx0vaDzdwoRX7RCsbhwfJBa/s/A Wr+7+yAXykKxgEi19m6Zi8SXMle5C+pNcUQIDC/KpPAea2APtTJkdUFIS16fCSP4HQ QzwvgDd9hJvY1EPMZ747pCIaB0WGo/ub+sEeXSPk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dan Carpenter , Sasha Levin Subject: [PATCH 5.19 447/717] drivers: serial: jsm: fix some leaks in probe Date: Sat, 22 Oct 2022 09:25:26 +0200 Message-Id: <20221022072518.048667262@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747375213266892707?= X-GMAIL-MSGID: =?utf-8?q?1747375213266892707?= 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 0ea799bf8dbb..417a5b6bffc3 100644 --- a/drivers/tty/serial/jsm/jsm_driver.c +++ b/drivers/tty/serial/jsm/jsm_driver.c @@ -211,7 +211,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 Sat Oct 22 07:25:27 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 7485 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1104715wrr; Sat, 22 Oct 2022 01:33:11 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6Ux4EKas5f6bVaYdURXCPe6AY/Su61ieUHadE14ucWw/fJTL4sQqVD45gBIR8JsQwqtwC7 X-Received: by 2002:a17:902:d58e:b0:17f:8003:1ceb with SMTP id k14-20020a170902d58e00b0017f80031cebmr23074439plh.54.1666427590797; Sat, 22 Oct 2022 01:33:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666427590; cv=none; d=google.com; s=arc-20160816; b=xtt9JLfh2WbpSabP2VVMX28T9h7kdNHliL0/8dNwxOfiw1mULeiMFioxBWPHivOHWy 4d4vXzx2WvnC5t3vHJm4Ye7uaL6rpN8qJTMDZbfpCVSHOIiQgTx612rS8sNwnNvSb5HF aHZ4RWO01wilObspQ4reU64Sefa39PytJ89dCFfF6Ib0G6gX7fqucE/Vda8oze50+yNt HqpAhuMheaJAiSpR81Jl8iZS6o6fMSrbKN9D1cuj3AK99cDR/hEti9DZ2xaoX832XTD1 7hWCux3mjYBoKQ4p8p0TjPLGZQLU3v5lrx5op32NqU8JNoKVUZsQxgIQSNB+C7osQSEG ZgZA== 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=/aislPPnPGSDJC95qf4bkhHERnUG0fOQMS5uaLGlw9s=; b=ZS2+mvHPKhHk0op4VGElxAm6LCsk9KQEpL8xc7qdTdI6VbGSj9ozGPXISCZVT5zEYp Sw//SdJzEycqjxJGcz5+i0etI/w9Sonn+79pyS5H1zWHAuksF+6nCdRue+2puqG9if22 h3KGhqI8hUoJSlt0ZOxFYXlY4IP4KgCebb6a5aSjBCBFvbZZdGViE6ogqEIED43oMrpS Ymz7KtPHIlZQxgMU/zdTN8ptFa/4TjQkjvgdmVq4gleNb2r+Wol1qq98pAAzZZmU6ndl RKBIUjXCM4e0II00LA/Uhsi3MihZM/BysV+EneJTTRPfXJP/LZPG4xHFfqg80QQ9QvjV cPJA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=hbZ9AgHf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 l4-20020a170903244400b001867ea919bdsi4163581pls.25.2022.10.22.01.32.58; Sat, 22 Oct 2022 01:33: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=hbZ9AgHf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S233220AbiJVIQ3 (ORCPT + 99 others); Sat, 22 Oct 2022 04:16:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57616 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233237AbiJVIML (ORCPT ); Sat, 22 Oct 2022 04:12:11 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5B4322C10A; Sat, 22 Oct 2022 00:54:56 -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 6D8E4B82E10; Sat, 22 Oct 2022 07:54:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CAD68C433C1; Sat, 22 Oct 2022 07:54:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425277; bh=JriGQH2ZerNgXXSQ2NT+nwSDaZwwrAgrAf1yrFYB7KA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hbZ9AgHf8h7gJGcMssOvw+UU+kjNN9WMNuav20md8I92oGQ3WmBZ2mF1dVf/P06Zh 5PYFTBM7l6toYD3Ud1Daihu5irqZQp1PBdusAn+Pi3yhMxmJg6TXdNzSPlKUtuw1Xe WU2Z6Ar6bLSNhTtlxgQ3ispRNt3gmGT5gje+RR/c= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Lennert Buytenhek , Andy Shevchenko , =?utf-8?q?Ilpo_J=C3=A4?= =?utf-8?q?rvinen?= , Sasha Levin Subject: [PATCH 5.19 448/717] serial: 8250: Toggle IER bits on only after irq has been set up Date: Sat, 22 Oct 2022 09:25:27 +0200 Message-Id: <20221022072518.088368896@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747375977781064308?= X-GMAIL-MSGID: =?utf-8?q?1747375977781064308?= From: Ilpo Järvinen [ Upstream commit 039d4926379b1d1c17b51cf21c500a5eed86899e ] Invoking TIOCVHANGUP on 8250_mid port on Ice Lake-D and then reopening the port triggers these faults during serial8250_do_startup(): DMAR: DRHD: handling fault status reg 3 DMAR: [DMA Write NO_PASID] Request device [00:1a.0] fault addr 0x0 [fault reason 0x05] PTE Write access is not set If the IRQ hasn't been set up yet, the UART will have zeroes in its MSI address/data registers. Disabling the IRQ at the interrupt controller won't stop the UART from performing a DMA write to the address programmed in its MSI address register (zero) when it wants to signal an interrupt. The UARTs (in Ice Lake-D) implement PCI 2.1 style MSI without masking capability, so there is no way to mask the interrupt at the source PCI function level, except disabling the MSI capability entirely, but that would cause it to fall back to INTx# assertion, and the PCI specification prohibits disabling the MSI capability as a way to mask a function's interrupt service request. The MSI address register is zeroed by the hangup as the irq is freed. The interrupt is signalled during serial8250_do_startup() performing a THRE test that temporarily toggles THRI in IER. The THRE test currently occurs before UART's irq (and MSI address) is properly set up. Refactor serial8250_do_startup() such that irq is set up before the THRE test. The current irq setup code is intermixed with the timer setup code. As THRE test must be performed prior to the timer setup, extract it into own function and call it only after the THRE test. The ->setup_timer() needs to be part of the struct uart_8250_ops in order to not create circular dependency between 8250 and 8250_base modules. Fixes: 40b36daad0ac ("[PATCH] 8250 UART backup timer") Reported-by: Lennert Buytenhek Tested-by: Lennert Buytenhek Reviewed-by: Andy Shevchenko Signed-off-by: Ilpo Järvinen Link: https://lore.kernel.org/r/20220922070005.2965-1-ilpo.jarvinen@linux.intel.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/tty/serial/8250/8250_core.c | 16 +++++++++++----- drivers/tty/serial/8250/8250_port.c | 8 +++++--- include/linux/serial_8250.h | 1 + 3 files changed, 17 insertions(+), 8 deletions(-) diff --git a/drivers/tty/serial/8250/8250_core.c b/drivers/tty/serial/8250/8250_core.c index 82726cda6066..f05544e93eae 100644 --- a/drivers/tty/serial/8250/8250_core.c +++ b/drivers/tty/serial/8250/8250_core.c @@ -298,10 +298,9 @@ static void serial8250_backup_timeout(struct timer_list *t) jiffies + uart_poll_timeout(&up->port) + HZ / 5); } -static int univ8250_setup_irq(struct uart_8250_port *up) +static void univ8250_setup_timer(struct uart_8250_port *up) { struct uart_port *port = &up->port; - int retval = 0; /* * The above check will only give an accurate result the first time @@ -322,10 +321,16 @@ static int univ8250_setup_irq(struct uart_8250_port *up) */ if (!port->irq) mod_timer(&up->timer, jiffies + uart_poll_timeout(port)); - else - retval = serial_link_irq_chain(up); +} - return retval; +static int univ8250_setup_irq(struct uart_8250_port *up) +{ + struct uart_port *port = &up->port; + + if (port->irq) + return serial_link_irq_chain(up); + + return 0; } static void univ8250_release_irq(struct uart_8250_port *up) @@ -381,6 +386,7 @@ static struct uart_ops univ8250_port_ops; static const struct uart_8250_ops univ8250_driver_ops = { .setup_irq = univ8250_setup_irq, .release_irq = univ8250_release_irq, + .setup_timer = univ8250_setup_timer, }; static struct uart_8250_port serial8250_ports[UART_NR]; diff --git a/drivers/tty/serial/8250/8250_port.c b/drivers/tty/serial/8250/8250_port.c index 5db53941d881..d5f9b56fdbab 100644 --- a/drivers/tty/serial/8250/8250_port.c +++ b/drivers/tty/serial/8250/8250_port.c @@ -2303,6 +2303,10 @@ int serial8250_do_startup(struct uart_port *port) if (port->irq && (up->port.flags & UPF_SHARE_IRQ)) up->port.irqflags |= IRQF_SHARED; + retval = up->ops->setup_irq(up); + if (retval) + goto out; + if (port->irq && !(up->port.flags & UPF_NO_THRE_TEST)) { unsigned char iir1; @@ -2345,9 +2349,7 @@ int serial8250_do_startup(struct uart_port *port) } } - retval = up->ops->setup_irq(up); - if (retval) - goto out; + up->ops->setup_timer(up); /* * Now, initialize the UART diff --git a/include/linux/serial_8250.h b/include/linux/serial_8250.h index ff84a3ed10ea..b0183e90fe90 100644 --- a/include/linux/serial_8250.h +++ b/include/linux/serial_8250.h @@ -74,6 +74,7 @@ struct uart_8250_port; struct uart_8250_ops { int (*setup_irq)(struct uart_8250_port *); void (*release_irq)(struct uart_8250_port *); + void (*setup_timer)(struct uart_8250_port *); }; struct uart_8250_em485 { From patchwork Sat Oct 22 07:25:28 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 7526 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1105791wrr; Sat, 22 Oct 2022 01:36:12 -0700 (PDT) X-Google-Smtp-Source: AMsMyM63xUsy0lpEUyHIbwpUDVv+02sIBKQMNVVLBk8qK2Ht+xxsYy7AN+zRsSgWlUgYWRjA+GNi X-Received: by 2002:a17:902:db01:b0:186:9329:723f with SMTP id m1-20020a170902db0100b001869329723fmr364955plx.172.1666427771908; Sat, 22 Oct 2022 01:36:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666427771; cv=none; d=google.com; s=arc-20160816; b=DM4iI7YPL2yPsWty/alqBy05EmkNAMF+99V0sLUZE7JaQX4fNabWa+0W/AGPFnv6Sh W3+hufzHbR4i8ose4HKLw0LSCCvnvtT0rgkWULv/7BTtJGjpLtpVk9JZitlRM2FxyYuu 158gTM/IXtls+b8YRhNif0mxwnOT6OF/+AHACho5kIvQPvGhpNcFxuAbRMBqM1tPMWPX zlpBZF5I6PE1jegMesZJeCmZnAYnl74ycW0Yrp2Q1GbdQRFlreXhN0y8ZqoopqZS9ExN RfXFIljqz/8RzsyeQ0v7OQ0FvXOtS1CpsXWnif7VhsT3zdl2X8pQnk7ge9dvdu76QF3b h2PQ== 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=2cey947dLZmDsgwWMJLLCN4TJJK8GVepaXfL0iPldvA=; b=qie8m5k6Tz8l8Wj4H1OKJ9CT64GqtCPyk2ccY3o8f0WKndrA5+K8UDBP2zpjxp5p3r cKWyfgnzl/HnonG4XM+iOpZgAJ+fT11r+lDW4g6sf6X96t38ABDWcTnijinqmr3mraFO 9ybtH2/WpZTBUThYaDdRhhem/M4A+x7Q0Clb7pBBRXqHuWGE9NninK/jy2HuxS1MIpvY oXHY0SVQsSg3NHAsIXzA1oKLm/poW0GJGqof9+K3U06akEkVc0TvIJSQaHe6GqxTZdsM /pfFJb64bVVcyKNetBKqao9XDbQ94eDajWgt56V8piUhNYCr4lXkhTlvFhKnSUPrg2cA 46UA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=cMFV3snm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 t37-20020a056a0013a500b0056b86567ce9si1224706pfg.347.2022.10.22.01.35.55; Sat, 22 Oct 2022 01:36: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=cMFV3snm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S233297AbiJVIQj (ORCPT + 99 others); Sat, 22 Oct 2022 04:16:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46880 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233426AbiJVIOB (ORCPT ); Sat, 22 Oct 2022 04: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 D9E31EB77C; Sat, 22 Oct 2022 00:55: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 60F13B82DF2; Sat, 22 Oct 2022 07:54:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AA09FC433D6; Sat, 22 Oct 2022 07:54:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425280; bh=Lkr8BBYCeuGeSIQydNTEzXhG3Uyi1hcTr8C3WMh2Pj4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cMFV3snmE/yOqfqIybIsBqhIcxzbJQdLnO6cCk4yoDtruzVXUWBBaHUKF9WhoD8Vx qHy/c9RJVUTxMHuObZfcQlEkqo7mkSzvFMDb50m4NjeyIz1MYJ7frxI0YtGGn0mFr9 JUWIVAsY2E9j9IVCzj5mS7B2S66CYuAYoTmg6jGk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?utf-8?q?Ilpo_J=C3=A4rvinen?= , Thara Gopinath , Sherry Sun , Sasha Levin Subject: [PATCH 5.19 449/717] tty: serial: fsl_lpuart: disable dma rx/tx use flags in lpuart_dma_shutdown Date: Sat, 22 Oct 2022 09:25:28 +0200 Message-Id: <20221022072518.120169495@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376166862562769?= X-GMAIL-MSGID: =?utf-8?q?1747376166862562769?= From: Sherry Sun [ Upstream commit 316ae95c175a7d770d1bfe4c011192712f57aa4a ] lpuart_dma_shutdown tears down lpuart dma, but lpuart_flush_buffer can still occur which in turn tries to access dma apis if lpuart_dma_tx_use flag is true. At this point since dma is torn down, these dma apis can abort. Set lpuart_dma_tx_use and the corresponding rx flag lpuart_dma_rx_use to false in lpuart_dma_shutdown so that dmas are not accessed after they are relinquished. Otherwise, when try to kill btattach, kernel may panic. This patch may fix this issue. root@imx8ulpevk:~# btattach -B /dev/ttyLP2 -S 115200 ^C[ 90.182296] Internal error: synchronous external abort: 96000210 [#1] PREEMPT SMP [ 90.189806] Modules linked in: moal(O) mlan(O) [ 90.194258] CPU: 0 PID: 503 Comm: btattach Tainted: G O 5.15.32-06136-g34eecdf2f9e4 #37 [ 90.203554] Hardware name: NXP i.MX8ULP 9X9 EVK (DT) [ 90.208513] pstate: 600000c5 (nZCv daIF -PAN -UAO -TCO -DIT -SSBS BTYPE=--) [ 90.215470] pc : fsl_edma3_disable_request+0x8/0x60 [ 90.220358] lr : fsl_edma3_terminate_all+0x34/0x20c [ 90.225237] sp : ffff800013f0bac0 [ 90.228548] x29: ffff800013f0bac0 x28: 0000000000000001 x27: ffff000008404800 [ 90.235681] x26: ffff000008404960 x25: ffff000008404a08 x24: ffff000008404a00 [ 90.242813] x23: ffff000008404a60 x22: 0000000000000002 x21: 0000000000000000 [ 90.249946] x20: ffff800013f0baf8 x19: ffff00000559c800 x18: 0000000000000000 [ 90.257078] x17: 0000000000000000 x16: 0000000000000000 x15: 0000000000000000 [ 90.264211] x14: 0000000000000003 x13: 0000000000000000 x12: 0000000000000040 [ 90.271344] x11: ffff00000600c248 x10: ffff800013f0bb10 x9 : ffff000057bcb090 [ 90.278477] x8 : fffffc0000241a08 x7 : ffff00000534ee00 x6 : ffff000008404804 [ 90.285609] x5 : 0000000000000000 x4 : 0000000000000000 x3 : ffff0000055b3480 [ 90.292742] x2 : ffff8000135c0000 x1 : ffff00000534ee00 x0 : ffff00000559c800 [ 90.299876] Call trace: [ 90.302321] fsl_edma3_disable_request+0x8/0x60 [ 90.306851] lpuart_flush_buffer+0x40/0x160 [ 90.311037] uart_flush_buffer+0x88/0x120 [ 90.315050] tty_driver_flush_buffer+0x20/0x30 [ 90.319496] hci_uart_flush+0x44/0x90 [ 90.323162] +0x34/0x12c [ 90.327253] tty_ldisc_close+0x38/0x70 [ 90.331005] tty_ldisc_release+0xa8/0x190 [ 90.335018] tty_release_struct+0x24/0x8c [ 90.339022] tty_release+0x3ec/0x4c0 [ 90.342593] __fput+0x70/0x234 [ 90.345652] ____fput+0x14/0x20 [ 90.348790] task_work_run+0x84/0x17c [ 90.352455] do_exit+0x310/0x96c [ 90.355688] do_group_exit+0x3c/0xa0 [ 90.359259] __arm64_sys_exit_group+0x1c/0x20 [ 90.363609] invoke_syscall+0x48/0x114 [ 90.367362] el0_svc_common.constprop.0+0xd4/0xfc [ 90.372068] do_el0_svc+0x2c/0x94 [ 90.375379] el0_svc+0x28/0x80 [ 90.378438] el0t_64_sync_handler+0xa8/0x130 [ 90.382711] el0t_64_sync+0x1a0/0x1a4 [ 90.386376] Code: 17ffffda d503201f d503233f f9409802 (b9400041) [ 90.392467] ---[ end trace 2f60524b4a43f1f6 ]--- [ 90.397073] note: btattach[503] exited with preempt_count 1 [ 90.402636] Fixing recursive fault but reboot is needed! Fixes: 6250cc30c4c4 ("tty: serial: fsl_lpuart: Use scatter/gather DMA for Tx") Reviewed-by: Ilpo Järvinen Signed-off-by: Thara Gopinath Signed-off-by: Sherry Sun Link: https://lore.kernel.org/r/20220920111703.1532-1-sherry.sun@nxp.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/tty/serial/fsl_lpuart.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/tty/serial/fsl_lpuart.c b/drivers/tty/serial/fsl_lpuart.c index cb83c66bd8a8..a6471af9653c 100644 --- a/drivers/tty/serial/fsl_lpuart.c +++ b/drivers/tty/serial/fsl_lpuart.c @@ -1768,6 +1768,7 @@ static void lpuart_dma_shutdown(struct lpuart_port *sport) if (sport->lpuart_dma_rx_use) { del_timer_sync(&sport->lpuart_timer); lpuart_dma_rx_free(&sport->port); + sport->lpuart_dma_rx_use = false; } if (sport->lpuart_dma_tx_use) { @@ -1776,6 +1777,7 @@ static void lpuart_dma_shutdown(struct lpuart_port *sport) sport->dma_tx_in_progress = false; dmaengine_terminate_all(sport->dma_tx_chan); } + sport->lpuart_dma_tx_use = false; } if (sport->dma_tx_chan) From patchwork Sat Oct 22 07:25: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: 7656 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1107984wrr; Sat, 22 Oct 2022 01:42:49 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4Fe9NgiA+ugZA30KcXg20nzXk1erkDHy1zigC6ABzkf9zJpxm/b3B+PiY4SbTEM7s8RAfh X-Received: by 2002:a05:6402:249f:b0:453:eb1b:1f8b with SMTP id q31-20020a056402249f00b00453eb1b1f8bmr20751294eda.235.1666428169491; Sat, 22 Oct 2022 01:42:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666428169; cv=none; d=google.com; s=arc-20160816; b=U27ZKmfWqkZHFO0ok3YZUT05K8YlhlaauAvuonols+8E+tJ3xqrLE53XGUa6ChPJMo 7D6Ii/uYmZ+sG+ZoLPbnDR6LhTOSGCGrUa1oQS3QlZEKnAZk+L8k09TbVVa0mvIgPUKX Qjm97FdXLg+505icog1ZHTX16F9HBwNhwFJhLCLJs3LpGcvRQrCXU8p2ZR/EGUqhQMV+ lOaz6ttRxpGu8/zxiDJVeewiz5u0pvMbk/rjH/Wi8AU8Hmu644AKOrrOG5GJ4Ht38DaB Ur4h0e/T/A2qleVyMGVZSzbwncndk24PHC8AIlbuoIqTk9sNrjp0TI1cUk7KXMdSUiPo TZNw== 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=kNaGe+gRNNJN9311HSyBaLL5guDPg3kkZIdTXpU39W8=; b=pVJ95AfaYB+OTQBUCjCdJX1Eh0kdjQdOlxAwTx1++cSlFdvQKMcspYFO4ec7tgqkdO LAyq68VJajs0h2yNM5QrEcKDClVMoKEFP4VcM9UmOpJuLWf+X5X09XiMXL0VIeyALf70 TFJYHiw0rvLUyHuuZzkc3Es9pK7vip27JD5RYJoP7KT4f03yH0v2ngijxah2je9cVzde Q9LF1ABxVyMcA+raF3ygTSU9/U8f48hivo66KtAy9MfXtP1ttFt23Mtao+DMxuEvKOUK zh6F+RL9IVJDZFdu7oFDkDANGkwhnxIZ5w4sxRbnbZwYmSdFs3BzLBWOMqJg5tge2BJ+ Rlag== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=gP2XaaPE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 o25-20020a170906289900b0078d4dcceb5dsi19050294ejd.717.2022.10.22.01.42.25; Sat, 22 Oct 2022 01: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=gP2XaaPE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S234020AbiJVIiA (ORCPT + 99 others); Sat, 22 Oct 2022 04:38:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58048 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233979AbiJVIcK (ORCPT ); Sat, 22 Oct 2022 04:32:10 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2ABB72E533E; Sat, 22 Oct 2022 01: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 dfw.source.kernel.org (Postfix) with ESMTPS id E115C60B39; Sat, 22 Oct 2022 07:54:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A2426C433C1; Sat, 22 Oct 2022 07:54:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425283; bh=uVPtii6QQOmB4B6xF72ZYD0gNI18FJWJaZLcL+ZjKkI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gP2XaaPE2t3t62LrYIKhH2Pdwtn8I1zvnRcFxppe0+7F92te8aOWE0XRmTR/vH2wM 6zr6wC04oBpL2oR0QvkF64OfCXDtGLTBezz/RPl7KmXy1ovPH6yB0lHEt6KPDFqChC stkcnxcWqxYdtmMxK+qARE0muZWZyS3TEsUAtir8= 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 5.19 450/717] phy: qualcomm: call clk_disable_unprepare in the error handling Date: Sat, 22 Oct 2022 09:25:29 +0200 Message-Id: <20221022072518.166320864@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376584345103347?= X-GMAIL-MSGID: =?utf-8?q?1747376584345103347?= 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 716a77748ed8..20f6dd37c7c1 100644 --- a/drivers/phy/qualcomm/phy-qcom-usb-hsic.c +++ b/drivers/phy/qualcomm/phy-qcom-usb-hsic.c @@ -54,8 +54,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 Sat Oct 22 07:25: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: 7479 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1101213wrr; Sat, 22 Oct 2022 01:20:05 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6gmylkJyap4JN53OeEtz7JNeYtC24AU6bSFBN/5faLJL84nJ8MTzyYJK1m3Qe1nuZHpXMz X-Received: by 2002:a17:90a:b103:b0:20d:69aa:a350 with SMTP id z3-20020a17090ab10300b0020d69aaa350mr60814076pjq.178.1666426805655; Sat, 22 Oct 2022 01:20:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666426805; cv=none; d=google.com; s=arc-20160816; b=ucqKPE53SFXwEaPaDRX+Wbb3WrTOENDj26Q4oTDTNzZYAN90nwW/cySdXWV5L3805I PDFVNbE7HeAXE/gww8R24wjyYclg8YJYZtU6Wtu8gz3kU4ZZ2vUidc9JFANb1H/wv4RA OIGLzpmit+MTaJIj5ZQO0/77C67gcX59FuQSIbtoVJEsg1z3Kui/8rbrrsThWyJtBBiV LTErGJW6xUFtj7YJm9c/jvJnpYIf6mDwhHDSY3ORoPJdhXv6HcAydJIEeEIFkyr1P6GE xDYvkx7MwQZ5VuCahCJNfQ4FbZQgZGzfLLlJCACvUt8XM5RnRs7bhbHfRGOSSVGcy+2H wvgQ== 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=AxXjufu2jhVkMJHSUHTXuKZQOjW6X0OlsWTmMnxRXvw=; b=Sy4Cyrod4LWhPR68Gq881fubCD7PkJHjo9Ax23XaWKnh9OOG6vm0JzxuZPF/DhKbKV NYRv4Ys7aStuz4CNM6rr44TzpYEqZQqBhWNikjGwBdy804W8OBsjA67kJbkhLvYWLsIm m8sbvrxOVz/iOpprOLs5K9RcHHfsoIA783Bb2m8X71GbdEcpfN5kzdwbmsYbSyZXTQWM pqUoamEkBdBn5R+kovu+wEWlO2znkxNKY3FmU3BZfpkCqQ/YyvA+rxOtftmFszR3VJsd V4Ikg3CK3Fvo6X/33Uemx4JOosDPrdsV4J+9KDwdt9YcdR3DsxwWSoHHYYd/Xh8OsRb/ oGHQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="JW/clmTH"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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-20020a65678c000000b0045afe1a8821si28145082pgr.128.2022.10.22.01.19.52; Sat, 22 Oct 2022 01:20: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="JW/clmTH"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S233330AbiJVIN0 (ORCPT + 99 others); Sat, 22 Oct 2022 04:13:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37152 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233300AbiJVILh (ORCPT ); Sat, 22 Oct 2022 04:11:37 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C4C374523D; Sat, 22 Oct 2022 00:54: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 004D560B45; Sat, 22 Oct 2022 07:54:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E6782C433D6; Sat, 22 Oct 2022 07:54:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425286; bh=MYLkHP5BSjJx3AY2DdM5hcJ68VoU5kZrCInx4VsyDTg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JW/clmTH0Jb3O56MG67ptLrYtayilvv4AcKf1MHKm4JJ3SzqU03GwsgHcO/IuInTM leuk9KvadEqh8h9sd7lf1YcmIWJd08Q8s0UbTfgIwVsWlCzU/Tdxqdr6uly5aTtzFb PMjUi9rqanp/ptuGPJWJoLCFR0NEhZ4BSrRIzlcI= 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 5.19 451/717] staging: vt6655: fix some erroneous memory clean-up loops Date: Sat, 22 Oct 2022 09:25:30 +0200 Message-Id: <20221022072518.217101632@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747375153759178361?= X-GMAIL-MSGID: =?utf-8?q?1747375153759178361?= 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 afaf331fe125..ecb8c3934bc6 100644 --- a/drivers/staging/vt6655/device_main.c +++ b/drivers/staging/vt6655/device_main.c @@ -564,7 +564,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); @@ -610,7 +610,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); @@ -715,7 +715,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 Sat Oct 22 07:25: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: 7481 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1104364wrr; Sat, 22 Oct 2022 01:31:43 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7mGiWyZDwXW+IMuVHWTtcJZjnHWJP7pe+OnhRmx+DPKCjrTaHmfIdqDKKlu6VKYjGDbPJP X-Received: by 2002:a05:6a00:cc4:b0:565:e009:b94c with SMTP id b4-20020a056a000cc400b00565e009b94cmr23381532pfv.25.1666427503027; Sat, 22 Oct 2022 01:31:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666427503; cv=none; d=google.com; s=arc-20160816; b=sS2fpG1Xh9O3tVH6Q96XZ5ZKq7mgoqffRxdNC4sPrshQ6RmOvgvfYJoG2A4GvMceNc 4bW31tzEkhfm1TH3kPSl9irOB4pMKN7ZGgLlKo/dgudRoPA+YQm9RniO+bo9SfVdfp52 KkVy/HLGx/6FCNEo0x4fudZDQvEN1NE/bQz6/iaIB7xXl+aFtwxbmk2rT8xGwMgmw1Eb oqHUSoeKnpWsN+ZQwMCgvz5bBSMnVgp2vmPwC6cOQ2yd1FQ4DAZCvouWtnhLEmZolpCX 8lyA+0YJFCLQ1b4MA8uhrHQytVu9HCBdtsH7JiNmBtrJubKagWwLBhjlebFVWyDd0s5i Axbg== 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=dnM1vMbybPjICeIhZ8ZUVX3dxblJib3i2vjSYuoMrF4=; b=wIdeGDAhr4UgKUdoaXOZl8043s+dhPWGYpJM/jflzxxyyKH/V++zcuMw+kSpz2wKyX O8Yi3kF5RIGp6z6FSumtap54Zai5vLVEJC5K0v6VA3cy8FJ0kiDpT6ERajojoOmhK0vf Ccx9qyw7G8pkgq+JnoFjhl9Y4oTVUj1qhzADHzs1PV7t8+QbZyph9iUSIQLIC2+P2+H0 Xp6iO83W8KBQtALtiiUyx5qFnqhoXNQZOyvItYlwp4rLs4i/zLWcf5sYoV43h35FAOnm ofjtfw1YA9tKemHsfR+nNn1v9N8qNVS3zI87bO+ppj6NI+svMxgTyqzyFwKfjRhZMghE +8AQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=2IS2yTh9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 q18-20020a17090311d200b00178662903bcsi30044498plh.52.2022.10.22.01.31.21; Sat, 22 Oct 2022 01:31: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=2IS2yTh9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S233178AbiJVINb (ORCPT + 99 others); Sat, 22 Oct 2022 04:13:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57034 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233313AbiJVILl (ORCPT ); Sat, 22 Oct 2022 04:11:41 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1EEB15FF6E; Sat, 22 Oct 2022 00:54: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 27D3260B82; Sat, 22 Oct 2022 07:54:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3B1F6C433C1; Sat, 22 Oct 2022 07:54:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425292; bh=aZ6ttHHGOGHia7odYA/3lZSLUuPnotEhC2sJFerxf8c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=2IS2yTh9Hg4feIzT/XWF6X3FLmOo+Wf4YycPnBN/zxr+bMdVwel15TuwdQC/3fJS3 H6smE36Nht0mhbUTzATTTrlK4hKYshzUyvjHxY0CZ+QTb13f6+SZfyWgJqDMNwagpY +Rq04PhB1tTq9L46PfYLfB7o9tx3ZzBZuAM0QSq0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Krzysztof Kozlowski , Srinivas Kandagatla , Sasha Levin Subject: [PATCH 5.19 452/717] slimbus: qcom-ngd-ctrl: allow compile testing without QCOM_RPROC_COMMON Date: Sat, 22 Oct 2022 09:25:31 +0200 Message-Id: <20221022072518.262727257@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747375885070158592?= X-GMAIL-MSGID: =?utf-8?q?1747375885070158592?= From: Krzysztof Kozlowski [ Upstream commit e291691c69776ad278cd39dec2306dd39d681a9f ] The Qualcomm common remote-proc code (CONFIG_QCOM_RPROC_COMMON) has necessary stubs, so it is not needed for compile testing. Signed-off-by: Krzysztof Kozlowski Signed-off-by: Srinivas Kandagatla Link: https://lore.kernel.org/r/20220916122910.170730-5-srinivas.kandagatla@linaro.org Signed-off-by: Greg Kroah-Hartman Stable-dep-of: 42992cf187e4 ("slimbus: qcom-ngd: Add error handling in of_qcom_slim_ngd_register") Signed-off-by: Sasha Levin --- drivers/slimbus/Kconfig | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/slimbus/Kconfig b/drivers/slimbus/Kconfig index 1235b7dc8496..2ed821f75816 100644 --- a/drivers/slimbus/Kconfig +++ b/drivers/slimbus/Kconfig @@ -22,7 +22,8 @@ config SLIM_QCOM_CTRL config SLIM_QCOM_NGD_CTRL tristate "Qualcomm SLIMbus Satellite Non-Generic Device Component" - depends on HAS_IOMEM && DMA_ENGINE && NET && QCOM_RPROC_COMMON + depends on HAS_IOMEM && DMA_ENGINE && NET + depends on QCOM_RPROC_COMMON || COMPILE_TEST depends on ARCH_QCOM || COMPILE_TEST select QCOM_QMI_HELPERS select QCOM_PDR_HELPERS From patchwork Sat Oct 22 07:25: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: 7796 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1124457wrr; Sat, 22 Oct 2022 02:36:44 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7y1CNaW6XKQCLY2W1jr06hV0052hb2DDkTRf1lsxReY9emj1gCC5Dg2d3LWML3Yctexq4q X-Received: by 2002:a17:90b:4c48:b0:20d:5c55:b8a8 with SMTP id np8-20020a17090b4c4800b0020d5c55b8a8mr27642333pjb.207.1666431403894; Sat, 22 Oct 2022 02:36:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666431403; cv=none; d=google.com; s=arc-20160816; b=YLziATmmwtVTsJNvfT/z1Bn1mIfyVtcTtcbY2LfkW0Vmb7zAg4yaJ53/lg0wCck1Ka a0WUhV8rhzc5iPEZRung1nzWgeZKY0F/TeZTU9uubTTQmJupWbzmqt3YcROnvRBzSFBy xyuJk1MmsYlRApl89TvTsLSeR2S2ei1xmA36pItEn4kanzlfJjWVb7Q4bFUuVXS0vJaC YJORIsmveAzuc+x5e1INlbQgLm/BzqGOYbFjzfOyox6bEDKIvEjggloPZrtbx2cWU2VL dsR/WR7U+Lil9ZNMcb0VPYyPtXwWhutSSY6mOMyOtzRLv0fNDR0QMidCwXbzD9w9bPwx h27w== 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=Tk6rJCCrUU+UDNO3KpzwcKkHRjzn/vohe9OfHA2ccnM=; b=OfbAzkOFz3NoSH9g+k7fZhWCodokTq9Cj3QnKdJvAAKqCvxKcx2YBH59a/pZZckSC4 kV+Ik0x1qAHAj03kcARkUdRt7OLbJ6Pev1tChZt9S+Kgroz6SzLXwBGK3gLtKnyisNs9 8dIR3Hi0PaLWekrufoMqIQF8Jw3bpWPDPK37XFvb5ZhtJ4o9VPr0ga4HTMkFCPqUxsyx UZX1IwxB3WukNkDkG0QKdYiiG78prNQyttecp5Du66n0QV91pnD3waUVCP2onDEuBjvq ojFvxGlhFceHVfnNriA2DZU9yUGPizyYO38HqvNRb3vQpY8TQIp7jdJ8CXzscFo5T6UM xfjw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=yli5Fmwh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 c13-20020a63d14d000000b00439e032756fsi25022639pgj.65.2022.10.22.02.36.30; Sat, 22 Oct 2022 02:36: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=yli5Fmwh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S230272AbiJVJSu (ORCPT + 99 others); Sat, 22 Oct 2022 05:18:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46060 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230328AbiJVJSF (ORCPT ); Sat, 22 Oct 2022 05:18:05 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B382830A0DB; Sat, 22 Oct 2022 01:32: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 sin.source.kernel.org (Postfix) with ESMTPS id ED5B3CE2CAD; Sat, 22 Oct 2022 07:54:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EFA5BC433D6; Sat, 22 Oct 2022 07:54:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425295; bh=AIPgOlTw2C29CZW+Rcr36Sfqvrn2uqvWjCZRKazOqQQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=yli5Fmwh6McwGdFLAXZ/NGXzjWhJlkYbKjtKw9TKSQFxrqVTUXgVIXc0Po+qQS7+d 0nbCc0mX0zVC4bvkE18Btfusdri1prqDqbUyNNePWlQbgb1mG9mlNXSo2QQn07Rdi2 Z7nNkBHAbmqXQIfuUTG346TQw28mhUDqABX/eeL8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Neil Armstrong , Lin Yujun , Sasha Levin Subject: [PATCH 5.19 453/717] slimbus: qcom-ngd: Add error handling in of_qcom_slim_ngd_register Date: Sat, 22 Oct 2022 09:25:32 +0200 Message-Id: <20221022072518.316510505@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747379975638519415?= X-GMAIL-MSGID: =?utf-8?q?1747379975638519415?= From: Lin Yujun [ Upstream commit 42992cf187e4e4bcfe3c58f8fc7b1832c5652d9f ] No error handling is performed when platform_device_add() return fails. Refer to the error handling of driver_set_override(), add error handling for platform_device_add(). Fixes: 917809e2280b ("slimbus: ngd: Add qcom SLIMBus NGD driver") Reviewed-by: Neil Armstrong Signed-off-by: Lin Yujun Link: https://lore.kernel.org/r/20220914031953.94061-1-linyujun809@huawei.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/slimbus/qcom-ngd-ctrl.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/slimbus/qcom-ngd-ctrl.c b/drivers/slimbus/qcom-ngd-ctrl.c index bacc6af1d51e..d29a1a9cf12f 100644 --- a/drivers/slimbus/qcom-ngd-ctrl.c +++ b/drivers/slimbus/qcom-ngd-ctrl.c @@ -1470,7 +1470,13 @@ static int of_qcom_slim_ngd_register(struct device *parent, ngd->pdev->dev.of_node = node; ctrl->ngd = ngd; - platform_device_add(ngd->pdev); + ret = platform_device_add(ngd->pdev); + if (ret) { + platform_device_put(ngd->pdev); + kfree(ngd); + of_node_put(node); + return ret; + } ngd->base = ctrl->base + ngd->id * data->offset + (ngd->id - 1) * data->size; From patchwork Sat Oct 22 07:25: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: 7542 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1105881wrr; Sat, 22 Oct 2022 01:36:26 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6gksgpmCsYPvRRjSulh5P+/tMBzxR6jNxDe+YWNmN0QPd3MEFOiz+Z5T6aoRlhe1iGR0yl X-Received: by 2002:a17:903:2111:b0:185:4ca4:7511 with SMTP id o17-20020a170903211100b001854ca47511mr23220401ple.164.1666427785862; Sat, 22 Oct 2022 01:36:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666427785; cv=none; d=google.com; s=arc-20160816; b=MKUJVbiMs5FUUi9sIFXnajw434zl1JGVcrWQsMuR9p2m/GioBt+YLjs9AdflBEfekB l2EiEI4YTQtlxGtTAAetouDICHg9Dt0FEwvOqfTCydsqImOr6KDM2pyonfuM2vsE18kj LGCk5JB9Ec1RrvZmPLJ8R7AjmRr1BQZeHTWkO/eNVXeIs+30ck5lUQ+73/NBVQ0XH+MR MfoYUIxfOhy9ockACyal1xsfmQYPko8bjSc1BHG1JUVO/55SshU4CJPOevhzM3KeYsIF gMinDAypwz7o5f1tDpyK+MUnw4JBqZhKcpOF5z+OQ1Pvu/9rCVuOjqfHDHpKH5/mp4Mm cX0g== 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=D4aeKO3li6DXpfT9DJMVqwM4QmuvNIwWWCVGysYMwoY=; b=Ardaoe95sF1Y9SFRtgWjaARZzOROSOXia7tXiKP5+E2+AKZtH5BkJRhYCP76UxgmXV N122MF0Qxs2bi/zMz7ZEK1dw0zu1ZPV6Sk04MNtdvvtpm5MCAJ7W/mz9MeDuVs52bI1A g6Kh9ngkf1Kc/1/ve8sxEvn/jV+bCfzzBvjHacc1p5rBWdRl/mLgiuYtPUAtygA15HLb YqzmpmbD2eKKw9zYQ1k7VAGnJY7oDZmysFB1K8aqwQZSh2V23c2XmapCDMsMUW8nLUS0 bfu41A83YmY/D7T3CQPMUEEtQ9baMMBlB5CQHO8Ul5Ik4Upt7HeVlcbjp3Gd2EB6zLVP QtBQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=iWAKuVi5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 x26-20020a634a1a000000b0044601bb2f90si27236887pga.530.2022.10.22.01.36.11; Sat, 22 Oct 2022 01:36: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=iWAKuVi5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S233282AbiJVIRb (ORCPT + 99 others); Sat, 22 Oct 2022 04:17:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33290 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233969AbiJVIPp (ORCPT ); Sat, 22 Oct 2022 04:15:45 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2ACBD2DA77A; Sat, 22 Oct 2022 00:56: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 E462B60AF8; Sat, 22 Oct 2022 07:54:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 064B5C433C1; Sat, 22 Oct 2022 07:54:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425298; bh=C+1GBcd4vi3x1Lbhy7+9mb4yrjJTjU/i8BhkPvezHH8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iWAKuVi5it03s0E+v5VSeUBucyNq0WeIe5USLp3uAbf9LCXxWN+QvIj40HnKfIqs5 nQvdW2kY1vC2nO3HjCDBpod9IIxVoGx9T+hZ6cFhoHhvt13cxuMdlmyxWtCrJY5TGT 62jAhvSJSaVa3WWl0maO656Trrbk+X8qHQNea8GE= 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 5.19 454/717] firmware: google: Test spinlock on panic path to avoid lockups Date: Sat, 22 Oct 2022 09:25:33 +0200 Message-Id: <20221022072518.367097504@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376182381835547?= X-GMAIL-MSGID: =?utf-8?q?1747376182381835547?= 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 adaa492c3d2d..4e2575dfeb90 100644 --- a/drivers/firmware/google/gsmi.c +++ b/drivers/firmware/google/gsmi.c @@ -681,6 +681,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 Sat Oct 22 07:25:34 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 7498 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1104886wrr; Sat, 22 Oct 2022 01:33:37 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7yX7AhbwhRTQiXzjIifqzk33EEkQr5iqp2NMxgRdRWBKqK+291/lENi9uKK++tApv86Ssl X-Received: by 2002:a17:90b:4c48:b0:20d:5c55:b8a8 with SMTP id np8-20020a17090b4c4800b0020d5c55b8a8mr27401364pjb.207.1666427617307; Sat, 22 Oct 2022 01:33:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666427617; cv=none; d=google.com; s=arc-20160816; b=dzoZJRavoAC3uzZIggrQNKC7a4CDoxAJ3RB0CXSgRf6ihYAY3JyF1qMsvlyfj+B5bc sTSRwo3lt201ySyV4WmbJexLNtV5WOQzbVhrd1c4gBQ/924HeL+WjN1gt7a9HkRky/zn 3qwrUTbhOZ62QdAkCiZ+mYoHISEfpfcKZWdBLBj2jsPL3OuZfazuZjkk72532c+x8bp4 YZ5bbxm+NxarpOQ2qw7mp4rTaLH2YJv/kYQcZT0cTlIrOdaodMK4b0nPs5xc7q7YIwUY sbLffdfVFzWOa1Ks9Wg5jS61RmlmBj3irxRNAHhRQw5juAolT/ypSQOYJncNSObaXF1l XVjQ== 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=5NNOj/ruD0ez3T6+1ORfQ5fkNO9hR3GCk72SnKTzJpI=; b=ofO8R1TeyEnnrWb9CT55t8Zsw7+jppeU2macEMEaUXTW0Nb1BahbuiaMLvPrdVMG8U cPEpYFBzcVLTbpvSA1ZiNOzrWr/UtJWef+7ln5Am/xQ6Z6KwK4MsNfdIraGRLJEWzww2 vGOlJrvP829Fkn5pu0lBWHwcWf5KIcjchuSq0F5+in/8GVOpca1esLea0+fiZmoo3hyC tz2GZFoYSCaRKqpDj9LItdtxaLT/pwRGwiVALyn7A9CfiPMX7D+StOiVOUqkpxRm3PwD C9x1xTz4dzA5zXSJ0wZ3wfjVjthnyE6+C5VGTkaT6qo3vOoVCrzCs89ELQsgYGOoozIh 01Wg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=qiTOlCiq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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-20020a65678c000000b0045afe1a8821si28145082pgr.128.2022.10.22.01.33.23; Sat, 22 Oct 2022 01:33: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=qiTOlCiq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S233456AbiJVISs (ORCPT + 99 others); Sat, 22 Oct 2022 04:18:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48884 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234088AbiJVIQL (ORCPT ); Sat, 22 Oct 2022 04:16:11 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 88E45D6BA2; Sat, 22 Oct 2022 00:57: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 B7EE360B83; Sat, 22 Oct 2022 07:57:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B2D04C433C1; Sat, 22 Oct 2022 07:56:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425420; bh=Q58M62zF5a2Iq9lsiN01H3o52BFXyQ3Xga6ESOSuWIQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qiTOlCiqmePeZAIIiqkgKsAdKSDUY2kSSMqPikeM04TfGAD5rGSnXvR72CC9MlPWK HQAj4l68jMqmSBaGTE4R3zM/H2+412c8ASuTG98F4+hqPh4wRI9vxiedLPCRK4DGss wAyec5dofYao1T74wLh5wwLma6etsZ5XnnFmdxog= 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 5.19 455/717] serial: 8250: Fix restoring termios speed after suspend Date: Sat, 22 Oct 2022 09:25:34 +0200 Message-Id: <20221022072518.416287983@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376005468473623?= X-GMAIL-MSGID: =?utf-8?q?1747376005468473623?= 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 d5f9b56fdbab..c66a029882e6 100644 --- a/drivers/tty/serial/8250/8250_port.c +++ b/drivers/tty/serial/8250/8250_port.c @@ -3325,8 +3325,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 Sat Oct 22 07:25: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: 7490 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1104794wrr; Sat, 22 Oct 2022 01:33:24 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4xBJgn0wFq7C9i9N1d1FsLlPOqxGn8idlVYyZvv4B9K0NjBcOb850f/R7d8V+LDF2cc7bM X-Received: by 2002:a17:902:ce09:b0:178:bb78:49a5 with SMTP id k9-20020a170902ce0900b00178bb7849a5mr23566023plg.100.1666427604370; Sat, 22 Oct 2022 01:33:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666427604; cv=none; d=google.com; s=arc-20160816; b=aR5Cl49+b50zcLQfS+ZCUUiKqTAN4WvxkvwAyJGGzWW6vGHYYfQcP73Y8G01puiRqD Q5l7o9dtF5y7n0hrJibZfRjsPcjM7tFUG6S5jlvTul+mjWrc2KBtYUz11e3QwRi/k5AE tACBQobfxmHVYiCZOlHMpC22JOHh2F0jzpeuh6DKGythNbDYgFlhNXOKW1P8GGAabJky I4H3qEcZ+NJN93fE9LHyhEgcY5xj3470Rwh2ZHjilFA1RGpFzfdqpBWowOAFrBi5KoeH QfcH3H1QiISlww8KbiJvhX70xsf/wa6KDy7v+jP6tZ7sBt8KV+Ru9OQMZmd1v3I1b7uW FaAA== 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=X2gydzhDT82LpqIkq2gSSn5Qmhd99GxcWsuwm2CchbU=; b=d3YwGaGSzBz6XftqtGuzWjBirlbaKMElshfAbk+IHhduMspW3SzMvvRDENIVotCUcf PRXrIj8W6a43esQmFXEr9G/Zcy+TtPW3hHqhRhU/ug/nL8GnQd14A+yykylPHWFZGIgq EurDcPdOtQzGBBMpmWjkD+KUlGeCr5B5mEBoIYRTmV4YzGijbBy2QQber6sUGXV1hhmC edy56g/RNXz5gA0A3ExFNVhu6geqyInla7QMlqmgReKONsYKQfCPb12dgBZZUcfWoh+E p3kxz1cvbHdFdcgKSyIarn6/74hiPTX47Bs4LpNPOXmi80jZ33MAsV5q71WLuAT4bhCp nMMA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=0RAxthJ3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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-20020a170902eccb00b00176db576dc0si33535273plh.147.2022.10.22.01.33.08; Sat, 22 Oct 2022 01:33: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=0RAxthJ3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S233544AbiJVIRT (ORCPT + 99 others); Sat, 22 Oct 2022 04:17:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49164 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233872AbiJVIP1 (ORCPT ); Sat, 22 Oct 2022 04:15:27 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D4ED12D7D27; Sat, 22 Oct 2022 00:56:22 -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 432A360B83; Sat, 22 Oct 2022 07:55:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 44EAEC433D7; Sat, 22 Oct 2022 07:55:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425323; bh=SolJk47Z+/TaZ6Q3OGuH3kP9ZyqpnIFIdMh1bXPf0PM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0RAxthJ3EdCtMMh9GWRnFUHlv/d6UwwnxYeINZkR/28rjepE/ghrJA9z6qa4KStW2 yRMj+iRKdVCXheysRcuc5gkPTB/QB/sOxS8dJYto6wo6yDpgH4r1Yi+k+IPaoyZUVN yctRG41zHs5ygM8fuDEGmVSnpOAUtE0qwSs77jic= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jason Yan , Duoming Zhou , "Martin K. Petersen" , Sasha Levin Subject: [PATCH 5.19 456/717] scsi: libsas: Fix use-after-free bug in smp_execute_task_sg() Date: Sat, 22 Oct 2022 09:25:35 +0200 Message-Id: <20221022072518.465490802@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747375991685899341?= X-GMAIL-MSGID: =?utf-8?q?1747375991685899341?= From: Duoming Zhou [ Upstream commit 46ba53c30666717cb06c2b3c5d896301cd00d0c0 ] When executing SMP task failed, the smp_execute_task_sg() calls del_timer() to delete "slow_task->timer". However, if the timer handler sas_task_internal_timedout() is running, the del_timer() in smp_execute_task_sg() will not stop it and a UAF will happen. The process is shown below: (thread 1) | (thread 2) smp_execute_task_sg() | sas_task_internal_timedout() ... | del_timer() | ... | ... sas_free_task(task) | kfree(task->slow_task) //FREE| | task->slow_task->... //USE Fix by calling del_timer_sync() in smp_execute_task_sg(), which makes sure the timer handler have finished before the "task->slow_task" is deallocated. Link: https://lore.kernel.org/r/20220920144213.10536-1-duoming@zju.edu.cn Fixes: 2908d778ab3e ("[SCSI] aic94xx: new driver") Reviewed-by: Jason Yan Signed-off-by: Duoming Zhou Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin --- drivers/scsi/libsas/sas_expander.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/scsi/libsas/sas_expander.c b/drivers/scsi/libsas/sas_expander.c index 260e735d06fa..1ec5f4c8e430 100644 --- a/drivers/scsi/libsas/sas_expander.c +++ b/drivers/scsi/libsas/sas_expander.c @@ -67,7 +67,7 @@ static int smp_execute_task_sg(struct domain_device *dev, res = i->dft->lldd_execute_task(task, GFP_KERNEL); if (res) { - del_timer(&task->slow_task->timer); + del_timer_sync(&task->slow_task->timer); pr_notice("executing SMP task failed:%d\n", res); break; } From patchwork Sat Oct 22 07:25: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: 7698 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1109275wrr; Sat, 22 Oct 2022 01:47:52 -0700 (PDT) X-Google-Smtp-Source: AMsMyM79DBfqw0WFGqs3Cm9JilrVhWiUQoEYPWFWctTf/LONAw/ebQNzBTTs+AubK0NKSISjJwnT X-Received: by 2002:a17:906:9b93:b0:78d:eb36:1ce7 with SMTP id dd19-20020a1709069b9300b0078deb361ce7mr19249154ejc.621.1666428472259; Sat, 22 Oct 2022 01:47:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666428472; cv=none; d=google.com; s=arc-20160816; b=rpUoV3AaWjQQvJax6gE1ZPbMB+xkk/hTtqQzobW7/yjZ6ksMAszL3Lsl6Vt0jg7Yvg 4D8+WK/xr3fbq+wKANMWrquI7K2D7o5zFumVKqIi9eHh/7EL73uOW7nkMM9btyJhMAla nHXq6OxUIf3ymEBbjb/BbuUpihsjO+hW2o8YiY61jGE74lYdBfnZzcdIvRBdFBR/CwBo IC9elvhI4KYSiPUK2TVkzoyxCNW98oHzJZvIdeGvhL2kjGaG+Jr44Rm+9AYtURWfJUjF rdrPh9KjFUPa2pIUfSGHxIUYg7sEIMSbhJS2s6gJTRsVqLLpp90UTyapJZOtKyFzeCfq cFqw== 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=3VKZd8HMaVqCkJpwsYsTEc6L+9te/cWarOeV1ebYHZ8=; b=eM8plnJimpIDdjaL0sHfpiigRlyd1myQmiSeipHx4Dpmq7zvThMzrIiW6TuorlOpsS ClLyVaLzV/eLdwX3TSxGaCmaWxSvDwxKSL6oGD+P8HJFkN1+7K+YiiFHUylmIbMeZLe7 sfT50bG7G3DhHooBSPZE7JuAt2zOGjfOvYkYWztuzz87/5OzUhve4H54c6oB/0rccxzo 2aiLChgDtvEPU5AB1o/VbwG49PewIMkahIQ3b2aBXgR6qYvZVLGTUCs7BUWaqG7+/Hhl 5oXlgvVQBqpXO3vnQ6GUOPzSkKhMT6nt1BkPA/o64OQVvXU0kYo6XILOKZUmK2QxfpJ8 FtUA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=n9Ld822n; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 hs23-20020a1709073e9700b007801a579899si9261452ejc.448.2022.10.22.01.47.27; Sat, 22 Oct 2022 01:47: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=n9Ld822n; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231391AbiJVIq5 (ORCPT + 99 others); Sat, 22 Oct 2022 04:46:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48384 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235086AbiJVIo3 (ORCPT ); Sat, 22 Oct 2022 04:44: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 6394D2EBB9A; Sat, 22 Oct 2022 01:08: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 D2FA3B82DF0; Sat, 22 Oct 2022 07:55:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 47BD4C433C1; Sat, 22 Oct 2022 07:55:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425356; bh=AKQzI2lfzFxTkIb4u/TG5qUIEPhEmFHhNg/AOpoPEv4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=n9Ld822nhS4z2tSjA+oLqPyuoU/dqL5u9uZkRm2d4pYq0J/2eA7CZUhQsfMpOi9Ul qr0T55TUxelVZmI0P4bdqEetDrkW9q8zYUDxi9Vct7k6Yvt6b5ZbY8Ah/kR5CloG5V Kangf8/AxrnawyTJxkmBdBGpT26tIr3MmJRblfkw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jack Wang , John Garry , "Martin K. Petersen" , Sasha Levin Subject: [PATCH 5.19 457/717] scsi: pm8001: Fix running_req for internal abort commands Date: Sat, 22 Oct 2022 09:25:36 +0200 Message-Id: <20221022072518.512394241@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376901611177239?= X-GMAIL-MSGID: =?utf-8?q?1747376901611177239?= From: John Garry [ Upstream commit d8c22c4697c11ed28062afe3c2b377025be11a23 ] Disabling the remote phy for a SATA disk causes a hang: root@(none)$ more /sys/class/sas_phy/phy-0:0:8/target_port_protocols sata root@(none)$ echo 0 > sys/class/sas_phy/phy-0:0:8/enable root@(none)$ [ 67.855950] sas: ex 500e004aaaaaaa1f phy08 change count has changed [ 67.920585] sd 0:0:2:0: [sdc] Synchronizing SCSI cache [ 67.925780] sd 0:0:2:0: [sdc] Synchronize Cache(10) failed: Result: hostbyte=0x04 driverbyte=DRIVER_OK [ 67.935094] sd 0:0:2:0: [sdc] Stopping disk [ 67.939305] sd 0:0:2:0: [sdc] Start/Stop Unit failed: Result: hostbyte=0x04 driverbyte=DRIVER_OK ... [ 123.998998] INFO: task kworker/u192:1:642 blocked for more than 30 seconds. [ 124.005960] Not tainted 6.0.0-rc1-205202-gf26f8f761e83 #218 [ 124.012049] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message. [ 124.019872] task:kworker/u192:1 state:D stack:0 pid: 642 ppid: 2 flags:0x00000008 [ 124.028223] Workqueue: 0000:04:00.0_event_q sas_port_event_worker [ 124.034319] Call trace: [ 124.036758] __switch_to+0x128/0x278 [ 124.040333] __schedule+0x434/0xa58 [ 124.043820] schedule+0x94/0x138 [ 124.047045] schedule_timeout+0x2fc/0x368 [ 124.051052] wait_for_completion+0xdc/0x200 [ 124.055234] __flush_workqueue+0x1a8/0x708 [ 124.059328] sas_porte_broadcast_rcvd+0xa8/0xc0 [ 124.063858] sas_port_event_worker+0x60/0x98 [ 124.068126] process_one_work+0x3f8/0x660 [ 124.072134] worker_thread+0x70/0x700 [ 124.075793] kthread+0x1a4/0x1b8 [ 124.079014] ret_from_fork+0x10/0x20 The issue is that the per-device running_req read in pm8001_dev_gone_notify() never goes to zero and we never make progress. This is caused by missing accounting for running_req for when an internal abort command completes. In commit 2cbbf489778e ("scsi: pm8001: Use libsas internal abort support") we started to send internal abort commands as a proper sas_task. In this when we deliver a sas_task to HW the per-device running_req is incremented in pm8001_queue_command(). However it is never decremented for internal abort commnds, so decrement in pm8001_mpi_task_abort_resp(). Link: https://lore.kernel.org/r/1663854664-76165-1-git-send-email-john.garry@huawei.com Fixes: 2cbbf489778e ("scsi: pm8001: Use libsas internal abort support") Acked-by: Jack Wang Signed-off-by: John Garry Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin --- drivers/scsi/pm8001/pm8001_hwi.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/scsi/pm8001/pm8001_hwi.c b/drivers/scsi/pm8001/pm8001_hwi.c index 991eb01bb1e0..0ccaefc35d6b 100644 --- a/drivers/scsi/pm8001/pm8001_hwi.c +++ b/drivers/scsi/pm8001/pm8001_hwi.c @@ -3608,6 +3608,10 @@ int pm8001_mpi_task_abort_resp(struct pm8001_hba_info *pm8001_ha, void *piomb) pm8001_dbg(pm8001_ha, FAIL, " TASK NULL. RETURNING !!!\n"); return -1; } + + if (t->task_proto == SAS_PROTOCOL_INTERNAL_ABORT) + atomic_dec(&pm8001_dev->running_req); + ts = &t->task_status; if (status != 0) pm8001_dbg(pm8001_ha, FAIL, "task abort failed status 0x%x ,tag = 0x%x, scp= 0x%x\n", From patchwork Sat Oct 22 07:25: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: 7523 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1105172wrr; Sat, 22 Oct 2022 01:34:18 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7fh40rm7ItCn2Ezk0cy5JX4S6bsYLL8EXtY/UYRf3IAqMBcvt0FqpSHseLByLFkh4kYOkI X-Received: by 2002:a17:902:a60c:b0:184:fa22:8b3c with SMTP id u12-20020a170902a60c00b00184fa228b3cmr22723957plq.136.1666427647091; Sat, 22 Oct 2022 01:34:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666427647; cv=none; d=google.com; s=arc-20160816; b=rpWRhN2P3adu9h+vISz6CBkQ3a+hoBBQLyMIUaTnKEmBTq8HZRqZNY7F/mdIkUPE5O JUKE7UpNz9qtIkafynBCxA+L0JPhe/eJoZ6FR+yyMmFafTSzbgNgigtojj6GuiQnlSMN HR3sG19AFaUCPDLBGJE5zdf4QXDQ+qSAD30DrzRhnDxv6yD+ft6Yn/lgG2aTS+7mf9QI VHJGgGe/g7iqYbodGmbnJzroJ/iw0x0LwEaPsvACQie31oN0BVNR1LlXFeqQEk2Ekaer xQQRov77RqXQ2/fgmWcXmrqwLm4XerfLiY+Ain68ADYLDYrDUvY5HQvyE0xOWmb+I67+ WSjw== 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=NOfSYGIo7noVU2075T7SfRFxW1Qy9Ggs4d6faJx7SZE=; b=duEhWC0WBq/vfjQUM34O+/dKxSfzzcpszV5ChtYCe2KMCYzB9gx5ztLuzF+FZJkbSC QG5vK224DcDRivlPnJzIBtXLmbT02t7gdeJvqRr4jw4E3+zD/Qp+nGs3a5pyzCu+41yk mO+5bT25DOpKgRpXF3JKOxh91gXRIBpQx+yV1LpJK+YjKotHIkBFC+KU5BhdoLrM4YXR LhUMlEXYiLgMwtuDWUVQJ9toFlBUm+7aI3yx5wBaj8AG1sl0BdlTiuzLAbKGGG8JINsD NZg4jDKD5mEa2+upBnOtlYsIRPjFrkH2HA3V2HJKVGGfztkX65RJACocneCPNDl9E9JS wiBw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=OfixWVNI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 j2-20020a170902da8200b0017f7fa141f2si31991123plx.583.2022.10.22.01.33.48; Sat, 22 Oct 2022 01:34: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=OfixWVNI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S233471AbiJVISH (ORCPT + 99 others); Sat, 22 Oct 2022 04:18:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54232 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234027AbiJVIP6 (ORCPT ); Sat, 22 Oct 2022 04:15: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 6578C3FF08; Sat, 22 Oct 2022 00:57: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 8105960B9D; Sat, 22 Oct 2022 07:56:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 82756C433C1; Sat, 22 Oct 2022 07:56:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425389; bh=GbVU7i6kJsHauPmUVr0+cCkaeydYSaa0G0xW5whq3uc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OfixWVNIV03+IVWN1hU5tVb82uiEw7CCAtNTgvgRLfVgPpv53X1WGpO6JkQRsb0t0 1Cy3m0jU2fgQ2CVgK/QklMSkRFSZWiYFmEKrpcHa+VNhfZhumYew58r4RavDC5j4Xb zVHgmjxuUowwA/zhb7PuyQLNNxdWO42OBXp/UYsE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Lee Duncan , Wu Bo , Mike Christie , "Martin K. Petersen" , Sasha Levin Subject: [PATCH 5.19 458/717] scsi: iscsi: Rename iscsi_conn_queue_work() Date: Sat, 22 Oct 2022 09:25:37 +0200 Message-Id: <20221022072518.552040736@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376036467709484?= X-GMAIL-MSGID: =?utf-8?q?1747376036467709484?= From: Mike Christie [ Upstream commit 4b9f8ce4d5e823e42944c5a0a4842b0f936365ad ] Rename iscsi_conn_queue_work() to iscsi_conn_queue_xmit() to reflect that it handles queueing of xmits only. Link: https://lore.kernel.org/r/20220616224557.115234-2-michael.christie@oracle.com Reviewed-by: Lee Duncan Reviewed-by: Wu Bo Signed-off-by: Mike Christie Signed-off-by: Martin K. Petersen Stable-dep-of: 57569c37f0ad ("scsi: iscsi: iscsi_tcp: Fix null-ptr-deref while calling getpeername()") Signed-off-by: Sasha Levin --- drivers/scsi/cxgbi/libcxgbi.c | 2 +- drivers/scsi/iscsi_tcp.c | 2 +- drivers/scsi/libiscsi.c | 12 ++++++------ include/scsi/libiscsi.h | 2 +- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/drivers/scsi/cxgbi/libcxgbi.c b/drivers/scsi/cxgbi/libcxgbi.c index 32abdf0fa9aa..af281e271f88 100644 --- a/drivers/scsi/cxgbi/libcxgbi.c +++ b/drivers/scsi/cxgbi/libcxgbi.c @@ -1455,7 +1455,7 @@ void cxgbi_conn_tx_open(struct cxgbi_sock *csk) if (conn) { log_debug(1 << CXGBI_DBG_SOCK, "csk 0x%p, cid %d.\n", csk, conn->id); - iscsi_conn_queue_work(conn); + iscsi_conn_queue_xmit(conn); } } EXPORT_SYMBOL_GPL(cxgbi_conn_tx_open); diff --git a/drivers/scsi/iscsi_tcp.c b/drivers/scsi/iscsi_tcp.c index 52c6f70d60ec..da1dc345b873 100644 --- a/drivers/scsi/iscsi_tcp.c +++ b/drivers/scsi/iscsi_tcp.c @@ -205,7 +205,7 @@ static void iscsi_sw_tcp_write_space(struct sock *sk) old_write_space(sk); ISCSI_SW_TCP_DBG(conn, "iscsi_write_space\n"); - iscsi_conn_queue_work(conn); + iscsi_conn_queue_xmit(conn); } static void iscsi_sw_tcp_conn_set_callbacks(struct iscsi_conn *conn) diff --git a/drivers/scsi/libiscsi.c b/drivers/scsi/libiscsi.c index 3ddb701cd29c..1bd772d9b804 100644 --- a/drivers/scsi/libiscsi.c +++ b/drivers/scsi/libiscsi.c @@ -83,7 +83,7 @@ MODULE_PARM_DESC(debug_libiscsi_eh, "%s " dbg_fmt, __func__, ##arg); \ } while (0); -inline void iscsi_conn_queue_work(struct iscsi_conn *conn) +inline void iscsi_conn_queue_xmit(struct iscsi_conn *conn) { struct Scsi_Host *shost = conn->session->host; struct iscsi_host *ihost = shost_priv(shost); @@ -91,7 +91,7 @@ inline void iscsi_conn_queue_work(struct iscsi_conn *conn) if (ihost->workq) queue_work(ihost->workq, &conn->xmitwork); } -EXPORT_SYMBOL_GPL(iscsi_conn_queue_work); +EXPORT_SYMBOL_GPL(iscsi_conn_queue_xmit); static void __iscsi_update_cmdsn(struct iscsi_session *session, uint32_t exp_cmdsn, uint32_t max_cmdsn) @@ -765,7 +765,7 @@ __iscsi_conn_send_pdu(struct iscsi_conn *conn, struct iscsi_hdr *hdr, goto free_task; } else { list_add_tail(&task->running, &conn->mgmtqueue); - iscsi_conn_queue_work(conn); + iscsi_conn_queue_xmit(conn); } return task; @@ -1513,7 +1513,7 @@ void iscsi_requeue_task(struct iscsi_task *task) */ iscsi_put_task(task); } - iscsi_conn_queue_work(conn); + iscsi_conn_queue_xmit(conn); spin_unlock_bh(&conn->session->frwd_lock); } EXPORT_SYMBOL_GPL(iscsi_requeue_task); @@ -1782,7 +1782,7 @@ int iscsi_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *sc) } } else { list_add_tail(&task->running, &conn->cmdqueue); - iscsi_conn_queue_work(conn); + iscsi_conn_queue_xmit(conn); } session->queued_cmdsn++; @@ -1963,7 +1963,7 @@ EXPORT_SYMBOL_GPL(iscsi_suspend_tx); static void iscsi_start_tx(struct iscsi_conn *conn) { clear_bit(ISCSI_CONN_FLAG_SUSPEND_TX, &conn->flags); - iscsi_conn_queue_work(conn); + iscsi_conn_queue_xmit(conn); } /* diff --git a/include/scsi/libiscsi.h b/include/scsi/libiscsi.h index 9758a4a9923f..51fb0c17815e 100644 --- a/include/scsi/libiscsi.h +++ b/include/scsi/libiscsi.h @@ -453,7 +453,7 @@ extern int iscsi_conn_get_addr_param(struct sockaddr_storage *addr, enum iscsi_param param, char *buf); extern void iscsi_suspend_tx(struct iscsi_conn *conn); extern void iscsi_suspend_queue(struct iscsi_conn *conn); -extern void iscsi_conn_queue_work(struct iscsi_conn *conn); +extern void iscsi_conn_queue_xmit(struct iscsi_conn *conn); #define iscsi_conn_printk(prefix, _c, fmt, a...) \ iscsi_cls_conn_printk(prefix, ((struct iscsi_conn *)_c)->cls_conn, \ From patchwork Sat Oct 22 07:25: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: 7743 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1110731wrr; Sat, 22 Oct 2022 01:54:06 -0700 (PDT) X-Google-Smtp-Source: AMsMyM66xe4tEffcHmEO7iAUlUFeaXlYOaUiccLo1v1tmVcOj+5AIoDEq7nMQ87fs2zK0djvkO2J X-Received: by 2002:a05:6402:3215:b0:45c:97de:b438 with SMTP id g21-20020a056402321500b0045c97deb438mr21150621eda.7.1666428846065; Sat, 22 Oct 2022 01:54:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666428846; cv=none; d=google.com; s=arc-20160816; b=TMeuSw77yrbZD3xm6h3ZvuxiLeIqIcS5Ywb62GpKEzYdUdzhFLT5UfmjyhUbQBIbMY tvjfMYpj0MVEX+IG6TUdFvykn1g4ybwi215d5JV5x+d23xIWyPzNVdKnfDuceWGZT6je hWIcQeNUpL2T3Nw3qp5vD63TYe2dYvNf7JDjiFUCwXF2QLV5qeo5oHvPsG0YxRHC4Eau lqQvPs4xm0nGcunD7Hsb7zbGnXSYpiqxBcTwJkICOsHSotppvBDM8uHfqZ7hR1dOL8KN 2meORAXy4vwXxSxEDvresse428e6peQHtE4yLteSakBDGyevTkSVrFj/8lsXcFZ4B1+e OXWw== 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=gQKzZkC3zyYwscOxUl/OKePDkuBbPzI0sYI8QFL9ts0=; b=nN9tKreoxaKWnfDxb70N3bQvsTMgoKHHhHDVxy7Ig1EjuezfZzb/uVQIwaxdkEMqpY TtvRhpJX00dyfY2NieQGhMDubkYx1Q0dAQedSTxrVFeb871RsUH0q3Wv13BFlUcHO9mi ENmj3FsoT3tLFl7I+ppYh5RcLh3br89OKD1KLUaMgHiWT7lb+SAC8XuPqv7k6zDsm3CW fvy8IcrpCtpSLSU2QOVTHFDrFZl3VOP36i7hXQfii85yWJ8jhV79UZjDrHC8eqf1Wux9 hFdBeLGljUiH8CdcDM6yPvxlwLcX6uTOhaK/8gZWUbHoGmWqG7Wp3J1XW/QqQGpmcRjb WfCg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="UsPkMC/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 g39-20020a056402322700b0046181f0e503si753657eda.209.2022.10.22.01.53.42; Sat, 22 Oct 2022 01:54: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="UsPkMC/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 S234996AbiJVIxG (ORCPT + 99 others); Sat, 22 Oct 2022 04:53:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51398 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234998AbiJVIwa (ORCPT ); Sat, 22 Oct 2022 04:52:30 -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 CAF542F1429; Sat, 22 Oct 2022 01:12: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 4F7EFB82E1C; Sat, 22 Oct 2022 07:56:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9F207C433D6; Sat, 22 Oct 2022 07:56:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425402; bh=FimAQjt8rxHycJrSJpJ2hpiNp5LRScxtbelMosB/6Po=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UsPkMC/gd2gH2lyUHrTE3EFF++mLGl0rIes3mPqkPEwCtp277QO63javXiSJgFZtB 04Pqu8CMt7uMP0yLt1yAae4giHJBTbq64+PxKCU9YvNUtnBQnjOfeU9IlEb9y1Gx1D gXRvYRCuXc0Qwsfa0tiXd4DHwZhPm8K28GbD2yVc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Lee Duncan , Mike Christie , "Martin K. Petersen" , Sasha Levin Subject: [PATCH 5.19 459/717] scsi: iscsi: Add recv workqueue helpers Date: Sat, 22 Oct 2022 09:25:38 +0200 Message-Id: <20221022072518.601109896@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747377293450456378?= X-GMAIL-MSGID: =?utf-8?q?1747377293450456378?= From: Mike Christie [ Upstream commit 8af809966c0b34cfacd8da9a412689b8e9910354 ] Add helpers to allow the drivers to run their recv paths from libiscsi's workqueue. Link: https://lore.kernel.org/r/20220616224557.115234-3-michael.christie@oracle.com Reviewed-by: Lee Duncan Signed-off-by: Mike Christie Signed-off-by: Martin K. Petersen Stable-dep-of: 57569c37f0ad ("scsi: iscsi: iscsi_tcp: Fix null-ptr-deref while calling getpeername()") Signed-off-by: Sasha Levin --- drivers/scsi/libiscsi.c | 29 +++++++++++++++++++++++++++-- include/scsi/libiscsi.h | 4 ++++ 2 files changed, 31 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/libiscsi.c b/drivers/scsi/libiscsi.c index 1bd772d9b804..8f73c8d6ef22 100644 --- a/drivers/scsi/libiscsi.c +++ b/drivers/scsi/libiscsi.c @@ -93,6 +93,16 @@ inline void iscsi_conn_queue_xmit(struct iscsi_conn *conn) } EXPORT_SYMBOL_GPL(iscsi_conn_queue_xmit); +inline void iscsi_conn_queue_recv(struct iscsi_conn *conn) +{ + struct Scsi_Host *shost = conn->session->host; + struct iscsi_host *ihost = shost_priv(shost); + + if (ihost->workq && !test_bit(ISCSI_CONN_FLAG_SUSPEND_RX, &conn->flags)) + queue_work(ihost->workq, &conn->recvwork); +} +EXPORT_SYMBOL_GPL(iscsi_conn_queue_recv); + static void __iscsi_update_cmdsn(struct iscsi_session *session, uint32_t exp_cmdsn, uint32_t max_cmdsn) { @@ -1943,7 +1953,7 @@ EXPORT_SYMBOL_GPL(iscsi_suspend_queue); /** * iscsi_suspend_tx - suspend iscsi_data_xmit - * @conn: iscsi conn tp stop processing IO on. + * @conn: iscsi conn to stop processing IO on. * * This function sets the suspend bit to prevent iscsi_data_xmit * from sending new IO, and if work is queued on the xmit thread @@ -1956,7 +1966,7 @@ void iscsi_suspend_tx(struct iscsi_conn *conn) set_bit(ISCSI_CONN_FLAG_SUSPEND_TX, &conn->flags); if (ihost->workq) - flush_workqueue(ihost->workq); + flush_work(&conn->xmitwork); } EXPORT_SYMBOL_GPL(iscsi_suspend_tx); @@ -1966,6 +1976,21 @@ static void iscsi_start_tx(struct iscsi_conn *conn) iscsi_conn_queue_xmit(conn); } +/** + * iscsi_suspend_rx - Prevent recvwork from running again. + * @conn: iscsi conn to stop. + */ +void iscsi_suspend_rx(struct iscsi_conn *conn) +{ + struct Scsi_Host *shost = conn->session->host; + struct iscsi_host *ihost = shost_priv(shost); + + set_bit(ISCSI_CONN_FLAG_SUSPEND_RX, &conn->flags); + if (ihost->workq) + flush_work(&conn->recvwork); +} +EXPORT_SYMBOL_GPL(iscsi_suspend_rx); + /* * We want to make sure a ping is in flight. It has timed out. * And we are not busy processing a pdu that is making diff --git a/include/scsi/libiscsi.h b/include/scsi/libiscsi.h index 51fb0c17815e..5a10e5acfad2 100644 --- a/include/scsi/libiscsi.h +++ b/include/scsi/libiscsi.h @@ -213,6 +213,8 @@ struct iscsi_conn { struct list_head cmdqueue; /* data-path cmd queue */ struct list_head requeue; /* tasks needing another run */ struct work_struct xmitwork; /* per-conn. xmit workqueue */ + /* recv */ + struct work_struct recvwork; unsigned long flags; /* ISCSI_CONN_FLAGs */ /* negotiated params */ @@ -452,8 +454,10 @@ extern int iscsi_conn_get_param(struct iscsi_cls_conn *cls_conn, extern int iscsi_conn_get_addr_param(struct sockaddr_storage *addr, enum iscsi_param param, char *buf); extern void iscsi_suspend_tx(struct iscsi_conn *conn); +extern void iscsi_suspend_rx(struct iscsi_conn *conn); extern void iscsi_suspend_queue(struct iscsi_conn *conn); extern void iscsi_conn_queue_xmit(struct iscsi_conn *conn); +extern void iscsi_conn_queue_recv(struct iscsi_conn *conn); #define iscsi_conn_printk(prefix, _c, fmt, a...) \ iscsi_cls_conn_printk(prefix, ((struct iscsi_conn *)_c)->cls_conn, \ From patchwork Sat Oct 22 07:25: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: 7702 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1109392wrr; Sat, 22 Oct 2022 01:48:18 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6nQ1Yd0XQEgbg46A2s9gRJuR6UtfFIq2rf6PeM9fXHw7+2eQJATtE+m6tTGqOJdPIDsdqm X-Received: by 2002:a17:906:ef8c:b0:78d:46b7:6847 with SMTP id ze12-20020a170906ef8c00b0078d46b76847mr18879600ejb.241.1666428498329; Sat, 22 Oct 2022 01:48:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666428498; cv=none; d=google.com; s=arc-20160816; b=x66nWxM6dTumuHK2CFywFzMH1JgZIpTwArd64n90pFKaV/JLNY3YlQsavziNjZsRQ3 ydu+9mo5aBVcrWx+a17AW56ogbi3skU6T3Mg1RY+VmPAg4lHG7GbbROQLeSm/ZV/lAqr TUTHVfsuDgnp94hT+pkKCCVKF0qHwuK7muwuYvrAbGFSc0pFCUEgze2p3iIuV2MyI8wq HnChftu9YMvAMhlO9xoNyvVYCuhP0easvukfHdIkZ9w3uXlHKGky1ddAFivKeTNWxkK0 oR6I6/MunGsmTqkyqrbcbnOuQENxsdwZAcclW8aSxkbkmuYz+7MtQopZTNDS/G4LX7yT O/Pg== 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=yVfSfWzjyZxG/GevmHUGwsWrc+WFjFeaFlNwI8q26SU=; b=bZvMRQvpx71N+/s1IKmK+8DREoTjbLJg27WE354E8GwXIhnjf5rjDuKP4Jj0t0FZL/ BhH12JW8Gn0en/MSqEd9Yf6ZTW4rAhq5a9pbNCkQoEz6c/TJh9YLXgfyzRYNlaNgPyCR kOmX4Qsg0HrYEusatLZg3lHX4FgWTg4MXS5q/Wt8B2aqb6Z6/S4oHN4MQQjYFIAQMM2W 5Yy3QnIdysMrbRqmqveaCbMC372gsw/k5XZi1G9yQ8xzzCIyAmVl2O/tXBOVUOPoN2fK 1LxiKYaHS23u6tf0CftuCHS3RigAgHoCp45EMxiZh8uvjF+2v7IcUT2EJJ2T5e5FSILC ziyQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=rl7eMwlz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 di13-20020a170906730d00b0078d1e08f1e5si21594297ejc.919.2022.10.22.01.47.54; Sat, 22 Oct 2022 01:48: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=rl7eMwlz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S234778AbiJVIrV (ORCPT + 99 others); Sat, 22 Oct 2022 04:47:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54864 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235157AbiJVIor (ORCPT ); Sat, 22 Oct 2022 04:44: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 9AB672CB8DA; Sat, 22 Oct 2022 01: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 ams.source.kernel.org (Postfix) with ESMTPS id 33AB6B82E10; Sat, 22 Oct 2022 07:56:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9981BC4314B; Sat, 22 Oct 2022 07:56:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425405; bh=tehG72v3c95uVxTzV5i+1h2vcogIiUZ8LZxNLsn5eu4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rl7eMwlzP3hVD2rOnT0D1yw91H66Jnw/IbjKv201vatLYrgcdPYuxhHkCicVrAKF3 CLKq82v1mEBUVr8M0OM2/yk0ZqnhW7NYNDxJkPIC0Sh3pnfngx1qNnnPBSwsiBFRQV PVcmKnWyLZb4So6CfQmxom9bqQQUVHDZcf/T0694= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Lee Duncan , Mike Christie , "Martin K. Petersen" , Sasha Levin Subject: [PATCH 5.19 460/717] scsi: iscsi: Run recv path from workqueue Date: Sat, 22 Oct 2022 09:25:39 +0200 Message-Id: <20221022072518.651221542@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376928981908162?= X-GMAIL-MSGID: =?utf-8?q?1747376928981908162?= From: Mike Christie [ Upstream commit f1d269765ee29da56b32818b7a08054484ed89f2 ] We don't always want to run the recv path from the network softirq because when we have to have multiple sessions sharing the same CPUs, some sessions can eat up the NAPI softirq budget and affect other sessions or users. Allow us to queue the recv handling to the iscsi workqueue so we can have the scheduler/wq code try to balance the work and CPU use across all sessions' worker threads. Note: It wasn't the original intent of the change but a nice side effect is that for some workloads/configs we get a nice performance boost. For a simple read heavy test: fio --direct=1 --filename=/dev/dm-0 --rw=randread --bs=256K --ioengine=libaio --iodepth=128 --numjobs=4 where the iscsi threads, fio jobs, and rps_cpus share CPUs we see a 32% throughput boost. We also see increases for small I/O IOPs tests but it's not as high. Link: https://lore.kernel.org/r/20220616224557.115234-4-michael.christie@oracle.com Reviewed-by: Lee Duncan Signed-off-by: Mike Christie Signed-off-by: Martin K. Petersen Stable-dep-of: 57569c37f0ad ("scsi: iscsi: iscsi_tcp: Fix null-ptr-deref while calling getpeername()") Signed-off-by: Sasha Levin --- drivers/scsi/iscsi_tcp.c | 65 ++++++++++++++++++++++++++++++++-------- drivers/scsi/iscsi_tcp.h | 2 ++ 2 files changed, 54 insertions(+), 13 deletions(-) diff --git a/drivers/scsi/iscsi_tcp.c b/drivers/scsi/iscsi_tcp.c index da1dc345b873..10d7f2b7dd0e 100644 --- a/drivers/scsi/iscsi_tcp.c +++ b/drivers/scsi/iscsi_tcp.c @@ -52,6 +52,10 @@ static struct iscsi_transport iscsi_sw_tcp_transport; static unsigned int iscsi_max_lun = ~0; module_param_named(max_lun, iscsi_max_lun, uint, S_IRUGO); +static bool iscsi_recv_from_iscsi_q; +module_param_named(recv_from_iscsi_q, iscsi_recv_from_iscsi_q, bool, 0644); +MODULE_PARM_DESC(recv_from_iscsi_q, "Set to true to read iSCSI data/headers from the iscsi_q workqueue. The default is false which will perform reads from the network softirq context."); + static int iscsi_sw_tcp_dbg; module_param_named(debug_iscsi_tcp, iscsi_sw_tcp_dbg, int, S_IRUGO | S_IWUSR); @@ -122,20 +126,13 @@ static inline int iscsi_sw_sk_state_check(struct sock *sk) return 0; } -static void iscsi_sw_tcp_data_ready(struct sock *sk) +static void iscsi_sw_tcp_recv_data(struct iscsi_conn *conn) { - struct iscsi_conn *conn; - struct iscsi_tcp_conn *tcp_conn; + struct iscsi_tcp_conn *tcp_conn = conn->dd_data; + struct iscsi_sw_tcp_conn *tcp_sw_conn = tcp_conn->dd_data; + struct sock *sk = tcp_sw_conn->sock->sk; read_descriptor_t rd_desc; - read_lock_bh(&sk->sk_callback_lock); - conn = sk->sk_user_data; - if (!conn) { - read_unlock_bh(&sk->sk_callback_lock); - return; - } - tcp_conn = conn->dd_data; - /* * Use rd_desc to pass 'conn' to iscsi_tcp_recv. * We set count to 1 because we want the network layer to @@ -144,13 +141,48 @@ static void iscsi_sw_tcp_data_ready(struct sock *sk) */ rd_desc.arg.data = conn; rd_desc.count = 1; - tcp_read_sock(sk, &rd_desc, iscsi_sw_tcp_recv); - iscsi_sw_sk_state_check(sk); + tcp_read_sock(sk, &rd_desc, iscsi_sw_tcp_recv); /* If we had to (atomically) map a highmem page, * unmap it now. */ iscsi_tcp_segment_unmap(&tcp_conn->in.segment); + + iscsi_sw_sk_state_check(sk); +} + +static void iscsi_sw_tcp_recv_data_work(struct work_struct *work) +{ + struct iscsi_conn *conn = container_of(work, struct iscsi_conn, + recvwork); + struct iscsi_tcp_conn *tcp_conn = conn->dd_data; + struct iscsi_sw_tcp_conn *tcp_sw_conn = tcp_conn->dd_data; + struct sock *sk = tcp_sw_conn->sock->sk; + + lock_sock(sk); + iscsi_sw_tcp_recv_data(conn); + release_sock(sk); +} + +static void iscsi_sw_tcp_data_ready(struct sock *sk) +{ + struct iscsi_sw_tcp_conn *tcp_sw_conn; + struct iscsi_tcp_conn *tcp_conn; + struct iscsi_conn *conn; + + read_lock_bh(&sk->sk_callback_lock); + conn = sk->sk_user_data; + if (!conn) { + read_unlock_bh(&sk->sk_callback_lock); + return; + } + tcp_conn = conn->dd_data; + tcp_sw_conn = tcp_conn->dd_data; + + if (tcp_sw_conn->queue_recv) + iscsi_conn_queue_recv(conn); + else + iscsi_sw_tcp_recv_data(conn); read_unlock_bh(&sk->sk_callback_lock); } @@ -276,6 +308,9 @@ static int iscsi_sw_tcp_xmit_segment(struct iscsi_tcp_conn *tcp_conn, if (segment->total_copied + segment->size < segment->total_size) flags |= MSG_MORE; + if (tcp_sw_conn->queue_recv) + flags |= MSG_DONTWAIT; + /* Use sendpage if we can; else fall back to sendmsg */ if (!segment->data) { sg = segment->sg; @@ -557,6 +592,8 @@ iscsi_sw_tcp_conn_create(struct iscsi_cls_session *cls_session, conn = cls_conn->dd_data; tcp_conn = conn->dd_data; tcp_sw_conn = tcp_conn->dd_data; + INIT_WORK(&conn->recvwork, iscsi_sw_tcp_recv_data_work); + tcp_sw_conn->queue_recv = iscsi_recv_from_iscsi_q; tfm = crypto_alloc_ahash("crc32c", 0, CRYPTO_ALG_ASYNC); if (IS_ERR(tfm)) @@ -610,6 +647,8 @@ static void iscsi_sw_tcp_release_conn(struct iscsi_conn *conn) iscsi_sw_tcp_conn_restore_callbacks(conn); sock_put(sock->sk); + iscsi_suspend_rx(conn); + spin_lock_bh(&session->frwd_lock); tcp_sw_conn->sock = NULL; spin_unlock_bh(&session->frwd_lock); diff --git a/drivers/scsi/iscsi_tcp.h b/drivers/scsi/iscsi_tcp.h index 791453195099..850a018aefb9 100644 --- a/drivers/scsi/iscsi_tcp.h +++ b/drivers/scsi/iscsi_tcp.h @@ -28,6 +28,8 @@ struct iscsi_sw_tcp_send { struct iscsi_sw_tcp_conn { struct socket *sock; + struct work_struct recvwork; + bool queue_recv; struct iscsi_sw_tcp_send out; /* old values for socket callbacks */ From patchwork Sat Oct 22 07:25: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: 7516 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1105093wrr; Sat, 22 Oct 2022 01:34:07 -0700 (PDT) X-Google-Smtp-Source: AMsMyM55b+9NyVb2059ixNltyqGNP74ZZRTOB2ziL3v6/7lEJqrC1Mc0j4B8W3R9/8xB9SJidkLk X-Received: by 2002:a17:90a:6405:b0:203:6eaa:4999 with SMTP id g5-20020a17090a640500b002036eaa4999mr62502288pjj.8.1666427636182; Sat, 22 Oct 2022 01:33:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666427636; cv=none; d=google.com; s=arc-20160816; b=B+cD1QxU8XrYC6ySYMHcYivJIB1eVedS2wOCrH16YoflrCThV2/od1KtiQLqqGlCAb GLGwxtmBhAVOOsZ7GCEwZhK0cnUGooQApAv4lw4F4egNzZ2hA96WUDB5zawoJ6iTbiJ0 TLOja/ZT5vOvzr5g1r/IWYmAebAoJjU3l4WVF7VUUOAwJsmnKm5HxcgkWmxt5tVbfb5O mNbCj5MFMnrGO14RPR052VzF4RlEc/Q5bIawx7c0FPjz6w2L19KDi5nogIxbS4M5uD7z p0XlniglPQz4LU9MnrRtwqen1p3N31OBbRSeSvX9T7S10fo4+DhsR6Y5ZOF+GqiLVpdC 1/xQ== 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=ISAeo9qaNEMwBLm/x/dchmSThxep/M6CTM1OqEzlDhg=; b=Fcmy/g3e+UKjjvrXMq+RJWE/R2crN+WzpdiWhNouiplUORjRhahlpTNUf++VmDwBrd o0TaV7azUbtxCNmcBb6/qvmdmgD0wzuCxYLb/3mEwhxtIc6JIYeeVq9nVRmlUtiSNYy+ H8m0fYJgbId1cfWleqUHRBOwOZVeSrZYROg/S236Rh3M7Tu6yssrK0b7DPTeBwBfHqVv XM09yYbBRBRumecj5tPMKXIy4Y3YMzJluUDt1BOi6jskijlomcbVX373KTDgj7MCs2g1 EZH1W61QvQ8XMohQ/Vv3M0ISCvllmPX9XI9wzAzuSd2TWXZA8s27cXfb7PYl7kWn2Vul tewA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=iVdCxiKH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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-20020a056a000a8700b0052f60f7e0a1si30656476pfl.5.2022.10.22.01.33.40; Sat, 22 Oct 2022 01:33: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=iVdCxiKH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S233671AbiJVIUm (ORCPT + 99 others); Sat, 22 Oct 2022 04:20:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48234 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233713AbiJVITL (ORCPT ); Sat, 22 Oct 2022 04:19: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 D27DAA3B71; Sat, 22 Oct 2022 00:58: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 601ACB82E2E; Sat, 22 Oct 2022 07:56:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 92177C433C1; Sat, 22 Oct 2022 07:56:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425408; bh=1D/vS+8S3AmPgXJJELocgYPg2tPpEPjyNhYTEsMKNm8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iVdCxiKHnECRRtqDlHiAqzdQVXK7f3VjulDAGTa664xxcdDrif9DkFbi8KJEgElWK 8vpuehdDDXOfi3u2hy2fcICYz5qQD4Zg62jzWn9zOKjBmbxWiCtcFARDOmZUZgzbM2 r1K0quiR2wXXvokCl5qpQPN4AR7imds+6nJYSz0E= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mike Christie , "Martin K. Petersen" , Sasha Levin Subject: [PATCH 5.19 461/717] scsi: iscsi: iscsi_tcp: Fix null-ptr-deref while calling getpeername() Date: Sat, 22 Oct 2022 09:25:40 +0200 Message-Id: <20221022072518.691067484@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376024573301791?= X-GMAIL-MSGID: =?utf-8?q?1747376024573301791?= From: Mike Christie [ Upstream commit 57569c37f0add1b6489e1a1563c71519daf732cf ] Fix a NULL pointer crash that occurs when we are freeing the socket at the same time we access it via sysfs. The problem is that: 1. iscsi_sw_tcp_conn_get_param() and iscsi_sw_tcp_host_get_param() take the frwd_lock and do sock_hold() then drop the frwd_lock. sock_hold() does a get on the "struct sock". 2. iscsi_sw_tcp_release_conn() does sockfd_put() which does the last put on the "struct socket" and that does __sock_release() which sets the sock->ops to NULL. 3. iscsi_sw_tcp_conn_get_param() and iscsi_sw_tcp_host_get_param() then call kernel_getpeername() which accesses the NULL sock->ops. Above we do a get on the "struct sock", but we needed a get on the "struct socket". Originally, we just held the frwd_lock the entire time but in commit bcf3a2953d36 ("scsi: iscsi: iscsi_tcp: Avoid holding spinlock while calling getpeername()") we switched to refcount based because the network layer changed and started taking a mutex in that path, so we could no longer hold the frwd_lock. Instead of trying to maintain multiple refcounts, this just has us use a mutex for accessing the socket in the interface code paths. Link: https://lore.kernel.org/r/20220907221700.10302-1-michael.christie@oracle.com Fixes: bcf3a2953d36 ("scsi: iscsi: iscsi_tcp: Avoid holding spinlock while calling getpeername()") Signed-off-by: Mike Christie Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin --- drivers/scsi/iscsi_tcp.c | 73 ++++++++++++++++++++++++++++------------ drivers/scsi/iscsi_tcp.h | 3 ++ 2 files changed, 55 insertions(+), 21 deletions(-) diff --git a/drivers/scsi/iscsi_tcp.c b/drivers/scsi/iscsi_tcp.c index 10d7f2b7dd0e..7e99070ea611 100644 --- a/drivers/scsi/iscsi_tcp.c +++ b/drivers/scsi/iscsi_tcp.c @@ -595,6 +595,8 @@ iscsi_sw_tcp_conn_create(struct iscsi_cls_session *cls_session, INIT_WORK(&conn->recvwork, iscsi_sw_tcp_recv_data_work); tcp_sw_conn->queue_recv = iscsi_recv_from_iscsi_q; + mutex_init(&tcp_sw_conn->sock_lock); + tfm = crypto_alloc_ahash("crc32c", 0, CRYPTO_ALG_ASYNC); if (IS_ERR(tfm)) goto free_conn; @@ -629,11 +631,15 @@ iscsi_sw_tcp_conn_create(struct iscsi_cls_session *cls_session, static void iscsi_sw_tcp_release_conn(struct iscsi_conn *conn) { - struct iscsi_session *session = conn->session; struct iscsi_tcp_conn *tcp_conn = conn->dd_data; struct iscsi_sw_tcp_conn *tcp_sw_conn = tcp_conn->dd_data; struct socket *sock = tcp_sw_conn->sock; + /* + * The iscsi transport class will make sure we are not called in + * parallel with start, stop, bind and destroys. However, this can be + * called twice if userspace does a stop then a destroy. + */ if (!sock) return; @@ -649,9 +655,9 @@ static void iscsi_sw_tcp_release_conn(struct iscsi_conn *conn) iscsi_suspend_rx(conn); - spin_lock_bh(&session->frwd_lock); + mutex_lock(&tcp_sw_conn->sock_lock); tcp_sw_conn->sock = NULL; - spin_unlock_bh(&session->frwd_lock); + mutex_unlock(&tcp_sw_conn->sock_lock); sockfd_put(sock); } @@ -703,7 +709,6 @@ iscsi_sw_tcp_conn_bind(struct iscsi_cls_session *cls_session, struct iscsi_cls_conn *cls_conn, uint64_t transport_eph, int is_leading) { - struct iscsi_session *session = cls_session->dd_data; struct iscsi_conn *conn = cls_conn->dd_data; struct iscsi_tcp_conn *tcp_conn = conn->dd_data; struct iscsi_sw_tcp_conn *tcp_sw_conn = tcp_conn->dd_data; @@ -723,10 +728,10 @@ iscsi_sw_tcp_conn_bind(struct iscsi_cls_session *cls_session, if (err) goto free_socket; - spin_lock_bh(&session->frwd_lock); + mutex_lock(&tcp_sw_conn->sock_lock); /* bind iSCSI connection and socket */ tcp_sw_conn->sock = sock; - spin_unlock_bh(&session->frwd_lock); + mutex_unlock(&tcp_sw_conn->sock_lock); /* setup Socket parameters */ sk = sock->sk; @@ -763,8 +768,15 @@ static int iscsi_sw_tcp_conn_set_param(struct iscsi_cls_conn *cls_conn, break; case ISCSI_PARAM_DATADGST_EN: iscsi_set_param(cls_conn, param, buf, buflen); + + mutex_lock(&tcp_sw_conn->sock_lock); + if (!tcp_sw_conn->sock) { + mutex_unlock(&tcp_sw_conn->sock_lock); + return -ENOTCONN; + } tcp_sw_conn->sendpage = conn->datadgst_en ? sock_no_sendpage : tcp_sw_conn->sock->ops->sendpage; + mutex_unlock(&tcp_sw_conn->sock_lock); break; case ISCSI_PARAM_MAX_R2T: return iscsi_tcp_set_max_r2t(conn, buf); @@ -779,8 +791,8 @@ static int iscsi_sw_tcp_conn_get_param(struct iscsi_cls_conn *cls_conn, enum iscsi_param param, char *buf) { struct iscsi_conn *conn = cls_conn->dd_data; - struct iscsi_tcp_conn *tcp_conn = conn->dd_data; - struct iscsi_sw_tcp_conn *tcp_sw_conn = tcp_conn->dd_data; + struct iscsi_sw_tcp_conn *tcp_sw_conn; + struct iscsi_tcp_conn *tcp_conn; struct sockaddr_in6 addr; struct socket *sock; int rc; @@ -790,21 +802,36 @@ static int iscsi_sw_tcp_conn_get_param(struct iscsi_cls_conn *cls_conn, case ISCSI_PARAM_CONN_ADDRESS: case ISCSI_PARAM_LOCAL_PORT: spin_lock_bh(&conn->session->frwd_lock); - if (!tcp_sw_conn || !tcp_sw_conn->sock) { + if (!conn->session->leadconn) { spin_unlock_bh(&conn->session->frwd_lock); return -ENOTCONN; } - sock = tcp_sw_conn->sock; - sock_hold(sock->sk); + /* + * The conn has been setup and bound, so just grab a ref + * incase a destroy runs while we are in the net layer. + */ + iscsi_get_conn(conn->cls_conn); spin_unlock_bh(&conn->session->frwd_lock); + tcp_conn = conn->dd_data; + tcp_sw_conn = tcp_conn->dd_data; + + mutex_lock(&tcp_sw_conn->sock_lock); + sock = tcp_sw_conn->sock; + if (!sock) { + rc = -ENOTCONN; + goto sock_unlock; + } + if (param == ISCSI_PARAM_LOCAL_PORT) rc = kernel_getsockname(sock, (struct sockaddr *)&addr); else rc = kernel_getpeername(sock, (struct sockaddr *)&addr); - sock_put(sock->sk); +sock_unlock: + mutex_unlock(&tcp_sw_conn->sock_lock); + iscsi_put_conn(conn->cls_conn); if (rc < 0) return rc; @@ -842,17 +869,21 @@ static int iscsi_sw_tcp_host_get_param(struct Scsi_Host *shost, } tcp_conn = conn->dd_data; tcp_sw_conn = tcp_conn->dd_data; - sock = tcp_sw_conn->sock; - if (!sock) { - spin_unlock_bh(&session->frwd_lock); - return -ENOTCONN; - } - sock_hold(sock->sk); + /* + * The conn has been setup and bound, so just grab a ref + * incase a destroy runs while we are in the net layer. + */ + iscsi_get_conn(conn->cls_conn); spin_unlock_bh(&session->frwd_lock); - rc = kernel_getsockname(sock, - (struct sockaddr *)&addr); - sock_put(sock->sk); + mutex_lock(&tcp_sw_conn->sock_lock); + sock = tcp_sw_conn->sock; + if (!sock) + rc = -ENOTCONN; + else + rc = kernel_getsockname(sock, (struct sockaddr *)&addr); + mutex_unlock(&tcp_sw_conn->sock_lock); + iscsi_put_conn(conn->cls_conn); if (rc < 0) return rc; diff --git a/drivers/scsi/iscsi_tcp.h b/drivers/scsi/iscsi_tcp.h index 850a018aefb9..68e14a344904 100644 --- a/drivers/scsi/iscsi_tcp.h +++ b/drivers/scsi/iscsi_tcp.h @@ -28,6 +28,9 @@ struct iscsi_sw_tcp_send { struct iscsi_sw_tcp_conn { struct socket *sock; + /* Taken when accessing the sock from the netlink/sysfs interface */ + struct mutex sock_lock; + struct work_struct recvwork; bool queue_recv; From patchwork Sat Oct 22 07:25: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: 7536 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1105864wrr; Sat, 22 Oct 2022 01:36:22 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4BWPl4Xt60WidfkiQ7V1UZYc8udvnF5WOd4OqbQJbCK7AVIkh40yvAvyjN1sbHWDA7ZsHc X-Received: by 2002:a05:6a00:290f:b0:56b:9226:9aa3 with SMTP id cg15-20020a056a00290f00b0056b92269aa3mr877178pfb.83.1666427782429; Sat, 22 Oct 2022 01:36:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666427782; cv=none; d=google.com; s=arc-20160816; b=PGdLQ7rSAN5Vx6M7fARhyYuJpof7pKHOmJBT7ZJ0ePSJMMyFqNI7e9gMBpLExBCFv1 nx6KkolB/7i+goVIi3yad/l5PEDHmHYlP+3qfikVDSqXUPmMrTSlLB3AFUsxJVUe/0s1 VbwEMM8INe5YNqA1sH/XSy1dCtvfVPSLCCFBEycyY7JPZ2wOWcWFXL5OhP/WpdxzFpGH UVUmrV77T58hmYhBjgxMzbkiSM875k/Hk+6tcJKQbAJvh+i24WPj5gEMpVs1NpkLEV3/ wRhaevxAynmfPi4FUIZmX993IBqATXhtC60CGiVpXJxdl5y97hw78lCmQKn/8nNyElel jGsA== 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=vEpJhqIpwQmFdzqiv6RUZiajBMmVY/iEhd/SkqiY9NU=; b=YjiyzuBVSvVlnzCh89ZWsDp0mRhtzKR+I0zKeUuzFmvYexZoMf+2+CK4qSJFD9n2Mh um7tW1obS4JQUTR0SMrxqJsg8K2yGViOqXPemhM8+KCyVpnw84G2+ziVRmW8dHXcLV16 V8iqdkvjlCPq+UJLKR7IVHU156PGky17eRDB2vC3G8D/Xk/sx53D/rPgr7mLY7OS3RNl nul2mPaWBFS88sHTCMaSL0ZTo90jJf89LJeZTndNpCxVO6Pu6r3SYuaipZHt/oIK4A05 yeJE770noPxT1vSJAL/ZuRuJEv/qyqSowzqZeIZ3kNdGus5Krla4yk8frdcHO8H2Y5wI 1IrQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=wZZdsA+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 p21-20020a63e655000000b00438766f903asi27965685pgj.490.2022.10.22.01.36.08; Sat, 22 Oct 2022 01:36: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=wZZdsA+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 S233748AbiJVI0C (ORCPT + 99 others); Sat, 22 Oct 2022 04:26:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36028 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233962AbiJVIY0 (ORCPT ); Sat, 22 Oct 2022 04:24: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 5216E4000C; Sat, 22 Oct 2022 00:59: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 71980B82E2C; Sat, 22 Oct 2022 07:56:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A3525C433C1; Sat, 22 Oct 2022 07:56:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425411; bh=ihLTuvpV7fDfB9cdHCvDyrLZholIYyBFIIbqcDNjvCo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wZZdsA+JwsBt2b4VahehVTDo6DK35zmDtTIJRpn2h1y8o4M2VOgF8UCGzVY+Z3ToN LWXkZmZUwxMBiJl6f3B3jsAOLGsoCZQ/0rCpuBWkZdKaLssbfIPdsCCq60PT2GIMlP xeZnmqcdoyp4jn/3WsdccJFGkWhtZYCF3C/aGHQk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Robert Marko , Dmitry Baryshkov , Bjorn Andersson , Sasha Levin Subject: [PATCH 5.19 462/717] clk: qcom: apss-ipq6018: mark apcs_alias0_core_clk as critical Date: Sat, 22 Oct 2022 09:25:41 +0200 Message-Id: <20221022072518.732027452@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376178538503024?= X-GMAIL-MSGID: =?utf-8?q?1747376178538503024?= From: Robert Marko [ Upstream commit 86e78995c93ee182433f965babfccd48417d4dcf ] While fixing up the driver I noticed that my IPQ8074 board was hanging after CPUFreq switched the frequency during boot, WDT would eventually reset it. So mark apcs_alias0_core_clk as critical since its the clock feeding the CPU cluster and must never be disabled. Fixes: 5e77b4ef1b19 ("clk: qcom: Add ipq6018 apss clock controller") Signed-off-by: Robert Marko Reviewed-by: Dmitry Baryshkov Signed-off-by: Bjorn Andersson Link: https://lore.kernel.org/r/20220818220628.339366-3-robimarko@gmail.com Signed-off-by: Sasha Levin --- drivers/clk/qcom/apss-ipq6018.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/clk/qcom/apss-ipq6018.c +++ b/drivers/clk/qcom/apss-ipq6018.c @@ -57,7 +57,7 @@ static struct clk_branch apcs_alias0_cor .parent_hws = (const struct clk_hw *[]){ &apcs_alias0_clk_src.clkr.hw }, .num_parents = 1, - .flags = CLK_SET_RATE_PARENT, + .flags = CLK_SET_RATE_PARENT | CLK_IS_CRITICAL, .ops = &clk_branch2_ops, }, }, From patchwork Sat Oct 22 07:25: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: 7497 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1104883wrr; Sat, 22 Oct 2022 01:33:37 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6d8xUcOAspdSP7h+D3iy3NxT+6eyVOj/rlsLE+mEAKcQry11pg1dDOwHV+m7QM03PEIx/h X-Received: by 2002:a17:902:d590:b0:185:4875:ae29 with SMTP id k16-20020a170902d59000b001854875ae29mr23614894plh.27.1666427617072; Sat, 22 Oct 2022 01:33:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666427617; cv=none; d=google.com; s=arc-20160816; b=khxDnugEX4DGv5v/uB/34u5gZEB5uSkKNcEfwmPjbxr97oMdcbSV0jb2wUnD5K82DZ USQ/ZsldIKRaVaYsSP1MTE4Ytf5qYAKsWqSPTZI15BDxztvio2NZpSUkOHxo6eC035mN 09hEhcstNOLHfqPH1ygCQB5ez2uyCakPCcZjwyXPMkLkhU+Ga+AeZuNnheTd7OkxiZzb iFrmCEytKHYbwzcLIghqhW07QmhvPL2hHtusIAOKobvA8nF64ZgfHtJBei9FKjiq/I1X ECzPYW/kUruIEyHn/bX/U12l6TzrPnLGFJi3MjWMM/kqEEAIkohOrktlTb1J6xeYx3wA kzBA== 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=uzbO9DSjnC1Yd0fQAin7YROKX3YifTgd3Ygidwkio6k=; b=iN2oeql06pF1kP6HaFh/lLB0OaNS29muFESKtu/g6OwJ2ugjkr4rrTIWp8gPVqZL9b 3JvPuQMpZg1BIIioTm9W3eXDU8HnpIRa16XpZvVmTFqeOgifsmJkGpn/4bubqTrHlTOy yHS1A/vUb7O61/Y0AVM7cqV6WgSsPhmoSwCM6V0dyOyE/Dn8/UR8I5PaqPtKtROJJ1VA 2FlPx/eMU3FUbZ2dha4wqWINW/bP7WLB7316K/G2LmFc8L1wsowJ6ZabFNgxK/3ErzXP 1etF3huG+qhSDLuHzZB370hNzdtcSGAE3Qlj93WJLXjPzOoL6CzLjPJKiBUdQAjCDw7w HVJg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Gif+MmWn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 h8-20020a170902704800b001713df0c8b2si24171267plt.213.2022.10.22.01.33.21; Sat, 22 Oct 2022 01:33: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=Gif+MmWn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S233589AbiJVISp (ORCPT + 99 others); Sat, 22 Oct 2022 04:18:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48810 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234083AbiJVIQJ (ORCPT ); Sat, 22 Oct 2022 04:16: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 885C486F9D; Sat, 22 Oct 2022 00:57: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 8CDFA60B45; Sat, 22 Oct 2022 07:56:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 92BAFC433C1; Sat, 22 Oct 2022 07:56:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425414; bh=ugBjsepRYvYP6ewZJtg3S2+9ioUPke2+iMbvqyO+qVE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Gif+MmWnRT7y9o2TolKo727PcTka27O5Ar/J7LFyjYtahEZ7BD0/AdW+xPqDfAUjD 6LXK5J4eZWMUcRqpYHHLo8qV0wS81noSxsPaVDKibW4s6TLt6Fin7+dsFY6GjJe47f /xWcUj8VMGv6OV1Cdg8LqGcfTsrZQYp8S86oc4RE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Adam Skladowski , Iskren Chernev , Bjorn Andersson , Sasha Levin Subject: [PATCH 5.19 463/717] clk: qcom: gcc-sm6115: Override default Alpha PLL regs Date: Sat, 22 Oct 2022 09:25:42 +0200 Message-Id: <20221022072518.779391675@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376004810264654?= X-GMAIL-MSGID: =?utf-8?q?1747376004810264654?= From: Adam Skladowski [ Upstream commit 068a0605ef5a6b430e7278c169bfcd25b680b28f ] The DEFAULT and BRAMMO PLL offsets are non-standard in downstream, but currently only BRAMMO ones are overridden. Override DEFAULT ones too. A very similar thing is happening in gcc-qcm2290 driver. Fixes: cbe63bfdc54f ("clk: qcom: Add Global Clock controller (GCC) driver for SM6115") Signed-off-by: Adam Skladowski Signed-off-by: Iskren Chernev Signed-off-by: Bjorn Andersson Link: https://lore.kernel.org/r/20220830075620.974009-2-iskren.chernev@gmail.com Signed-off-by: Sasha Levin --- drivers/clk/qcom/gcc-sm6115.c | 46 +++++++++++++++++++++++------------ 1 file changed, 30 insertions(+), 16 deletions(-) diff --git a/drivers/clk/qcom/gcc-sm6115.c b/drivers/clk/qcom/gcc-sm6115.c index 68fe9f6f0d2f..e24a977c2580 100644 --- a/drivers/clk/qcom/gcc-sm6115.c +++ b/drivers/clk/qcom/gcc-sm6115.c @@ -53,11 +53,25 @@ static struct pll_vco gpll10_vco[] = { { 750000000, 1500000000, 1 }, }; +static const u8 clk_alpha_pll_regs_offset[][PLL_OFF_MAX_REGS] = { + [CLK_ALPHA_PLL_TYPE_DEFAULT] = { + [PLL_OFF_L_VAL] = 0x04, + [PLL_OFF_ALPHA_VAL] = 0x08, + [PLL_OFF_ALPHA_VAL_U] = 0x0c, + [PLL_OFF_TEST_CTL] = 0x10, + [PLL_OFF_TEST_CTL_U] = 0x14, + [PLL_OFF_USER_CTL] = 0x18, + [PLL_OFF_USER_CTL_U] = 0x1c, + [PLL_OFF_CONFIG_CTL] = 0x20, + [PLL_OFF_STATUS] = 0x24, + }, +}; + static struct clk_alpha_pll gpll0 = { .offset = 0x0, .vco_table = default_vco, .num_vco = ARRAY_SIZE(default_vco), - .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_DEFAULT], + .regs = clk_alpha_pll_regs_offset[CLK_ALPHA_PLL_TYPE_DEFAULT], .clkr = { .enable_reg = 0x79000, .enable_mask = BIT(0), @@ -83,7 +97,7 @@ static struct clk_alpha_pll_postdiv gpll0_out_aux2 = { .post_div_table = post_div_table_gpll0_out_aux2, .num_post_div = ARRAY_SIZE(post_div_table_gpll0_out_aux2), .width = 4, - .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_DEFAULT], + .regs = clk_alpha_pll_regs_offset[CLK_ALPHA_PLL_TYPE_DEFAULT], .clkr.hw.init = &(struct clk_init_data){ .name = "gpll0_out_aux2", .parent_hws = (const struct clk_hw *[]){ &gpll0.clkr.hw }, @@ -115,7 +129,7 @@ static struct clk_alpha_pll_postdiv gpll0_out_main = { .post_div_table = post_div_table_gpll0_out_main, .num_post_div = ARRAY_SIZE(post_div_table_gpll0_out_main), .width = 4, - .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_DEFAULT], + .regs = clk_alpha_pll_regs_offset[CLK_ALPHA_PLL_TYPE_DEFAULT], .clkr.hw.init = &(struct clk_init_data){ .name = "gpll0_out_main", .parent_hws = (const struct clk_hw *[]){ &gpll0.clkr.hw }, @@ -137,7 +151,7 @@ static struct clk_alpha_pll gpll10 = { .offset = 0xa000, .vco_table = gpll10_vco, .num_vco = ARRAY_SIZE(gpll10_vco), - .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_DEFAULT], + .regs = clk_alpha_pll_regs_offset[CLK_ALPHA_PLL_TYPE_DEFAULT], .clkr = { .enable_reg = 0x79000, .enable_mask = BIT(10), @@ -163,7 +177,7 @@ static struct clk_alpha_pll_postdiv gpll10_out_main = { .post_div_table = post_div_table_gpll10_out_main, .num_post_div = ARRAY_SIZE(post_div_table_gpll10_out_main), .width = 4, - .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_DEFAULT], + .regs = clk_alpha_pll_regs_offset[CLK_ALPHA_PLL_TYPE_DEFAULT], .clkr.hw.init = &(struct clk_init_data){ .name = "gpll10_out_main", .parent_hws = (const struct clk_hw *[]){ &gpll10.clkr.hw }, @@ -189,7 +203,7 @@ static struct clk_alpha_pll gpll11 = { .vco_table = default_vco, .num_vco = ARRAY_SIZE(default_vco), .flags = SUPPORTS_DYNAMIC_UPDATE, - .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_DEFAULT], + .regs = clk_alpha_pll_regs_offset[CLK_ALPHA_PLL_TYPE_DEFAULT], .clkr = { .enable_reg = 0x79000, .enable_mask = BIT(11), @@ -215,7 +229,7 @@ static struct clk_alpha_pll_postdiv gpll11_out_main = { .post_div_table = post_div_table_gpll11_out_main, .num_post_div = ARRAY_SIZE(post_div_table_gpll11_out_main), .width = 4, - .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_DEFAULT], + .regs = clk_alpha_pll_regs_offset[CLK_ALPHA_PLL_TYPE_DEFAULT], .clkr.hw.init = &(struct clk_init_data){ .name = "gpll11_out_main", .parent_hws = (const struct clk_hw *[]){ &gpll11.clkr.hw }, @@ -229,7 +243,7 @@ static struct clk_alpha_pll gpll3 = { .offset = 0x3000, .vco_table = default_vco, .num_vco = ARRAY_SIZE(default_vco), - .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_DEFAULT], + .regs = clk_alpha_pll_regs_offset[CLK_ALPHA_PLL_TYPE_DEFAULT], .clkr = { .enable_reg = 0x79000, .enable_mask = BIT(3), @@ -248,7 +262,7 @@ static struct clk_alpha_pll gpll4 = { .offset = 0x4000, .vco_table = default_vco, .num_vco = ARRAY_SIZE(default_vco), - .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_DEFAULT], + .regs = clk_alpha_pll_regs_offset[CLK_ALPHA_PLL_TYPE_DEFAULT], .clkr = { .enable_reg = 0x79000, .enable_mask = BIT(4), @@ -274,7 +288,7 @@ static struct clk_alpha_pll_postdiv gpll4_out_main = { .post_div_table = post_div_table_gpll4_out_main, .num_post_div = ARRAY_SIZE(post_div_table_gpll4_out_main), .width = 4, - .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_DEFAULT], + .regs = clk_alpha_pll_regs_offset[CLK_ALPHA_PLL_TYPE_DEFAULT], .clkr.hw.init = &(struct clk_init_data){ .name = "gpll4_out_main", .parent_hws = (const struct clk_hw *[]){ &gpll4.clkr.hw }, @@ -287,7 +301,7 @@ static struct clk_alpha_pll gpll6 = { .offset = 0x6000, .vco_table = default_vco, .num_vco = ARRAY_SIZE(default_vco), - .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_DEFAULT], + .regs = clk_alpha_pll_regs_offset[CLK_ALPHA_PLL_TYPE_DEFAULT], .clkr = { .enable_reg = 0x79000, .enable_mask = BIT(6), @@ -313,7 +327,7 @@ static struct clk_alpha_pll_postdiv gpll6_out_main = { .post_div_table = post_div_table_gpll6_out_main, .num_post_div = ARRAY_SIZE(post_div_table_gpll6_out_main), .width = 4, - .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_DEFAULT], + .regs = clk_alpha_pll_regs_offset[CLK_ALPHA_PLL_TYPE_DEFAULT], .clkr.hw.init = &(struct clk_init_data){ .name = "gpll6_out_main", .parent_hws = (const struct clk_hw *[]){ &gpll6.clkr.hw }, @@ -326,7 +340,7 @@ static struct clk_alpha_pll gpll7 = { .offset = 0x7000, .vco_table = default_vco, .num_vco = ARRAY_SIZE(default_vco), - .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_DEFAULT], + .regs = clk_alpha_pll_regs_offset[CLK_ALPHA_PLL_TYPE_DEFAULT], .clkr = { .enable_reg = 0x79000, .enable_mask = BIT(7), @@ -352,7 +366,7 @@ static struct clk_alpha_pll_postdiv gpll7_out_main = { .post_div_table = post_div_table_gpll7_out_main, .num_post_div = ARRAY_SIZE(post_div_table_gpll7_out_main), .width = 4, - .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_DEFAULT], + .regs = clk_alpha_pll_regs_offset[CLK_ALPHA_PLL_TYPE_DEFAULT], .clkr.hw.init = &(struct clk_init_data){ .name = "gpll7_out_main", .parent_hws = (const struct clk_hw *[]){ &gpll7.clkr.hw }, @@ -380,7 +394,7 @@ static struct clk_alpha_pll gpll8 = { .offset = 0x8000, .vco_table = default_vco, .num_vco = ARRAY_SIZE(default_vco), - .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_DEFAULT], + .regs = clk_alpha_pll_regs_offset[CLK_ALPHA_PLL_TYPE_DEFAULT], .flags = SUPPORTS_DYNAMIC_UPDATE, .clkr = { .enable_reg = 0x79000, @@ -407,7 +421,7 @@ static struct clk_alpha_pll_postdiv gpll8_out_main = { .post_div_table = post_div_table_gpll8_out_main, .num_post_div = ARRAY_SIZE(post_div_table_gpll8_out_main), .width = 4, - .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_DEFAULT], + .regs = clk_alpha_pll_regs_offset[CLK_ALPHA_PLL_TYPE_DEFAULT], .clkr.hw.init = &(struct clk_init_data){ .name = "gpll8_out_main", .parent_hws = (const struct clk_hw *[]){ &gpll8.clkr.hw }, From patchwork Sat Oct 22 07:25: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: 7512 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1105041wrr; Sat, 22 Oct 2022 01:33:58 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4VEoL1jV25oaBCSKburMRoi9uwqJQItru2Fgyb3EZMDzt1jCzPM8SA64riU0c3vegMxusI X-Received: by 2002:a17:903:2284:b0:178:349b:d21b with SMTP id b4-20020a170903228400b00178349bd21bmr23362469plh.49.1666427638584; Sat, 22 Oct 2022 01:33:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666427638; cv=none; d=google.com; s=arc-20160816; b=oxZ5LVFheAY+GSH4gs0093doZSEd/Yfg/Praxxg9fMEzlG3i9sicMcfyCN0RUkRhpr wvq9mRJqHPRr87isRuEA2Z1VXYAfNuoS7jBSYrE/INWRj2LBLmZN7oUdGdRNvyRs8R1D 20cdd6z197iRj14CzhcfiJlVw7MgF0vwRDdFIduZi74IESUQVwE7Iv+DLCpLO7PGKPae 02RZfL1j40eWL5fNBlR8egTt9rkaqBCrwh0I8Zgt0jRK5EwhpawVLs3jhjRjgSXCkRCT ykN1iC9LxwOEoikBWdW0RA1cGtQ1isKz2ws10+fT80oRwLXq8u5lfton7qDKZx3ufxDJ 1I4Q== 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=R+b2huPMsaMi5FgkgPUWChaHItGkkPxr9G8EYuakqs4=; b=eqRHGE2Cqz6PSXtOD/3GdOmL2plKj2URR0zz8UbmA8+Mrk/SSI2Es9+GK1CbafveRE HJee8L23zGM31ytG2sL5Bx6yqcsGBH/BRLz4CLki7zJSqQmnimrBT95GzhlF/GekMr46 zhvRF6Uq8q+4iNV+j1Nsnytn1nicBuciRdR3QZJv6+0sjOzpwte1ow6KK6Mo43ZsTOiK drpQLb53EOJ5hAw2qJmMpiwf9xmSmOqEYjbaVLd60/Ta29phWfS9JM475RM4pUV2dJiV PgFBmBwsGtyak012po83jct8WoRtTnmEhj6f2yS43UGM6BhuYxdH2O7QHg72l9aapaXD 5r3Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=taKgWB6h; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 p4-20020a637f44000000b0046b3ba2c806si22487564pgn.145.2022.10.22.01.33.42; Sat, 22 Oct 2022 01:33: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=taKgWB6h; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S233697AbiJVIUp (ORCPT + 99 others); Sat, 22 Oct 2022 04:20:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58232 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233723AbiJVITN (ORCPT ); Sat, 22 Oct 2022 04:19: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 99FD82DF448; Sat, 22 Oct 2022 00:58: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 2B633B80E4D; Sat, 22 Oct 2022 07:56:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8BD3CC433B5; Sat, 22 Oct 2022 07:56:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425416; bh=tv9L0ATtm/g+3f1svrh0qKf6P+ZJy0hTBvk3G0cON/Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=taKgWB6he3HAjDBNzYi/l2yOdLSnNbrZi/Vcnw09X9OHZu5A+wsD12abKq8ULI2wN 9VHLqzHngDQKgRIfKod+I2f2J+NnSK2IwxsvGG0qNYSCLtzxU5dC27d67kVTok3hQd tUJz+2HbBCHZsb+5qnaNHBhG9IkG+vzilTm/4sqE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Bob Pearson , Li Zhijian , Jason Gunthorpe , Sasha Levin Subject: [PATCH 5.19 464/717] RDMA/rxe: Fix resize_finish() in rxe_queue.c Date: Sat, 22 Oct 2022 09:25:43 +0200 Message-Id: <20221022072518.828870179@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376027671324929?= X-GMAIL-MSGID: =?utf-8?q?1747376027671324929?= From: Bob Pearson [ Upstream commit fda5d0cf8aef12f0a4f714a96a4b2fce039a3e55 ] Currently in resize_finish() in rxe_queue.c there is a loop which copies the entries in the original queue into a newly allocated queue. The termination logic for this loop is incorrect. The call to queue_next_index() updates cons but has no effect on whether the queue is empty. So if the queue starts out empty nothing is copied but if it is not then the loop will run forever. This patch changes the loop to compare the value of cons to the original producer index. Fixes: ae6e843fe08d0 ("RDMA/rxe: Add memory barriers to kernel queues") Link: https://lore.kernel.org/r/20220825221446.6512-1-rpearsonhpe@gmail.com Signed-off-by: Bob Pearson Reviewed-by: Li Zhijian Signed-off-by: Jason Gunthorpe Signed-off-by: Sasha Levin --- drivers/infiniband/sw/rxe/rxe_queue.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/drivers/infiniband/sw/rxe/rxe_queue.c b/drivers/infiniband/sw/rxe/rxe_queue.c index dbd4971039c0..d6dbf5a0058d 100644 --- a/drivers/infiniband/sw/rxe/rxe_queue.c +++ b/drivers/infiniband/sw/rxe/rxe_queue.c @@ -112,23 +112,25 @@ static int resize_finish(struct rxe_queue *q, struct rxe_queue *new_q, unsigned int num_elem) { enum queue_type type = q->type; + u32 new_prod; u32 prod; u32 cons; if (!queue_empty(q, q->type) && (num_elem < queue_count(q, type))) return -EINVAL; - prod = queue_get_producer(new_q, type); + new_prod = queue_get_producer(new_q, type); + prod = queue_get_producer(q, type); cons = queue_get_consumer(q, type); - while (!queue_empty(q, type)) { - memcpy(queue_addr_from_index(new_q, prod), + while ((prod - cons) & q->index_mask) { + memcpy(queue_addr_from_index(new_q, new_prod), queue_addr_from_index(q, cons), new_q->elem_size); - prod = queue_next_index(new_q, prod); + new_prod = queue_next_index(new_q, new_prod); cons = queue_next_index(q, cons); } - new_q->buf->producer_index = prod; + new_q->buf->producer_index = new_prod; q->buf->consumer_index = cons; /* update private index copies */ From patchwork Sat Oct 22 07:25: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: 7633 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1107551wrr; Sat, 22 Oct 2022 01:41:15 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6Q2KrGQ5oR4vAdpYiVx1mN0CzzHKczqR1WYD/GsQvehDXD5eybyQ5vu02/QpohJgBXF7nd X-Received: by 2002:a17:907:2e19:b0:78e:11cc:3bc5 with SMTP id ig25-20020a1709072e1900b0078e11cc3bc5mr19259856ejc.543.1666428074836; Sat, 22 Oct 2022 01:41:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666428074; cv=none; d=google.com; s=arc-20160816; b=F7uzoHve44ILTyvEraiRKfG9l/bBm7kfnxPIySpFDy7h1PuinnBxS8+MTjvqTi3mJU s3DLn17bv2vTJwy5qSYGG6wNVH1xE5rRPyOXlfvXTe3kEprCSlR7gHeBzbubXDfeYlhP 4eBuHCm6Bx3hG56w9/yMP6V+8LuyzMgzYgo+UaFKHItDi2qMg68C+YKxywuNa3f/vy4b atOjg8DHWsYbvKKWBfbPlMrtSvjKjwjG38/fE6U+iUTvr5pwt/ENA64jb6GwRgpnXd0a EJ6+xtboSASSFyrpfn80R7S1DHSdVJxTTEXssC4EFlwgTrsaBWlwJnufTEfMMkQjFo4m BXkw== 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=2gns+FEdS4MRDGVMHTHPbHNp/HxSEF7fIZwKgvc6t3o=; b=jik/nOUN/bT0JQv2VScz/bEcrcgWNKAUzNnMRyoiD56d2vYWVCiftTuTQoF3vnW9eY nszfgZCqDIxuJlDT8ehui0hgZB/ib3T3irWb7Y+c07Zk6w1m7PbJFiRj+yv3Vl9vAPrp +nAHSdMcbYornuXTbJZpuV/mwmUSXNJ9r+mZM7+eh1wCHV7nnSHflnYE7CoxiAquDiY0 lLs1+WcWp6gdQ5ZErXGZvJ0bgut2WMdERrca36Syo4P7xJngpmmknDem+Arbo2CkYB5+ fDeDoH9r1prNNufCnSUuxN2GffdUXPbjzm0qcUqtnJXnBLl+sQccV0N2065hEFIEtPpV QPaA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="t3oemX1/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 dp19-20020a170906c15300b0078c47b4478esi20810162ejc.106.2022.10.22.01.40.46; Sat, 22 Oct 2022 01: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="t3oemX1/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S234477AbiJVIi3 (ORCPT + 99 others); Sat, 22 Oct 2022 04:38:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58716 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234108AbiJVIdu (ORCPT ); Sat, 22 Oct 2022 04:33:50 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0C8592E7150; Sat, 22 Oct 2022 01: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 39EBF60B80; Sat, 22 Oct 2022 07:55:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 467E0C433D6; Sat, 22 Oct 2022 07:55:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425326; bh=1OAwvSabGh6LnKItuicwtRw9I08Q/Qc3Yz5P8kejiIA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=t3oemX1/VzxFe+9RlpVQFHXG4pKlCxr6XFYZ37lOUDf1gy2hcmuJxxYb46RP9uhcD ylaIqYQu/ELXvh/e8XGweFXJnN/0jF4VHMo89A1SX0PdbOuV2gwvs7qo7BMOcsSO8u zZX7Vii/Vd8hIlQ2nRkaECAS3F6quhUOstmE7ses= 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 5.19 465/717] fsi: core: Check error number after calling ida_simple_get Date: Sat, 22 Oct 2022 09:25:44 +0200 Message-Id: <20221022072518.876493488@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376484705099857?= X-GMAIL-MSGID: =?utf-8?q?1747376484705099857?= 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 3a7b78e36701..5858e6339a10 100644 --- a/drivers/fsi/fsi-core.c +++ b/drivers/fsi/fsi-core.c @@ -1314,6 +1314,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); master->dev.class = &fsi_master_class; From patchwork Sat Oct 22 07:25: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: 7840 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1153139wrr; Sat, 22 Oct 2022 04:04:51 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6Ema2Met0y8TJchZT1iu9cBZTUAcmw2ef5jc67kyvcy4WHOYRDuFrYSFnpMv06gb3LyRm9 X-Received: by 2002:a17:906:fe04:b0:777:b13d:30a6 with SMTP id wy4-20020a170906fe0400b00777b13d30a6mr19278796ejb.248.1666436691156; Sat, 22 Oct 2022 04:04:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666436691; cv=none; d=google.com; s=arc-20160816; b=agkiZ/JFRBqDOWXFPQx8bm6ZlIS3i2puR5YfFy5yQsIcFLmk/OGGJdYmZZvTtvz+7B iPmYSB0EyMB7VbCtvXwsE64c67hazE7Rk8mq1Phjz2Ha9boxBK9B/TQEn69jAFHBQQ6a ETuTnKjz8x/RYkNSA60zqpXyxGYzQLze1vyzNqeGmDkZV0GQX3DXGtG2tfGNi1ObJsAY JNrcE7sHFmMQ0aLtYaymSuaGkwKuIxnzEJcqiITk8j4wUH1cl10qnfqPwnh9TM/+PBWQ G7h4UwXmjznXsI/tqyKeE3bizaZSynuLJlaxm24OPrwG5xzgp1FnfKLLpM0xryVsXLZP iZoA== 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=DaTEd/xT6UTzO3OgvZc60DTCtjxGPPhX+9N6vYoS20k=; b=nq0cYj264+eW7CnXOx8S831x9Fj9UbGW5Z4PYorXDAL613+xBkzGeibanfi3Pon8gt HyvKw8NTjKbGn0IP4m6agTwnnhHFsxmZxyvNpSXtxGNFcYv0KGvRgxYnDfU5E8p9BhgN uBTBBLLRURjzluBEkcNfW2hot49J8JSHK0bLvNtCcyPIFeFDX3bmyNIy4i0xLqvDsOlG vO2a/QhpfRtsHqvdi5V+iXZtAZGsC+s8L+DeKnRMEP3Rt2x/nl2PdZxZmk0Hph3QyT2e n33IGbQWmZ5OxcjTa1v7a2Cljoau5vTsuW30/+M/5LeJC5lSiYJGnmrdw3UD/u6dvW8C 31Pg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="qi//daVm"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 j20-20020a1709066dd400b0078d9b2facaesi20019447ejt.339.2022.10.22.04.04.18; Sat, 22 Oct 2022 04:04: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="qi//daVm"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S230075AbiJVK6x (ORCPT + 99 others); Sat, 22 Oct 2022 06:58:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47560 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230060AbiJVK6d (ORCPT ); Sat, 22 Oct 2022 06:58:33 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5517072291; Sat, 22 Oct 2022 03:17: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 40F98B82E2B; Sat, 22 Oct 2022 07:55:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3FE4AC43470; Sat, 22 Oct 2022 07:55:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425329; bh=TOSu46mciuE/L6gJio2Q140JlgyZxiLGuzWYQlMx65Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qi//daVm1AIkIkt0QJnPGef7yb1ioLl2SoMfPdbboftKN8mqfiPAO+cWOoEIsT0g4 cyA7qcAArguFmI4l/TE9WXGTVLRDg5pD56j0SjgxjFxdYjae6e0e+J0Dn7J/PHHkxx 4y5gIgNGA9BqE2biG6ihrTA3Qd13P7y2n9YBonoU= 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 5.19 466/717] mfd: intel_soc_pmic: Fix an error handling path in intel_soc_pmic_i2c_probe() Date: Sat, 22 Oct 2022 09:25:45 +0200 Message-Id: <20221022072518.916284151@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 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?1747385519894351655?= X-GMAIL-MSGID: =?utf-8?q?1747385519894351655?= 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 5e8c94e008ed..85d070bce0e2 100644 --- a/drivers/mfd/intel_soc_pmic_core.c +++ b/drivers/mfd/intel_soc_pmic_core.c @@ -77,6 +77,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 Sat Oct 22 07:25: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: 7628 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1107512wrr; Sat, 22 Oct 2022 01:41:08 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7HaWus1M+X7GVmY4r2s7m9HJPh+fKTuTbO8tOEhxYZLNFxLqPbMlIxITNRqeBoTkZSx5XL X-Received: by 2002:a17:906:9bc5:b0:7a2:8b6a:c4f8 with SMTP id de5-20020a1709069bc500b007a28b6ac4f8mr275356ejc.411.1666428067970; Sat, 22 Oct 2022 01:41:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666428067; cv=none; d=google.com; s=arc-20160816; b=Nd/b3LrfmjwbbtcDBxUq14V4Eold+vf8akquogeJPxIooEW37KLewcNVSlb/fZ+BgU k7OX6MzUJNUIJcHvUA+b7k54BHO+xc+s7oL+xYMQxq8Lvd0DX7kI8s3bgTI7a5khWJSO X7vAif7DT7iRhRWVcMxNTxoui8QNnwSXtLyH7+At6fWv0Ujw/9T4UHMzRn8Z8UcLoFxJ frCtq0ddrx5KV+hDdgMn6mAhKDSJshRujQ3a1pY8T/FTG5E3rr1WMKNK2qkR3fogXnNf gbwF0DgXVqQ3kEuRR51V9iuntjlwroNudDQxZtDd2LDT8ynag6JoY4OLcYVKbqB+Z5hL n8aw== 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=XTIhGMgQ0F1wWDDTAASWJeNHYYCpzlxmNaVF2yvzPXo=; b=qQFGqS1p6ED3NQvNjLe59uv5C112/8/JmJICJBRcHSA0DnlGJfkKNe85ur7zTkVhX7 c1pStVlfu8iBvy6nI2sNF2YHtzhkrx98EWRW+cuY/A45/YpsKtQqPKK8a1z8c0olVXOZ El42Xvh0nHwlFNil13yXN4k7Im5Zkq0sVyrhTq/Ao7aujg1lz7erbgnZ+bdxK46kig6P NCpPZ2QEdF+GuLvtPR+MAW/e+IrAAZrBftEeFQvA30p4tpqr7FqdaOQ9PTaIA8gKCmei HbrzxQGjaC6RzAJUOpPuHjZbjHVI0cfy0VpwuoYmxgq/Rd6bk/V1b+q4pLu5/Khycrdz dfKw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=sP8xXZwr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 s11-20020a056402520b00b0045db2dcff0esi15659333edd.594.2022.10.22.01.40.39; Sat, 22 Oct 2022 01:41: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=sP8xXZwr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S234089AbiJVIiT (ORCPT + 99 others); Sat, 22 Oct 2022 04:38:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59710 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234073AbiJVIdE (ORCPT ); Sat, 22 Oct 2022 04:33:04 -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 BD1D22E5E2F; Sat, 22 Oct 2022 01:03: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 C292260B90; Sat, 22 Oct 2022 07:55:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 82CEEC433C1; Sat, 22 Oct 2022 07:55:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425333; bh=7rNgIZ8t7ZwPJgpss76pj0gV2+cw0OBlIpaZoHxPsnE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sP8xXZwr/dshBvljj74GOvpoZBq9L1K4Uj8Y5ewQ+w3sF68DLDQHy4vZ/SqP4dSii AIEs0lgi2eu0eoQq+txduc2Mf1Kz+Kp2MJqMpekTX1xG3wkbDtsezYInecPGPrRXfT cv9N8que5rqpDSTQQ7YXUnvVqRLgvzRydhWY1vYQ= 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 5.19 467/717] mfd: fsl-imx25: Fix an error handling path in mx25_tsadc_setup_irq() Date: Sat, 22 Oct 2022 09:25:46 +0200 Message-Id: <20221022072518.964308156@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376478086467690?= X-GMAIL-MSGID: =?utf-8?q?1747376478086467690?= 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 37e5e02a1d05..85f7982d26d2 100644 --- a/drivers/mfd/fsl-imx25-tsadc.c +++ b/drivers/mfd/fsl-imx25-tsadc.c @@ -84,6 +84,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) { @@ -171,18 +184,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 Sat Oct 22 07:25: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: 7541 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1105879wrr; Sat, 22 Oct 2022 01:36:26 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4O4//eR4RwIq/jew2NVjV+95xQl6QO6buB1Vxku0SZiKIM0ZEiMWdJJyLlMzfeL45iUC0d X-Received: by 2002:a17:902:f651:b0:184:6925:d127 with SMTP id m17-20020a170902f65100b001846925d127mr23015515plg.140.1666427785733; Sat, 22 Oct 2022 01:36:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666427785; cv=none; d=google.com; s=arc-20160816; b=X09MYOd0lDfSyfvmxnof/k8A/b+FTFmxNW7I+TDEL+c2dn1fW/RJW2uDNzlRWPTUHO XRx2RwzGzVHyF4WhfHaudjPh+PG1A9N+mpDZ2w+Zpjs9gryvl+u4M9kactQRYlMZJypn XqwzZLsHS2T0JfmIfWBtb/VbKUFovWfukzO7vQmV77CO/Abt1MMrb21uTNc+6zxIPkMy pQk6EdfUKvUVJNY6lW4v3/puB9x1CP8YVOPxgP59iy+Vdh1QA1Nw02N9UmEH3I+SPL6l 7OkPTiImhJ/UiFk4nwbqMwUr32CwRIZMljxLmLQ3gH2rt37FCU9odOFJPiN9pXq7wOvM Irnw== 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=/yB1Ibw3wCLACPtCe4w/w4R9JkSResqOfKHH1PCnfio=; b=edUAlRvTC4clidHXLo0mauKZ3oNw37IAvLxQi3QM55egi/zlv2I9EBzoYAR4CpsNgT ZZql4H7VFDJSzurDhA906GihuDYe0Rw/eOYkX8PWG7QqhppamuupJYarvDR9Uw0XYO0W 6zmnNrFvmHkT/qajV2pKPAGCeIv5v9jbaLUCvc/wWVZR/Rm28vg2plbqG9gq1vABvU0R 9Lm0NCIr07SG3zjEYK2I4yluPv4HhMhrI3GCp5Tm8oGoIqHVeWpzIFzRaps3iU4qWlj4 cK59loiotDJ0HrhA3gRcOd3WTlyq6t02HUHnJZnIoSu9BIJtXJBU5wOyFTJRHdk249sn F0QA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=EoHdymRF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 mh10-20020a17090b4aca00b002088ad6d93fsi2448980pjb.49.2022.10.22.01.36.11; Sat, 22 Oct 2022 01:36: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=EoHdymRF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S230167AbiJVIR0 (ORCPT + 99 others); Sat, 22 Oct 2022 04:17:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50254 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233944AbiJVIPk (ORCPT ); Sat, 22 Oct 2022 04:15:40 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5B50D2DA754; Sat, 22 Oct 2022 00:56: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 dfw.source.kernel.org (Postfix) with ESMTPS id AA2B160B45; Sat, 22 Oct 2022 07:55:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C13D1C433C1; Sat, 22 Oct 2022 07:55:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425336; bh=WXxZPIWiyubGD4UyoxgS6nPk1TseZmuCXaYHcZUh6f4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EoHdymRFmHfWi4gLAQnFr7RxPu4FZ5CWRCj5kjOjniDq/k6z7dDA9xWDKEgt8C6Ir lBgWxNKA14eQqezpZQLbJwb46rGryQBTjeJ+4qf7E3+h/b5Aooux5sqkQ9rpUw3n+G wDZ7iEdU1iIkhowJeOC48DhdZS5ZapXHdj6H07uk= 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 5.19 468/717] mfd: lp8788: Fix an error handling path in lp8788_probe() Date: Sat, 22 Oct 2022 09:25:47 +0200 Message-Id: <20221022072519.006232101@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376181462946578?= X-GMAIL-MSGID: =?utf-8?q?1747376181462946578?= 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 c223d2c6a363..998e8cc408a0 100644 --- a/drivers/mfd/lp8788.c +++ b/drivers/mfd/lp8788.c @@ -195,8 +195,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 Sat Oct 22 07:25: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: 7555 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1105905wrr; Sat, 22 Oct 2022 01:36:29 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4V1bKS2ykugA8/3PeTCzXiY2+/F/wJeKrRQcD52W5GEz+dujT3QRR/LpymGNH0K4xdT0dZ X-Received: by 2002:a17:902:aa42:b0:17e:b779:dadb with SMTP id c2-20020a170902aa4200b0017eb779dadbmr23836514plr.11.1666427788968; Sat, 22 Oct 2022 01:36:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666427788; cv=none; d=google.com; s=arc-20160816; b=ppLVrUlDInxjAW4vjUHY9pN/5wnqlUKbTkIdoP3r7t/BYjDsfjYU3fwB0NRbOEU8H3 mg2Xhp+6//6JtPEQc5Yv7Ka3XkL20XCblibbdGiCzU6K7HPrfhlADdJlYbg5ZFvUe9le WljTUEiprtKRbX+1uXj2OPQ3pI/wjobrJOZf5nDnME6xap9owk+Jx9STQ2kwDbRpRb8E tZrGFYUiNsjc56A8ZDm/79pIDiB1QMq1QrtgdPm+gk02lmNW6Xw1hIXlk5cu3X7wjM9J pTkiwHoR/SILPP8+6wYCtszOK4FcSpN7rTbsP1h1eC/1GCvil36U6wCRhZLouWRDbqOm ccOg== 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=zzon+syC4d/y8skF7+zvINdnuWToVbLqabMxD8RyuoU=; b=g3m1hXwNG2uFuVXB7IG4Uiw2jVQPaI95Y2LkOVdwMHwkjB8RhTLbME9OzGMq43aGPd g7xY8Z3h2iCOkkFoWcsNOYn5R2roBIVJx6gu1Befxkz7DK4UZMhpAvKpponQru8/luXO saAvqAvH6wpIJdqpxt+iqdua+Uwnjyg6Ixa9IBnprcWXwwGHYAZoHDfnQMOsHSpoMkUP 45t5TS1rTNpQ5j64VogYq0QRvFQniNBUoeB4nCOKpsknZ7lLV5DzmIH3wKc+zwV+xiED JB+cxx7cZcmfFxRvd7nFWiwRM6C18Qw69gEA6riw/CoP/YQij529+eifzXwoaAZDPby+ QxLA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=uewJ3Wn7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 il15-20020a17090b164f00b0020579d99c4dsi10639199pjb.138.2022.10.22.01.36.14; Sat, 22 Oct 2022 01:36: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=uewJ3Wn7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S233642AbiJVIUd (ORCPT + 99 others); Sat, 22 Oct 2022 04:20:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54582 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233696AbiJVITI (ORCPT ); Sat, 22 Oct 2022 04: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 CBDC02DE445; Sat, 22 Oct 2022 00:58: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 7430160B94; Sat, 22 Oct 2022 07:55:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8AB68C433D6; Sat, 22 Oct 2022 07:55:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425338; bh=Ku35vuD17YGpq0QHl+DAKe80YrZ/0TpL18rzyvhTdJ0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uewJ3Wn7SgpKex6/qBaepTZCYeM5dR4gfk1vQvflcZnmjOThCfA5ikinQ0pbskQdV OCbl2171FNyTqwDfb+lox9FeAoSHK3NazMDwfH069fSUjI3WaFLZTSbhbHYPJaRFzJ mT0WNGJiFJTKu36uAwJv0+30vooqA6UCW/MBEaoE= 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 5.19 469/717] mfd: lp8788: Fix an error handling path in lp8788_irq_init() and lp8788_irq_init() Date: Sat, 22 Oct 2022 09:25:48 +0200 Message-Id: <20221022072519.057578490@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376185536387610?= X-GMAIL-MSGID: =?utf-8?q?1747376185536387610?= 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 348439a3fbbd..39006297f3d2 100644 --- a/drivers/mfd/lp8788-irq.c +++ b/drivers/mfd/lp8788-irq.c @@ -175,6 +175,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; } @@ -188,4 +189,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 Sat Oct 22 07:25: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: 7515 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1105089wrr; Sat, 22 Oct 2022 01:34:05 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6svXQRPluk+q6fQFZJazM6PZuyNGrOneosFrHqAu1GTHlNaUmLJBp+qwRSF2mOs7tbRjay X-Received: by 2002:a17:90a:54:b0:212:eb01:1ce with SMTP id 20-20020a17090a005400b00212eb0101cemr945893pjb.236.1666427645582; Sat, 22 Oct 2022 01:34:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666427645; cv=none; d=google.com; s=arc-20160816; b=NFMRuTxv1WTY6Ubcyiqz6gnE18OGf08FKeHA1iJ2tQoVDTrKpUzEkq69Es0aN86B6d Z3/B0mFd4GPcHqVbm4kJUeQQx/ua1oxsBnWfloW1SHtshPPqMRWujK/1440nDy80SIXF 5tJg1xXcRkJHhESI9q5lh7JADz7K+BJH8adgLG5o8mJ7vek82fXfohq6mUWZn5OCyYck s9PeZ3HQw3pMBsKRzR2/GM8Mink2uk4K8QRC4RWBbbaJLVv3QoFPfOOzJjQMhoygH8Qh HZlUFFpNGBXO+/Odu48EmDUWUjKp2bfUAV7QmTZr9U9/41kvR+GcwxKwNtpeGYGPHM92 9RDQ== 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=0ATPCS8Y3WjRgGflB2uOFybiEyvctPzj/oV05yt+ARo=; b=D+kO9EsJ5fz6hjb5o7W6vr8EcYgOySpfw/COkewvTYNtgNkGxAPrP3VG8Og72ZkqHd LVKGcqzDQSdMcZk9cOUUTedJaV1mo2vR1pSW/AX4FG/z6Q4MDUjtQb1ySuoTVsEM+DiV sT0wp3vXyWbUs8eFiH18vNITWJNRviWYTCJjdr+Af1m8YtbILngyIj73sY9DUvA9Rp86 a4eEUCTCD/N/F8Dvxh9j2oQGc7iCu0yTtMtpYTaWXpx7Bm8u3Xs3V4of/oY+n8ibI0QY vtagVXthxih1tpXlSUm5gaRS2Yp/o8XVi32iSa7sGGPk6M8DNuy8zWpORsqM9+gu9H7H Jlqw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=SrFoW4Jd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 lk18-20020a17090b33d200b00209a3e49f63si2293654pjb.94.2022.10.22.01.33.47; Sat, 22 Oct 2022 01:34: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=SrFoW4Jd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S230012AbiJVISD (ORCPT + 99 others); Sat, 22 Oct 2022 04:18:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51590 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234019AbiJVIP4 (ORCPT ); Sat, 22 Oct 2022 04:15:56 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 73C54D6BB8; Sat, 22 Oct 2022 00:56: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 3FAB960B9A; Sat, 22 Oct 2022 07:55:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 553A9C433C1; Sat, 22 Oct 2022 07:55:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425341; bh=qWqlig6IlzpHHxfd14zNaM8RXMalHFwmu12oJV+HDCI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SrFoW4Jdl8k8BSJD3i9rs5Agt3Tp1z/IbnncKCVggjORPEv9te7IOua/wxHyLxQ0/ Lyijjxp7H9SH76FicCNJ3+EFX6F3rvRNxKYCrgjPIcjWlj//9sNKlD31ii2UYXqt00 lpJbpMX/bDU0vYiI4ZkNVFVcEuDYGIYl6wUP8AXg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dan Carpenter , Martin Kaiser , Lee Jones , Sasha Levin Subject: [PATCH 5.19 470/717] mfd: fsl-imx25: Fix check for platform_get_irq() errors Date: Sat, 22 Oct 2022 09:25:49 +0200 Message-Id: <20221022072519.112847638@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376034963072823?= X-GMAIL-MSGID: =?utf-8?q?1747376034963072823?= From: Dan Carpenter [ Upstream commit 75db7907355ca5e2ff606e9dd3e86b6c3a455fe2 ] The mx25_tsadc_remove() function assumes all non-zero returns are success but the platform_get_irq() function returns negative on error and positive non-zero values on success. It never returns zero, but if it did then treat that as a success. Fixes: 18f773937968 ("mfd: fsl-imx25: Clean up irq settings during removal") Signed-off-by: Dan Carpenter Reviewed-by: Martin Kaiser Signed-off-by: Lee Jones Link: https://lore.kernel.org/r/YvTfkbVQWYKMKS/t@kili Signed-off-by: Sasha Levin --- drivers/mfd/fsl-imx25-tsadc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/mfd/fsl-imx25-tsadc.c b/drivers/mfd/fsl-imx25-tsadc.c index 85f7982d26d2..823595bcc9b7 100644 --- a/drivers/mfd/fsl-imx25-tsadc.c +++ b/drivers/mfd/fsl-imx25-tsadc.c @@ -69,7 +69,7 @@ static int mx25_tsadc_setup_irq(struct platform_device *pdev, int irq; irq = platform_get_irq(pdev, 0); - if (irq <= 0) + if (irq < 0) return irq; tsadc->domain = irq_domain_add_simple(np, 2, 0, &mx25_tsadc_domain_ops, @@ -89,7 +89,7 @@ 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) { + if (irq >= 0) { irq_set_chained_handler_and_data(irq, NULL, NULL); irq_domain_remove(tsadc->domain); } From patchwork Sat Oct 22 07:25: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: 7491 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1104854wrr; Sat, 22 Oct 2022 01:33:31 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6xcBw3LpW70gIpwLC/wh0PNkcWzNd+6+Y3BNDvgmwCbKrVSZCy9yqLdr0KjqVPfdqRnybl X-Received: by 2002:a17:90b:3850:b0:20d:54f2:a780 with SMTP id nl16-20020a17090b385000b0020d54f2a780mr62461228pjb.115.1666427601350; Sat, 22 Oct 2022 01:33:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666427601; cv=none; d=google.com; s=arc-20160816; b=uSjxvqmJsCHQShNyvr2Z7qDrzQn307XJhWV+6qdCc+p1hnDRero5oSkRPzcQMHzJvm jEZcK1aNawnfkoz9ldYNTTNS5UMYNEoeI7fOBh9ncxF5cjd5/pExB3/q3mFQUB68u1Z1 CsiI2whrkeb/Z7jfL74GpCEaJZBhykTMJBO2jeQGrrjQOYZYNpjcHk3Lo0J2O0+HZD3E GLWIvgMyKV24IqLrAiaJ88tvTnH3K5qI1e9tURGrjxpF2C7UxkI2bh//dItpHhxOa6OY 9ivqhGtAFlD4dWlwk5G4pqiOIf4hOUYIssssu1IcC6h4eQRCZUY+XqWRDGUHx/lpIt75 lhkw== 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=hUbD7jYnkfK2RLtqHcB1eSo0ORYYYje42e/pQX0r7+0=; b=BXjW5f6qmJU64CMpBLAEsc/ir/nczrA0DSaCFJ2lafxVziGTnrEyWzUPe5d2slTu8u 2NYb8vi+NAg5UxObn5a3jk/IqTYL3D+Qjyce44kvxbitf/VC6wt4OKqMfU2v4M6rUrAA Hx20l7r13f24m75+Um3uFbGXv1UnwKK3d5gcFxta3xFYi8WIchDlnuSHLoa4FWtBm0EA 9SJmr5svDNvLKOzOOq++c4UD/cit+BId6odHi5hbR9gi++EFfmMXaMl0VCqnx8qmMLUJ qISxJyKMBOYkFg59VPkQc7NyBhUsQfxleazY57+ykv0V09BdrBIs63IQcZz0ALNcHLTp qahg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=nMxcUVRc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 n9-20020a170902f60900b0017f73e4af01si11738406plg.298.2022.10.22.01.33.05; Sat, 22 Oct 2022 01: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=nMxcUVRc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S233407AbiJVIQy (ORCPT + 99 others); Sat, 22 Oct 2022 04:16:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57592 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233688AbiJVIOv (ORCPT ); Sat, 22 Oct 2022 04:14: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 5F719290E1D; Sat, 22 Oct 2022 00:55: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 CB7F5B82DF2; Sat, 22 Oct 2022 07:55:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 32472C433D6; Sat, 22 Oct 2022 07:55:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425344; bh=/HIERa100lh8MOJ+VnEm9GMQEByn7+Vm+HFFy4N/aVA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nMxcUVRckV7hwBPYPE1F/9kS4ZlwYkEf5WRYgBQld3bJLftlQkLr63snN6mP9anSb f3fBX+zDuVyKCgbGEJvGsB5ECvQayt4IWBX17QOMg2p7442IvU+090zKvezEtafsuJ Sqttzz9s2myf8bhrwh0sIVBj59w6tP/Hg89jEY+g= 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 5.19 471/717] mfd: sm501: Add check for platform_driver_register() Date: Sat, 22 Oct 2022 09:25:50 +0200 Message-Id: <20221022072519.163507867@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747375988115128501?= X-GMAIL-MSGID: =?utf-8?q?1747375988115128501?= 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 bc0a2c38653e..3ac4508a6742 100644 --- a/drivers/mfd/sm501.c +++ b/drivers/mfd/sm501.c @@ -1720,7 +1720,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 Sat Oct 22 07:25: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: 7502 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1104927wrr; Sat, 22 Oct 2022 01:33:43 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4w03sVN1QoaCG3FdUUZiEuSGZMJLBGbrQHfrTsLfzSFCnu6/vM8cy8f0yFpg143OT40aiV X-Received: by 2002:a17:902:f60a:b0:186:5d06:8da4 with SMTP id n10-20020a170902f60a00b001865d068da4mr16413135plg.106.1666427623681; Sat, 22 Oct 2022 01:33:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666427623; cv=none; d=google.com; s=arc-20160816; b=Vwq2AQB7pgfEYodyEFbOoAy5ol7N8+L7NEK1YHUWZP4B7LiNb2mVhXuDp/GSDH2bYx bfSCR9QaCo8M3hEGHStfvtGS3u5LlTAx84eSY7yd6DKBjqQCLKNA4j5VvNF444uUek88 nVSfmRSdR+igvujQMGCDoCsX/oW+pjqR+xpHmTbsAFOMgsT+mzsjVbbxF3WKKfqXR9be GcWolze0mC7M/MgTNiOjs0GDL9MYYyjiTOdcOP9BH2ZVE21dzZT1SjP84/G5b8aMqvxs SEYdjFlnyuxLvHwsqFBrx89t5Ihr6C1uzbNRjvlnOHO0JX94ezQ6mT9YOjIblu00k8rH DyhQ== 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=6lTb0eKTiMxmfcHJM9/oa7dpHu3BOlegrHT8hcIg9yQ=; b=UAuL58kk6mMQxx3X3XMmrJP37wpSUuTzuOeEjadujXvfEDk0yKPKe9j+JBYGf4QX/o u6egF3F6ze5tvhPIzeMREORYbg8EKaEqdoJrdxVFiUDzB/gM98tuhl4TsvCci1Nl7rp4 VAmSF+f3h5yPwv/j8OuimY0Dg1sMwSLDTTd2BSi0p/C7Sv+IBQJOBUIHrV9cE7Q4AdJx 4QtUaY1ehIEr0DnRqYKEP93Fd9teDATs3hrT5u2SEtdBPedpgP7KbuxBRR9o/+M/Alj4 D4yfNJQfbDmGiN59Wks7Zx/A3RBwifJIAbDivKVX3hRnbBlPw0J9Q+vGtfhldXjc8Ul3 nMuQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=WUKWoFb9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 cm4-20020a17090afa0400b00208606154f7si7280267pjb.117.2022.10.22.01.33.29; Sat, 22 Oct 2022 01:33: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=WUKWoFb9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S233705AbiJVITK (ORCPT + 99 others); Sat, 22 Oct 2022 04:19:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48810 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233335AbiJVIQk (ORCPT ); Sat, 22 Oct 2022 04:16:40 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 272702DCB09; Sat, 22 Oct 2022 00:57: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 sin.source.kernel.org (Postfix) with ESMTPS id 4696ECE01BE; Sat, 22 Oct 2022 07:55:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 446B2C433D6; Sat, 22 Oct 2022 07:55:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425347; bh=1Ex0IhPVO/kdm+4mY+F4aJIeYW5QUwl8qdfY4dthjZE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WUKWoFb9wQyrUa3wHcJSg6HfrTlw+9/W48okB/V+NxPJPdYOrBZoxh42SwVb11Jo/ uKaWy0t3kmo/UfES1e+6lqHEnHJOPMXWj4eBgevsIr66r5QsIXGsBqh5rM0UWpsIjY irj/IeA1w2AGNsfUHQRrcM11LLn7TIHSbPMpInWQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jens Hillenstedt , Adam Ward , Lee Jones , Sasha Levin Subject: [PATCH 5.19 472/717] mfd: da9061: Fix Failed to set Two-Wire Bus Mode. Date: Sat, 22 Oct 2022 09:25:51 +0200 Message-Id: <20221022072519.210039111@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376011868480050?= X-GMAIL-MSGID: =?utf-8?q?1747376011868480050?= From: Jens Hillenstedt [ Upstream commit 834382ea32865a4bdeae83ec2dcb9321dc9489f2 ] In da9062_i2c_probe() regmap_clear_bits() tries to access CONFIG_J register. As CONFIG_J is not present in da9061_aa_writeable_ranges[] probe of da9061 fails: da9062 2-0058: Entering I2C mode! da9062 2-0058: Failed to set Two-Wire Bus Mode. da9062: probe of 2-0058 failed with error -5 Add CONFIG_J register to da9061_aa_writeable_ranges[]. Fixes: 5c6f0f456351 ("mfd: da9062: Support SMBus and I2C mode") Signed-off-by: Jens Hillenstedt Reviewed-by: Adam Ward Signed-off-by: Lee Jones Link: https://lore.kernel.org/r/20220915092004.168744-1-jens.hillenstedt@ise.de Signed-off-by: Sasha Levin --- drivers/mfd/da9062-core.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/mfd/da9062-core.c b/drivers/mfd/da9062-core.c index 2774b2cbaea6..c2acdbcd5d6b 100644 --- a/drivers/mfd/da9062-core.c +++ b/drivers/mfd/da9062-core.c @@ -453,6 +453,7 @@ static const struct regmap_range da9061_aa_writeable_ranges[] = { regmap_reg_range(DA9062AA_VBUCK1_B, DA9062AA_VBUCK4_B), regmap_reg_range(DA9062AA_VBUCK3_B, DA9062AA_VBUCK3_B), regmap_reg_range(DA9062AA_VLDO1_B, DA9062AA_VLDO4_B), + regmap_reg_range(DA9062AA_CONFIG_J, DA9062AA_CONFIG_J), regmap_reg_range(DA9062AA_GP_ID_0, DA9062AA_GP_ID_19), }; From patchwork Sat Oct 22 07:25: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: 7540 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1105877wrr; Sat, 22 Oct 2022 01:36:26 -0700 (PDT) X-Google-Smtp-Source: AMsMyM62r1b/k9FeLEiRKqY4Xr8EVfRv5y4dz22DvalRH5GhjXB6RoPeQfKh6AoMrOZjPpQoG1Rk X-Received: by 2002:a05:6a00:1a92:b0:565:d5c0:f627 with SMTP id e18-20020a056a001a9200b00565d5c0f627mr23651751pfv.10.1666427785733; Sat, 22 Oct 2022 01:36:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666427785; cv=none; d=google.com; s=arc-20160816; b=Jix1q2PI9FTHtoy+eeC/SXAZvE/RqyaxOKYALoHig6kQJV0BIKCKiZo9vP07T7Qwl/ M+dy24BEzpujFcIgRU080tQi0k9ePLr3Wek1ztcmWnhiFiZ25AwGFEUGBwh4Zuspd/sx 6jbr3XgX7+M1hYjldnIPFO/3Z9+pawPG+wVVcIp9DDV2Gf2g+s/7bMA8GM+4QKIJrLhA R+c2xLtXeIKUsPq99gwEGojWoWW4BYaOC8UXFMaVq8GBx3XRJ2+6FmukmRP4iey6as/G iJxKGlAewCAfsC9eoaAkJ06CrVmGUNivJS5rliURwmAmu5bkLnWagKStfwle3vm64vfZ yP7Q== 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=6uAE3ooxfCfRaPEyOTN8dSX9k7p1mrvClZ/iBMbAZDU=; b=JNyvKJYOJA8NMVOgUYP8IMgyiivyo1wAYUGiMy2o+BkgZEZy27FrhoosC6qgT2LW2P U06Jhv+oiJpk3bumMirc1V+ve1n1vaS6ejQDvEGu/gZsgQG2GABcZAStvhJ/bgjA5aI6 omNz9XIiHXcCtpZX/Y5ryan3W9HlJyM5viSJeauwxt7xOd6B0sH3zLaXTz/XVfq1+8Jj Jj+OEf0npT1Igwi6TUVq/tvl5zKM01bR/hwAACBC+vt6bbEMelaA4l5PcM0wXl5WOQ4h S9NQ0q8YUJX7tVXcRNNNpSi4dEIa6PixZr4E3m30axTIAtyv6MeIWCfEHhiwuhVF7Rk0 /CpQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=SJprsWQn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 z14-20020a170902d54e00b0017680ae3a9csi25997416plf.534.2022.10.22.01.36.11; Sat, 22 Oct 2022 01:36: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=SJprsWQn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S233552AbiJVIRi (ORCPT + 99 others); Sat, 22 Oct 2022 04:17:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49164 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233992AbiJVIPt (ORCPT ); Sat, 22 Oct 2022 04:15:49 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CED972DB7B9; Sat, 22 Oct 2022 00:56: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 4721060B93; Sat, 22 Oct 2022 07:55:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4E605C433C1; Sat, 22 Oct 2022 07:55:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425350; bh=Fjt2jIwBgVzTGqtp7I6RkWwJ6PuwF/5JIKJ4axJCIgg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SJprsWQnEgmITrSyJztFfR3cGTGr3DoRtJQHXHC+dpUR3HYPHm1bElssSsCOZ3UUV anKhFyKjtDK5XE07k33uD+gFQmrRAk5yjKm+tvsZZFzcPs66LMBKnZONEhhDppYeBJ vGw+KUqEkBvCWeBdw4hB9CdC/6H3gAO/Fb06X7nw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Chen-Yu Tsai , AngeloGioacchino Del Regno , Sasha Levin Subject: [PATCH 5.19 473/717] clk: mediatek: mt8183: mfgcfg: Propagate rate changes to parent Date: Sat, 22 Oct 2022 09:25:52 +0200 Message-Id: <20221022072519.262642755@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376181390264013?= X-GMAIL-MSGID: =?utf-8?q?1747376181390264013?= From: Chen-Yu Tsai [ Upstream commit 9f94f545f258b15bfa6357eb62e1e307b712851e ] The only clock in the MT8183 MFGCFG block feeds the GPU. Propagate its rate change requests to its parent, so that DVFS for the GPU can work properly. Fixes: acddfc2c261b ("clk: mediatek: Add MT8183 clock support") Signed-off-by: Chen-Yu Tsai Reviewed-by: AngeloGioacchino Del Regno Signed-off-by: AngeloGioacchino Del Regno Link: https://lore.kernel.org/r/20220927101128.44758-3-angelogioacchino.delregno@collabora.com Signed-off-by: Chen-Yu Tsai Signed-off-by: Sasha Levin --- drivers/clk/mediatek/clk-mt8183-mfgcfg.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/clk/mediatek/clk-mt8183-mfgcfg.c b/drivers/clk/mediatek/clk-mt8183-mfgcfg.c index d774edaf760b..230299728859 100644 --- a/drivers/clk/mediatek/clk-mt8183-mfgcfg.c +++ b/drivers/clk/mediatek/clk-mt8183-mfgcfg.c @@ -18,9 +18,9 @@ static const struct mtk_gate_regs mfg_cg_regs = { .sta_ofs = 0x0, }; -#define GATE_MFG(_id, _name, _parent, _shift) \ - GATE_MTK(_id, _name, _parent, &mfg_cg_regs, _shift, \ - &mtk_clk_gate_ops_setclr) +#define GATE_MFG(_id, _name, _parent, _shift) \ + GATE_MTK_FLAGS(_id, _name, _parent, &mfg_cg_regs, _shift, \ + &mtk_clk_gate_ops_setclr, CLK_SET_RATE_PARENT) static const struct mtk_gate mfg_clks[] = { GATE_MFG(CLK_MFG_BG3D, "mfg_bg3d", "mfg_sel", 0) From patchwork Sat Oct 22 07:25: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: 7696 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1109261wrr; Sat, 22 Oct 2022 01:47:47 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6IlxKm+kblaYZUdCsShBiDEcvOHXr6RJgmnp48+Eo1w7MJtPn/go6l8C308fOOk2YxEub4 X-Received: by 2002:a17:907:761b:b0:78d:4990:3f3e with SMTP id jx27-20020a170907761b00b0078d49903f3emr18915643ejc.228.1666428466965; Sat, 22 Oct 2022 01:47:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666428466; cv=none; d=google.com; s=arc-20160816; b=XWTxRYRXl/OmgKzPbLHXgA2h9v8RrZpjs0qJxKcfd1Sh47KwcseH013ePyOPRe18Hq 1aFTH/GwI8h6vjSkj+fk3XD/4VAtEAMgVPkY3CXaqxDajQ+mhEey+UGasnIbQPHCqdIs fu2rGaOIDgMXI0OZwhGAmWcqGHU68FipYSpbp+bPOLnQahbsKCiSEjYaTF6u2LmZSA9J Mxlg+9NG4Mvtj5TkgauAcI+jKy1RnlxGq6coYtBEh6jxluTuAUsJgXyM6P90MkdL/5xE x95N/5V/Glfh/OYVKlgKJoXtAdRjvuaRJQthduFYujvulU0xUX1dfb1CDOes8lkb83qi /TxA== 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=ZiZhiKH2+fKKIypKpgj/SHczTm3Euf9W+5FO4SHhG5M=; b=KY10KvjmxvuSN463Dlar7ET3tulp19Ed354n9raNidutpOt2SnstH+/XwCJhxPCzsy JcrOkML0Fb+30r+FV5RQjljzGgjK9DJmIisaaPirm3vlUiBygaFneWITOURzOLUR1ZsE P1CbFZIqTDKuH3NhEbmLxi40uw9lR3Rtm5sWItv9IuFtTAwJxIfMmrk4xnnduilZCrxQ Oed9MH7Pekk8APIlx+3WprsHhIZEYOLjoHPCY2tFf5oCs0a0yo1HwQPWp1J6XHGb8jKr mjJMkaq4P14h4KtqK6MV3SFmL5uLsxpZ0pHLE0oAXZ6DO6sPcCHF6CcH+t7erTK3y1Bq KVMw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=uKR031iJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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-20020a17090794d400b007123952b00dsi22398894ejc.100.2022.10.22.01.47.23; Sat, 22 Oct 2022 01:47: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=uKR031iJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S234157AbiJVIqt (ORCPT + 99 others); Sat, 22 Oct 2022 04:46:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40808 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235072AbiJVIoZ (ORCPT ); Sat, 22 Oct 2022 04:44:25 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 779E22EBB86; Sat, 22 Oct 2022 01:08: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 D6272B82E1F; Sat, 22 Oct 2022 07:55:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 470B5C433C1; Sat, 22 Oct 2022 07:55:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425353; bh=xwQFS+0dceWteJ5a9d7UTXfY02GKVvj6lofGoSNaXtU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uKR031iJircWeDfJtBqkKzKFU5aiA9WrppMJ4vLsnCq8J7wmpJja4lF2JHNDSFjum uDIEtDfsBrokUBzF6+jyoqWU4n/V7Ps46K9yDidz9OuD2q10OcOMnGX/C3VIWk8Ugk gIpVDRukFhVzU1EmIgmLw0m4Dm8taxeRI2HJtHOg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, AngeloGioacchino Del Regno , Chen-Yu Tsai , Sasha Levin Subject: [PATCH 5.19 474/717] clk: mediatek: clk-mt8195-mfg: Reparent mfg_bg3d and propagate rate changes Date: Sat, 22 Oct 2022 09:25:53 +0200 Message-Id: <20221022072519.313487111@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376896276415973?= X-GMAIL-MSGID: =?utf-8?q?1747376896276415973?= From: AngeloGioacchino Del Regno [ Upstream commit a5f7bf5458c2cf6730106e16a6373638a0e5ed1e ] The MFG_BG3D is a gate to enable/disable clock output to the GPU, but the actual output is decided by multiple muxes; in particular: mfg_ck_fast_ref muxes between "slow" (top_mfg_core_tmp) and "fast" (MFGPLL) clock, while top_mfg_core_tmp muxes between the 26MHz clock and various system PLLs. The clock gate comes after all the muxes, so its parent is mfg_ck_fast_reg, not top_mfg_core_tmp. Reparent MFG_BG3D to the latter to match the hardware and add the CLK_SET_RATE_PARENT flag to it: this way we ensure propagating rate changes that are requested on MFG_BG3D along its entire clock tree. Fixes: 35016f10c0e5 ("clk: mediatek: Add MT8195 mfgcfg clock support") Signed-off-by: AngeloGioacchino Del Regno Reviewed-by: Chen-Yu Tsai Link: https://lore.kernel.org/r/20220927101128.44758-6-angelogioacchino.delregno@collabora.com Signed-off-by: Chen-Yu Tsai Signed-off-by: Sasha Levin --- drivers/clk/mediatek/clk-mt8195-mfg.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/clk/mediatek/clk-mt8195-mfg.c b/drivers/clk/mediatek/clk-mt8195-mfg.c index 9411c556a5a9..c94cb71bd9b9 100644 --- a/drivers/clk/mediatek/clk-mt8195-mfg.c +++ b/drivers/clk/mediatek/clk-mt8195-mfg.c @@ -17,10 +17,12 @@ static const struct mtk_gate_regs mfg_cg_regs = { }; #define GATE_MFG(_id, _name, _parent, _shift) \ - GATE_MTK(_id, _name, _parent, &mfg_cg_regs, _shift, &mtk_clk_gate_ops_setclr) + GATE_MTK_FLAGS(_id, _name, _parent, &mfg_cg_regs, \ + _shift, &mtk_clk_gate_ops_setclr, \ + CLK_SET_RATE_PARENT) static const struct mtk_gate mfg_clks[] = { - GATE_MFG(CLK_MFG_BG3D, "mfg_bg3d", "top_mfg_core_tmp", 0), + GATE_MFG(CLK_MFG_BG3D, "mfg_bg3d", "mfg_ck_fast_ref", 0), }; static const struct mtk_clk_desc mfg_desc = { From patchwork Sat Oct 22 07:25: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: 7711 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1109518wrr; Sat, 22 Oct 2022 01:48:52 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6h3QtoJNBA+VoU2RIdZOBX6x0lZ8xWgeS4zVcDeuyXHS1qB8GEeTm1mAS9cP5SS3g9Yllh X-Received: by 2002:a05:6402:50cc:b0:45c:ec07:c394 with SMTP id h12-20020a05640250cc00b0045cec07c394mr21446605edb.411.1666428532773; Sat, 22 Oct 2022 01:48:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666428532; cv=none; d=google.com; s=arc-20160816; b=AQKmST6s8GPOmKUdSsoegZE3IkpWw3PBfKOq1ITrCDAJJin5SfgZZ4sLawfxE83aqj q9+5K8/zKbJWDlz9BYwprUHbCSoMqXMTpM+z/ksO7nIacZfE8afzfykS+Dw2b4kRPQvQ 4n5rWbgEpcGaISMHNuuperkKiFfFuK/5oy7NWXzN6JxKy2M2XGERO1eUPxken958Etki nRbnT+VkmlT2XT+uIX21EZAl37BqcEZuyZAJefxArXO3WOuedD64efDvL1WqagkcKp8r 7ksMa5fWzQ/kRpbEVaktxh6TNO8m28NmQByVTPXTq1KtiF6zecwuBq5hgvyLccMKdhoZ Wa4w== 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=aT5O6DUItw/raRyKdLWyta/Gtx3jTLQSKYL8S6gspHY=; b=gGplWc7l/grKl8TTMHz00SGENBBGajUWufEiTgqOZNn0rE3yjpnJ4BI68gU+YFqc8T Gsx+yHicJsB8EudZtKT+wOp3wGQ6NgOzumQR/KkC8woMHHwrJFkS6MDAMDGefxD+Orvz Zt8bq3VaR5iwuaw7DvS0S7hV2FDf3qNxcCzVcEbY2Qx3sqcL+9C47MiyxOM8OvKiXTEX vo0jjDHThtYtnEhROMb3DE5beRNLJM4UOsQpOSewNJEkdZA6Y/mtmQ0XEvFUhQZC6MrX yO0LAZnnaMLNX6tP+eXExeDOU9ddR2k4y55uN6Pmi1Vd+cdV/+ZV2LBn9ZZZaoq5nkvP tNWA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=aZWkGUSD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 z22-20020a05640240d600b0045d5a712e82si20784922edb.586.2022.10.22.01.48.28; Sat, 22 Oct 2022 01:48: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=aZWkGUSD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231571AbiJVIr6 (ORCPT + 99 others); Sat, 22 Oct 2022 04:47:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52878 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235232AbiJVIpA (ORCPT ); Sat, 22 Oct 2022 04:45:00 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CE8822ECF44; Sat, 22 Oct 2022 01: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 3825E60B9E; Sat, 22 Oct 2022 07:56:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 41333C43142; Sat, 22 Oct 2022 07:55:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425359; bh=mCt10wEUGdkbYKVqsikirEnFY/fRySLGrPNv1mk+zm4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=aZWkGUSDTg2C3+RurIScZZU07UIY3w8SO46LaQQ0h+h0MPIGGX80dpXtbl6MMBIkI kemOBnyTiE7mjGM/mVA1Kq5kQ658bMlmHoWP2P9idXXFkdYuan0ZurLNdzE3GiSkA7 UxAOlzELzqgkphI0DyleICPlzfmurXKDpsIRQ0uA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, AngeloGioacchino Del Regno , Chen-Yu Tsai , Sasha Levin Subject: [PATCH 5.19 475/717] clk: mediatek: fix unregister function in mtk_clk_register_dividers cleanup Date: Sat, 22 Oct 2022 09:25:54 +0200 Message-Id: <20221022072519.358479275@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376965347434752?= X-GMAIL-MSGID: =?utf-8?q?1747376965347434752?= From: Chen-Yu Tsai [ Upstream commit 20f7a0dba9075fb0e3d645495bc24d7025b58de1 ] When the cleanup paths for the various clk register APIs in the MediaTek clk library were added, the one in the dividers type used the wrong type of unregister function. This would result in incorrect dereferencing of the clk pointer and freeing of invalid pointers. Fix this by switching to the correct type of clk unregistration call. Fixes: 3c3ba2ab0226 ("clk: mediatek: mtk: Implement error handling in register APIs") Reviewed-by: AngeloGioacchino Del Regno Link: https://lore.kernel.org/r/20220926102523.2367530-2-wenst@chromium.org Signed-off-by: Chen-Yu Tsai Signed-off-by: Sasha Levin --- drivers/clk/mediatek/clk-mtk.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/clk/mediatek/clk-mtk.c b/drivers/clk/mediatek/clk-mtk.c index b9188000ab3c..53bb8b88332f 100644 --- a/drivers/clk/mediatek/clk-mtk.c +++ b/drivers/clk/mediatek/clk-mtk.c @@ -393,7 +393,7 @@ int mtk_clk_register_dividers(const struct mtk_clk_divider *mcds, int num, if (IS_ERR_OR_NULL(clk_data->hws[mcd->id])) continue; - mtk_clk_unregister_composite(clk_data->hws[mcd->id]); + clk_hw_unregister_divider(clk_data->hws[mcd->id]); clk_data->hws[mcd->id] = ERR_PTR(-ENOENT); } From patchwork Sat Oct 22 07:25: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: 7503 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1104951wrr; Sat, 22 Oct 2022 01:33:46 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6gbVVHt1fV4A23X1KR+VXvwgHAPGWb7bJLoHbN56btZ1exd2SSJ0NQEpDk7rdpE3QDN7nA X-Received: by 2002:a17:90b:4c92:b0:20b:a13:83c7 with SMTP id my18-20020a17090b4c9200b0020b0a1383c7mr62465857pjb.128.1666427615810; Sat, 22 Oct 2022 01:33:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666427615; cv=none; d=google.com; s=arc-20160816; b=IEjm+Y8j96FdSzVu4vxoo1EL44mkCceae2Sn+x2NELc7TsIb1Wd84vuqNqUWNs///W F5zXo9mmUkMI9zu2d2b2nOi90NQDVT4/HkWzFZ12AKqmq+Cta4SR0uAWg//Jto4FTGtH JtU+XJGmkt+Nx1ie+UGz0IpYrDpUqR3LuxuZ5BHrZk7IctYGgjOWH6TsGwHtl2/49t4d Dhp4BALemvlou/6VyM/ExWEsft1e3JNRtCbD8Q4aIDL8vvzqD7vuiDLsOCZUVm4KmeYX 1d53ODkEnNM0CI5Uz+IH9xwe/M1HqIIeaCEwuRPvdoBj7vWLLxumdDcOd9ZNNFf1/q1W e8uw== 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=ImLMwpaAIsEriiX3RobgXe3W3OMtyzo7z7LTVGWoP00=; b=BSV6YJ+5oWRyFr/VOpdqYwggZn79+c+XKm5EKboeCnKwwu2qMFPOS62J8Jo2LK3Tl9 pHPUQ1zmJUkVw86H3hp/53DAvhP1iKrZuSC77XsWBDdGclgAvkJGcse0ru00AxyPD13Z i91wMUla9sH3xPhi8MvF21ViQeNiryJ2Ja+g7vR6rxt0VU4TTcjyqx3sdXa/glxtNCPt OsTdZVbRYGQS0rYoGcb3etJiT/i6NfvojH1ILWQgFM2+T0APkFgLbvdwbFwyoiDKHzwo oyp7SOsfwfhIft35WFTlyjJGGVPiYerKF3BZdSLeYzLEpYKp7PHZj0H1E4xposmTbT74 niUg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=I0rVqZXF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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-20020a6390c4000000b0046b172c5c54si27026507pge.561.2022.10.22.01.33.22; Sat, 22 Oct 2022 01: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=I0rVqZXF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S233434AbiJVIQ6 (ORCPT + 99 others); Sat, 22 Oct 2022 04:16:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37154 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233765AbiJVIPE (ORCPT ); Sat, 22 Oct 2022 04:15: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 911F2112A93; Sat, 22 Oct 2022 00: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 ams.source.kernel.org (Postfix) with ESMTPS id 0CC3EB82DF2; Sat, 22 Oct 2022 07:56:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5187EC433C1; Sat, 22 Oct 2022 07:56:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425362; bh=srv/EIl8izX/BPUoVv3mGmNEBkCdcC6kZNz8wlmMOUg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=I0rVqZXFH8MimDFqY3LYb/xwraQ6RuWIE6mGMRo2n47KwozVTuPPjPADWFijxKBJI jIQfqP7GPjYTnzDWKEnHgWBfblALY1n9+aJ1zClFaZO29VA0ydQhQRTMsjW1l21ng2 rqJgn6l5Do43TBoU/Dym4wCr8rPuRcPTEkwwMnFI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, AngeloGioacchino Del Regno , Chen-Yu Tsai , Sasha Levin Subject: [PATCH 5.19 476/717] clk: mediatek: Migrate remaining clk_unregister_*() to clk_hw_unregister_*() Date: Sat, 22 Oct 2022 09:25:55 +0200 Message-Id: <20221022072519.406403441@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376003889132179?= X-GMAIL-MSGID: =?utf-8?q?1747376003889132179?= From: Chen-Yu Tsai [ Upstream commit fef14676fc4be40b8441745a3c96b7e7d7d8592d ] During the previous |struct clk| to |struct clk_hw| clk provider API migration in commit 6f691a586296 ("clk: mediatek: Switch to clk_hw provider APIs"), a few clk_unregister_*() calls were missed. Migrate the remaining ones to the |struct clk_hw| provider API, i.e. change clk_unregister_*() to clk_hw_unregister_*(). Fixes: 6f691a586296 ("clk: mediatek: Switch to clk_hw provider APIs") Reviewed-by: AngeloGioacchino Del Regno Link: https://lore.kernel.org/r/20220926102523.2367530-3-wenst@chromium.org Signed-off-by: Chen-Yu Tsai Signed-off-by: Sasha Levin --- drivers/clk/mediatek/clk-mtk.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/clk/mediatek/clk-mtk.c b/drivers/clk/mediatek/clk-mtk.c index 53bb8b88332f..35845163edae 100644 --- a/drivers/clk/mediatek/clk-mtk.c +++ b/drivers/clk/mediatek/clk-mtk.c @@ -80,7 +80,7 @@ int mtk_clk_register_fixed_clks(const struct mtk_fixed_clk *clks, int num, if (IS_ERR_OR_NULL(clk_data->hws[rc->id])) continue; - clk_unregister_fixed_rate(clk_data->hws[rc->id]->clk); + clk_hw_unregister_fixed_rate(clk_data->hws[rc->id]); clk_data->hws[rc->id] = ERR_PTR(-ENOENT); } @@ -102,7 +102,7 @@ void mtk_clk_unregister_fixed_clks(const struct mtk_fixed_clk *clks, int num, if (IS_ERR_OR_NULL(clk_data->hws[rc->id])) continue; - clk_unregister_fixed_rate(clk_data->hws[rc->id]->clk); + clk_hw_unregister_fixed_rate(clk_data->hws[rc->id]); clk_data->hws[rc->id] = ERR_PTR(-ENOENT); } } @@ -146,7 +146,7 @@ int mtk_clk_register_factors(const struct mtk_fixed_factor *clks, int num, if (IS_ERR_OR_NULL(clk_data->hws[ff->id])) continue; - clk_unregister_fixed_factor(clk_data->hws[ff->id]->clk); + clk_hw_unregister_fixed_factor(clk_data->hws[ff->id]); clk_data->hws[ff->id] = ERR_PTR(-ENOENT); } @@ -168,7 +168,7 @@ void mtk_clk_unregister_factors(const struct mtk_fixed_factor *clks, int num, if (IS_ERR_OR_NULL(clk_data->hws[ff->id])) continue; - clk_unregister_fixed_factor(clk_data->hws[ff->id]->clk); + clk_hw_unregister_fixed_factor(clk_data->hws[ff->id]); clk_data->hws[ff->id] = ERR_PTR(-ENOENT); } } @@ -414,7 +414,7 @@ void mtk_clk_unregister_dividers(const struct mtk_clk_divider *mcds, int num, if (IS_ERR_OR_NULL(clk_data->hws[mcd->id])) continue; - clk_unregister_divider(clk_data->hws[mcd->id]->clk); + clk_hw_unregister_divider(clk_data->hws[mcd->id]); clk_data->hws[mcd->id] = ERR_PTR(-ENOENT); } } From patchwork Sat Oct 22 07:25: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: 7493 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1104861wrr; Sat, 22 Oct 2022 01:33:32 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6gXJlEUvxQEBRzeePA50pdE/XAUcUbfbdaH3ZlNLe/yCQe2Pg9JiJtkGgOyJ94PqE6v1BO X-Received: by 2002:a17:902:b597:b0:182:8547:ae57 with SMTP id a23-20020a170902b59700b001828547ae57mr23591031pls.92.1666427612452; Sat, 22 Oct 2022 01:33:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666427612; cv=none; d=google.com; s=arc-20160816; b=SOt5ehLwYDFEiDlBMIBks4aQPclEWAVS5ixb8mJNM/+hivG5kz88UdE1nSkkTLPouy Kgs94eLJp1fvPAzYNH/Fjuh0tRG9qRYDyQACVM3LuF+l8i7/stYURNYGK1U8bRAX+tHx Nnx+MxsODi2HOXCizcEuBe+e1O/VtDan5442bFU6pnCvwZQfwExKhVht/kYq5PAiZPJs 4H4xENpKQml1KKrnjV6LiG/fL2aGxYXeqKHImKnaqF9n/uyGcCM1EcBRkWT+JpTLDa9G EvQ4Rcv5XtJi/CiS/Yanjgny/QiCMypTXDlLHbfLfHaibpNJkua9H0XwLkQitdbfI+Ws HTaQ== 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=7asfMDE5/D7dKpT8/biKetb4XW91a489M0kGzgXzjQo=; b=Y5CJR3evYtUr/BDsUIRHlBdCEq4vLlAuz/O2f8boXYDMqz5DiiQGoUs9nU4gLx7bin OjwCbFAvxbLxrcBUKaUTGZnvfRjSZNG7WuxH7VRU6WdAV0ogl8lHVfVIOxSZr+0o8JKR LxF+FY0i2GfYvfUvIHC7iLYswoBN1ekEZjrCCqeAtOo9VzAD65G2jL8QJZykUjScowc3 VeA3QBHyocbxPvpHI5qaI9Hn6WHit1O1hTv1/Ll+SuXWD5uyPvU2vwmiZ5i2ZOD6KFly psxSMPhubNvFvHGNrEMtMfB9r8BEdDbie9QT2hoOsMLDEjbJM9WevM+GhEAEZaFQ0C1O tlsA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=GBUKsZEt; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 d17-20020a170903209100b00182c500d95bsi22924250plc.1.2022.10.22.01.33.19; Sat, 22 Oct 2022 01:33: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=GBUKsZEt; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S233414AbiJVISS (ORCPT + 99 others); Sat, 22 Oct 2022 04:18:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50254 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234062AbiJVIQF (ORCPT ); Sat, 22 Oct 2022 04:16:05 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 871162DB96A; Sat, 22 Oct 2022 00:56: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 A222B60BA0; Sat, 22 Oct 2022 07:56:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 63085C433B5; Sat, 22 Oct 2022 07:56:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425366; bh=V1yLvhX9zdad2+j+Fwim9g75fpNwO3eUX/S2g7mfUCQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GBUKsZEt8MSFugLh2Mwtm7vIpL0SQJaw4tgea4AeHNmHJcnLsBEhQMfxP8XpRSa6n XFdeRVc/gVXnDWxYbLHLsQtVDxRfr+U/Q9cziRYRudXBaS8LFbWV8hfKvrOTjBeBGK AOpFfQJhR6XNzJU9wQXRsTGIjM0r8cwlB1N3oh2g= 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 5.19 477/717] dmaengine: ioat: stop mod_timer from resurrecting deleted timer in __cleanup() Date: Sat, 22 Oct 2022 09:25:56 +0200 Message-Id: <20221022072519.457117679@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376000148175264?= X-GMAIL-MSGID: =?utf-8?q?1747376000148175264?= 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 37ff4ec7db76..e2070df6cad2 100644 --- a/drivers/dma/ioat/dma.c +++ b/drivers/dma/ioat/dma.c @@ -656,7 +656,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 */ @@ -682,7 +682,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); } } @@ -879,7 +879,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); } static void ioat_reboot_chan(struct ioatdma_chan *ioat_chan) From patchwork Sat Oct 22 07:25: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: 7791 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1123377wrr; Sat, 22 Oct 2022 02:33:18 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7F+Tivco1celGA2BtuX7JifWtnsny+GJ3HBzAJ9ZBir1lSJgJwtqBfSfmCuEcvfnhR53ye X-Received: by 2002:a17:907:7626:b0:78d:e65b:e5ac with SMTP id jy6-20020a170907762600b0078de65be5acmr18550177ejc.416.1666431197815; Sat, 22 Oct 2022 02:33:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666431197; cv=none; d=google.com; s=arc-20160816; b=fPw+ra3JRI4QdT4QxULllvRdSnEBmImYP22zYjEFnZz224ysvmzQJUU5UkDFda1zeA q5UCAHSo5N30gicp6+pmHUznIxDN3qsvfRDpAmbFfuPfc7OYoKj0AQqCWIh6yMGI9ywU JE/03I+jG+pGlGUtI4sb1oUcH7gPz+fUpyZo/6Es6/lp9JLJtx5YdVsAgkBIyurXXveB aXuVZ5nhPQQg0xsMo3DgTHhzTh21N6YdKzIIHYHlu0jNAndSc2IMtYyccO+P47itHqDd EYfsUh0yZ7aKgTPOc90k4XULchg9Sowtkw2lTaY8PYAnHn/u7ufsnmBO9XjR8DY5jf0g lM4A== 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=ABqLhEefk0LvQT+Xph82fNTgTbQEcZoMI1BaWLPqWcU=; b=iFT5eE54C2KK1e9+Q+dIqbW4WHumH+bELqRhGshbO26Ty+Un4lAmm5BABgg84f+Het so8aj3Sz4E6EzVwGuPutVxJcMKhIY7cdcDjF95TY6N2lGPCyUkSzSHyCV8vu9EEEhwgv OwJwTfETjUCtRKKeUiG7FxCytDeJbGPZg3WoIHw0xuL902vNC8L16f09kSsj2k7GA/6L XOPVdea8SJKC2O0pDRNtNf0wEtOUB/8h4Pm0jYYjc9TsstlHcSroR0HpMqn6aTJfprAa 1eErwPLgO4fvn+ujV3fLKRDv0tLFJSqniJh+HEOl8mrLpZFvYrqdtT6X81yW3HM6TfRU Lx8A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=mnIU7JR+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 ho31-20020a1709070e9f00b0078dcf17c084si25158879ejc.728.2022.10.22.02.32.49; Sat, 22 Oct 2022 02:33: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=mnIU7JR+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231134AbiJVJQb (ORCPT + 99 others); Sat, 22 Oct 2022 05:16:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40242 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230280AbiJVJP2 (ORCPT ); Sat, 22 Oct 2022 05:15:28 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 008D5836D3; Sat, 22 Oct 2022 01:30: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 801DB60B82; Sat, 22 Oct 2022 07:56:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 86660C433D6; Sat, 22 Oct 2022 07:56:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425368; bh=vefNYbMf8Zt5bHYazbZqb/GZMUBayjSqs/8fWewmGmE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mnIU7JR+HvttRpP+GvLGMuXJtjJbZiexV0TiQ4hyphL2WvgXZQYZOzZyZEgQU30PK sh4BQ1r9EpLfhuETkosvpgryU9lzXx76bbu0eeDNU8xhY53gwvll6utICPGohzeUvp x3eBmvQg4RK5kYytuNpkS20FU9zkvhuvIOZypjbE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, AngeloGioacchino Del Regno , Tianping Fang , Chunfeng Yun , Sasha Levin Subject: [PATCH 5.19 478/717] usb: mtu3: fix failed runtime suspend in host only mode Date: Sat, 22 Oct 2022 09:25:57 +0200 Message-Id: <20221022072519.497103600@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747379759607243928?= X-GMAIL-MSGID: =?utf-8?q?1747379759607243928?= From: Chunfeng Yun [ Upstream commit 1c703e29da5efac6180e4c189029fa34b7e48e97 ] When the dr_mode is "host", after the host enter runtime suspend, the mtu3 can't do it, because the mtu3's device wakeup function is not enabled, instead it's enabled in gadget init function, to fix the issue, init wakeup early in mtu3's probe() Fixes: 6b587394c65c ("usb: mtu3: support suspend/resume for dual-role mode") Reviewed-by: AngeloGioacchino Del Regno Reported-by: Tianping Fang Signed-off-by: Chunfeng Yun Link: https://lore.kernel.org/r/20220929064459.32522-1-chunfeng.yun@mediatek.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/usb/mtu3/mtu3_core.c | 2 -- drivers/usb/mtu3/mtu3_plat.c | 2 ++ 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/usb/mtu3/mtu3_core.c b/drivers/usb/mtu3/mtu3_core.c index c4a2c37abf62..3ea5145a842b 100644 --- a/drivers/usb/mtu3/mtu3_core.c +++ b/drivers/usb/mtu3/mtu3_core.c @@ -971,8 +971,6 @@ int ssusb_gadget_init(struct ssusb_mtk *ssusb) goto irq_err; } - device_init_wakeup(dev, true); - /* power down device IP for power saving by default */ mtu3_stop(mtu); diff --git a/drivers/usb/mtu3/mtu3_plat.c b/drivers/usb/mtu3/mtu3_plat.c index 4309ed939178..845b25320fd2 100644 --- a/drivers/usb/mtu3/mtu3_plat.c +++ b/drivers/usb/mtu3/mtu3_plat.c @@ -332,6 +332,8 @@ static int mtu3_probe(struct platform_device *pdev) pm_runtime_enable(dev); pm_runtime_get_sync(dev); + device_init_wakeup(dev, true); + ret = ssusb_rscs_init(ssusb); if (ret) goto comm_init_err; From patchwork Sat Oct 22 07:25: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: 7703 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1109396wrr; Sat, 22 Oct 2022 01:48:19 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6JlDnPKrfBCtqjLS8xULM9JX75eF0rkY4NZb/EdDri7I0advD1iuR59FNwnHu5A4AnKX7o X-Received: by 2002:aa7:c491:0:b0:461:7f0c:c573 with SMTP id m17-20020aa7c491000000b004617f0cc573mr1443314edq.8.1666428499098; Sat, 22 Oct 2022 01:48:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666428499; cv=none; d=google.com; s=arc-20160816; b=n9E2vHNGzteACbkRKLWKmtDmeBH6HPDUDI7yICj9PUudpf3xwKtl/u6L63boYp7vrK uPNjTbzziLixLmgBihRLK3R0gjMJvlP5pBw5T0pk/p/wYG2NBjTTGI6wvkat9agqAoUT YeKO1c92+ybz5aDFx/XY7py03S7ONDuhZdQ0doZiOdC7VBsPc7ypuBCK4qkbO6ocjoxP SOg5/rI5Cr1iXk3VfZSxNtDPhlPtOhry+dGR4u3IXUdS9QgECwTCQT+Hc2FOKpqKpHeH LSqIz2JN0fGic7jeQKElyihG21ir5PcT7EDxk3OVjezSM90NWKRXMbVnoXvh7KSs0mMn 0hbw== 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=ErPD93IJ6gOoF4eX7uNsUbPCy1naZfv+pcbNCA2DqbA=; b=bC5gHL4XHRMlEZWG8MkepwznzZE398WTLZnkGESuy8Nwz/IWQMnfJMk382/X74yt3N K6YcSRtwbs4bGpcTUd9kKSfH5nFGW2ZhDwh+SpZcGmU+Ldb1zI/odTobrUSugWA7t5HH Ryq1Am1KUnSc38arQJcl9KGbnn7+HtreAO9wjphTX29c5HsyYMnG1jrOoiNmNDkLq8Od nGt+CeqMwrBjV2xORMv1Ba5eiU+gT4tfESSFZ7yUMWsNyZiaQtR0SxEYw0YzJIVKwiyt zv/53Fqa+vk3KGIKdFyTNIW7H+1KJTqQLGLkUIuCz4lTUfSXDjxKcuHTwdOlAx6lZxWS ZsHA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="U5nXzVt/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 dn22-20020a17090794d600b007986956bd8esi7664632ejc.472.2022.10.22.01.47.54; Sat, 22 Oct 2022 01:48: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="U5nXzVt/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S234472AbiJVIrB (ORCPT + 99 others); Sat, 22 Oct 2022 04:47:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40042 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235112AbiJVIoj (ORCPT ); Sat, 22 Oct 2022 04:44:39 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7AAD72EC219; Sat, 22 Oct 2022 01:08: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 A9EF360B8E; Sat, 22 Oct 2022 07:56:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9EBB0C43470; Sat, 22 Oct 2022 07:56:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425372; bh=K2n3lZ/Ursgsg4sKeDOQ5OROfj9/y9Ig83F2qNg4SAM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=U5nXzVt/vxepdQOPmbbWPD/PuSPxv5HuwiXcharAf/WmaIw03HkCttUke4fdXwuso LLpN69dXrnKJAI1EZ5A6k8yzXqHozu1nlmkKt5b2r5ZtKcstpGyyv3SvFSU9CyAYOS 9f0i5PqdQP7gVWf4OvhHp8wWWeJjVDN7o0QIAICo= 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 5.19 479/717] spmi: pmic-arb: correct duplicate APID to PPID mapping logic Date: Sat, 22 Oct 2022 09:25:58 +0200 Message-Id: <20221022072519.546386667@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376930164429283?= X-GMAIL-MSGID: =?utf-8?q?1747376930164429283?= 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 2113be40b5a9..58f580e7aacc 100644 --- a/drivers/spmi/spmi-pmic-arb.c +++ b/drivers/spmi/spmi-pmic-arb.c @@ -992,7 +992,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); @@ -1015,16 +1016,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 Sat Oct 22 07:25: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: 7851 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1155477wrr; Sat, 22 Oct 2022 04:11:55 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5oGkpq/CWbSMZDU73n0BLX7sewq2f1vCLbDgw0HgD1Mk2L/OVkfWpt4+Rn1HbLRqYO4X/+ X-Received: by 2002:a05:6402:42d0:b0:457:d16e:283d with SMTP id i16-20020a05640242d000b00457d16e283dmr21627521edc.395.1666437115207; Sat, 22 Oct 2022 04:11:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666437115; cv=none; d=google.com; s=arc-20160816; b=ioOEjVUvyPt0/rIqUPI57znNMTZ5sCHXudQ1HOvBicK2E9b5xnCdZ+Kw4yJA11+kYQ EMdxP9wKNKG55luQqa7Wii/vRWzf4VihdiO66Kn0xx80dzht0gvl1Ws3XWziy5C+hTXS vY0hW0KQA18MDLT9g2U73Jmoch8UwOMoKO+3VB/WGBAjsHjSA5gu922G9jEA8xHG9Q/I 92VWHI4YB0a1DN+GpeGPt1zdEwqosEeidsHEf2GW4YWjKDYN5Sb+SyyTvm6JF4lieJmC 9oR/KvamT2C0tg5oodzosrjZCZMPsY1B/kdAcwGC24JZ1jlM/BC0D+6mZ2ogt6PR9p6z Fo0g== 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=ijinfp+6zshcEz3zxDVM6H6Z5AoOAH7rNPFsph+s/NQ=; b=LFgyeo81OWjVYNjVCAHTr9fK5o8mt+RK057zxQ+S4EZlEoWdNOZhvP7HCypNoXHNeO oS9XMWGygLQJeDGlX8tR70Ru88duKiX1r656zA1q4i0XwrKTWz2cO4p3XWOnh6HSDJ+M xJCBIoM7pe8BTJGnZEM2pezUEf+wUcHbhZfJJUPV3x/3Jb1ok2mtNwSu1mG4fJ1E83ZI tlQdzyTMS8UpdLJ1Q+sV9FTJ0sxFUMNJCzju7ZtXDGQ7pwnRsdoy/Jg0TlPj+//AcPOa 25bQbz2vCUkUozClFcM5eC4cPadvqnRFC9CuPYL7pfsXAOvQ1KbxDN8YV76dHZqLkR7d eSVA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ZZLqlskJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 s10-20020a170906354a00b007891fd9179bsi18981758eja.150.2022.10.22.04.11.30; Sat, 22 Oct 2022 04: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=ZZLqlskJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S230512AbiJVLHi (ORCPT + 99 others); Sat, 22 Oct 2022 07:07:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52084 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230345AbiJVLHR (ORCPT ); Sat, 22 Oct 2022 07:07:17 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4FBBF197F95; Sat, 22 Oct 2022 03:25:22 -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 sin.source.kernel.org (Postfix) with ESMTPS id ADA83CE2CAE; Sat, 22 Oct 2022 07:56:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B0A63C433C1; Sat, 22 Oct 2022 07:56:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425375; bh=j+D3BSRw6K3WPL1upC13NhG7/06VKOHGGwiFpM2s2cY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZZLqlskJat8RcPHh7+IdsMPLV874xZ99avmrGX9Z3LynOlAtcevOSINhBqPTRftDA W9zxKwxuZuH7yDRZ/NE4k/T2qVRPA+03uFDTvd/yAAe+G+imZrZGjrVZvq5RknWhjF VSWFqK0Q7r+qJnk2eIacCaHaYtnVujZb8I9jCynw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Serge Semin , Luca Ceresoli , Stephen Boyd , Sasha Levin Subject: [PATCH 5.19 480/717] clk: vc5: Fix 5P49V6901 outputs disabling when enabling FOD Date: Sat, 22 Oct 2022 09:25:59 +0200 Message-Id: <20221022072519.598997780@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 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?1747385964188909034?= X-GMAIL-MSGID: =?utf-8?q?1747385964188909034?= From: Serge Semin [ Upstream commit c388cc804016cf0f65afdc2362b120aa594ff3e6 ] We have discovered random glitches during the system boot up procedure. The problem investigation led us to the weird outcomes: when none of the Renesas 5P49V6901 ports are explicitly enabled by the kernel driver, the glitches disappeared. It was a mystery since the SoC external clock domains were fed with different 5P49V6901 outputs. The driver code didn't seem like bogus either. We almost despaired to find out a root cause when the solution has been found for a more modern revision of the chip. It turned out the 5P49V6901 clock generator stopped its output for a short period of time during the VC5_OUT_DIV_CONTROL register writing. The same problem was found for the 5P49V6965 revision of the chip and was successfully fixed in commit fc336ae622df ("clk: vc5: fix output disabling when enabling a FOD") by enabling the "bypass_sync" flag hidden inside "Unused Factory Reserved Register". Even though the 5P49V6901 registers description and programming guide doesn't provide any intel regarding that flag, setting it up anyway in the officially unused register completely eliminated the denoted glitches. Thus let's activate the functionality submitted in commit fc336ae622df ("clk: vc5: fix output disabling when enabling a FOD") for the Renesas 5P49V6901 chip too in order to remove the ports implicit inter-dependency. Fixes: dbf6b16f5683 ("clk: vc5: Add support for IDT VersaClock 5P49V6901") Signed-off-by: Serge Semin Reviewed-by: Luca Ceresoli Link: https://lore.kernel.org/r/20220929225402.9696-2-Sergey.Semin@baikalelectronics.ru Signed-off-by: Stephen Boyd Signed-off-by: Sasha Levin --- drivers/clk/clk-versaclock5.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/clk/clk-versaclock5.c b/drivers/clk/clk-versaclock5.c index e7be3e54b9be..03cfef494b49 100644 --- a/drivers/clk/clk-versaclock5.c +++ b/drivers/clk/clk-versaclock5.c @@ -1204,7 +1204,7 @@ static const struct vc5_chip_info idt_5p49v6901_info = { .model = IDT_VC6_5P49V6901, .clk_fod_cnt = 4, .clk_out_cnt = 5, - .flags = VC5_HAS_PFD_FREQ_DBL, + .flags = VC5_HAS_PFD_FREQ_DBL | VC5_HAS_BYPASS_SYNC_BIT, }; static const struct vc5_chip_info idt_5p49v6965_info = { From patchwork Sat Oct 22 07:26: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: 7514 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1105086wrr; Sat, 22 Oct 2022 01:34:05 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7FhvRwdnlTlC4GxnbyCT8VRKVVx1NtKeLWY360MyzdVGL6FDGQGFpLYRfUJx2971j2E9S8 X-Received: by 2002:a65:4bc3:0:b0:439:103b:fc35 with SMTP id p3-20020a654bc3000000b00439103bfc35mr19586987pgr.248.1666427645127; Sat, 22 Oct 2022 01:34:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666427645; cv=none; d=google.com; s=arc-20160816; b=Lev4Q18nB7gF2vjuoypB4W8uycDfU77hcgyfdSyMDliKq0gPegEND1gSmZ5sBd0VD7 Z+M/bOKPYeJOYBDl6TVW/k96oLYuTsxf6cFNxRFjH5tMhzKmUc5gzr/+HiBuGy+nFMH1 AExhlJKkDX0KpeewoGgg+sksKcX+O5DfGlnr2IXMJP1pCSIARTQAgsowVmDHrt19q9vS jLglXY/eNM3U8bxQfDzGBPxanHeG7g1DWsG0DZAwiXvua3JuUbd3QrV2WU6AXSfvo5VN q1ub1PJWiGkLz+K8UgZ6zKYP3PjNmMts8xT4lA7fwIsXUivcj0iQO1UZRbxs4+0WG0Ex 8MJw== 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=g1BD2pRscx3BLuLNatvPMtlqb/wTaXyZbIfEzXs7GjY=; b=rcCEzrGvYJ3eAEJLuop27at0SZoIcjhDLbc3u/7KqLkvew22M2RHTy2cH57vblBX4V ApNEEbJq3cHex2Tlnerl6pp5Ka0Fcfp5meZCMqaGldk9sxuJ8LlnBXqws1igbxsbPTYB jiXz4KJmHwI3UxFO/qqCsF6cIs0q/xWRUUQJSDLGL3C+JFhtDumuLj37iXbjH2fuXyw5 qBaEGRUNjRPX2DZyXQ7aKAeviLp0oVpuM3yTivpXzGREDcyU/0FCPW8wKC4sv8pjViXZ dgv6NznA/sETrsmImZNXcftXLcdvFL9QphGA88802aFffFaOrRH2hoFHlaGVg1BFZ+UI lXXw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Fbb246jq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 m185-20020a633fc2000000b0043c69a39e26si27932615pga.215.2022.10.22.01.33.48; Sat, 22 Oct 2022 01:34: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=Fbb246jq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S232870AbiJVIT6 (ORCPT + 99 others); Sat, 22 Oct 2022 04:19:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52158 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233538AbiJVIRS (ORCPT ); Sat, 22 Oct 2022 04:17: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 86FBF2DCB3C; Sat, 22 Oct 2022 00: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 ams.source.kernel.org (Postfix) with ESMTPS id 7BE8FB82DF2; Sat, 22 Oct 2022 07:56:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DB6A0C433D6; Sat, 22 Oct 2022 07:56:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425378; bh=hDIWTXnFPYaCL2NW+LTf3CWQC5jgrfHnhKhZtQhXzUs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Fbb246jqk8ESfzLCQWvaB45xJApAna+2zkwlAH5jC3cOrOVD3nJSNfjCLqn01V5Q0 afoBRNbw9TR69gnn4IGu7xuNUAvzQftcchyJAOxWHTN5vBMCAzXvJelxPMr6BtxHKy Hsni3CqFcXFKGOZ43+1yCh6srg0XfQRUV3FdUTdY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Serge Semin , Stephen Boyd , Sasha Levin Subject: [PATCH 5.19 481/717] clk: baikal-t1: Fix invalid xGMAC PTP clock divider Date: Sat, 22 Oct 2022 09:26:00 +0200 Message-Id: <20221022072519.650141583@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376034719898855?= X-GMAIL-MSGID: =?utf-8?q?1747376034719898855?= From: Serge Semin [ Upstream commit 3c742088686ce922704aec5b11d09bcc5a396589 ] Most likely due to copy-paste mistake the divider has been set to 10 while according to the SoC reference manual it's supposed to be 8 thus having PTP clock frequency of 156.25 MHz. Fixes: 353afa3a8d2e ("clk: Add Baikal-T1 CCU Dividers driver") Signed-off-by: Serge Semin Link: https://lore.kernel.org/r/20220929225402.9696-3-Sergey.Semin@baikalelectronics.ru Signed-off-by: Stephen Boyd Signed-off-by: Sasha Levin --- drivers/clk/baikal-t1/clk-ccu-div.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/clk/baikal-t1/clk-ccu-div.c b/drivers/clk/baikal-t1/clk-ccu-div.c index f141fda12b09..ea77eec40ddd 100644 --- a/drivers/clk/baikal-t1/clk-ccu-div.c +++ b/drivers/clk/baikal-t1/clk-ccu-div.c @@ -207,7 +207,7 @@ static const struct ccu_div_info sys_info[] = { CCU_DIV_GATE_INFO(CCU_SYS_XGMAC_REF_CLK, "sys_xgmac_ref_clk", "eth_clk", CCU_SYS_XGMAC_BASE, 8), CCU_DIV_FIXED_INFO(CCU_SYS_XGMAC_PTP_CLK, "sys_xgmac_ptp_clk", - "eth_clk", 10), + "eth_clk", 8), CCU_DIV_GATE_INFO(CCU_SYS_USB_CLK, "sys_usb_clk", "eth_clk", CCU_SYS_USB_BASE, 10), CCU_DIV_VAR_INFO(CCU_SYS_PVT_CLK, "sys_pvt_clk", From patchwork Sat Oct 22 07:26: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: 7492 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1104858wrr; Sat, 22 Oct 2022 01:33:32 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4FzhxdVT7mDFMDUh3+y6rAB728hcD3Bs0vzPMI2nsPRw1+Tx2oqHpbjgRgAvzrLiOOzGMS X-Received: by 2002:a17:90b:1bc9:b0:20d:b990:5028 with SMTP id oa9-20020a17090b1bc900b0020db9905028mr51301706pjb.111.1666427612389; Sat, 22 Oct 2022 01:33:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666427612; cv=none; d=google.com; s=arc-20160816; b=XDcNYg98JSgfzvOlE21NOa1ANL36FG3lgVo90+BRmbQeNwatiUoo1AJqXMA9dSk2D+ /zsQ+58hF+VgKTEm3N1lnibxyRS1aii8LfpPHy8p5pzKFAUtKQXtkcQ0c0ZrKr3WODXL VeHx6ax63b3s/VPpRp5A3K1k+35qDQ40aq8NSRsvb9faiQKlOz/BS+VkVfPxm+omn/Hq Eaj3BseFQ/G1SSQhJNRzuOeJMYVbTP2m1D830URgb34vH78kP3xAiyQ7/DMHRYNr1pWT AAmxk5wSnzF5WEge28vTwsDM9nOi9gEXN9PA7uXQ5jHtY6CnBarCEfZ9Wi7QmHwPH90x fC4w== 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=4g0cVlHUXjv0gLOXBoPWodJKCKk8oHQXO+u+JUneURA=; b=WzR2scu0FDdfp4UvtxaJEfjMe/D/LyklITol31rpbmHYNcsqETXbX6YJoLc7sg5rsC Z6YcpbUepM4d2DnkYglsxiBA2iQI+QoBB65BUILYjUUK9zOuVEmfcx1xY7nHoTcQ24N6 o4GdLM9pRKvaIQFgcWzkg5Fsireqc/iO0VuKqJ0/THlOa2iaBeh6Y8X9a4MtsEb+FeOo e9QAnHAtc+ZnsL8bjVXyhvQxwXPp3qf0nt74dnSikcKYhk7yx74kP37WjGbzrpEwX6n3 geZz8bjVw8F74swpWspETKoG8lN3/ZtxhxlQrVS1cuhX8cvwi555w6R2SPoWQlnxXYfS bk1w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=2O5Qaifh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 e129-20020a636987000000b004597ddac1fasi26671689pgc.533.2022.10.22.01.33.19; Sat, 22 Oct 2022 01:33: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=2O5Qaifh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S233392AbiJVISK (ORCPT + 99 others); Sat, 22 Oct 2022 04:18:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54296 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234028AbiJVIP6 (ORCPT ); Sat, 22 Oct 2022 04:15:58 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 06DA92DB976; Sat, 22 Oct 2022 00:56: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 dfw.source.kernel.org (Postfix) with ESMTPS id C2D3F60B98; Sat, 22 Oct 2022 07:56:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C952EC433C1; Sat, 22 Oct 2022 07:56:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425381; bh=8OgA0C8IHIsrI+48hYao+3vnUM+6hvyUvzEmf2Rdq/4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=2O5Qaifhu9AtjBbxquWGayqhjBjn4Ry8zX2lY4ZVjKh/EDAAM8eEy43Xj6GeFZb10 X4dtUhYTmeJmkihmK3FsenofNjDTC6rLIIA3y6DJvtBLcv3jz2I393HGqG5RP7c/Ju xJRk6uFDQeKjUcQUuMN875no/kvXDWdqljCCEq6U= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Serge Semin , Stephen Boyd , Sasha Levin Subject: [PATCH 5.19 482/717] clk: baikal-t1: Add shared xGMAC ref/ptp clocks internal parent Date: Sat, 22 Oct 2022 09:26:01 +0200 Message-Id: <20221022072519.700631964@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376000274275729?= X-GMAIL-MSGID: =?utf-8?q?1747376000274275729?= From: Serge Semin [ Upstream commit e2eef312762e0b5a5a70d29fe59a245c0a3cffa0 ] Baikal-T1 CCU reference manual says that both xGMAC reference and xGMAC PTP clocks are generated by two different wrappers with the same constant divider thus each producing a 156.25 MHz signal. But for some reason both of these clock sources are gated by a single switch-flag in the CCU registers space - CCU_SYS_XGMAC_BASE.BIT(0). In order to make the clocks handled independently we need to define a shared parental gate so the base clock signal would be switched off only if both of the child-clocks are disabled. Note the ID is intentionally set to -2 since we are going to add a one more internal clock identifier in the next commit. Fixes: 353afa3a8d2e ("clk: Add Baikal-T1 CCU Dividers driver") Signed-off-by: Serge Semin Link: https://lore.kernel.org/r/20220929225402.9696-4-Sergey.Semin@baikalelectronics.ru Signed-off-by: Stephen Boyd Signed-off-by: Sasha Levin --- drivers/clk/baikal-t1/ccu-div.c | 1 + drivers/clk/baikal-t1/ccu-div.h | 6 ++++++ drivers/clk/baikal-t1/clk-ccu-div.c | 8 +++++--- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/drivers/clk/baikal-t1/ccu-div.c b/drivers/clk/baikal-t1/ccu-div.c index 4062092d67f9..bbfa3526ee10 100644 --- a/drivers/clk/baikal-t1/ccu-div.c +++ b/drivers/clk/baikal-t1/ccu-div.c @@ -579,6 +579,7 @@ struct ccu_div *ccu_div_hw_register(const struct ccu_div_init_data *div_init) goto err_free_div; } parent_data.fw_name = div_init->parent_name; + parent_data.name = div_init->parent_name; hw_init.parent_data = &parent_data; hw_init.num_parents = 1; diff --git a/drivers/clk/baikal-t1/ccu-div.h b/drivers/clk/baikal-t1/ccu-div.h index 795665caefbd..b6a9c8e45318 100644 --- a/drivers/clk/baikal-t1/ccu-div.h +++ b/drivers/clk/baikal-t1/ccu-div.h @@ -13,6 +13,12 @@ #include #include +/* + * CCU Divider private clock IDs + * @CCU_SYS_XGMAC_CLK: CCU XGMAC internal clock + */ +#define CCU_SYS_XGMAC_CLK -2 + /* * CCU Divider private flags * @CCU_DIV_SKIP_ONE: Due to some reason divider can't be set to 1. diff --git a/drivers/clk/baikal-t1/clk-ccu-div.c b/drivers/clk/baikal-t1/clk-ccu-div.c index ea77eec40ddd..3953ae5664be 100644 --- a/drivers/clk/baikal-t1/clk-ccu-div.c +++ b/drivers/clk/baikal-t1/clk-ccu-div.c @@ -204,10 +204,12 @@ static const struct ccu_div_info sys_info[] = { "eth_clk", CCU_SYS_GMAC1_BASE, 5), CCU_DIV_FIXED_INFO(CCU_SYS_GMAC1_PTP_CLK, "sys_gmac1_ptp_clk", "eth_clk", 10), - CCU_DIV_GATE_INFO(CCU_SYS_XGMAC_REF_CLK, "sys_xgmac_ref_clk", - "eth_clk", CCU_SYS_XGMAC_BASE, 8), + CCU_DIV_GATE_INFO(CCU_SYS_XGMAC_CLK, "sys_xgmac_clk", + "eth_clk", CCU_SYS_XGMAC_BASE, 1), + CCU_DIV_FIXED_INFO(CCU_SYS_XGMAC_REF_CLK, "sys_xgmac_ref_clk", + "sys_xgmac_clk", 8), CCU_DIV_FIXED_INFO(CCU_SYS_XGMAC_PTP_CLK, "sys_xgmac_ptp_clk", - "eth_clk", 8), + "sys_xgmac_clk", 8), CCU_DIV_GATE_INFO(CCU_SYS_USB_CLK, "sys_usb_clk", "eth_clk", CCU_SYS_USB_BASE, 10), CCU_DIV_VAR_INFO(CCU_SYS_PVT_CLK, "sys_pvt_clk", From patchwork Sat Oct 22 07:26: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: 7510 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1104987wrr; Sat, 22 Oct 2022 01:33:51 -0700 (PDT) X-Google-Smtp-Source: AMsMyM74btzk5ZKvA7RR7WbZC9pLTNTYS4/CHxva9EjL+EJAV2Ll//va7MgfmGhxpG9MipAga9vX X-Received: by 2002:a17:902:8549:b0:178:6399:3e0f with SMTP id d9-20020a170902854900b0017863993e0fmr23613710plo.35.1666427631024; Sat, 22 Oct 2022 01:33:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666427631; cv=none; d=google.com; s=arc-20160816; b=UMB3FDQIfbuuai8SRD+J5FKxgXTJBYVdtFcuWOAS/i5Ugdf3or0K2qDJaPxiDHT08s GB1l5+5c15WEiNhWotgU1qy9vcu0GqWatMKn3DKzMJp8ucZhqhNQM/vqgTQl13uOfLC1 3prbT8cTH67DQsdq6Q5R+ixRuPKrc/aZvIxJe8PKPWgOT5R8FrwiuS8Ab0y3IEsJAoZ9 Fqj9kuWQ4Th53jnPRBwkTz0lqmsNFRHexj1tm59FNDPo6UqDJ56lfaNNm3UcifI/4Zgh F/YY1IxtmoPlhq1RoytVMJgclfZTyaZSenwJhjgxyjInIh49EHwtRU2++aigcmYtfvHl oe3A== 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=9tOCKbE/rQj/V7qeN54HTO3Ih/H1SCm6TeyHUFcw4U8=; b=ObI2E/hGZ+WOC/acbDFAVFORQoXrDY26OTSkLKEH95RJov7bCeyXsLcOm/BYVMKGnV o6Fxv/CO3/SYtUSQDUhyrQOGngqr3yNzY7g13BnAAKHdFCMVsR4ZDZu+L6EnLUZG5MgK a0AtCjM824qfw3DfFYgpcdtm+q8YkL98ncapsxWHv3wdDMtHYcGgV4QX/6kpwdaZV5W3 upa2E3iqEZNKhvyBkLi0dmL1wVA0FeZ3VeE8puYPietJiP9bgzHMvlqXmSAqpqduX5Xr 8KrQ2A7SzEl7Iw4Efh7Fbropsb6v4MtlbibOaOqX6GQT3e5VFtccp70fN87f27Mc8EDw sdFA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Y1uVduo1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 y4-20020aa78544000000b0056b820bc25esi1392052pfn.228.2022.10.22.01.33.37; Sat, 22 Oct 2022 01:33: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=Y1uVduo1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S233583AbiJVIU0 (ORCPT + 99 others); Sat, 22 Oct 2022 04:20:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36222 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233674AbiJVITE (ORCPT ); Sat, 22 Oct 2022 04:19: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 E83B2A3B4A; Sat, 22 Oct 2022 00:57: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 42223B82E0A; Sat, 22 Oct 2022 07:56:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B32D6C433D6; Sat, 22 Oct 2022 07:56:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425384; bh=whpjSLgFOwluMyDP5s1KRTKjvJu5FSA0Wxy6pCWsZP8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Y1uVduo1YS5XHjLqXVeEWYPal4GyjI6MXpdA0sxmSs22r3GmBheGNep+DqPe7S5pk DEbq9LytafYwkInBJYou7Airb880Ra8YjBwAAySw9ymsjUI84vwfA8A/gbeD3v+BiE FzC2bpK0GzAEbY2PS5oP4/rOUQC8KdnmByB7wCzA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Serge Semin , Stephen Boyd , Sasha Levin Subject: [PATCH 5.19 483/717] clk: baikal-t1: Add SATA internal ref clock buffer Date: Sat, 22 Oct 2022 09:26:02 +0200 Message-Id: <20221022072519.755237581@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376019634929174?= X-GMAIL-MSGID: =?utf-8?q?1747376019634929174?= From: Serge Semin [ Upstream commit 081a9b7c74eae4e12b2cb1b86720f836a8f29247 ] It turns out the internal SATA reference clock signal will stay unavailable for the SATA interface consumer until the buffer on it's way is ungated. So aside with having the actual clock divider enabled we need to ungate a buffer placed on the signal way to the SATA controller (most likely some rudiment from the initial SoC release). Seeing the switch flag is placed in the same register as the SATA-ref clock divider at a non-standard ffset, let's implement it as a separate clock controller with the set-rate propagation to the parental clock divider wrapper. As such we'll be able to disable/enable and still change the original clock source rate. Fixes: 353afa3a8d2e ("clk: Add Baikal-T1 CCU Dividers driver") Signed-off-by: Serge Semin Link: https://lore.kernel.org/r/20220929225402.9696-5-Sergey.Semin@baikalelectronics.ru Signed-off-by: Stephen Boyd Signed-off-by: Sasha Levin --- drivers/clk/baikal-t1/ccu-div.c | 64 +++++++++++++++++++++++++++++ drivers/clk/baikal-t1/ccu-div.h | 4 ++ drivers/clk/baikal-t1/clk-ccu-div.c | 18 +++++++- 3 files changed, 85 insertions(+), 1 deletion(-) diff --git a/drivers/clk/baikal-t1/ccu-div.c b/drivers/clk/baikal-t1/ccu-div.c index bbfa3526ee10..a6642f3d33d4 100644 --- a/drivers/clk/baikal-t1/ccu-div.c +++ b/drivers/clk/baikal-t1/ccu-div.c @@ -34,6 +34,7 @@ #define CCU_DIV_CTL_CLKDIV_MASK(_width) \ GENMASK((_width) + CCU_DIV_CTL_CLKDIV_FLD - 1, CCU_DIV_CTL_CLKDIV_FLD) #define CCU_DIV_CTL_LOCK_SHIFTED BIT(27) +#define CCU_DIV_CTL_GATE_REF_BUF BIT(28) #define CCU_DIV_CTL_LOCK_NORMAL BIT(31) #define CCU_DIV_RST_DELAY_US 1 @@ -170,6 +171,40 @@ static int ccu_div_gate_is_enabled(struct clk_hw *hw) return !!(val & CCU_DIV_CTL_EN); } +static int ccu_div_buf_enable(struct clk_hw *hw) +{ + struct ccu_div *div = to_ccu_div(hw); + unsigned long flags; + + spin_lock_irqsave(&div->lock, flags); + regmap_update_bits(div->sys_regs, div->reg_ctl, + CCU_DIV_CTL_GATE_REF_BUF, 0); + spin_unlock_irqrestore(&div->lock, flags); + + return 0; +} + +static void ccu_div_buf_disable(struct clk_hw *hw) +{ + struct ccu_div *div = to_ccu_div(hw); + unsigned long flags; + + spin_lock_irqsave(&div->lock, flags); + regmap_update_bits(div->sys_regs, div->reg_ctl, + CCU_DIV_CTL_GATE_REF_BUF, CCU_DIV_CTL_GATE_REF_BUF); + spin_unlock_irqrestore(&div->lock, flags); +} + +static int ccu_div_buf_is_enabled(struct clk_hw *hw) +{ + struct ccu_div *div = to_ccu_div(hw); + u32 val = 0; + + regmap_read(div->sys_regs, div->reg_ctl, &val); + + return !(val & CCU_DIV_CTL_GATE_REF_BUF); +} + static unsigned long ccu_div_var_recalc_rate(struct clk_hw *hw, unsigned long parent_rate) { @@ -323,6 +358,7 @@ static const struct ccu_div_dbgfs_bit ccu_div_bits[] = { CCU_DIV_DBGFS_BIT_ATTR("div_en", CCU_DIV_CTL_EN), CCU_DIV_DBGFS_BIT_ATTR("div_rst", CCU_DIV_CTL_RST), CCU_DIV_DBGFS_BIT_ATTR("div_bypass", CCU_DIV_CTL_SET_CLKDIV), + CCU_DIV_DBGFS_BIT_ATTR("div_buf", CCU_DIV_CTL_GATE_REF_BUF), CCU_DIV_DBGFS_BIT_ATTR("div_lock", CCU_DIV_CTL_LOCK_NORMAL) }; @@ -441,6 +477,9 @@ static void ccu_div_var_debug_init(struct clk_hw *hw, struct dentry *dentry) continue; } + if (!strcmp("div_buf", name)) + continue; + bits[didx] = ccu_div_bits[bidx]; bits[didx].div = div; @@ -477,6 +516,21 @@ static void ccu_div_gate_debug_init(struct clk_hw *hw, struct dentry *dentry) &ccu_div_dbgfs_fixed_clkdiv_fops); } +static void ccu_div_buf_debug_init(struct clk_hw *hw, struct dentry *dentry) +{ + struct ccu_div *div = to_ccu_div(hw); + struct ccu_div_dbgfs_bit *bit; + + bit = kmalloc(sizeof(*bit), GFP_KERNEL); + if (!bit) + return; + + *bit = ccu_div_bits[3]; + bit->div = div; + debugfs_create_file_unsafe(bit->name, ccu_div_dbgfs_mode, dentry, bit, + &ccu_div_dbgfs_bit_fops); +} + static void ccu_div_fixed_debug_init(struct clk_hw *hw, struct dentry *dentry) { struct ccu_div *div = to_ccu_div(hw); @@ -489,6 +543,7 @@ static void ccu_div_fixed_debug_init(struct clk_hw *hw, struct dentry *dentry) #define ccu_div_var_debug_init NULL #define ccu_div_gate_debug_init NULL +#define ccu_div_buf_debug_init NULL #define ccu_div_fixed_debug_init NULL #endif /* !CONFIG_DEBUG_FS */ @@ -520,6 +575,13 @@ static const struct clk_ops ccu_div_gate_ops = { .debug_init = ccu_div_gate_debug_init }; +static const struct clk_ops ccu_div_buf_ops = { + .enable = ccu_div_buf_enable, + .disable = ccu_div_buf_disable, + .is_enabled = ccu_div_buf_is_enabled, + .debug_init = ccu_div_buf_debug_init +}; + static const struct clk_ops ccu_div_fixed_ops = { .recalc_rate = ccu_div_fixed_recalc_rate, .round_rate = ccu_div_fixed_round_rate, @@ -566,6 +628,8 @@ struct ccu_div *ccu_div_hw_register(const struct ccu_div_init_data *div_init) } else if (div_init->type == CCU_DIV_GATE) { hw_init.ops = &ccu_div_gate_ops; div->divider = div_init->divider; + } else if (div_init->type == CCU_DIV_BUF) { + hw_init.ops = &ccu_div_buf_ops; } else if (div_init->type == CCU_DIV_FIXED) { hw_init.ops = &ccu_div_fixed_ops; div->divider = div_init->divider; diff --git a/drivers/clk/baikal-t1/ccu-div.h b/drivers/clk/baikal-t1/ccu-div.h index b6a9c8e45318..4eb49ff4803c 100644 --- a/drivers/clk/baikal-t1/ccu-div.h +++ b/drivers/clk/baikal-t1/ccu-div.h @@ -15,8 +15,10 @@ /* * CCU Divider private clock IDs + * @CCU_SYS_SATA_CLK: CCU SATA internal clock * @CCU_SYS_XGMAC_CLK: CCU XGMAC internal clock */ +#define CCU_SYS_SATA_CLK -1 #define CCU_SYS_XGMAC_CLK -2 /* @@ -37,11 +39,13 @@ * enum ccu_div_type - CCU Divider types * @CCU_DIV_VAR: Clocks gate with variable divider. * @CCU_DIV_GATE: Clocks gate with fixed divider. + * @CCU_DIV_BUF: Clock gate with no divider. * @CCU_DIV_FIXED: Ungateable clock with fixed divider. */ enum ccu_div_type { CCU_DIV_VAR, CCU_DIV_GATE, + CCU_DIV_BUF, CCU_DIV_FIXED }; diff --git a/drivers/clk/baikal-t1/clk-ccu-div.c b/drivers/clk/baikal-t1/clk-ccu-div.c index 3953ae5664be..90f4fda406ee 100644 --- a/drivers/clk/baikal-t1/clk-ccu-div.c +++ b/drivers/clk/baikal-t1/clk-ccu-div.c @@ -76,6 +76,16 @@ .divider = _divider \ } +#define CCU_DIV_BUF_INFO(_id, _name, _pname, _base, _flags) \ + { \ + .id = _id, \ + .name = _name, \ + .parent_name = _pname, \ + .base = _base, \ + .type = CCU_DIV_BUF, \ + .flags = _flags \ + } + #define CCU_DIV_FIXED_INFO(_id, _name, _pname, _divider) \ { \ .id = _id, \ @@ -188,11 +198,14 @@ static const struct ccu_div_rst_map axi_rst_map[] = { * for the SoC devices registers IO-operations. */ static const struct ccu_div_info sys_info[] = { - CCU_DIV_VAR_INFO(CCU_SYS_SATA_REF_CLK, "sys_sata_ref_clk", + CCU_DIV_VAR_INFO(CCU_SYS_SATA_CLK, "sys_sata_clk", "sata_clk", CCU_SYS_SATA_REF_BASE, 4, CLK_SET_RATE_GATE, CCU_DIV_SKIP_ONE | CCU_DIV_LOCK_SHIFTED | CCU_DIV_RESET_DOMAIN), + CCU_DIV_BUF_INFO(CCU_SYS_SATA_REF_CLK, "sys_sata_ref_clk", + "sys_sata_clk", CCU_SYS_SATA_REF_BASE, + CLK_SET_RATE_PARENT), CCU_DIV_VAR_INFO(CCU_SYS_APB_CLK, "sys_apb_clk", "pcie_clk", CCU_SYS_APB_BASE, 5, CLK_IS_CRITICAL, CCU_DIV_RESET_DOMAIN), @@ -398,6 +411,9 @@ static int ccu_div_clk_register(struct ccu_div_data *data) init.base = info->base; init.sys_regs = data->sys_regs; init.divider = info->divider; + } else if (init.type == CCU_DIV_BUF) { + init.base = info->base; + init.sys_regs = data->sys_regs; } else { init.divider = info->divider; } From patchwork Sat Oct 22 07:26: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: 7530 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1105799wrr; Sat, 22 Oct 2022 01:36:12 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4K/6EK7JGMBC1zn9VABudSlgdZdQjQTO+niw4bExONquVtNCHxO+Z6HuPOvt7enrJ4gQzo X-Received: by 2002:a63:f709:0:b0:44f:6cba:3a4f with SMTP id x9-20020a63f709000000b0044f6cba3a4fmr19069562pgh.428.1666427772462; Sat, 22 Oct 2022 01:36:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666427772; cv=none; d=google.com; s=arc-20160816; b=UogWejVN16FhjUnmJZ65UvG3D/+Tqbm8qlEUN/g0xFP04uTTGoXZfcnTwgTABWCoXd UaNvgEGnk1xLDxUq4LQbpkWsnLyETgMiBsy2YiXiCaCflLvXKzDGZ9lmxnbadGKVyMoz QydMQ9Yfav6qq2wWmipmxKBU+k2z767kd27VqhkaGd4P/RE4JwXAbIHLJjS9ClnpEpAh y0l5s2IEIsrBslEh8Ia9iKCItMUiZrSsG6/aaju2Vlaw0H6QXQbCLEDW4omCo+f+z3f/ OEd4jbxALB/fU4UYsxnPjQEtniq+9V2LutGGrqWOwlHAa861SJCg2ciY6UatW/ZthM9r +qtQ== 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=JBFxf4W1bmaAfIVMAz1L2haQwthAJ8YO22nTFQpZygc=; b=Q5I9AiElgmT/HsWflzLFlmqQlOIwB0HlldA4xfTwTUjPSFapXzVMQCbh5tuhKTIWKg RUZoODRRJY6eyIst0fDE1Ln68/R7HndGcsYzzL9jXVVW/6UOvFymxrwLW+SOi30o8m+G lBPC4GEvpA+XOahJlZNIG5AUMl1HAHbWiEe4jQGVqOdBvfEzcIOmeSlZvIOFTVKUUdup +DzyqkfXOf5O8gkLQ1p16kUtc+SSdnWoBxcxuJnyPdjMeiK3jWxR091nJCFAQinuO4mp pAwCf67EPi9ivuAEVUYE5KugJ7L7Hs6LnvDzTsyXUaFnBa0E06SWnECtc2cqOGGD96Dz LqpA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="okqaPYY/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 y31-20020a63495f000000b004629cd1dbb1si28721459pgk.329.2022.10.22.01.35.56; Sat, 22 Oct 2022 01:36: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="okqaPYY/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S233543AbiJVIUR (ORCPT + 99 others); Sat, 22 Oct 2022 04:20:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54292 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233661AbiJVITC (ORCPT ); Sat, 22 Oct 2022 04:19:02 -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 DF8732DE448; Sat, 22 Oct 2022 00:58: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 6A79BB82E29; Sat, 22 Oct 2022 07:56:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id ADCCDC433C1; Sat, 22 Oct 2022 07:56:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425387; bh=cOm26CLNCRY3FQd40Isa4XAbzShkLfFTJBR6ThNBhWU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=okqaPYY/mp9ygXGv8dB/mKvcKn84g9ZRA60wsIsTtlzfCs1NmSKfo0VECFgZW73of 7+wmyF/XlhR2bCPSrz5+cgvZ8pYS+VgWyfDhjju9id7M7OG6wUWRIq/eA75QCs+dZJ pOAnT8gEjqVeDc05UaJKkUt14Exa1bPsB0AG1eMk= 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 5.19 484/717] clk: bcm2835: fix bcm2835_clock_rate_from_divisor declaration Date: Sat, 22 Oct 2022 09:26:03 +0200 Message-Id: <20221022072519.797638219@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376168371231839?= X-GMAIL-MSGID: =?utf-8?q?1747376168371231839?= 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 48a1eb9f2d55..9e9f8b242958 100644 --- a/drivers/clk/bcm/clk-bcm2835.c +++ b/drivers/clk/bcm/clk-bcm2835.c @@ -966,9 +966,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 Sat Oct 22 07:26: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: 7522 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1105166wrr; Sat, 22 Oct 2022 01:34:16 -0700 (PDT) X-Google-Smtp-Source: AMsMyM57yYJ+lX+ViAVKW7+sOim49GJV8eIue8uxbhBSQsi/XsPM+yy7lvaoVvjus4tbrj9j6fXq X-Received: by 2002:a63:1145:0:b0:46a:e00c:579c with SMTP id 5-20020a631145000000b0046ae00c579cmr20040838pgr.279.1666427656616; Sat, 22 Oct 2022 01:34:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666427656; cv=none; d=google.com; s=arc-20160816; b=XphGf/NBTRAreEXLMPEa0rEOSy6K3rSS6cTN/5F+xP5GKYGM5BJEv7tyvMPaEj78+g FmfMcbnCe4BhPIloERSROJrPRnRaD/RfezrSJZav+q4soqOZwH8ZJqZEUAUtT7/VNjfC hAw9chTx5JrCPIUkIcXUAkwRQF6XHSTI2s9aKDlm9FnRRQpXPCgvABS+zf8DBNzOxgzL zB3WZYxQzI5sreZwLSF/0/lIANklS3PuH0xXR+xQJAn2O/7ORAn2f1jUVED0LWoeKS8A M03a7cnPeuMMzsYRyqyQenVEU7OeWIaWXZqtt+Z7rgxXd1ardmhfHlBT86onsomLBXhp n4jg== 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=hlHXTeLk6Vus863ESYLLvMsfIytHocqsYinwuBwvjGE=; b=FKRm8m3RP35FZAXRQoJY2MIfto3UTvejNgGNIBUZM8KmsGSXn5yKYewpSprWPcYJnc I8AxInLrSSOjGGuMGTHilG47z0rkj+d6PrB/CMXcF07UHkPszOPSQ/Lzv7jWcje9S2ig WLt02Z679yC4kTgrmjLVyRnM3QfiCOeM2/WWDc4cEDEuDIUEgDcZodJkYWwu6OVWj9RD XbU95ctOTai/+/z00onbFTCP16DQabP4/oyhIm0mBLh65j3nYpLwmG4xYv4DLp9OVcqN IPuPbEWlLAc/rRZQUsE46Ymf91WHlGV69rt1Lrbr2b91umPsa2n9BKaNZfYK24G8sDjv VYsA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=PCbbhWt7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 a7-20020a637f07000000b0043949ac7077si28242946pgd.418.2022.10.22.01.33.52; Sat, 22 Oct 2022 01:34: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=PCbbhWt7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S233754AbiJVIVG (ORCPT + 99 others); Sat, 22 Oct 2022 04:21:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54234 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233795AbiJVITo (ORCPT ); Sat, 22 Oct 2022 04:19: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 E15D0D6BB4; Sat, 22 Oct 2022 00:58: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 dfw.source.kernel.org (Postfix) with ESMTPS id 7486160B91; Sat, 22 Oct 2022 07:56:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6B239C433C1; Sat, 22 Oct 2022 07:56:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425392; bh=1Y7qpSB/p47Zdgo29zn1EKjizf5xN3DqjUZFK+QYqKQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PCbbhWt7zb9TKPWUQdTV0oZZVYa/GYwkhS3E/qExBJXXo7n1rgvhjhH4Ww01msjdv nAU59SyHRPj51rG2WT88Dc+Tq4onCKixmwsKkIODzqFoDA4zIY9XBw+4ztl+L9231E 8m2wE0vuftUXxpY3RdGiHebnJTYKawYgwB1ke+Rc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Lin Yujun , Stephen Boyd , Sasha Levin Subject: [PATCH 5.19 485/717] clk: imx: scu: fix memleak on platform_device_add() fails Date: Sat, 22 Oct 2022 09:26:04 +0200 Message-Id: <20221022072519.828988984@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376046393926123?= X-GMAIL-MSGID: =?utf-8?q?1747376046393926123?= From: Lin Yujun [ Upstream commit 855ae87a2073ebf1b395e020de54fdf9ce7d166f ] No error handling is performed when platform_device_add() fails. Add error processing before return, and modified the return value. Fixes: 77d8f3068c63 ("clk: imx: scu: add two cells binding support") Signed-off-by: Lin Yujun Link: https://lore.kernel.org/r/20220914033206.98046-1-linyujun809@huawei.com Signed-off-by: Stephen Boyd Signed-off-by: Sasha Levin --- drivers/clk/imx/clk-scu.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/clk/imx/clk-scu.c b/drivers/clk/imx/clk-scu.c index c56e406138db..1e6870f3671f 100644 --- a/drivers/clk/imx/clk-scu.c +++ b/drivers/clk/imx/clk-scu.c @@ -695,7 +695,11 @@ struct clk_hw *imx_clk_scu_alloc_dev(const char *name, pr_warn("%s: failed to attached the power domain %d\n", name, ret); - platform_device_add(pdev); + ret = platform_device_add(pdev); + if (ret) { + platform_device_put(pdev); + return ERR_PTR(ret); + } /* For API backwards compatiblilty, simply return NULL for success */ return NULL; From patchwork Sat Oct 22 07:26: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: 7495 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1104866wrr; Sat, 22 Oct 2022 01:33:33 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6eVo74NJf5co5hAESnTnAELb2zEjs1CgkL8UrC/QJa3Je1FyxFruVc9UV3x6QmVhl0IdQP X-Received: by 2002:a05:6a00:1349:b0:563:654d:ce3f with SMTP id k9-20020a056a00134900b00563654dce3fmr23594486pfu.32.1666427613290; Sat, 22 Oct 2022 01:33:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666427613; cv=none; d=google.com; s=arc-20160816; b=M/2MviU49YpzUkZkSEHtoEPdL1vsLUYyl/7h0eiXbbidSkK98gGhUvu4iplZOjrKWT /FXKHldJhSAEkZFhkQ3MQLKV0a8H98J+q8ahBsbwWHu6PuBHBN0qtIaqfrvNUQu0PKKL YDtOsJ6lMFrU1Uqpsg12UU1u2Si3dxLAHntbls97FJ73Vf1N1R0rC+obq+Z6qJMxwBP/ kOjQzdn9Y8e/Ra5EoAaXS3F21Tf2pEfCVqX//El+g6X6Rx0YIO5o9SEOAmztULmEtaSy zdXogfGdOoQA6BIXydcGAouA4g8cE4Vk+FgmeieoPRRBJ7x4uQGgY1JOmkBlzjxFOmS+ 29Mw== 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=Evmka1oQuAdiwcaxKLxtYpkMWiSxXEFjiOYfNW/PMQQ=; b=xsZ3TAUOTK8FK0+JynaJBqDZa1ZH0lU4gLq8CZzwMoy0n+q5kSCu1imo0qFAegTlct 4pJXFACCTsKhiK5MHx5GkdvNnoAKt2Fssondl9ZxrDbGblJyIgvqNjntxRKpd7aFKCXb GD1cNkIBNb1mg/npgnDyCZyu2Q+lWa4DC5pMykYQYxp8DKMe4ha8gsQ//ur2KSmOm2Lo q/2NeWrWvWH6KiX0o/rmdIep0SLmP6ciJIUtq5TAloKuv3Z3ophx8UIeZk3rUh2aV6zR 6pdkXBWs8WcneCmcIfwRh+brPhEv6HfQPALs7n4lw6iSllg/EzIcSJEkvPyS2SDEwMJy J9JQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="hUz/ueP2"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 l22-20020a056a0016d600b0052c56cea553si27764746pfc.352.2022.10.22.01.33.20; Sat, 22 Oct 2022 01:33: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="hUz/ueP2"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S233587AbiJVISb (ORCPT + 99 others); Sat, 22 Oct 2022 04:18:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57974 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234074AbiJVIQH (ORCPT ); Sat, 22 Oct 2022 04:16:07 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E571E2CCA13; Sat, 22 Oct 2022 00:57: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 BBC0860AC3; Sat, 22 Oct 2022 07:56:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B3E10C4314C; Sat, 22 Oct 2022 07:56:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425396; bh=kEJlBh+wNtWmXqcwtAkfwDO8V/HHGFV5VPH8ZyBTNso=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hUz/ueP2GksGPlESuPnNTjCY8clEMmKdQe6VFcTyMecW2kkgYPzpCrQt752yk5gby j51Z4E39aIlotQA033GHfpEOrszkRbABHjhQlWxDElpWzeobDmGB32bi8QGEDLkZkn fuFiM3beNsEiIYnttIYOz+M40Ua7Ng4pUjlfaE2o= 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 5.19 486/717] clk: ti: Balance of_node_get() calls for of_find_node_by_name() Date: Sat, 22 Oct 2022 09:26:05 +0200 Message-Id: <20221022072519.859940424@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376001185929402?= X-GMAIL-MSGID: =?utf-8?q?1747376001185929402?= From: Liang He [ Upstream commit 058a3996b888ab60eb1857fb4fd28f1b89a9a95a ] In ti_find_clock_provider(), of_find_node_by_name() will call of_node_put() for the 'from' argument, possibly putting the node one too many times. Let's maintain the of_node_get() from the previous search and only put when we're exiting the function early. This should avoid a misbalanced reference count on the node. Fixes: 51f661ef9a10 ("clk: ti: Add ti_find_clock_provider() to use clock-output-names") Signed-off-by: Liang He Link: https://lore.kernel.org/r/20220915031121.4003589-1-windhl@126.com [sboyd@kernel.org: Rewrite commit text, maintain reference instead of get again] Signed-off-by: Stephen Boyd Signed-off-by: Sasha Levin --- drivers/clk/ti/clk.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/clk/ti/clk.c b/drivers/clk/ti/clk.c index 121d8610beb1..6b2de32ef88d 100644 --- a/drivers/clk/ti/clk.c +++ b/drivers/clk/ti/clk.c @@ -148,11 +148,12 @@ static struct device_node *ti_find_clock_provider(struct device_node *from, break; } } - of_node_put(from); kfree(tmp); - if (found) + if (found) { + of_node_put(from); return np; + } /* Fall back to using old node name base provider name */ return of_find_node_by_name(from, name); From patchwork Sat Oct 22 07:26: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: 7517 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1105099wrr; Sat, 22 Oct 2022 01:34:07 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7eNtYWP5NuVaCAp4oZsTIJwjPZTf5NOUiuVWUn6fJAh43+GyvJ57VIudvvy+kJUcRVgWne X-Received: by 2002:a63:1c4e:0:b0:458:e183:1342 with SMTP id c14-20020a631c4e000000b00458e1831342mr19457358pgm.409.1666427647585; Sat, 22 Oct 2022 01:34:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666427647; cv=none; d=google.com; s=arc-20160816; b=zOL0r+fZssZClDhLxe9zh6y4bZu7PrEj9H/Q0UvvLf2OCddX0Et2WRhq4X0ZLY78G1 WOx2sMkUr8HbahDsUPm4OBwMtA4RmBM6kU5eyk3UdB+CHK0LjjAOhsarM3bVsO01aIko +vXEyN8YJwqRSHVipmGuH9mMzFqSY5ec5YeW2un+5TQ+Q+pd58MY1JrSW7WqRLZOWkok GQae02Ln/mdjsFyat8pQ/Mo3c1jEpGAb/XAPH6IGJRslumAKzYcPFE/wUgZbh41peO/A kIQhERP/1bQ6D5Ue58O62mlNaMSydNB6AUi2TIUdBqaZ0yMeGfk17v7dP5XgcMH4Ka14 vt3w== 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=XFhQZio/J0Z6P9om4dxb6oAtl0U5fYzEC39QHLLbZaU=; b=S++5Qox0tvDwBYm1iYSb2nWj/gV8t3ijn/uN34puVjdso/QzCnkpmiAtlN4dg7XHUn 86j9DMadof61b5JR8n2exrLBoxzkzC2KVCtA85b66QOqN1tsr07534jXt1Z0tAl3LOCL zO2GzqXKNHlqPkR6wbyywZlNPFkfu+08E30fR2ZCCIpfK8DT4cVh7VaEQNKiZCXDlTQq zbF2C+u6//KdtNCPyeZx6R6rqVwqCRJoRgo4smFe33G72N8IR1z1t7uEg49Lyxg0kXzJ /24FxF/HOADrVjaY0rAnax7VIlokhOtJWHuzGexNi6hGPr4iNAdsyw04ZTbrXvIxPsLp AHUg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Rhpd7Spz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 4-20020a630c44000000b0043980f3cf24si28958038pgm.296.2022.10.22.01.33.48; Sat, 22 Oct 2022 01:34: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=Rhpd7Spz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S233740AbiJVIVD (ORCPT + 99 others); Sat, 22 Oct 2022 04:21:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51524 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233769AbiJVITb (ORCPT ); Sat, 22 Oct 2022 04:19: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 634C52DF469; Sat, 22 Oct 2022 00:58: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 dfw.source.kernel.org (Postfix) with ESMTPS id B38AB60B9C; Sat, 22 Oct 2022 07:56:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BFBFDC433D6; Sat, 22 Oct 2022 07:56:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425399; bh=jf8fLkWoIzpS9etIYsFt+wUCczoUIgrZFu4evcQxtgI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Rhpd7SpzYqBA3FzSalHFvIqdNoZZqhPgpPlWfxl2Y1Qua45BzjCyRHLg3p9dhucG4 V39SE0o83+Wd9z7DyUtcbAC2ONMdjmvYgR/oinUt9nnrng00+8l2ZATKgiNqKPO97n MmFddqYmXjt7/3sVjx4yvYFoxWe3q7sxGoweCbwo= 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 5.19 487/717] clk: ti: dra7-atl: Fix reference leak in of_dra7_atl_clk_probe Date: Sat, 22 Oct 2022 09:26:06 +0200 Message-Id: <20221022072519.891186190@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376037160385502?= X-GMAIL-MSGID: =?utf-8?q?1747376037160385502?= 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 aa0950c4f498..5c278d6c985e 100644 --- a/drivers/clk/ti/clk-dra7-atl.c +++ b/drivers/clk/ti/clk-dra7-atl.c @@ -253,14 +253,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)); @@ -293,8 +295,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 Sat Oct 22 07:26: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: 7525 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1105787wrr; Sat, 22 Oct 2022 01:36:11 -0700 (PDT) X-Google-Smtp-Source: AMsMyM51rHG34Lr+Aqgp8h1f28pW+dXzqXjWAXdmPsx+VEZnzIeZsh1fbXV9pKKrTIboeSGuOVdB X-Received: by 2002:a63:494e:0:b0:448:5163:4788 with SMTP id y14-20020a63494e000000b0044851634788mr19032558pgk.507.1666427771083; Sat, 22 Oct 2022 01:36:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666427771; cv=none; d=google.com; s=arc-20160816; b=nbGmcAx9dSQjadUZvEFQSbbXL8ifZcU/HL/kg/5cBtxw9vDwCfJS56zz0oDmYYOn1V A5ALW9y9rHUW69Ktui7oGJzsxeAxjtMgIgjYfch9ICzVgnWe3q9RvbwobLDQ6daglvad 7OSTYRR7SA6RTN+qzaceam3kfYZwD/X5l4MTCHMStUEs37xPYwo0IC728d+QmwDyA8UT WlRVOzaec88ctEDmHkRmGay7wiFtYa6Vl46xtmbYU39+SHJ4lrdzf8FxWhhyfZiYjrNh FxveuLtPvnyvop4aolRWCjYRbMTx7AnTTuspRK2dfAIV+6w1QCpxC1GgXCY4RgU2d3c4 HXaQ== 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=K3U6h1ZFYGt/wdhpVzTBJWNxbnPLKnC9h5nOVfy2B5U=; b=dBrhwYcF4brzgkXdQYLv5Lvif2gzBNqz/y6l2YuKa6WyCK/txaeYwgZvd/fc9Z/YCG WteSvcosQmRN06tnmAnlUe93IABS1hxIqv21ezAAWxTM7RHi8tz93ZFrSGXrG2XYBg1M psN2eyyDhgYJNmtRrYSDJDGsLAJJkmDRPA494SdgmmBOPhoeJQZyntmAjQVo0H1ravIW VbSsO2Vt+M1H6i22cmVqprTT70fHWT+gsGU9kA/9kbWQdB+Uicsqj+nxgvFql4ZTFB1o E46KzBqblDw69ZwVmT3IMKOV4AGHQe+JMGkaOn4Ts0Mu1qPMk1l7v5/d7dlF+/LjKuSI qtmg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="bqs/Uf6S"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 c24-20020a637258000000b0041183daa0ffsi26940953pgn.761.2022.10.22.01.35.55; Sat, 22 Oct 2022 01:36: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="bqs/Uf6S"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S233669AbiJVIWX (ORCPT + 99 others); Sat, 22 Oct 2022 04:22:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35142 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233647AbiJVIUd (ORCPT ); Sat, 22 Oct 2022 04:20:33 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2AE322DE46C; Sat, 22 Oct 2022 00:58: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 32C9D60B93; Sat, 22 Oct 2022 07:58:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 25EA3C433D6; Sat, 22 Oct 2022 07:58:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425521; bh=64gELA0nUsV9N2NViMDvTXlYD/PS9XrRDXeAPBJL2d8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bqs/Uf6Sjn5MwZw9Ruer7G5MEesL0n9B9zDisyxOdqu9cl73oah6HMJs5krQhvy7W 2sqNplMCoW1sge+4bOBoa+W3TA8YxH14ckk6bf70t/GfTEL0ZYDWfqyGBnoNp3HZAX rzwOo54wBxCwuEyzmsz8spJJ7PYSCsSJ78jgMYQQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Joel Stanley , Stephen Boyd , Sasha Levin Subject: [PATCH 5.19 488/717] clk: ast2600: BCLK comes from EPLL Date: Sat, 22 Oct 2022 09:26:07 +0200 Message-Id: <20221022072519.924528008@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376166374803032?= X-GMAIL-MSGID: =?utf-8?q?1747376166374803032?= From: Joel Stanley [ Upstream commit b8c1dc9c00b252b3be853720a71b05ed451ddd9f ] This correction was made in the u-boot SDK recently. There are no in-tree users of this clock so the impact is minimal. Fixes: d3d04f6c330a ("clk: Add support for AST2600 SoC") Link: https://github.com/AspeedTech-BMC/u-boot/commit/8ad54a5ae15f27fea5e894cc2539a20d90019717 Signed-off-by: Joel Stanley Link: https://lore.kernel.org/r/20220421040426.171256-1-joel@jms.id.au Signed-off-by: Stephen Boyd Signed-off-by: Sasha Levin --- drivers/clk/clk-ast2600.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/clk/clk-ast2600.c b/drivers/clk/clk-ast2600.c index 24dab2312bc6..9c3305bcb27a 100644 --- a/drivers/clk/clk-ast2600.c +++ b/drivers/clk/clk-ast2600.c @@ -622,7 +622,7 @@ static int aspeed_g6_clk_probe(struct platform_device *pdev) regmap_write(map, 0x308, 0x12000); /* 3x3 = 9 */ /* P-Bus (BCLK) clock divider */ - hw = clk_hw_register_divider_table(dev, "bclk", "hpll", 0, + hw = clk_hw_register_divider_table(dev, "bclk", "epll", 0, scu_g6_base + ASPEED_G6_CLK_SELECTION1, 20, 3, 0, ast2600_div_table, &aspeed_g6_clk_lock); From patchwork Sat Oct 22 07:26: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: 7745 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1111051wrr; Sat, 22 Oct 2022 01:55:46 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5+VtgeXFK+Rzo4L/4ToIIK6ZRjgybNuDmg2ixWdWd9meQ86CTUZYb1BLZE29Fe0TSJgNZf X-Received: by 2002:a17:907:7607:b0:78d:66e8:c746 with SMTP id jx7-20020a170907760700b0078d66e8c746mr19348128ejc.220.1666428946802; Sat, 22 Oct 2022 01:55:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666428946; cv=none; d=google.com; s=arc-20160816; b=thC9qApB+1MAWdulQzGbDQRW+xzC0vvgaCD+dFn/j7LkirDe29TLNnahs07Rvwfm9Y lBWJQ3eRJSCmI+JFgcc+I53d7A1p0t2BY/1cmlV0dL7YGNjG9E3Z6VadwLW9apxWPxlO arnb1Hz3cHSFNe4SE+eJsBQK8DyLuT2RgLkHpIuzMjqvvApKx+AqZZ20GFodZnqiH9Z5 I8IcQV66qkGVEprz4HYLjEoNPYJ3AjLL21aguBbTSP3AbzxmiCGZ3uc8459WSz6Fs6a9 JaBGCo/8soYMTzzTpxgtm1KdWtH2w6rjXO7pIAwgEhtuXrNhRTCn+s6j/oukU47nQYq3 dS9Q== 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=3nSjuCAwduMBFtcaaKcXgEkc0vrdf1VD87ZjOSTdQa8=; b=FU6m2gSTPCAL/24fSVfqTQaaUdyF/DiWbRwI8hedc7H4GhRGMBd/eqZAWsEY2Iio6w VqGP70IIOJKmsXlA37/Ohu6zvDJZid6ZyLExzEY/La15VsbHAfRXQOYt2N4VRWN7F6xS kOooSXkpxuowIhmQnfJsfTmV5035WKeCd0XLFjTkJhb4cerXT0lGpGs8ag1ovsdbT95h LPpuaEiCgFek+w0hQeFYCg/X/F2ViWq6KiqPuaNe9iXqq2JRM2LBQmHrxAwB5U+b8vxk gmhpsLl9Xcy3SzX/BTJz8g9rOQ7TXCDgRJRxkeGevjBO57M7YhgW0FD3AK3RwEx2Z0Ab 3YPw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=R8aMO8m0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 fi18-20020a056402551200b0045a3b951e8bsi21019560edb.194.2022.10.22.01.55.22; Sat, 22 Oct 2022 01:55: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=R8aMO8m0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S234971AbiJVIxp (ORCPT + 99 others); Sat, 22 Oct 2022 04:53:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47134 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235018AbiJVIww (ORCPT ); Sat, 22 Oct 2022 04:52: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 2491536DC1; Sat, 22 Oct 2022 01:12:25 -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 48EDEB82DFF; Sat, 22 Oct 2022 07:57:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A228EC433D6; Sat, 22 Oct 2022 07:57:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425423; bh=QG5TJidSSe20q6w/U96C+IpsB/oyzh/jpVsc0UJamV0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=R8aMO8m0O9IZeiDwnNEt07fHFXnwCq8vCcPRJ0bCz92cxKCeHPwCCONCAHpptbdOb QMs4iXNV7d+liXHVn70SPFxjPY3V7wMMP+GOXYd/0bXAEtoJFqEgLYmInnZawth5g3 xDHc4fbz83dX159t8hg/JyGRyGcIABUX6J0kywbI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Conor Dooley , Jassi Brar , Sasha Levin Subject: [PATCH 5.19 489/717] mailbox: mpfs: fix handling of the reg property Date: Sat, 22 Oct 2022 09:26:08 +0200 Message-Id: <20221022072519.967045506@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747377399137711619?= X-GMAIL-MSGID: =?utf-8?q?1747377399137711619?= From: Conor Dooley [ Upstream commit 2e10289d1f304f5082a4dda55a677b72b3bdb581 ] The "data" region of the PolarFire SoC's system controller mailbox is not one continuous register space - the system controller's QSPI sits between the control and data registers. Split the "data" reg into two parts: "data" & "control". Optionally get the "data" register address from the 3rd reg property in the devicetree & fall back to using the old base + MAILBOX_REG_OFFSET that the current code uses. Fixes: 83d7b1560810 ("mbox: add polarfire soc system controller mailbox") Signed-off-by: Conor Dooley Signed-off-by: Jassi Brar Signed-off-by: Sasha Levin --- drivers/mailbox/mailbox-mpfs.c | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/drivers/mailbox/mailbox-mpfs.c b/drivers/mailbox/mailbox-mpfs.c index 4e34854d1238..e432a8f0d148 100644 --- a/drivers/mailbox/mailbox-mpfs.c +++ b/drivers/mailbox/mailbox-mpfs.c @@ -62,6 +62,7 @@ struct mpfs_mbox { struct mbox_controller controller; struct device *dev; int irq; + void __iomem *ctrl_base; void __iomem *mbox_base; void __iomem *int_reg; struct mbox_chan chans[1]; @@ -73,7 +74,7 @@ static bool mpfs_mbox_busy(struct mpfs_mbox *mbox) { u32 status; - status = readl_relaxed(mbox->mbox_base + SERVICES_SR_OFFSET); + status = readl_relaxed(mbox->ctrl_base + SERVICES_SR_OFFSET); return status & SCB_STATUS_BUSY_MASK; } @@ -99,14 +100,13 @@ static int mpfs_mbox_send_data(struct mbox_chan *chan, void *data) for (index = 0; index < (msg->cmd_data_size / 4); index++) writel_relaxed(word_buf[index], - mbox->mbox_base + MAILBOX_REG_OFFSET + index * 0x4); + mbox->mbox_base + index * 0x4); if (extra_bits) { u8 i; u8 byte_off = ALIGN_DOWN(msg->cmd_data_size, 4); u8 *byte_buf = msg->cmd_data + byte_off; - val = readl_relaxed(mbox->mbox_base + - MAILBOX_REG_OFFSET + index * 0x4); + val = readl_relaxed(mbox->mbox_base + index * 0x4); for (i = 0u; i < extra_bits; i++) { val &= ~(0xffu << (i * 8u)); @@ -114,14 +114,14 @@ static int mpfs_mbox_send_data(struct mbox_chan *chan, void *data) } writel_relaxed(val, - mbox->mbox_base + MAILBOX_REG_OFFSET + index * 0x4); + mbox->mbox_base + index * 0x4); } } opt_sel = ((msg->mbox_offset << 7u) | (msg->cmd_opcode & 0x7fu)); tx_trigger = (opt_sel << SCB_CTRL_POS) & SCB_CTRL_MASK; tx_trigger |= SCB_CTRL_REQ_MASK | SCB_STATUS_NOTIFY_MASK; - writel_relaxed(tx_trigger, mbox->mbox_base + SERVICES_CR_OFFSET); + writel_relaxed(tx_trigger, mbox->ctrl_base + SERVICES_CR_OFFSET); return 0; } @@ -141,7 +141,7 @@ static void mpfs_mbox_rx_data(struct mbox_chan *chan) if (!mpfs_mbox_busy(mbox)) { for (i = 0; i < num_words; i++) { response->resp_msg[i] = - readl_relaxed(mbox->mbox_base + MAILBOX_REG_OFFSET + readl_relaxed(mbox->mbox_base + mbox->resp_offset + i * 0x4); } } @@ -200,14 +200,18 @@ static int mpfs_mbox_probe(struct platform_device *pdev) if (!mbox) return -ENOMEM; - mbox->mbox_base = devm_platform_get_and_ioremap_resource(pdev, 0, ®s); - if (IS_ERR(mbox->mbox_base)) - return PTR_ERR(mbox->mbox_base); + mbox->ctrl_base = devm_platform_get_and_ioremap_resource(pdev, 0, ®s); + if (IS_ERR(mbox->ctrl_base)) + return PTR_ERR(mbox->ctrl_base); mbox->int_reg = devm_platform_get_and_ioremap_resource(pdev, 1, ®s); if (IS_ERR(mbox->int_reg)) return PTR_ERR(mbox->int_reg); + mbox->mbox_base = devm_platform_get_and_ioremap_resource(pdev, 2, ®s); + if (IS_ERR(mbox->mbox_base)) // account for the old dt-binding w/ 2 regs + mbox->mbox_base = mbox->ctrl_base + MAILBOX_REG_OFFSET; + mbox->irq = platform_get_irq(pdev, 0); if (mbox->irq < 0) return mbox->irq; From patchwork Sat Oct 22 07:26: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: 7705 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1109423wrr; Sat, 22 Oct 2022 01:48:27 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5E/VlRR9w2fMB8UQZS+hDsJCPZEwcqfZWPUOR7CyM95PxcLqIiiW9lS6ZoIKdT+ZplLd72 X-Received: by 2002:a17:906:9b94:b0:78d:b8a5:7493 with SMTP id dd20-20020a1709069b9400b0078db8a57493mr18578825ejc.530.1666428507140; Sat, 22 Oct 2022 01:48:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666428507; cv=none; d=google.com; s=arc-20160816; b=032GHkItZUo9aba/wSIFN8BaCjee8gTSMIQjRAkMwIZh5rIHPfjwhJyAwUSqFW3yHX uvBdohRlxhplNWbr1oVkN5JogDBE8kHK2SYdneb+QKnCI0eEmSlS2PBUfbz1cZSTiPZv mW19795yBVBV3HL07nqXjFn5PKyNhTlhAnd+3beX31CXiuoRNaLUT10O/cinqEH2YRZi 9dwn8t8cPug9kKhfP/gom1IqoKen3jqe6ohEWBFR0OpWUbNKAxxQNMOHtyxO8Dm9Od73 zoBfu8wVG3n9rt5KS6k4WVyS3jWlNBmU8Kgif5kxbfBFkvY8GzpLM4F+vI18QlIhoXFQ RyvQ== 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=xJzHFxIB5ABkFlipgr6KWm7rM26EFsRk2b6RS9pkBzY=; b=xm5IxsHRlpQY98P+O1A5+6M6jQKthLYWXcMKMaje+z25h/xHC1PsujJ87hksP37/6Z VauWrxvKWhgNSsGuqKaniEWRGc8vo0qRHmxx32I/PNMV0SaTd5G4nfwcMPwzlUW1FVCu DaaufpWY1xmnYhy5o6xzTeFzQ9uGXbvtwhs1CTkq13Z2Vmw/r9UO6HfWB+mdUMUHeSyu JDsmWNgdhq4P6lKB05FWLGmJerVu0mkV/V3E1NoCO5vQZhP6Mp6dHTxoUyV8Q4eHB9iD bsnbMgUmzh1FTPl0YJGcXXd88BZK9ejZzJamgv9B/KY5Ds5ZmobIW6glsqgjinbaODSD YbSw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=LLYMSF+H; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 d4-20020a05640208c400b004615d1d6b1dsi2455358edz.502.2022.10.22.01.48.03; Sat, 22 Oct 2022 01:48: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=LLYMSF+H; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S234661AbiJVIrf (ORCPT + 99 others); Sat, 22 Oct 2022 04:47:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40042 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235214AbiJVIoz (ORCPT ); Sat, 22 Oct 2022 04:44: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 DC3C62D5E84; Sat, 22 Oct 2022 01:08: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 CC77FB82E02; Sat, 22 Oct 2022 07:57:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 39F7EC433D6; Sat, 22 Oct 2022 07:57:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425456; bh=znIfOAw2qnyy3/KsoXWVQh5iihyrexv06scq5zFQkEo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LLYMSF+HXIHk0a0ILsJ8MWaq8L3Op5SmNS7uUCpCLrBimji7Xq4sE/kSzFRuwLXKe ooX8tYLTRQDoK7Z/2LqWFN51CQeP75fwbCxgT6AfumoMYsCe8Qkdi7S6Nsl51I5puL 9NxgclEk1JzEU7NmLx55j0ch3grwwPridXFNF0Hw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Conor Dooley , Jassi Brar , Sasha Levin Subject: [PATCH 5.19 490/717] mailbox: mpfs: account for mbox offsets while sending Date: Sat, 22 Oct 2022 09:26:09 +0200 Message-Id: <20221022072519.996543965@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376938050886291?= X-GMAIL-MSGID: =?utf-8?q?1747376938050886291?= From: Conor Dooley [ Upstream commit 0d1aadfe10ba17ebdeb96abb9638eb0f623f9b55 ] The mailbox offset is not only used for receiving messages, but it is also used by messages sent to the system controller by Linux that have a payload, such as the "digital signature service". It is also overloaded by certain other services (reprogramming of the FPGA fabric, see Link:) to have a meaning other than the offset the system controller should read from. When the driver was written, no such services of the latter type were in use & those of the former used an offset of zero so this has gone un-noticed. Link: https://www.microsemi.com/document-portal/doc_download/1245815-polarfire-fpga-and-polarfire-soc-fpga-system-services-user-guide # Section 5.2 Fixes: 83d7b1560810 ("mbox: add polarfire soc system controller mailbox") Signed-off-by: Conor Dooley Signed-off-by: Jassi Brar Signed-off-by: Sasha Levin --- drivers/mailbox/mailbox-mpfs.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/mailbox/mailbox-mpfs.c b/drivers/mailbox/mailbox-mpfs.c index e432a8f0d148..cfacb3f320a6 100644 --- a/drivers/mailbox/mailbox-mpfs.c +++ b/drivers/mailbox/mailbox-mpfs.c @@ -100,21 +100,20 @@ static int mpfs_mbox_send_data(struct mbox_chan *chan, void *data) for (index = 0; index < (msg->cmd_data_size / 4); index++) writel_relaxed(word_buf[index], - mbox->mbox_base + index * 0x4); + mbox->mbox_base + msg->mbox_offset + index * 0x4); if (extra_bits) { u8 i; u8 byte_off = ALIGN_DOWN(msg->cmd_data_size, 4); u8 *byte_buf = msg->cmd_data + byte_off; - val = readl_relaxed(mbox->mbox_base + index * 0x4); + val = readl_relaxed(mbox->mbox_base + msg->mbox_offset + index * 0x4); for (i = 0u; i < extra_bits; i++) { val &= ~(0xffu << (i * 8u)); val |= (byte_buf[i] << (i * 8u)); } - writel_relaxed(val, - mbox->mbox_base + index * 0x4); + writel_relaxed(val, mbox->mbox_base + msg->mbox_offset + index * 0x4); } } From patchwork Sat Oct 22 07:26: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: 7565 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1106059wrr; Sat, 22 Oct 2022 01:36:47 -0700 (PDT) X-Google-Smtp-Source: AMsMyM661W5KKK1xfZ4nw0zBFBUv0l5Kir21sCdZVVaUoz8jFB2oRr4n1W3MgsabBIRbIE9Idlu9 X-Received: by 2002:a17:90b:4b0c:b0:20d:7ffa:4b1b with SMTP id lx12-20020a17090b4b0c00b0020d7ffa4b1bmr61585571pjb.16.1666427806849; Sat, 22 Oct 2022 01:36:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666427806; cv=none; d=google.com; s=arc-20160816; b=lwgLdp3tKSCWOanCR65Ap4UG0PHF4W++kiANLkiN5o9mhjk9bDXIFjyD+N35zJQHTh Wn0hnufhWBh//xvlccbvg7yqEW1NhYpODRe3QkcUIupYWr3AG+l4AnXz3dtwIyKJ2LLP pQHFq/3KR45jY4YXOGYzBva2kjihP98bxFqdVio9y/YN1vqS3XCj2tp9RMPPL6HvYyuz /IQDDBmNPrD2c0Brdm6AxRATG5Uuayw2nDevzEYT9iNiHLPoFqDW7CFJ4eGLmaXEZ9Mv DTIU9i50yBnZB0dvkUtM6wR4PLkm/O5f7Ccnfocjc2y91RAtAnBY0BHPhT2i+PdLtgUH ajMQ== 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=FW5OnS587ciysSEyCoOCmInYNbaDeeqoIsizsVvMWS0=; b=oU+nQqiiyAwXsTZbQoNagGCEeTiHo2qvW1U7wQkNk/8QrbDd9IuzI7+YybdlsutP+X D/D8oMyjDaxBSMpGFUOT5UFlDVRsfSPwSvxz8udA3kELX4sRCRPoniSTu8vo2xlKUTuE j2BNqccPvMObLsor+FFEy97KaHxQm60dQ8IIMbLrJQE1UwhPAdJs6LsZRcqSdA6xit+K hMlULfOX66EWmAk9USM1VbjVO+xZuQB5h5aYjjih9tVgB27ejh/SqxkU1fekJqEsbGNt RPNJH2wasjm//IyKMxvwpak+vidPs3OixVsX4ZGGSPfJ+kR/JGaJ1t53wqiDC9mhMt/o eynQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=04SKokKW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 l191-20020a6391c8000000b00460358671e2si27154060pge.547.2022.10.22.01.36.29; Sat, 22 Oct 2022 01:36: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=04SKokKW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S233844AbiJVIVs (ORCPT + 99 others); Sat, 22 Oct 2022 04:21:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47398 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233499AbiJVIUK (ORCPT ); Sat, 22 Oct 2022 04:20: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 8B2623BC6A; Sat, 22 Oct 2022 00:58:37 -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 1A81D60B76; Sat, 22 Oct 2022 07:58:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0D03FC433C1; Sat, 22 Oct 2022 07:58:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425491; bh=PAWe9+sr/8pCcusCMevO9dufsJtfvbqu//B6LJb3YgQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=04SKokKWA5iMFYXrOEsi5sd/15nddZKrOgvyJG1cL5zJjm2Bleucfjlj6OzqxstHj 1yP2e678UtzBcE360jRLN696cDFq5jTN2CFNr4OL+Skcop8iQXvCSoTikG6MUMO/VU nYtwNATn1CCkWSlGi9dgigbyOBPb/nRW79GtSot4= 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 5.19 491/717] mailbox: bcm-ferxrm-mailbox: Fix error check for dma_map_sg Date: Sat, 22 Oct 2022 09:26:10 +0200 Message-Id: <20221022072520.035256552@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376203924966470?= X-GMAIL-MSGID: =?utf-8?q?1747376203924966470?= 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 22acb51531cb..658e47b21933 100644 --- a/drivers/mailbox/bcm-flexrm-mailbox.c +++ b/drivers/mailbox/bcm-flexrm-mailbox.c @@ -632,15 +632,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 Sat Oct 22 07:26: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: 7590 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1106334wrr; Sat, 22 Oct 2022 01:37:32 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6tIvrnyz2XgjR5l5i+x2YtIB4XtBbioWZcpXXodIegi32/8q7NOVN+poGz6GV/IxI2vBig X-Received: by 2002:a17:90b:1d0e:b0:20d:a61f:84b1 with SMTP id on14-20020a17090b1d0e00b0020da61f84b1mr54075414pjb.172.1666427851982; Sat, 22 Oct 2022 01:37:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666427851; cv=none; d=google.com; s=arc-20160816; b=CyXSAMForhyT8XKN1TTL/HdiXKbhPHQNNf1AGR361AfqFO5krZuZvzzZ2cNRMENKV+ gGjI+IEPFjIjeh5D+lGJFiZ/dZXpSbUe5zBuP6Ulpu+efQvx6hz695TnUyzO+sF8CXKM FCQPMV+HfO3BcefaPkFfNPnhWUmAcGe+s3ysXtQeLPZsvXgbDq0wlc0y1ybuABLjKWIn gG4p+fEF3ovU7eYnk2P5XyWyEPImXVXQoWTJEWSIczNp6mGH9ZEXrFQpqZSBRHvFqH4z 5JyyFn/K3SVlKEHReelTwPFRSX+tdHh2tyhyGP+6z3AndvrMpfzibl9jokZmhVu+4Aet y5lQ== 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=zReY4V2wRoelfSK5JEhicprgL6PGKrJbzzQm9rIR10o=; b=MwK1zEwaj1daUr4v2kTr9T/AYov88sv0nfvqS963yMmTTrcrNzugSaepyKl1/QdV86 oIvbBQsqoQmmAI2bl/M0Dz7/DSnK4hXP53r1nI9oLgrTnrVHcCEGDpUnLESMa54rebJy cHO8eTq+2LFEl9sqGbo2JlQMLAtgm48Q1nWSQ/oKoBDmTm4ugOM0oYJcOjWtmc23Ch9M qG3lsqVqfLa+UAIIHQA3PzjoINnUcq+z9oPbVwJcjInPv5+2E2jQMyx2AASlIk5L/hMG 3Rj0nIdFGrjXqaqcoEBM7pyPXGDmuOCA4kf1T/BrfUE/R3+SLthD/OOIb0k59sVkgDDA ZI1w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=JNvstZjk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 y1-20020a1709027c8100b00175430821b1si3736793pll.430.2022.10.22.01.37.17; Sat, 22 Oct 2022 01:37: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=JNvstZjk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S233339AbiJVIXi (ORCPT + 99 others); Sat, 22 Oct 2022 04:23:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46832 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233310AbiJVIVW (ORCPT ); Sat, 22 Oct 2022 04:21:22 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 774C146DAF; Sat, 22 Oct 2022 00: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 ams.source.kernel.org (Postfix) with ESMTPS id BCFC8B82E2E; Sat, 22 Oct 2022 07:58:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 30D7DC433D6; Sat, 22 Oct 2022 07:58:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425503; bh=6WiXUIWdNpTJTFRKsmuUuF0DqLK4FwROa9QJifzyzlM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JNvstZjkZyO/LdRxKWbaNCxOKH3bXM3F/6WH2NeasAzHnOs58/0+2zc66QOyfInTQ J9YPf3yVbKjHKKg2YqNlAtJAq/gb3dd+SFL0GBCr2zNpWtG12YDUvn+I2xGGXnMu5y GT89+ns63CipFZTrqH1mEysxqVeceKYCzrgAAlyU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hangyu Hua , "Eric W. Biederman" , Sasha Levin Subject: [PATCH 5.19 492/717] ipc: mqueue: fix possible memory leak in init_mqueue_fs() Date: Sat, 22 Oct 2022 09:26:11 +0200 Message-Id: <20221022072520.065627399@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376251344597644?= X-GMAIL-MSGID: =?utf-8?q?1747376251344597644?= From: Hangyu Hua [ Upstream commit c579d60f0d0cd87552f64fdebe68b5d941d20309 ] commit db7cfc380900 ("ipc: Free mq_sysctls if ipc namespace creation failed") Here's a similar memory leak to the one fixed by the patch above. retire_mq_sysctls need to be called when init_mqueue_fs fails after setup_mq_sysctls. Fixes: dc55e35f9e81 ("ipc: Store mqueue sysctls in the ipc namespace") Signed-off-by: Hangyu Hua Link: https://lkml.kernel.org/r/20220715062301.19311-1-hbh25y@gmail.com Signed-off-by: Eric W. Biederman Signed-off-by: Sasha Levin --- ipc/mqueue.c | 1 + 1 file changed, 1 insertion(+) diff --git a/ipc/mqueue.c b/ipc/mqueue.c index 12ad7860bb88..83370fef8879 100644 --- a/ipc/mqueue.c +++ b/ipc/mqueue.c @@ -1746,6 +1746,7 @@ static int __init init_mqueue_fs(void) unregister_filesystem(&mqueue_fs_type); out_sysctl: kmem_cache_destroy(mqueue_inode_cachep); + retire_mq_sysctls(&init_ipc_ns); return error; } From patchwork Sat Oct 22 07:26: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: 7538 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1105871wrr; Sat, 22 Oct 2022 01:36:24 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6pLBesihSqgDkFoJY84mYFU+OtNEV/oDv4+1ZgmZ7cvh/71YW+NTU/5JL7u7qvXz4RTBwy X-Received: by 2002:a17:90b:38d1:b0:20d:8f2a:c4c4 with SMTP id nn17-20020a17090b38d100b0020d8f2ac4c4mr60618039pjb.192.1666427784342; Sat, 22 Oct 2022 01:36:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666427784; cv=none; d=google.com; s=arc-20160816; b=U3Dskt+kG9ZKQHT4MxutoWXAdERPhTk6Y7JhuT8spx6aIJlWLnielmV62L0EgdFSHR qIODdw0VWMYjkZEooGBBw2sZtr6U8xCoZ3uhTqm08gwpJcu9A4mToP+ZNixMlrzFEARn wPlGbz2t0Cjgh8sCbvNM9mF0MVF2WtPRN3AM4xGOkfS7hef9X4NSqG6RaeX/rGpV0ImN Ie3w6bpwXrjpNFG9yanhJuH97Nmv/DOQxjWj8j73ez0G/0obLdEPVHUtio+/0SvMNyey CkYco6B6ici+jYJ0xHWCsCDSaR3Cfs9uhMVOuLz8tyV0y1bs2gIRb9d1KzcX1zb9ohYp kmEg== 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=boQam1fP1HcdDlBuavZdl3u9HRRqRG7gI7LtF1eD2Vs=; b=JFphtSYG+Ox+VoyvDQeEb+LeOXBnFZ6uO2bTTH0hpKnIDGCdaTaOqXESOHl9C+uQhI 6G+74xISJJIE4RO5N0Z9dTlhOlAjIcd7edLOZbDkQdIzNYS2n2QQ/pJJD3xhC0ONk5Rj puOAokPg5uYnlZfbvo9O608HGB5JP40Bwkn51FO8jK4zFlFTmTP+lQY5oc6r7lC+/N/x w42yC21BSY1fhuCsH2RIA7Nickb+mJ1/9IFy2y5r1Xnot5/K/IjHRPfZ1pSYgwWE0V+D /7t6+eWj51z8rNnjtwqFV69eJt+XEt+0tJKz8yoSqk7uHXpFAyysKuzPp1Pe80PlXAHj bQmg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=b3kfXn9f; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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-20020a63f618000000b00430b00f507dsi25767254pgh.430.2022.10.22.01.36.10; Sat, 22 Oct 2022 01:36: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=b3kfXn9f; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S229987AbiJVI0M (ORCPT + 99 others); Sat, 22 Oct 2022 04:26:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37070 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234052AbiJVIYi (ORCPT ); Sat, 22 Oct 2022 04:24:38 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E8CD05D881; Sat, 22 Oct 2022 01: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 dfw.source.kernel.org (Postfix) with ESMTPS id 29D3260B88; Sat, 22 Oct 2022 07:58:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 33089C433D7; Sat, 22 Oct 2022 07:58:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425506; bh=f0I55/u99pGYDq+p5TcYl8mlp27PqkFcOL+TYbcY9o0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=b3kfXn9fR4kZYL+gPt8xrU1oATBPZn58CqkOIl9Ka1+N/9KHIpvHjcZeQR/EOyyLI AwAffsBltF5Ne+oxvfpaen4cnAxNz/GGfkQEWf98RttihglgcDjSnQTwtJ9js2TkwY GLyVVLdSkUFFqegETaAwz9bJS11I4Dfge4zBtqMk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Michael Ellerman , Sasha Levin Subject: [PATCH 5.19 493/717] powerpc/configs: Properly enable PAPR_SCM in pseries_defconfig Date: Sat, 22 Oct 2022 09:26:12 +0200 Message-Id: <20221022072520.096335533@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376180725633776?= X-GMAIL-MSGID: =?utf-8?q?1747376180725633776?= From: Michael Ellerman [ Upstream commit aa398d88aea4ec863bd7aea35d5035a37096dc59 ] My commit to add PAPR_SCM to pseries_defconfig failed to add the required dependencies, meaning the driver doesn't get built. Add the required LIBNVDIMM=m. Fixes: d6481a7195df ("powerpc/configs: Add PAPR_SCM to pseries_defconfig") Signed-off-by: Michael Ellerman Link: https://lore.kernel.org/r/20220901014253.252927-1-mpe@ellerman.id.au Signed-off-by: Sasha Levin --- arch/powerpc/configs/pseries_defconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/powerpc/configs/pseries_defconfig b/arch/powerpc/configs/pseries_defconfig index b571d084c148..c05e37af9f1e 100644 --- a/arch/powerpc/configs/pseries_defconfig +++ b/arch/powerpc/configs/pseries_defconfig @@ -40,6 +40,7 @@ CONFIG_PPC_SPLPAR=y CONFIG_DTL=y CONFIG_PPC_SMLPAR=y CONFIG_IBMEBUS=y +CONFIG_LIBNVDIMM=m CONFIG_PAPR_SCM=m CONFIG_PPC_SVM=y # CONFIG_PPC_PMAC is not set From patchwork Sat Oct 22 07:26: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: 7695 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1109257wrr; Sat, 22 Oct 2022 01:47:45 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7VhMx0qZFY9hI549yJ601QA1K4HHnSfgRUBTU0cbqqAHeREFzJZAgfFBjpDUKD/p23dSi3 X-Received: by 2002:a17:907:2723:b0:78e:214b:e3c7 with SMTP id d3-20020a170907272300b0078e214be3c7mr19801595ejl.186.1666428465255; Sat, 22 Oct 2022 01:47:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666428465; cv=none; d=google.com; s=arc-20160816; b=qIjMpmXALB6XWXOtAMT+xzWxq9dCI//NSR/GPjaCqrz54O1hVzVOTfI+rhYw4OdlG0 4QJpar2/CoRtqzb8qvXUdxaeEoISOTCa0d6wk524WPglZCviXHBV72A52GrnCdalxDjO IsnLCoK1DtRNSka+gWMEydxPS8zI4yd5VAR1ENjLw+rtHCqpC0YEyd7QDL7FzBLxqD6s LJXDQu14Q4WDxW0MWTuvoOjjzWHvMgNbzlKYnYI+szeITmg2klqcfLrBHaG998GQbptD 4s+ONAtTr/g6nYTDSkLatO0gGiyS4ySCYwE7GoD7jlRaExIvg9DFQ1cry1Fzk0HlX36s gU5w== 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=VdDAP0eGeDgP9t5fUtoe9++sIfX8aGNyvRDuNDvBtQ4=; b=OgIzc6D4QIOUXCIFKwNxlw1i4q27wvR5XCyeGPeAT2VXuDJBItJt5cB6GjsnVzFs47 SVyvekdwI97h2jhF4vEJZ9Vir62grRKJm7CXAPb2lB9BymUx2cq17Q9ANUxw7ygT4Gkm qNEqRQ+7zIZOFXWBikceipGql0PjDpQkIPvFNwb0QVfk4oobylDbnHO479LrVwb8M3j0 RIveVS+fJbuHamVG8B2/t60GZPUERccziCb0uzWtGov0od9BJYbNCmkn8G4MidP5qzKT ZZt/6vLNaHPnuUNUqBi6pGjzVKZ9lqzJc2CvmgJ28MinXXW7Fc5MkZywLXIsGx0W5FE4 D0SA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=kDBUX6Kj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 go7-20020a1709070d8700b00792e39c31dcsi10355424ejc.988.2022.10.22.01.47.21; Sat, 22 Oct 2022 01:47: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=kDBUX6Kj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S234220AbiJVIqo (ORCPT + 99 others); Sat, 22 Oct 2022 04:46:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52870 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235022AbiJVIoR (ORCPT ); Sat, 22 Oct 2022 04:44:17 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 695DCB878E; Sat, 22 Oct 2022 01:08: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 D3533B82DF3; Sat, 22 Oct 2022 07:58:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 300B8C433D6; Sat, 22 Oct 2022 07:58:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425509; bh=sc+YbobDr/tEqzXPDL3b8fTi2QPNYaqR8xdhG6QRLxo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kDBUX6Kj/hNx4G7EXAVgHBA535FL567yJOyLDIm5eQMr0OEt8nWQvtNr3xsd5gth7 E7iFgvzyL/uJmjM3A9p4JQVwQk0YAdcDJzG10nrZ1S7GueWRX+2PiIkizaAyaVjvKv HXs2BDdmK3e2VpvO0nj1Pmg9lN+5lMpobwtwC37A= 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 5.19 494/717] powerpc/math_emu/efp: Include module.h Date: Sat, 22 Oct 2022 09:26:13 +0200 Message-Id: <20221022072520.126748270@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376894808546624?= X-GMAIL-MSGID: =?utf-8?q?1747376894808546624?= 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 39b84e7452e1..aa3bb8da1cb9 100644 --- a/arch/powerpc/math-emu/math_efp.c +++ b/arch/powerpc/math-emu/math_efp.c @@ -17,6 +17,7 @@ #include #include +#include #include #include From patchwork Sat Oct 22 07:26: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: 7812 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1140292wrr; Sat, 22 Oct 2022 03:25:00 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5Pj5DKnUOHouF08rmBC63dcfH/k9q1McxLHCwgno8/gksxOXA4yWskI6p88IsG6g0aPBlf X-Received: by 2002:aa7:c78d:0:b0:454:fe1d:8eb1 with SMTP id n13-20020aa7c78d000000b00454fe1d8eb1mr21466206eds.59.1666434300395; Sat, 22 Oct 2022 03:25:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666434300; cv=none; d=google.com; s=arc-20160816; b=h+MNB79xjTKg0EHlx4/3hVNWUk8d8NfGrdIKiuk/l2wjUryf1s0lDzNi5w2h2nGQTF M+PY3bkeN9e3w9Q/eCXvtU/8McDJTTkEK8RQKa7sKJp3WfqR/wYjbiwiU5xTQs0nGVQj qCnitDXoMgZWBsXcpb14sI8GAkk+zz5xNGZW/hU1z1KogpqlUJcYMhQO1sQ+F6LJB4ls vQgYDgUYkj730RH0TRgCy8zsZSsDaa58dM/ySPTAKkgEcZ90MjLOidv8zSSHjVEEIROL IYr4KjZJwCAhFd+sQVvnelv+Rf/aPygeTTTmTleUxqwDos/TUyAoydmdkF4gdTTdtR4S EK3Q== 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=y9zKNt0Fgj+6W8NaXtiNXEZ5AdriOp709K78Ief3jZI=; b=LBV1rLLXjI8VKJC14/H6uIVerVBWCmqcMvI8XU3n4Ta9OdGTrAwCCdmzQaHaAtFla0 ZUei7j0kP0jEQxm0TI2NtHsH0ur05ViZ2fqPCtVhaKlHwMxEvspOVmab+veRynw1gFwo YS4AGqzZfxtnmb+3f+ggbbZLfmiKyRaA9LjqHcpa4OUCDsmQAhjssVISwTekoqs+W7Du PzE8gs9py2UG6DG0UyXKPzfZ2ewAHONOTJsJ80RpB4Bm1s9VcGD3BB20pAsEJgXRJuEY G1qtMzpO1En+IJaIpJdigxnuLWRUdNmlt59KIeQd3vr85vPgu07Nr27sCjG7t3no7W5x p9sg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=zzPUGc8q; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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-20020a50ef18000000b004615b657cbcsi2662083eds.190.2022.10.22.03.24.36; Sat, 22 Oct 2022 03: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=zzPUGc8q; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S229574AbiJVKRo (ORCPT + 99 others); Sat, 22 Oct 2022 06:17:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53286 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230305AbiJVKRV (ORCPT ); Sat, 22 Oct 2022 06:17: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 F087F2EA8E7; Sat, 22 Oct 2022 02:34: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 2E7F460B28; Sat, 22 Oct 2022 07:58:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 24249C433B5; Sat, 22 Oct 2022 07:58:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425512; bh=3a6Ezfk5Xd230UoZ6JDDW0SFulTzd9ZULyx1GhQQxWU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zzPUGc8q3jcPb9/C+R0CxzcdwJLrmX89NkHKmbj4pEbRucLn8ppJDrrT9O6s8aHJU jdqf8A9ZN881SGaVmyvFSUhj3/mr2Nz/bXhn+UHtStwWEhxZq73Tibbk7zzwFjT3f0 q01Lmy4Ysc5QUYL8H/cTi/zPsUK50QMmcY/EjPDE= 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 5.19 495/717] powerpc/sysdev/fsl_msi: Add missing of_node_put() Date: Sat, 22 Oct 2022 09:26:14 +0200 Message-Id: <20221022072520.158922735@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 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?1747383012833111301?= X-GMAIL-MSGID: =?utf-8?q?1747383012833111301?= 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 ef9a5999fa93..73c2d70706c0 100644 --- a/arch/powerpc/sysdev/fsl_msi.c +++ b/arch/powerpc/sysdev/fsl_msi.c @@ -209,8 +209,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); } msi_for_each_desc(entry, &pdev->dev, MSI_DESC_NOTASSOCIATED) { From patchwork Sat Oct 22 07:26: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: 7591 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1106318wrr; Sat, 22 Oct 2022 01:37:30 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6apaVPmv7YK2MJnNcE9ltNJIsqJ7uU4EK8+7LENltOGL5bP4Gmq/wxBooTKol3IhrlFIHT X-Received: by 2002:a63:f91e:0:b0:456:ccc4:85c2 with SMTP id h30-20020a63f91e000000b00456ccc485c2mr19358141pgi.624.1666427850057; Sat, 22 Oct 2022 01:37:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666427850; cv=none; d=google.com; s=arc-20160816; b=dmBS36cjjTbT1RUk0rWTf1JgRkJGsp1TC+ELMc1AC6JnVah8NbmjuqBsp2zIH9JV46 4Ioq0xGP2oqEAOnRhlkTQ1N2NLSwLCn/tbUW0U9rAv+sS1Rb8w0d2RfN7raNK9ZVjEYD +J5/9wsisD+WfA1cuXKALh8/YaQtFH0w936O6xJrbRdPfi5ZdTFr1iFIenDmwSkf6PU/ 4aFJRIr1sKTYviqUvBpDuJ3fyXVrS/2fM8PBXEgiJaRqyNJP4OvwVzN9k+VkRWo3RX5m KuvYYx54rOIdiGZgcPJHYTqyUcBb6+F4SOLr6ZScu6BSZdt71viziLTTxwGH7P2qMMIq 1Thw== 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=c158FeTc6/i7JKDsfCRcTrft+Z3vhDrbM/ojlGmUDYI=; b=wVTje7AH3FxU1GvfAs7jDTEAjk/vLqNcr0XDI/bTHjx8E1nPSRN9oE0eBqEP3uQnST 9Dgxq0s7ul1dO1OnDl+ELjBoKjIP/67V2eVFpaXU/e7TbPQjprJtkpKaR8DFNFZN0N12 7h8FUKB1Nl52HlInQDSsbZcVBvKULairI9bHcEWJe23cIOAgqjP0H6lEgEOIYIGMFw9p i5F6iHIPEPs9AEDv/u1q77Ws7fqm0nRg3DsLie0Kz5nwFwmpvu0yvTR9zREg9YWanDPP EQ+n8qPHyabgd3rDE2jtyWDgZM69XhVgolATOQtODVYzd+WHBRgjWsHG4cWoiJH6RF9F tz7Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=WAAZodWh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 mw16-20020a17090b4d1000b0021071bf8d26si10716855pjb.29.2022.10.22.01.37.15; Sat, 22 Oct 2022 01:37: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=WAAZodWh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S233755AbiJVIXt (ORCPT + 99 others); Sat, 22 Oct 2022 04:23:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57960 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233630AbiJVIWK (ORCPT ); Sat, 22 Oct 2022 04:22: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 6FBEC7295E; Sat, 22 Oct 2022 00:59: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 AE057B80E4D; Sat, 22 Oct 2022 07:58:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1CD3AC433C1; Sat, 22 Oct 2022 07:58:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425515; bh=b7LpL8C/41SiR/ZzlbJOp5syACJkyE/krPpmkVYkMlw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WAAZodWhLV7K97IvJJhnH8VWYkH4RmP02NUOsku3sevSvEjGoSAF5G635ZYJ/lmLv HvQ6dcfnXlNzsjKiLZBPomDfDGS1c07YMjwcpMJDG355TOPGL04JMsl/J0DLCAwWlt BzFzTmOCM/H7RCUiumnlfA1K9g3stFPkTcbRkq54= 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 5.19 496/717] powerpc/pci_dn: Add missing of_node_put() Date: Sat, 22 Oct 2022 09:26:15 +0200 Message-Id: <20221022072520.200835290@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376249317701415?= X-GMAIL-MSGID: =?utf-8?q?1747376249317701415?= 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 938ab8838ab5..aa221958007e 100644 --- a/arch/powerpc/kernel/pci_dn.c +++ b/arch/powerpc/kernel/pci_dn.c @@ -330,6 +330,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 Sat Oct 22 07:26: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: 7585 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1106326wrr; Sat, 22 Oct 2022 01:37:31 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6+CUl4ACYkUklXKhM9YT/xsmanwEGYAeq1N64osh9lygff9SEYVeETuYGHWLpr3xYDxVAd X-Received: by 2002:a17:90a:8988:b0:212:e1b9:e8fd with SMTP id v8-20020a17090a898800b00212e1b9e8fdmr2697574pjn.148.1666427851343; Sat, 22 Oct 2022 01:37:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666427851; cv=none; d=google.com; s=arc-20160816; b=RMULLX8jlBkes04KSgqgsPyQ92eTy5O3Obw8I+tiU4Oe+Vzzi/j83EVzHFoWzmOWC+ iJsOyqwlfzr1pJwwDtX7KxHlIryPh+RXk+DYHf+fF5HR/yWwcrfY+30HAG1PnZgpb0Rb L7BMOCUTrcpcE86nOD/IJw/lT5WYTlEetvkH4/PJ+MqKYYDi7NVp1mlj6LDlT/dlDPj/ Zp4btNk8QwRFUQbqI3yza9rd53q5tLX3lEG+D0nDX9ae6DWrWdoOwENwU83pFOoiZC8J vkeU6p/7t2AIH7cRp0OQuFHNYis9f08RtcYx4URacD9miKZvXbeKTXrK8M9KHJivYCf/ 4p/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=1GMx6OuFidB3j1RSaOH1gvLOJiKUKowCpwylL/pAduQ=; b=fQQkqSxAFkxRTl0Cy7SHhKB9wiiKsOlKGZSk2pz0l9tNIewv9nd1l7eduw1RjR1Brw DOxGhLaqxM8t1AqpjAT9XHJt84fch4tvG5Fb84GK/lPexrIWSorKtzj4AMUK4aKYbuB9 bsiiyEHB0PyRClqh98S4k9hiPd0SuIWy+mVE7uc96oSSmtjzJEi6L0DQMEiAYVXNwugd tJZD6B/m8QpLhSh4/sp5gPgHGWfFFVMyMplTWZQKf3FPncIbwoaJ+w+zjvH3T8/0mDSl tOLqTXSeRn50ivHq8Mk/XcEmBu2AAeNIwtGEIxLjG6PomolcLFIUjHqV9EBMv/jCPNUI QGnw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=dwiNyuxj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 j5-20020a63b605000000b00450b99448b0si27005452pgf.341.2022.10.22.01.37.17; Sat, 22 Oct 2022 01:37: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=dwiNyuxj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S233725AbiJVIWr (ORCPT + 99 others); Sat, 22 Oct 2022 04:22:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44336 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233717AbiJVIU4 (ORCPT ); Sat, 22 Oct 2022 04:20:56 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D461937F9F; Sat, 22 Oct 2022 00:58: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 22F2460B8C; Sat, 22 Oct 2022 07:58:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1463BC433C1; Sat, 22 Oct 2022 07:58:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425518; bh=MzqN5J3LzkgF+sMfK6atxZHurz4IuMxAyc9YhNaRH90=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dwiNyuxjS3q2ElTURGtps1/ecY6NUqkiIysu7pPe8ZETlsyl7+9xU4vizj8+CBE4D /hHXwMuqIuy1kJM2o+27dE2BJdioVa074F0famm8yljbKpC/ytFoDliqIY7gFYZzfF JDnjMl+t+E6k3JCHQtBtiZ3JPiImvdyKLM9ugxss= 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 5.19 497/717] powerpc/powernv: add missing of_node_put() in opal_export_attrs() Date: Sat, 22 Oct 2022 09:26:16 +0200 Message-Id: <20221022072520.249526274@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376251034810061?= X-GMAIL-MSGID: =?utf-8?q?1747376251034810061?= 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 55a8fbfdb5b2..3510b55b36f8 100644 --- a/arch/powerpc/platforms/powernv/opal.c +++ b/arch/powerpc/platforms/powernv/opal.c @@ -892,6 +892,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 Sat Oct 22 07:26: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: 7822 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1143033wrr; Sat, 22 Oct 2022 03:33:27 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5LQ+risMx6IbuNIOZKwGVIRAX4F8nVjZQd+7MfPOOgcMLzukKI0Uerf51Bs7yweLZRiH/I X-Received: by 2002:a17:906:6a17:b0:794:f0e8:1918 with SMTP id qw23-20020a1709066a1700b00794f0e81918mr13892471ejc.474.1666434807294; Sat, 22 Oct 2022 03:33:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666434807; cv=none; d=google.com; s=arc-20160816; b=IlldAzAIXDXNjoh/C8PWT7jaN4C0Y6coz/ab5vXIWSQvPlsO8Su89o5/8W0LUCpQ4H ki/nU8k9ACwoG9L9zCHpLmYAUKJoDgREFmRdwfXxuV4dArJdujDnGAqqFPmXiqemsetV c8cNDXx8lcd/Dh/DOT2DqpkVVd6/PYB/TeXsxGAhRNr8AhDwaGwkXohntI7qbb+c24gt 78HCqxPl6KTqJMbZklojeelVendVG/MUNAHKbvnIjPQco1QxJyr9cxiq3fPeN/b1Bsc4 kXDaLLeEGacdL0u0B2UrBMghbd6XUq9AgHNyNuvYHXEXaNa4jtQ7XewKmIi+OPTlHsny zIkw== 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=1QOQ5NG5iPgRBrdDlsm5zTSP2UOmpOfM3EYQGq2yfR8=; b=IFb1slT70ZA73LVn+nN0EYJmTcnmNre8pgqZ5omlcJPd3Ye+Laal9WHv5f5nrCzuT0 4zdhrgJr/uprbsYv3A9bJCuZhDWXO7vh3KD5bW2/DapcxP0fT1NEQRRqhUCryISDOkJd k9WjxoveuaLzgN9TvSBjR4YFVExKv/2fy/x8wRd9K3pDdZWjAVD2Ek0/ic3dud4O0UfO CnpzX1n9ovjQHtXAZmBnAOn728UXK/NuO3IcAuzrQin2o8r0h0y2Vm73IpGBTEubCdMv 2jYUDDOG9IlyNhALydoYTlbG/xi/Pq/QvniYpGFoVQptfJ+ha0vELO/s1M63mArFV48f 8q8Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=SV9MakjA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 b2-20020aa7d482000000b00459060fcde3si19961291edr.202.2022.10.22.03.32.56; Sat, 22 Oct 2022 03:33: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=SV9MakjA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S230057AbiJVKbm (ORCPT + 99 others); Sat, 22 Oct 2022 06:31:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54468 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230338AbiJVKbX (ORCPT ); Sat, 22 Oct 2022 06:31: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 772D62E00A7; Sat, 22 Oct 2022 02:47: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 5E4B2B82DF8; Sat, 22 Oct 2022 07:57:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 95811C433D6; Sat, 22 Oct 2022 07:57:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425426; bh=r0iJe32ob/GSHTmdUuVBkNeqx/9YvNjYROZ+D4DgXUg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SV9MakjAkT46H87yoXwgyrSHpLQ4n+HncD1PRp0hALX0Mn38tFXiCvMgowyfxiOiZ T6wnXRPq9c2Exn6kg4LXY8rBx/9srKBkpaPdCYO13ZwgexFpKggxgsfKUWPrAERgxZ ATOS1zBJ+nY5eBMNoJ+NZ1I/kCSOo/T6xpIuhKpQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Anup Patel , Andrew Jones , Palmer Dabbelt , Sasha Levin Subject: [PATCH 5.19 498/717] cpuidle: riscv-sbi: Fix CPU_PM_CPU_IDLE_ENTER_xyz() macro usage Date: Sat, 22 Oct 2022 09:26:17 +0200 Message-Id: <20221022072520.297041515@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 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?1747383544354952918?= X-GMAIL-MSGID: =?utf-8?q?1747383544354952918?= From: Anup Patel [ Upstream commit cfadbb9df8c4dc917787da4458327e5ec14743d4 ] Currently, we are using CPU_PM_CPU_IDLE_ENTER_PARAM() for all SBI HSM suspend types so retentive suspend types are also treated non-retentive and kernel will do redundant additional work for these states. The BIT[31] of SBI HSM suspend types allows us to differentiate between retentive and non-retentive suspend types so we should use this BIT to call appropriate CPU_PM_CPU_IDLE_ENTER_xyz() macro. Fixes: 6abf32f1d9c5 ("cpuidle: Add RISC-V SBI CPU idle driver") Signed-off-by: Anup Patel Link: https://lore.kernel.org/r/20220718084553.2056169-1-apatel@ventanamicro.com/ Reviewed-by: Andrew Jones Signed-off-by: Palmer Dabbelt Signed-off-by: Sasha Levin --- drivers/cpuidle/cpuidle-riscv-sbi.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/cpuidle/cpuidle-riscv-sbi.c b/drivers/cpuidle/cpuidle-riscv-sbi.c index 1151e5e2ba82..33c92fec4365 100644 --- a/drivers/cpuidle/cpuidle-riscv-sbi.c +++ b/drivers/cpuidle/cpuidle-riscv-sbi.c @@ -97,8 +97,13 @@ static int sbi_cpuidle_enter_state(struct cpuidle_device *dev, struct cpuidle_driver *drv, int idx) { u32 *states = __this_cpu_read(sbi_cpuidle_data.states); + u32 state = states[idx]; - return CPU_PM_CPU_IDLE_ENTER_PARAM(sbi_suspend, idx, states[idx]); + if (state & SBI_HSM_SUSP_NON_RET_BIT) + return CPU_PM_CPU_IDLE_ENTER_PARAM(sbi_suspend, idx, state); + else + return CPU_PM_CPU_IDLE_ENTER_RETENTION_PARAM(sbi_suspend, + idx, state); } static int __sbi_enter_domain_idle_state(struct cpuidle_device *dev, From patchwork Sat Oct 22 07:26: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: 7546 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1105889wrr; Sat, 22 Oct 2022 01:36:26 -0700 (PDT) X-Google-Smtp-Source: AMsMyM51jSmUATZDsvIXge4CI0W6EpU7cVc/1c3c3hg3t4tjtrlCTbwbI1We8GChivBzoE/9y9Ay X-Received: by 2002:a05:6a00:301c:b0:567:6e2c:45f0 with SMTP id ay28-20020a056a00301c00b005676e2c45f0mr19729579pfb.84.1666427786568; Sat, 22 Oct 2022 01:36:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666427786; cv=none; d=google.com; s=arc-20160816; b=wSb0NCQdjjVaCeJynn6TVJ0zhporMnYhuMAPNPbHUuYAqroLwBv8cx5M9v9EuQdKjF p0H/T2q1DP48p3S/keZw1ioPmrYI03OujElSi+H89YAfrYsLajZAeX8Q3liJuI/t7IU7 GpFp5eM7XnjMCLSQ82cI1BVAsloUY1655mAHGE1TuR+aG/YxQuxOV9GMh5Yew9o3POd2 bpSrHoB2rKqvx3KfUKgsc3uw87Pptls2LMM+eTPy2ceDIe7SwatWHX7UIb9k2jtgYa1e +gsSLKY4H7sBwObOUBrid+63UUl9mAbf5CdWYt8gGus0FJXEZ3xGaiycL3c1tGo3H/E6 HUcA== 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=qp55gMiZm6q14YK0ixU2VQwhkvmz2OwXf0ZTkmZZ4jA=; b=Qz/WmrDJpp0up2ENNqkl9QsJ9BSgHmMhUjudgr5OHGJ/uEOu3Pfqkw8aFBf0zNqbft RtzAMlmJZWZgXdj5+kgUJPovXIgAXLujlvHf3ScnrrsIr+6+MblU3xrg6qpJB+Lgu8Aw FKBavRP01qgis+TpsMc23g+LylQN6fj7oCC+84f95xkNMS/6ezK4zlQWlLv43OO5Ugvo 9naGdPT7gRUb2xBt3wAu0Qq4+4gMCUL1wSYSPb7aSzqwMHE8oN38YGTRZp883FjcHYB4 rUoVzigk7bGjwXxetv17APWB5lr84MBwjk3vdQmlyHmj+SOcJWP6tAm03ZXFmJ07iJOL hWsA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="sZwUK/eN"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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-20020a170902eccb00b00176db576dc0si33535273plh.147.2022.10.22.01.36.12; Sat, 22 Oct 2022 01:36: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="sZwUK/eN"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S233874AbiJVIXw (ORCPT + 99 others); Sat, 22 Oct 2022 04:23:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48930 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233586AbiJVIWK (ORCPT ); Sat, 22 Oct 2022 04:22: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 EE3B0836C8; Sat, 22 Oct 2022 00:59: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 9B01960ADE; Sat, 22 Oct 2022 07:57:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A801FC433D6; Sat, 22 Oct 2022 07:57:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425429; bh=gjDljZl/wvRQcLjS5e2kmaL29MSYEY38YuRzoP9nEaE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sZwUK/eNDOt+o7fFrUwWYdBlyeVVMmbVw7MvNlZRp3aCZBBWw/hwD+g9Qv9IdZWjS Rhigb1RQMS1lEzP2ahEEMiaVdKOwlAyrad5wFKQQrOS98s106vaRKk38VxapDBOeu/ C2Hc3K1B6ll3+5irMij0SFfN94MKmYajBZrhK+ek= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Arnd Bergmann , Rohan McLure , Nicholas Piggin , Michael Ellerman , Sasha Levin Subject: [PATCH 5.19 499/717] powerpc: Fix fallocate and fadvise64_64 compat parameter combination Date: Sat, 22 Oct 2022 09:26:18 +0200 Message-Id: <20221022072520.337094485@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376182484681283?= X-GMAIL-MSGID: =?utf-8?q?1747376182484681283?= From: Rohan McLure [ Upstream commit 016ff72bd2090903715c0f9422a44afbb966f4ee ] As reported[1] by Arnd, the arch-specific fadvise64_64 and fallocate compatibility handlers assume parameters are passed with 32-bit big-endian ABI. This affects the assignment of odd-even parameter pairs to the high or low words of a 64-bit syscall parameter. Fix fadvise64_64 fallocate compat handlers to correctly swap upper/lower 32 bits conditioned on endianness. A future patch will replace the arch-specific compat fallocate with an asm-generic implementation. This patch is intended for ease of back-port. [1]: https://lore.kernel.org/all/be29926f-226e-48dc-871a-e29a54e80583@www.fastmail.com/ Fixes: 57f48b4b74e7 ("powerpc/compat_sys: swap hi/lo parts of 64-bit syscall args in LE mode") Reported-by: Arnd Bergmann Signed-off-by: Rohan McLure Reviewed-by: Arnd Bergmann Reviewed-by: Nicholas Piggin Signed-off-by: Michael Ellerman Link: https://lore.kernel.org/r/20220921065605.1051927-9-rmclure@linux.ibm.com Signed-off-by: Sasha Levin --- arch/powerpc/include/asm/syscalls.h | 12 ++++++++++++ arch/powerpc/kernel/sys_ppc32.c | 14 +------------- arch/powerpc/kernel/syscalls.c | 4 ++-- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/arch/powerpc/include/asm/syscalls.h b/arch/powerpc/include/asm/syscalls.h index a2b13e55254f..da40219b303a 100644 --- a/arch/powerpc/include/asm/syscalls.h +++ b/arch/powerpc/include/asm/syscalls.h @@ -8,6 +8,18 @@ #include #include +/* + * long long munging: + * The 32 bit ABI passes long longs in an odd even register pair. + * High and low parts are swapped depending on endian mode, + * so define a macro (similar to mips linux32) to handle that. + */ +#ifdef __LITTLE_ENDIAN__ +#define merge_64(low, high) (((u64)high << 32) | low) +#else +#define merge_64(high, low) (((u64)high << 32) | low) +#endif + struct rtas_args; asmlinkage long sys_mmap(unsigned long addr, size_t len, diff --git a/arch/powerpc/kernel/sys_ppc32.c b/arch/powerpc/kernel/sys_ppc32.c index 16ff0399a257..719bfc6d1e3f 100644 --- a/arch/powerpc/kernel/sys_ppc32.c +++ b/arch/powerpc/kernel/sys_ppc32.c @@ -56,18 +56,6 @@ unsigned long compat_sys_mmap2(unsigned long addr, size_t len, return sys_mmap(addr, len, prot, flags, fd, pgoff << 12); } -/* - * long long munging: - * The 32 bit ABI passes long longs in an odd even register pair. - * High and low parts are swapped depending on endian mode, - * so define a macro (similar to mips linux32) to handle that. - */ -#ifdef __LITTLE_ENDIAN__ -#define merge_64(low, high) ((u64)high << 32) | low -#else -#define merge_64(high, low) ((u64)high << 32) | low -#endif - compat_ssize_t compat_sys_pread64(unsigned int fd, char __user *ubuf, compat_size_t count, u32 reg6, u32 pos1, u32 pos2) { @@ -94,7 +82,7 @@ asmlinkage int compat_sys_truncate64(const char __user * path, u32 reg4, asmlinkage long compat_sys_fallocate(int fd, int mode, u32 offset1, u32 offset2, u32 len1, u32 len2) { - return ksys_fallocate(fd, mode, ((loff_t)offset1 << 32) | offset2, + return ksys_fallocate(fd, mode, merge_64(offset1, offset2), merge_64(len1, len2)); } diff --git a/arch/powerpc/kernel/syscalls.c b/arch/powerpc/kernel/syscalls.c index fc999140bc27..abc3fbb3c490 100644 --- a/arch/powerpc/kernel/syscalls.c +++ b/arch/powerpc/kernel/syscalls.c @@ -98,8 +98,8 @@ long ppc64_personality(unsigned long personality) long ppc_fadvise64_64(int fd, int advice, u32 offset_high, u32 offset_low, u32 len_high, u32 len_low) { - return ksys_fadvise64_64(fd, (u64)offset_high << 32 | offset_low, - (u64)len_high << 32 | len_low, advice); + return ksys_fadvise64_64(fd, merge_64(offset_high, offset_low), + merge_64(len_high, len_low), advice); } SYSCALL_DEFINE0(switch_endian) From patchwork Sat Oct 22 07:26: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: 7741 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1110659wrr; Sat, 22 Oct 2022 01:53:38 -0700 (PDT) X-Google-Smtp-Source: AMsMyM72O+fAM3FCJU0IpBCrsGOj5ioL5wCNwCVpMPof2Qt4t7+CVJBhvJyIBYcVyfj5lw6eOyaH X-Received: by 2002:a05:6402:168c:b0:458:5b8b:afd2 with SMTP id a12-20020a056402168c00b004585b8bafd2mr21081878edv.357.1666428818759; Sat, 22 Oct 2022 01:53:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666428818; cv=none; d=google.com; s=arc-20160816; b=aIknRP4N4bd+1xxbDgAGCSBChzqVGbzt1wexFHagGGdxGueGEDjo/Q3oWty8eTn76l wzaefl4gp4M7R5oaRPZAB8ioaDfBcVeBY+qrQ6lY5mmLhYapyQEe9e+63wIX6JQFgcEj l4a+JihED1LXfJa+g9HOwOdYDfK6mnF34JzfL+l+KuGi0xmxXv0IKiAjRBMyoAZHkkkZ noK4Fjfh/GVc0pWYwBC6e7F/kCNe2xaNg1/7gcerVGnoHCZ1zGkSMtaDal2xjpfLwsA8 nBUailpqVZ5yxvrA0QogLlLj4NFNp4y+T+WYB8zBPiYSjoWbcHvTNRVkbxw7hQMTynWt GRfw== 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=joEPKpTa+uxNk9vVTRrWEAoMQ3DGHGrnvbhFNDD5Bro=; b=AObmOoEsEG8ooV1SksqtnktlMtVdDdYi/Ge89mSC/1GU9OVHwMSbM1qOADeCBMNizO OCQL6xxvrP8E7Sq0F+QAE6PMJceJvK+n+fah5zHlayeB22lQQ2+jeNznrYJ7VtPm6gyH YCXmsO8/Ot2K7v7K/D+l5w+E0ntg4BBjthAruSR+FeIzsNK7FK1DngWJGYHY8UfveEOt AYk8QVRFBeMSNrlxGIHBEPFhW2CHtMx9FkSLIJcjqe+Adr+thewCZQn/Qd0zisJkZPvY 5QxtP7YSBDZq9JCNbNnyZPSV4PYA64bwfFN/asPPDfk5vnLheCYU1wgfWNNyzdsFJvhw R0+A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=1v3Ygibu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 d13-20020a056402400d00b0044ea553d7cdsi7293210eda.105.2022.10.22.01.53.15; Sat, 22 Oct 2022 01:53: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=1v3Ygibu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231903AbiJVIwX (ORCPT + 99 others); Sat, 22 Oct 2022 04:52:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38062 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234313AbiJVIvb (ORCPT ); Sat, 22 Oct 2022 04:51: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 775722F0DCC; Sat, 22 Oct 2022 01:11: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 ams.source.kernel.org (Postfix) with ESMTPS id 8290EB82E12; Sat, 22 Oct 2022 07:57:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B9AD2C433D7; Sat, 22 Oct 2022 07:57:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425432; bh=P6mrvCB9xhdjNaQd5esO9PzJUs/Txx/H4cT1nbvnes4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1v3YgibuygT9wGSAlSIbMJNZzrOFAXudvdbP0PzHWCG/DJrdHKs8iqqGSH5c6u2Ds Mh6dM/CacbTlSjzWqB4rMjmwxlXKdeUU6zsVguoZ6hgb8SuiIGbBFJbQAZiE16aVqX xMXfSVXjPHhxdXCAGPKvFcUoYyKX3rWa2uGGVdbw= 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 5.19 500/717] x86/hyperv: Fix struct hv_enlightened_vmcs definition Date: Sat, 22 Oct 2022 09:26:19 +0200 Message-Id: <20221022072520.372130740@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747377264954485000?= X-GMAIL-MSGID: =?utf-8?q?1747377264954485000?= 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 0a9407dc0859..6f0acc45e67a 100644 --- a/arch/x86/include/asm/hyperv-tlfs.h +++ b/arch/x86/include/asm/hyperv-tlfs.h @@ -546,7 +546,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; @@ -554,7 +554,7 @@ struct hv_enlightened_vmcs { u32 reserved:30; } __packed hv_enlightenments_control; u32 hv_vp_id; - + u32 padding32_2; u64 hv_vm_id; u64 partition_assist_page; u64 padding64_4[4]; From patchwork Sat Oct 22 07:26: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: 7524 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1105788wrr; Sat, 22 Oct 2022 01:36:11 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5GBS38tLyyJif88uVBFHqwN/WY3DX6VT6OhWULOUnGNNGTQ0QualGy7at5hRTnmOeN4TQF X-Received: by 2002:aa7:8607:0:b0:53b:13b5:2b6a with SMTP id p7-20020aa78607000000b0053b13b52b6amr23571723pfn.52.1666427771412; Sat, 22 Oct 2022 01:36:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666427771; cv=none; d=google.com; s=arc-20160816; b=dKhgvXCi4UUj1lNN2beHFqVi6y8s7YlntceQuwK20XeAi78OSR8nFE+XVly6xfrzOz aYp9GgrilHS8PW88RwPPrDIESeHr2KDimqxz+0XxRjuFes+oqnmxAhQnqsX9wbKzA6wV mTNeJVTBTlbJbpWtDhAYn/Ir99HjOhzQLB3O+yiRVb+dzgCx6Mo3KBZgKQpCaCjm2uik VjKa1zumN5ub1bwcEx2Upe7/Z+gvzW4oKOwa8OfyfRxHgsYB/Hf8xiZYHCNTJRF6el7C ml1v/MOeJE6iy98vS4nNciEHKCofpbArK7BPyTXbIvh/fAHBr+cQrWN21idu+jzhOjR/ TnpA== 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=mfAeNG5KHBlKC1EHx324bq6BZK3h77TpCxl98xEnzC8=; b=IyQA1VYc2EgvEjn8OQzd7KfCMePDtPoDQIxTxybRjlpUsHI2ruLUyfrOOtqVJ5nPNB yvVUVSqF416LuhbliXmq7H0Mlj2BojLPRnt47/8mMSJJGEivhqw6UWTIiJCL++jxcsYd J2U55EFNERDFkCM1G1kPj5AdVqJYKobQFjeTmfsWeqplLWlPQFr61VXF/ZqcrEPARRSQ 1a06t+X9LORzkcENWdI3kCKO2ftj6fQfXwOt+++ZmaQysXeu0VJFBXa0drSScwmT96nB ka1d/Huvnb3ScGqe6QT+CTkKBHxmZzCh06u4ynM1d2WemXnuOwct5zqVPB7mlD3UtUzs y3MA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Eo8kbrhA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 p4-20020a637f44000000b0046b3dce8455si20719379pgn.14.2022.10.22.01.35.54; Sat, 22 Oct 2022 01:36: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=Eo8kbrhA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S230077AbiJVIWR (ORCPT + 99 others); Sat, 22 Oct 2022 04:22:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49014 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233639AbiJVIUa (ORCPT ); Sat, 22 Oct 2022 04:20:30 -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 4DE402DE447; Sat, 22 Oct 2022 00:58: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 ams.source.kernel.org (Postfix) with ESMTPS id 9E20CB82E28; Sat, 22 Oct 2022 07:57:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E50E1C433D6; Sat, 22 Oct 2022 07:57:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425435; bh=n+52xSQrxTm+UqR0b2GceeHoHH/Do0/baJ2D045InPM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Eo8kbrhAtbqI/ekNwWcaLDZ4LY5LwvRY7u/VwUAhM4/T+yezBkqNjD442mRDkJKie GC5Ck8gGVw/o3KDApq1SaGbIs9avteB+uWJyBuFWAo3y/FwDLuEtf5LoAgbKFsk8Em l0PMOhTyoRD7gtSvuuvnykz/qAX9K9kwp3TfOJ+g= 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 5.19 501/717] powerpc/64s: Fix GENERIC_CPU build flags for PPC970 / G5 Date: Sat, 22 Oct 2022 09:26:20 +0200 Message-Id: <20221022072520.422189997@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376167108309953?= X-GMAIL-MSGID: =?utf-8?q?1747376167108309953?= 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 d54e1fe03551..dbeba3e209c0 100644 --- a/arch/powerpc/Makefile +++ b/arch/powerpc/Makefile @@ -152,7 +152,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 Sat Oct 22 07:26: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: 7533 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1105836wrr; Sat, 22 Oct 2022 01:36:17 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6mwoKRIS04cKI+FPNiJ+rsUvcz7eaxzw2KzgK698+NvOiUoTgIqr6tgV9N55Wvz1Tbmdcb X-Received: by 2002:a17:90a:e10:b0:211:9e6a:a099 with SMTP id v16-20020a17090a0e1000b002119e6aa099mr15665460pje.27.1666427776822; Sat, 22 Oct 2022 01:36:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666427776; cv=none; d=google.com; s=arc-20160816; b=n7zozHxOIDGS0YCs3D5GebTPaIthoUWQF8jZPk71vxxK7JFRx1KPgm3TwL6vY68kZm BEjeSk27jtr7IqSRViNrbtkZeiB0SHvHpd5f+F1oCh73aYtHiEXsW+xnbxCoUfC6NaaI +RIKJ9HiTduiNhl/oWMYBCXe4XHRbGM97v6YslVJZv6axpiActbsWCf0hxAX+8uRzAZO sofwIAassZK+3QKoJ2P4KF3x690Rgq95/zVz2oZgYZLBs7oZ+LFqcsUSopyDZkB54Hen Ba7zC+B7eLIqeCf8kKU8ELuVKJSHkFQnBqEvE6w6eyqyva5hs1dwKygcboyyQ1H9fHli z66A== 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=9R6fYnDo9S9LmZvSen/lNRxgBS5WiRoJUKkUQDFaQJg=; b=pdupqu6z8EIVqHufFe0qLLhcUsgVq/R84qk3SILnJxHAehFOnUHzBfK2i9o+JzZ67c Qdhqy3OUhjB/0xRmNkzG8m/NQ2JmpPBDxEl5fkmEKn5RrJNBpmEomBFPGXu3jvmcdg+P 51oSD+vRmH/373lqbzU5GUlLm8oBtOcsItp6MySNAzv0Z7j2uGGK02XSoLf7IDWY/1+N VFnhk9eU+ltWOgs7ooVMo00x6/5WZkr6xNgsn9Zupprt5zWsMAEoIlWDxwekIZSemLJt 607NBOy3IRiq0QB/keOglNv4doIWkNDVTrNb2v5zoZCNnQTQwr+h24DbWsfvjG0YFzNo OClA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=mmMnhZSO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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-20020a170903110f00b00178b88d40ebsi32805993plh.51.2022.10.22.01.35.59; Sat, 22 Oct 2022 01:36: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=mmMnhZSO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S229973AbiJVIZe (ORCPT + 99 others); Sat, 22 Oct 2022 04:25:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53208 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233768AbiJVIXE (ORCPT ); Sat, 22 Oct 2022 04:23:04 -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 C280B169CD6; Sat, 22 Oct 2022 00: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 E9A2360AFA; Sat, 22 Oct 2022 07:57:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EE065C433D6; Sat, 22 Oct 2022 07:57:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425438; bh=+7vq+AHutYpGIBBik1KRpBUm4rIJ77U6/TMEBYvCzxg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mmMnhZSOTHy5ozqUrDd7fGFUa6MeQh6SVsw11FEAOThC3r2yKzb5APmPE+nW+Azyx l5HBpJMrGiC2x5iXHH+6maHbwh4HZi56ObXd0Fn64kg7Q7no/RAxjzGkm2l/itPDeY zkzhn3UqXql6aQ1BMam57CkZhazcd95NfmPnYK/c= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Nicholas Piggin , Michael Ellerman , Sasha Levin Subject: [PATCH 5.19 502/717] powerpc/64: mark irqs hard disabled in boot paca Date: Sat, 22 Oct 2022 09:26:21 +0200 Message-Id: <20221022072520.473745835@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376172271495973?= X-GMAIL-MSGID: =?utf-8?q?1747376172271495973?= From: Nicholas Piggin [ Upstream commit 799f7063c7645f9a751d17f5dfd73b952f962cd2 ] This prevents interrupts in early boot (e.g., program check) from enabling MSR[EE], potentially causing endian mismatch or other crashes when reporting early boot traps. Fixes: 4423eb5ae32ec ("powerpc/64/interrupt: make normal synchronous interrupts enable MSR[EE] if possible") Signed-off-by: Nicholas Piggin Signed-off-by: Michael Ellerman Link: https://lore.kernel.org/r/20220926054305.2671436-3-npiggin@gmail.com Signed-off-by: Sasha Levin --- arch/powerpc/kernel/setup_64.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/arch/powerpc/kernel/setup_64.c b/arch/powerpc/kernel/setup_64.c index 5761f08dae95..6562517bcb3b 100644 --- a/arch/powerpc/kernel/setup_64.c +++ b/arch/powerpc/kernel/setup_64.c @@ -183,8 +183,10 @@ static void __init fixup_boot_paca(void) get_paca()->cpu_start = 1; /* Allow percpu accesses to work until we setup percpu data */ get_paca()->data_offset = 0; - /* Mark interrupts disabled in PACA */ + /* Mark interrupts soft and hard disabled in PACA */ irq_soft_mask_set(IRQS_DISABLED); + get_paca()->irq_happened = PACA_IRQ_HARD_DIS; + WARN_ON(mfmsr() & MSR_EE); } static void __init configure_exceptions(void) From patchwork Sat Oct 22 07:26: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: 7569 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1106101wrr; Sat, 22 Oct 2022 01:36:57 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7777UGDAfOZ6m4xAwqdZOKUwgyjm118wRek57TJU1qIFMB0ut+udmYZ0LAAAfW7y4wEQQ1 X-Received: by 2002:a17:902:cecf:b0:185:475a:4073 with SMTP id d15-20020a170902cecf00b00185475a4073mr23648516plg.60.1666427816917; Sat, 22 Oct 2022 01:36:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666427816; cv=none; d=google.com; s=arc-20160816; b=nMZY6I3Ad0+9x32LKK/b0GSx+nxVfJPKgTAkwJSKZCgE5caanEVVWF58dCCpnKyMhq nO/i1lm0YRhtkLOtHMeTB3OnU+57vetpNpgAf5A3BhGKXMCFd73llWBUlMPfaL5CwMua X+Zj0Kc6tfllYsgRoGZ+oqBep9/OOh5mWqJjf4iYpcadh6L55obWLaw6mCmmRhc16SLe dZ3JIyDxnTbA07sP2wBHtLpIELnpq68oFtOHOV3WnZEqqnorAUXj0sqUJ+ZNlSlHIozV i/qq4aP1kH/qeBCwqu1tR2CAo/dEIRdSOd+QwHGsYfP+shMamGFFTwSFycQQbjHryGlF KvwQ== 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=VFE8mqsuf3NiicJPr84kOPAqj1JXZMEHtdRCR7GkZYQ=; b=y7nNmBQXA7I48ms3HLrTUzD18IvlwElO5q4naXNeiEGOmRQ2GOAptKrKcqkCK/yAR1 6CfHhGLRNJtamdwmqmG+8/OYgBp9IvO53Touw70jwsD93yj1rKE5XISwXNeXxGJVsnT8 ECPI0sQcRfoMudI3+z3dCIax/zQSTfJgeHB4S/xYdC4q4skIinSp8CVPdpVWT4SBRer8 jW+LVZPF27SU3VLP56gulfqedExb1glOmy5Q6GkQYnR3farPOdzpJqjOzhoUYk8DD+2N Ahd09fvPlECpTTP6R4kpANP4wWdHRR6d4H/QoNB5AgzKnyBJ2ikXSFJagF9jvpAkCoRp 8Tfg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=p9QJ237K; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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-20020a635818000000b0041cd5c0295esi25100158pgb.852.2022.10.22.01.36.41; Sat, 22 Oct 2022 01:36: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=p9QJ237K; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S233827AbiJVIXY (ORCPT + 99 others); Sat, 22 Oct 2022 04:23:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46808 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233819AbiJVIVS (ORCPT ); Sat, 22 Oct 2022 04:21: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 3B3742E0433; Sat, 22 Oct 2022 00: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 dfw.source.kernel.org (Postfix) with ESMTPS id E508760B1F; Sat, 22 Oct 2022 07:57:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E486CC433C1; Sat, 22 Oct 2022 07:57:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425441; bh=js3v98GcGKRV1eEWcT7nHaJQYSSKM8ZDnkx4SxjvrwI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=p9QJ237KjH8bjoPO7QbhzHmlC0afNSf0Jy7Of6bAmkVpWJXdtjhn2YUznlQYfgar7 3YMl04xUFSvOXaeYf3GZOeYpu6dOV/GJuXEjMv7MlF+4UUKL9OXbEQZrB7Q9j/Xzxh 8rspNIcpVvg6M5QED4rpH/xjM8kjC7tyanhaznrE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Nicholas Piggin , Michael Ellerman , Sasha Levin Subject: [PATCH 5.19 503/717] powerpc/64/interrupt: Fix return to masked context after hard-mask irq becomes pending Date: Sat, 22 Oct 2022 09:26:22 +0200 Message-Id: <20221022072520.514630503@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376214216842121?= X-GMAIL-MSGID: =?utf-8?q?1747376214216842121?= From: Nicholas Piggin [ Upstream commit e485f6c751e0a969327336c635ca602feea117f0 ] If a synchronous interrupt (e.g., hash fault) is taken inside an irqs-disabled region which has MSR[EE]=1, then an asynchronous interrupt that is PACA_IRQ_MUST_HARD_MASK (e.g., PMI) is taken inside the synchronous interrupt handler, then the synchronous interrupt will return with MSR[EE]=1 and the asynchronous interrupt fires again. If the asynchronous interrupt is a PMI and the original context does not have PMIs disabled (only Linux IRQs), the asynchronous interrupt will fire despite having the PMI marked soft pending. This can confuse the perf code and cause warnings. This patch changes the interrupt return so that irqs-disabled MSR[EE]=1 contexts will be returned to with MSR[EE]=0 if a PACA_IRQ_MUST_HARD_MASK interrupt has become pending in the meantime. The longer explanation for what happens: 1. local_irq_disable() 2. Hash fault interrupt fires, do_hash_fault handler runs 3. interrupt_enter_prepare() sets IRQS_ALL_DISABLED 4. interrupt_enter_prepare() sets MSR[EE]=1 5. PMU interrupt fires, masked handler runs 6. Masked handler marks PMI pending 7. Masked handler returns with PACA_IRQ_HARD_DIS set, MSR[EE]=0 8. do_hash_fault interrupt return handler runs 9. interrupt_exit_kernel_prepare() clears PACA_IRQ_HARD_DIS 10. interrupt returns with MSR[EE]=1 11. PMU interrupt fires, perf handler runs Fixes: 4423eb5ae32e ("powerpc/64/interrupt: make normal synchronous interrupts enable MSR[EE] if possible") Signed-off-by: Nicholas Piggin Signed-off-by: Michael Ellerman Link: https://lore.kernel.org/r/20220926054305.2671436-4-npiggin@gmail.com Signed-off-by: Sasha Levin --- arch/powerpc/kernel/interrupt.c | 10 --------- arch/powerpc/kernel/interrupt_64.S | 34 +++++++++++++++++++++++++++--- 2 files changed, 31 insertions(+), 13 deletions(-) diff --git a/arch/powerpc/kernel/interrupt.c b/arch/powerpc/kernel/interrupt.c index 784ea3289c84..0b656b897f99 100644 --- a/arch/powerpc/kernel/interrupt.c +++ b/arch/powerpc/kernel/interrupt.c @@ -592,16 +592,6 @@ notrace unsigned long interrupt_exit_kernel_prepare(struct pt_regs *regs) if (unlikely(stack_store)) __hard_EE_RI_disable(); - /* - * Returning to a kernel context with local irqs disabled. - * Here, if EE was enabled in the interrupted context, enable - * it on return as well. A problem exists here where a soft - * masked interrupt may have cleared MSR[EE] and set HARD_DIS - * here, and it will still exist on return to the caller. This - * will be resolved by the masked interrupt firing again. - */ - if (regs->msr & MSR_EE) - local_paca->irq_happened &= ~PACA_IRQ_HARD_DIS; #endif /* CONFIG_PPC64 */ } diff --git a/arch/powerpc/kernel/interrupt_64.S b/arch/powerpc/kernel/interrupt_64.S index ce25b28cf418..d76376ce7291 100644 --- a/arch/powerpc/kernel/interrupt_64.S +++ b/arch/powerpc/kernel/interrupt_64.S @@ -559,15 +559,43 @@ _ASM_NOKPROBE_SYMBOL(interrupt_return_\srr\()_kernel) ld r11,SOFTE(r1) cmpwi r11,IRQS_ENABLED stb r11,PACAIRQSOFTMASK(r13) - bne 1f + beq .Linterrupt_return_\srr\()_soft_enabled + + /* + * Returning to soft-disabled context. + * Check if a MUST_HARD_MASK interrupt has become pending, in which + * case we need to disable MSR[EE] in the return context. + */ + ld r12,_MSR(r1) + andi. r10,r12,MSR_EE + beq .Lfast_kernel_interrupt_return_\srr\() // EE already disabled + lbz r11,PACAIRQHAPPENED(r13) + andi. r10,r11,PACA_IRQ_MUST_HARD_MASK + beq 1f // No HARD_MASK pending + + /* Must clear MSR_EE from _MSR */ +#ifdef CONFIG_PPC_BOOK3S + li r10,0 + /* Clear valid before changing _MSR */ + .ifc \srr,srr + stb r10,PACASRR_VALID(r13) + .else + stb r10,PACAHSRR_VALID(r13) + .endif +#endif + xori r12,r12,MSR_EE + std r12,_MSR(r1) + b .Lfast_kernel_interrupt_return_\srr\() + +.Linterrupt_return_\srr\()_soft_enabled: #ifdef CONFIG_PPC_BOOK3S lbz r11,PACAIRQHAPPENED(r13) andi. r11,r11,(~PACA_IRQ_HARD_DIS)@l bne- interrupt_return_\srr\()_kernel_restart #endif - li r11,0 - stb r11,PACAIRQHAPPENED(r13) # clear out possible HARD_DIS 1: + li r11,0 + stb r11,PACAIRQHAPPENED(r13) // clear the possible HARD_DIS .Lfast_kernel_interrupt_return_\srr\(): cmpdi cr1,r3,0 From patchwork Sat Oct 22 07:26: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: 7583 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1106309wrr; Sat, 22 Oct 2022 01:37:28 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7HkEkTk7aSg9UjVBgrXFBvXqAvE5aYKVLk6JjTvJY1qqTTLNMEUGpG99+W2B5ldICsHda9 X-Received: by 2002:a05:6402:51d1:b0:45d:b498:169 with SMTP id r17-20020a05640251d100b0045db4980169mr21615432edd.119.1666427848760; Sat, 22 Oct 2022 01:37:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666427848; cv=none; d=google.com; s=arc-20160816; b=bRF2KyA7ZLaKi/zTko1HMfFJik8zp9xYqqpI+eeIex2VKbDfTObG3KXfMRDHxT2BWA TL3X14T44PGxWNLK76L+BglesHc+BTMamZsnuv984Lxh7gZgND6Q4sA0iIRfoAuy94dk MNDfy9k0m+EAAwJdFUWGOrTuVmq7aEQ01nC6e3XBjqLFTN9WmbgjhSPIQumqId2UX6mi F7fpD7e1fWj9mH8pFIK4+y54o7fR3CryUd4FbglabALdTT/lyrTgVjuStx49QCba9kkn 2Q1AAwOlHmbx+mrk/hbQjwgDPHase5QCiON+GysorIr/hZB8KIQOWtb4vdrgJSdoz5aV 0AZg== 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=dl7DbacewDRs1kZ9C6d3ti7ZEcmbSP0pgR+ErZNXqVI=; b=uRDl53ywJQwWpOCBA0oLx+wyxpn7uN0+FdbmSV6+KJf2WKiecwy+CT0d6QSw4qx2w6 Sx9cGGxNL1SmwMvBmzhNhYuj3RxoKn4FbXlBWNp/pGyfPsyCoazH0Jq6Mr6TCVTXvbKZ smWle68QE3o+1AeyqzPVGj6KIylJ63qxuw7/nXGrvBxLbpc3LVp1bWseIAe+ZRHOe2DI GRcG0RyPTF5E9tlaMWJUT3o7dGHcHz1CfkBf2l6hjf0+XJZOGI0KwSIKrlDZVYu+ZuwP CZ/my68l9MW9qxlzOnFbLUsljjHpeTbiIWHxuAZBrx8X/nhEuD4eXTzMNN7oQwMFR69W aB2g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=I19Iitnf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 q33-20020a05640224a100b0044e9c289ae5si20316062eda.155.2022.10.22.01.37.00; Sat, 22 Oct 2022 01:37: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=I19Iitnf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S233645AbiJVITB (ORCPT + 99 others); Sat, 22 Oct 2022 04:19:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57972 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233295AbiJVIQi (ORCPT ); Sat, 22 Oct 2022 04:16:38 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7C7672DCB0F; Sat, 22 Oct 2022 00:57:25 -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 C605E60B45; Sat, 22 Oct 2022 07:57:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B594FC433C1; Sat, 22 Oct 2022 07:57:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425444; bh=l0qQ2lCaxTmpz63zjBz0GZTyNJRYUHWb1NPdjSlk1wE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=I19Iitnf4GaMFXtW0zpbujUUx/0sWWctBNJN9gd8//TX18MANm80iXPvGTujdttc6 BdAGrRRwcMJwxS7tAf2wkMN6HbEIxmYXVTFXNj85cLFrd4RW9lVpDyrTUHA4lNS+1n S93/cxT/D8FS2QeDhpJGAuPqMWCiBNTHYbENLJ1s= 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 5.19 504/717] powerpc: Fix SPE Power ISA properties for e500v1 platforms Date: Sat, 22 Oct 2022 09:26:23 +0200 Message-Id: <20221022072520.548164809@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376248231151924?= X-GMAIL-MSGID: =?utf-8?q?1747376248231151924?= 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 18a885130538..e03ae130162b 100644 --- a/arch/powerpc/boot/dts/fsl/mpc8540ads.dts +++ b/arch/powerpc/boot/dts/fsl/mpc8540ads.dts @@ -7,7 +7,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 ac381e7b1c60..a2a6c5cf852e 100644 --- a/arch/powerpc/boot/dts/fsl/mpc8541cds.dts +++ b/arch/powerpc/boot/dts/fsl/mpc8541cds.dts @@ -7,7 +7,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 9f58db2a7e66..901b6ff06dfb 100644 --- a/arch/powerpc/boot/dts/fsl/mpc8555cds.dts +++ b/arch/powerpc/boot/dts/fsl/mpc8555cds.dts @@ -7,7 +7,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 a24722ccaebf..c2f9aea78b29 100644 --- a/arch/powerpc/boot/dts/fsl/mpc8560ads.dts +++ b/arch/powerpc/boot/dts/fsl/mpc8560ads.dts @@ -7,7 +7,7 @@ /dts-v1/; -/include/ "e500v2_power_isa.dtsi" +/include/ "e500v1_power_isa.dtsi" / { model = "MPC8560ADS"; From patchwork Sat Oct 22 07:26: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: 7564 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1106046wrr; Sat, 22 Oct 2022 01:36:46 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7O+eZ8sfiOKxcPCtAcKrgZLKvDlhDQqD7T8VM/s/RlvnIjeWaoBVsC69uaW6KCFhJmNEJI X-Received: by 2002:a63:82c6:0:b0:460:a691:356 with SMTP id w189-20020a6382c6000000b00460a6910356mr19420612pgd.621.1666427806037; Sat, 22 Oct 2022 01:36:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666427806; cv=none; d=google.com; s=arc-20160816; b=P9AUIYq+fEjVPQ5IgOSQ7L32am+vRe/u47Z7IKgYUy6h2PUm48GTgVAWeT8Z0oO+4O NuzWuUA8WocVMQclgMZsUjB/aLERR+ZqdrHaMMCdXh1F7bet/iF3SUu8zNFoeSKyCXDn +mNGwIIQO6mE33KEnudwo02/BCqGBUZ2NoLLR+SAuCSPvBh6Lu6kgfOWx5jUghP8uaPv LjJWryPdXtPqKkoCbYgfJUzKeejOhCpPq/UQS0xrFBBVrGihfXor3UQydaTq84zrrkgh Ne9FcWh6z8pRniKsRRkBEeGEXRezpuk4hWJUVD90TVPJUh0n7AydaoPokOMphSkNGLAP oJGg== 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=l3grWRsXq6ymfD25b++emFgXLXqNVMag4t8Qaibak2g=; b=X9ZSOhrkJExwg88rV+Eqm4SHTmH+kEcNuMfYpfVvqiE7g/U6Cj9pJru0Ah8Y+cOEUV Teh7BSUqUmGmb3DfZ3Ht7krB8yoBMfvTnTrimAmd03xKn/uYun3Nf7v8lOfqFE3hLG6E j6cdO7mSvUpT5x5vklVoS4PGKycAtIMM/ZKr1Rq2EgU+XXiArBftCQ/QGoQ3yjuiPGLh x6fjtu6B19jtEU+01zpCOpro0NgDBN/qysaKJI8AAKsB1Yj8vfCje0o1TzI5tvqRn2pm xHjUR0PL5nQZUn3kILaG73JJdD8zfDjg2GeIa17eD/5CvXW8d38BLWQfk5CP3SzTQpni 8wYQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=DhmVtqFc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 e14-20020a63ee0e000000b004393f624553si29211288pgi.864.2022.10.22.01.36.28; Sat, 22 Oct 2022 01:36: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=DhmVtqFc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S233719AbiJVIU4 (ORCPT + 99 others); Sat, 22 Oct 2022 04:20:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42954 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233754AbiJVITY (ORCPT ); Sat, 22 Oct 2022 04:19: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 24A5BABD78; Sat, 22 Oct 2022 00:58: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 772C9B82DF3; Sat, 22 Oct 2022 07:57:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C92E6C433C1; Sat, 22 Oct 2022 07:57:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425447; bh=WJZNRqMRPjBUQX4aUfuXCXvVAymsOHR9K0L14B8HJaU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DhmVtqFc7Uso1oFegWNvZbTW5TciHj+lq8zVSrPy+HEsO5dusWeO+E7XYg4aaVPnA n00C9xQbvnsq8rDNSEJGxYq2rwPhOWtnkD5s2c1aY687L5MDDVgINC87WGtsDsAAt5 QFJ27QSYgwqIZre7TQlFVgwmz/Dhs67HrZd2YrIM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Li Huafei , Michael Ellerman , Sasha Levin Subject: [PATCH 5.19 505/717] powerpc/kprobes: Fix null pointer reference in arch_prepare_kprobe() Date: Sat, 22 Oct 2022 09:26:24 +0200 Message-Id: <20221022072520.597601164@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376203279987450?= X-GMAIL-MSGID: =?utf-8?q?1747376203279987450?= From: Li Huafei [ Upstream commit 97f88a3d723162781d6cbfdc7b9617eefab55b19 ] I found a null pointer reference in arch_prepare_kprobe(): # echo 'p cmdline_proc_show' > kprobe_events # echo 'p cmdline_proc_show+16' >> kprobe_events Kernel attempted to read user page (0) - exploit attempt? (uid: 0) BUG: Kernel NULL pointer dereference on read at 0x00000000 Faulting instruction address: 0xc000000000050bfc Oops: Kernel access of bad area, sig: 11 [#1] LE PAGE_SIZE=64K MMU=Radix SMP NR_CPUS=2048 NUMA PowerNV Modules linked in: CPU: 0 PID: 122 Comm: sh Not tainted 6.0.0-rc3-00007-gdcf8e5633e2e #10 NIP: c000000000050bfc LR: c000000000050bec CTR: 0000000000005bdc REGS: c0000000348475b0 TRAP: 0300 Not tainted (6.0.0-rc3-00007-gdcf8e5633e2e) MSR: 9000000000009033 CR: 88002444 XER: 20040006 CFAR: c00000000022d100 DAR: 0000000000000000 DSISR: 40000000 IRQMASK: 0 ... NIP arch_prepare_kprobe+0x10c/0x2d0 LR arch_prepare_kprobe+0xfc/0x2d0 Call Trace: 0xc0000000012f77a0 (unreliable) register_kprobe+0x3c0/0x7a0 __register_trace_kprobe+0x140/0x1a0 __trace_kprobe_create+0x794/0x1040 trace_probe_create+0xc4/0xe0 create_or_delete_trace_kprobe+0x2c/0x80 trace_parse_run_command+0xf0/0x210 probes_write+0x20/0x40 vfs_write+0xfc/0x450 ksys_write+0x84/0x140 system_call_exception+0x17c/0x3a0 system_call_vectored_common+0xe8/0x278 --- interrupt: 3000 at 0x7fffa5682de0 NIP: 00007fffa5682de0 LR: 0000000000000000 CTR: 0000000000000000 REGS: c000000034847e80 TRAP: 3000 Not tainted (6.0.0-rc3-00007-gdcf8e5633e2e) MSR: 900000000280f033 CR: 44002408 XER: 00000000 The address being probed has some special: cmdline_proc_show: Probe based on ftrace cmdline_proc_show+16: Probe for the next instruction at the ftrace location The ftrace-based kprobe does not generate kprobe::ainsn::insn, it gets set to NULL. In arch_prepare_kprobe() it will check for: ... prev = get_kprobe(p->addr - 1); preempt_enable_no_resched(); if (prev && ppc_inst_prefixed(ppc_inst_read(prev->ainsn.insn))) { ... If prev is based on ftrace, 'ppc_inst_read(prev->ainsn.insn)' will occur with a null pointer reference. At this point prev->addr will not be a prefixed instruction, so the check can be skipped. Check if prev is ftrace-based kprobe before reading 'prev->ainsn.insn' to fix this problem. Fixes: b4657f7650ba ("powerpc/kprobes: Don't allow breakpoints on suffixes") Signed-off-by: Li Huafei [mpe: Trim oops] Signed-off-by: Michael Ellerman Link: https://lore.kernel.org/r/20220923093253.177298-1-lihuafei1@huawei.com Signed-off-by: Sasha Levin --- arch/powerpc/kernel/kprobes.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/arch/powerpc/kernel/kprobes.c b/arch/powerpc/kernel/kprobes.c index 1c97c0f177ae..ed4f6b992f97 100644 --- a/arch/powerpc/kernel/kprobes.c +++ b/arch/powerpc/kernel/kprobes.c @@ -161,7 +161,13 @@ int arch_prepare_kprobe(struct kprobe *p) preempt_disable(); prev = get_kprobe(p->addr - 1); preempt_enable_no_resched(); - if (prev && ppc_inst_prefixed(ppc_inst_read(prev->ainsn.insn))) { + + /* + * When prev is a ftrace-based kprobe, we don't have an insn, and it + * doesn't probe for prefixed instruction. + */ + if (prev && !kprobe_ftrace(prev) && + ppc_inst_prefixed(ppc_inst_read(prev->ainsn.insn))) { printk("Cannot register a kprobe on the second word of prefixed instruction\n"); ret = -EINVAL; } From patchwork Sat Oct 22 07:26: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: 7693 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1109218wrr; Sat, 22 Oct 2022 01:47:36 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6STvg4aIooskrqT56QMYCCNGB2l8PG5N94PkvVJnhQnIGTfWmmCY3KM0Z1FwDk4skQCreI X-Received: by 2002:a17:907:a4e:b0:77d:94d:8148 with SMTP id be14-20020a1709070a4e00b0077d094d8148mr18534443ejc.607.1666428456150; Sat, 22 Oct 2022 01:47:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666428456; cv=none; d=google.com; s=arc-20160816; b=i15cXMljna+H2hdK3h4kmRwoKutWQ14edvOcS7nxyZLAxzK9/6gPl7asbY4CMpgwNz snw+h8iWzQaEogxnPXMliPWqUU1hcZZGRCwviU/eLoZ7wsnQKJ68wruK9NeU+tsJQauQ Df/+osjU7CWlXIFV23brjT1a5cDhcY5gngbQJ34H+/DMWTFqvK6Yt6kK/s1fwfVLsmT5 kiPQmnsBwbPav1L2QyDTPfO4jF4LWfKL7utfR/eqHzITycyAviZgYNo+B/r4eiuAuULG Ciiu4faAz82odV0SSglHRGN0L6Xqvkq9BbfkBVXSLpx3R0o5/MIoaBgMkZIz4FDm9M/q F7ZQ== 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=cGssJP/RdnXfPAW6b1tlvKwo2OVui095ItH59m9bjSg=; b=gelS3ex/LYdPNuTtQSTSKm1nmKIPa7cljK+41c51IxEvNWpPXcUTPah4N1+D0CgEl5 AuifXI5tU690Rw0IYe+/t0hRHNZY66uz/zN58+BW3jVrOnQ6CgDm18giuKHjmHAdaVNs /bGajNJAwUMKPRtl81pSLBb4vouQmNZBzojEp9jrkmPKuhbS8ng85/Z5z/qe701BodW2 +Tt6IG1AII0G/gzN5FOL06xR6MxYIXexL4uTKHDO+oqD1vSBnv8SQHYTunQbaaJUAVzH 7yWqhZ4hd0+4dKehBxhJdyNBTdN6ZfOj4PnoH9bs58WEwFzKcaMhhHCshu3drnGSE6O/ wIDA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=NMfk36zT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 hv9-20020a17090760c900b0078c31a71f47si21124909ejc.220.2022.10.22.01.47.11; Sat, 22 Oct 2022 01:47: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=NMfk36zT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S234282AbiJVIqf (ORCPT + 99 others); Sat, 22 Oct 2022 04:46:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33236 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234992AbiJVIoN (ORCPT ); Sat, 22 Oct 2022 04:44:13 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0E82D2EBB96; Sat, 22 Oct 2022 01:08: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 2D59560AC3; Sat, 22 Oct 2022 07:57:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 16A41C433C1; Sat, 22 Oct 2022 07:57:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425450; bh=faVI2ltSz4dRWRF51eXeVoUuUZAOTS8lGFgE0aj/DJo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NMfk36zTdCJQzbKXAEx+gh5GoNnmtqAcmcPdEV45zUCbVjUuOFlTM/ISQSBlEpINh LXmDtmzJ1d3AD5NhXZQP/QcAa4tz9BG5DMWtXxkaB6SnuFwh6NPTTfbajuN7KxWWbJ T0Uu2Aw3EwlGOaPWCjVayF1AHE8qd3BhS0Mzx+ec= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Nathan Lynch , Haren Myneni , Michael Ellerman , Sasha Levin Subject: [PATCH 5.19 506/717] powerpc/pseries/vas: Pass hw_cpu_id to node associativity HCALL Date: Sat, 22 Oct 2022 09:26:25 +0200 Message-Id: <20221022072520.647548263@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376884986202225?= X-GMAIL-MSGID: =?utf-8?q?1747376884986202225?= From: Haren Myneni [ Upstream commit f3e5d9e53e74d77e711a2c90a91a8b0836a9e0b3 ] Generally the hypervisor decides to allocate a window on different VAS instances. But if user space wishes to allocate on the current VAS instance where the process is executing, the kernel has to pass associativity domain IDs to allocate VAS window HCALL. To determine the associativity domain IDs for the current CPU, smp_processor_id() is passed to node associativity HCALL which may return H_P2 (-55) error during DLPAR CPU event. This is because Linux CPU numbers (smp_processor_id()) are not the same as the hypervisor's view of CPU numbers. Fix the issue by passing hard_smp_processor_id() with VPHN_FLAG_VCPU flag (PAPR 14.11.6.1 H_HOME_NODE_ASSOCIATIVITY). Fixes: b22f2d88e435 ("powerpc/pseries/vas: Integrate API with open/close windows") Reviewed-by: Nathan Lynch Signed-off-by: Haren Myneni [mpe: Update change log to mention Linux vs HV CPU numbers] Signed-off-by: Michael Ellerman Link: https://lore.kernel.org/r/55380253ea0c11341824cd4c0fc6bbcfc5752689.camel@linux.ibm.com Signed-off-by: Sasha Levin --- arch/powerpc/platforms/pseries/vas.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/powerpc/platforms/pseries/vas.c b/arch/powerpc/platforms/pseries/vas.c index 500a1fc4a1d7..b2a32f8a837a 100644 --- a/arch/powerpc/platforms/pseries/vas.c +++ b/arch/powerpc/platforms/pseries/vas.c @@ -332,7 +332,7 @@ static struct vas_window *vas_allocate_window(int vas_id, u64 flags, * So no unpacking needs to be done. */ rc = plpar_hcall9(H_HOME_NODE_ASSOCIATIVITY, domain, - VPHN_FLAG_VCPU, smp_processor_id()); + VPHN_FLAG_VCPU, hard_smp_processor_id()); if (rc != H_SUCCESS) { pr_err("H_HOME_NODE_ASSOCIATIVITY error: %d\n", rc); goto out; From patchwork Sat Oct 22 07:26: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: 7549 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1105895wrr; Sat, 22 Oct 2022 01:36:28 -0700 (PDT) X-Google-Smtp-Source: AMsMyM68PpOeZdN8rxr4e3Y1ncGdfbe1uLfJ20y3+vgRlVkm2xpJl/F9wr8sH+maJb41ox4cRle5 X-Received: by 2002:a17:902:cf08:b0:17d:46b6:25f9 with SMTP id i8-20020a170902cf0800b0017d46b625f9mr23332133plg.67.1666427777444; Sat, 22 Oct 2022 01:36:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666427777; cv=none; d=google.com; s=arc-20160816; b=VJSPwyqHmzyAsMVHytl1DHZXCPbQTZEw6HCT/YKZvateGdj73aiGR2nvB+DcSKk5c2 zhWmiQOecvZGYkrtbVK1bvp+A8gWy3n+jC7p2GlGrrJ5Vua/2Nq37WH5D7RKdYN2H/Zq 4yfn8yUX/NKCLkwkzq1l4gZlJ89Y7uB2/6Chx4Yv1DSHClPbrqT/8Ar0GL2oOP4jBo9k RobSM2z6Qj+MHuf1c8j53YsLqshBXp95X2egZQW30K8GzOiL8Iy86g0mgR46ALKg42LV sNqve6YdchweQDViQPwRAoEC6CBYNsn2+Zcao7xPVrIgtnBqm7Emy865z5T3PMmzGCzF 2oVg== 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=UeXMP0V5EKhvdGZgYYTjnp6nrp2m6DpWou5AFJKNcsQ=; b=miu9Rs5hmUNaISztg0/mscEYx7lPM/kFrv+o2dUZJT4gl5P4IKcC2tsKCW+be1e44y ve11TYYkgOGxT7xMNj1hXBhSdoOfQ55VOow3ycXmWbruE2riOYsxws6eFW2QU0aOoquo mDYYP3WEtTIymUYa2PPMOgxLBq2S2fHE3CvCAJXx4m3PVAdUlzoaufiZ9IidybZtBxWn O8BfrYysEB3ZfOVg+cQXtm+wAHHrPFUhkefUvnOmMP64AB3Wa5yq2VtGHWSGJ2OisgDn AQdGs5bxBZLcH8lMKhrpjz+PGPd/XHye1QFUCwmasyr9o50cfMHbpk9f6luX6HOFGXtR kNXw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=jngscZb+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 pi5-20020a17090b1e4500b00212ca8e7457si6151053pjb.133.2022.10.22.01.36.01; Sat, 22 Oct 2022 01:36: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=jngscZb+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S230064AbiJVIZm (ORCPT + 99 others); Sat, 22 Oct 2022 04:25:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46832 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233801AbiJVIXW (ORCPT ); Sat, 22 Oct 2022 04:23:22 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C053D14D1FC; Sat, 22 Oct 2022 00: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 4527060B98; Sat, 22 Oct 2022 07:57:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 27C96C433D6; Sat, 22 Oct 2022 07:57:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425453; bh=oi1CZUVpo8tc5lnU4a5h7UpgZgb2bjuEFwx20nMrjHg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jngscZb+xOMQNYZ0vtw2v5WsEn30LuT6De/DVsTLrmX9j6pXWDmrMbVCWQ1TwgMXL kAHoN3vRe6OGcKyq7rGhglqVqCpMJ2yL5ZLg1KPgcNCwkMs1SNh4744IHj/UKLfb2n ftjjfUZfW9j4XBLthLyj2c6OxA4eHpB5jKQ89C5c= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zhengchao Shao , Herbert Xu , Sasha Levin Subject: [PATCH 5.19 507/717] crypto: sahara - dont sleep when in softirq Date: Sat, 22 Oct 2022 09:26:26 +0200 Message-Id: <20221022072520.688358442@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376172737342771?= X-GMAIL-MSGID: =?utf-8?q?1747376172737342771?= From: Zhengchao Shao [ Upstream commit 108586eba094b318e6a831f977f4ddcc403a15da ] Function of sahara_aes_crypt maybe could be called by function of crypto_skcipher_encrypt during the rx softirq, so it is not allowed to use mutex lock. Fixes: c0c3c89ae347 ("crypto: sahara - replace tasklets with...") Signed-off-by: Zhengchao Shao Signed-off-by: Herbert Xu Signed-off-by: Sasha Levin --- drivers/crypto/sahara.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/drivers/crypto/sahara.c b/drivers/crypto/sahara.c index 457084b344c1..b07ae4ba165e 100644 --- a/drivers/crypto/sahara.c +++ b/drivers/crypto/sahara.c @@ -26,10 +26,10 @@ #include #include #include -#include #include #include #include +#include #define SHA_BUFFER_LEN PAGE_SIZE #define SAHARA_MAX_SHA_BLOCK_SIZE SHA256_BLOCK_SIZE @@ -196,7 +196,7 @@ struct sahara_dev { void __iomem *regs_base; struct clk *clk_ipg; struct clk *clk_ahb; - struct mutex queue_mutex; + spinlock_t queue_spinlock; struct task_struct *kthread; struct completion dma_completion; @@ -642,9 +642,9 @@ static int sahara_aes_crypt(struct skcipher_request *req, unsigned long mode) rctx->mode = mode; - mutex_lock(&dev->queue_mutex); + spin_lock_bh(&dev->queue_spinlock); err = crypto_enqueue_request(&dev->queue, &req->base); - mutex_unlock(&dev->queue_mutex); + spin_unlock_bh(&dev->queue_spinlock); wake_up_process(dev->kthread); @@ -1043,10 +1043,10 @@ static int sahara_queue_manage(void *data) do { __set_current_state(TASK_INTERRUPTIBLE); - mutex_lock(&dev->queue_mutex); + spin_lock_bh(&dev->queue_spinlock); backlog = crypto_get_backlog(&dev->queue); async_req = crypto_dequeue_request(&dev->queue); - mutex_unlock(&dev->queue_mutex); + spin_unlock_bh(&dev->queue_spinlock); if (backlog) backlog->complete(backlog, -EINPROGRESS); @@ -1092,9 +1092,9 @@ static int sahara_sha_enqueue(struct ahash_request *req, int last) rctx->first = 1; } - mutex_lock(&dev->queue_mutex); + spin_lock_bh(&dev->queue_spinlock); ret = crypto_enqueue_request(&dev->queue, &req->base); - mutex_unlock(&dev->queue_mutex); + spin_unlock_bh(&dev->queue_spinlock); wake_up_process(dev->kthread); @@ -1449,7 +1449,7 @@ static int sahara_probe(struct platform_device *pdev) crypto_init_queue(&dev->queue, SAHARA_QUEUE_LENGTH); - mutex_init(&dev->queue_mutex); + spin_lock_init(&dev->queue_spinlock); dev_ptr = dev; From patchwork Sat Oct 22 07:26: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: 7563 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1106053wrr; Sat, 22 Oct 2022 01:36:46 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7hhJjFy3MaFNVaYfF5S9BqoUIMI3xnMXgMm6C2a+O/HnjquJlvdq+7HI66zUXTsUMG5vwo X-Received: by 2002:a17:90a:64c3:b0:212:d67d:a034 with SMTP id i3-20020a17090a64c300b00212d67da034mr6362476pjm.55.1666427806415; Sat, 22 Oct 2022 01:36:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666427806; cv=none; d=google.com; s=arc-20160816; b=IRKjXugF1VhTQCkvb/NRoJDKRczrEjlmIp5L2wy/S+Hq187UhI2wUQs1kQDBWdk3nO mNox0P9HP3y0pe2CVJBGVQjxdMF8AurGRaEwvVkWbswYoLNMSpm5yk6XiCjguBOWJs4c dt2b2kibB+57uY+gvegTFzOU5Y7vit6SEY4+Q4nlWj+MDdSMqJQYQmuHUl6JTtZoaBBQ wCrvkOMBi0CfWfU8soTcQ+3LZtbnMDO5of/jWurGSJa3SkrBIpwQ8iQik4RZjrvP7nET nFLsOVyL3ZFKBugxRNr9CooEXZwRPJ0Vh+M6LK5qOed3FqOXoUGfZyVQNK1zs4U7erJX X+IQ== 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=e002EOn8n0rk4BPfgZet4gShs69/B1EyLhKjERlKVww=; b=bE+SK1C+7a4PzMBddRXYaHZrRrUDMKU/GXDt2noWUFGGXwAANubKQhv9/0x8+9TLYA H0g0OGz8fmTddzOKJYp2Jm48r3Fckfl8jkJeJKeGRsYFwUVGGczklzAxJZeLaEnudsSP UlOqIz+wpP3CSP5UvBv4SL+pHCH+ts2UsHWJw+NTzEKAL6fIshnCP4uyeZwTL/0T2Gh+ e9M6mz0iD6WAJJc8U4YSeV6j5tuUW7t/KHMIu2bP03KvaaM4a3NmPRWDzSJEvY+3R0wD x6eUwydLCDoZG0A6DOQeDJoZM0wDflcY0AjrkvbnyYCKspAbbEHRHESy6ABSEy+EDO1S 48PQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=htWat0Qu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 y12-20020a170902700c00b0018273316ce0si26608398plk.511.2022.10.22.01.36.28; Sat, 22 Oct 2022 01:36: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=htWat0Qu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S233839AbiJVIVg (ORCPT + 99 others); Sat, 22 Oct 2022 04:21:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50244 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233834AbiJVITv (ORCPT ); Sat, 22 Oct 2022 04:19: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 60ADC2B5B8C; Sat, 22 Oct 2022 00:58: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 ECACEB82E2A; Sat, 22 Oct 2022 07:57:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 32420C433D6; Sat, 22 Oct 2022 07:57:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425459; bh=hofricjNNRe79eBTRgopoPwZestWeMR5bnWXab1Fj6Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=htWat0QuOSoy17Pqgav53Szc8WuA+P0SDuXXJNbqW5hf72+/FzBdoLL2MLVIqrPUa JLIGwf1UtgL1RtsCSc5a6xU5sRdimjxwDG2mnKzTV/ynUqDF8A/bVStIUwDMMnMTqY Dbrn0KNzPBf4SILREXnk7G4azZNaI00l3BfHsqzE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ye Weihua , Herbert Xu , Sasha Levin Subject: [PATCH 5.19 508/717] crypto: hisilicon/zip - fix mismatch in get/set sgl_sge_nr Date: Sat, 22 Oct 2022 09:26:27 +0200 Message-Id: <20221022072520.733510815@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376203763702918?= X-GMAIL-MSGID: =?utf-8?q?1747376203763702918?= From: Ye Weihua [ Upstream commit d74f9340097a881869c4c22ca376654cc2516ecc ] KASAN reported this Bug: [17619.659757] BUG: KASAN: global-out-of-bounds in param_get_int+0x34/0x60 [17619.673193] Read of size 4 at addr fffff01332d7ed00 by task read_all/1507958 ... [17619.698934] The buggy address belongs to the variable: [17619.708371] sgl_sge_nr+0x0/0xffffffffffffa300 [hisi_zip] There is a mismatch in hisi_zip when get/set the variable sgl_sge_nr. The type of sgl_sge_nr is u16, and get/set sgl_sge_nr by param_get/set_int. Replacing param_get/set_int to param_get/set_ushort can fix this bug. Fixes: f081fda293ffb ("crypto: hisilicon - add sgl_sge_nr module param for zip") Signed-off-by: Ye Weihua Signed-off-by: Herbert Xu Signed-off-by: Sasha Levin --- drivers/crypto/hisilicon/zip/zip_crypto.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/crypto/hisilicon/zip/zip_crypto.c b/drivers/crypto/hisilicon/zip/zip_crypto.c index 67869513e48c..d90b10ae005b 100644 --- a/drivers/crypto/hisilicon/zip/zip_crypto.c +++ b/drivers/crypto/hisilicon/zip/zip_crypto.c @@ -122,12 +122,12 @@ static int sgl_sge_nr_set(const char *val, const struct kernel_param *kp) if (ret || n == 0 || n > HISI_ACC_SGL_SGE_NR_MAX) return -EINVAL; - return param_set_int(val, kp); + return param_set_ushort(val, kp); } static const struct kernel_param_ops sgl_sge_nr_ops = { .set = sgl_sge_nr_set, - .get = param_get_int, + .get = param_get_ushort, }; static u16 sgl_sge_nr = HZIP_SGL_SGE_NR; From patchwork Sat Oct 22 07:26: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: 7535 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1105860wrr; Sat, 22 Oct 2022 01:36:22 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7kefCmTKlcDc0YzwhdiHGicShXzgCKcZ8tV+DJhlfUUy2Nmz84+pnNhtR1Be5bC9XQvLbN X-Received: by 2002:a17:90b:4c52:b0:20d:7917:4cb3 with SMTP id np18-20020a17090b4c5200b0020d79174cb3mr62749058pjb.6.1666427771681; Sat, 22 Oct 2022 01:36:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666427771; cv=none; d=google.com; s=arc-20160816; b=R2AqgtP3CDoTZlgsrwoQ8RPXz4vLWWoYtWfo+ju+EaG9dEH2nRgoCISx33jA2wEEYW SiaidFYm7V+dgvTpSHSgblEwM1ZSpDc+YjRH/RCBdWvx4XiLQlZzGDQzBrCrsRTizxSD wswVRTj8ecHTSQTY2e9v/wNLY2jYcCiJA0ThBbBbkHUsFOGU+t9+hZjD50npBm1C6GYh nGOU2JyipcmJBhRy1OBh/5U6ADI99/acQXd1UWTi4z4ir3pfJUzAFLDrzurtx+3T/JSf OuwKAuH3GS4ZGKkCL8H7M/O7ZTxMEjUy2pIANsUb1RKmTuZ3VbN6CET8RU8GqwSerHiK 90Sw== 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=qEKNeIL4HkIK2GQ8U2jYZWfK3ac60MEC36bmrovh++I=; b=hMFEaxkqfBzpJ73XQZSNcw1BzVjYnL6xNc1Tjk7nWi6x/shxRay51eTtqWC+zfEaIG nNqHcvAJ/DPmBj2XolWJSRcPaYioqmruFtPCvIk9QOato3nGZoLk6de/uy04cGb2CU4w 3iqBHcDj2G2em3SJyQbEbVQYScBA1JSwQxO2UTYD56K0LzJzsHSZ4R3vpdYHRDzXj4RM wFSNLEfqUBKqlgjtbm+yYU7LDOKv2mwmT1ZKQQzi4l4sjhU6euvd1iItiSMZdPcsiGKd MjJKtSR1aNwGkOIGGFSBYlyoRYMzWY6DJVrsecxfdLvn1ZfJp8Ow68c1qS7wqk0pO8ET alpg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="vZfE9/Rd"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 eb9-20020a056a004c8900b0054342bb20e2si25092657pfb.66.2022.10.22.01.35.55; Sat, 22 Oct 2022 01:36: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="vZfE9/Rd"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S233614AbiJVIWl (ORCPT + 99 others); Sat, 22 Oct 2022 04:22:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50600 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233688AbiJVIUo (ORCPT ); Sat, 22 Oct 2022 04:20:44 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D18752B5BAD; Sat, 22 Oct 2022 00:58:37 -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 408ACB82E31; Sat, 22 Oct 2022 07:57:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 823AAC433C1; Sat, 22 Oct 2022 07:57:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425463; bh=iLfJweqofE4ePh5lC+qqoU4eiN4c6k2V77N1oN0Csjg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vZfE9/RdjGtcY19TDCgqBa0zDVNIQkKIc+KUgZOrwQvP4CdWLrrg4tPnsgv1RLXn5 F55buU55Tgi53N+Uv0bogebvrQhCAPgXf+XOm/Yb4O7YGDC6lZlQmKG3PIOUN6+DAj mtqg0kw9WXv/Y8Y8qsROOmhaxQNfVi9MX94j/Ius= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, James Cowgill , Herbert Xu , Sasha Levin Subject: [PATCH 5.19 509/717] hwrng: arm-smccc-trng - fix NO_ENTROPY handling Date: Sat, 22 Oct 2022 09:26:28 +0200 Message-Id: <20221022072520.767107550@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376166874463477?= X-GMAIL-MSGID: =?utf-8?q?1747376166874463477?= From: James Cowgill [ Upstream commit 042b4b169c6fb9d4df268d66282d7302dd73d37b ] The SMCCC_RET_TRNG_NO_ENTROPY switch arm is never used because the NO_ENTROPY return value is negative and negative values are handled above the switch by immediately returning. Fix by handling errors using a default arm in the switch. Fixes: 0888d04b47a1 ("hwrng: Add Arm SMCCC TRNG based driver") Signed-off-by: James Cowgill Signed-off-by: Herbert Xu Signed-off-by: Sasha Levin --- drivers/char/hw_random/arm_smccc_trng.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/char/hw_random/arm_smccc_trng.c b/drivers/char/hw_random/arm_smccc_trng.c index b24ac39a903b..e34c3ea692b6 100644 --- a/drivers/char/hw_random/arm_smccc_trng.c +++ b/drivers/char/hw_random/arm_smccc_trng.c @@ -71,8 +71,6 @@ static int smccc_trng_read(struct hwrng *rng, void *data, size_t max, bool wait) MAX_BITS_PER_CALL); arm_smccc_1_1_invoke(ARM_SMCCC_TRNG_RND, bits, &res); - if ((int)res.a0 < 0) - return (int)res.a0; switch ((int)res.a0) { case SMCCC_RET_SUCCESS: @@ -88,6 +86,8 @@ static int smccc_trng_read(struct hwrng *rng, void *data, size_t max, bool wait) return copied; cond_resched(); break; + default: + return -EIO; } } From patchwork Sat Oct 22 07:26: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: 7520 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1105151wrr; Sat, 22 Oct 2022 01:34:14 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6xlv4SQv4raSaAtpE2oGDImQFHZR0xx7rEtlbNHvQiDV2vD2SE4QtT1TlMfAXSq+B83jfS X-Received: by 2002:a63:c14:0:b0:456:d887:c83 with SMTP id b20-20020a630c14000000b00456d8870c83mr20023518pgl.53.1666427653945; Sat, 22 Oct 2022 01:34:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666427653; cv=none; d=google.com; s=arc-20160816; b=Z8HO2TIUTOAfhicHwcensMzfPyKAyo23T2y0PR9VxmS9OGJLCCH956wIVR4DZs3qj5 pCCNhl52+4XCzv9/4wJa7slOLFDkQem44keM4aKx0Ova6SxdMgmQHrmCqn+cFlvXWcGI 5sL0TcfNBzSht78OgfFnoA2FRSHdEoRg3Az5m7/LeKJRrSArRJv5Ay8XX7X1FNc140HX TeAkAjwxVexxI7S77BhCUYGVSal7isd+XHqTRnmstJzLTMb5JbhjWXzmyBXNB5X7aGjl f50XsvNEDyfVY0M0TbXBjFgt6S2onujk7TIdSMjM11O+Y/voJe8au8enOgjs6MQkhAA3 Q5Sg== 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=w6tz0U8UPKbtwhOkHEsa6Qf5NzLol/nzDz/Eru6RGwY=; b=EqOFn4ba1WfCL9PfKYlChLFt2Zz73bVsyjlbTocJDrVcLW/shNK3KV+i5zcjuUJLof ltdWP/XlexBl8wov467LD+TXUoEBTHKt9WPxLVqtFz2eSRWT4X9yEwWUyFO8eW/bIGXM ABDA5uuX+O3Af0XlXEJWW+vem9tE3yYxQAHfEWVaypsO9dHInpyP+Xu7RlpZLodqn8b6 6CHFSJzbfbagvhGdu88F5s63d8rT+b3/8wE31eIg2cawZUzjZIjN0wUn08+tjB6pI88I a6EaVr2VMsIfFO0wmMIqn+WAJF/x1HVb/zokZKiqnxw0voeiUejLi5E5zi4F/WJ6nsCc +RTw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=jz+tY4my; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 5-20020a631145000000b004428327e6dfsi29123035pgr.174.2022.10.22.01.33.56; Sat, 22 Oct 2022 01:34: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=jz+tY4my; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S230048AbiJVIV0 (ORCPT + 99 others); Sat, 22 Oct 2022 04:21:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50008 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233813AbiJVITs (ORCPT ); Sat, 22 Oct 2022 04:19:48 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 086162DF47B; Sat, 22 Oct 2022 00:58: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 99A5160B09; Sat, 22 Oct 2022 07:57:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8E5BDC433D7; Sat, 22 Oct 2022 07:57:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425467; bh=Oez0xSkPvwxIgWUhwxsQd8h6OI5hQd7QDtdeIIXp/vc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jz+tY4myBboT5enhvmu2t2vkaZ/vTI879TdBtEHSjKS3lUtfeC3I8bromMRq7ll/X UtuLSR34El4RfTG3HTUqh0rC3HLMXclEZj3vbzvX+w3U5CRXILK4TNMPFpfKlUBxKO mW5iFlNFnX2yohb9eaZRCymgwZXwYyMrXGIHTUwI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Peter Gonda , kernel test robot , Jacky Li , David Rientjes , Tom Lendacky , Herbert Xu , Sasha Levin Subject: [PATCH 5.19 510/717] crypto: ccp - Fail the PSP initialization when writing psp data file failed Date: Sat, 22 Oct 2022 09:26:29 +0200 Message-Id: <20221022072520.817573312@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376043608872335?= X-GMAIL-MSGID: =?utf-8?q?1747376043608872335?= From: Jacky Li [ Upstream commit efb4b01c1c993d245e6608076684ff2162cf9dc6 ] Currently the OS continues the PSP initialization when there is a write failure to the init_ex_file. Therefore, the userspace would be told that SEV is properly INIT'd even though the psp data file is not updated. This is problematic because later when asked for the SEV data, the OS won't be able to provide it. Fixes: 3d725965f836 ("crypto: ccp - Add SEV_INIT_EX support") Reported-by: Peter Gonda Reported-by: kernel test robot Signed-off-by: Jacky Li Acked-by: David Rientjes Acked-by: Tom Lendacky Signed-off-by: Herbert Xu Signed-off-by: Sasha Levin --- drivers/crypto/ccp/sev-dev.c | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/drivers/crypto/ccp/sev-dev.c b/drivers/crypto/ccp/sev-dev.c index 9f588c9728f8..6c49e6d06114 100644 --- a/drivers/crypto/ccp/sev-dev.c +++ b/drivers/crypto/ccp/sev-dev.c @@ -231,7 +231,7 @@ static int sev_read_init_ex_file(void) return 0; } -static void sev_write_init_ex_file(void) +static int sev_write_init_ex_file(void) { struct sev_device *sev = psp_master->sev_data; struct file *fp; @@ -241,14 +241,16 @@ static void sev_write_init_ex_file(void) lockdep_assert_held(&sev_cmd_mutex); if (!sev_init_ex_buffer) - return; + return 0; fp = open_file_as_root(init_ex_path, O_CREAT | O_WRONLY, 0600); if (IS_ERR(fp)) { + int ret = PTR_ERR(fp); + dev_err(sev->dev, - "SEV: could not open file for write, error %ld\n", - PTR_ERR(fp)); - return; + "SEV: could not open file for write, error %d\n", + ret); + return ret; } nwrite = kernel_write(fp, sev_init_ex_buffer, NV_LENGTH, &offset); @@ -259,18 +261,20 @@ static void sev_write_init_ex_file(void) dev_err(sev->dev, "SEV: failed to write %u bytes to non volatile memory area, ret %ld\n", NV_LENGTH, nwrite); - return; + return -EIO; } dev_dbg(sev->dev, "SEV: write successful to NV file\n"); + + return 0; } -static void sev_write_init_ex_file_if_required(int cmd_id) +static int sev_write_init_ex_file_if_required(int cmd_id) { lockdep_assert_held(&sev_cmd_mutex); if (!sev_init_ex_buffer) - return; + return 0; /* * Only a few platform commands modify the SPI/NV area, but none of the @@ -285,10 +289,10 @@ static void sev_write_init_ex_file_if_required(int cmd_id) case SEV_CMD_PEK_GEN: break; default: - return; + return 0; } - sev_write_init_ex_file(); + return sev_write_init_ex_file(); } static int __sev_do_cmd_locked(int cmd, void *data, int *psp_ret) @@ -361,7 +365,7 @@ static int __sev_do_cmd_locked(int cmd, void *data, int *psp_ret) cmd, reg & PSP_CMDRESP_ERR_MASK); ret = -EIO; } else { - sev_write_init_ex_file_if_required(cmd); + ret = sev_write_init_ex_file_if_required(cmd); } print_hex_dump_debug("(out): ", DUMP_PREFIX_OFFSET, 16, 2, data, From patchwork Sat Oct 22 07:26: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: 7611 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1106746wrr; Sat, 22 Oct 2022 01:38:52 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4R6aOmc9ShaPllFWMbubIvk2vIuxytA+6GapxkYsuQdLgfyJcjZqfJfPMI+FXI+L5dAg7v X-Received: by 2002:a05:6402:8cc:b0:45c:a5c9:c0a with SMTP id d12-20020a05640208cc00b0045ca5c90c0amr21083523edz.135.1666427932442; Sat, 22 Oct 2022 01:38:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666427932; cv=none; d=google.com; s=arc-20160816; b=WgJSOR5q16WDvDie5KWHp2IpUVSVm6ZV0l4E/UTc0MPaT1/uWNaj8ra/9qlunLaVVQ +dC+60Civ3PSw8fz5nHw1OlmnR4kFjn2jhawiWkEHh5NFomJcuQz6lPZ+AygJOSQdFOF 1s8G0pxnMri9Ea0Eb6CJoBeEmNXni77eWFhbbn0jwUGobf4aKcxBUoe20X/e7pgIsTl6 7uNRqJ49QIIDDgSce43kbVmC63mAt4d0L1DZqUgB+z1ZcEAcJ6rB8eTJZeo5LhlvofTa g9OY9MOpRoIqLt9GUcfJSxu5MLP6xINwz+Vp3MOMR6AWYuOT8LwPyZESfw17XjITxXMf 2Daw== 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=pvMe6m3X6tijpRe5l9xTDjeUV+n7R6qu7LhOjTQGdrY=; b=OZSvvgZkT2TYciWPYT5MDTV0pSDkvV41xYJxbEwEHn8KF/177fpTt++m/clPw/Szhe 7JcPsvhRXXgvmauTCywWjwc2/EWywTgaejj4IuGB5xWBtHR2iyYcS73PdSGZ8MgsA9ZU QmB5j4e1ibNfWLkCU7KIBdbeQ0m9m2VKR5HGASR9L4A9Ei0iOAejuRP2Vr7ywDlKkgMi 24HNQYYB/NrkjFzrnGqJdSv3K4xcijwOJhgpir2T0pZ0DTym5JPXhE5KJeNCAbI/jY8U NHoz7o8vfudvtJu3RJKxYYxKNFKaqw8GLFEeGoZoPPMKixp8/L1dCzbHJniJBS0nD0qP LTdg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=seW0QweO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 gn17-20020a1709070d1100b0078e254ae418si22027483ejc.640.2022.10.22.01.38.24; Sat, 22 Oct 2022 01:38: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=seW0QweO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S233677AbiJVIWf (ORCPT + 99 others); Sat, 22 Oct 2022 04:22:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43672 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233687AbiJVIUo (ORCPT ); Sat, 22 Oct 2022 04:20: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 D107313A580; Sat, 22 Oct 2022 00:58:37 -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 3E231B82E1A; Sat, 22 Oct 2022 07:57:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 951D1C433D7; Sat, 22 Oct 2022 07:57:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425470; bh=gLfPVt/hzTDak0xAaXlvDvTTkyu+KcPowc7Cv3qqwwU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=seW0QweOwDp2FZP1JiyQPs4Tm57YTXakAtJYivXyrmyZrDui5hEPYPEEhgGdhj8JE AXKWRQhe/+4UlFvX91T3M0RGJDZIas+5PfGldRP33/wBp2ItXA8WTAkCRStgEaCHC9 8vvusxK9XwjifKMc4zoJeFkZBSdo91nXHhtWk7Vs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?utf-8?q?Michal_Koutn=C3=BD?= , Tejun Heo , Sasha Levin Subject: [PATCH 5.19 511/717] cgroup: Honor callers cgroup NS when resolving path Date: Sat, 22 Oct 2022 09:26:30 +0200 Message-Id: <20221022072520.870616339@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376335897562559?= X-GMAIL-MSGID: =?utf-8?q?1747376335897562559?= From: Michal Koutný [ Upstream commit 74e4b956eb1cac0e4c10c240339b1bbfbc9a4c48 ] cgroup_get_from_path() is not widely used function. Its callers presume the path is resolved under cgroup namespace. (There is one caller currently and resolving in init NS won't make harm (netfilter). However, future users may be subject to different effects when resolving globally.) Since, there's currently no use for the global resolution, modify the existing function to take cgroup NS into account. Fixes: a79a908fd2b0 ("cgroup: introduce cgroup namespaces") Signed-off-by: Michal Koutný Signed-off-by: Tejun Heo Signed-off-by: Sasha Levin --- kernel/cgroup/cgroup.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/kernel/cgroup/cgroup.c b/kernel/cgroup/cgroup.c index 80c23f48f3b4..90019724c719 100644 --- a/kernel/cgroup/cgroup.c +++ b/kernel/cgroup/cgroup.c @@ -6615,8 +6615,12 @@ struct cgroup *cgroup_get_from_path(const char *path) { struct kernfs_node *kn; struct cgroup *cgrp = ERR_PTR(-ENOENT); + struct cgroup *root_cgrp; - kn = kernfs_walk_and_get(cgrp_dfl_root.cgrp.kn, path); + spin_lock_irq(&css_set_lock); + root_cgrp = current_cgns_cgroup_from_root(&cgrp_dfl_root); + kn = kernfs_walk_and_get(root_cgrp->kn, path); + spin_unlock_irq(&css_set_lock); if (!kn) goto out; From patchwork Sat Oct 22 07:26: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: 7528 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1105793wrr; Sat, 22 Oct 2022 01:36:12 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4FxyLtGTqS3fz0Rs4lLLkTttWXR8KkRa0BE6GkuFHIRyJ1gHmUIpoONrp/6LtmzHwBdBwx X-Received: by 2002:a65:6cc7:0:b0:42a:4d40:8dc1 with SMTP id g7-20020a656cc7000000b0042a4d408dc1mr19875686pgw.321.1666427772243; Sat, 22 Oct 2022 01:36:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666427772; cv=none; d=google.com; s=arc-20160816; b=EAr6I2PBit+EdDo4uTMkAfjOc2gbxKXGH65KKnigi8JgxOlm/k3fw3F3P92VNDgUs8 XoBf39Tt/O5xK6mLjlHCXth9iVw3h3dqQ0TV7O8TM7CN8r7V1yPBiQyd33SP9XXrUWF2 2GnEC6bb7cYA9JrH5KCK5xBhSrvLA5vjViw+dBPsYwxUQIXc9FRsq0IJgYBelqEvnUb6 g8gVO7wBrRqmhVJjDIr5qaoSSBU9Q3DtwnrXfjIOeuet7L8hMr5jcW+nJ5yPYmHp2ul1 loRkEvK6+JmKGP1qFQu1PAjB7QVCm6AJMbdVOvC63YLBvlaqO4xP6s2LfW9/WlY9FB1r PwVg== 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=Q/v9+hCYN23aUlx7E08CfeR6SDQ/ghKOiJPbb6JjnWA=; b=kgkSckYurZfN/msq2+m54lPmQ7kuhtFT72vL1pxX0BUYD3nLw1Cq84xpRyZkoDbqUd qvMGYQVOb7nTm/zZThLTJDP7rrir4Lc1LFfVH9BmnjhWBJf8MBq4U1HyJP9jK1ns5iyw NEuq+xGfalI44SjbGBrrKYWHYVDXz2GWtT6qyhwKk2emAzQo7xfABhd8YjrmBZJgZGfC ld0yi44iEuATEgDKOETPvmHMVnXY1wCHW3vRdEv1IQ0CJiM8yg8rgA5qxCN8/Bj1mhgO U/u3UwA7egma5mE0L1IKabOqzzqFw9elkMJ9fGMb1UWcuUuTEdz7LAAnjXiajmjgyI5B By9w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=IE28KD4i; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 mq11-20020a17090b380b00b0020a7e0138d2si10894987pjb.50.2022.10.22.01.35.55; Sat, 22 Oct 2022 01:36: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=IE28KD4i; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S233763AbiJVIXE (ORCPT + 99 others); Sat, 22 Oct 2022 04:23:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51802 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230127AbiJVIVA (ORCPT ); Sat, 22 Oct 2022 04:21:00 -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 2B2002DE46D; Sat, 22 Oct 2022 00:58: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 ams.source.kernel.org (Postfix) with ESMTPS id 62E7CB82E2D; Sat, 22 Oct 2022 07:57:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BF9D1C433C1; Sat, 22 Oct 2022 07:57:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425473; bh=b2T9RUet62fU3Ztf9GawhjllprseIO+DUXDl6aQp68Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IE28KD4irLTXgSO4qszzrdtzEebOXgGGCdak0qF5sDzQS6U/9zO6tA/fAFWmnFeRQ m8GOxJIA+t9U5rkfsxG0mSj2ZoKQ91YBrhbJ6jr3bRMzexCat2xiSBCx4iMHZxeZPc wvtbRUycafsIXcA9G5SmYfYUVjrJNO2OMdM92bl0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kshitiz Varshney , Herbert Xu , Sasha Levin Subject: [PATCH 5.19 512/717] hwrng: imx-rngc - Moving IRQ handler registering after imx_rngc_irq_mask_clear() Date: Sat, 22 Oct 2022 09:26:31 +0200 Message-Id: <20221022072520.918378507@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376167640899918?= X-GMAIL-MSGID: =?utf-8?q?1747376167640899918?= From: Kshitiz Varshney [ Upstream commit 10a2199caf437e893d9027d97700b3c6010048b7 ] Issue: While servicing interrupt, if the IRQ happens to be because of a SEED_DONE due to a previous boot stage, you end up completing the completion prematurely, hence causing kernel to crash while booting. Fix: Moving IRQ handler registering after imx_rngc_irq_mask_clear() Fixes: 1d5449445bd0 (hwrng: mx-rngc - add a driver for Freescale RNGC) Signed-off-by: Kshitiz Varshney Signed-off-by: Herbert Xu Signed-off-by: Sasha Levin --- drivers/char/hw_random/imx-rngc.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) --- a/drivers/char/hw_random/imx-rngc.c +++ b/drivers/char/hw_random/imx-rngc.c @@ -270,13 +270,6 @@ static int imx_rngc_probe(struct platfor goto err; } - ret = devm_request_irq(&pdev->dev, - irq, imx_rngc_irq, 0, pdev->name, (void *)rngc); - if (ret) { - dev_err(rngc->dev, "Can't get interrupt working.\n"); - goto err; - } - init_completion(&rngc->rng_op_done); rngc->rng.name = pdev->name; @@ -290,6 +283,13 @@ static int imx_rngc_probe(struct platfor imx_rngc_irq_mask_clear(rngc); + ret = devm_request_irq(&pdev->dev, + irq, imx_rngc_irq, 0, pdev->name, (void *)rngc); + if (ret) { + dev_err(rngc->dev, "Can't get interrupt working.\n"); + return ret; + } + if (self_test) { ret = imx_rngc_self_test(rngc); if (ret) { From patchwork Sat Oct 22 07:26: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: 7849 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1154917wrr; Sat, 22 Oct 2022 04:10:06 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6ZcVuxqoR/hHdqjpZDuc5rdJ0O0WrS9285fJTqwzNB/8U77Ai88szAal/A9lD9HT4xd7CW X-Received: by 2002:a17:907:2e19:b0:78e:11cc:3bc5 with SMTP id ig25-20020a1709072e1900b0078e11cc3bc5mr19648478ejc.543.1666437005930; Sat, 22 Oct 2022 04:10:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666437005; cv=none; d=google.com; s=arc-20160816; b=0fsLfmOBTFh0lxW2FVWBmJrzfZRWgvradqfEpFy36MwSbo+Pi15oY0cF7wSnis5F5f ngYvc8m3DsRqoo+ma3NLUtdgLHvNNUjkE1u2Rzq5A3DE4EKzx+jU2bfoxCCiTW2TlVZc j3OjArZWn/GDJQy0+Z491R5nWq+oAOs0AZenQYLQKt4y8aCbBsMgZD1sucvHFEDU1JQZ Pkm/6I7pv6BMB//VcDM5QVwfC3R/W4deLtAIChEsoCkBlWye9oYCSCbnJNB/0t47L0Fa tUn5kDXK1ush5FmOQGP6ilI47Evvs4/27oAw9DqW16Eob1MX8QskS8kcUuEFeLUmFSja IQNQ== 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=eBp7S9F95/JHolxKOxyqCzhzhLPacV4tuaEw9EH8h54=; b=L5ZERuBWYoie1It8GhynhjUT8YUjxPR2QY2waBPDztAMJK5ZqMV3KF0U0U9KwEZZ9r MR1MpRs5UCAY9kcj3PwbigFwjMv78/5pNA30sjrqwT0lgaRkVrEajaXPhCuKqf0CKc7J nbKEbtHp7nPUCGJFzMXAYmsQ/T/rjca3FzEUAx7hTNS3O6cFweOVLqsdJUEvTKcFebhC SD4rANp8VaLjMof4Er4mNyjxcY+xMkrXpRII0bI9f+SOZjEhnRvN/9+eVJdV0BoIR5Rz y5TaMBIR72Oirb9E3hAQZ5YobPP6m7smv/CrOcv9SkLanWZuJX8GFCZ3GYvLOfE1kVzk OquQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=gjwwCn3v; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 du3-20020a17090772c300b00734be0d7167si22214714ejc.825.2022.10.22.04.09.40; Sat, 22 Oct 2022 04:10: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=gjwwCn3v; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S230188AbiJVLHc (ORCPT + 99 others); Sat, 22 Oct 2022 07:07:32 -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 S230255AbiJVLHP (ORCPT ); Sat, 22 Oct 2022 07:07:15 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5046C19ABC4; Sat, 22 Oct 2022 03:25: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 sin.source.kernel.org (Postfix) with ESMTPS id C890ACE2CAF; Sat, 22 Oct 2022 07:57:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C1D18C433D6; Sat, 22 Oct 2022 07:57:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425476; bh=vujw5cF2w9ojqX9/fEY6xpNzZwk1Hc103xQkPvbWCdM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gjwwCn3vPUT5UXtSBbwHwv0toOeuGFBkY+TErYQOHPBc1JiLJ+BFvO3J2A8Mcv8rb SpzQTEumaq43kxu88ChRr7kaDS3lc/pfbi24R0AEYVCI6l10aQbHV7PNI+90sX/ax9 TQ1IO0N45NDp+OP0XFl7iLxccp85bCW3pXUoKoks= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Giovanni Cabiddu , Lucas Segarra Fernandez , Herbert Xu , Sasha Levin Subject: [PATCH 5.19 513/717] crypto: qat - fix default value of WDT timer Date: Sat, 22 Oct 2022 09:26:32 +0200 Message-Id: <20221022072520.961345437@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 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?1747385850227406010?= X-GMAIL-MSGID: =?utf-8?q?1747385850227406010?= From: Lucas Segarra Fernandez [ Upstream commit cc40b04c08400d86d2d6ea0159e0617e717f729c ] The QAT HW supports an hardware mechanism to detect an accelerator hang. The reporting of a hang occurs after a watchdog timer (WDT) expires. The value of the WDT set previously was too small and was causing false positives. Change the default value of the WDT to 0x7000000ULL to avoid this. Fixes: 1c4d9d5bbb5a ("crypto: qat - enable detection of accelerators hang") Reviewed-by: Giovanni Cabiddu Signed-off-by: Lucas Segarra Fernandez Signed-off-by: Herbert Xu Signed-off-by: Sasha Levin --- drivers/crypto/qat/qat_common/adf_gen4_hw_data.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/crypto/qat/qat_common/adf_gen4_hw_data.h b/drivers/crypto/qat/qat_common/adf_gen4_hw_data.h index 43b8f864806b..4fb4b3df5a18 100644 --- a/drivers/crypto/qat/qat_common/adf_gen4_hw_data.h +++ b/drivers/crypto/qat/qat_common/adf_gen4_hw_data.h @@ -107,7 +107,7 @@ do { \ * Timeout is in cycles. Clock speed may vary across products but this * value should be a few milli-seconds. */ -#define ADF_SSM_WDT_DEFAULT_VALUE 0x200000 +#define ADF_SSM_WDT_DEFAULT_VALUE 0x7000000ULL #define ADF_SSM_WDT_PKE_DEFAULT_VALUE 0x8000000 #define ADF_SSMWDTL_OFFSET 0x54 #define ADF_SSMWDTH_OFFSET 0x5C From patchwork Sat Oct 22 07:26: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: 7584 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1106320wrr; Sat, 22 Oct 2022 01:37:30 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5qhU3NkJugo0LdjxUfaqqGOZz97j7oVaq/x/dQUxHeZQMv5Xr29O5vCdpivP5rDelDvmtG X-Received: by 2002:a17:902:eb89:b0:185:33d:cb34 with SMTP id q9-20020a170902eb8900b00185033dcb34mr23289229plg.55.1666427850043; Sat, 22 Oct 2022 01:37:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666427850; cv=none; d=google.com; s=arc-20160816; b=TnLyoX+FLRzkkQkeaKa6kKe5Y8QQHPnSZq+9OtmRGPgvfrWY0muouP6JQc4SuZR8Dm +oijyAXSota2iB2HvfvM3ccY0Twb8voSc/sc567FZqP6KOnKOeTfEqXECKztdxAAGzIc 4OgXq67kCnuwqLYdrwZlHZosWHHLNEqeOadkXOs43tmaKO0gXeKNEKoVo7s6ECiF9TZm Yy/ZpaU6gpvXuAt/y/Xbmm7U2iudP+1KeSlP+GPKURgoqfSV44QB62mCaW7uwe5dnDln BDWhK3rjsN5jd6wroUtOxNbEq8OXTB4D6Bnl+0RhSuxxOsQqZUttOHUDACxO38n7oFOl Gk6w== 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=uZvUCTu4T2JTg8LdJK9vw+rzrfC2xSi8SJLrDaasu3A=; b=A27lM3Xr4jEsFpTssD86QrhfoVDB9D3+CuMSA1BHArQf/f51YeIaNiITW7dTeF2aTx 7jpHKqXbbOOimIoMPSOQZsckHpLIdCbJpZsS9VAx196cy5TKfQoaS+5/dzFQe73JiNjZ VhR+bEM1Mkltbe5lIP5f24IoGiLl2jZR61Eq9vFMeDXSF4BH9lvQAFPbT64amcQOdZn6 c3qsHipS2+QuMa7pqmdrHI88Rjt25ZUTIZ45IvQyWxCxK7fn9I3tdDOpPZZQ2F3eK5Bq NbDf/iHPli4WnBaTqrVo6ELFMPi0UpPIXD3k4RfjozKYfwnPikdiXlm23yvF61TZpQvU enWw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=DTDgSmyG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 i8-20020a17090332c800b0017f61b0bc5bsi30984597plr.557.2022.10.22.01.37.15; Sat, 22 Oct 2022 01:37: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=DTDgSmyG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S233783AbiJVIXQ (ORCPT + 99 others); Sat, 22 Oct 2022 04:23:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53204 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233791AbiJVIVP (ORCPT ); Sat, 22 Oct 2022 04:21: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 C49722E042B; Sat, 22 Oct 2022 00:58: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 ams.source.kernel.org (Postfix) with ESMTPS id 8BDAFB82DF2; Sat, 22 Oct 2022 07:58:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B1976C433C1; Sat, 22 Oct 2022 07:57:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425479; bh=pgwEOrNfjoygXqCf/s4qyI7U4E29PrLsa3xhHvAaEdg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DTDgSmyGdZcz0Hz4NA904MrYm73HeE5Vfygeans9ATElps33WNIbSf8guTE+poGIW tKOK+YRdIMR0syCJSRuK6Pjh8OVyZMkYZ4DrW1EMUEIFM+rF4gkhi2AewQgw5G23cu +B7OAXagwWlQEfUONzUllumM+eGiqsHyAwD5Bryg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Weili Qian , Herbert Xu , Sasha Levin Subject: [PATCH 5.19 514/717] crypto: hisilicon/qm - fix missing put dfx access Date: Sat, 22 Oct 2022 09:26:33 +0200 Message-Id: <20221022072521.012296213@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376248977948644?= X-GMAIL-MSGID: =?utf-8?q?1747376248977948644?= From: Weili Qian [ Upstream commit 5afc904f443de2afd31c4e0686ba178beede86fe ] In function qm_cmd_write(), if function returns from branch 'atomic_read(&qm->status.flags) == QM_STOP', the got dfx access is forgotten to put. Fixes: 607c191b371d ("crypto: hisilicon - support runtime PM for accelerator device") Signed-off-by: Weili Qian Signed-off-by: Herbert Xu Signed-off-by: Sasha Levin --- drivers/crypto/hisilicon/qm.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/crypto/hisilicon/qm.c b/drivers/crypto/hisilicon/qm.c index b4ca2eb034d7..eb82e9864d14 100644 --- a/drivers/crypto/hisilicon/qm.c +++ b/drivers/crypto/hisilicon/qm.c @@ -2229,8 +2229,10 @@ static ssize_t qm_cmd_write(struct file *filp, const char __user *buffer, return ret; /* Judge if the instance is being reset. */ - if (unlikely(atomic_read(&qm->status.flags) == QM_STOP)) - return 0; + if (unlikely(atomic_read(&qm->status.flags) == QM_STOP)) { + ret = 0; + goto put_dfx_access; + } if (count > QM_DBG_WRITE_LEN) { ret = -ENOSPC; From patchwork Sat Oct 22 07:26: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: 7561 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1106050wrr; Sat, 22 Oct 2022 01:36:46 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4wapF9do3ysepM90l3kC3c9CPr80jne5ouuAhr0/z4XdpMSlhTayyqS3n/o2WYWCaFM1p2 X-Received: by 2002:a17:90b:38c4:b0:20d:9dfa:4339 with SMTP id nn4-20020a17090b38c400b0020d9dfa4339mr59170281pjb.74.1666427806291; Sat, 22 Oct 2022 01:36:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666427806; cv=none; d=google.com; s=arc-20160816; b=OU/wAu+Tiyux03+7/+y28ofW2/EkleedVTiuBuhg5MTU2ZspP5H8+Hiy8mO6JIPmpq 3jPktQZKi8/NwfO4BBf/q/bJ69XTgL84tLSbJTWw+fbyEN814GNVhfV1fhXWElPLQY1g tzQqCfyLLwFhDgo0KlB8TNMroXPOB1ntfQPcRCfy6dgQwvUSdAaZeidU/tlg4krZzYrt GydZtHZCN6+ojTFDt8Zfh4t9RYGc9gertVkCm/wqWpgI/GsOJ2vJl4Tjz3l1sRA47JIm XJDFE6oU3bUySmz/w2vjKa5SKYG1NynO4hc+NNUxRe96PsAb+9n/wGG0NFwSl4OjWNTL +iJQ== 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=Zpv7QTHXImhI1udXCUjWDwKjVaTo65+gR5Rq4s7msoY=; b=bUKZY/ZhWx8y7/k7IccXZvCnFjr1Q+IkeDEZU1d7tlUfdj2IUytEKFlY9fMu+rjzw4 F0yvg1pPHt4X9SJoPx1mVNY2AQgV1bJn0SjXN2eyVfMN9EXvzcQzyz6L26OozUa08n8o UZoBsPM7C6SxW+uHEPgg8J4YR7DloK1Dgdcw2yMshw21dHj0eiBW9zvtd9DLdp5rhsYS p3EDO/iNJgpTv5ZNL2KMKT3cHNx8YUAPBvK5ChY1AW+pME79xGehKk7gm0k1T9S3QBq6 JoIQSuYzJM7uMk+6MCLIAQBw5hd5OLkeoyPr1N1jzPkziNkYgwVmjbHKV/0AN05djbLq jp9w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Legf1VSb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 bk13-20020a056a02028d00b0046040a8c03bsi26390271pgb.660.2022.10.22.01.36.29; Sat, 22 Oct 2022 01:36: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=Legf1VSb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S230036AbiJVIVL (ORCPT + 99 others); Sat, 22 Oct 2022 04:21:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54232 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233796AbiJVITo (ORCPT ); Sat, 22 Oct 2022 04:19: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 AFBE52B5B98; Sat, 22 Oct 2022 00:58: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 BFE9660B95; Sat, 22 Oct 2022 07:58:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C38B7C433D6; Sat, 22 Oct 2022 07:58:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425482; bh=cWRamBsDNvVDBJ3mqQVRbJszxwtXNpzWGuAkpTyTjgE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Legf1VSbfVzkMOqMWTxUx/ICNRQ+jqUjcX7j/JFGnWlGCa36UoCHFO+wsBiZRS/7K 7OwU8fX0SQBl7TULHE4mrBLPUzfgPtPdqpLWLKUyxS6q2J7WksfVqYdFwfP7qCUVx0 iztQU05V/Ae8H/MRvBIa7fGOyS5BO/LxzKbWU8mg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Waiman Long , Tejun Heo , Sasha Levin Subject: [PATCH 5.19 515/717] cgroup/cpuset: Enable update_tasks_cpumask() on top_cpuset Date: Sat, 22 Oct 2022 09:26:34 +0200 Message-Id: <20221022072521.055933064@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376203338998527?= X-GMAIL-MSGID: =?utf-8?q?1747376203338998527?= From: Waiman Long [ Upstream commit ec5fbdfb99d18482619ac42605cb80fbb56068ee ] Previously, update_tasks_cpumask() is not supposed to be called with top cpuset. With cpuset partition that takes CPUs away from the top cpuset, adjusting the cpus_mask of the tasks in the top cpuset is necessary. Percpu kthreads, however, are ignored. Fixes: ee8dde0cd2ce ("cpuset: Add new v2 cpuset.sched.partition flag") Signed-off-by: Waiman Long Signed-off-by: Tejun Heo Signed-off-by: Sasha Levin --- kernel/cgroup/cpuset.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/kernel/cgroup/cpuset.c b/kernel/cgroup/cpuset.c index 1f3a55297f39..50bf837571ac 100644 --- a/kernel/cgroup/cpuset.c +++ b/kernel/cgroup/cpuset.c @@ -33,6 +33,7 @@ #include #include #include +#include #include #include #include @@ -1127,10 +1128,18 @@ static void update_tasks_cpumask(struct cpuset *cs) { struct css_task_iter it; struct task_struct *task; + bool top_cs = cs == &top_cpuset; css_task_iter_start(&cs->css, 0, &it); - while ((task = css_task_iter_next(&it))) + while ((task = css_task_iter_next(&it))) { + /* + * Percpu kthreads in top_cpuset are ignored + */ + if (top_cs && (task->flags & PF_KTHREAD) && + kthread_is_per_cpu(task)) + continue; set_cpus_allowed_ptr(task, cs->effective_cpus); + } css_task_iter_end(&it); } @@ -2092,12 +2101,7 @@ static int update_prstate(struct cpuset *cs, int new_prs) update_flag(CS_CPU_EXCLUSIVE, cs, 0); } - /* - * Update cpumask of parent's tasks except when it is the top - * cpuset as some system daemons cannot be mapped to other CPUs. - */ - if (parent != &top_cpuset) - update_tasks_cpumask(parent); + update_tasks_cpumask(parent); if (parent->child_ecpus_count) update_sibling_cpumasks(parent, cs, &tmpmask); From patchwork Sat Oct 22 07:26: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: 7539 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1105873wrr; Sat, 22 Oct 2022 01:36:24 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7rnLcFPdAJwQX+8YBdgXiywY3Z3GqGGMmJesMv+NPhl8/UWH/LIrpK8DvxQJmLSkQV1KGI X-Received: by 2002:a05:6402:1906:b0:45d:db20:7709 with SMTP id e6-20020a056402190600b0045ddb207709mr20796707edz.406.1666427784837; Sat, 22 Oct 2022 01:36:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666427784; cv=none; d=google.com; s=arc-20160816; b=mibeCTYWJfkQjVJhRbyhFdWtnelL1JNAZRt3wWbJ7cX8kQIqFd+n/n/mulxazNh4Hq udHMS8+NEpDkpdZv3lAarxfPAdBnnq/uXJcOoCCh8vrMxooDSMo9r3R2G2fGY2XveUc/ N1xxChn/v6BF4hxmX9vnyeDjN9Nhn/xTLPMJ35vbbiRR4fDYl+UUM5h1JOwLNHnP7CBy dFneM+WY3Is4h+i+ZCEMZCWSBIQN0D178MrwrRy2edFvdFKoqf116KlKDbOsaWXpA7Ol EbXWu9m/LvAG6FxJPFrJZ2NImR3oSYbEUMPbQ/45ndrjd0vEToDBEqnTm2DeoA+zl9Qc IVeA== 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=Re463ur1U2wiu9FBcNtMjBkF7WpIaychu4lKxQTsQLs=; b=OF/LgUaHBoYw0ijWbyMzUD4OLgS4b6JtUM5a45wFgPIe8L2j1+ua4Ie9sG7IGyfxdB MDGSyfBnBfvJxtspTbFlAt9MiypFkKcCJ1Q6nTeuwQD6ZpS/ktsYU6rwhMlDizW4+7No mLMDjH0rzQu8zlolCOvOEW2HOK+86sApz0Z9F5DLYpKXHMBTy+ueIVvqXKvk3s337wEK /JXpgbkfrKNuv/iQ6i/szi+/I6DVmmWTg+FQ6lOd9NzmcP2luxI9g7qWGhy9QElRAv2l JllrqXUNCHfAXAqpi9g6uKwtWZPPjgEyVBkTVxV/ue8LpNRp90c+lPFwoJnSJzX3zZwZ vAfA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=M5QaGctB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 y14-20020a50ce0e000000b0045745ecd5a1si17988968edi.304.2022.10.22.01.35.55; Sat, 22 Oct 2022 01:36: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=M5QaGctB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S233750AbiJVIW1 (ORCPT + 99 others); Sat, 22 Oct 2022 04:22:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49458 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233655AbiJVIUe (ORCPT ); Sat, 22 Oct 2022 04:20: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 9F6332B5BAC; Sat, 22 Oct 2022 00:58: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 dfw.source.kernel.org (Postfix) with ESMTPS id A172960ADC; Sat, 22 Oct 2022 07:58:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A1443C433C1; Sat, 22 Oct 2022 07:58:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425485; bh=AlKGxA5oHb1mhMs88++LuDXBhLryEnVpofotGpHubyE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=M5QaGctB2iYXQx0I2xwiGTzTqFv1pW/xRQkkMp2dj6iiEdiJpEzWvpRYlbZcyTCUN W7vZc4c6sd47WzGeMEi0GfjoiASPDFW0/Ukh30Z7fVf5B7x/w7/jO7n9/uQbObjO9I mB1g528tgRA1C6jmKfCrGcvGax+ZNj9By2rosJC4= 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 5.19 516/717] iommu/omap: Fix buffer overflow in debugfs Date: Sat, 22 Oct 2022 09:26:35 +0200 Message-Id: <20221022072521.109506096@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376180841660088?= X-GMAIL-MSGID: =?utf-8?q?1747376180841660088?= 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 a99afb5d9011..259f65291d90 100644 --- a/drivers/iommu/omap-iommu-debug.c +++ b/drivers/iommu/omap-iommu-debug.c @@ -32,12 +32,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 Sat Oct 22 07:26: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: 7560 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1106039wrr; Sat, 22 Oct 2022 01:36:44 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6hJMc+jOIE56muz8oPLdxLUBW1uUz0beH5mYcI+O+8JkK9ZGs9LeNTC3GOWJIJn+xW/WFe X-Received: by 2002:a17:902:f602:b0:178:9818:48a4 with SMTP id n2-20020a170902f60200b00178981848a4mr23107824plg.148.1666427804626; Sat, 22 Oct 2022 01:36:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666427804; cv=none; d=google.com; s=arc-20160816; b=H1u6Y1PUdLcXld+GS301PxacpRA2v05GIeRbLs3yeYIiHyWu3T1ipi452SUzGnCuVk 8d5UMdnN6W0LdxmHVhpTS+uMSTonD7lvU3kbnh3n7Cq/3bNt2q9EwXNkW7HJ635XlAzw FnB190s8+AZ3hm50mWI9x2qe6C43xxYuR2dT/X3HmyHPOTgsDwg6r+8PwmgWnF707UTr sC5gfFb6dRFcK63yh/8vsvoUgDNwu8Oz3mA3S/sRCX6HDjUc+inlfjh5rCMe+/+cePb9 iehx5MObeIk9R1XmD8soWDSRzZhrLrSa1hQt7EVW/vSeO5NymTYBKgp6bPLPVewuRwrp rX9Q== 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=s4TDZAiNiYSUYVklnJSXPar7Ef7VYkLcVSdzRuKqZDE=; b=q7rxh89/R13OJ1BsAA3PTPm9n69tAYSWrBJtFGNPGwYx27UAqJastYggXdYn97fu3w ALTorw+vw73Ujoo5mjw5igj3u2UOnZI+eJzPjcFEuqUwzLB3cOB30oW9H/8DiQgoFktj mXGJA3fkY0HALXox+bELzYxn4cjJ4t8Lssa2e7uGPv9+YemHMNS3qpsizozlZ8Ku2syq b2+vbWOHFk0tkSXuq/wjkXTcLbu914Fpzb0eg9HNomjfgBpCpjHqlyuuBYhEf9mVczbI EgqEo0M9B1DDSM2+Qyk+0GTUshnXRRkOr69rcDCKA+qnRLg7pwox72en5jim8OdWgoIP nDSQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Q48ZTopR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 i9-20020a17090332c900b0017f7de32cb0si30962885plr.85.2022.10.22.01.36.27; Sat, 22 Oct 2022 01:36: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=Q48ZTopR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S233808AbiJVI0U (ORCPT + 99 others); Sat, 22 Oct 2022 04:26:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46832 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234069AbiJVIYl (ORCPT ); Sat, 22 Oct 2022 04:24:41 -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 260F35D894; Sat, 22 Oct 2022 01:00: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 B0DAA60B40; Sat, 22 Oct 2022 07:58:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A4598C433C1; Sat, 22 Oct 2022 07:58:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425488; bh=NI1fBXPVYlDZ4B6j6GMBIhhEi5k4CLiLesxDmWTMZN8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Q48ZTopRp9I5z4OnjJqvBCuB+HbLzOsxSkgHiMOLlH8alBh5jnqkeKG6ef98tAJzW jdvViRoeCE8SzMlU/1OfDykjp6ISuaW3bSs5grrdq3YKcPhCvEehrumbbX3A9yXPRF JcLCNz33JGanPAZ0llXIoRHTzzzUXIs2KnTF2GCY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ignat Korchagin , Herbert Xu , Sasha Levin Subject: [PATCH 5.19 517/717] crypto: akcipher - default implementation for setting a private key Date: Sat, 22 Oct 2022 09:26:36 +0200 Message-Id: <20221022072521.161399308@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376201272172136?= X-GMAIL-MSGID: =?utf-8?q?1747376201272172136?= From: Ignat Korchagin [ Upstream commit bc155c6c188c2f0c5749993b1405673d25a80389 ] Changes from v1: * removed the default implementation from set_pub_key: it is assumed that an implementation must always have this callback defined as there are no use case for an algorithm, which doesn't need a public key Many akcipher implementations (like ECDSA) support only signature verifications, so they don't have all callbacks defined. Commit 78a0324f4a53 ("crypto: akcipher - default implementations for request callbacks") introduced default callbacks for sign/verify operations, which just return an error code. However, these are not enough, because before calling sign the caller would likely call set_priv_key first on the instantiated transform (as the in-kernel testmgr does). This function does not have a default stub, so the kernel crashes, when trying to set a private key on an akcipher, which doesn't support signature generation. I've noticed this, when trying to add a KAT vector for ECDSA signature to the testmgr. With this patch the testmgr returns an error in dmesg (as it should) instead of crashing the kernel NULL ptr dereference. Fixes: 78a0324f4a53 ("crypto: akcipher - default implementations for request callbacks") Signed-off-by: Ignat Korchagin Signed-off-by: Herbert Xu Signed-off-by: Sasha Levin --- crypto/akcipher.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/crypto/akcipher.c b/crypto/akcipher.c index f866085c8a4a..ab975a420e1e 100644 --- a/crypto/akcipher.c +++ b/crypto/akcipher.c @@ -120,6 +120,12 @@ static int akcipher_default_op(struct akcipher_request *req) return -ENOSYS; } +static int akcipher_default_set_key(struct crypto_akcipher *tfm, + const void *key, unsigned int keylen) +{ + return -ENOSYS; +} + int crypto_register_akcipher(struct akcipher_alg *alg) { struct crypto_alg *base = &alg->base; @@ -132,6 +138,8 @@ int crypto_register_akcipher(struct akcipher_alg *alg) alg->encrypt = akcipher_default_op; if (!alg->decrypt) alg->decrypt = akcipher_default_op; + if (!alg->set_priv_key) + alg->set_priv_key = akcipher_default_set_key; akcipher_prepare_alg(alg); return crypto_register_alg(base); From patchwork Sat Oct 22 07:26: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: 7587 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1106329wrr; Sat, 22 Oct 2022 01:37:31 -0700 (PDT) X-Google-Smtp-Source: AMsMyM46OotBaK6DEEwHqleT1hyiMna5fJgnucU6+Hq7Vds/dyoSClOImXscnGbM3v9CfWxzX8So X-Received: by 2002:a17:90b:4c86:b0:20d:8410:d829 with SMTP id my6-20020a17090b4c8600b0020d8410d829mr27644767pjb.146.1666427851477; Sat, 22 Oct 2022 01:37:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666427851; cv=none; d=google.com; s=arc-20160816; b=NX1Yv48T1qoQsdN89ZYhAfLlLkJLqgzWZ5D/NIZya6Q4MixWhy7rQIwnAjcdsAaw54 ddLi9BtvUHcS04RljkMvzyEgG6F4gdOFvfSRubcxHcp0DIjCWtfHaLpd7MYVzNYHA485 z6/ejcCC7lci5dGruhQ8BGmABbPGVLUa8RDvi53qcWR+ZvyXAKqOhe3BKwdOxEx1jC1J 6UJ2ZIeKkpKcn6i7AokNhSXHUwfOnJ5mI1oFt6RsZkC1FNY0PFhwtRCVbbQ4cyT8UKJR Bb9F03SFnxaCNk8ja4qZOgA8uGvSHYPp27T/Fc2vgIGF11UHYBIyoRAHe2hCTnAcQNtp vjAA== 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=AThQeGQYCqQqT78FfOQVeY0zAyJGPYQUpAdkc3HP4j4=; b=urguvAaTIPpIyiwVNoDr8nQcJULkIS4jbCYxHJ+R6UEE+JsjLvx6VZJ5ycCUBL6Iz9 cDvleDlwA94AM93/HWyPhcBWI6ZilLVaVpHHSnW00XPqeEH7tKNLirbqE2GU3/FD2Zj7 /UYe1av2ne9CHzAiXC7rkVt1ncuL/7YtFbCA0F2wdtbVCLy9VfzFTzCQhsk/0wCJkIV/ Vhmc4LbaeS2NpWmHsrYrB5AQQJsUSD4MIyQeRT5mfCZ2YEJmQVGdQuiKowC4HYPqv8lk 6tV0LWvQ42n+bedSVdhyLCJxR3dDEb4O/fCith8+vqR1d45dbJ0ZeZHbS4u9ZzWIVA59 3mgQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=wpqvMr9i; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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-20020a170902f70700b001841134e3b1si27755764plo.160.2022.10.22.01.37.17; Sat, 22 Oct 2022 01:37: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=wpqvMr9i; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S233818AbiJVIX3 (ORCPT + 99 others); Sat, 22 Oct 2022 04:23:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45486 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233822AbiJVIVT (ORCPT ); Sat, 22 Oct 2022 04:21: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 1686531371; Sat, 22 Oct 2022 00:58: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 C3ED7B82DFE; Sat, 22 Oct 2022 07:58:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1D1CBC433D6; Sat, 22 Oct 2022 07:58:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425494; bh=HDYsHqlawLyMenwDf+zZ2I9OXsat/1lMky2g1FD+N7I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wpqvMr9icWunlhIKz8Ze+yHt408fcULQQm6GfBFpptbMwod04e7/3S5LlIEJuMF+/ Gc/WYzuIuwyzH3fdy4LIqHNAFnyk2zxeN0pc9B95nOeWbyT+P7IsrhCL1KgWeEowCc dY+4Q6jADVwHx/mP5Ee+hiaW9Sgp9Y1wRRS/daOA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, kernel test robot , Koba Ko , Tom Lendacky , Herbert Xu , Sasha Levin Subject: [PATCH 5.19 518/717] crypto: ccp - Release dma channels before dmaengine unrgister Date: Sat, 22 Oct 2022 09:26:37 +0200 Message-Id: <20221022072521.213056994@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376250600306214?= X-GMAIL-MSGID: =?utf-8?q?1747376250600306214?= From: Koba Ko [ Upstream commit 68dbe80f5b510c66c800b9e8055235c5b07e37d1 ] A warning is shown during shutdown, __dma_async_device_channel_unregister called while 2 clients hold a reference WARNING: CPU: 15 PID: 1 at drivers/dma/dmaengine.c:1110 __dma_async_device_channel_unregister+0xb7/0xc0 Call dma_release_channel for occupied channles before dma_async_device_unregister. Fixes: 54cce8ecb925 ("crypto: ccp - ccp_dmaengine_unregister release dma channels") Reported-by: kernel test robot Signed-off-by: Koba Ko Acked-by: Tom Lendacky Signed-off-by: Herbert Xu Signed-off-by: Sasha Levin --- drivers/crypto/ccp/ccp-dmaengine.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/crypto/ccp/ccp-dmaengine.c b/drivers/crypto/ccp/ccp-dmaengine.c index 7d4b4ad1db1f..9f753cb4f5f1 100644 --- a/drivers/crypto/ccp/ccp-dmaengine.c +++ b/drivers/crypto/ccp/ccp-dmaengine.c @@ -641,6 +641,10 @@ static void ccp_dma_release(struct ccp_device *ccp) for (i = 0; i < ccp->cmd_q_count; i++) { chan = ccp->ccp_dma_chan + i; dma_chan = &chan->dma_chan; + + if (dma_chan->client_count) + dma_release_channel(dma_chan); + tasklet_kill(&chan->cleanup_tasklet); list_del_rcu(&dma_chan->device_node); } @@ -766,8 +770,8 @@ void ccp_dmaengine_unregister(struct ccp_device *ccp) if (!dmaengine) return; - dma_async_device_unregister(dma_dev); ccp_dma_release(ccp); + dma_async_device_unregister(dma_dev); kmem_cache_destroy(ccp->dma_desc_cache); kmem_cache_destroy(ccp->dma_cmd_cache); From patchwork Sat Oct 22 07:26: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: 7544 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1105887wrr; Sat, 22 Oct 2022 01:36:26 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7/guY7AqHfuF+h9bGz6/i3fj4zFfQ4FWCX2GWVRw6/uzFyscRsITN3BcD+cyUYvZsYu4lz X-Received: by 2002:a17:90b:4f8a:b0:212:cf2f:ea7e with SMTP id qe10-20020a17090b4f8a00b00212cf2fea7emr8389038pjb.66.1666427786430; Sat, 22 Oct 2022 01:36:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666427786; cv=none; d=google.com; s=arc-20160816; b=NKVxd7h9cRYZePmt5ZbElnjL8+O4+oryI+YMqvDaFwnXJd4vSOYRmE4oA5w5/z9Cqb i/G1wBCbsteNLBVux2ZGHsKGaMrg2lEuCNj6wvsHILK2oBrYKa2sPOqLQ1sEQXhTqE+f BBhh4hEe2CUZJ/WR65LxGcFcbbVjipvsZW1Eun+TB9eP+/oz3GawrPBHjFLf1m1hdnAt jm5tDK8NhKwVfPlKGIr2CO1M5dDyDHbK0+6Y4IyL3ieUOFg3xz5XvX6nBlfFXULFYazT jI9UhsC2+ykAiWmQgt366ifM5ss5vtHASLRcIvhvAnY1X52pu3qeQdvEIT6qY/pr9JbP b3kw== 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=7x2n/RkekdGOKth6jNyMxgSl4XjLQSVzhxcKcZ4+GV8=; b=QfiNaxmAe/15z3rxYrCnYiB69UWKjtQas915u40sX05vsGHd0wlhza3TvN1xE2wPv+ xk5qLl7PPIUPZzns2CsOEdEyAEWtS00hM9Fdb/1W3Fcl/ktqhOM23BSUisqVENEfHN2F W1YZus5Y7RhKTypycXaymMIndiJKUF6bpZnsc4S9SJFzHP+oyHbeVYeARGKZJLFKpfmY d8dQO8ZOKfSuQXxHzvoWNcyPrXkNEq0pii6v23hC4EbheDtqXeWKl8KgN7OY1trHK+y6 zStW0jV25Cak4nQid1mN7hIGVwiQZbdPIpz/Sz/LgSwNNx6MgQgwc1OaeDx0mBISeDk3 pBIA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=0BqF1OTP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 k138-20020a628490000000b00562dda10caesi26537225pfd.245.2022.10.22.01.36.11; Sat, 22 Oct 2022 01:36: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=0BqF1OTP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S230017AbiJVI1P (ORCPT + 99 others); Sat, 22 Oct 2022 04:27:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37082 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233586AbiJVIZh (ORCPT ); Sat, 22 Oct 2022 04:25:37 -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 462CB1826FE; Sat, 22 Oct 2022 01:00: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 F0810B82E1E; Sat, 22 Oct 2022 07:58:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 48964C433D6; Sat, 22 Oct 2022 07:58:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425497; bh=V158gqfaGOuKvv7mls5uKxEIcANh4s5FzQov9SkR/sc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0BqF1OTPs7yz7ovNxRLXEaQ3tBY9u3yi6UC33oyXkKLxn8r8JWG6o43Mm/iJygcW6 79vvRXhtDCAPB8Hgb77iKHIDjp5LZNAlNkUhh5beUzpMvk7qdu47RDLLhU/B20SZM5 dJPtJBiBVWoWw88BexnFnCeF7B8TJEd4ojpeZvDc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Peter Harliman Liem , Antoine Tenart , Herbert Xu , Sasha Levin Subject: [PATCH 5.19 519/717] crypto: inside-secure - Change swab to swab32 Date: Sat, 22 Oct 2022 09:26:38 +0200 Message-Id: <20221022072521.251498785@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376182509448618?= X-GMAIL-MSGID: =?utf-8?q?1747376182509448618?= From: Peter Harliman Liem [ Upstream commit 664593407e936b6438fbfaaf98876910fd31cf9a ] The use of swab() is causing failures in 64-bit arch, as it translates to __swab64() instead of the intended __swab32(). It eventually causes wrong results in xcbcmac & cmac algo. Fixes: 78cf1c8bfcb8 ("crypto: inside-secure - Move ipad/opad into safexcel_context") Signed-off-by: Peter Harliman Liem Acked-by: Antoine Tenart Signed-off-by: Herbert Xu Signed-off-by: Sasha Levin --- drivers/crypto/inside-secure/safexcel_hash.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/crypto/inside-secure/safexcel_hash.c b/drivers/crypto/inside-secure/safexcel_hash.c index bc60b5802256..2124416742f8 100644 --- a/drivers/crypto/inside-secure/safexcel_hash.c +++ b/drivers/crypto/inside-secure/safexcel_hash.c @@ -383,7 +383,7 @@ static int safexcel_ahash_send_req(struct crypto_async_request *async, int ring, u32 x; x = ipad[i] ^ ipad[i + 4]; - cache[i] ^= swab(x); + cache[i] ^= swab32(x); } } cache_len = AES_BLOCK_SIZE; @@ -821,7 +821,7 @@ static int safexcel_ahash_final(struct ahash_request *areq) u32 *result = (void *)areq->result; /* K3 */ - result[i] = swab(ctx->base.ipad.word[i + 4]); + result[i] = swab32(ctx->base.ipad.word[i + 4]); } areq->result[0] ^= 0x80; // 10- padding crypto_cipher_encrypt_one(ctx->kaes, areq->result, areq->result); @@ -2106,7 +2106,7 @@ static int safexcel_xcbcmac_setkey(struct crypto_ahash *tfm, const u8 *key, crypto_cipher_encrypt_one(ctx->kaes, (u8 *)key_tmp + AES_BLOCK_SIZE, "\x3\x3\x3\x3\x3\x3\x3\x3\x3\x3\x3\x3\x3\x3\x3\x3"); for (i = 0; i < 3 * AES_BLOCK_SIZE / sizeof(u32); i++) - ctx->base.ipad.word[i] = swab(key_tmp[i]); + ctx->base.ipad.word[i] = swab32(key_tmp[i]); crypto_cipher_clear_flags(ctx->kaes, CRYPTO_TFM_REQ_MASK); crypto_cipher_set_flags(ctx->kaes, crypto_ahash_get_flags(tfm) & @@ -2189,7 +2189,7 @@ static int safexcel_cmac_setkey(struct crypto_ahash *tfm, const u8 *key, return ret; for (i = 0; i < len / sizeof(u32); i++) - ctx->base.ipad.word[i + 8] = swab(aes.key_enc[i]); + ctx->base.ipad.word[i + 8] = swab32(aes.key_enc[i]); /* precompute the CMAC key material */ crypto_cipher_clear_flags(ctx->kaes, CRYPTO_TFM_REQ_MASK); From patchwork Sat Oct 22 07:26: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: 7588 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1106328wrr; Sat, 22 Oct 2022 01:37:31 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4/Lq21JeyIN7xQu1z+6Vhp9SX+vrO/xKgfBFHhpYmX1aUpNTsBWxlyWF7AWlybXKqnNQGx X-Received: by 2002:a65:42c8:0:b0:41a:8138:f47f with SMTP id l8-20020a6542c8000000b0041a8138f47fmr19986385pgp.476.1666427851483; Sat, 22 Oct 2022 01:37:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666427851; cv=none; d=google.com; s=arc-20160816; b=QSYzBAOSGtdw/AgoSzu82sGapO/qS8TFz1JAanZyeIq5LLDNTTQTtO4E5mJTaoHG4s GYrCXnCr6evuxkJ88WTyFLldr/vwNKZKTpCe7yZW/FnNKYAwe5PSmzuixd9/yZsiaJ/y 2OAxxhU3JEdeWoIcPk7mDjlyqb5NMaQEEceCcbm6fSb1Xj1ylA9RNrhrXXVGW708c/hu lHhoLsvReANu+f8tDLNvlI1zhOXZn3w3q2+vZX/0PukwMsO1eoHcs/x0ap8Q/+SuhMFa 3o9h6MV0dS18UWBlB+DpcgElW8mtWOp3+i+QrAxm4EYnDafTA2zA1+cyEIoOw4oRQ1HK m/Gg== 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=953aYWR9mJAZKQoY/4agSSKTCHgqoOGvu7KaNhOtfkk=; b=ETQ1fuNjba8nD0qqbZrXajUxpULGkZkH+jPaBs5D9BzNWfVTJ1PrlgeJCpVpdniJ67 HcDSneEXUgwa6cL4Wpg8b+6DQzHjHUqFIyf9xJIM01ZMAfg5xz++m77LaXUFFMNF4SYi HQ48hbUFP0acOaeuEUTEwGCkP0uNYR6SpS5S6NjQh9Zabk8WZF/6n4KPL1p7UQrLZwaa tQT1rbSrm0SjhHe/vNXdkAuTnMMiKk7UUNCxU/Efj/RzKk0mM4YGjmXBNL6eJuv7TJxh vBmDzj3oMcNJGT07+BJ2JVejdO8fOG7dNwMbIMNzqMIIosBaIJ3zECiBkWOQd6bnD913 Jmww== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Vmz5SYn6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 n9-20020a170902f60900b0017f73e4af01si11738406plg.298.2022.10.22.01.37.16; Sat, 22 Oct 2022 01:37: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=Vmz5SYn6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S233860AbiJVIXd (ORCPT + 99 others); Sat, 22 Oct 2022 04:23:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53804 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230299AbiJVIVT (ORCPT ); Sat, 22 Oct 2022 04:21: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 776B06503B; Sat, 22 Oct 2022 00: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 ams.source.kernel.org (Postfix) with ESMTPS id F3771B82E0F; Sat, 22 Oct 2022 07:58:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5AF10C433C1; Sat, 22 Oct 2022 07:58:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425500; bh=jhIWUs5sEtmpmfHv1g5CP9m8YF68xxWpT8UvFPPUhss=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Vmz5SYn65kfZgIVGLWhRII9t+1oTXwO4k2+4//ENMyHvMEEnRQifoCBNK7xheIDB7 +lXMDK9QbykS0p07zQgICP+ft9stCTS13nwCdKoqr84VxsPnEp1Xi8CdVkNVBgS81q tRuXic50yK1mqayYEPfrdVynnDzcD2fcvFQDF8D4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Damian Muszynski , Giovanni Cabiddu , Herbert Xu , Sasha Levin Subject: [PATCH 5.19 520/717] crypto: qat - fix DMA transfer direction Date: Sat, 22 Oct 2022 09:26:39 +0200 Message-Id: <20221022072521.301947506@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376250609436568?= X-GMAIL-MSGID: =?utf-8?q?1747376250609436568?= From: Damian Muszynski [ Upstream commit cf5bb835b7c8a5fee7f26455099cca7feb57f5e9 ] When CONFIG_DMA_API_DEBUG is selected, while running the crypto self test on the QAT crypto algorithms, the function add_dma_entry() reports a warning similar to the one below, saying that overlapping mappings are not supported. This occurs in tests where the input and the output scatter list point to the same buffers (i.e. two different scatter lists which point to the same chunks of memory). The logic that implements the mapping uses the flag DMA_BIDIRECTIONAL for both the input and the output scatter lists which leads to overlapped write mappings. These are not supported by the DMA layer. Fix by specifying the correct DMA transfer directions when mapping buffers. For in-place operations where the input scatter list matches the output scatter list, buffers are mapped once with DMA_BIDIRECTIONAL, otherwise input buffers are mapped using the flag DMA_TO_DEVICE and output buffers are mapped with DMA_FROM_DEVICE. Overlapping a read mapping with a write mapping is a valid case in dma-coherent devices like QAT. The function that frees and unmaps the buffers, qat_alg_free_bufl() has been changed accordingly to the changes to the mapping function. DMA-API: 4xxx 0000:06:00.0: cacheline tracking EEXIST, overlapping mappings aren't supported WARNING: CPU: 53 PID: 4362 at kernel/dma/debug.c:570 add_dma_entry+0x1e9/0x270 ... Call Trace: dma_map_page_attrs+0x82/0x2d0 ? preempt_count_add+0x6a/0xa0 qat_alg_sgl_to_bufl+0x45b/0x990 [intel_qat] qat_alg_aead_dec+0x71/0x250 [intel_qat] crypto_aead_decrypt+0x3d/0x70 test_aead_vec_cfg+0x649/0x810 ? number+0x310/0x3a0 ? vsnprintf+0x2a3/0x550 ? scnprintf+0x42/0x70 ? valid_sg_divisions.constprop.0+0x86/0xa0 ? test_aead_vec+0xdf/0x120 test_aead_vec+0xdf/0x120 alg_test_aead+0x185/0x400 alg_test+0x3d8/0x500 ? crypto_acomp_scomp_free_ctx+0x30/0x30 ? __schedule+0x32a/0x12a0 ? ttwu_queue_wakelist+0xbf/0x110 ? _raw_spin_unlock_irqrestore+0x23/0x40 ? try_to_wake_up+0x83/0x570 ? _raw_spin_unlock_irqrestore+0x23/0x40 ? __set_cpus_allowed_ptr_locked+0xea/0x1b0 ? crypto_acomp_scomp_free_ctx+0x30/0x30 cryptomgr_test+0x27/0x50 kthread+0xe6/0x110 ? kthread_complete_and_exit+0x20/0x20 ret_from_fork+0x1f/0x30 Fixes: d370cec ("crypto: qat - Intel(R) QAT crypto interface") Link: https://lore.kernel.org/linux-crypto/20220223080400.139367-1-gilad@benyossef.com/ Signed-off-by: Damian Muszynski Signed-off-by: Giovanni Cabiddu Signed-off-by: Herbert Xu Signed-off-by: Sasha Levin --- drivers/crypto/qat/qat_common/qat_algs.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/drivers/crypto/qat/qat_common/qat_algs.c b/drivers/crypto/qat/qat_common/qat_algs.c index 148edbe379e3..0828d856d6b0 100644 --- a/drivers/crypto/qat/qat_common/qat_algs.c +++ b/drivers/crypto/qat/qat_common/qat_algs.c @@ -673,11 +673,14 @@ static void qat_alg_free_bufl(struct qat_crypto_instance *inst, dma_addr_t blpout = qat_req->buf.bloutp; size_t sz = qat_req->buf.sz; size_t sz_out = qat_req->buf.sz_out; + int bl_dma_dir; int i; + bl_dma_dir = blp != blpout ? DMA_TO_DEVICE : DMA_BIDIRECTIONAL; + for (i = 0; i < bl->num_bufs; i++) dma_unmap_single(dev, bl->bufers[i].addr, - bl->bufers[i].len, DMA_BIDIRECTIONAL); + bl->bufers[i].len, bl_dma_dir); dma_unmap_single(dev, blp, sz, DMA_TO_DEVICE); @@ -691,7 +694,7 @@ static void qat_alg_free_bufl(struct qat_crypto_instance *inst, for (i = bufless; i < blout->num_bufs; i++) { dma_unmap_single(dev, blout->bufers[i].addr, blout->bufers[i].len, - DMA_BIDIRECTIONAL); + DMA_FROM_DEVICE); } dma_unmap_single(dev, blpout, sz_out, DMA_TO_DEVICE); @@ -716,6 +719,7 @@ static int qat_alg_sgl_to_bufl(struct qat_crypto_instance *inst, struct scatterlist *sg; size_t sz_out, sz = struct_size(bufl, bufers, n); int node = dev_to_node(&GET_DEV(inst->accel_dev)); + int bufl_dma_dir; if (unlikely(!n)) return -EINVAL; @@ -733,6 +737,8 @@ static int qat_alg_sgl_to_bufl(struct qat_crypto_instance *inst, qat_req->buf.sgl_src_valid = true; } + bufl_dma_dir = sgl != sglout ? DMA_TO_DEVICE : DMA_BIDIRECTIONAL; + for_each_sg(sgl, sg, n, i) bufl->bufers[i].addr = DMA_MAPPING_ERROR; @@ -744,7 +750,7 @@ static int qat_alg_sgl_to_bufl(struct qat_crypto_instance *inst, bufl->bufers[y].addr = dma_map_single(dev, sg_virt(sg), sg->length, - DMA_BIDIRECTIONAL); + bufl_dma_dir); bufl->bufers[y].len = sg->length; if (unlikely(dma_mapping_error(dev, bufl->bufers[y].addr))) goto err_in; @@ -787,7 +793,7 @@ static int qat_alg_sgl_to_bufl(struct qat_crypto_instance *inst, bufers[y].addr = dma_map_single(dev, sg_virt(sg), sg->length, - DMA_BIDIRECTIONAL); + DMA_FROM_DEVICE); if (unlikely(dma_mapping_error(dev, bufers[y].addr))) goto err_out; bufers[y].len = sg->length; @@ -817,7 +823,7 @@ static int qat_alg_sgl_to_bufl(struct qat_crypto_instance *inst, if (!dma_mapping_error(dev, buflout->bufers[i].addr)) dma_unmap_single(dev, buflout->bufers[i].addr, buflout->bufers[i].len, - DMA_BIDIRECTIONAL); + DMA_FROM_DEVICE); if (!qat_req->buf.sgl_dst_valid) kfree(buflout); @@ -831,7 +837,7 @@ static int qat_alg_sgl_to_bufl(struct qat_crypto_instance *inst, if (!dma_mapping_error(dev, bufl->bufers[i].addr)) dma_unmap_single(dev, bufl->bufers[i].addr, bufl->bufers[i].len, - DMA_BIDIRECTIONAL); + bufl_dma_dir); if (!qat_req->buf.sgl_src_valid) kfree(bufl); From patchwork Sat Oct 22 07:26: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: 7596 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1106381wrr; Sat, 22 Oct 2022 01:37:42 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7vad6mfZgzMgQQj78qmPTbBVa0yP/6fIpE7fiWDN+cyueEGIkpM9sXAJFLegtvxhZ8Da+7 X-Received: by 2002:a17:907:84a:b0:733:735:2b1a with SMTP id ww10-20020a170907084a00b0073307352b1amr19169204ejb.290.1666427862530; Sat, 22 Oct 2022 01:37:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666427862; cv=none; d=google.com; s=arc-20160816; b=rtPHlCHzwqhnpNQbLbli6d1+86CpLMeqI0xdz3TG6pJaDz/hG9Md9OI3JdKcMIEKqt 15dSmCvX1gQKE9nRcR0762K3ARKOHCdlFc/m+FGn0Vwm03/4vC8MZ0UvdMlLtDdTfF4O bAK2926DfBoEY1xn5Rf1D+o07cr829J2RJVkGC9DZb5FAZPVorKUHXgJUQ95or/lNoMS eBvbTxGuj+stJXzTF363kClddkPCktFleGKhopjcJQIYlYkHYDmgTwsi6kYlN1QbydUa Mrudp9KtC6fzYAzw8bEhleJad+FXW7MiKAdAyGcBiVmO89aa7eLv4nwRuTQpYk7iDkbG dm4Q== 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=BZKF+1UKxVg2bixsMw+juhPTNVYe2lU1afz31OQY59s=; b=ecwaafe2kQNX9GefLIGxUyw0N6hBMGVSw1Ulamhn4IHKg6Rgk7vlkk0+rNOL1fP07r 3HXPP/CH4YVuV7WWBMl+rE931F2XRDhLeflCYfgq1dh0JSZAISBHVz6d37TUvZN8GBR4 V9HHimowKFEVNfzQlGgoXFgrcZvTYtA22nNMd5ofczd09R5azmWt7p/GZGHpSy7ux9a1 bY3W9SssvCsLu6IChTQ/OBOyp/mG/c3FVDgUU+eMUndUbOIzHLPMXOf5XB9HAvcUCqj4 DWQ2JQR2xWHnyV8Rqn7QVJrrCs+QV1sYbPjXhiMpOoIemVU24KkFTK2dY5mW4kjNmP/o xVVA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ZwoKLnoY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 d1-20020a50ea81000000b00456cc6e1017si19275232edo.109.2022.10.22.01.37.15; Sat, 22 Oct 2022 01:37: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=ZwoKLnoY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S233961AbiJVIc5 (ORCPT + 99 others); Sat, 22 Oct 2022 04:32:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58022 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234103AbiJVI3k (ORCPT ); Sat, 22 Oct 2022 04: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 A767C2E25DC; Sat, 22 Oct 2022 01: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 dfw.source.kernel.org (Postfix) with ESMTPS id 4803A60B40; Sat, 22 Oct 2022 08:00:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 559D9C433B5; Sat, 22 Oct 2022 08:00:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425623; bh=RGwrKnkrt+w/nHMKlIsALNrzbvtZrXpoRBaBl2bJTIg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZwoKLnoYp5xCRU926pElRHTgXtJ2Ipod7aQjrWii25/4Do7pme19fLXkGI08aoU8S JCHxTF9JztvQyDu9snDrpJSLsoYmkzgGL0d6+nSGckS3FmeAzqewRCbpRvrDJhWDHz 6D3lEvDvHRXmudS+XTuWRyqZBxUZfOVYpN5Pfy70= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kunkun Jiang , Marc Zyngier , Oliver Upton , Daniel Lezcano , Sasha Levin Subject: [PATCH 5.19 521/717] clocksource/drivers/arm_arch_timer: Fix handling of ARM erratum 858921 Date: Sat, 22 Oct 2022 09:26:40 +0200 Message-Id: <20221022072521.341170227@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376262232107318?= X-GMAIL-MSGID: =?utf-8?q?1747376262232107318?= From: Kunkun Jiang [ Upstream commit 6c3b62d93e195f78c1437c8fa7581e9b2f00886e ] The commit a38b71b0833e ("clocksource/drivers/arm_arch_timer: Move system register timer programming over to CVAL") moves the programming of the timers from the countdown timer (TVAL) over to the comparator (CVAL). This makes it necessary to read the counter when programming next event. However, the workaround of Cortex-A73 erratum 858921 does not set the corresponding set_next_event_phys and set_next_event_virt. Add the appropriate hooks to apply the erratum mitigation when programming the next timer event. Fixes: a38b71b0833e ("clocksource/drivers/arm_arch_timer: Move system register timer programming over to CVAL") Signed-off-by: Kunkun Jiang Acked-by: Marc Zyngier Reviewed-by: Oliver Upton Link: https://lore.kernel.org/r/20220914061424.1260-1-jiangkunkun@huawei.com Signed-off-by: Daniel Lezcano Signed-off-by: Sasha Levin --- drivers/clocksource/arm_arch_timer.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/clocksource/arm_arch_timer.c b/drivers/clocksource/arm_arch_timer.c index 8122a1646925..a7ff77550e17 100644 --- a/drivers/clocksource/arm_arch_timer.c +++ b/drivers/clocksource/arm_arch_timer.c @@ -473,6 +473,8 @@ static const struct arch_timer_erratum_workaround ool_workarounds[] = { .desc = "ARM erratum 858921", .read_cntpct_el0 = arm64_858921_read_cntpct_el0, .read_cntvct_el0 = arm64_858921_read_cntvct_el0, + .set_next_event_phys = erratum_set_next_event_phys, + .set_next_event_virt = erratum_set_next_event_virt, }, #endif #ifdef CONFIG_SUN50I_ERRATUM_UNKNOWN1 From patchwork Sat Oct 22 07:26: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: 7532 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1105814wrr; Sat, 22 Oct 2022 01:36:13 -0700 (PDT) X-Google-Smtp-Source: AMsMyM79LzoYJcADiZbp0fc2DXN7/59liJfKAx9mH+LGt977T0YSnYYX1N0MrE8JD20Rj2QHYtmW X-Received: by 2002:a63:f206:0:b0:446:eb31:47e0 with SMTP id v6-20020a63f206000000b00446eb3147e0mr20068052pgh.491.1666427773287; Sat, 22 Oct 2022 01:36:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666427773; cv=none; d=google.com; s=arc-20160816; b=LP0QpwnDwwcdeke8rtJdVoji65SyUzSvZv+ErsxY9r4ix3Ne3Uw+BkP7Z7yiHKZwBk wODgmP56tgkbTt46ejZIn6rDJ1jbHlwmsIKRK972irruzmfYeQF5f61nEwDYUdNYEiTm ANgQZV1Z8EzLeOZX+Ph85nlyfK2L+ohHTFGxOJlOdArncv4Yx87a2VODE3eN3MKdjPSi m+eKiEjQRH4ww9yekgoWTwokZZ2u8QcFyUOnUBSenNvvA6fSlj36nIdv+nC5IS60jaIs kQ86AiDyqD9d+qfGnGJ0yJrHmYjmV+tPYxgGoJJ+bCoeXvjiVvTMHz7XjUIqq5Fladqh /3mA== 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=3NVHu8D43K6DlPVGRW9e7kWOFKqnCWmQnn3uBDk2xvM=; b=B0Vpnh2qi2HOWopR5QXQqOnOu1w3vAKM255mQ1Oee/esWBhXN04EBuSNaZMTxYg2St JWqOOoGgR0u/4FSuHOUdsDm7/ilZJEIFUqk5Zz+OAYPW7/7rDFgzVn1ox4oBhwvH6qqv U8MHIwxY2IKjjuy4S5/Z8AyIaCFas+heyoFmyYYytTyWlXbZoMB80vBsasG5rfgD/Bu7 GZ33rXD7y8fT0/sKVr2z4ZuZsk9jLDzSex2+AXRYvU+y/Hx7cGBylB4Fw2BHXYtlUECg hS/0DSZguRhVs7akASH1N/NdeHM+cjNuZqNr7HwUD+1QVj8IPxRa4dTdSrgfhtPf9Ukv Gw2w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=E0q5V2HQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 k71-20020a63844a000000b0045724b1e357si27673163pgd.683.2022.10.22.01.35.56; Sat, 22 Oct 2022 01:36: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=E0q5V2HQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S230097AbiJVIZ0 (ORCPT + 99 others); Sat, 22 Oct 2022 04:25:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44402 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233695AbiJVIWn (ORCPT ); Sat, 22 Oct 2022 04:22:43 -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 D63BA13A58A; Sat, 22 Oct 2022 00: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 ams.source.kernel.org (Postfix) with ESMTPS id CA9F3B82DF9; Sat, 22 Oct 2022 07:58:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 11740C433C1; Sat, 22 Oct 2022 07:58:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425524; bh=wpNuhBG9/6aQ2W+7cbuETNqCLtVcvtJT1YSt5RjOQ6M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=E0q5V2HQ+bkOJSmdCytPHEyTlRt5hvZ+/DuEydR5VVgK4zCGrja01Zcf4ff0iootc vcBip9IFcmcr8r47ubvq138IeHGtfrp7mWUZ6YfkcDyPquXmQOqfQJBGrlp19PaCl6 32B8Sxs4Ce3tU3UHOSxb2J/XTTDwXwDrLv5vNZFA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Lin Yujun , Daniel Lezcano , Sasha Levin Subject: [PATCH 5.19 522/717] clocksource/drivers/timer-gxp: Add missing error handling in gxp_timer_probe Date: Sat, 22 Oct 2022 09:26:41 +0200 Message-Id: <20221022072521.392405978@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376168761706820?= X-GMAIL-MSGID: =?utf-8?q?1747376168761706820?= From: Lin Yujun [ Upstream commit 0e2c8e6d769bcdc4f6634a02c545356282275e68 ] Add platform_device_put() to make sure to free the platform device in the event platform_device_add() fails. Fixes: 5184f4bf151b ("clocksource/drivers/timer-gxp: Add HPE GXP Timer") Signed-off-by: Lin Yujun Link: https://lore.kernel.org/r/20220914033018.97484-1-linyujun809@huawei.com Signed-off-by: Daniel Lezcano Signed-off-by: Sasha Levin --- drivers/clocksource/timer-gxp.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/clocksource/timer-gxp.c b/drivers/clocksource/timer-gxp.c index 8b38b3212388..fe4fa8d7b3f1 100644 --- a/drivers/clocksource/timer-gxp.c +++ b/drivers/clocksource/timer-gxp.c @@ -171,6 +171,7 @@ static int gxp_timer_probe(struct platform_device *pdev) { struct platform_device *gxp_watchdog_device; struct device *dev = &pdev->dev; + int ret; if (!gxp_timer) { pr_err("Gxp Timer not initialized, cannot create watchdog"); @@ -187,7 +188,11 @@ static int gxp_timer_probe(struct platform_device *pdev) gxp_watchdog_device->dev.platform_data = gxp_timer->counter; gxp_watchdog_device->dev.parent = dev; - return platform_device_add(gxp_watchdog_device); + ret = platform_device_add(gxp_watchdog_device); + if (ret) + platform_device_put(gxp_watchdog_device); + + return ret; } static const struct of_device_id gxp_timer_of_match[] = { From patchwork Sat Oct 22 07:26: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: 7688 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1109095wrr; Sat, 22 Oct 2022 01:47:15 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6QX4kF6W290MguURva2LmgHUsrLgLLohUBX3I//QV9+BAsJ7qjO+3QT5Gyn+vC7Aj78Lg+ X-Received: by 2002:a17:907:744:b0:741:36b9:d2cc with SMTP id xc4-20020a170907074400b0074136b9d2ccmr18410402ejb.613.1666428435017; Sat, 22 Oct 2022 01:47:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666428435; cv=none; d=google.com; s=arc-20160816; b=szR4GzSGte1NMYT4UTy7mOy69iiDStOIXYXX/9eHgFASw3ELBYdm2LneRh8cI8hkwe ZXXWy0B0livuoxvsjmG5Q09RoD8iaOljGnM+MU+POGajgPEZIEzb5S1GCVPRgi3riMFs wZ+Iwd5FLk1DLVtMSIQb9U/Hu1xflyLmeid220wjvk7l1wXpKsQtV4GyORg8vrDjWIbe CTmZ9P38xsaZWHWiwQ/I9nOV1S3WGjTEs3JvZ/kEJv1rlyRwsEp0iMrp6cLqOFju8tGG /oInlX5u9TH4h7CpsH+jJs5yob6ik2HH2eZEDrsUnxEioScwz4kSly4DKq3xXglJbLNy rPWw== 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=RKRmZw+87b4NrD80ymQgo5l+jv7v8C/yukwI9780aSA=; b=BNJgMOP6PYlxeAMoX1282k7vEnafxfvw2OHAdhpG01Brccxk3gOjQBJxE/OMKfdOn9 BygfAReIVDlblFozOihJdq3jxClkDS0ta8+6HpUetEE7kVPQjzH9JVsXiUIOcbg9ZxjV R00G14kGZiBynPrr038WSiNo+DLrZ58K9OF0Qcb5Py6DUP2QfLqzAdQt4NanaAoqzMNe TlnVl5pambYRdQz1lRMOtQh0cLGhEXj4JRwMGyJ9wVqUlyRdac+iJc0ZA7sdnTFfGulN +tNrzfSK6xY9F1CjWP89sG4cLGhpDLLgQONzyfCvcFG/D1At3xGkcQmUbyicA7NTX5N9 ohlw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=slkWU2uc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 dm4-20020a170907948400b007894b9de062si9010701ejc.631.2022.10.22.01.46.50; Sat, 22 Oct 2022 01:47: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=slkWU2uc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S234783AbiJVIqU (ORCPT + 99 others); Sat, 22 Oct 2022 04:46:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52146 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234963AbiJVIoJ (ORCPT ); Sat, 22 Oct 2022 04:44:09 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4A8D62D5E94; Sat, 22 Oct 2022 01:07:52 -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 8D23EB82E06; Sat, 22 Oct 2022 07:59:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E63E4C433D6; Sat, 22 Oct 2022 07:59:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425558; bh=9UrjUr8/IkPv6PWDRT8g70RM3dX0hvB24hPHyGPf0nc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=slkWU2ucj/aDhflC2sfvKqSJDUJ4HHeIB5HZkOSzPrlGHOu98kZKL3SDm4WXAuwzP yudSmyFN34K0lt3hrCIHV2mEqG9dHJwLUDHy45XdQOwoLDRxsXbGGm7T0goM6fczjX YM1lC+BtLAtMxA4T6W1kgtA0bj8BQetpurLcG2bs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ronnie Sahlberg , Enzo Matsumiya , Steve French , Sasha Levin Subject: [PATCH 5.19 523/717] cifs: return correct error in ->calc_signature() Date: Sat, 22 Oct 2022 09:26:42 +0200 Message-Id: <20221022072521.442957149@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376863123137073?= X-GMAIL-MSGID: =?utf-8?q?1747376863123137073?= From: Enzo Matsumiya [ Upstream commit 09a1f9a168ae1f69f701689429871793174417d2 ] If an error happens while getting the key or session in the ->calc_signature implementations, 0 (success) is returned. Fix it by returning a proper error code. Since it seems to be highly unlikely to happen wrap the rc check in unlikely() too. Reviewed-by: Ronnie Sahlberg Fixes: 32811d242ff6 ("cifs: Start using per session key for smb2/3 for signature generation") Signed-off-by: Enzo Matsumiya Signed-off-by: Steve French Signed-off-by: Sasha Levin --- fs/cifs/smb2transport.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/fs/cifs/smb2transport.c b/fs/cifs/smb2transport.c index 55e79f6ee78d..334d8471346f 100644 --- a/fs/cifs/smb2transport.c +++ b/fs/cifs/smb2transport.c @@ -225,9 +225,9 @@ smb2_calc_signature(struct smb_rqst *rqst, struct TCP_Server_Info *server, struct smb_rqst drqst; ses = smb2_find_smb_ses(server, le64_to_cpu(shdr->SessionId)); - if (!ses) { + if (unlikely(!ses)) { cifs_server_dbg(VFS, "%s: Could not find session\n", __func__); - return 0; + return -ENOENT; } memset(smb2_signature, 0x0, SMB2_HMACSHA256_SIZE); @@ -557,8 +557,10 @@ smb3_calc_signature(struct smb_rqst *rqst, struct TCP_Server_Info *server, u8 key[SMB3_SIGN_KEY_SIZE]; rc = smb2_get_sign_key(le64_to_cpu(shdr->SessionId), server, key); - if (rc) - return 0; + if (unlikely(rc)) { + cifs_server_dbg(VFS, "%s: Could not get signing key\n", __func__); + return rc; + } if (allocate_crypto) { rc = cifs_alloc_hash("cmac(aes)", &hash, &sdesc); From patchwork Sat Oct 22 07:26: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: 7691 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1109121wrr; Sat, 22 Oct 2022 01:47:20 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4+6wwUjNDQYAlrqAhh1wHYsT0Mf/wv9kHdLIE0tvoD8MFZebDzIQznzGG+KkbBbRcME8ka X-Received: by 2002:a17:907:a429:b0:78d:b6bb:304f with SMTP id sg41-20020a170907a42900b0078db6bb304fmr18782490ejc.497.1666428440439; Sat, 22 Oct 2022 01:47:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666428440; cv=none; d=google.com; s=arc-20160816; b=prpwACYH3EpqufL2zGC14B8curR9+Rf+HHz8O+KdJcIoJxnbF28g9VJsnoGL2vZZgC DWtBDKSXO6mD7MOg308mHvzqKIaqfmsdReixHPyGExfS8E+Wl4GDX+ymkMfaOb7EMhpo 6LN+zDe9ARlPomnwbFRrVSfaqysQkrM9To9asC0g06beF9ShQa7BjwqaZNQcpUQO//6o stUKpl6Ku9tPmKVS70ldk2aTpusH/jPlz4NQssZlgWKODW87pGozaFoK00z2M6qyaaSw jcfBd88ojWQJTmWCV6nVvvxZ2lcCD9REzbr7rkilAFazZy0fvdU7ozgKt2GJG6r+2F0A HyoA== 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=kKDaTjIux1XjAbVFr8dc8yMLBlt3gTaYg9LlN+mVqKw=; b=isMJ60QNv8wb6fAb/G12yPtnUV2CV9SwPyVKniByZh5Mg1pM3fWH1IghNwC+6X/4c8 m+89J+0TIRp6Lc8Q2FfWqX7QNjEo8HThBRNfPazDAWd9jSRUQS9GVPlIOKLozo4MDuch yWuYtKH3ag6mbDZ9/t3GH/oNEkDXosc0130FAbEFvuR8Lq9XDeYuQDRbiusdNBdM5oKE uzRVsGjmfHMw7yEOZ+soEKG02K3mlY2b7Nj/MiVaxONPET6mcwLiAT9IlESB0DdOEVpL PldIO6FzIcMj4Tj/t2/cQg7xfTVNDGNCbRFU7QSERV5imcaJKEH/uOVHtvGrQQCIW4z8 c+Gw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=mOg24Kdz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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-20020a05640242cf00b0045a1dbedd92si29506498edc.35.2022.10.22.01.46.55; Sat, 22 Oct 2022 01:47: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=mOg24Kdz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S234177AbiJVIqZ (ORCPT + 99 others); Sat, 22 Oct 2022 04:46:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52306 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234977AbiJVIoL (ORCPT ); Sat, 22 Oct 2022 04:44: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 140472C6E1F; Sat, 22 Oct 2022 01:07: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 ams.source.kernel.org (Postfix) with ESMTPS id 848D3B82DFE; Sat, 22 Oct 2022 07:59:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D5EC9C433D6; Sat, 22 Oct 2022 07:59:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425592; bh=/EJsLI7IGYST8ISKH+nK60rKSqHNZhQC+NgTJrfGF38=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mOg24KdzpT+jAILFINJlXFhS9OY8JvvGD1LrIYv92zvyJU490oxW8NKC2O4tg58AU PjsZYyuDcREuYVAyJMHGSvF0IVgGsGPXHFnXDz56eXki+6CO5sWG0m+rJkJ7R0FoGg GKaCVQA8jVJtnwVTLOtDk64SHE5qH6IWkdvb7kp4= 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 5.19 524/717] iommu/iova: Fix module config properly Date: Sat, 22 Oct 2022 09:26:43 +0200 Message-Id: <20221022072521.495197957@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376868220651276?= X-GMAIL-MSGID: =?utf-8?q?1747376868220651276?= 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 320a70e40233..f1dba47cfc97 100644 --- a/include/linux/iova.h +++ b/include/linux/iova.h @@ -75,7 +75,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 Sat Oct 22 07:26: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: 7737 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1110451wrr; Sat, 22 Oct 2022 01:52:52 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6E1ay5DH2GHzYA6Gy+OQoIs2Ap3A59BkscnrfPNzKvxH6Ao2dQK+624fvLOD53hjxq1H9+ X-Received: by 2002:a17:906:8a64:b0:78d:b00d:fe with SMTP id hy4-20020a1709068a6400b0078db00d00femr19641573ejc.32.1666428771808; Sat, 22 Oct 2022 01:52:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666428771; cv=none; d=google.com; s=arc-20160816; b=vM/UnBfUTY/vNg7/CEMl5764SvN1JtZ1vk+TqcuhY+aQhH+CXqXleTDXoj7INjved6 RCMvVVdGcLHZeZlRyAo0u8qxYu6CPwFn8Z5brz1FdgJdJSVaeYZp3iw6WWNsLzT+BzJN +TUI39a55J7JsW7ppjPMVhaxwtwJ0BCBjwM4U+5bY8zyp+P6kkybqa8ikxuhBsso5/b0 77mqqdZzPORC/SicbJIMYOZugsypPaFkpQJHGmDmF+0ZPnJjioSgqE0qwpxn7h/OO63E q7VvJKaFflnADuKZ4AzfAa44CF0YMCbJ5OFbcMyXvZthHYCwq5255DX5PMENDx746S/J a0Jg== 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=KCkiCwAeM0DC4G4M8RXTYA9/YX5WvLBhBfIsZNV29lU=; b=ZNoMqDQDR/f+9SqriZBn0Ku27lDbi3Qhj+L6N7eqhWInRjd7ZmKFfqa50CNjKNf/2g aH/JDxqseqFerTv7DaxXGffc9q1c49K4bao4rP6qlJJkodUV0vxdFCTSyj82ckXRrtvR t4b4ghv/J1PAsAkGovH3uLLID/w+lIKomLRWmSRYm7ft9tywyukRp5p+u/AVjAS/OftK jiSUWCJCJhx+DoSEFpGwfHJafLSJvr+Rt/IdxLzTB0k3Q/7EOSW9QKqzybgGmTbZulu+ eQ42g5ncPtuQYyOTF/lE4iS8OanNglu8SLe4OBmGH3vF6Pb0rQGMfEU45T8MSgg7erWo vxAQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=oDRZ1KYU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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-20020a056402399800b0045cafc51fbfsi21831833edb.525.2022.10.22.01.52.27; Sat, 22 Oct 2022 01:52: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=oDRZ1KYU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S234995AbiJVIvO (ORCPT + 99 others); Sat, 22 Oct 2022 04:51:14 -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 S235219AbiJVIuB (ORCPT ); Sat, 22 Oct 2022 04:50:01 -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 E092D2ED993; Sat, 22 Oct 2022 01: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 3859BB82E2D; Sat, 22 Oct 2022 08:00:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 33292C433C1; Sat, 22 Oct 2022 08:00:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425604; bh=G2L0nwBjn5VtTyRobVNartiz1/0xuFjNYrEZ5NJlSKU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oDRZ1KYUy5xDGt2FQnuCeCcx9fj4wv5GIF9HXC+tVhsOPOQmqLA+5uEISjXPMdRbS 0bPVrndXQkwwX5kqhFGluLch6JZQdPOjKnVcZhjOCz8C3hK0T80OgENFqyyH8OAx/w xCpBpjv3nMMD7q6c7e4Do6AGiK9UXrLMM6z/lhNY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, linux-riscv@lists.infradead.org, mingo@redhat.com, paul.walmsley@sifive.com, palmer@dabbelt.com, aou@eecs.berkeley.edu, zanussi@kernel.org, liaochang1@huawei.com, chris.zjh@huawei.com, Yipeng Zou , "Masami Hiramatsu (Google)" , "Steven Rostedt (Google)" , Sasha Levin Subject: [PATCH 5.19 525/717] tracing: kprobe: Fix kprobe event gen test module on exit Date: Sat, 22 Oct 2022 09:26:44 +0200 Message-Id: <20221022072521.543885453@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747377215520998584?= X-GMAIL-MSGID: =?utf-8?q?1747377215520998584?= From: Yipeng Zou [ Upstream commit ac48e189527fae87253ef2bf58892e782fb36874 ] Correct gen_kretprobe_test clr event para on module exit. This will make it can't to delete. Link: https://lkml.kernel.org/r/20220919125629.238242-2-zouyipeng@huawei.com Cc: Cc: Cc: Cc: Cc: Cc: Cc: Cc: Fixes: 64836248dda2 ("tracing: Add kprobe event command generation test module") Signed-off-by: Yipeng Zou Acked-by: Masami Hiramatsu (Google) Signed-off-by: Steven Rostedt (Google) Signed-off-by: Sasha Levin --- kernel/trace/kprobe_event_gen_test.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/trace/kprobe_event_gen_test.c b/kernel/trace/kprobe_event_gen_test.c index 18b0f1cbb947..e023154be0f8 100644 --- a/kernel/trace/kprobe_event_gen_test.c +++ b/kernel/trace/kprobe_event_gen_test.c @@ -206,7 +206,7 @@ static void __exit kprobe_event_gen_test_exit(void) WARN_ON(kprobe_event_delete("gen_kprobe_test")); /* Disable the event or you can't remove it */ - WARN_ON(trace_array_set_clr_event(gen_kprobe_test->tr, + WARN_ON(trace_array_set_clr_event(gen_kretprobe_test->tr, "kprobes", "gen_kretprobe_test", false)); From patchwork Sat Oct 22 07:26: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: 7572 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1106188wrr; Sat, 22 Oct 2022 01:37:13 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6lk7yqwQ/ofmlTBQzUOwXZUqglt1clghCqfw0Ffx0uauetpHeaHwmwjE3YSJ4rizh4PsOP X-Received: by 2002:a17:907:6e8b:b0:793:30e1:96c9 with SMTP id sh11-20020a1709076e8b00b0079330e196c9mr13834269ejc.97.1666427833487; Sat, 22 Oct 2022 01:37:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666427833; cv=none; d=google.com; s=arc-20160816; b=tOCkU9hBk3VXoZ38OrNpTWxpnabQee3VImkRsTsmdF0F/Vou9dUNTQtS613HhOAIcN NzFGehOKNi495eaMzL1w/LLyWvIy7/WtR6g2HC2R68tS4gK7PWTSE0VPNUGTQMs/jpxE VnMQlntqXaWjwaIJX1X+4lG2r1zzB8DPEvUOMZ6wp+cfPdFUQupI+ZGrp+0dQSratajx epQFqtK45M1MXdrPfXyk6OukulEGq982K+dt+jFtxrWiknGJ5QyR6CAx1hD7326iCgA1 d7XWYmQY70dHZ2JdCrzcfaRw5WSj402RPQ86l2HByAQdsixqt61a0kZLmgepUThLMwwM e4ww== 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=svhPfyiBknFcdK9Jb03uX0IgjMsCSeIO5LuOUGYZPMQ=; b=H6xEvDejxzShK8YyWl3LL2+H+VsrM5WMD7Xc/XeJIj61Af+VhkU7brDjD14/g8p+S5 qRQgkMDP/czgvXgt92B5axxSS2oHodENvD1csvsAkSGDkvbQGbA3udQWdV8S6e1gYWYP zmMMhk/X00OIhslOrGkjc+RQuuLQanULvxOSX2joyeshw5tdecQcv3Cy5d3mb1tNGVo8 EYVBO+Xd/tDo9IigASno8zibT0vq44sLTH1vsEiFvhVB/tD7SOcvMY9MeO/N+Ex4MJmU Its1HaXNVKvafGtgA1oQiXsmDUY/kFkrUczL8CumN8ookrTKDHpTH9XiZlohmjZtFEAv Xf2Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=H6rL+InR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 l15-20020a170906794f00b0078d2a84f2f8si25249371ejo.645.2022.10.22.01.36.45; Sat, 22 Oct 2022 01:37: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=H6rL+InR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S233995AbiJVIcQ (ORCPT + 99 others); Sat, 22 Oct 2022 04:32:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38898 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234013AbiJVI3M (ORCPT ); Sat, 22 Oct 2022 04:29: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 920C12E2BAD; Sat, 22 Oct 2022 01:01: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 4531F60AFA; Sat, 22 Oct 2022 08:00:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 27020C433D7; Sat, 22 Oct 2022 08:00:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425607; bh=Xz/JYnNX+bv4d5sNBNrD5dHf4bfzzM5L7MEjHHLxJTw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=H6rL+InRTUElvIlZItognaPFHJRAN5sEq1ClqqFIvaWofsbyNObsG7vWoQNRNxvtb znRUHfZCWU5+m8gxTYNp0qCLsA6Yeg/sSs9/YD7fsZrxl8dw8l6/j/eXUY5fN09OHy qrrAg1n9rkLAqU+midzCPz5cj86VxZLsULn38WXs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, linux-riscv@lists.infradead.org, mingo@redhat.com, paul.walmsley@sifive.com, palmer@dabbelt.com, aou@eecs.berkeley.edu, zanussi@kernel.org, liaochang1@huawei.com, chris.zjh@huawei.com, Yipeng Zou , "Masami Hiramatsu (Google)" , "Steven Rostedt (Google)" , Sasha Levin Subject: [PATCH 5.19 526/717] tracing: kprobe: Make gen test module work in arm and riscv Date: Sat, 22 Oct 2022 09:26:45 +0200 Message-Id: <20221022072521.582016938@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376232311953431?= X-GMAIL-MSGID: =?utf-8?q?1747376232311953431?= From: Yipeng Zou [ Upstream commit d8ef45d66c01425ff748e13ef7dd1da7a91cc93c ] For now, this selftest module can only work in x86 because of the kprobe cmd was fixed use of x86 registers. This patch adapted to register names under arm and riscv, So that this module can be worked on those platform. Link: https://lkml.kernel.org/r/20220919125629.238242-3-zouyipeng@huawei.com Cc: Cc: Cc: Cc: Cc: Cc: Cc: Cc: Fixes: 64836248dda2 ("tracing: Add kprobe event command generation test module") Signed-off-by: Yipeng Zou Acked-by: Masami Hiramatsu (Google) Signed-off-by: Steven Rostedt (Google) Signed-off-by: Sasha Levin --- kernel/trace/kprobe_event_gen_test.c | 47 +++++++++++++++++++++++++--- 1 file changed, 43 insertions(+), 4 deletions(-) diff --git a/kernel/trace/kprobe_event_gen_test.c b/kernel/trace/kprobe_event_gen_test.c index e023154be0f8..80e04a1e1977 100644 --- a/kernel/trace/kprobe_event_gen_test.c +++ b/kernel/trace/kprobe_event_gen_test.c @@ -35,6 +35,45 @@ static struct trace_event_file *gen_kprobe_test; static struct trace_event_file *gen_kretprobe_test; +#define KPROBE_GEN_TEST_FUNC "do_sys_open" + +/* X86 */ +#if defined(CONFIG_X86_64) || defined(CONFIG_X86_32) +#define KPROBE_GEN_TEST_ARG0 "dfd=%ax" +#define KPROBE_GEN_TEST_ARG1 "filename=%dx" +#define KPROBE_GEN_TEST_ARG2 "flags=%cx" +#define KPROBE_GEN_TEST_ARG3 "mode=+4($stack)" + +/* ARM64 */ +#elif defined(CONFIG_ARM64) +#define KPROBE_GEN_TEST_ARG0 "dfd=%x0" +#define KPROBE_GEN_TEST_ARG1 "filename=%x1" +#define KPROBE_GEN_TEST_ARG2 "flags=%x2" +#define KPROBE_GEN_TEST_ARG3 "mode=%x3" + +/* ARM */ +#elif defined(CONFIG_ARM) +#define KPROBE_GEN_TEST_ARG0 "dfd=%r0" +#define KPROBE_GEN_TEST_ARG1 "filename=%r1" +#define KPROBE_GEN_TEST_ARG2 "flags=%r2" +#define KPROBE_GEN_TEST_ARG3 "mode=%r3" + +/* RISCV */ +#elif defined(CONFIG_RISCV) +#define KPROBE_GEN_TEST_ARG0 "dfd=%a0" +#define KPROBE_GEN_TEST_ARG1 "filename=%a1" +#define KPROBE_GEN_TEST_ARG2 "flags=%a2" +#define KPROBE_GEN_TEST_ARG3 "mode=%a3" + +/* others */ +#else +#define KPROBE_GEN_TEST_ARG0 NULL +#define KPROBE_GEN_TEST_ARG1 NULL +#define KPROBE_GEN_TEST_ARG2 NULL +#define KPROBE_GEN_TEST_ARG3 NULL +#endif + + /* * Test to make sure we can create a kprobe event, then add more * fields. @@ -58,14 +97,14 @@ static int __init test_gen_kprobe_cmd(void) * fields. */ ret = kprobe_event_gen_cmd_start(&cmd, "gen_kprobe_test", - "do_sys_open", - "dfd=%ax", "filename=%dx"); + KPROBE_GEN_TEST_FUNC, + KPROBE_GEN_TEST_ARG0, KPROBE_GEN_TEST_ARG1); if (ret) goto free; /* Use kprobe_event_add_fields to add the rest of the fields */ - ret = kprobe_event_add_fields(&cmd, "flags=%cx", "mode=+4($stack)"); + ret = kprobe_event_add_fields(&cmd, KPROBE_GEN_TEST_ARG2, KPROBE_GEN_TEST_ARG3); if (ret) goto free; @@ -128,7 +167,7 @@ static int __init test_gen_kretprobe_cmd(void) * Define the kretprobe event. */ ret = kretprobe_event_gen_cmd_start(&cmd, "gen_kretprobe_test", - "do_sys_open", + KPROBE_GEN_TEST_FUNC, "$retval"); if (ret) goto free; From patchwork Sat Oct 22 07:26: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: 7701 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1109355wrr; Sat, 22 Oct 2022 01:48:11 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5LVgBXMsH2B6L4yBODlUPiv2rK9zh7xvkWwhXmZFHTlTta3V1d90eWLfkfUe/kU3SIxBAh X-Received: by 2002:aa7:de9a:0:b0:44d:8191:44c5 with SMTP id j26-20020aa7de9a000000b0044d819144c5mr20944881edv.232.1666428491216; Sat, 22 Oct 2022 01:48:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666428491; cv=none; d=google.com; s=arc-20160816; b=cFNkz4RMUHEs3K8ZiizCJ4F7B6gFqmJIW0QHFeD66Y7xbEd/DtRO9lD3BZ9Yxtopb+ 2wDvw4M9N4yVtnt3vVTnuMLWtkfCpnHdb06eq34MAR57kJGYHau4BwnO/VeQ1QIPON44 ZDcRfKVpjDEp/nVuNd5QR51EahZY7rcCs4iNYOB2M7nGJq5Mp0/aAOWHI2BNEc2MM0r9 r7vbOAT1+opUwx47ZcwB+7L6cDdPjtIr5pzsr9MgQORWV8wtAvx1Bl1SDXMML9y3uSdZ 0dKutTAW1SO5TMEdrCpBbHqJQ0qZO+A9VyaEY4/d0t4M505dstGKXrwY0CdSjG1O0uOu qoBg== 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=G8XAnjqPKg/5aTCwdOonfTc/QL7bk9dvwrxJiGYcME0=; b=Ik0xzPkDQZceZ351CsfiS8mVap6FeFofc8Np0MbJUkEFz7bxtEj2Anx7ZY5rf+Au3+ hpldCwGt0jt4M8Vdav6P/cWbprE4erbSg523NPPs+CIN++LzJ71PM64wlb5+dGT+w3s1 yUYnF1Q53KnX/n+IQWjvi6rrafW/42EcGZkafU5IENitLubJAWpeaLH/jxR9UdtHKxTv b4HAJT6vfmxANEcmiCNZviVhkY9aBaauKGsyYOJ64bpYRD9K5EhpEA0JpLqvD/ZlyLbl 7NI1rUt4djCDwqMxsbi8eGHuOkSBAVe6L0e/LFemWUmgk7cR1NzUWmAJiGs/1egSEEcD kkEQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=xQdN2hfd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 t20-20020a50ab54000000b0045fd458991fsi6543520edc.428.2022.10.22.01.47.47; Sat, 22 Oct 2022 01: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=xQdN2hfd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S234469AbiJVIrP (ORCPT + 99 others); Sat, 22 Oct 2022 04:47:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42352 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235138AbiJVIom (ORCPT ); Sat, 22 Oct 2022 04:44: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 DDD8B2E9E04; Sat, 22 Oct 2022 01:08: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 36EEEB82DFA; Sat, 22 Oct 2022 08:00:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3C658C433D6; Sat, 22 Oct 2022 08:00:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425610; bh=CM0lsX2xNuDhqw6knoqtt6uLkfZ93Q02MCIk5faF5dE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xQdN2hfdKHwuS2aAQ6flNLsTnWE1TX3KJOfdG7aS8m44B5pLou48sqP/5nS5rIzVK ilmcKhrcYgr16nvJUWf0YAlI7cxX21lH+KsLjVxDp6JOVkWe0A8SfZpUW7ABqKENMG pRfMINDxELonqmFgmnDR090A3vuY3ZLXtGVMnSt4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Nico Pache , Daniel Bristot de Oliveira , "Steven Rostedt (Google)" , Sasha Levin Subject: [PATCH 5.19 527/717] tracing/osnoise: Fix possible recursive locking in stop_per_cpu_kthreads Date: Sat, 22 Oct 2022 09:26:46 +0200 Message-Id: <20221022072521.625085247@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376921368615739?= X-GMAIL-MSGID: =?utf-8?q?1747376921368615739?= From: Nico Pache [ Upstream commit 99ee9317a1305cd5626736785c8cb38b0e47686c ] There is a recursive lock on the cpu_hotplug_lock. In kernel/trace/trace_osnoise.c:_per_cpu_kthreads: - start_per_cpu_kthreads calls cpus_read_lock() and if start_kthreads returns a error it will call stop_per_cpu_kthreads. - stop_per_cpu_kthreads then calls cpus_read_lock() again causing deadlock. Fix this by calling cpus_read_unlock() before calling stop_per_cpu_kthreads. This behavior can also be seen in commit f46b16520a08 ("trace/hwlat: Implement the per-cpu mode"). This error was noticed during the LTP ftrace-stress-test: WARNING: possible recursive locking detected -------------------------------------------- sh/275006 is trying to acquire lock: ffffffffb02f5400 (cpu_hotplug_lock){++++}-{0:0}, at: stop_per_cpu_kthreads but task is already holding lock: ffffffffb02f5400 (cpu_hotplug_lock){++++}-{0:0}, at: start_per_cpu_kthreads other info that might help us debug this: Possible unsafe locking scenario: CPU0 ---- lock(cpu_hotplug_lock); lock(cpu_hotplug_lock); *** DEADLOCK *** May be due to missing lock nesting notation 3 locks held by sh/275006: #0: ffff8881023f0470 (sb_writers#24){.+.+}-{0:0}, at: ksys_write #1: ffffffffb084f430 (trace_types_lock){+.+.}-{3:3}, at: rb_simple_write #2: ffffffffb02f5400 (cpu_hotplug_lock){++++}-{0:0}, at: start_per_cpu_kthreads Link: https://lkml.kernel.org/r/20220919144932.3064014-1-npache@redhat.com Fixes: c8895e271f79 ("trace/osnoise: Support hotplug operations") Signed-off-by: Nico Pache Acked-by: Daniel Bristot de Oliveira Signed-off-by: Steven Rostedt (Google) Signed-off-by: Sasha Levin --- kernel/trace/trace_osnoise.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/kernel/trace/trace_osnoise.c b/kernel/trace/trace_osnoise.c index 313439920a8c..78d536d3ff3d 100644 --- a/kernel/trace/trace_osnoise.c +++ b/kernel/trace/trace_osnoise.c @@ -1786,8 +1786,9 @@ static int start_per_cpu_kthreads(void) for_each_cpu(cpu, current_mask) { retval = start_kthread(cpu); if (retval) { + cpus_read_unlock(); stop_per_cpu_kthreads(); - break; + return retval; } } From patchwork Sat Oct 22 07:26: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: 7862 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1162159wrr; Sat, 22 Oct 2022 04:31:52 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7w977R+d9L2pb720fgu6h64NQ/JhLLeWAD4Y09qboG4xk+NEDkpTxi7j4TZwlm9iZK6jlq X-Received: by 2002:a05:6a00:124e:b0:565:ba3c:58bf with SMTP id u14-20020a056a00124e00b00565ba3c58bfmr23982857pfi.82.1666438312257; Sat, 22 Oct 2022 04:31:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666438312; cv=none; d=google.com; s=arc-20160816; b=ngvI75+9hnd3pFqsQ2cFGZEf0TdjA3+c9aYzl9AOzoj/1wPvV4PqMMzidvnh/9p7ve aSReeGa2Erj2zEBgZcRRJlwUNVpnKezHqym0Ay5OilowIT4WTx660tQbXQf/eQ1xa2LO 8/TLkm7yDGa8NN4W194KxN/Y+eah7+SQGsptneu2k04pM8BD0mbKcPGTARVzH48raccP ZdzDw2yAb9NqjE6zez7AuKp/oZ4oCecCbJ5r6J8Bul6K8ylDvT18ffh/9V+HI2Dw3QWb RNHaqlnH15nfs1nX2SI99Ed7jzoDFYnebSXlkPzklBkF2k5orombBXUxQNK/ZiukKWdc fN7A== 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=MGkREK5j0NpiRsplELJW6baWyQju9VVa+gsLkZantVc=; b=yGFR2PM4RcZ6ZkG5c57lt/HfNOrZvUE2lyxakH5vKbyixRyTVeOG1oR/xqP6zvr1+c 9gHodPNmhO18U8cR3Dq47ARElBScvOZsVo28Lf1KYI1ROtzWrSMjNUCVm3KjjGkExNTE hxT+L2bD34aWtQPAZ/R33eDQtcfC9AgQsHxl6YW1JkBraBZA9EPZufK5FK6PpqYBQ6Oj pQc9NQA2IRE9SWMegybQiy0IjFMRXTg5BO5efAgJxvDC/dLqqb0Y56BhX2+X+T+sV+ng 6A/kGInii25gTt2A+/3b1kFez1QTsnur8vuqqUD1byEqN4zuGG/+6QFEIll7DR2Y+uJY l9TQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="dHdSw/VQ"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 133-20020a63018b000000b0046ee85f1477si724169pgb.712.2022.10.22.04.31.39; Sat, 22 Oct 2022 04:31: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="dHdSw/VQ"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S229629AbiJVLTx (ORCPT + 99 others); Sat, 22 Oct 2022 07:19:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59860 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230470AbiJVLTJ (ORCPT ); Sat, 22 Oct 2022 07:19:09 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7246A2B5B92; Sat, 22 Oct 2022 03:46: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 E86EAB82E16; Sat, 22 Oct 2022 08:00:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 76701C433D7; Sat, 22 Oct 2022 08:00:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425614; bh=r1uSprv05uRiiOBGa4ahdssT8plV/zjFxqe8j0cDwak=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dHdSw/VQvoazTOJT/rTDzI3FavFk1xZjqy23AvipESzi+wWvj/1gJTiS0/Uxp19WA nbGhL7Fz3uvRFAnGUYiqTTk5fDGdqnG6OM5P5jYwPCkq2Ql3D37402X7j1w+hFQJb+ Ykv7EV5M1wPmXu24zK23BUMzacTxRPzZdda5PCuk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ingo Molnar , Rob Herring , Masahiro Yamada , Nicolas Schier , Sasha Levin Subject: [PATCH 5.19 528/717] kbuild: remove the target in signal traps when interrupted Date: Sat, 22 Oct 2022 09:26:47 +0200 Message-Id: <20221022072521.669887803@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 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?1747387219704791966?= X-GMAIL-MSGID: =?utf-8?q?1747387219704791966?= From: Masahiro Yamada [ Upstream commit a7f3257da8a86b96fb9bf1bba40ae0bbd7f1885a ] When receiving some signal, GNU Make automatically deletes the target if it has already been changed by the interrupted recipe. If the target is possibly incomplete due to interruption, it must be deleted so that it will be remade from scratch on the next run of make. Otherwise, the target would remain corrupted permanently because its timestamp had already been updated. Thanks to this behavior of Make, you can stop the build any time by pressing Ctrl-C, and just run 'make' to resume it. Kbuild also relies on this feature, but it is equivalently important for any build systems that make decisions based on timestamps (if you want to support Ctrl-C reliably). However, this does not always work as claimed; Make immediately dies with Ctrl-C if its stderr goes into a pipe. [Test Makefile] foo: echo hello > $@ sleep 3 echo world >> $@ [Test Result] $ make # hit Ctrl-C echo hello > foo sleep 3 ^Cmake: *** Deleting file 'foo' make: *** [Makefile:3: foo] Interrupt $ make 2>&1 | cat # hit Ctrl-C echo hello > foo sleep 3 ^C$ # 'foo' is often left-over The reason is because SIGINT is sent to the entire process group. In this example, SIGINT kills 'cat', and 'make' writes the message to the closed pipe, then dies with SIGPIPE before cleaning the target. A typical bad scenario (as reported by [1], [2]) is to save build log by using the 'tee' command: $ make 2>&1 | tee log This can be problematic for any build systems based on Make, so I hope it will be fixed in GNU Make. The maintainer of GNU Make stated this is a long-standing issue and difficult to fix [3]. It has not been fixed yet as of writing. So, we cannot rely on Make cleaning the target. We can do it by ourselves, in signal traps. As far as I understand, Make takes care of SIGHUP, SIGINT, SIGQUIT, and SITERM for the target removal. I added the traps for them, and also for SIGPIPE just in case cmd_* rule prints something to stdout or stderr (but I did not observe an actual case where SIGPIPE was triggered). [Note 1] The trap handler might be worth explaining. rm -f $@; trap - $(sig); kill -s $(sig) $$ This lets the shell kill itself by the signal it caught, so the parent process can tell the child has exited on the signal. Generally, this is a proper manner for handling signals, in case the calling program (like Bash) may monitor WIFSIGNALED() and WTERMSIG() for WCE although this may not be a big deal here because GNU Make handles SIGHUP, SIGINT, SIGQUIT in WUE and SIGTERM in IUE. IUE - Immediate Unconditional Exit WUE - Wait and Unconditional Exit WCE - Wait and Cooperative Exit For details, see "Proper handling of SIGINT/SIGQUIT" [4]. [Note 2] Reverting 392885ee82d3 ("kbuild: let fixdep directly write to .*.cmd files") would directly address [1], but it only saves if_changed_dep. As reported in [2], all commands that use redirection can potentially leave an empty (i.e. broken) target. [Note 3] Another (even safer) approach might be to always write to a temporary file, and rename it to $@ at the end of the recipe. > $(tmp-target) mv $(tmp-target) $@ It would require a lot of Makefile changes, and result in ugly code, so I did not take it. [Note 4] A little more thoughts about a pattern rule with multiple targets (or a grouped target). %.x %.y: %.z When interrupted, GNU Make deletes both %.x and %.y, while this solution only deletes $@. Probably, this is not a big deal. The next run of make will execute the rule again to create $@ along with the other files. [1]: https://lore.kernel.org/all/YLeot94yAaM4xbMY@gmail.com/ [2]: https://lore.kernel.org/all/20220510221333.2770571-1-robh@kernel.org/ [3]: https://lists.gnu.org/archive/html/help-make/2021-06/msg00001.html [4]: https://www.cons.org/cracauer/sigint.html Fixes: 392885ee82d3 ("kbuild: let fixdep directly write to .*.cmd files") Reported-by: Ingo Molnar Reported-by: Rob Herring Signed-off-by: Masahiro Yamada Tested-by: Ingo Molnar Reviewed-by: Nicolas Schier Signed-off-by: Sasha Levin --- scripts/Kbuild.include | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include index ece44b735061..2bc08ace38a3 100644 --- a/scripts/Kbuild.include +++ b/scripts/Kbuild.include @@ -100,8 +100,29 @@ echo-cmd = $(if $($(quiet)cmd_$(1)),\ quiet_redirect := silent_redirect := exec >/dev/null; +# Delete the target on interruption +# +# GNU Make automatically deletes the target if it has already been changed by +# the interrupted recipe. So, you can safely stop the build by Ctrl-C (Make +# will delete incomplete targets), and resume it later. +# +# However, this does not work when the stderr is piped to another program, like +# $ make >&2 | tee log +# Make dies with SIGPIPE before cleaning the targets. +# +# To address it, we clean the target in signal traps. +# +# Make deletes the target when it catches SIGHUP, SIGINT, SIGQUIT, SIGTERM. +# So, we cover them, and also SIGPIPE just in case. +# +# Of course, this is unneeded for phony targets. +delete-on-interrupt = \ + $(if $(filter-out $(PHONY), $@), \ + $(foreach sig, HUP INT QUIT TERM PIPE, \ + trap 'rm -f $@; trap - $(sig); kill -s $(sig) $$$$' $(sig);)) + # printing commands -cmd = @set -e; $(echo-cmd) $($(quiet)redirect) $(cmd_$(1)) +cmd = @set -e; $(echo-cmd) $($(quiet)redirect) $(delete-on-interrupt) $(cmd_$(1)) ### # if_changed - execute command if any prerequisite is newer than From patchwork Sat Oct 22 07:26: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: 7818 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1141288wrr; Sat, 22 Oct 2022 03:28:05 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6w3Y30OF5N3QYVgaaMBGM0lk6gkhuUily6MrZqmhh36lTZdG3NvstVH7+YmYkJ1ZLZk1FA X-Received: by 2002:aa7:c6c1:0:b0:460:f684:901a with SMTP id b1-20020aa7c6c1000000b00460f684901amr10959125eds.6.1666434485420; Sat, 22 Oct 2022 03:28:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666434485; cv=none; d=google.com; s=arc-20160816; b=GgqaoW3M2iRCfA+Ep5djnXpjvSFLZUTKj99AwRbB71ESwEyZwQHawKlJYNcxWZ15hK 9BYAUJmIynzV+dg85ZAQeOYeFKJNMeHGP8/0YF1Gz7MV8JMiF5leCYdVEd2d+bqYrYyF G3BXamN9YXkHFTo46WmQ7jdN479BsL1InGDJi04OS8VA9GguCivXJxKmXO59okXMCcwo BfiayNNcFfjZ/ixJhBqCidaOIzersYFr51mM4imcl4yhpjcfjyGgEISAmLIOFEvVMhRt bPt37kI1ZWd/YSzWu7ao9+gWbn60Aw5t2AJVVL6gh6hBiwObXkIPBDYdi9Bw/jeMU0nN /RtQ== 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=EwC22GEKUDudLWUoYsqY6JUPbS1ZmXWczO/JHYxxqPs=; b=r4gxT1uAlZPfmKYW9XXjPS/Jgxv3lItVBHZfXBTNudIgpiVExxfxBYNZdleXvidVQt L+QaWUdWliGnWILbwQvrePw/4MHaSfVreQ2xna91uquD0RNvASG24aXjO7RHWPA5XxQy znvPRTP3/iZpn2wBsZhZdBFtd18yi9fEcAanam6Cw9lwpkNhu9gNJu4uuDjRtGBzhQOx ySnX5oGCSNE+pPd26TbKZF+A1n9C/gr+LRdvGA66VulDBVmtq+EmjhqhkV70Sl9zAGpo X+ng374dV4lSzI+0KpblJlT5gt+lskZxVUKQEK5GGFWQbMbyRASkZOS9nmim9YZuoH4a tN5w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=rmFTavuU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 nd33-20020a17090762a100b007879bc7eacfsi23266224ejc.93.2022.10.22.03.27.33; Sat, 22 Oct 2022 03:28: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=rmFTavuU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S230086AbiJVKVV (ORCPT + 99 others); Sat, 22 Oct 2022 06:21:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45148 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230010AbiJVKUq (ORCPT ); Sat, 22 Oct 2022 06:20: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 3C35D31D5A3; Sat, 22 Oct 2022 02:37: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 F0D64B82E35; Sat, 22 Oct 2022 08:00:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4C69AC433D7; Sat, 22 Oct 2022 08:00:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425617; bh=WsLm7DULaSh3XLEUh8TtPER6hSxauw/5gTEcKzR+ymA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rmFTavuUkooxzmbugtnm0pGLkApoysBWN0zW9v6D9/SgSSCoxY7K0wcNUTcAfdJ4s rq81ZODUEpjmiVKA8jhWbeIU4IPr5QtoVL6xPwnMoHXSryGuZvhUzbOeYNoW9+y29d nhWnemO9NjkA6vj3UzPWVWC4Q8hCGSBCrpSMpsKo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Yann Sionneau , Masahiro Yamada , Sasha Levin Subject: [PATCH 5.19 529/717] linux/export: use inline assembler to populate symbol CRCs Date: Sat, 22 Oct 2022 09:26:48 +0200 Message-Id: <20221022072521.710779092@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 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?1747383207061951662?= X-GMAIL-MSGID: =?utf-8?q?1747383207061951662?= From: Masahiro Yamada [ Upstream commit f3304ecd7f060db1d4197fbdce5a503259f770d3 ] Since commit 7b4537199a4a ("kbuild: link symbol CRCs at final link, removing CONFIG_MODULE_REL_CRCS"), the module versioning on the (non-upstreamed-yet) kvx Linux port is broken due to unexpected padding for __crc_* symbols. The kvx GCC adds padding so u32 gets 8-byte alignment instead of 4. I do not know if this happens for upstream architectures in general, but any compiler has the freedom to insert padding for faster access. Use the inline assembler to directly specify the wanted data layout. This is how we previously did before the breakage. Link: https://lore.kernel.org/lkml/20220817161438.32039-1-ysionneau@kalray.eu/ Link: https://lore.kernel.org/linux-kbuild/31ce5305-a76b-13d7-ea55-afca82c46cf2@kalray.eu/ Fixes: 7b4537199a4a ("kbuild: link symbol CRCs at final link, removing CONFIG_MODULE_REL_CRCS") Reported-by: Yann Sionneau Signed-off-by: Masahiro Yamada Tested-by: Yann Sionneau Signed-off-by: Sasha Levin --- include/linux/export-internal.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/include/linux/export-internal.h b/include/linux/export-internal.h index c2b1d4fd5987..fe7e6ba918f1 100644 --- a/include/linux/export-internal.h +++ b/include/linux/export-internal.h @@ -10,8 +10,10 @@ #include #include -/* __used is needed to keep __crc_* for LTO */ #define SYMBOL_CRC(sym, crc, sec) \ - u32 __section("___kcrctab" sec "+" #sym) __used __crc_##sym = crc + asm(".section \"___kcrctab" sec "+" #sym "\",\"a\"" "\n" \ + "__crc_" #sym ":" "\n" \ + ".long " #crc "\n" \ + ".previous" "\n") #endif /* __LINUX_EXPORT_INTERNAL_H__ */ From patchwork Sat Oct 22 07:26: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: 7556 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1105891wrr; Sat, 22 Oct 2022 01:36:27 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7o3y+uWuY3GYtbz0nByh5Cit4rlktHwvS8JzmZXS03xye1IZaYWdmu89vC1R6DsoZb5e5t X-Received: by 2002:a17:902:e890:b0:185:4ac7:9757 with SMTP id w16-20020a170902e89000b001854ac79757mr22946145plg.150.1666427786868; Sat, 22 Oct 2022 01:36:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666427786; cv=none; d=google.com; s=arc-20160816; b=q7rqEuOPxHDSRUheTuWlI3U6htZKA0j+79P0Dp3AhT+c6pasFf0dMTXg+7xZl+sbLn MD6ZA1rjS2S0maDLAhSENGaL85hyE2nkKvRnGtECCE5y2SbIEbXm9AzGdKscxBP5qHcE 5pitrQuBgjWNIBFP6ukyBi82rogfsmkFkTpryIxJ4y1PqInldBnVkYWvIkYOeZFtv9hj t8TWQyMR87kJFL8FFhRb05lbzvVp1Y1QbE/GZeq59DPXj89/UtG703hh6TDwOc4Ri3qm psMRjc9VVvvSzwpMa5weH7POSz8NL2oVKlv9GM78nC3p+85urNYsn/Y+9oOTf+BR0wR4 G5Zw== 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=yI2US8f+IXxCuSRWlihomRCIUWEFkrcOD+fhy8xKdfQ=; b=oDjDzsZCYGXeGTHua6W+pcfKW01bSp6Wa7FmO77re1nBwB8hrNa+I0sZR8y3ouW2JN q+ZMZJJ2+j/Thb51WmrC9Dxp2c1SNymdP7nOoZlr7I8I4iLIHG/vvQozk9PifJqFPXJt qle69GXyqUx4ZQTwE3of/TrC2OrmxV08xKERNvzzrtr6jMUDq0C0ERxGw3870Ni+TaUt yMalEnp8QjNdnWFUTvP7CN9uHJWotqMiAfEHYXxqMOXt6+SiCbfPFIiLPrpJ0T0m41Pi 1zUftbrU5aOH8IrB2h16i/7152sylnTU/QzU5QYEk2+8Py5XagM/m9izJ6Bp9TIP7IkQ BbFg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=KspYc5Nc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 e10-20020a630f0a000000b00434ffe3cc11si27759539pgl.870.2022.10.22.01.36.11; Sat, 22 Oct 2022 01:36: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=KspYc5Nc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S233883AbiJVI1h (ORCPT + 99 others); Sat, 22 Oct 2022 04:27:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38050 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230111AbiJVI1G (ORCPT ); Sat, 22 Oct 2022 04: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 5F1B81D8F00; Sat, 22 Oct 2022 01:00:52 -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 D7B71B82E2C; Sat, 22 Oct 2022 08:00:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2F010C433D7; Sat, 22 Oct 2022 08:00:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425620; bh=aB5UaX4PEnngZ+QuGyOLg8annvuPF1tnFpPw2lzRz5k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KspYc5NcMPZSxBAo5VGZ89zWCVKEV4GLegqbXRmz3w0xf8GwUg7xfyJPYQVLUYJMr 6yyVut2kuDQprBLQ7x+cY3UxsyD0ujVaGaImrr7Sm0rIQig+CK6UwUNyZkw92n0caR asRU+zd2NxxYgaYvNqtX2mSpQ/vyIZZ76jMO3Lkc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Janis Schoetterl-Glausch , Masahiro Yamada , Sasha Levin Subject: [PATCH 5.19 530/717] kbuild: rpm-pkg: fix breakage when V=1 is used Date: Sat, 22 Oct 2022 09:26:49 +0200 Message-Id: <20221022072521.759823283@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376182998706784?= X-GMAIL-MSGID: =?utf-8?q?1747376182998706784?= From: Janis Schoetterl-Glausch [ Upstream commit 2e07005f4813a9ff6e895787e0c2d1fea859b033 ] Doing make V=1 binrpm-pkg results in: Executing(%install): /bin/sh -e /var/tmp/rpm-tmp.EgV6qJ + umask 022 + cd . + /bin/rm -rf /home/scgl/rpmbuild/BUILDROOT/kernel-6.0.0_rc5+-1.s390x + /bin/mkdir -p /home/scgl/rpmbuild/BUILDROOT + /bin/mkdir /home/scgl/rpmbuild/BUILDROOT/kernel-6.0.0_rc5+-1.s390x + mkdir -p /home/scgl/rpmbuild/BUILDROOT/kernel-6.0.0_rc5+-1.s390x/boot + make -f ./Makefile image_name + cp test -e include/generated/autoconf.h -a -e include/config/auto.conf || ( \ echo >&2; \ echo >&2 " ERROR: Kernel configuration is invalid."; \ echo >&2 " include/generated/autoconf.h or include/config/auto.conf are missing.";\ echo >&2 " Run 'make oldconfig && make prepare' on kernel src to fix it."; \ echo >&2 ; \ /bin/false) arch/s390/boot/bzImage /home/scgl/rpmbuild/BUILDROOT/kernel-6.0.0_rc5+-1.s390x/boot/vmlinuz-6.0.0-rc5+ cp: invalid option -- 'e' Try 'cp --help' for more information. error: Bad exit status from /var/tmp/rpm-tmp.EgV6qJ (%install) Because the make call to get the image name is verbose and prints additional information. Fixes: 993bdde94547 ("kbuild: add image_name to no-sync-config-targets") Signed-off-by: Janis Schoetterl-Glausch Signed-off-by: Masahiro Yamada Signed-off-by: Sasha Levin --- scripts/package/mkspec | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/package/mkspec b/scripts/package/mkspec index 7c477ca7dc98..951cc60e5a90 100755 --- a/scripts/package/mkspec +++ b/scripts/package/mkspec @@ -85,10 +85,10 @@ $S mkdir -p %{buildroot}/boot %ifarch ia64 mkdir -p %{buildroot}/boot/efi - cp \$($MAKE image_name) %{buildroot}/boot/efi/vmlinuz-$KERNELRELEASE + cp \$($MAKE -s image_name) %{buildroot}/boot/efi/vmlinuz-$KERNELRELEASE ln -s efi/vmlinuz-$KERNELRELEASE %{buildroot}/boot/ %else - cp \$($MAKE image_name) %{buildroot}/boot/vmlinuz-$KERNELRELEASE + cp \$($MAKE -s image_name) %{buildroot}/boot/vmlinuz-$KERNELRELEASE %endif $M $MAKE %{?_smp_mflags} INSTALL_MOD_PATH=%{buildroot} modules_install $MAKE %{?_smp_mflags} INSTALL_HDR_PATH=%{buildroot}/usr headers_install From patchwork Sat Oct 22 07:26: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: 7543 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1105884wrr; Sat, 22 Oct 2022 01:36:26 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4DHlA6HPC8HUxFk1egLpl3jZL1Bwam77OVMek8H1lUl25SyG/S/daFS8IvstCxWm+INlAX X-Received: by 2002:a17:902:ce87:b0:181:e55d:2d4 with SMTP id f7-20020a170902ce8700b00181e55d02d4mr23700323plg.13.1666427786183; Sat, 22 Oct 2022 01:36:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666427786; cv=none; d=google.com; s=arc-20160816; b=NdvKkhi9/QZcH6xMfKPE+oTu2smY/exmot7kGK9KG/1pC4+bvG0QfVMw8mazPvlre6 U96sQAXyL9g1cDT4RLkpehi+Ke3X0i/z/e9v0+6IQxT8yenQMSbU+v+QkAY/r+HOfdQz 4xYVnShLa4OMPHZGiVU4AOTkYecv1giY/DVYjBzP0Tj9sFRjS8Wie1Xybe01mS5/ufms rT8GNzvMyEHO+C8oeY8XTKGR9YcX/qBUQgT3Pj4fbBpm94SKZZFbILc4w+0+XX5lkIDX OwEzKLtxgPqZvljMFkaLiYcBAmjWjJ9/y1nU0fh8+gDzfqRHHYCuJXvHYEPT6wCVpFwp Q/HA== 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=VJ+Rg+1xcgXv+IYAaiAFf0JVtaFhhpPuyaFYntOWOtM=; b=vsSNkWoO5TwogM+UL76MdVhueeTFCbs5mDXniAncBOPl8ch8fqCECA+szVW92p4vYR tkx5dcHugV+srS4FQXePrflm2JW314YGEdzTeagpvG/rGGSZAMQTyFd1jYcJeL1Sixpw I4OBC38FVe2esCo5PFHnD+Gjdn+/GgUEgkz+wYBNftxbtYNBuepxK+wvgQqQH+DZVoF1 N5x+rnuPr1G0FrsNOfkvNJEjwfvYe/enAirj9NWbp3g3mDg4WKk1fECfklbv9yA4ZFJQ Gyye0RE/9HelK/A/GvyxCGobE6SN/ZMSP3UCexzFKRoY4vOCuINgWWmdPMOrEddAHQdv 8lag== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="ddMV/Bov"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 p41-20020a056a000a2900b0052acaf4a3c0si33157732pfh.17.2022.10.22.01.36.12; Sat, 22 Oct 2022 01:36: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="ddMV/Bov"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S230102AbiJVI2T (ORCPT + 99 others); Sat, 22 Oct 2022 04:28:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48968 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233836AbiJVI1b (ORCPT ); Sat, 22 Oct 2022 04:27: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 6296427023D; Sat, 22 Oct 2022 01: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 B9ADDB82E2A; Sat, 22 Oct 2022 07:58:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1C7F4C433C1; Sat, 22 Oct 2022 07:58:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425527; bh=tzkFWHdBR1QJkTnAVZrUmtw9WJSWAiTSqmAiaamAgSg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ddMV/BovTGhdoQinWWwmBvnwoa2zd5x+Bd0gd3vHUpugV3zweKmXvEtlqTgvCuhZ0 UsGU+aMCKkwWZkzIM5579U97dOTzZeVCjTufnkfKnEdy7J7Y/cC54WL4PrWAKP7ntm ZtnJ77Q5OXXnLn6AxbEAI3hOPrHtRgH7CJyCZ42I= 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 5.19 531/717] crypto: marvell/octeontx - prevent integer overflows Date: Sat, 22 Oct 2022 09:26:50 +0200 Message-Id: <20221022072521.812435246@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376182040505987?= X-GMAIL-MSGID: =?utf-8?q?1747376182040505987?= From: Dan Carpenter [ Upstream commit caca37cf6c749ff0303f68418cfe7b757a4e0697 ] 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 "code_length * 2" can overflow. The round_up(ucode_size, 16) + sizeof() expression can overflow too. Prevent these overflows. Fixes: d9110b0b01ff ("crypto: marvell - add support for OCTEON TX CPT engine") Signed-off-by: Dan Carpenter Signed-off-by: Herbert Xu Signed-off-by: Sasha Levin --- .../crypto/marvell/octeontx/otx_cptpf_ucode.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/drivers/crypto/marvell/octeontx/otx_cptpf_ucode.c b/drivers/crypto/marvell/octeontx/otx_cptpf_ucode.c index 40b482198ebc..a765eefb18c2 100644 --- a/drivers/crypto/marvell/octeontx/otx_cptpf_ucode.c +++ b/drivers/crypto/marvell/octeontx/otx_cptpf_ucode.c @@ -286,6 +286,7 @@ static int process_tar_file(struct device *dev, struct tar_ucode_info_t *tar_info; struct otx_cpt_ucode_hdr *ucode_hdr; int ucode_type, ucode_size; + unsigned int code_length; /* * If size is less than microcode header size then don't report @@ -303,7 +304,13 @@ static int process_tar_file(struct device *dev, if (get_ucode_type(ucode_hdr, &ucode_type)) return 0; - ucode_size = ntohl(ucode_hdr->code_length) * 2; + code_length = ntohl(ucode_hdr->code_length); + if (code_length >= INT_MAX / 2) { + dev_err(dev, "Invalid code_length %u\n", code_length); + return -EINVAL; + } + + ucode_size = code_length * 2; if (!ucode_size || (size < round_up(ucode_size, 16) + sizeof(struct otx_cpt_ucode_hdr) + OTX_CPT_UCODE_SIGN_LEN)) { dev_err(dev, "Ucode %s invalid size\n", filename); @@ -886,6 +893,7 @@ static int ucode_load(struct device *dev, struct otx_cpt_ucode *ucode, { struct otx_cpt_ucode_hdr *ucode_hdr; const struct firmware *fw; + unsigned int code_length; int ret; set_ucode_filename(ucode, ucode_filename); @@ -896,7 +904,13 @@ static int ucode_load(struct device *dev, struct otx_cpt_ucode *ucode, ucode_hdr = (struct otx_cpt_ucode_hdr *) fw->data; memcpy(ucode->ver_str, ucode_hdr->ver_str, OTX_CPT_UCODE_VER_STR_SZ); ucode->ver_num = ucode_hdr->ver_num; - ucode->size = ntohl(ucode_hdr->code_length) * 2; + code_length = ntohl(ucode_hdr->code_length); + if (code_length >= INT_MAX / 2) { + dev_err(dev, "Ucode invalid code_length %u\n", code_length); + ret = -EINVAL; + goto release_fw; + } + ucode->size = code_length * 2; if (!ucode->size || (fw->size < round_up(ucode->size, 16) + sizeof(struct otx_cpt_ucode_hdr) + OTX_CPT_UCODE_SIGN_LEN)) { dev_err(dev, "Ucode %s invalid size\n", ucode_filename); From patchwork Sat Oct 22 07:26: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: 7589 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1106332wrr; Sat, 22 Oct 2022 01:37:31 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4ne1pTS51H6sdmiQGuuoXqkyOhFdmj/G/FauEzZ1qok1R5pWWkFIU096kBGnTe4iYD35dg X-Received: by 2002:a17:903:2442:b0:17f:8069:533a with SMTP id l2-20020a170903244200b0017f8069533amr22927348pls.46.1666427851654; Sat, 22 Oct 2022 01:37:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666427851; cv=none; d=google.com; s=arc-20160816; b=xLbWe7atXcT8UoVs1oYQl5xzEyuwGqMmi09dshMT+wa8IEFvFjxVzcmbY945FXa8/F FtUXX0RIo6xGzsw3Pkiev0/P6YZ9iPxYj4dufsbbLR/eGXFyMyUg4iiU4GJXF3P2/f3B HlPbTKDHeHOVYx38q9Fi836r/II/0u03XCjRJKxfJKvAFClOZEfgDRUBareiPrcKjXC+ 7YoRQXjmeF4osJ4W8jG1N1+BWqyxGZ+tVXJM8kxArBJvbwLxpZUl/zYv1WSVsShDp+JW MHrut8u58B7psniIZDKMaoXoFhNiMhrV4OjmQ5sZWU7YpyIj0ldXuid0ViVDlkpOmNZ8 qryA== 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=hJv7IUM6kJVsPIVNE+HRCOwEHEJ86PcnO/llMYLz+4M=; b=0LS6ZjYs0RAP9xk7pjHEZfZwlhJWoXm36tPvBHWgTfCG1hh0nVW0OQ43FnVYo2Hlmi eP1JHU1zam1QkbS3KffyzC8Fk3w2Z8xUucd66kf/WIfay59Xvaz0DAFzQJ2HO/k5ukb7 2BoTe81b87IHAVazDkMC4nc9tnt/OrulkghV/FaH1Zrr0kI+5hgxX+y4oa4KyQj9Uhlc mHi043Md7wo5nHIOBL8rAhXlHkcIa3VVtpqwvU33tHsVgDKSJ9l29RmkNaM+KttLJ7JD l70qoEzsyw3ZfEiRE6YPTijSkwWdRe+8SJ2yt2kPiYBOz335OCnTJfNU3kcmVNBN3PAZ 3lhA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=qDDvXkD3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 189-20020a6306c6000000b0046ec3ee4fafsi3993221pgg.211.2022.10.22.01.37.17; Sat, 22 Oct 2022 01:37: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=qDDvXkD3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S233727AbiJVIWx (ORCPT + 99 others); Sat, 22 Oct 2022 04:22:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51514 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233722AbiJVIU5 (ORCPT ); Sat, 22 Oct 2022 04:20:57 -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 91C742DF477; Sat, 22 Oct 2022 00:58: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 33CCA60B09; Sat, 22 Oct 2022 07:58:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 09389C433D6; Sat, 22 Oct 2022 07:58:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425530; bh=R5xFzSHogEP2NN2e/wL2tnIj+3tgTrpSBrWmiZXApdA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qDDvXkD3EYzjQnMXli79oI7yzOSToyeiAF9jYXsdsfwMdtFDTqkLDrxw5NoLGRqyg Yd6QLOTfcs0j1mA5hxiYhoyl04NqtP9GoALw9IH17dTN+apZvihFeGIASm8l8pHlzy iPOwiGxoI6/6Xj4ZBSnCbYJwAyY6Ss+HwVRwLuac= 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 5.19 532/717] crypto: cavium - prevent integer overflow loading firmware Date: Sat, 22 Oct 2022 09:26:51 +0200 Message-Id: <20221022072521.848741405@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376250989094820?= X-GMAIL-MSGID: =?utf-8?q?1747376250989094820?= 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 8c32d0eb8fcf..6872ac344001 100644 --- a/drivers/crypto/cavium/cpt/cptpf_main.c +++ b/drivers/crypto/cavium/cpt/cptpf_main.c @@ -253,6 +253,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; @@ -263,11 +264,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 Sat Oct 22 07:26: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: 7704 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1109399wrr; Sat, 22 Oct 2022 01:48:20 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4KmB13V77soRJ0qgIBCvlV1R6RiuK4RXnQ88mqROmjaOGkG6y8YM2nSNofk7s6sTi13xQ+ X-Received: by 2002:a17:907:7f07:b0:779:7f94:d259 with SMTP id qf7-20020a1709077f0700b007797f94d259mr18976307ejc.525.1666428500350; Sat, 22 Oct 2022 01:48:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666428500; cv=none; d=google.com; s=arc-20160816; b=1BVjCtesQv75WoctITE+U6mpGS3hsoxmcZYwcJvvXh31RpYIo/phnE827rD/BRI0m/ KG77JAub+k0L/IZy7+K92E4fP+/y8oH+ytPFJ+4rXq8zRF/uzSnXaFdewCgkDd5STPRK Fa35l33Hsw7gQXr/O1aWIRMtp1vaYZXIAYfkPac2oakgsK1PHoUCYf+gnvT6NMqfRAwk rm0+silnFHZ9g+io+etqGHseo6lMjU842m5Y2XWIxZTH3a9tnm+jPRewpA4kCT9Lf+0u Gk8GCY1dagrumu8D21hYj+bAaVMtLJt3K+SiQFuhoDUf0QfFLhXE6wsw7qgj1/xlO3FT czvw== 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=RguZUmlNTMoTKqHGi+v4jkh3k1eLc80dmEzMJqjo6Kc=; b=Q7E0Vxwldf5auG89aT0g9kW2m2YhE1o55ogfTjYpRSCwsCtCeVH5c4jUTFj78k5V6T qgiXaBnfZUxxxuY+gfFXpLZm8Er/FDMCe7q4Vnc6E5DYSs1/Nz5phdDXE/805K3WEr2X qwfoU3C5nlbTnjfv4k4xNvTaJRHcuufYMuUJP316HgQDXv6dXbSRE2p6vDiw5B3WGZbn 7XlQGQhzXpX+SDncku3UfACwssw+n0g6qfYMQkllambcLyj9doHVfHfcoH8apLH0J8rG R/YGKekzSHtDLr6cnMVvxTxNkHXPmjVAV9ivfakEi5p3jNlKaU63J3UoADmeV+SbrBRa 1itQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=PdEzsNcL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 o7-20020a056402038700b004592ebc28a9si18923639edv.59.2022.10.22.01.47.56; Sat, 22 Oct 2022 01:48: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=PdEzsNcL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S234630AbiJVIr0 (ORCPT + 99 others); Sat, 22 Oct 2022 04:47:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40808 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235177AbiJVIot (ORCPT ); Sat, 22 Oct 2022 04:44:49 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 696A12CB8D0; Sat, 22 Oct 2022 01:08: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 0E85160B9C; Sat, 22 Oct 2022 07:58:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2193CC433D6; Sat, 22 Oct 2022 07:58:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425533; bh=XyPVQJbFTLvipGXK1VZ5NAIpvAx/eXTeDvTak5V8T+Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PdEzsNcLljOQGtWkv+98ElY2+y8Oqai9rmVIPXlXAjG3XxbZQA8Zcuzpj9yRArh9l o1lK+QuNnUr3ReH4ksGGFD+OZ7SHDVKxxvKZPggKsVw4Xvs9KvU8guXxe2RyTVMHfG bH7KRePhQjhyFsXGNpmpPqNwNQxdgBGHrwzWCrsE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dominik Brodowski , Sebastian Andrzej Siewior , Sultan Alsawaf , "Jason A. Donenfeld" , Sasha Levin Subject: [PATCH 5.19 533/717] random: schedule jitter credit for next jiffy, not in two jiffies Date: Sat, 22 Oct 2022 09:26:52 +0200 Message-Id: <20221022072521.900794646@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376931268520301?= X-GMAIL-MSGID: =?utf-8?q?1747376931268520301?= From: Jason A. Donenfeld [ Upstream commit 122733471384be8c23f019fbbd46bdf7be561dcd ] Counterintuitively, mod_timer(..., jiffies + 1) will cause the timer to fire not in the next jiffy, but in two jiffies. The way to cause the timer to fire in the next jiffy is with mod_timer(..., jiffies). Doing so then lets us bump the upper bound back up again. Fixes: 50ee7529ec45 ("random: try to actively add entropy rather than passively wait for it") Fixes: 829d680e82a9 ("random: cap jitter samples per bit to factor of HZ") Cc: Dominik Brodowski Cc: Sebastian Andrzej Siewior Cc: Sultan Alsawaf Signed-off-by: Jason A. Donenfeld Signed-off-by: Sasha Levin --- drivers/char/random.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/char/random.c b/drivers/char/random.c index 8dfb28d5ae3f..5defbc479a5c 100644 --- a/drivers/char/random.c +++ b/drivers/char/random.c @@ -1178,7 +1178,7 @@ static void __cold entropy_timer(struct timer_list *timer) */ static void __cold try_to_generate_entropy(void) { - enum { NUM_TRIAL_SAMPLES = 8192, MAX_SAMPLES_PER_BIT = HZ / 30 }; + enum { NUM_TRIAL_SAMPLES = 8192, MAX_SAMPLES_PER_BIT = HZ / 15 }; struct entropy_timer_state stack; unsigned int i, num_different = 0; unsigned long last = random_get_entropy(); @@ -1197,7 +1197,7 @@ static void __cold try_to_generate_entropy(void) timer_setup_on_stack(&stack.timer, entropy_timer, 0); while (!crng_ready() && !signal_pending(current)) { if (!timer_pending(&stack.timer)) - mod_timer(&stack.timer, jiffies + 1); + mod_timer(&stack.timer, jiffies); mix_pool_bytes(&stack.entropy, sizeof(stack.entropy)); schedule(); stack.entropy = random_get_entropy(); From patchwork Sat Oct 22 07:26: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: 7593 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1106330wrr; Sat, 22 Oct 2022 01:37:31 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6ZQ6rjon0Z0UoC/6QCSPEqmxKgrD6NfRQg+q0w6InDtgtZUWI+P25U3ay/wloFqVcZaK+J X-Received: by 2002:a05:6a00:1707:b0:563:235:769b with SMTP id h7-20020a056a00170700b005630235769bmr23437369pfc.19.1666427851539; Sat, 22 Oct 2022 01:37:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666427851; cv=none; d=google.com; s=arc-20160816; b=tq09VYp6Pqmak5LT70Jp69A29JfDIr7Z7JdPJ8L5MNh3CCBQ9ke9UFQ2hq8mam0xXq nW5Si1pVeJLs5lS9Vp0eMHVoUGLs+zC1CQa2Hj1lQLQoaLettYm9hqwXGdQce+310mbE CoN3aA6Il9PmWQLZCiu2XHVZ1IE4BNcq35+JF9lnLtuE+XF2jxxzqr7+AMrWBSJjqXSa amwN9d9h8vh/uABAYaffa+7wa0uEu5Rb7EWYiklwE/Qg4mS4t1azcIRfSNv9VcbP8wTl p/IEWVDKXkTEVnv1pQjLjluHGuRTHohNP+wq7J2B37apFGJw8ka5gmYH2jZJOacUQVdK wKpA== 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=oBrT6TR0WFZr08DQddYVyvrUM6feAxRhSk2hEnX4FZk=; b=M2xNt4qdbMUM8c6l0HK44777JYtqnb6S1dP0djIavKAry0X0aPKTIccQcStaD0cmZk ljoHVkRpOSS09dBwSBdHWlo+2g66OeW58FL1N75Mbkm6hJDftJZtdF76+eezIQPHG4EE poPobMgtgBHqI15wwhsuX4aRVndOnTmOMPw6gR+OZndIXynEJvAASuRfPfevx77w61st WORrtcN97GQH9+F7vpl7dPWPj3MVyUbwxOylMrORctMXDnDcB4qoBKFTKs81I6nN064z i17OAFEVRyXKSd/xQbKf1rYo5MP6zEQeKrBd8/Rnp9pudYMFtNcskyF/GXSgzzcRzNTh a5rQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=2kBGb4nT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 q17-20020a656851000000b0046eacc32426si3423578pgt.688.2022.10.22.01.37.18; Sat, 22 Oct 2022 01:37: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=2kBGb4nT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S229956AbiJVIXH (ORCPT + 99 others); Sat, 22 Oct 2022 04:23:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53212 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233794AbiJVIVP (ORCPT ); Sat, 22 Oct 2022 04:21:15 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 87FC72DCB1E; Sat, 22 Oct 2022 00:58: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 131FF60B93; Sat, 22 Oct 2022 07:58:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1B48CC433D6; Sat, 22 Oct 2022 07:58:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425536; bh=EToABdKvy4XhxuhBiW5VUN7zQrDrFjx5hkuwfUdi6NE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=2kBGb4nTkxl4d/UgXuCpISumNps+WFsGrCHW2MhMPZwwHu/gwgeSqsGAZ3MfND6+i bbqnIId8ORYe8azs7c6fm3mrcVq/+mYWv1fey78dRmWdCpEugcdIsRgVYq9akuF1vP fWxvn9ddn2wzXoJGlCAVXUNef+mLYYuELH1WLp1s= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Vincent Knecht , Dmitry Baryshkov , Bjorn Andersson , Bryan ODonoghue , Daniel Lezcano , Sasha Levin Subject: [PATCH 5.19 534/717] thermal/drivers/qcom/tsens-v0_1: Fix MSM8939 fourth sensor hw_id Date: Sat, 22 Oct 2022 09:26:53 +0200 Message-Id: <20221022072521.941039343@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376250774540620?= X-GMAIL-MSGID: =?utf-8?q?1747376250774540620?= From: Vincent Knecht [ Upstream commit b0c883e900702f408d62cf92b0ef01303ed69be9 ] Reading temperature from this sensor fails with 'Invalid argument'. Looking at old vendor dts [1], its hw_id should be 3 instead of 4. Change this hw_id accordingly. [1] https://github.com/msm8916-mainline/android_kernel_qcom_msm8916/blob/master/arch/arm/boot/dts/qcom/msm8939-common.dtsi#L511 Fixes: 332bc8ebab2c ("thermal: qcom: tsens-v0_1: Add support for MSM8939") Signed-off-by: Vincent Knecht Reviewed-by: Dmitry Baryshkov Reviewed-by: Bjorn Andersson Reviewed-by: Bryan O'Donoghue Link: https://lore.kernel.org/r/20220811105014.7194-1-vincent.knecht@mailoo.org Signed-off-by: Daniel Lezcano Signed-off-by: Sasha Levin --- drivers/thermal/qcom/tsens-v0_1.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/thermal/qcom/tsens-v0_1.c b/drivers/thermal/qcom/tsens-v0_1.c index f136cb350238..327f37202c69 100644 --- a/drivers/thermal/qcom/tsens-v0_1.c +++ b/drivers/thermal/qcom/tsens-v0_1.c @@ -604,7 +604,7 @@ static const struct tsens_ops ops_8939 = { struct tsens_plat_data data_8939 = { .num_sensors = 10, .ops = &ops_8939, - .hw_ids = (unsigned int []){ 0, 1, 2, 4, 5, 6, 7, 8, 9, 10 }, + .hw_ids = (unsigned int []){ 0, 1, 2, 3, 5, 6, 7, 8, 9, 10 }, .feat = &tsens_v0_1_feat, .fields = tsens_v0_1_regfields, From patchwork Sat Oct 22 07:26: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: 7666 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1108165wrr; Sat, 22 Oct 2022 01:43:38 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4Ge68lHHdbSafJsUSsCv0+pwphwtWhgsILQQE8ZGxiG4SyUGBWj8ewB3q10PoQ9IFYfW92 X-Received: by 2002:a50:9519:0:b0:45f:ca89:cf9a with SMTP id u25-20020a509519000000b0045fca89cf9amr12958618eda.248.1666428218287; Sat, 22 Oct 2022 01:43:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666428218; cv=none; d=google.com; s=arc-20160816; b=L3RyweZpzAOjCs45nTOJMIzt63mRd3PeZMo3KhtcN30L8/KfdfmLVtzxgCxUl/0Vy8 Xojogf5lehbWktgqC3J6uwa5Qiacf/mojFw3a/JeoAvMCIBa3WjbkEde070t7UWmy57O xbYagvzOrnrppemZV+myPsrEj8R6A0//69V0lr9TJ2m87i7b9aQPLlZoh+rZTXRTyHmq YygdanZjgIcCi1k0jHIR4YL2szjNHtsuj5m/4sLRYHmPlG2vtoRlFfUZfAJfbMxO3JjE ORkWxGs0ZLKVb3kUXbFv81Rg6TIItFiOjQvIOztHRE0eChMEhu3U78lStqpzXBWKXnf6 TaUg== 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=Hvs4hgilptgO+/i38adUEuP5+Rgjnez5emDoQYy+TTc=; b=PIYIVGFelmBjm9Rkmz+xfIMllAGGuf4AoKeO+PLyDd6iJq79REMe9C7Rb78Z/XgoCB sl47HYSprA8u/E4/oWxzN7vO0YwftnIUZZcJJhegzcUGsUOYnXI56dzhzzRPcyMrz/X2 EyE6T1zKkoN8SCDSQ5tdeXtodgnVNCXIQfDIc67lqDHtWjJzf7TrLpYxR0VF/TGtW685 ioUjaSUrfgQ+FEvYV21XSSjCPjxnFBI4Q1KcurLt06X7M0NLlV+hbArOQT9PnuQFDNrD rLfrscnvsRrJxLpGWjzb0WsYvacShOZIYe75VwcNxjQ3i8VYacIzEBv+iw7HUwKHadWM fECQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=uCD8WB7+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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-20020aa7c2d6000000b0044e9fd71b82si18852530edp.280.2022.10.22.01.43.14; Sat, 22 Oct 2022 01:43: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=uCD8WB7+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S232424AbiJVImb (ORCPT + 99 others); Sat, 22 Oct 2022 04:42:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56488 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234831AbiJVIkV (ORCPT ); Sat, 22 Oct 2022 04:40: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 6B7121E3915; Sat, 22 Oct 2022 01:06: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 C3776B82E1A; Sat, 22 Oct 2022 07:59:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 12D2CC433C1; Sat, 22 Oct 2022 07:58:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425539; bh=gQ9uhgSJYlR3is3lDutdEcOjJQsBHpKOa3lCfgM3yUc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uCD8WB7+fqOK3GrNJdwitp5+d3QVNS42LNaXx6LEn0pN4J3lUkrfIFB/VUIL0fvf2 ZEl/NaG5Z2cdZ7IjEHEiJIFk/u0EgzfyIhYNYPRyrDtSQd0cl0F6aKPGHDR2Tiq9Sy iBjRwy/EcAIfg68Zapur010yXAqrYgGKJIriMhEQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Shuai Xue , Tony Luck , "Rafael J. Wysocki" , Sasha Levin Subject: [PATCH 5.19 535/717] ACPI: APEI: do not add task_work to kernel thread to avoid memory leak Date: Sat, 22 Oct 2022 09:26:54 +0200 Message-Id: <20221022072521.984264440@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376635022417402?= X-GMAIL-MSGID: =?utf-8?q?1747376635022417402?= From: Shuai Xue [ Upstream commit 415fed694fe11395df56e05022d6e7cee1d39dd3 ] If an error is detected as a result of user-space process accessing a corrupt memory location, the CPU may take an abort. Then the platform firmware reports kernel via NMI like notifications, e.g. NOTIFY_SEA, NOTIFY_SOFTWARE_DELEGATED, etc. For NMI like notifications, commit 7f17b4a121d0 ("ACPI: APEI: Kick the memory_failure() queue for synchronous errors") keep track of whether memory_failure() work was queued, and make task_work pending to flush out the queue so that the work is processed before return to user-space. The code use init_mm to check whether the error occurs in user space: if (current->mm != &init_mm) The condition is always true, becase _nobody_ ever has "init_mm" as a real VM any more. In addition to abort, errors can also be signaled as asynchronous exceptions, such as interrupt and SError. In such case, the interrupted current process could be any kind of thread. When a kernel thread is interrupted, the work ghes_kick_task_work deferred to task_work will never be processed because entry_handler returns to call ret_to_kernel() instead of ret_to_user(). Consequently, the estatus_node alloced from ghes_estatus_pool in ghes_in_nmi_queue_one_entry() will not be freed. After around 200 allocations in our platform, the ghes_estatus_pool will run of memory and ghes_in_nmi_queue_one_entry() returns ENOMEM. As a result, the event failed to be processed. sdei: event 805 on CPU 113 failed with error: -2 Finally, a lot of unhandled events may cause platform firmware to exceed some threshold and reboot. The condition should generally just do if (current->mm) as described in active_mm.rst documentation. Then if an asynchronous error is detected when a kernel thread is running, (e.g. when detected by a background scrubber), do not add task_work to it as the original patch intends to do. Fixes: 7f17b4a121d0 ("ACPI: APEI: Kick the memory_failure() queue for synchronous errors") Signed-off-by: Shuai Xue Reviewed-by: Tony Luck Signed-off-by: Rafael J. Wysocki Signed-off-by: Sasha Levin --- drivers/acpi/apei/ghes.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/acpi/apei/ghes.c b/drivers/acpi/apei/ghes.c index d91ad378c00d..80ad530583c9 100644 --- a/drivers/acpi/apei/ghes.c +++ b/drivers/acpi/apei/ghes.c @@ -985,7 +985,7 @@ static void ghes_proc_in_irq(struct irq_work *irq_work) ghes_estatus_cache_add(generic, estatus); } - if (task_work_pending && current->mm != &init_mm) { + if (task_work_pending && current->mm) { estatus_node->task_work.func = ghes_kick_task_work; estatus_node->task_work_cpu = smp_processor_id(); ret = task_work_add(current, &estatus_node->task_work, From patchwork Sat Oct 22 07:26: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: 7527 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1105795wrr; Sat, 22 Oct 2022 01:36:12 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6M5fU7XdMQ37KTxl07+jpTRrxdu0FsRIgPGRpq+BS/UC0/tsazX8ctif4/obTuB3QWBpIE X-Received: by 2002:aa7:8a05:0:b0:56a:fd17:6720 with SMTP id m5-20020aa78a05000000b0056afd176720mr6118385pfa.1.1666427772292; Sat, 22 Oct 2022 01:36:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666427772; cv=none; d=google.com; s=arc-20160816; b=fo9tvu71dFDb58sbPJopsJd6M6fk+q5wvWpqAFNypBXhVI5uxAdVxyjs6aj/6JbBcO JH21GwTirlm6IbRzhw/9h0uV7SPXNzIW4N6weIYXRGOAXqdlAAGW6NT7F8H4hDnPOOxk eUj7GNfPHgnUP8SynpZ8MNGtHToL0DbVRTvgupqoExQ5ki70LJOWky0HYWo4WLV79mG6 JQ7O83OW68ri5uOxU8c8H6b9bPcWR9Dcx0fQT2TS/lKoquDKYigm7veT6D/zrZ8dau82 LEa9G5IzDF3lVrhrlkX/QIkn0YTldjEdpQnR9C54qpUeq5fz0f+UyHsLsBnN1Os4sHqG bPJQ== 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=mRjNevsjHmu6soZypnH8AnuQIel6+ino/dMijUWye8w=; b=zdXaRCg6P24nwR/Y73+/NPDpYIyINM4Trp9gxdyxeePwAMcaPLzba4V+2djF7hQ9cf aE/H+tT2EHTI7Ik+cQjY9iJ3ycb8vxvTeb7bPxyFpg4OqZIm38cX6IVHvxbksJIwGEnS Q7a/L3smiVW2lo6wbZp5gYdKkBMOuH9seXisJjITAZRDyf/OBrXUviLd53WPGT6btIRw /jSQyvqQig95htNi1fyrOpvaZUbg7qyrrdCkjXEdtowziGhmnXEHWjWGjf1mtDDuIJ8s GE/JEdHCDoshhmOQXXSgpMBXfOQOPjWW5h9kjK1g7CCiWxhafgQKBuAWHeIuUkXDNeOW UBvg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=qRLNu5E7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 20-20020a631154000000b0043c0b452d3csi29495349pgr.69.2022.10.22.01.35.56; Sat, 22 Oct 2022 01:36: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=qRLNu5E7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S233869AbiJVIXp (ORCPT + 99 others); Sat, 22 Oct 2022 04:23:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56472 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233843AbiJVIVq (ORCPT ); Sat, 22 Oct 2022 04:21:46 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EC9F013A582; Sat, 22 Oct 2022 00: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 6566560ADC; Sat, 22 Oct 2022 07:59:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3DEB0C433D6; Sat, 22 Oct 2022 07:59:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425542; bh=VvCdVM0o6p1PxXk6TZ1vPl1OdkJWcfXxLrIRwfpPLSI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qRLNu5E7b33lgKGI/7FnKUbAiodRumhfvj9BrAuueiwae6ys/UDWn59E6BBGo/bA4 ULTkhE0aK41dpe3LCYGDLGzoK7LF0Ut/5souDfi7ty2jXE35FTLNt5TOniUZGW7l8g Hh6/qnBD5veXTKcBCFdm6vHUHBHCwdkcQhJ72VZc= 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 5.19 536/717] f2fs: fix race condition on setting FI_NO_EXTENT flag Date: Sat, 22 Oct 2022 09:26:55 +0200 Message-Id: <20221022072522.027714075@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376167628804008?= X-GMAIL-MSGID: =?utf-8?q?1747376167628804008?= 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 866e72b29bd5..761fd42c93f2 100644 --- a/fs/f2fs/extent_cache.c +++ b/fs/f2fs/extent_cache.c @@ -804,9 +804,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 Sat Oct 22 07:26: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: 7529 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1105797wrr; Sat, 22 Oct 2022 01:36:12 -0700 (PDT) X-Google-Smtp-Source: AMsMyM54Ut0UqScSrYrZ6IbVLbcEp3l9okvqUQg06uoq87z+9DsFeOwtqANaFLn9b1Us015hCNRK X-Received: by 2002:a17:902:8491:b0:183:c3d2:2112 with SMTP id c17-20020a170902849100b00183c3d22112mr23259769plo.133.1666427772455; Sat, 22 Oct 2022 01:36:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666427772; cv=none; d=google.com; s=arc-20160816; b=cGGwMrs6JVii8B4814iQihCyXcGviHpZI0UWX9YVsqh7tKKp1ovZFYFv5W6WVbbURm qg2TrF6GWb35CeD16geYQIpMlMOCWFAJ07FsEE71y6wFtnMU4zDDqlXR7708ss1XZaMy egeFVK4fmJjUG0Vtvnx0EpXVXM902A0PCTuXIXMBQqB65sV8fS+NoHr4GZhVo6znUTTa Jc1YNkn8FBWRVkS09JJQWatvowVIdxDZkOPDq3Xbhl99tqtDLKQtWNdzWiuwzZX4jQ8j Wu06UGWbMRxNMcwxeRU4oSuZMEcgZt5ie733JYcgJHG2l029taJZ/9VPEFq29JoluIDR uYWA== 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=MJ+r6/TpTxtjbYPlpZ6l9fiYtZXz9AF686oEtB5u/2E=; b=jW+pefOeFy9SQGB7TaPGAIknkz7W3PZT54Qsbab/c0so7m/0rXfS0fX6Srk0i8VgoB Adr+qOmouJKBQUxTBV/ukZqtMm5t4vLl12n8lSNAzjlCjVJTOeEdGRR9s2pd3GQyElQ+ rjF3f5Q2+GW/QWszKC5tD93HJ/QqLEE7oMM5T0JTlvnxSBECoHa4l/LX6Lh77QV+ojSQ nW6d3RE63PSqyxxRCBTaPVgWCPmN1yJfAGiCPXpyFbvPevP+QYpnZpcthCoX2C5wjCCa ANeGM7OOAsd08X5MkGAKWwPghrd/OtkheYmhfGwLhzWTOf2gOgb2xEybe9auhiIgMMOG GIiA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=KJ4aGTaB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 j2-20020a17090a734200b00212e24a499csi1460161pjs.26.2022.10.22.01.35.56; Sat, 22 Oct 2022 01:36: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=KJ4aGTaB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S233891AbiJVIX7 (ORCPT + 99 others); Sat, 22 Oct 2022 04:23:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43656 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229913AbiJVIWX (ORCPT ); Sat, 22 Oct 2022 04:22: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 ABA73171CEC; Sat, 22 Oct 2022 00: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 ams.source.kernel.org (Postfix) with ESMTPS id 07A32B82E33; Sat, 22 Oct 2022 07:59:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4F5FDC433D6; Sat, 22 Oct 2022 07:59:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425545; bh=8x1GVGNt9XiIQqkjtVfsiusz1SyAaluOtV/zS6uMHq8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KJ4aGTaBAE/Uzls8qK7/k7w7iu+szCDdKrwRdutQmRipgAThU1mvDDz8YH3SvLlpL 95Z2R9r9F6b+FXoKBLVRiL5HEdBIyhTGwOgfrS6Mr2ZLe7i6vwvFE7QqXadX0FsUoN 8EGJyuNib+x3hvB3RXbLm6YHiNIBwdOqpwCkdIUI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Chao Yu , Jaegeuk Kim , Sasha Levin Subject: [PATCH 5.19 537/717] f2fs: fix to account FS_CP_DATA_IO correctly Date: Sat, 22 Oct 2022 09:26:56 +0200 Message-Id: <20221022072522.076491149@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376168079004392?= X-GMAIL-MSGID: =?utf-8?q?1747376168079004392?= From: Chao Yu [ Upstream commit d80afefb17e01aa0c46a8eebc01882e0ebd8b0f6 ] f2fs_inode_info.cp_task was introduced for FS_CP_DATA_IO accounting since commit b0af6d491a6b ("f2fs: add app/fs io stat"). However, cp_task usage coverage has been increased due to below commits: commit 040d2bb318d1 ("f2fs: fix to avoid deadloop if data_flush is on") commit 186857c5a14a ("f2fs: fix potential recursive call when enabling data_flush") So that, if data_flush mountoption is on, when data flush was triggered from background, the IO from data flush will be accounted as checkpoint IO type incorrectly. In order to fix this issue, this patch splits cp_task into two: a) cp_task: used for IO accounting b) wb_task: used to avoid deadlock Fixes: 040d2bb318d1 ("f2fs: fix to avoid deadloop if data_flush is on") Fixes: 186857c5a14a ("f2fs: fix potential recursive call when enabling data_flush") Signed-off-by: Chao Yu Signed-off-by: Jaegeuk Kim Signed-off-by: Sasha Levin --- fs/f2fs/checkpoint.c | 13 +++++++++---- fs/f2fs/data.c | 4 ++-- fs/f2fs/f2fs.h | 4 +++- fs/f2fs/segment.c | 2 +- 4 files changed, 15 insertions(+), 8 deletions(-) diff --git a/fs/f2fs/checkpoint.c b/fs/f2fs/checkpoint.c index 2a1930cfd513..5c77ae07150d 100644 --- a/fs/f2fs/checkpoint.c +++ b/fs/f2fs/checkpoint.c @@ -1063,7 +1063,8 @@ void f2fs_remove_dirty_inode(struct inode *inode) spin_unlock(&sbi->inode_lock[type]); } -int f2fs_sync_dirty_inodes(struct f2fs_sb_info *sbi, enum inode_type type) +int f2fs_sync_dirty_inodes(struct f2fs_sb_info *sbi, enum inode_type type, + bool from_cp) { struct list_head *head; struct inode *inode; @@ -1098,11 +1099,15 @@ int f2fs_sync_dirty_inodes(struct f2fs_sb_info *sbi, enum inode_type type) if (inode) { unsigned long cur_ino = inode->i_ino; - F2FS_I(inode)->cp_task = current; + if (from_cp) + F2FS_I(inode)->cp_task = current; + F2FS_I(inode)->wb_task = current; filemap_fdatawrite(inode->i_mapping); - F2FS_I(inode)->cp_task = NULL; + F2FS_I(inode)->wb_task = NULL; + if (from_cp) + F2FS_I(inode)->cp_task = NULL; iput(inode); /* We need to give cpu to another writers. */ @@ -1231,7 +1236,7 @@ static int block_operations(struct f2fs_sb_info *sbi) /* write all the dirty dentry pages */ if (get_pages(sbi, F2FS_DIRTY_DENTS)) { f2fs_unlock_all(sbi); - err = f2fs_sync_dirty_inodes(sbi, DIR_INODE); + err = f2fs_sync_dirty_inodes(sbi, DIR_INODE, true); if (err) return err; cond_resched(); diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c index f2a272613477..d3768115e3b8 100644 --- a/fs/f2fs/data.c +++ b/fs/f2fs/data.c @@ -2843,7 +2843,7 @@ int f2fs_write_single_data_page(struct page *page, int *submitted, } unlock_page(page); if (!S_ISDIR(inode->i_mode) && !IS_NOQUOTA(inode) && - !F2FS_I(inode)->cp_task && allow_balance) + !F2FS_I(inode)->wb_task && allow_balance) f2fs_balance_fs(sbi, need_balance_fs); if (unlikely(f2fs_cp_error(sbi))) { @@ -3141,7 +3141,7 @@ static inline bool __should_serialize_io(struct inode *inode, struct writeback_control *wbc) { /* to avoid deadlock in path of data flush */ - if (F2FS_I(inode)->cp_task) + if (F2FS_I(inode)->wb_task) return false; if (!S_ISREG(inode->i_mode)) diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h index f9d5110bbcd8..7896cbadbcd7 100644 --- a/fs/f2fs/f2fs.h +++ b/fs/f2fs/f2fs.h @@ -784,6 +784,7 @@ struct f2fs_inode_info { unsigned int clevel; /* maximum level of given file name */ struct task_struct *task; /* lookup and create consistency */ struct task_struct *cp_task; /* separate cp/wb IO stats*/ + struct task_struct *wb_task; /* indicate inode is in context of writeback */ nid_t i_xattr_nid; /* node id that contains xattrs */ loff_t last_disk_size; /* lastly written file size */ spinlock_t i_size_lock; /* protect last_disk_size */ @@ -3710,7 +3711,8 @@ int f2fs_recover_orphan_inodes(struct f2fs_sb_info *sbi); int f2fs_get_valid_checkpoint(struct f2fs_sb_info *sbi); void f2fs_update_dirty_folio(struct inode *inode, struct folio *folio); void f2fs_remove_dirty_inode(struct inode *inode); -int f2fs_sync_dirty_inodes(struct f2fs_sb_info *sbi, enum inode_type type); +int f2fs_sync_dirty_inodes(struct f2fs_sb_info *sbi, enum inode_type type, + bool from_cp); void f2fs_wait_on_all_pages(struct f2fs_sb_info *sbi, int type); u64 f2fs_get_sectors_written(struct f2fs_sb_info *sbi); int f2fs_write_checkpoint(struct f2fs_sb_info *sbi, struct cp_control *cpc); diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c index 52df19a0638b..b740ff81024e 100644 --- a/fs/f2fs/segment.c +++ b/fs/f2fs/segment.c @@ -469,7 +469,7 @@ void f2fs_balance_fs_bg(struct f2fs_sb_info *sbi, bool from_bg) mutex_lock(&sbi->flush_lock); blk_start_plug(&plug); - f2fs_sync_dirty_inodes(sbi, FILE_INODE); + f2fs_sync_dirty_inodes(sbi, FILE_INODE, false); blk_finish_plug(&plug); mutex_unlock(&sbi->flush_lock); From patchwork Sat Oct 22 07:26: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: 7838 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1153120wrr; Sat, 22 Oct 2022 04:04:49 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7LrMuzy/FozEPu7x81Y2DKCL3sB7F2mCmRlTujUDzHjMbUiMkkrVKG9vgROEGbggZYQtwE X-Received: by 2002:a17:907:9611:b0:78d:bb06:90a3 with SMTP id gb17-20020a170907961100b0078dbb0690a3mr19571582ejc.233.1666436689217; Sat, 22 Oct 2022 04:04:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666436689; cv=none; d=google.com; s=arc-20160816; b=zgoLCj6khPVhOKE1VFuBXR5nimFvMkogQi7XDj+3NhTyYmJnLBHYFsLlHZuu3vSUE7 EfQ8bUMe+GZ+mEA2AKGDmsnEEGQbIaFigzhUtNxDbjOxgWL6VNnD6nQnoNBd1n9lwu4A 0ZiuN4JJL/j4PRqDfz5l9hCBIEPXiDzv362jl6TW8S6UF9UzigrJdkcFNyLWXo1yzR99 Z0hCMT+7bBhTqiKmI3PcdvPVWeXMZKkiEw6HRJSKy4l2I6LL3gf1obgIFNXhNhOoXeSm b5bqEz/9vmh0IV5XY/vJEYaV4mvQEx2piZ64wNKMp1ChWJ6iEXszoLwCv75ORPNPoK9z DlPg== 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=4vRJUTUzwjYB2roPGkBz4trD4wxoeZa0gezVN8vh6Qc=; b=U4Y0hspfEMfJjdqOLNZFbRw5yUFpD4YVF8HYyB0iNLPyo8V5nVpMDftK9JJYmV9rcm IkFogNR8bjRQVvaiwcZfhy+e0oPQn89gLAOYyyRPrnPHXYoMJcbdMzMD77K8Fph/H5o/ qSGnjStGta/UwLYYNMv9XDpR9ogVZyvSuIalKhdd51JhxAw3vPPsKwnkH6SEzR418bxG 6DO80D2YWaX3+h2UNiVBvbk8N+ABGRg88uUJvtSaCibkHGxikCRnqtO8yL+NW26thuVm 2NZPYKu3OApscMs6H4uXAGwA7pA2rLUylzgGbY8+BHFQ0wFJUWA9RirktPnKE4ABkBFq 7GSw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=pnufLew+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 g39-20020a056402322700b0046181f0e503si998581eda.209.2022.10.22.04.04.15; Sat, 22 Oct 2022 04:04: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=pnufLew+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S230121AbiJVK6Q (ORCPT + 99 others); Sat, 22 Oct 2022 06:58:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43282 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230446AbiJVK5x (ORCPT ); Sat, 22 Oct 2022 06:57:53 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EC14C319B88; Sat, 22 Oct 2022 03:16: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 sin.source.kernel.org (Postfix) with ESMTPS id A3E46CE2CB3; Sat, 22 Oct 2022 07:59:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 609DBC433D6; Sat, 22 Oct 2022 07:59:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425548; bh=X1wE11PrAAWw40XctTtBRMrMg9csj3krl4R38bk5NqQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pnufLew+vBVIRbhblDTV5C8t1OhIkXxHDh703gR1UrZDT5Z+YWHuBAkFeE0Q7LmGP NiSJGA2FzvpcDA96TcQz1j2pQlJssvEnfpM6LIz2HapvTPOLg67pKfr7HdRHyyl3uE P7ITTgN3v7Ll5NnKZ/uGa7NOnEZmFOaOGiqtxmUQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Shuah Khan , linux-kselftest@vger.kernel.org, Jarkko Sakkinen , Stefan Berger , Sasha Levin Subject: [PATCH 5.19 538/717] selftest: tpm2: Add Client.__del__() to close /dev/tpm* handle Date: Sat, 22 Oct 2022 09:26:57 +0200 Message-Id: <20221022072522.125914615@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 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?1747385517731214092?= X-GMAIL-MSGID: =?utf-8?q?1747385517731214092?= From: Stefan Berger [ Upstream commit 2d869f0b458547386fbcd8cf3004b271b7347b7f ] The following output can bee seen when the test is executed: test_flush_context (tpm2_tests.SpaceTest) ... \ /usr/lib64/python3.6/unittest/case.py:605: ResourceWarning: \ unclosed file <_io.FileIO name='/dev/tpmrm0' mode='rb+' closefd=True> An instance of Client does not implicitly close /dev/tpm* handle, once it gets destroyed. Close the file handle in the class destructor Client.__del__(). Fixes: 6ea3dfe1e0732 ("selftests: add TPM 2.0 tests") Cc: Shuah Khan Cc: linux-kselftest@vger.kernel.org Cc: Jarkko Sakkinen Signed-off-by: Stefan Berger Reviewed-by: Jarkko Sakkinen Signed-off-by: Jarkko Sakkinen Signed-off-by: Sasha Levin --- tools/testing/selftests/tpm2/tpm2.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tools/testing/selftests/tpm2/tpm2.py b/tools/testing/selftests/tpm2/tpm2.py index 057a4f49c79d..c7363c6764fc 100644 --- a/tools/testing/selftests/tpm2/tpm2.py +++ b/tools/testing/selftests/tpm2/tpm2.py @@ -371,6 +371,10 @@ class Client: fcntl.fcntl(self.tpm, fcntl.F_SETFL, flags) self.tpm_poll = select.poll() + def __del__(self): + if self.tpm: + self.tpm.close() + def close(self): self.tpm.close() From patchwork Sat Oct 22 07:26: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: 7531 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1105811wrr; Sat, 22 Oct 2022 01:36:13 -0700 (PDT) X-Google-Smtp-Source: AMsMyM59E8y9E62zjHRwCoBG+aAJ31n89A1u4wLsvhOzNwF3XRGMtKDLkFHxP8m7odcdY2JgI8cd X-Received: by 2002:a63:1450:0:b0:439:3806:9b91 with SMTP id 16-20020a631450000000b0043938069b91mr19555739pgu.407.1666427772972; Sat, 22 Oct 2022 01:36:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666427772; cv=none; d=google.com; s=arc-20160816; b=Sk08mxQKNPY7N1kA/p2qqUvjH14XpVv4mPliNVJZCPE45atWT6xlWMTotKnDIdjB6I eC7DPHJHK4bCN7wl6jGCQI9bbjYtWtb+7b8DSKQ0ksgmsCqdza3k1+q1PM5mQ1xPkyBv WFffkK3Wa7fKCBvmIhR1EIYnND5RhyR+IksZaP0zMWxby+IDwtGObV5LUfPRyHDK38Bd 8s/YwNyFRLOLWXlNZ1iKQsi2c9vadezDMJKoevakSZ1aJ2jTjLozWaeQUcpZX3mYyrG+ E7lCgq4GEWfpm54BFmnVkiuSkBsxE2Muu0zoyglPS26ztRx18gYxVY16jvBFzdh3isjv bjuQ== 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=I8DkjVnHvipYjZWYYer0sDnqPw4kNhj2E0HivcOn//s=; b=baLLyv7rhvwOPdpev0d/yMdBkWZE8T7hf6de3lVI9sJT/AzcPev1tqq+iSW85td+pi oGMkrpotKGta16P1dQGSfHaYWsjYUhKLBRJBhe+hunfeDxMX+x8AndkS/GiAQOKmq9jL oT8Lelgm3BWS0eYZSEBcaZFBWQC+p2WCV9nz15Y+I/HfPXS/ioG7kvUWAk+7dFwFKMmI WEMevyNsrFGguf0dA29MFerMLrTVmiCCT9TTIbwnrhzqnFMRh0cAXZ6H6TgyCxbJd1z9 +lO67z1b24znufjM81qs3GFwsgIE5cJQ2xLoNX4IBDgoskneoSWncHMg7tLZ0kruZQzN z2Vw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=a1XiWn27; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 r138-20020a632b90000000b0046086f8f5d0si27266533pgr.537.2022.10.22.01.35.56; Sat, 22 Oct 2022 01:36: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=a1XiWn27; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S230331AbiJVIZV (ORCPT + 99 others); Sat, 22 Oct 2022 04:25:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50650 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233621AbiJVIW1 (ORCPT ); Sat, 22 Oct 2022 04:22:27 -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 D8C623B956; Sat, 22 Oct 2022 00:59: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 597F3B82DFA; Sat, 22 Oct 2022 07:59:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8B47DC433D6; Sat, 22 Oct 2022 07:59:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425552; bh=vu7rJYj1z+XfoxBx4lR0BrFlu16v+YMPOdlO7pyXxkc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=a1XiWn27v3kSFkQTfDxiw0z0eaZQ/jnqlo8kURX0UtiEHhxDZ0i5bIxvm4vg3jNoW q2+QMxaLMJmZ4zc67brD4MyLXGoeywjq6h473os0xsdjL9a49+aIc5ypVyemB9VBkB XlNNuUrL7cLtPTg67eIR1FJmT5UpHscc2hOilj6Q= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alexey Dobriyan , Aaron Tomlin , Luis Chamberlain , Linus Torvalds , Sasha Levin Subject: [PATCH 5.19 539/717] module: tracking: Keep a record of tainted unloaded modules only Date: Sat, 22 Oct 2022 09:26:58 +0200 Message-Id: <20221022072522.179159829@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376168495064403?= X-GMAIL-MSGID: =?utf-8?q?1747376168495064403?= From: Aaron Tomlin [ Upstream commit 47cc75aa92837a9d3f15157d6272ff285585d75d ] This ensures that no module record/or entry is added to the unloaded_tainted_modules list if it does not carry a taint. Reported-by: Alexey Dobriyan Fixes: 99bd9956551b ("module: Introduce module unload taint tracking") Signed-off-by: Aaron Tomlin Acked-by: Luis Chamberlain Signed-off-by: Linus Torvalds Signed-off-by: Sasha Levin --- kernel/module/tracking.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/kernel/module/tracking.c b/kernel/module/tracking.c index 7f8133044d09..af52cabfe632 100644 --- a/kernel/module/tracking.c +++ b/kernel/module/tracking.c @@ -21,6 +21,9 @@ int try_add_tainted_module(struct module *mod) module_assert_mutex_or_preempt(); + if (!mod->taints) + goto out; + list_for_each_entry_rcu(mod_taint, &unloaded_tainted_modules, list, lockdep_is_held(&module_mutex)) { if (!strcmp(mod_taint->name, mod->name) && From patchwork Sat Oct 22 07:26: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: 7557 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1105965wrr; Sat, 22 Oct 2022 01:36:37 -0700 (PDT) X-Google-Smtp-Source: AMsMyM78hcg7ELn0wwq4aR6r/glEsmVZI03JNRaV5i2tsJ0EtWALdGDyssHzr99mNtjwey4FMfXa X-Received: by 2002:a17:90b:1643:b0:20c:c7c7:d598 with SMTP id il3-20020a17090b164300b0020cc7c7d598mr63055087pjb.97.1666427786566; Sat, 22 Oct 2022 01:36:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666427786; cv=none; d=google.com; s=arc-20160816; b=vawGB4NkTrBYLV1yksOuk8wWEHqlEY0qT2nkeA4yarwy/onPZD6OsVtVsml8wURYY4 MIbasb7oxABVZ9Euir0YMApz+ej2lLmJPGZjtyXNxI8y/twmtwV2xdTZvB7qPlFOKFtA 8HYm8a/j6QEjacxHG8N3bD8garuSgPvY1hgOLu1/KCK/BRwYn3OWMEbTYdBwrPQJCXMe ueSqwwmhJ6S1pD5BJYg48xqUDmyduB3r3+78pkL6ZJ34KAKpVzc1kQEF+fEbG0mLgvZH 8pGNqtdZHAPJK1riSQ3qz56+/Ht3V9FSobtOCFifDqQIXcnXHv0+0u+8GN8rmlPP03hm Xcxg== 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=9SU62d7DnURm9nt6NtaFFgt6/BPLBaNwHgtn94FYdUo=; b=yYEolyGzGC3azmz0T5YzRO5zEbTTqb7lUKtX8BqPUx+smh99bPibtjpYNCRUzpd+Gx pRrlTlKT0UR86M9SbJEszMmlofPmeOxYJLgzCHkV1+2EhJj+E6yPF+H7AfLFa/BiUzP3 MTEFB6XoxYJVrtg6BNKNJpRZ6xZ/Dr9uIWP5JFZ9BHjSUbOPQoVYEQOIGpbHhAbOj+bT 9McWZpUemBZOsW0r53g7UATeXi6398UreJzZ3ddP+kAlL9asKkBxRvDzrQqwdvVDW4Wn YmEIqBoH08RNzvbdzEAzqrl6jHEDAZiJ1s4l45LQYExwuJvP5zs4wIynPGKiFyMZn3Ik eEqQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Cj1aLwZ9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 pv12-20020a17090b3c8c00b00210509dfb99si8626120pjb.42.2022.10.22.01.36.11; Sat, 22 Oct 2022 01:36: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=Cj1aLwZ9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S233521AbiJVI1s (ORCPT + 99 others); Sat, 22 Oct 2022 04:27:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38764 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233890AbiJVI1J (ORCPT ); Sat, 22 Oct 2022 04:27:09 -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 05AA41DEC29; Sat, 22 Oct 2022 01:00: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 15F48B82DF2; Sat, 22 Oct 2022 07:59:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 84365C433D7; Sat, 22 Oct 2022 07:59:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425554; bh=KM+yqH9LxgCI1cABBreSlmVHgkz04CgVC7Pe9gqdX88=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Cj1aLwZ9UDxYwuGd9s+eAqmtu7ZNo4K50CtRSbqqWCJMrZ00w1//ArAYqWXD5x6bo wIlrBFOJ7iboREFQHucEFKXmz7B13I9j32BA9XvnP39X+QngU3stAPCQELYHLS2lAP Yv7a5cRU8Gh8zdgM+fhgPev1VOgZskvJE7yAh0e0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alexander Aring , David Teigland , Sasha Levin Subject: [PATCH 5.19 540/717] fs: dlm: fix race in lowcomms Date: Sat, 22 Oct 2022 09:26:59 +0200 Message-Id: <20221022072522.228629924@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376182828240199?= X-GMAIL-MSGID: =?utf-8?q?1747376182828240199?= From: Alexander Aring [ Upstream commit 30ea3257e8766027c4d8d609dcbd256ff9a76073 ] This patch fixes a race between queue_work() in _dlm_lowcomms_commit_msg() and srcu_read_unlock(). The queue_work() can take the final reference of a dlm_msg and so msg->idx can contain garbage which is signaled by the following warning: [ 676.237050] ------------[ cut here ]------------ [ 676.237052] WARNING: CPU: 0 PID: 1060 at include/linux/srcu.h:189 dlm_lowcomms_commit_msg+0x41/0x50 [ 676.238945] Modules linked in: dlm_locktorture torture rpcsec_gss_krb5 intel_rapl_msr intel_rapl_common iTCO_wdt iTCO_vendor_support qxl kvm_intel drm_ttm_helper vmw_vsock_virtio_transport kvm vmw_vsock_virtio_transport_common ttm irqbypass crc32_pclmul joydev crc32c_intel serio_raw drm_kms_helper vsock virtio_scsi virtio_console virtio_balloon snd_pcm drm syscopyarea sysfillrect sysimgblt snd_timer fb_sys_fops i2c_i801 lpc_ich snd i2c_smbus soundcore pcspkr [ 676.244227] CPU: 0 PID: 1060 Comm: lock_torture_wr Not tainted 5.19.0-rc3+ #1546 [ 676.245216] Hardware name: Red Hat KVM/RHEL-AV, BIOS 1.16.0-2.module+el8.7.0+15506+033991b0 04/01/2014 [ 676.246460] RIP: 0010:dlm_lowcomms_commit_msg+0x41/0x50 [ 676.247132] Code: fe ff ff ff 75 24 48 c7 c6 bd 0f 49 bb 48 c7 c7 38 7c 01 bd e8 00 e7 ca ff 89 de 48 c7 c7 60 78 01 bd e8 42 3d cd ff 5b 5d c3 <0f> 0b eb d8 66 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 55 48 [ 676.249253] RSP: 0018:ffffa401c18ffc68 EFLAGS: 00010282 [ 676.249855] RAX: 0000000000000001 RBX: 00000000ffff8b76 RCX: 0000000000000006 [ 676.250713] RDX: 0000000000000000 RSI: ffffffffbccf3a10 RDI: ffffffffbcc7b62e [ 676.251610] RBP: ffffa401c18ffc70 R08: 0000000000000001 R09: 0000000000000001 [ 676.252481] R10: 0000000000000001 R11: 0000000000000001 R12: 0000000000000005 [ 676.253421] R13: ffff8b76786ec370 R14: ffff8b76786ec370 R15: ffff8b76786ec480 [ 676.254257] FS: 0000000000000000(0000) GS:ffff8b7777800000(0000) knlGS:0000000000000000 [ 676.255239] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 676.255897] CR2: 00005590205d88b8 CR3: 000000017656c003 CR4: 0000000000770ee0 [ 676.256734] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 [ 676.257567] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 [ 676.258397] PKRU: 55555554 [ 676.258729] Call Trace: [ 676.259063] [ 676.259354] dlm_midcomms_commit_mhandle+0xcc/0x110 [ 676.259964] queue_bast+0x8b/0xb0 [ 676.260423] grant_pending_locks+0x166/0x1b0 [ 676.261007] _unlock_lock+0x75/0x90 [ 676.261469] unlock_lock.isra.57+0x62/0xa0 [ 676.262009] dlm_unlock+0x21e/0x330 [ 676.262457] ? lock_torture_stats+0x80/0x80 [dlm_locktorture] [ 676.263183] torture_unlock+0x5a/0x90 [dlm_locktorture] [ 676.263815] ? preempt_count_sub+0xba/0x100 [ 676.264361] ? complete+0x1d/0x60 [ 676.264777] lock_torture_writer+0xb8/0x150 [dlm_locktorture] [ 676.265555] kthread+0x10a/0x130 [ 676.266007] ? kthread_complete_and_exit+0x20/0x20 [ 676.266616] ret_from_fork+0x22/0x30 [ 676.267097] [ 676.267381] irq event stamp: 9579855 [ 676.267824] hardirqs last enabled at (9579863): [] __up_console_sem+0x58/0x60 [ 676.268896] hardirqs last disabled at (9579872): [] __up_console_sem+0x3d/0x60 [ 676.270008] softirqs last enabled at (9579798): [] __do_softirq+0x349/0x4c7 [ 676.271438] softirqs last disabled at (9579897): [] irq_exit_rcu+0xb0/0xf0 [ 676.272796] ---[ end trace 0000000000000000 ]--- I reproduced this warning with dlm_locktorture test which is currently not upstream. However this patch fix the issue by make a additional refcount between dlm_lowcomms_new_msg() and dlm_lowcomms_commit_msg(). In case of the race the kref_put() in dlm_lowcomms_commit_msg() will be the final put. Signed-off-by: Alexander Aring Signed-off-by: David Teigland Signed-off-by: Sasha Levin --- fs/dlm/lowcomms.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/fs/dlm/lowcomms.c b/fs/dlm/lowcomms.c index 19e82f08c0e0..c80ee6a95d17 100644 --- a/fs/dlm/lowcomms.c +++ b/fs/dlm/lowcomms.c @@ -1336,6 +1336,8 @@ struct dlm_msg *dlm_lowcomms_new_msg(int nodeid, int len, gfp_t allocation, return NULL; } + /* for dlm_lowcomms_commit_msg() */ + kref_get(&msg->ref); /* we assume if successful commit must called */ msg->idx = idx; return msg; @@ -1375,6 +1377,8 @@ void dlm_lowcomms_commit_msg(struct dlm_msg *msg) { _dlm_lowcomms_commit_msg(msg); srcu_read_unlock(&connections_srcu, msg->idx); + /* because dlm_lowcomms_new_msg() */ + kref_put(&msg->ref, dlm_msg_release); } #endif From patchwork Sat Oct 22 07:27: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: 7566 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1106061wrr; Sat, 22 Oct 2022 01:36:47 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6RoDil6VyE3WKA3Z1EJAsBuv0EwvP06UL0MZNXsw8MLNg58qtgvlGagB9gNB+5y5I7yIgz X-Received: by 2002:a17:903:2c9:b0:182:c500:d93d with SMTP id s9-20020a17090302c900b00182c500d93dmr23896351plk.44.1666427806856; Sat, 22 Oct 2022 01:36:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666427806; cv=none; d=google.com; s=arc-20160816; b=v252+YJXxBS4vI+yyHzTRWycY3AnJckK4ISFZvbZ7IxleEeSPxaIcHJTjQOdAnStTx SbpQZ2+IPAeQYqgSbTs46aLjmwC5s/0xTW7ruX/xaNU6v07MRWuhnLVfmBib18sLAFEa XGVhbl4r1kqy5gz0kZN10Nr3vbRwN3hdrnMlov6kn55Ka9HEosNX6zAUAy+3fI5aZngm 1WkYywiV5LZG57/4/l4p0lwTPSWTU4EJR18v02TIXV+oqwLw6TcjHmUeOz29e08zEZcu GlrdC4HkP2vFykMrZuFhzOZQ3wnv7ix4dl/rR+fn81GrfV9ouJRit6RRKXlhS7QFNX92 runw== 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=uGepL7sJqjVYAmoQNgcfjIYSeGTMrcEH+Kc5ZSFcv+I=; b=oArxCwJbetfpsQ63UTHs5TjhdkZKCq0MNjSAvoKgx6Jc6T61okApRaL3G4mLbqMLzS DDbBrLiRYR/4r/dQ1Q33SCOaiXOFX89m12YrLMbLqOnMtwEkVnYp4Jno8ol/J4GIxc4y a/WXKKec5gkjxA/EWKQPZCtUIB7jXiz34A+Q9DHzBqUIIXvV0x9XFfrT2KnqGlSWfIU/ 7j5uZufbBpp7Y2izD98FdEJ2voFxmYSWPUapMndDknVVxLnK6p4HQ1amkgYWttUAI18/ ksU/8wKKe1i7aMA1qp4CF3mq7YfyxLfNCX6GX/LK7TXpKG+2sOk4lwYYm9euT0ft7sFm eaVA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=rxd41uYs; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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-20020a170902be1400b00184000a834dsi7481789pls.455.2022.10.22.01.36.29; Sat, 22 Oct 2022 01:36: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=rxd41uYs; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S229996AbiJVI1n (ORCPT + 99 others); Sat, 22 Oct 2022 04:27:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51440 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231317AbiJVI1G (ORCPT ); Sat, 22 Oct 2022 04:27:06 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 071B01E8BA6; Sat, 22 Oct 2022 01:00: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 E63EA60B09; Sat, 22 Oct 2022 07:59:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F10ACC433C1; Sat, 22 Oct 2022 07:59:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425561; bh=6Njtknf8o9zV3FzGqR/rcsTSKjOQy+EbRF2tsLSqiFY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rxd41uYsqOcfFU6uLFxfRCcHRcD/wZHr3OX8uqOE0pQvC3gLAQl77eobA40x2tfQ5 291ZRVfBv+2k9iA/Ahn+j4ufCC641eo5kZ+7sFUwUF+Zx4jtnpZ/LRalj5VzourcBc UP2m5wolorP61tiWuLxxzb1UqRcHcfNdKbYzvNX8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zqiang , "Paul E. McKenney" , Sasha Levin Subject: [PATCH 5.19 541/717] rcu: Avoid triggering strict-GP irq-work when RCU is idle Date: Sat, 22 Oct 2022 09:27:00 +0200 Message-Id: <20221022072522.277132672@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376204340237685?= X-GMAIL-MSGID: =?utf-8?q?1747376204340237685?= From: Zqiang [ Upstream commit 621189a1fe93cb2b34d62c5cdb9e258bca044813 ] Kernels built with PREEMPT_RCU=y and RCU_STRICT_GRACE_PERIOD=y trigger irq-work from rcu_read_unlock(), and the resulting irq-work handler invokes rcu_preempt_deferred_qs_handle(). The point of this triggering is to force grace periods to end quickly in order to give tools like KASAN a better chance of detecting RCU usage bugs such as leaking RCU-protected pointers out of an RCU read-side critical section. However, this irq-work triggering is unconditional. This works, but there is no point in doing this irq-work unless the current grace period is waiting on the running CPU or task, which is not the common case. After all, in the common case there are many rcu_read_unlock() calls per CPU per grace period. This commit therefore triggers the irq-work only when the current grace period is waiting on the running CPU or task. This change was tested as follows on a four-CPU system: echo rcu_preempt_deferred_qs_handler > /sys/kernel/debug/tracing/set_ftrace_filter echo 1 > /sys/kernel/debug/tracing/function_profile_enabled insmod rcutorture.ko sleep 20 rmmod rcutorture.ko echo 0 > /sys/kernel/debug/tracing/function_profile_enabled echo > /sys/kernel/debug/tracing/set_ftrace_filter This procedure produces results in this per-CPU set of files: /sys/kernel/debug/tracing/trace_stat/function* Sample output from one of these files is as follows: Function Hit Time Avg s^2 -------- --- ---- --- --- rcu_preempt_deferred_qs_handle 838746 182650.3 us 0.217 us 0.004 us The baseline sum of the "Hit" values (the number of calls to this function) was 3,319,015. With this commit, that sum was 1,140,359, for a 2.9x reduction. The worst-case variance across the CPUs was less than 25%, so this large effect size is statistically significant. The raw data is available in the Link: URL. Link: https://lore.kernel.org/all/20220808022626.12825-1-qiang1.zhang@intel.com/ Signed-off-by: Zqiang Signed-off-by: Paul E. McKenney Signed-off-by: Sasha Levin --- kernel/rcu/tree_plugin.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/kernel/rcu/tree_plugin.h b/kernel/rcu/tree_plugin.h index c8ba0fe17267..d164938528cd 100644 --- a/kernel/rcu/tree_plugin.h +++ b/kernel/rcu/tree_plugin.h @@ -641,7 +641,8 @@ static void rcu_read_unlock_special(struct task_struct *t) expboost = (t->rcu_blocked_node && READ_ONCE(t->rcu_blocked_node->exp_tasks)) || (rdp->grpmask & READ_ONCE(rnp->expmask)) || - IS_ENABLED(CONFIG_RCU_STRICT_GRACE_PERIOD) || + (IS_ENABLED(CONFIG_RCU_STRICT_GRACE_PERIOD) && + ((rdp->grpmask & READ_ONCE(rnp->qsmask)) || t->rcu_blocked_node)) || (IS_ENABLED(CONFIG_RCU_BOOST) && irqs_were_disabled && t->rcu_blocked_node); // Need to defer quiescent state until everything is enabled. From patchwork Sat Oct 22 07:27: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: 7837 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1153118wrr; Sat, 22 Oct 2022 04:04:48 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6sv3n4y+4W86LzVqteeEqHE2j7mGaRrVPIA8g1ZFBsH8VoNtJ2K/hRYX/0sSETN8JBq6jk X-Received: by 2002:a17:907:a43:b0:77b:ba98:d2f with SMTP id be3-20020a1709070a4300b0077bba980d2fmr19918196ejc.270.1666436688704; Sat, 22 Oct 2022 04:04:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666436688; cv=none; d=google.com; s=arc-20160816; b=Bpv3ZrLIwrKSYW9vzsgIPMhHJgJ5RwtGy0k1ThtSwJCByhpqjFE2y0TfJO3ylHiF7X W72ypiFca4gp42XLOk04y8MTb0zw+W6RTbXz2UwP6lqk2dUPGKMFPsot6bjeHYkQxDLo aEqyHYWDraIxjE0Pcv68lIQHm+u8FI4AD76xIzekIaenT2bTPjt6jsc6TZ8J0ted8JlW yZ8Pvt07weY1NxMu4Fof22v7HYbNif6yPzJJHEZInGPJJziN3pOxyAj76euJsuHBcpx/ Yf/rE/Zgwf/cIyH5ffxhbXK3OK0pUtQWA0K68K8mqtRMxivMbcD/YsZuixaucMwSrGVm xwEQ== 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=ZcDcx/IUi6ez1wMrW547lc5GlhnjRxbT4bVG/UeRZFY=; b=ZHzYZeV5E07wHGu2XaOWFPhADjaDDF6+yZgIY35726+/XYECPeemfAVM9dsUQhMqK/ FEGAErTz/UE7bKb1jkk4rgJA4EFi5oDG7FSq63OZ9SfLi/L7Dm4wfQLS6dvHTNGAmKdq 226JmYd61MCheDKlN8NrwEUW5abJp0eq4haMqRzxgLRicaNV4Nsg71PY+WKLwXF4xQA4 ijs6sCT1YAbia/64dt6tIeC/GbWlEdg4MaPjLFuMG5a72ROmJGmGGF1kd7gqRe8j3rlG 71hyoDOPvgNnENU+mabyuriODwoRfZ/+W3wC9/7OfDPiKWAlOkn0rRmYL/sTp2iWZl4R mAiw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=qxMIuck9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 b21-20020a056402139500b00448d387c327si19454686edv.181.2022.10.22.04.04.15; Sat, 22 Oct 2022 04:04: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=qxMIuck9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S230507AbiJVK6o (ORCPT + 99 others); Sat, 22 Oct 2022 06:58:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39286 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230447AbiJVK6P (ORCPT ); Sat, 22 Oct 2022 06:58:15 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9CF2540BCA; Sat, 22 Oct 2022 03:17: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 B95D3B82DEF; Sat, 22 Oct 2022 07:59:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id ED9B7C433C1; Sat, 22 Oct 2022 07:59:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425564; bh=jWnmZB96YzuwtBqDfWonjmLe0fepcA22GyA5+Yn5wxE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qxMIuck9RQOhAZPkOqLk/0DMLiMqJZbHO81r59tN1SW1pN8829v6m0x2tGTdiPlgq dPmb3BSkBdRHHWkLKbxfzKGNpr5HAPvv8faOnlE+pR9pEK+R2Xr73YRH2VcsJ5sEYi 2oGQN/odXYyX7kEwU6sn1o7UCHWXsmc/f7yj+bVE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Uladzislau Rezki (Sony)" , "Paul E. McKenney" , Frederic Weisbecker , Neeraj Upadhyay , Josh Triplett , Steven Rostedt , Mathieu Desnoyers , Lai Jiangshan , Joel Fernandes , Michal Hocko , Sasha Levin Subject: [PATCH 5.19 542/717] rcu: Back off upon fill_page_cache_func() allocation failure Date: Sat, 22 Oct 2022 09:27:01 +0200 Message-Id: <20221022072522.317578067@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 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?1747385517424160476?= X-GMAIL-MSGID: =?utf-8?q?1747385517424160476?= From: Michal Hocko [ Upstream commit 093590c16b447f53e66771c8579ae66c96f6ef61 ] The fill_page_cache_func() function allocates couple of pages to store kvfree_rcu_bulk_data structures. This is a lightweight (GFP_NORETRY) allocation which can fail under memory pressure. The function will, however keep retrying even when the previous attempt has failed. This retrying is in theory correct, but in practice the allocation is invoked from workqueue context, which means that if the memory reclaim gets stuck, these retries can hog the worker for quite some time. Although the workqueues subsystem automatically adjusts concurrency, such adjustment is not guaranteed to happen until the worker context sleeps. And the fill_page_cache_func() function's retry loop is not guaranteed to sleep (see the should_reclaim_retry() function). And we have seen this function cause workqueue lockups: kernel: BUG: workqueue lockup - pool cpus=93 node=1 flags=0x1 nice=0 stuck for 32s! [...] kernel: pool 74: cpus=37 node=0 flags=0x1 nice=0 hung=32s workers=2 manager: 2146 kernel: pwq 498: cpus=249 node=1 flags=0x1 nice=0 active=4/256 refcnt=5 kernel: in-flight: 1917:fill_page_cache_func kernel: pending: dbs_work_handler, free_work, kfree_rcu_monitor Originally, we thought that the root cause of this lockup was several retries with direct reclaim, but this is not yet confirmed. Furthermore, we have seen similar lockups without any heavy memory pressure. This suggests that there are other factors contributing to these lockups. However, it is not really clear that endless retries are desireable. So let's make the fill_page_cache_func() function back off after allocation failure. Cc: Uladzislau Rezki (Sony) Cc: "Paul E. McKenney" Cc: Frederic Weisbecker Cc: Neeraj Upadhyay Cc: Josh Triplett Cc: Steven Rostedt Cc: Mathieu Desnoyers Cc: Lai Jiangshan Cc: Joel Fernandes Signed-off-by: Michal Hocko Reviewed-by: Uladzislau Rezki (Sony) Signed-off-by: Paul E. McKenney Signed-off-by: Sasha Levin --- kernel/rcu/tree.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c index c25ba442044a..54a3a19c4c0b 100644 --- a/kernel/rcu/tree.c +++ b/kernel/rcu/tree.c @@ -3508,15 +3508,16 @@ static void fill_page_cache_func(struct work_struct *work) bnode = (struct kvfree_rcu_bulk_data *) __get_free_page(GFP_KERNEL | __GFP_NORETRY | __GFP_NOMEMALLOC | __GFP_NOWARN); - if (bnode) { - raw_spin_lock_irqsave(&krcp->lock, flags); - pushed = put_cached_bnode(krcp, bnode); - raw_spin_unlock_irqrestore(&krcp->lock, flags); + if (!bnode) + break; - if (!pushed) { - free_page((unsigned long) bnode); - break; - } + raw_spin_lock_irqsave(&krcp->lock, flags); + pushed = put_cached_bnode(krcp, bnode); + raw_spin_unlock_irqrestore(&krcp->lock, flags); + + if (!pushed) { + free_page((unsigned long) bnode); + break; } } From patchwork Sat Oct 22 07:27: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: 7576 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1106250wrr; Sat, 22 Oct 2022 01:37:21 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4Apj4e/QkNexZpRmyHLzeLc5950v769IPXFlPFAaZ5f4lxNZUKXvMVbCa4cB0Yhpj+F99O X-Received: by 2002:a05:6402:496:b0:443:a5f5:d3b with SMTP id k22-20020a056402049600b00443a5f50d3bmr21902808edv.331.1666427841293; Sat, 22 Oct 2022 01:37:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666427841; cv=none; d=google.com; s=arc-20160816; b=J7jJcE+ljneuS7UNo1cLAV8Haob+eE0TQgqOl34XGhitl1tm+26WoMDX0trTRgRbhW FDSVcQkiI2+Q5p2RE8F/Z+vgtnSHji/6cBqmauSy/nUKHxxuOlHK9lR6YzyLqSz0+W7A G+HSLAi9C6uqHKoL1mUWgHP84GpyyPqZPPA5l6zbLt4i2nD8kIOL1lHNVm0pccPKfxIh clVTt5POskzXmitec+J+CAyVaXXlLwAyoHgeB6bKVgWWFDeY2cmSs3cEBPATE+bQUNPK 1aMMHErwHXNap07FOb26XdOUNVCqMLQXHo5WxFNaobpyd0rAcs1QSeB9oNuYa2L/EYNe Xb9A== 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=56JKciz4SiEApXUJTwD43HaUclDvuqghf+HfwdyEQPc=; b=g11IT5PHNoUI8iecjw0f94h55YHRtd9raeH1pLPSCRb+qlYwsCDPzjUchqvLICcBIa hGqQxFjU0uNDck30fKf8cwIbkfEi3E3Jmvy2aPvSKDWhsRTggD1+PlNJOBEvtuln+wM+ cYCEaO4zcY/UkgP+G0PvRDqfyzMw4F7kbrGCAQwoveyHpROHiLLhL/WyBaVhNldb+h5E D/GtNbNOVexfE25WRm0fzclG9RUhHfpP2qURoll4GjEoQnUcWsI+vOTrxwA8PvE7dQbA DZD574ktlUpl0AVwReClWdmCtConRwaoRho+m9LpUwfA8vC4alRJ8MQ7I+Lb9SQDv8nY YTtg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=v8mH59dz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 sa26-20020a1709076d1a00b0078c8dadd4bbsi21694768ejc.742.2022.10.22.01.36.52; Sat, 22 Oct 2022 01:37: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=v8mH59dz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S233657AbiJVIbU (ORCPT + 99 others); Sat, 22 Oct 2022 04:31:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51544 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233877AbiJVI2j (ORCPT ); Sat, 22 Oct 2022 04: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 056BE2E1B94; Sat, 22 Oct 2022 01: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 dfw.source.kernel.org (Postfix) with ESMTPS id 2EFD360ADC; Sat, 22 Oct 2022 07:59:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 08541C433D6; Sat, 22 Oct 2022 07:59:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425567; bh=GYMheR2uDf5Pu2mG9xm6Hst+j27aQrPCPR8epawv2K8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=v8mH59dz/vwuh9670EI9hy5RsbWgYInYBkOtKkfvhnduSG+lRSUXwR2D11tat9mqA DCEXxAHQBfXf7Vk5Hm7n79uxbddBMLYoRBGX1ku+gZLyTtN87sNoPZP5tyEKuvlw79 CMn7p7FGy08M5jKIsySe9A+rDxOmgnQi4RAjLlAk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Huang Rui , Viresh Kumar , Perry Yuan , Su Jinzhou , "Rafael J. Wysocki" , Sasha Levin Subject: [PATCH 5.19 543/717] cpufreq: amd_pstate: fix wrong lowest perf fetch Date: Sat, 22 Oct 2022 09:27:02 +0200 Message-Id: <20221022072522.360550037@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376240241488515?= X-GMAIL-MSGID: =?utf-8?q?1747376240241488515?= From: Perry Yuan [ Upstream commit b185c5053c65b7704ead4537e4d4d9b33dc398dc ] Fix the wrong lowest perf value reading which is used for new des_perf calculation by governor requested, the incorrect min_perf will get incorrect des_perf to be set , that will cause the system frequency changing unexpectedly. Reviewed-by: Huang Rui Acked-by: Viresh Kumar Signed-off-by: Perry Yuan Signed-off-by: Su Jinzhou Signed-off-by: Rafael J. Wysocki Signed-off-by: Sasha Levin --- drivers/cpufreq/amd-pstate.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/cpufreq/amd-pstate.c b/drivers/cpufreq/amd-pstate.c index 365f3ad166a7..d63a28c5f95a 100644 --- a/drivers/cpufreq/amd-pstate.c +++ b/drivers/cpufreq/amd-pstate.c @@ -322,7 +322,7 @@ static int amd_pstate_target(struct cpufreq_policy *policy, return -ENODEV; cap_perf = READ_ONCE(cpudata->highest_perf); - min_perf = READ_ONCE(cpudata->lowest_nonlinear_perf); + min_perf = READ_ONCE(cpudata->lowest_perf); max_perf = cap_perf; freqs.old = policy->cur; From patchwork Sat Oct 22 07:27: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: 7712 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1109537wrr; Sat, 22 Oct 2022 01:48:56 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4fIwyYcnnDR0WDYyb81/5+oQcff+2NnZ3NxB0qPQBKVuK4zM5xMhoYPVXNJoHzPKU7qovf X-Received: by 2002:aa7:db01:0:b0:461:4dc9:74e with SMTP id t1-20020aa7db01000000b004614dc9074emr6338934eds.139.1666428536322; Sat, 22 Oct 2022 01:48:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666428536; cv=none; d=google.com; s=arc-20160816; b=UaAnvsH32JUxZF01RuUhHkC4TIewznBkMpdr5q0XhhihDY1eZXPHc/aZcHbqocZjPT ZUsoEOC7BnfcTkffGy3BNolfH5e9g97VU24s7Y868wLXs3RIC5+ePLLA+gy32ty1xkqe S9CO5GMFWiNRq/Q4boprnudY845VKCPjgF1DecFPi7ZocExm5CfxwIEJr7xc+utWhIcb UFs4E8d48dV4XtDFBWojkrPJfNR4ti8q1qNHYZm7CzwEqKAcjLkKVpufBnBtsJ6VDk0r jrMX7Cu3Z9PWU1xMe1PWoXYb0ix38HVgtjXWawsz6u+mWRUyrBbJ36JsfRHOfTSiElJt p7Fw== 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=MsukG8FIPKGe0ul7cGtKATHXA//Me834/DV/snvCYjs=; b=Z4o/OJ0DJhNK0NEUSkclQndHKwLD7OlARRQX/nbZ6BAgQ5eusW1trwxqBs3+OnBNb/ /HywZ5STkfC503M9QThs54P6RLfb3ipJNKPH0FL2j/Y/n2tBm17DfBlyxlLsIxqiMcAg n1c3jGrnIlXTmxYRGai7sAaKjkIP0ULtTS1Bz7mEO+TSlNQRhaXMzvxq2MDHsmG9tSxQ pIYpgKVcWQbZzyIYDYSn6wseZ7J5kJldNflL8bWypueLzFSjiqMIUiWJ4rxXTIEWJnYk 1iuYXfshOZMuFBjORHw8KNyevZVf02pygIHX0k3X5nly0WAJQepNXfnWox4v6dxsrkFF lNUA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=br9hr+Fc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 ji3-20020a170907980300b0078e254ae419si26292531ejc.643.2022.10.22.01.48.32; Sat, 22 Oct 2022 01:48: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=br9hr+Fc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S234322AbiJVIsD (ORCPT + 99 others); Sat, 22 Oct 2022 04:48:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52858 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235229AbiJVIo7 (ORCPT ); Sat, 22 Oct 2022 04:44:59 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C748A2EC21D; Sat, 22 Oct 2022 01:08: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 3987960AD7; Sat, 22 Oct 2022 07:59:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 330D6C433C1; Sat, 22 Oct 2022 07:59:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425570; bh=nLLcqQo2hHrNZnG6RE5P/dIUeAGxE2Muhy9l2Em4mAk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=br9hr+FcL0Gu4MQnbakwJL/UjrTjdao6AX9YzpfN8hVWBFWTUsa7Ow458dGt2Krth /VaUVDxRcWAHM9284fKV3hkFEJJglXvSsB1/T7Ff1aivSOg/0L5uGmEYaIfB+R7ON7 n9JUlRajbNwYIKDKtNO0ZIQ3UNc9tYA0eZ5h4nIQ= 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 5.19 544/717] ACPI: video: Add Toshiba Satellite/Portege Z830 quirk Date: Sat, 22 Oct 2022 09:27:03 +0200 Message-Id: <20221022072522.409051425@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376968779878611?= X-GMAIL-MSGID: =?utf-8?q?1747376968779878611?= 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 eaea733b368a..03f5f92b603c 100644 --- a/drivers/acpi/acpi_video.c +++ b/drivers/acpi/acpi_video.c @@ -496,6 +496,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 Sat Oct 22 07:27: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: 7710 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1109498wrr; Sat, 22 Oct 2022 01:48:49 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6vGbxA53rYR1Ax7G9YhU98QMZYjauFWuiwCNkZmZgjnu6ZeeJfNEh5xvtA2mTzjFhQ1qCq X-Received: by 2002:a17:906:7314:b0:791:a45a:bc84 with SMTP id di20-20020a170906731400b00791a45abc84mr17432856ejc.394.1666428529360; Sat, 22 Oct 2022 01:48:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666428529; cv=none; d=google.com; s=arc-20160816; b=sq3aWsuBNkh1S/qthT3PaJ2LpkTQNCn7tpYXBzTyfB4obGHLLk490BzburvK4U6BOd MaaszBLeopEZUCb5P+DL4xRII8m/y1kmOr6dx7z32zw3GzZ0qk3xL3yaivAN+FoO+xIq QGCy6TsTHvNORslr8yZ5GJz36cFwTzVIQCIO2iefShBdZO+M9xkd9vcmBM5LGtZPDkIX EDzY3iozXScbR1FPx+mjFqn3zYHcazWK7DzgRPPw4xcVNlBWrBaIdV8osYnDf10FidRQ MhT5cX2edBV1e4KFHNDH3savReHIPoq5UHZn0taV/gQEdeaUI9H6fyEQXA2f356niIqq byVw== 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=LG7kQDXSgEdPfkLBqJx8Jeea0WzstOnh63KhBlYLm9Q=; b=OprzKH6Fe5+oWQIZdATd5aNjL1oreqUE7D1Sso8JvPfNQETzzQkVsOfJQtxr91+GZS da1dicwLw3sQU2WceNb/66ehuetaZeGzrwI7fhXLW9r3FFWhTWBfItfXQYqSVH1Ilq9i q0DCrawNBboFrgrqg69BHibI4BvX9HP/X0Y1uGYNLDEOhUqzx/Q9un/qDoGl09Ho8qZW yGgKR8dPcQ0j0K6cJQNNJk9Y8pw9IDK1IyyrJyYa6pX5h0kY9B0YQF51Decytf/Bov8h iFqGcPjYFATn/N7Nvq4PKnyKjY3FRLS1PTwCXJ5uDJ9pbE4dC5bKo0LEPMCz1G7alIZV /B0w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=mDrZeKLD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 s16-20020a50d490000000b0045cd50b7c65si19329849edi.266.2022.10.22.01.48.25; Sat, 22 Oct 2022 01: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=mDrZeKLD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S234554AbiJVIra (ORCPT + 99 others); Sat, 22 Oct 2022 04:47:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40816 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235174AbiJVIot (ORCPT ); Sat, 22 Oct 2022 04:44:49 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A8D492CB8C5; Sat, 22 Oct 2022 01:08: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 50A7460B1B; Sat, 22 Oct 2022 07:59:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 25724C433C1; Sat, 22 Oct 2022 07:59:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425573; bh=hzbiDCjgP4PWpxtEpRK2mCWbxYUpFdc6paCISbBKNxg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mDrZeKLDuXuU9SGEfDqfISMNuvMjWQ5T2r+ThsxvajZw67xFR2nI+jpYlHd7xSaEJ 0soQ2Eu4YGWUg75v0nF594EGklSJc9hMimMofwyRhVIRgie5cab2IGjlHyjZPRozqi aSbdX1B4YJMfnlX1DX5DTMqNe+Hcoyl3XwoAb484= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Nathan Chancellor , Tom Rix , Andrew Morton , Vlastimil Babka , "Steven Rostedt (Google)" , David Gow , Yury Norov , Masami Hiramatsu , Sander Vanheule , linux-hardening@vger.kernel.org, llvm@lists.linux.dev, Nick Desaulniers , Kees Cook , Sasha Levin Subject: [PATCH 5.19 545/717] fortify: Fix __compiletime_strlen() under UBSAN_BOUNDS_LOCAL Date: Sat, 22 Oct 2022 09:27:04 +0200 Message-Id: <20221022072522.458343012@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376961757523381?= X-GMAIL-MSGID: =?utf-8?q?1747376961757523381?= From: Kees Cook [ Upstream commit d07c0acb4f41cc42a0d97530946965b3e4fa68c1 ] With CONFIG_FORTIFY=y and CONFIG_UBSAN_LOCAL_BOUNDS=y enabled, we observe a runtime panic while running Android's Compatibility Test Suite's (CTS) android.hardware.input.cts.tests. This is stemming from a strlen() call in hidinput_allocate(). __compiletime_strlen() is implemented in terms of __builtin_object_size(), then does an array access to check for NUL-termination. A quirk of __builtin_object_size() is that for strings whose values are runtime dependent, __builtin_object_size(str, 1 or 0) returns the maximum size of possible values when those sizes are determinable at compile time. Example: static const char *v = "FOO BAR"; static const char *y = "FOO BA"; unsigned long x (int z) { // Returns 8, which is: // max(__builtin_object_size(v, 1), __builtin_object_size(y, 1)) return __builtin_object_size(z ? v : y, 1); } So when FORTIFY_SOURCE is enabled, the current implementation of __compiletime_strlen() will try to access beyond the end of y at runtime using the size of v. Mixed with UBSAN_LOCAL_BOUNDS we get a fault. hidinput_allocate() has a local C string whose value is control flow dependent on a switch statement, so __builtin_object_size(str, 1) evaluates to the maximum string length, making all other cases fault on the last character check. hidinput_allocate() could be cleaned up to avoid runtime calls to strlen() since the local variable can only have literal values, so there's no benefit to trying to fortify the strlen call site there. Perform a __builtin_constant_p() check against index 0 earlier in the macro to filter out the control-flow-dependant case. Add a KUnit test for checking the expected behavioral characteristics of FORTIFY_SOURCE internals. Cc: Nathan Chancellor Cc: Tom Rix Cc: Andrew Morton Cc: Vlastimil Babka Cc: "Steven Rostedt (Google)" Cc: David Gow Cc: Yury Norov Cc: Masami Hiramatsu Cc: Sander Vanheule Cc: linux-hardening@vger.kernel.org Cc: llvm@lists.linux.dev Reviewed-by: Nick Desaulniers Tested-by: Android Treehugger Robot Link: https://android-review.googlesource.com/c/kernel/common/+/2206839 Co-developed-by: Nick Desaulniers Signed-off-by: Nick Desaulniers Signed-off-by: Kees Cook Signed-off-by: Sasha Levin --- include/linux/fortify-string.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/include/linux/fortify-string.h b/include/linux/fortify-string.h index 3b401fa0f374..fce2fb2fc962 100644 --- a/include/linux/fortify-string.h +++ b/include/linux/fortify-string.h @@ -19,7 +19,8 @@ void __write_overflow_field(size_t avail, size_t wanted) __compiletime_warning(" unsigned char *__p = (unsigned char *)(p); \ size_t __ret = (size_t)-1; \ size_t __p_size = __builtin_object_size(p, 1); \ - if (__p_size != (size_t)-1) { \ + if (__p_size != (size_t)-1 && \ + __builtin_constant_p(*__p)) { \ size_t __p_len = __p_size - 1; \ if (__builtin_constant_p(__p[__p_len]) && \ __p[__p_len] == '\0') \ From patchwork Sat Oct 22 07:27: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: 7814 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1140806wrr; Sat, 22 Oct 2022 03:26:49 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5A8t5CEZV5BMaWAN1T9EcM9WGJCWn0MIbhCQQQX6B0NM/C4y/Pvn8F7cvFnxH7u7cGbL8A X-Received: by 2002:a05:6402:540d:b0:450:bda7:f76e with SMTP id ev13-20020a056402540d00b00450bda7f76emr21836004edb.249.1666434409472; Sat, 22 Oct 2022 03:26:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666434409; cv=none; d=google.com; s=arc-20160816; b=q4c1zR88n5PTgv2LE8zGW8sJDxwC+c+QhODDdCVZ8Qdo3vmlx6W8+t5l9x4cPwOJXz PP1HJTarA51uvRklFsJhOe8FKGV/i9au5sLIJm3o+THrEsE8a7sdNkKBBi5JQn+IkgH3 ykbZKhOn+4tdbMJfoMNQ/Evse4dv6hb8X2GfS6e/Zoc5F96OrUDwrfgp16AWG4IHNDyj 18tb0cWYOEy5SYgq1Kjg6PCBWMEd+mdkRO1ZjHR3vjl2q7GzxvtkdHiNPWJ6hSVhL2iD uDpId/YF2s5P4kDl2zG0PmWZNjENmVnTAUajSTvysRWF0kpYa32VxBrmvzH6xz04brHk ofeg== 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=5UU1faRhyva+hrnjpUGx4UiOlTv45d8qgEQyvdFa5ls=; b=f9RZN25gdsvQyvTwLWZd4JxQhk8x3q04POnYado+IiAfW+25ePR98yX52dWBUpKjMU OOY0KroSFdXVy379IOldSfERVhu07kdLRyCOEvrExnxRak7FNuo0gkeECdvpXhyuqI1F 35Vo59RoIuOvILxxZgnDgWVVmRwv9a4WNmSN3conkzYMyKNzyDhY81+ODj5Fp8R18q6O aNgAhuqXf4gZ29DQOSfxIqmckkDAHtTf45/vNG1qsY/u8+kWVSvW3K/JUhh6AitzM3iP rStAiUSgSRb/Z/TDO2P6czQRjDo4Y7ZnpSBwjrbF9+czcCIaQbtIFszkpdIcC41CG9w9 PHHg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=HXh8Y6Y8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 dr8-20020a170907720800b0077945c44b7fsi24079924ejc.856.2022.10.22.03.26.24; Sat, 22 Oct 2022 03:26: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=HXh8Y6Y8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S229761AbiJVKXA (ORCPT + 99 others); Sat, 22 Oct 2022 06:23:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55416 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230261AbiJVKWX (ORCPT ); Sat, 22 Oct 2022 06:22: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 3874E31E5E4; Sat, 22 Oct 2022 02:38: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 8522760B1F; Sat, 22 Oct 2022 07:59:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 570BEC433D7; Sat, 22 Oct 2022 07:59:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425576; bh=VV1OpKp2yHPswDsQUvrr44yQuL620U4g+koU7ZS60sw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HXh8Y6Y8dICxfafGkPVLQGgYVlNxwyFLD4OXofXkOCFlOila4CgIBpoJaw2mVrkXL M1p4Kx2ww6mweNqqJEaOLQ8DWN9qiRWUYkMQ5+1yVU3ri76e5olww4kIPRzJiNu+l7 N1/sarmscI/TwPAGZPqlWzhJE3yUNmUqtvvWEevo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hans de Goede , "Rafael J. Wysocki" , Sasha Levin Subject: [PATCH 5.19 546/717] ACPI: tables: FPDT: Dont call acpi_os_map_memory() on invalid phys address Date: Sat, 22 Oct 2022 09:27:05 +0200 Message-Id: <20221022072522.509968479@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 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?1747383127154299502?= X-GMAIL-MSGID: =?utf-8?q?1747383127154299502?= From: Hans de Goede [ Upstream commit 211391bf04b3c74e250c566eeff9cf808156c693 ] On a Packard Bell Dot SC (Intel Atom N2600 model) there is a FPDT table which contains invalid physical addresses, with high bits set which fall outside the range of the CPU-s supported physical address range. Calling acpi_os_map_memory() on such an invalid phys address leads to the below WARN_ON in ioremap triggering resulting in an oops/stacktrace. Add code to verify the physical address before calling acpi_os_map_memory() to fix / avoid the oops. [ 1.226900] ioremap: invalid physical address 3001000000000000 [ 1.226949] ------------[ cut here ]------------ [ 1.226962] WARNING: CPU: 1 PID: 1 at arch/x86/mm/ioremap.c:200 __ioremap_caller.cold+0x43/0x5f [ 1.226996] Modules linked in: [ 1.227016] CPU: 1 PID: 1 Comm: swapper/0 Not tainted 6.0.0-rc3+ #490 [ 1.227029] Hardware name: Packard Bell dot s/SJE01_CT, BIOS V1.10 07/23/2013 [ 1.227038] RIP: 0010:__ioremap_caller.cold+0x43/0x5f [ 1.227054] Code: 96 00 00 e9 f8 af 24 ff 89 c6 48 c7 c7 d8 0c 84 99 e8 6a 96 00 00 e9 76 af 24 ff 48 89 fe 48 c7 c7 a8 0c 84 99 e8 56 96 00 00 <0f> 0b e9 60 af 24 ff 48 8b 34 24 48 c7 c7 40 0d 84 99 e8 3f 96 00 [ 1.227067] RSP: 0000:ffffb18c40033d60 EFLAGS: 00010286 [ 1.227084] RAX: 0000000000000032 RBX: 3001000000000000 RCX: 0000000000000000 [ 1.227095] RDX: 0000000000000001 RSI: 00000000ffffdfff RDI: 00000000ffffffff [ 1.227105] RBP: 3001000000000000 R08: 0000000000000000 R09: ffffb18c40033c18 [ 1.227115] R10: 0000000000000003 R11: ffffffff99d62fe8 R12: 0000000000000008 [ 1.227124] R13: 0003001000000000 R14: 0000000000001000 R15: 3001000000000000 [ 1.227135] FS: 0000000000000000(0000) GS:ffff913a3c080000(0000) knlGS:0000000000000000 [ 1.227146] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 1.227156] CR2: 0000000000000000 CR3: 0000000018c26000 CR4: 00000000000006e0 [ 1.227167] Call Trace: [ 1.227176] [ 1.227185] ? acpi_os_map_iomem+0x1c9/0x1e0 [ 1.227215] ? kmem_cache_alloc_trace+0x187/0x370 [ 1.227254] acpi_os_map_iomem+0x1c9/0x1e0 [ 1.227288] acpi_init_fpdt+0xa8/0x253 [ 1.227308] ? acpi_debugfs_init+0x1f/0x1f [ 1.227339] do_one_initcall+0x5a/0x300 [ 1.227406] ? rcu_read_lock_sched_held+0x3f/0x80 [ 1.227442] kernel_init_freeable+0x28b/0x2cc [ 1.227512] ? rest_init+0x170/0x170 [ 1.227538] kernel_init+0x16/0x140 [ 1.227552] ret_from_fork+0x1f/0x30 [ 1.227639] [ 1.227647] irq event stamp: 186819 [ 1.227656] hardirqs last enabled at (186825): [] __up_console_sem+0x5e/0x70 [ 1.227672] hardirqs last disabled at (186830): [] __up_console_sem+0x43/0x70 [ 1.227686] softirqs last enabled at (186576): [] __irq_exit_rcu+0xed/0x160 [ 1.227701] softirqs last disabled at (186569): [] __irq_exit_rcu+0xed/0x160 [ 1.227715] ---[ end trace 0000000000000000 ]--- Signed-off-by: Hans de Goede Signed-off-by: Rafael J. Wysocki Signed-off-by: Sasha Levin --- drivers/acpi/acpi_fpdt.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/drivers/acpi/acpi_fpdt.c b/drivers/acpi/acpi_fpdt.c index 6922a44b3ce7..a2056c4c8cb7 100644 --- a/drivers/acpi/acpi_fpdt.c +++ b/drivers/acpi/acpi_fpdt.c @@ -143,6 +143,23 @@ static const struct attribute_group boot_attr_group = { static struct kobject *fpdt_kobj; +#if defined CONFIG_X86 && defined CONFIG_PHYS_ADDR_T_64BIT +#include +static bool fpdt_address_valid(u64 address) +{ + /* + * On some systems the table contains invalid addresses + * with unsuppored high address bits set, check for this. + */ + return !(address >> boot_cpu_data.x86_phys_bits); +} +#else +static bool fpdt_address_valid(u64 address) +{ + return true; +} +#endif + static int fpdt_process_subtable(u64 address, u32 subtable_type) { struct fpdt_subtable_header *subtable_header; @@ -151,6 +168,11 @@ static int fpdt_process_subtable(u64 address, u32 subtable_type) u32 length, offset; int result; + if (!fpdt_address_valid(address)) { + pr_info(FW_BUG "invalid physical address: 0x%llx!\n", address); + return -EINVAL; + } + subtable_header = acpi_os_map_memory(address, sizeof(*subtable_header)); if (!subtable_header) return -ENOMEM; From patchwork Sat Oct 22 07:27: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: 7534 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1105853wrr; Sat, 22 Oct 2022 01:36:21 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5ml/XomCNXKtpXRq7q5aECepUfqFMC/INLlpikE87hZKzx3ej7H1rWdpOIQof8OqqNSRzq X-Received: by 2002:a05:6a00:1414:b0:563:ae66:3103 with SMTP id l20-20020a056a00141400b00563ae663103mr22953266pfu.17.1666427781085; Sat, 22 Oct 2022 01:36:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666427781; cv=none; d=google.com; s=arc-20160816; b=QKQFa6KISUYrjZDBm/cpX3nTHSW2OePeUDlzGG3leRlbcqsjxvRBEJxENH9R+mttLS whGTohnE5oD/dCuZkToMdjmMwWZheamkpeJPaECTKpCezW1mNqE4vMRd7mhckCJn3bdq c6M+i2ZEbGB9X/HXnN/tT3SnD8LE3ptNVSt1wdIXTBFLwdaAZsrNu1H0NRTBGZcoTt0H +u3ii7COy68LSFVOYEsY7Us7+29+WFcBbrxnjFJfFlQkP8Im166iEBS/DfLPIAOLZlWQ yb78lLTBB1t8MvqMhf51GAlHq1qu+yvmKRf8wFuJ/I/oe27GRdTkomDo4ZdQH78cLmHU 3m6w== 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=CZSjt032K0LHwvApGfEfA8wqmT/MRIyCh5n5MoAqxJk=; b=iwMeZfjtlXlsgxTMaNMAmo1I06n9RAMUSaBLjGTmZ6p60ub6iZhjkX0XKopJf9HIB+ ygBPzwCGNKkEo48wbbzily/xLGQ3YqS+1XSEE2NRlUeH6tl1E0UT1zBXEKvHOP7Ghu2q qIql4/Wq2eceom+KfCux9xszPHwquZi5oz1k3uivXf8/YYKsT0NkDUr41LmInM9Sh9Og ikajyoIWBunguoo0oaNRh/zCburbzDhEK3uzcLjIAEbgLNPtaSu6rZF8PsZcN/4ghWuZ 8TJ+Mh4o8BBWJLyC14KB59h3osYQoGcezlC1qQ4P7pMqYXRNmSDRrLTGFW43miKTzSl+ xFfg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=YL8yW9V0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 b1-20020a170903228100b00176a0d8780csi33503157plh.285.2022.10.22.01.36.07; Sat, 22 Oct 2022 01:36: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=YL8yW9V0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S233703AbiJVIZq (ORCPT + 99 others); Sat, 22 Oct 2022 04:25:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36026 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233961AbiJVIYZ (ORCPT ); Sat, 22 Oct 2022 04:24: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 BC6622A716; Sat, 22 Oct 2022 00:59: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 350E3B82DF9; Sat, 22 Oct 2022 07:59:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6706EC433D6; Sat, 22 Oct 2022 07:59:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425579; bh=PU8iaCs2iWQxeCCZgNEo4F7oo3UpqlSd8bf4uBmxP6E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YL8yW9V0pxt7CrgyIzIBLOWz++R6AfBAnQsl3atYSkHU2LTgMP0Cn2TPSaylfY4jf DrDMZXLeAeB6a+2oRM4l1B8wLj3IQMeT3pWEwe7x58NpkmkOT+Gdy0J/MXg00Y3sx2 UgUAtbajCxysYFLwk81suaY8wtlF3n91ci8JgZCs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Doug Smythies , "Rafael J. Wysocki" , Sasha Levin Subject: [PATCH 5.19 547/717] cpufreq: intel_pstate: Add Tigerlake support in no-HWP mode Date: Sat, 22 Oct 2022 09:27:06 +0200 Message-Id: <20221022072522.559406934@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376176552858613?= X-GMAIL-MSGID: =?utf-8?q?1747376176552858613?= From: Doug Smythies [ Upstream commit 71bb5c82aaaea007167f3ba68d3a669c74d7d55d ] Users may disable HWP in firmware, in which case intel_pstate wouldn't load unless the CPU model is explicitly supported. Add TIGERLAKE to the list of CPUs that can register intel_pstate while not advertising the HWP capability. Without this change, an TIGERLAKE in no-HWP mode could only use the acpi_cpufreq frequency scaling driver. See also commits: d8de7a44e11f: cpufreq: intel_pstate: Add Skylake servers support fbdc21e9b038: cpufreq: intel_pstate: Add Icelake servers support in no-HWP mode 706c5328851d: cpufreq: intel_pstate: Add Cometlake support in no-HWP mode Reported by: M. Cargi Ari Signed-off-by: Doug Smythies Signed-off-by: Rafael J. Wysocki Signed-off-by: Sasha Levin --- drivers/cpufreq/intel_pstate.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c index 57cdb3679885..fc3ebeb0bbe5 100644 --- a/drivers/cpufreq/intel_pstate.c +++ b/drivers/cpufreq/intel_pstate.c @@ -2416,6 +2416,7 @@ static const struct x86_cpu_id intel_pstate_cpu_ids[] = { X86_MATCH(SKYLAKE_X, core_funcs), X86_MATCH(COMETLAKE, core_funcs), X86_MATCH(ICELAKE_X, core_funcs), + X86_MATCH(TIGERLAKE, core_funcs), {} }; MODULE_DEVICE_TABLE(x86cpu, intel_pstate_cpu_ids); From patchwork Sat Oct 22 07:27: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: 7595 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1106380wrr; Sat, 22 Oct 2022 01:37:42 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4MbnwLruThpgslo7LWOIwv9fOhS8aMNksC/s7MhHkEudQXXwHfLyq9mPPb57XYAFu1be4h X-Received: by 2002:a17:907:724d:b0:78d:acf4:4c57 with SMTP id ds13-20020a170907724d00b0078dacf44c57mr19181175ejc.516.1666427862511; Sat, 22 Oct 2022 01:37:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666427862; cv=none; d=google.com; s=arc-20160816; b=x7s2AJWFyiwkQ9NmU4Xf43fJFAt+8cdHAiUFmUxgK5aZ8xLg6FMGvAo9FaasyikH2o D5zaQigDxmD5HmWP73YItckwQ9eZcWuxGmbEpqRlcObQyrSsTs8Bz5ajI6wCIdvD2m1P yj0J7DNWn4V50XLhQa6w2jpIpLBhN+gSBdUxzGwtS737YX29NuX1msHl0HvO0HbI5shb Ly+U2qk6jTsRRzRWgLxCJ5LJ4XhgXS4OJayZkekXfBpED19AqdjSxlXAezgqHe2Ths2l c04XfCaAt/6kfLS8DIgsZAdD1R/duUhh/fF12lOLueoZbUy8dGQ5sTHsu/fW6Nig7DVX vKhw== 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=f80RdvYLhvTAVR3P3Bw9zKIbAfB5GF0D/Soc9uxZKkk=; b=0FAsX4N50/4pa8fkIhCwX+vhLzqscmu5PnXUbRKG+yzQL1D40Ddkdnh827frsubnbP s6lBTWIbsdA/bn6FSiosGjFQWkVINNTIh7pLOP4duyp3aFftslrEMr1AzEgrT50JVoLH EHqfQbsUdhdbaHq6dniW6hSuk8P5qEsLFTHlGZ2uD74UBm0/GxnqeTsFb8z3sDoR5F3r WMgH95PVNZOCjc5Ne0E19Nj5nQeoERzp0+Npk0Z1UgNV6i5Ut1O0J4wb5ugvf71mq63P 2bvRzAUwAAow41BVv8T6ClwxSo8WrRT4BZiMqIWRxahYJVku4bDYT1LR8ercm+IUxuGe Yeug== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=dGu4EJwt; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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-20020a1709078b0f00b007918f58458bsi11989716ejc.441.2022.10.22.01.37.15; Sat, 22 Oct 2022 01:37: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=dGu4EJwt; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S234007AbiJVIcS (ORCPT + 99 others); Sat, 22 Oct 2022 04:32:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39186 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234026AbiJVI3O (ORCPT ); Sat, 22 Oct 2022 04:29: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 044602E22A9; Sat, 22 Oct 2022 01:01: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 EA22160ADD; Sat, 22 Oct 2022 07:59:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C576EC433C1; Sat, 22 Oct 2022 07:59:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425583; bh=sm/LDBBuPWty4rPPEEqovbTw/jWuPeNCGNYMtE2bPkU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dGu4EJwt1fryvkeOa/wlOSwWhFLqJeu53nKg5tG9lvCj6w1EWH9rdtojEct1oN/qC atPDJ75O7wkR9mSVpM/Hicjzx5uzAv38i3QYToBmM2UOJXYDcfSokc6nWLob0BgVQm mHejx1tXFd65cnItFHP9H69C97kRMEv21oevnPLA= 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 5.19 548/717] MIPS: BCM47XX: Cast memcmp() of function to (void *) Date: Sat, 22 Oct 2022 09:27:07 +0200 Message-Id: <20221022072522.604305739@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376262103002724?= X-GMAIL-MSGID: =?utf-8?q?1747376262103002724?= 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 0a63721d0fbf..5a33d6b48d77 100644 --- a/arch/mips/bcm47xx/prom.c +++ b/arch/mips/bcm47xx/prom.c @@ -86,7 +86,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; @@ -159,7 +159,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 Sat Oct 22 07:27: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: 7574 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1106205wrr; Sat, 22 Oct 2022 01:37:16 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7qWGhdItwexNS55Lj8CKJIzVMGzWMhd7ISz/WVZBKEzhAvivxNCUIwApG8QyV8wlOqmtZ7 X-Received: by 2002:a17:907:25c5:b0:783:f5df:900e with SMTP id ae5-20020a17090725c500b00783f5df900emr18530460ejc.491.1666427836220; Sat, 22 Oct 2022 01:37:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666427836; cv=none; d=google.com; s=arc-20160816; b=0kN4cXSiggV+IL68tzxAsdwwLnLueKx36V1dfhsE0m6CsFCUrhl+RXu79R/K2DjuaB ozoLATuu8ZYMgj4/0rmS3AY+tcVtS0kduorsJRQT/AORDwKEPDPeoI86VMW7Pn1RLZJv bYhyWZ5Hs4V0+9O/zJ1pLoX/toxqouOWTacUcUX5Utc+JEgrtBexF1JfyMIK+Y3YfKtJ UyyO2KwICuWwVs0JL7uKHF3FG78vc0e7DyPOZeeAdrUzmZJ8C7FSHeUpdwJE7Zvyscmu NPnxu/0wkfyv6zRhLJGCeEeWXiKI2GTnSOFkWzBJ51cQWNyQ1d14Llo7ydvuMX2jSnOW z2ow== 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=GkpIIKB4FSAuvww5RJn8c2l+yUbHTebrSJd4X3cfkbU=; b=Yj2gY4JZDF4aU2HD26+MMMuvW0NT1Fyk2haL/cCluP50zP9Ghv+lI0IkQGcSbPN4qf HGFBPUIGz0FlNKamaW/ren7JnnpUTJ1TrAWGvM7Gwll+svyYHrYqmvYKdoRiBT+ssVUE vwsSdybsc22zPOY9DGWtE5lP/MqIERLs2h53eWK13TJbmakrEtTvRn79EK2Q7v2QKa+o I+NzbbKhqZbORud2o8FqUvZXpCegywTi+k4jh9UF2DJcQfIBKsOT7+8qqy03X9wMvuCM e5jfGQnFRaUlpApAq2LlBzpFlILYpGEz/1fcrCgExEy5ShvK7ZjaTau5tIer+xlAvIpX VX6A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=MNsij98I; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 ec12-20020a0564020d4c00b00459779478absi18592928edb.186.2022.10.22.01.36.48; Sat, 22 Oct 2022 01:37: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=MNsij98I; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S233920AbiJVIbm (ORCPT + 99 others); Sat, 22 Oct 2022 04:31:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52006 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233939AbiJVI2u (ORCPT ); Sat, 22 Oct 2022 04:28:50 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CC3542F668; Sat, 22 Oct 2022 01:01: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 DF6AB60B93; Sat, 22 Oct 2022 07:59:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E6803C433C1; Sat, 22 Oct 2022 07:59:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425586; bh=DWDmBHGO0wHz+DOiz6L+Y2WUHV5bbg+xFAMdEVqancE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MNsij98I5/VA3CYPFfgVON20X6GJ+xkyQUKXS0WhjxscgchAqpnFueuTpGA1QLbrH m5nqsZ41ttbEVHHbw7PChONn2zWNhlCS/6m6PC72O7fWSeOEL/wO7K8JK2glPCOPhy jn0rrOTGRORmiYOErW2elePSIK1TXUvqjcwAQLCM= 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 5.19 549/717] powercap: intel_rapl: fix UBSAN shift-out-of-bounds issue Date: Sat, 22 Oct 2022 09:27:08 +0200 Message-Id: <20221022072522.652748958@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376234639743040?= X-GMAIL-MSGID: =?utf-8?q?1747376234639743040?= 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_common.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/powercap/intel_rapl_common.c b/drivers/powercap/intel_rapl_common.c index 684f177acb44..c053fac05cc2 100644 --- a/drivers/powercap/intel_rapl_common.c +++ b/drivers/powercap/intel_rapl_common.c @@ -994,6 +994,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 Sat Oct 22 07:27: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: 7861 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1161657wrr; Sat, 22 Oct 2022 04:30:59 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5RMGReVEf9TTJe+BVbjJ9uvSiUW2i0s/DWhcwad7WoQCSdk0i4q8UfzBNa9uTuzt3/tt/z X-Received: by 2002:a17:90b:3e82:b0:20d:2fa1:d08d with SMTP id rj2-20020a17090b3e8200b0020d2fa1d08dmr64547826pjb.162.1666438258803; Sat, 22 Oct 2022 04:30:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666438258; cv=none; d=google.com; s=arc-20160816; b=i57JskPe5ew2IQAP2tPGYuHvwdtmskpdGl3jtaqqqc9G4CGOInFWzg/SVeA/tUwac/ cliE1AdkgWmacokXnYCuHPXuSpTPoXOgKkcLqzo0JrknTa7Xtw3glA+QGpgxTs+JVjHZ wgQuAmCTRF1oN3tCoynwBBhM/ofkHu70vL/6CnJpS6rqxCspER+s9DBZl4dR/nAYbaBP shJf+5WH/wQlWKNvt70f/hjlMwuy0fGA4a6mY/RTww/WMkQ+oEgwtwJgOHw9EQXwQ3yu mBF2bv+wkomDPQX1AgpLxeyev/OAoKJnbHSIUllVRPvUCt7Ld0GpCJAl6e7Gr02cS0lQ 7z5A== 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=ma9FpLCpZxntQhjPvuA56EGCf9dh3cQ9rCzxLDKkr34=; b=F+sf9eh/0RQku8gQDl3Lh0OlzwiN1oZJzdQg/uRO9UYWDJkga0KxmqKZM4Q3eyEjEl G9hPaQYqaH3jcWu6IpumB5FP3xYQG8cYaiqtAN1bW1U2GD0LCwFx+Lq8b+RsuqCoGxpy fDis1HdJXoPNRpb68Bb5dTl53ARoXimsoZ6wgBejb0bKdu8vxQfvCRR1bc1gV/+5nZZv 54av2T0iCcrI+yQogS2tKsnAITJ4wpl1lYIjCT7vw2U/BT8PaM/xI03ey/btRzeU97Em vExxQevWg7pshZlhg8c0CGFbyDKo9EbrA/0pDGKZoDFbM9Bt+UK8but9Ey1huSbkGgmH vC4A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=c0ozydwQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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-20020a62a50a000000b005632e26e7ffsi25319155pfm.309.2022.10.22.04.30.45; Sat, 22 Oct 2022 04:30: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=c0ozydwQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231126AbiJVLTg (ORCPT + 99 others); Sat, 22 Oct 2022 07:19:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50386 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230263AbiJVLTD (ORCPT ); Sat, 22 Oct 2022 07:19:03 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3D0CD5D0F6; Sat, 22 Oct 2022 03:46: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 9CF29B82E0F; Sat, 22 Oct 2022 07:59:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E7A5CC433C1; Sat, 22 Oct 2022 07:59:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425589; bh=sO3qeFRmk2abLCeiuvM40rE2MlBvScvIuhhFNrA1ZVU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=c0ozydwQproAfgt6JOcL2WYX79wb6CiuZ58OZsD2a/nYQIfhOohBQ68+WjQOTSuPj pCHDp4nSpsdCEZzggGQmmgH2s+JH54wRt5fjlbN8LSRFBoL09vT6f5b9cBeRwaqIx6 l+y8wWoskVIPeFn3+ZQkc9r8bLf74xFZ94E3P6b4= 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 5.19 550/717] thermal: intel_powerclamp: Use get_cpu() instead of smp_processor_id() to avoid crash Date: Sat, 22 Oct 2022 09:27:09 +0200 Message-Id: <20221022072522.694733012@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 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?1747387163869925458?= X-GMAIL-MSGID: =?utf-8?q?1747387163869925458?= 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/intel_powerclamp.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/thermal/intel/intel_powerclamp.c b/drivers/thermal/intel/intel_powerclamp.c index c841ab37e7c6..46cd799af148 100644 --- a/drivers/thermal/intel/intel_powerclamp.c +++ b/drivers/thermal/intel/intel_powerclamp.c @@ -532,8 +532,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 Sat Oct 22 07:27: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: 7689 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1109102wrr; Sat, 22 Oct 2022 01:47:16 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4J4FJ42WhfiS1bUrlZ3Mdl5KU6072hQKq0AbBpv5AbTFl4irkO3WYFmkhANOfJv1yauJjU X-Received: by 2002:a17:907:9605:b0:6f5:c66:7c13 with SMTP id gb5-20020a170907960500b006f50c667c13mr19819863ejc.66.1666428436170; Sat, 22 Oct 2022 01:47:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666428436; cv=none; d=google.com; s=arc-20160816; b=O02UL9L7SdkN+zJiDmLdOx90oit8VyytAYZ8CG63bR5ucljDXpOkicCySOmUHihcNq 6cV/7QtLR9NYwTNijPHBGTJm+GCMkO/r+Dxz+UaMo9B/6hvbDdmdIiHt82WBfO83e/X5 9YxRiBIzNNrbE+RulwV1tC0iZ75a/ZaCGVnc+/YUpcwJr/znFoRFaFuK+gfWoftZG3BJ vlw4hH7qFsVxi2y7kW5ysm3IFrOLzBddjVmb+409P1UfPr+Rorh0qTHVo0Xdd/ohEUAa 70d9LZg9iwHgaqQfhtn3S3zEf9wUh3AwbGd76EYG2947uFX/3ghCi4I6UNJ9l9EI2W5w /FfQ== 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=O8rtQZvCK3QrKkEijY70c3BNQMjq20RYlITf+boiZWE=; b=JVUn+MVpJFlA8MPpVs6VWcywftjyWZmykJyIZR4OhDW2uQrTD83WmLNHuAvHrePZCW UFEnP4ChiwHUlYIOuGyyUwanyLx+vSNtElIgilRHhB3o6PvED8asqJ7XKX0t9mTb7/a7 tprSEL4HfFN9NnKt+X/0T3RIK7FpPrsrszthZL4kflKTW2U3xQUJJ8U9qHg2/wKWocP1 u1iqZYO4Q8GtrC6tnl+1P9nvYgxmiz0buIC0EzMUbCyo9oKJl/dlFEMqnoveESg+kdHN NLuOioZRJft2rzTrZaTEJNb5J2BDZdxe4XrP5x+kmMTLk/lKb8fy/LLxJfe1vMWTggo/ PR9Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=EyYMYy0X; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 ho19-20020a1709070e9300b0078dcd448f97si26437016ejc.801.2022.10.22.01.46.51; Sat, 22 Oct 2022 01:47: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=EyYMYy0X; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S234332AbiJVIqC (ORCPT + 99 others); Sat, 22 Oct 2022 04:46:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33240 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234831AbiJVIn5 (ORCPT ); Sat, 22 Oct 2022 04:43:57 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 14F772EA957; Sat, 22 Oct 2022 01:07: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 dfw.source.kernel.org (Postfix) with ESMTPS id 708A260B83; Sat, 22 Oct 2022 07:59:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 16257C433C1; Sat, 22 Oct 2022 07:59:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425595; bh=KJQPpJ32UIqN4u7A8mzjqm34rg4kJPRAbyTUOPAsbIY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EyYMYy0XiVg2wqEGk118QpqI4Jwj7lUfHboCqgbkndWVHHMad91hfK1qhx/8C803T J38Azsq5Qyb2u3SU3UXJ9TbOs/x46YZxwOHVqoo2OBL1RezjN1hIkQQzpR+alHpdGR 44I2RBx6I1Pur7OL+hdLlIiEUIXj8KpbtOudLbHQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, kernel test robot , Russell King , linux-arm-kernel@lists.infradead.org, Kees Cook , Sasha Levin Subject: [PATCH 5.19 551/717] ARM: decompressor: Include .data.rel.ro.local Date: Sat, 22 Oct 2022 09:27:10 +0200 Message-Id: <20221022072522.740344747@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376863710158284?= X-GMAIL-MSGID: =?utf-8?q?1747376863710158284?= From: Kees Cook [ Upstream commit 1b64daf413acd86c2c13f5443f6b4ef3690c8061 ] The .data.rel.ro.local section has the same semantics as .data.rel.ro here, so include it in the .rodata section of the decompressor. Additionally since the .printk_index section isn't usable outside of the core kernel, discard it in the decompressor. Avoids these warnings: arm-linux-gnueabi-ld: warning: orphan section `.data.rel.ro.local' from `arch/arm/boot/compressed/fdt_rw.o' being placed in section `.data.rel.ro.local' arm-linux-gnueabi-ld: warning: orphan section `.printk_index' from `arch/arm/boot/compressed/fdt_rw.o' being placed in section `.printk_index' Reported-by: kernel test robot Link: https://lore.kernel.org/linux-mm/202209080545.qMIVj7YM-lkp@intel.com Cc: Russell King Cc: linux-arm-kernel@lists.infradead.org Signed-off-by: Kees Cook Signed-off-by: Sasha Levin --- arch/arm/boot/compressed/vmlinux.lds.S | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/arm/boot/compressed/vmlinux.lds.S b/arch/arm/boot/compressed/vmlinux.lds.S index 1bcb68ac4b01..3fcb3e62dc56 100644 --- a/arch/arm/boot/compressed/vmlinux.lds.S +++ b/arch/arm/boot/compressed/vmlinux.lds.S @@ -23,6 +23,7 @@ SECTIONS *(.ARM.extab*) *(.note.*) *(.rel.*) + *(.printk_index) /* * Discard any r/w data - this produces a link error if we have any, * which is required for PIC decompression. Local data generates @@ -57,6 +58,7 @@ SECTIONS *(.rodata) *(.rodata.*) *(.data.rel.ro) + *(.data.rel.ro.*) } .piggydata : { *(.piggydata) From patchwork Sat Oct 22 07:27: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: 7537 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1105865wrr; Sat, 22 Oct 2022 01:36:22 -0700 (PDT) X-Google-Smtp-Source: AMsMyM73mx0ZZhqNzJCyShndynoLoAVZKAWuddK9eMqvVzsBHR5l9iMm2w8cNdKJCsQS/s89tXBI X-Received: by 2002:a63:5a63:0:b0:42f:e143:80d4 with SMTP id k35-20020a635a63000000b0042fe14380d4mr19961723pgm.456.1666427782677; Sat, 22 Oct 2022 01:36:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666427782; cv=none; d=google.com; s=arc-20160816; b=IGsFgJZhtzbXhaJeqEjU5F6IVcRChdKzLpBAlgRe8IRMKZVdZy4z42unFqgQ+i1nDE kzsTDwO5ydqsvL/2VZstN55UhPlMcy/9zCsTqhgVoC7vph6OGLLnBGJERkSVQPYJksXw mND79d5dXPEV81CWkJwx2v1i3rQd5vN27sRUPQFQW57+byVo/hH+nrRVY6/vw3PRDYCS JqBjtop4Zq3zWQ0EwAGly4cuYrCZYdRvm5AKj7HeXx5i7b3Y9tf4VbHW4mxVl8q5RJ1H 0+sM+XesBRBK+gKFaqE1ohYtGhLBZH2nXrs9k4HU5ygauEBUVo85BBrfuRJ+SNtxLEm6 yJbA== 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=UBym0VXSnLeYoMgTFdL3ZmoKoU+5/HKxdD3hjJz0Diw=; b=te4+gXeezfwkaM95XdI4dtxV+OVhhSTu8VyxKuZ7WN4tU/3cS2nPIL1YxcvgYnhIBh 1HAamGrwIkXBbH/qrtPx91S+fN9UGgFzE8qK+1vJn+df+K5ToqP41lOWLFoQb6BQTT7q rMZAqQOBePSRN+riaiGS+orw3ljDY0jEi2kZcxK2ugh+bFj8S4AYJ0OMU3kIfd+FUjbZ Smn+SRfXv9UOW68T/fVTIc0+MOIi/oqiQ/sGxwY37j4lPxuiN0LZVp6XKHfQkQ2dWA/3 92YC6SLjJjEcWYDbX2HY3cp601rddVljd9ZS+vIHWKduIFnqS2/lxlN+OB+kGOOUbXPo 1GiA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=rrp6h9ll; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 m18-20020a056a00081200b00565de49c28esi30533015pfk.57.2022.10.22.01.36.08; Sat, 22 Oct 2022 01:36: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=rrp6h9ll; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S233785AbiJVI0I (ORCPT + 99 others); Sat, 22 Oct 2022 04:26:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34070 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233989AbiJVIYa (ORCPT ); Sat, 22 Oct 2022 04:24:30 -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 8B44C57564; Sat, 22 Oct 2022 01:00: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 EAE18B82E16; Sat, 22 Oct 2022 07:59:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6055EC433C1; Sat, 22 Oct 2022 07:59:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425598; bh=psaJ9l6m2dT3AwTJ14Cd2vhLcC+Ys2U7Ajn7QpIyigg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rrp6h9llEbUoVuRReZ+qtj/Qx5SUMbOUQbs4fGRk+b9skgEfKBCC5rGOpwUwKQ2DB 1qyVZu52h32Og5pP/i4pJI/p3DBhEoIccIkj3xJKdgoPYwxe2J33DZ7J3Vjcf5csUv ms+2DFC3nqS8irjeZ1fxEZ1sjJlZdaxUkdhco1bU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mario Limonciello , Hans de Goede , "Rafael J. Wysocki" , Sasha Levin , Luya Tshimbalanga Subject: [PATCH 5.19 552/717] ACPI: x86: Add a quirk for Dell Inspiron 14 2-in-1 for StorageD3Enable Date: Sat, 22 Oct 2022 09:27:11 +0200 Message-Id: <20221022072522.791506800@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376179163141163?= X-GMAIL-MSGID: =?utf-8?q?1747376179163141163?= From: Mario Limonciello [ Upstream commit 018d6711c26e4bd26e20a819fcc7f8ab902608f3 ] Dell Inspiron 14 2-in-1 has two ACPI nodes under GPP1 both with _ADR of 0, both without _HID. It's ambiguous which the kernel should take, but it seems to take "DEV0". Unfortunately "DEV0" is missing the device property `StorageD3Enable` which is present on "NVME". To avoid this causing problems for suspend, add a quirk for this system to behave like `StorageD3Enable` property was found. Link: https://bugzilla.kernel.org/show_bug.cgi?id=216440 Reported-and-tested-by: Luya Tshimbalanga Signed-off-by: Mario Limonciello Reviewed-by: Hans de Goede Signed-off-by: Rafael J. Wysocki Signed-off-by: Sasha Levin --- drivers/acpi/x86/utils.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/drivers/acpi/x86/utils.c b/drivers/acpi/x86/utils.c index 664070fc8349..d7cdd8406c84 100644 --- a/drivers/acpi/x86/utils.c +++ b/drivers/acpi/x86/utils.c @@ -207,9 +207,26 @@ static const struct x86_cpu_id storage_d3_cpu_ids[] = { {} }; +static const struct dmi_system_id force_storage_d3_dmi[] = { + { + /* + * _ADR is ambiguous between GPP1.DEV0 and GPP1.NVME + * but .NVME is needed to get StorageD3Enable node + * https://bugzilla.kernel.org/show_bug.cgi?id=216440 + */ + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."), + DMI_MATCH(DMI_PRODUCT_NAME, "Inspiron 14 7425 2-in-1"), + } + }, + {} +}; + bool force_storage_d3(void) { - return x86_match_cpu(storage_d3_cpu_ids); + const struct dmi_system_id *dmi_id = dmi_first_match(force_storage_d3_dmi); + + return dmi_id || x86_match_cpu(storage_d3_cpu_ids); } /* From patchwork Sat Oct 22 07:27: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: 7815 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1140928wrr; Sat, 22 Oct 2022 03:27:06 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4KCeUAo0KDo0rHitjdvrtL0m9S3soJidm0vOn9nmgHcIlC3X4MQ7ew8Wnc7qMCb5BdTo+r X-Received: by 2002:a17:906:4fcb:b0:791:9a26:376f with SMTP id i11-20020a1709064fcb00b007919a26376fmr19493484ejw.431.1666434426407; Sat, 22 Oct 2022 03:27:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666434426; cv=none; d=google.com; s=arc-20160816; b=FiTiD+OTosuEpmd/x+A/peHQAhAAGKw8v7H2IIzwvJPFA1zZlrvsMMV1SUHTku1h25 w5R/m1x3OLqBafPjbkQin1wVxCSAgmvY6r8BRAyz4yGZGdJa1m0JvwG0JjKZw6DimlaS mFzplzqN29zDegshlVFvkMkugHVxaOv9UHd1395go0ffoP6RFutGIanyPaa8ltKCV24X Wlp1joBUv5fzZX3l8DK+3yi+7incopic9Creh+z32EKnPHE5Vh40JlbQugwsQ96ncRwR RdyDUdZpVSUs4idUBJpkRyew4O436cFPm/3I3HhMYhsHARRjAeBIK/UP/dgkCXtMNr3y Ys7w== 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=vuA9a6t3fOnapTOTnGUH/1TrbgIT7put1zz010HiY+U=; b=xC61qCvUkBCTfnTsYXzSTWXTTFc6wpdmiCGwQNCTLUeCM9yIJ/AH7XdqT03gQUYv/N pI7wZexaMpBPX4PdqzYmzbPEJh3NmA2i0ZcOCoFzN9zDxf9eLsLJbhrpIhq8DzF7Y021 ZQ1ulRpB8xOMgQtwdJ8dgFHz7NAn0cw9YiUCITY1X6eD+1++hyLLWNKPCOVOryrDUC+G Wk+O99MsfsYEexEwoznEPy7iTBJHM11o68BXBRL7iPnkV488Y1ITnveMkvo5bNN14CBv 2N6DAdaixSHJHD1pMWrd7mKjUn4k/dfp8CGYnH431pLmMiMqwMuCF5Y9cnaEiJhIj3cS CANA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=0LCuBtS9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 cs14-20020a0564020c4e00b00447d567a77dsi23023541edb.207.2022.10.22.03.26.41; Sat, 22 Oct 2022 03:27: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=0LCuBtS9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S229763AbiJVKWZ (ORCPT + 99 others); Sat, 22 Oct 2022 06:22:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42920 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229494AbiJVKWB (ORCPT ); Sat, 22 Oct 2022 06:22: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 6F24E5807C; Sat, 22 Oct 2022 02:38: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 7020460B98; Sat, 22 Oct 2022 08:00:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EC2C4C4347C; Sat, 22 Oct 2022 08:00:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425601; bh=WOtLqPtfTzhG6xYKuXLzf9SXFlrNx350kTurMW1iEWw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0LCuBtS9J8zCXCeiOIcEq/bt0xKzDvb9q5k5RZDel+NFT7DxWETPCOGBFEeWGNQbB BcSD/RJmPEGyLRmCHk2tKei1unDmZGIXa1q1N777LKlHX1rLy8eb9Yp4LyrYaR5d8K R6ZC++I1FW9vPHa1RNkkc1LBMCSVprNghSbFulcY= 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 5.19 553/717] x86/entry: Work around Clang __bdos() bug Date: Sat, 22 Oct 2022 09:27:12 +0200 Message-Id: <20221022072522.841821313@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 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?1747383145259805992?= X-GMAIL-MSGID: =?utf-8?q?1747383145259805992?= 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 0ed2e487a693..9b1a58dda935 100644 --- a/arch/x86/xen/enlighten_pv.c +++ b/arch/x86/xen/enlighten_pv.c @@ -765,6 +765,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); @@ -774,7 +775,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 Sat Oct 22 07:27: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: 7746 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1111136wrr; Sat, 22 Oct 2022 01:56:08 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5SCjqAXRj17MgsIn7dHcTdjuqViC9a1f9Av+8U3z4IcxXbXJM0BBjQS0I9F6FGy9nUlG0i X-Received: by 2002:a05:6402:350d:b0:45c:f5a2:348e with SMTP id b13-20020a056402350d00b0045cf5a2348emr21222836edd.398.1666428968300; Sat, 22 Oct 2022 01:56:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666428968; cv=none; d=google.com; s=arc-20160816; b=oWn9hWp0E6+pFEoq62oTP8iJjVGM07PkcaW0yXC1kZx/u/3CwMfpr2dLlEQF1QiOTk FxJHvqcEv+KoZ8STKu+oFHFbaZAeCYlCI6pvXswP0HRaT7hLIGY6Ep5nrC5AI37TLIiL oGxDKezmKwbygVHK5Swj/fFat9PGOBpl/8IaUgyE+An550ppfX4I8rnrlKshZfBPQABv 7OmisRWlczmfP/3mZ1y7kbOvt8No9iCXopbVXu1KO3QVb1dAsDOcZ1HbIwTjUukvfTKo 7TPPeUpxk6N/HdlOHUuw38sqIQKUQreKwM+HsRKhM8G+Mv5xVjwVZq6/nyP23GmCyzWW Eohg== 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=WKM/KDy08OAMH8fsCvo4Ijw+vuo6F2FZHaxIdlsxurk=; b=B34Dz/6wnziEETw+Vp0tv6FCY3nsDTc5Wb9wb2xPMnF6RiyFqsqm2XaKGAoV4bim1V /y0i7PJfnamaeZMPoMSsa4k2l26lM+TV3SG3PXlRCIX18Qy40fiFkJJ6G39TlF9anM4N G4p2vBPcHNdyGx9BWeWeNQqgQllbHbI3jSprxNzoWumd70ZOq7ehdT3HeJFhiFTPfiEY Vz5Zqc9S9G08VpSF83PbeVFglQQq4UD31WSLqG3PIwZBwFrtg99SZTYLsYGTV2woPYjR a1P6fuwzAb5fQTbcL6e/xwvBbWD1KsagfFxmaFkvwCTMVeoH2UeaKHd+YYV4c6kfGU2j 1UZw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ZnD9SAMA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 d26-20020aa7d69a000000b0046157981475si2604124edr.474.2022.10.22.01.55.42; Sat, 22 Oct 2022 01:56: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=ZnD9SAMA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231806AbiJVIzT (ORCPT + 99 others); Sat, 22 Oct 2022 04:55:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51836 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234649AbiJVIxM (ORCPT ); Sat, 22 Oct 2022 04:53:12 -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 0DCAE36BD6; Sat, 22 Oct 2022 01:12: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 0CB25B80E44; Sat, 22 Oct 2022 08:02:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5BEDDC433C1; Sat, 22 Oct 2022 08:02:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425722; bh=QNlC+amV3gh/GGLHmqaVA+h+qe2X831HkJsJ7yTq4l0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZnD9SAMAjg/shNHNB0Zu1dMNemIQ0267Y6KOHZ2nrsIh7FknlgdzWNTBFKrRgzjrQ +kvEqIW6czeseYqOm8CjyEzFH7IyLFahY/j/T7R8jwk8hFOuTvFcWxNo9kusJDDgZU h+cJxTv0Dbehv5vBCg5uAMujQPigfCDBtrl10jvw= 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 5.19 554/717] NFSD: Return nfserr_serverfault if splice_ok but buf->pages have data Date: Sat, 22 Oct 2022 09:27:13 +0200 Message-Id: <20221022072522.883630640@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747377421782871672?= X-GMAIL-MSGID: =?utf-8?q?1747377421782871672?= 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 eef98e3f4ae5..1e5822d00043 100644 --- a/fs/nfsd/nfs4xdr.c +++ b/fs/nfsd/nfs4xdr.c @@ -3995,7 +3995,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 Sat Oct 22 07:27: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: 7614 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1106777wrr; Sat, 22 Oct 2022 01:39:01 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6FZ/gha17BjBsYpfUZJrRsG83YUPX6UqLGeM4IXpymzbjN97cWXLoHUA9IhKlSy8vz32EE X-Received: by 2002:a17:902:e747:b0:186:7608:1857 with SMTP id p7-20020a170902e74700b0018676081857mr8400261plf.88.1666427941693; Sat, 22 Oct 2022 01:39:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666427941; cv=none; d=google.com; s=arc-20160816; b=Xxfs0AklAR4CrPXoge3T57kqA/kqVDrGQcIQQkVESLfdjYbgkHPlB2eE7vN4i/ElzG OmIWp5sohiQrpWTRz06yqODWgMgN9t4RhmUjHiljHYqwUvlkoA51ETReZiwSw3G03doW f6V07xo4dFssqQyrosshVeAq7FROghnhipc+V7JdNdC1jIh3w7ULnRCOEC6isXZ4YUG4 +fKZ57j3/tPQNC61knDcnC281naS30eBzzncmsnpSQ/ASBOBis6kjYVkU0p+Cm+itJEy BdI3VJpjnt7M6jGMpiC30AvhuDjd0PLCCPFM0WlLBFsj7gfzi7NaZfUem2lmzG20o53U CixA== 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=H5cX8WuSS/KD1C+NRdKsD77AFyIr7VAPQQxJd6j+XYA=; b=GEPpWcWSv8hXR2tieFWsGgM6iyfMCeyqpmQmVEtNFZ/tnaPMAfYj08hjUt0+PERJpu UAWUOM2GVKkTGtHAKJLoyrQYfHEFO4qMfYY6Rf2QD4DeCMIWXvoAU0xTlOphWyRx5zoY sFxKab1vAa0jaUJ6IjdMPSiUWMTNYCoiu2FjVOeEEsgXWJElP1d2pykVtkqA3STJQtII mrk46ME6ojBfZ2As9K7olQJ4xS8D6lY/3WPm5wDpTvgbD57I9CDCfIq5RJRSLACiPOh7 neIEZDCxDq974SXxCZRIAsPYdX8aGu6Ygy9XXHWdzt+FGVygVyImY+tuVvm9YKph7ZwF Hn6A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=eNvZmUvs; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 k2-20020a170902c40200b001769541146bsi32649436plk.573.2022.10.22.01.38.49; Sat, 22 Oct 2022 01:39: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=eNvZmUvs; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S234103AbiJVIdn (ORCPT + 99 others); Sat, 22 Oct 2022 04:33:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58744 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234261AbiJVIaO (ORCPT ); Sat, 22 Oct 2022 04:30:14 -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 80F832D080E; Sat, 22 Oct 2022 01:02:22 -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 EAC3FB82E33; Sat, 22 Oct 2022 08:00:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4A973C433B5; Sat, 22 Oct 2022 08:00:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425626; bh=WbRwxcu/QJGq8CcvlsmhWax0qh8D82LhJMYaSGEx+V0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eNvZmUvsrAqH5q6dzY3O/iFOo2pWSDsBr3j7vfGgay/xlDrDDvRl1We1InnBvHNlN EjWKYN8NkzlGDN+CEYGf7DmGH+2BwfT0MMdkzvaaMzknOrcKNXDwcQ0f+5tKeDkJhs uGG791+tz4GxTDJQRXTep+4wmakv7t/V/9t9qre4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dai Ngo , Chuck Lever , Sasha Levin Subject: [PATCH 5.19 555/717] NFSD: fix use-after-free on source server when doing inter-server copy Date: Sat, 22 Oct 2022 09:27:14 +0200 Message-Id: <20221022072522.924524928@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376345118647130?= X-GMAIL-MSGID: =?utf-8?q?1747376345118647130?= From: Dai Ngo [ Upstream commit 019805fea91599b22dfa62ffb29c022f35abeb06 ] Use-after-free occurred when the laundromat tried to free expired cpntf_state entry on the s2s_cp_stateids list after inter-server copy completed. The sc_cp_list that the expired copy state was inserted on was already freed. When COPY completes, the Linux client normally sends LOCKU(lock_state x), FREE_STATEID(lock_state x) and CLOSE(open_state y) to the source server. The nfs4_put_stid call from nfsd4_free_stateid cleans up the copy state from the s2s_cp_stateids list before freeing the lock state's stid. However, sometimes the CLOSE was sent before the FREE_STATEID request. When this happens, the nfsd4_close_open_stateid call from nfsd4_close frees all lock states on its st_locks list without cleaning up the copy state on the sc_cp_list list. When the time the FREE_STATEID arrives the server returns BAD_STATEID since the lock state was freed. This causes the use-after-free error to occur when the laundromat tries to free the expired cpntf_state. This patch adds a call to nfs4_free_cpntf_statelist in nfsd4_close_open_stateid to clean up the copy state before calling free_ol_stateid_reaplist to free the lock state's stid on the reaplist. Signed-off-by: Dai Ngo Signed-off-by: Chuck Lever Signed-off-by: Sasha Levin --- fs/nfsd/nfs4state.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c index 9409a0dc1b76..c16646f9db31 100644 --- a/fs/nfsd/nfs4state.c +++ b/fs/nfsd/nfs4state.c @@ -1049,6 +1049,7 @@ static struct nfs4_ol_stateid * nfs4_alloc_open_stateid(struct nfs4_client *clp) static void nfs4_free_deleg(struct nfs4_stid *stid) { + WARN_ON(!list_empty(&stid->sc_cp_list)); kmem_cache_free(deleg_slab, stid); atomic_long_dec(&num_delegations); } @@ -1463,6 +1464,7 @@ static void nfs4_free_ol_stateid(struct nfs4_stid *stid) release_all_access(stp); if (stp->st_stateowner) nfs4_put_stateowner(stp->st_stateowner); + WARN_ON(!list_empty(&stid->sc_cp_list)); kmem_cache_free(stateid_slab, stid); } @@ -6608,6 +6610,7 @@ static void nfsd4_close_open_stateid(struct nfs4_ol_stateid *s) struct nfs4_client *clp = s->st_stid.sc_client; bool unhashed; LIST_HEAD(reaplist); + struct nfs4_ol_stateid *stp; spin_lock(&clp->cl_lock); unhashed = unhash_open_stateid(s, &reaplist); @@ -6616,6 +6619,8 @@ static void nfsd4_close_open_stateid(struct nfs4_ol_stateid *s) if (unhashed) put_ol_stateid_locked(s, &reaplist); spin_unlock(&clp->cl_lock); + list_for_each_entry(stp, &reaplist, st_locks) + nfs4_free_cpntf_statelist(clp->net, &stp->st_stid); free_ol_stateid_reaplist(&reaplist); } else { spin_unlock(&clp->cl_lock); From patchwork Sat Oct 22 07:27:15 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 7558 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1106002wrr; Sat, 22 Oct 2022 01:36:41 -0700 (PDT) X-Google-Smtp-Source: AMsMyM47/OzoVHcEE9/XtgwuA5Cu9bT/TjeFHdQnfdT1nAiXC/rIyTO3pAj9OI/QiekzIOHpo2yJ X-Received: by 2002:a62:198f:0:b0:554:f1c2:d487 with SMTP id 137-20020a62198f000000b00554f1c2d487mr23441326pfz.30.1666427800818; Sat, 22 Oct 2022 01:36:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666427800; cv=none; d=google.com; s=arc-20160816; b=e4LODrO5WeU5uOcit3tvRI3w1d3pdwXWz2sOEmuHhPorcCr8/1OC2kEkAwHG1OzKWD E0hKx77O7FjIU2ixBu9cn4ioqN28XDQ6otHkyyfNba0SrcvH9jpf/PkTdo5z8LHT9IYM dzVlnH460xHIRBaeck+pXVwbRfPqOoasPgpjnbSeJ3VzfQv8Hm4g3K4CaeMr2/8VzoR4 b37GAxrJZmDZdpfljqmhcMeMh26hcVtckVs66wyEVwaLCqUMBfTY3TVNvg1K7+/hw5i0 ul1LrwFobos9xer/JdTF1a0QwVZif+kNF9slJjSdlTSPvUsbKYMawZ6uo5PgTL0my/+9 G6UQ== 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=Oh4PY+SCt681u9VR+d6HAk8y5TTI6PtRIp+d8Bovd4s=; b=kAa25dP/46yQSMmVKhJbu+C4+0kOFZzq63ewkBNUIq8Ct4m4dKUvzlmqC390T5yC6R +PGWHZ9+ZTk/QiG3wkqDrlmiRtKqgi9wJGEIpmvVMwqSx2XjDowFDV6QuoGh52AJmTfT 9Hd27KLBAbWFa/zuuBLR46oLRgDcFnWUfpW+wqeuG+qzjSTfpRagb/BI+RGK2wPTCFTk Nh3Cqp0NBkFrczxP8RjpeyWHodqKrCG0g/HZpURj6vcVF4/suwJAYkPBZ7e+4D1qhqO7 8fBF8JfQo8kRxUPpirYtd8XfBl/bRx9ql4V8KNgPrHKf1eA8gxNo/dsQ27hcQ0sO7g1Q V+lg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=a40gptRd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 s15-20020a170902ea0f00b0017f62505522si28387224plg.608.2022.10.22.01.36.23; Sat, 22 Oct 2022 01:36: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=a40gptRd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S230289AbiJVIbP (ORCPT + 99 others); Sat, 22 Oct 2022 04:31:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49340 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233921AbiJVI2S (ORCPT ); Sat, 22 Oct 2022 04: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 983F42D52EF; Sat, 22 Oct 2022 01:01: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 E980EB82E28; Sat, 22 Oct 2022 08:01:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 47EC1C433D7; Sat, 22 Oct 2022 08:00:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425659; bh=t4QUz7k5ixCbtG/WyjayRMs4byyTtxxTPJyT7nb1rRM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=a40gptRdyQFwTzvbNGxc+9Iah2sgRdxRQTctZZ3o2TB9sl4zsrfxZg7Y0VMkP32kt 39/swbknCWGsKLrAR6gLAPZweMXz4sYqqf3EoOiJijbnTYszXGAggfKxg5m5K/i+jj KPvc84RTpjDNvh6UrXlEJl9PMsUMXenC1nVbd/BQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Youghandhar Chintala , Kalle Valo , Sasha Levin Subject: [PATCH 5.19 556/717] wifi: ath10k: Set tx credit to one for WCN3990 snoc based devices Date: Sat, 22 Oct 2022 09:27:15 +0200 Message-Id: <20221022072522.970388201@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376197831291759?= X-GMAIL-MSGID: =?utf-8?q?1747376197831291759?= From: Youghandhar Chintala [ Upstream commit d81bbb684c250a637186d9286d75b1cb04d2986c ] Currently host can send two WMI commands at once. There is possibility to cause SMMU issues or corruption, if host wants to initiate 2 DMA transfers, it is possible when copy complete interrupt for first DMA reaches host, CE has already updated SRRI (Source ring read index) for both DMA transfers and is in the middle of 2nd DMA. Host uses SRRI (Source ring read index) to interpret how many DMA’s have been completed and tries to unmap/free both the DMA entries. Hence now it is limiting to one.Because CE is still in the middle of 2nd DMA which can cause these issues when handling two DMA transfers. This change will not impact other targets, as it is only for WCN3990. Tested-on: WCN3990 hw1.0 SNOC WLAN.HL.2.0-01387-QCAHLSWMTPLZ-1 Signed-off-by: Youghandhar Chintala Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/20220801134941.15216-1-quic_youghand@quicinc.com Signed-off-by: Sasha Levin --- drivers/net/wireless/ath/ath10k/core.c | 16 ++++++++++++++++ drivers/net/wireless/ath/ath10k/htc.c | 11 ++++++++--- drivers/net/wireless/ath/ath10k/hw.h | 2 ++ 3 files changed, 26 insertions(+), 3 deletions(-) diff --git a/drivers/net/wireless/ath/ath10k/core.c b/drivers/net/wireless/ath/ath10k/core.c index 688177453b07..07c4a4f0ed33 100644 --- a/drivers/net/wireless/ath/ath10k/core.c +++ b/drivers/net/wireless/ath/ath10k/core.c @@ -95,6 +95,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = { .tx_stats_over_pktlog = true, .dynamic_sar_support = false, .hw_restart_disconnect = false, + .use_fw_tx_credits = true, }, { .id = QCA988X_HW_2_0_VERSION, @@ -133,6 +134,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = { .tx_stats_over_pktlog = true, .dynamic_sar_support = false, .hw_restart_disconnect = false, + .use_fw_tx_credits = true, }, { .id = QCA9887_HW_1_0_VERSION, @@ -172,6 +174,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = { .tx_stats_over_pktlog = false, .dynamic_sar_support = false, .hw_restart_disconnect = false, + .use_fw_tx_credits = true, }, { .id = QCA6174_HW_3_2_VERSION, @@ -206,6 +209,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = { .supports_peer_stats_info = true, .dynamic_sar_support = true, .hw_restart_disconnect = false, + .use_fw_tx_credits = true, }, { .id = QCA6174_HW_2_1_VERSION, @@ -244,6 +248,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = { .tx_stats_over_pktlog = false, .dynamic_sar_support = false, .hw_restart_disconnect = false, + .use_fw_tx_credits = true, }, { .id = QCA6174_HW_2_1_VERSION, @@ -282,6 +287,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = { .tx_stats_over_pktlog = false, .dynamic_sar_support = false, .hw_restart_disconnect = false, + .use_fw_tx_credits = true, }, { .id = QCA6174_HW_3_0_VERSION, @@ -320,6 +326,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = { .tx_stats_over_pktlog = false, .dynamic_sar_support = false, .hw_restart_disconnect = false, + .use_fw_tx_credits = true, }, { .id = QCA6174_HW_3_2_VERSION, @@ -362,6 +369,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = { .supports_peer_stats_info = true, .dynamic_sar_support = true, .hw_restart_disconnect = false, + .use_fw_tx_credits = true, }, { .id = QCA99X0_HW_2_0_DEV_VERSION, @@ -406,6 +414,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = { .tx_stats_over_pktlog = false, .dynamic_sar_support = false, .hw_restart_disconnect = false, + .use_fw_tx_credits = true, }, { .id = QCA9984_HW_1_0_DEV_VERSION, @@ -457,6 +466,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = { .tx_stats_over_pktlog = false, .dynamic_sar_support = false, .hw_restart_disconnect = false, + .use_fw_tx_credits = true, }, { .id = QCA9888_HW_2_0_DEV_VERSION, @@ -505,6 +515,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = { .tx_stats_over_pktlog = false, .dynamic_sar_support = false, .hw_restart_disconnect = false, + .use_fw_tx_credits = true, }, { .id = QCA9377_HW_1_0_DEV_VERSION, @@ -543,6 +554,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = { .tx_stats_over_pktlog = false, .dynamic_sar_support = false, .hw_restart_disconnect = false, + .use_fw_tx_credits = true, }, { .id = QCA9377_HW_1_1_DEV_VERSION, @@ -583,6 +595,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = { .tx_stats_over_pktlog = false, .dynamic_sar_support = false, .hw_restart_disconnect = false, + .use_fw_tx_credits = true, }, { .id = QCA9377_HW_1_1_DEV_VERSION, @@ -614,6 +627,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = { .credit_size_workaround = true, .dynamic_sar_support = false, .hw_restart_disconnect = false, + .use_fw_tx_credits = true, }, { .id = QCA4019_HW_1_0_DEV_VERSION, @@ -659,6 +673,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = { .tx_stats_over_pktlog = false, .dynamic_sar_support = false, .hw_restart_disconnect = false, + .use_fw_tx_credits = true, }, { .id = WCN3990_HW_1_0_DEV_VERSION, @@ -690,6 +705,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = { .tx_stats_over_pktlog = false, .dynamic_sar_support = true, .hw_restart_disconnect = true, + .use_fw_tx_credits = false, }, }; diff --git a/drivers/net/wireless/ath/ath10k/htc.c b/drivers/net/wireless/ath/ath10k/htc.c index fab398046a3f..6d1784f74bea 100644 --- a/drivers/net/wireless/ath/ath10k/htc.c +++ b/drivers/net/wireless/ath/ath10k/htc.c @@ -947,13 +947,18 @@ int ath10k_htc_wait_target(struct ath10k_htc *htc) return -ECOMM; } - htc->total_transmit_credits = __le16_to_cpu(msg->ready.credit_count); + if (ar->hw_params.use_fw_tx_credits) + htc->total_transmit_credits = __le16_to_cpu(msg->ready.credit_count); + else + htc->total_transmit_credits = 1; + htc->target_credit_size = __le16_to_cpu(msg->ready.credit_size); ath10k_dbg(ar, ATH10K_DBG_HTC, - "Target ready! transmit resources: %d size:%d\n", + "Target ready! transmit resources: %d size:%d actual credits:%d\n", htc->total_transmit_credits, - htc->target_credit_size); + htc->target_credit_size, + msg->ready.credit_count); if ((htc->total_transmit_credits == 0) || (htc->target_credit_size == 0)) { diff --git a/drivers/net/wireless/ath/ath10k/hw.h b/drivers/net/wireless/ath/ath10k/hw.h index 93acf0dd580a..1b99f3a39a11 100644 --- a/drivers/net/wireless/ath/ath10k/hw.h +++ b/drivers/net/wireless/ath/ath10k/hw.h @@ -635,6 +635,8 @@ struct ath10k_hw_params { bool dynamic_sar_support; bool hw_restart_disconnect; + + bool use_fw_tx_credits; }; struct htt_resp; From patchwork Sat Oct 22 07:27:16 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 7620 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1106863wrr; Sat, 22 Oct 2022 01:39:13 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4M3rfYq+wFOFdstOZHEA5kuyVs788llJllLzeHB1MGodkqM/RI9QK54m2wr4TpuQ5RuxeN X-Received: by 2002:aa7:df16:0:b0:45b:f51f:ab73 with SMTP id c22-20020aa7df16000000b0045bf51fab73mr21353140edy.366.1666427953130; Sat, 22 Oct 2022 01:39:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666427953; cv=none; d=google.com; s=arc-20160816; b=i4hNHEDfRRmkdegJc02vl81icFhMbEHPRDtpO0yMFXl8Glio8yhf0pbLq4B3vOlnJY 8bHoYT7ybNdRepyCXyPNxQQ8byHwzgGqYttY8PysCFyw/UA6nfq1UYds7OjxHXeqH+yp SGXAL1MVMouQPjgBxPnh5u406cHI5fIz8iaisZ740HCG5KN5Y2760z+5HTDlQIATP/dh HDgTpFY6Zqyy/JMS0awiMrNR7pyPghFlCWA5czA9gQt6c0DU+WNUzo2loK/NMws9eJeI zhWYitkCnAsh4dGXTwg+Nq3eMi7/L2qN+Tchw6Mwk99yD6MN6jUaJVDhFBZlYcTiVCfF a4OA== 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=3FDYm5qWRAQ5l345ryfobEqKAwddUGp/eoaICeD9bzg=; b=Gjh5AS2TaupuP0xYqiSuBnYrkEIgGK5RwRVKNCamKLKarIbzZMrdnIA102nNtE02of VzgByv4O4tZ/pUkqZFFWcJGuGHR5xU7ZK5PJgqfUbzALZMRzmd0IdlyrPXv/xsOvVTsq Wf3WaHtNXPGp8sedsDMahK0oY2KAa/NtR6x8b+rAXIfdfKmKfppG4Squb+7/skRtznfz Qfp7oAiKe9MhDDXEjKa5N66W7xBvZe79YpDEm/bhM/edxY3AK9igABa7+qn/IzPSf6b8 9UFqPm5xSaTQBWQ5e7NRrEBLRpaGgAF88c7Vks+9JC8a99m9L6ZREW3zyFHpsOWNjovw Rnfw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="ByUrWUt/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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-20020a05640251c700b0045d523bee48si20411956edd.178.2022.10.22.01.38.47; Sat, 22 Oct 2022 01:39: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="ByUrWUt/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S234218AbiJVIgc (ORCPT + 99 others); Sat, 22 Oct 2022 04:36:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37934 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234486AbiJVIa7 (ORCPT ); Sat, 22 Oct 2022 04:30: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 3D119981ED; Sat, 22 Oct 2022 01:03: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 4C5D960B9B; Sat, 22 Oct 2022 08:01:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4134AC433C1; Sat, 22 Oct 2022 08:01:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425692; bh=bPQpXuTiwSD2XHaeEE3f7S0MAGju3li9gNzgfMUaygQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ByUrWUt/xlmJ26wZBXpYMZzPrgAnbcmhCkJUI1ZRgaq2Dz7hSad5VV+V79bmNavk4 HidCuqelEpr2TwJ1evA8Hnw270qXvvDBD/W6McFtV2CdALyukTSfNC3sL0mfy96dVZ 04fi51AkH23CxPvujEy02kEKyG0FPTM5mk5/M4jY= 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 5.19 557/717] wifi: brcmfmac: fix invalid address access when enabling SCAN log level Date: Sat, 22 Oct 2022 09:27:16 +0200 Message-Id: <20221022072523.011599476@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376356955986922?= X-GMAIL-MSGID: =?utf-8?q?1747376356955986922?= 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 fabfbb0b40b0..d0a7465be586 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pno.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pno.c @@ -158,12 +158,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; } @@ -185,7 +185,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 Sat Oct 22 07:27: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: 7582 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1106308wrr; Sat, 22 Oct 2022 01:37:28 -0700 (PDT) X-Google-Smtp-Source: AMsMyM70TllKfWnxMDe8fBSKyFJbcuqDfAc7bWGNTOlitTez4pb9S21V4CtN4I9DCQk+nLzfFlis X-Received: by 2002:a05:6402:1941:b0:457:13a:cce9 with SMTP id f1-20020a056402194100b00457013acce9mr21521416edz.265.1666427848752; Sat, 22 Oct 2022 01:37:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666427848; cv=none; d=google.com; s=arc-20160816; b=h2XWnQhdR3gM4RDTaGVNa2KMTM1nbQUC4JbgeJGB3wHD5a5gtpXdjadZB9xJJQ9olh i7xIGOjJF6O6rYXyJ5jrmZvNlK2oah72LV2cObrbrHkqZdVnaHmu/ZMpeIR7sH8sFsMe Dvw4n+JERZOt8Yo3rzmMbbR61v3lYMa0wCTNm1qULPOX6UgpFdaUyJ28YrSTuAq7ogZw x72YswszcLpAP+8a7CtRKAYeh3jjadJk7gSq3MS64N09FyEjwVayQ1JRQ0GxlhP59ANx i6NZWhkBpeG3oXZVHq1t2y6+jcvXhNh7TKZEpvKyTUVi7A6d5dlfB7ITXA7q6ADRSdaQ xgoA== 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=hqKpmV/p6GoRtOu2B7koP5LfHY79JZIFD90VIg/OY+o=; b=rkKvSK82BpBxo4bRrQ8mPouHhBkODQxwP6LmtAZlHeSwMY9rfy6nfKVqm7wAlu0O/l aVinhwzYs/VkBe1sEHYJGLpk3mPmaDvAQqMWy+H5FkuBnB/BWJqnp2J8xoPBTQNUQxhL NHonLS4nGR9TaFNMkt1rX5unNz9err5FuNRpSdWwU3p+t69FdRU/5YVh92+b45ytsxPh tIFHx/AiJE/ZBsD1QLThl8HGHxVtBh6PYHvd9rW44q8A/tNvU2jTVNgSQF9lb+rdm5zr NUt/WhV7BQG/02VQBm3e8+yoMoTGlmZRA8f0rL6FftO/WEp7+1/7Pld2XXKdJazjjpjO 2rbg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=FFx8wThX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 c20-20020a05640227d400b0045d27c0ba90si23418541ede.577.2022.10.22.01.37.01; Sat, 22 Oct 2022 01:37: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=FFx8wThX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231510AbiJVIcl (ORCPT + 99 others); Sat, 22 Oct 2022 04:32:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52004 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234036AbiJVI3Q (ORCPT ); Sat, 22 Oct 2022 04:29:16 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 901332E32C5; Sat, 22 Oct 2022 01: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 dfw.source.kernel.org (Postfix) with ESMTPS id 3C1D160B93; Sat, 22 Oct 2022 08:01:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 03CBEC433D6; Sat, 22 Oct 2022 08:01:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425704; bh=xHizhrsgBaS+HGjRTXe73ubCJjvU4dsr7/rdK0W9Avo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FFx8wThX1/d2kZqgSdnxizQOOakDqpUtoHaWImx3+/0fKHA+GFux5ms2O7Nb9XlmS 6er+j9T/oPcEJtgbk1qSNx3iPNr9rj52AXRNZLw4qgjsACPSvsaCYxrZ5Z8zMtg0mG N4tzSphH2EVUxAZQCbKGJMzsYr93nQFzuZD0S6Y0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Quentin Monnet , Daniel Borkmann , Sasha Levin Subject: [PATCH 5.19 558/717] bpftool: Clear errno after libcaps checks Date: Sat, 22 Oct 2022 09:27:17 +0200 Message-Id: <20221022072523.061685952@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376248198458465?= X-GMAIL-MSGID: =?utf-8?q?1747376248198458465?= From: Quentin Monnet [ Upstream commit cea558855c39b7f1f02ff50dcf701ca6596bc964 ] When bpftool is linked against libcap, the library runs a "constructor" function to compute the number of capabilities of the running kernel [0], at the beginning of the execution of the program. As part of this, it performs multiple calls to prctl(). Some of these may fail, and set errno to a non-zero value: # strace -e prctl ./bpftool version prctl(PR_CAPBSET_READ, CAP_MAC_OVERRIDE) = 1 prctl(PR_CAPBSET_READ, 0x30 /* CAP_??? */) = -1 EINVAL (Invalid argument) prctl(PR_CAPBSET_READ, CAP_CHECKPOINT_RESTORE) = 1 prctl(PR_CAPBSET_READ, 0x2c /* CAP_??? */) = -1 EINVAL (Invalid argument) prctl(PR_CAPBSET_READ, 0x2a /* CAP_??? */) = -1 EINVAL (Invalid argument) prctl(PR_CAPBSET_READ, 0x29 /* CAP_??? */) = -1 EINVAL (Invalid argument) ** fprintf added at the top of main(): we have errno == 1 ./bpftool v7.0.0 using libbpf v1.0 features: libbfd, libbpf_strict, skeletons +++ exited with 0 +++ This has been addressed in libcap 2.63 [1], but until this version is available everywhere, we can fix it on bpftool side. Let's clean errno at the beginning of the main() function, to make sure that these checks do not interfere with the batch mode, where we error out if errno is set after a bpftool command. [0] https://git.kernel.org/pub/scm/libs/libcap/libcap.git/tree/libcap/cap_alloc.c?h=libcap-2.65#n20 [1] https://git.kernel.org/pub/scm/libs/libcap/libcap.git/commit/?id=f25a1b7e69f7b33e6afb58b3e38f3450b7d2d9a0 Signed-off-by: Quentin Monnet Signed-off-by: Daniel Borkmann Link: https://lore.kernel.org/bpf/20220815162205.45043-1-quentin@isovalent.com Signed-off-by: Sasha Levin --- tools/bpf/bpftool/main.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tools/bpf/bpftool/main.c b/tools/bpf/bpftool/main.c index 9062ef2b8767..0881437587ba 100644 --- a/tools/bpf/bpftool/main.c +++ b/tools/bpf/bpftool/main.c @@ -435,6 +435,16 @@ int main(int argc, char **argv) setlinebuf(stdout); +#ifdef USE_LIBCAP + /* Libcap < 2.63 hooks before main() to compute the number of + * capabilities of the running kernel, and doing so it calls prctl() + * which may fail and set errno to non-zero. + * Let's reset errno to make sure this does not interfere with the + * batch mode. + */ + errno = 0; +#endif + last_do_help = do_help; pretty_output = false; json_output = false; From patchwork Sat Oct 22 07:27: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: 7794 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1124169wrr; Sat, 22 Oct 2022 02:35:44 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6hgIYWD6bj9f4mZeH2UDIVKhApxoNGfJl1VIqcSy2e1RD2dnvV4xOkBbgcg15GOUb4jhjF X-Received: by 2002:aa7:c7d1:0:b0:461:2a82:497e with SMTP id o17-20020aa7c7d1000000b004612a82497emr9543097eds.267.1666431343919; Sat, 22 Oct 2022 02:35:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666431343; cv=none; d=google.com; s=arc-20160816; b=0ISXrZZS65rGB295Ya2BEuLDtn5V13gJfxMC9Pq5Jx2VN0NAj5MAVOkL6dowAPDYKa QEb6dJrAW0QyajLh42MLnQMcFRYeOZ9awcu5nNIiXi75mO+0DcuUVmNTuFKwDF0i8T+w vtMr4Do7sE2p9i1A+D+uBngFLd/JjTQTobBnc+6dQsX4iWiIABCZCZ9uFQ252WpfNZDU PaWjEwi3gOuAnz1fcW4OA/J2mOrDU8DUnaAYWX4LKmBt3OLuKd6YlhT2beardHlsAd98 26fLc5myRsT5+1w4zJtKLxz0Pib9poFM9JfX/C4HXdYnYDbYfS/RHL3XYKSV/t44d+oU 41cA== 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=hEyQew45tpWxq85aejrVd8Q1QqzFtyP6/KyHIqe5Hlg=; b=zOAk7RlUSi4zut1B6fH5gmup4a1LTzHa4bC1IV6cegJ9d2RuOTOle9E2bAP+PlNXX5 1tuBsvIUdCYXhXJMVi31K/6vu2zvMfdQLFRFFD1gn89kl40rYYry7tYK+csmvMimdq0y guamo10Yy3lo1T8SUKrB9sd5nCL5a/JSGa10kzEKTREBL78XRBwxBaWeF7KNthwFak84 4W/xK5zmNW3zjNozI+4NWhwUqUFveHaJ8ube1xH9YUxmCocOz0w7+0ARDOvNj/8TAQgK 4gib4Q+rNOzesVYboOGOcZyZlh6iKzwSQ17rDMOp35D8CscRcDTwTk7yiMLVZ6ewedtC XnSg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=s2xGAEsI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 cn25-20020a0564020cb900b0045d53f8ea52si17698881edb.1.2022.10.22.02.35.19; Sat, 22 Oct 2022 02:35: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=s2xGAEsI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S230466AbiJVJR0 (ORCPT + 99 others); Sat, 22 Oct 2022 05:17:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41088 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231882AbiJVJQj (ORCPT ); Sat, 22 Oct 2022 05:16: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 75D6B2E2B94; Sat, 22 Oct 2022 01:31: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 414AD60B09; Sat, 22 Oct 2022 08:01:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 35ED7C433C1; Sat, 22 Oct 2022 08:01:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425707; bh=86sBV2qtfryQCC0tnr7qDvXObYavIWhzE4hrzmMFdMM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=s2xGAEsI2sVfb7FRSVvjPfYzPWYqa7MnynhUqAwiIHOi4udR9QxUDE0Us36H8aLnS ozkb8M3EnQgdJxUGNugM6mYOD4mKMF52xi2dfnVWRl9gGZIFJZhMhxq8SQvk0RfM10 gqMKuSF9XtlKsPQ1/5tUEmCI3EoEGQhSe9N6Mz2g= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jacob Keller , Tony Nguyen , Sasha Levin , Gurucharan Subject: [PATCH 5.19 559/717] ice: set tx_tstamps when creating new Tx rings via ethtool Date: Sat, 22 Oct 2022 09:27:18 +0200 Message-Id: <20221022072523.106448179@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747379912656530813?= X-GMAIL-MSGID: =?utf-8?q?1747379912656530813?= From: Jacob Keller [ Upstream commit b3b173745c8cab1e24d6821488b60abed3acb24d ] When the user changes the number of queues via ethtool, the driver allocates new rings. This allocation did not initialize tx_tstamps. This results in the tx_tstamps field being zero (due to kcalloc allocation), and would result in a NULL pointer dereference when attempting a transmit timestamp on the new ring. Signed-off-by: Jacob Keller Tested-by: Gurucharan (A Contingent worker at Intel) Signed-off-by: Tony Nguyen Signed-off-by: Sasha Levin --- drivers/net/ethernet/intel/ice/ice_ethtool.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/net/ethernet/intel/ice/ice_ethtool.c b/drivers/net/ethernet/intel/ice/ice_ethtool.c index 4efa5e5846e0..4dfdec11ddc1 100644 --- a/drivers/net/ethernet/intel/ice/ice_ethtool.c +++ b/drivers/net/ethernet/intel/ice/ice_ethtool.c @@ -2826,6 +2826,7 @@ ice_set_ringparam(struct net_device *netdev, struct ethtool_ringparam *ring, tx_rings[i].count = new_tx_cnt; tx_rings[i].desc = NULL; tx_rings[i].tx_buf = NULL; + tx_rings[i].tx_tstamps = &pf->ptp.port.tx; err = ice_setup_tx_ring(&tx_rings[i]); if (err) { while (i--) From patchwork Sat Oct 22 07:27: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: 7598 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1106396wrr; Sat, 22 Oct 2022 01:37:45 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6BKnZkwIYJXm2xV8oY9syYGNikNFTtwLzH4cImD9HwMaQNubEoVG2LruxZFpqdIvUMsOdd X-Received: by 2002:a05:6402:440c:b0:43a:1124:e56a with SMTP id y12-20020a056402440c00b0043a1124e56amr21729968eda.134.1666427864960; Sat, 22 Oct 2022 01:37:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666427864; cv=none; d=google.com; s=arc-20160816; b=R2/fRkHJ9OALorb9I3fRXzOd1/NUCmMzpjvbEruVJbWPxJUve9F95CSiLfGM1Z2ZMD jHLxlBLSTxdTkAFLwv9AFT07gJilTNWyvrsSulL3FcmBOhFe1WnB+SxvRysSHei3xiT8 nnMWviP66WjJveRF/0RXPiIdijDvhZEsCkGMY2CLEoK0inVxzUJbjiqAGBGmSwqACJR9 u77Ri9Xxhn0T8L/vepXs+oZ0K9aiv0wcfwPT0KtJpLeDhXhtLhe3EMpDjag+gEgcjBB3 ni4vcxnXLw0jJkisdnif/V8vh8jr/nTXIRTyY+q6BdHp/TEgiW1gEwt+cwOpndIN6+1e j2Qg== 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=TeD+YD02Jhho6Ns51bPfr5Lcm+93eTOD5sXLOo/WmTI=; b=bySnaWTJn7QEEO+TWhYILNM6bfBcc126XQFVI4uLWXKV0F3fjjzzdtcE73ZaOx1pju 2ryBtVAUiReByAfxTbB1+eTjAQqonqUjpX2ro5rHWxwToa6b6ogumb0ZSQp3wlP28jHb WJUhzvYhb3dyI6iBpN9g4ar6fNnopmcRJ9bubiPnNtkOKAysZiuQaZymVRfCBDFO1XGe gDMJ4I22n8SQ3TfCGPvQbBLW9ZvozXJ1hmlfEfl6IgEVaZcCqXmh7+cTPxcwZd6MX3L4 +SFbS058E1e5757rzjwJGme/s95OuIPeYFwkHmTOvaiopb4BPVFJMOCbOrjhjb6dSIp+ DrOQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=VAtBjw7s; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 qa42-20020a17090786aa00b0078d3babe59bsi1538881ejc.401.2022.10.22.01.37.20; Sat, 22 Oct 2022 01:37: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=VAtBjw7s; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S234077AbiJVIdF (ORCPT + 99 others); Sat, 22 Oct 2022 04:33:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58048 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234112AbiJVI3k (ORCPT ); Sat, 22 Oct 2022 04:29:40 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 111762E32EF; Sat, 22 Oct 2022 01:01: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 1D19560BA7; Sat, 22 Oct 2022 08:01:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2EAE4C433C1; Sat, 22 Oct 2022 08:01:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425710; bh=vT7Q6sU90rduuqxqS5trs7s3dVF0Knuk5sg5ohmKtRw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VAtBjw7sjj6Piz0M5IY058OxcPyNE1NKnG9XprepHnd/SNkurqB9h7MGygrV2g1JM MjOYr+nMGWfpCBTeRP2sJkN5iK8Lk9ovj5VGNGkvmDyhpgM/Y3yEw0985MKqrbNssl giiezM6/yQBIjp7VT72zgETGGspELwLuXFRitw7s= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ravi Gunasekaran , kernel test robot , Andrew Lunn , "David S. Miller" , Sasha Levin Subject: [PATCH 5.19 560/717] net: ethernet: ti: davinci_mdio: Add workaround for errata i2329 Date: Sat, 22 Oct 2022 09:27:19 +0200 Message-Id: <20221022072523.153775283@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376264883102719?= X-GMAIL-MSGID: =?utf-8?q?1747376264883102719?= From: Ravi Gunasekaran [ Upstream commit d04807b80691c6041ca8e3dcf1870d1bf1082c22 ] On the CPSW and ICSS peripherals, there is a possibility that the MDIO interface returns corrupt data on MDIO reads or writes incorrect data on MDIO writes. There is also a possibility for the MDIO interface to become unavailable until the next peripheral reset. The workaround is to configure the MDIO in manual mode and disable the MDIO state machine and emulate the MDIO protocol by reading and writing appropriate fields in MDIO_MANUAL_IF_REG register of the MDIO controller to manipulate the MDIO clock and data pins. More details about the errata i2329 and the workaround is available in: https://www.ti.com/lit/er/sprz487a/sprz487a.pdf Add implementation to disable MDIO state machine, configure MDIO in manual mode and achieve MDIO read and writes via MDIO Bitbanging Signed-off-by: Ravi Gunasekaran Reported-by: kernel test robot Reviewed-by: Andrew Lunn Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/net/ethernet/ti/davinci_mdio.c | 242 +++++++++++++++++++++++-- 1 file changed, 231 insertions(+), 11 deletions(-) diff --git a/drivers/net/ethernet/ti/davinci_mdio.c b/drivers/net/ethernet/ti/davinci_mdio.c index ea3772618043..946b9753ccfb 100644 --- a/drivers/net/ethernet/ti/davinci_mdio.c +++ b/drivers/net/ethernet/ti/davinci_mdio.c @@ -26,6 +26,8 @@ #include #include #include +#include +#include /* * This timeout definition is a worst-case ultra defensive measure against @@ -41,6 +43,7 @@ struct davinci_mdio_of_param { int autosuspend_delay_ms; + bool manual_mode; }; struct davinci_mdio_regs { @@ -49,6 +52,15 @@ struct davinci_mdio_regs { #define CONTROL_IDLE BIT(31) #define CONTROL_ENABLE BIT(30) #define CONTROL_MAX_DIV (0xffff) +#define CONTROL_CLKDIV GENMASK(15, 0) + +#define MDIO_MAN_MDCLK_O BIT(2) +#define MDIO_MAN_OE BIT(1) +#define MDIO_MAN_PIN BIT(0) +#define MDIO_MANUALMODE BIT(31) + +#define MDIO_PIN 0 + u32 alive; u32 link; @@ -59,7 +71,9 @@ struct davinci_mdio_regs { u32 userintmasked; u32 userintmaskset; u32 userintmaskclr; - u32 __reserved_1[20]; + u32 manualif; + u32 poll; + u32 __reserved_1[18]; struct { u32 access; @@ -79,6 +93,7 @@ static const struct mdio_platform_data default_pdata = { struct davinci_mdio_data { struct mdio_platform_data pdata; + struct mdiobb_ctrl bb_ctrl; struct davinci_mdio_regs __iomem *regs; struct clk *clk; struct device *dev; @@ -90,6 +105,7 @@ struct davinci_mdio_data { */ bool skip_scan; u32 clk_div; + bool manual_mode; }; static void davinci_mdio_init_clk(struct davinci_mdio_data *data) @@ -128,9 +144,122 @@ static void davinci_mdio_enable(struct davinci_mdio_data *data) writel(data->clk_div | CONTROL_ENABLE, &data->regs->control); } -static int davinci_mdio_reset(struct mii_bus *bus) +static void davinci_mdio_disable(struct davinci_mdio_data *data) +{ + u32 reg; + + /* Disable MDIO state machine */ + reg = readl(&data->regs->control); + + reg &= ~CONTROL_CLKDIV; + reg |= data->clk_div; + + reg &= ~CONTROL_ENABLE; + writel(reg, &data->regs->control); +} + +static void davinci_mdio_enable_manual_mode(struct davinci_mdio_data *data) +{ + u32 reg; + /* set manual mode */ + reg = readl(&data->regs->poll); + reg |= MDIO_MANUALMODE; + writel(reg, &data->regs->poll); +} + +static void davinci_set_mdc(struct mdiobb_ctrl *ctrl, int level) +{ + struct davinci_mdio_data *data; + u32 reg; + + data = container_of(ctrl, struct davinci_mdio_data, bb_ctrl); + reg = readl(&data->regs->manualif); + + if (level) + reg |= MDIO_MAN_MDCLK_O; + else + reg &= ~MDIO_MAN_MDCLK_O; + + writel(reg, &data->regs->manualif); +} + +static void davinci_set_mdio_dir(struct mdiobb_ctrl *ctrl, int output) +{ + struct davinci_mdio_data *data; + u32 reg; + + data = container_of(ctrl, struct davinci_mdio_data, bb_ctrl); + reg = readl(&data->regs->manualif); + + if (output) + reg |= MDIO_MAN_OE; + else + reg &= ~MDIO_MAN_OE; + + writel(reg, &data->regs->manualif); +} + +static void davinci_set_mdio_data(struct mdiobb_ctrl *ctrl, int value) +{ + struct davinci_mdio_data *data; + u32 reg; + + data = container_of(ctrl, struct davinci_mdio_data, bb_ctrl); + reg = readl(&data->regs->manualif); + + if (value) + reg |= MDIO_MAN_PIN; + else + reg &= ~MDIO_MAN_PIN; + + writel(reg, &data->regs->manualif); +} + +static int davinci_get_mdio_data(struct mdiobb_ctrl *ctrl) +{ + struct davinci_mdio_data *data; + unsigned long reg; + + data = container_of(ctrl, struct davinci_mdio_data, bb_ctrl); + reg = readl(&data->regs->manualif); + return test_bit(MDIO_PIN, ®); +} + +static int davinci_mdiobb_read(struct mii_bus *bus, int phy, int reg) +{ + int ret; + + ret = pm_runtime_resume_and_get(bus->parent); + if (ret < 0) + return ret; + + ret = mdiobb_read(bus, phy, reg); + + pm_runtime_mark_last_busy(bus->parent); + pm_runtime_put_autosuspend(bus->parent); + + return ret; +} + +static int davinci_mdiobb_write(struct mii_bus *bus, int phy, int reg, + u16 val) +{ + int ret; + + ret = pm_runtime_resume_and_get(bus->parent); + if (ret < 0) + return ret; + + ret = mdiobb_write(bus, phy, reg, val); + + pm_runtime_mark_last_busy(bus->parent); + pm_runtime_put_autosuspend(bus->parent); + + return ret; +} + +static int davinci_mdio_common_reset(struct davinci_mdio_data *data) { - struct davinci_mdio_data *data = bus->priv; u32 phy_mask, ver; int ret; @@ -138,6 +267,11 @@ static int davinci_mdio_reset(struct mii_bus *bus) if (ret < 0) return ret; + if (data->manual_mode) { + davinci_mdio_disable(data); + davinci_mdio_enable_manual_mode(data); + } + /* wait for scan logic to settle */ msleep(PHY_MAX_ADDR * data->access_time); @@ -171,6 +305,23 @@ static int davinci_mdio_reset(struct mii_bus *bus) return 0; } +static int davinci_mdio_reset(struct mii_bus *bus) +{ + struct davinci_mdio_data *data = bus->priv; + + return davinci_mdio_common_reset(data); +} + +static int davinci_mdiobb_reset(struct mii_bus *bus) +{ + struct mdiobb_ctrl *ctrl = bus->priv; + struct davinci_mdio_data *data; + + data = container_of(ctrl, struct davinci_mdio_data, bb_ctrl); + + return davinci_mdio_common_reset(data); +} + /* wait until hardware is ready for another user access */ static inline int wait_for_user_access(struct davinci_mdio_data *data) { @@ -318,6 +469,28 @@ static int davinci_mdio_probe_dt(struct mdio_platform_data *data, return 0; } +struct k3_mdio_soc_data { + bool manual_mode; +}; + +static const struct k3_mdio_soc_data am65_mdio_soc_data = { + .manual_mode = true, +}; + +static const struct soc_device_attribute k3_mdio_socinfo[] = { + { .family = "AM62X", .revision = "SR1.0", .data = &am65_mdio_soc_data }, + { .family = "AM64X", .revision = "SR1.0", .data = &am65_mdio_soc_data }, + { .family = "AM64X", .revision = "SR2.0", .data = &am65_mdio_soc_data }, + { .family = "AM65X", .revision = "SR1.0", .data = &am65_mdio_soc_data }, + { .family = "AM65X", .revision = "SR2.0", .data = &am65_mdio_soc_data }, + { .family = "J7200", .revision = "SR1.0", .data = &am65_mdio_soc_data }, + { .family = "J7200", .revision = "SR2.0", .data = &am65_mdio_soc_data }, + { .family = "J721E", .revision = "SR1.0", .data = &am65_mdio_soc_data }, + { .family = "J721E", .revision = "SR2.0", .data = &am65_mdio_soc_data }, + { .family = "J721S2", .revision = "SR1.0", .data = &am65_mdio_soc_data}, + { /* sentinel */ }, +}; + #if IS_ENABLED(CONFIG_OF) static const struct davinci_mdio_of_param of_cpsw_mdio_data = { .autosuspend_delay_ms = 100, @@ -331,6 +504,14 @@ static const struct of_device_id davinci_mdio_of_mtable[] = { MODULE_DEVICE_TABLE(of, davinci_mdio_of_mtable); #endif +static const struct mdiobb_ops davinci_mdiobb_ops = { + .owner = THIS_MODULE, + .set_mdc = davinci_set_mdc, + .set_mdio_dir = davinci_set_mdio_dir, + .set_mdio_data = davinci_set_mdio_data, + .get_mdio_data = davinci_get_mdio_data, +}; + static int davinci_mdio_probe(struct platform_device *pdev) { struct mdio_platform_data *pdata = dev_get_platdata(&pdev->dev); @@ -345,7 +526,26 @@ static int davinci_mdio_probe(struct platform_device *pdev) if (!data) return -ENOMEM; - data->bus = devm_mdiobus_alloc(dev); + data->manual_mode = false; + data->bb_ctrl.ops = &davinci_mdiobb_ops; + + if (IS_ENABLED(CONFIG_OF) && dev->of_node) { + const struct soc_device_attribute *soc_match_data; + + soc_match_data = soc_device_match(k3_mdio_socinfo); + if (soc_match_data && soc_match_data->data) { + const struct k3_mdio_soc_data *socdata = + soc_match_data->data; + + data->manual_mode = socdata->manual_mode; + } + } + + if (data->manual_mode) + data->bus = alloc_mdio_bitbang(&data->bb_ctrl); + else + data->bus = devm_mdiobus_alloc(dev); + if (!data->bus) { dev_err(dev, "failed to alloc mii bus\n"); return -ENOMEM; @@ -371,11 +571,20 @@ static int davinci_mdio_probe(struct platform_device *pdev) } data->bus->name = dev_name(dev); - data->bus->read = davinci_mdio_read; - data->bus->write = davinci_mdio_write; - data->bus->reset = davinci_mdio_reset; + + if (data->manual_mode) { + data->bus->read = davinci_mdiobb_read; + data->bus->write = davinci_mdiobb_write; + data->bus->reset = davinci_mdiobb_reset; + + dev_info(dev, "Configuring MDIO in manual mode\n"); + } else { + data->bus->read = davinci_mdio_read; + data->bus->write = davinci_mdio_write; + data->bus->reset = davinci_mdio_reset; + data->bus->priv = data; + } data->bus->parent = dev; - data->bus->priv = data; data->clk = devm_clk_get(dev, "fck"); if (IS_ERR(data->clk)) { @@ -433,9 +642,13 @@ static int davinci_mdio_remove(struct platform_device *pdev) { struct davinci_mdio_data *data = platform_get_drvdata(pdev); - if (data->bus) + if (data->bus) { mdiobus_unregister(data->bus); + if (data->manual_mode) + free_mdio_bitbang(data->bus); + } + pm_runtime_dont_use_autosuspend(&pdev->dev); pm_runtime_disable(&pdev->dev); @@ -452,7 +665,9 @@ static int davinci_mdio_runtime_suspend(struct device *dev) ctrl = readl(&data->regs->control); ctrl &= ~CONTROL_ENABLE; writel(ctrl, &data->regs->control); - wait_for_idle(data); + + if (!data->manual_mode) + wait_for_idle(data); return 0; } @@ -461,7 +676,12 @@ static int davinci_mdio_runtime_resume(struct device *dev) { struct davinci_mdio_data *data = dev_get_drvdata(dev); - davinci_mdio_enable(data); + if (data->manual_mode) { + davinci_mdio_disable(data); + davinci_mdio_enable_manual_mode(data); + } else { + davinci_mdio_enable(data); + } return 0; } #endif From patchwork Sat Oct 22 07:27: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: 7604 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1106543wrr; Sat, 22 Oct 2022 01:38:14 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4mVQVPuBN1/t2+XCtB8+qPMNy9VfxkHHj/en8TCWJJBPBvBaEBRnJMs5clMlBRRxSW9JhL X-Received: by 2002:a17:906:8a4a:b0:78d:5ff6:7507 with SMTP id gx10-20020a1709068a4a00b0078d5ff67507mr19069795ejc.194.1666427894246; Sat, 22 Oct 2022 01:38:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666427894; cv=none; d=google.com; s=arc-20160816; b=k6/8+hpKBeF7VooebtOEZSaaZqlerji1ltspXlV9ybkuUAc4OveVj9Fd6cqaA951ap K/zANGs34v4sv8RsF9+n0szuj5aAioL1m+Gjw7dMAU7avp8G61fQTeC6C9AX07Ph6z5M JtRkH4+ndUbecLj1Cpw1MkqQ1w8mkANRPucArDvuaahn8j8jhxFFQ83YqGuVUoWgmM1t 0BUTC930jtMEvx3GaWGP3bcaEXv+XRwTbMIbnqVAjDmwGiWOsbQWThCG+JWont894e84 dL9Qm/lEJ6U0DvgC7cLwbr4NYA8im6MkDJ1SXfwsM1axi05sVs+oc/5/isk/jwO1Ud8c eLog== 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=s2JYHE3jzH5G/wVhhmK7HeNfmDBc7ddkfQJqVQ/4540=; b=QZtSfkJuCzCXzX78JL5NbcnMdEQp6me1aMG1LVNpMA7FMKXOkmXu6htwK5lBmwador eP/wl1MgpDhpPDUJCNxRzQnAJmuid7rxJH7yCq+SXNwZeAfY+XwcKTXH7lFwBDn4lANi M2rNONmeaHrfvoIBtqYobEsJcFj3ENT4+CxlRDdv9qkpqFzRoufX+2+dlV+tUIXFl+zR a/ms6Lm9vgt4wc8qvqM7sn8cdKKnZD6cVBWpYJbujpB6PAhRawuABZMo7hQloCxrssLU i++CcKRCGNTR0cQoUl3NUe0a+t1O1xbtykPOrqplefFMGslzb3kk6s4qNV+xZs0r6P1n qDxA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=grFDLCm+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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-20020a1709065d0700b007316ac034a1si18839966ejt.831.2022.10.22.01.37.41; Sat, 22 Oct 2022 01:38: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=grFDLCm+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S234127AbiJVIeF (ORCPT + 99 others); Sat, 22 Oct 2022 04:34:05 -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 S234327AbiJVIa2 (ORCPT ); Sat, 22 Oct 2022 04:30: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 23BBA2D083A; Sat, 22 Oct 2022 01: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 B26D9B82E13; Sat, 22 Oct 2022 08:01:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0E4BEC433D7; Sat, 22 Oct 2022 08:01:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425713; bh=YIPJ25ERBUQJfRKFkqLFPqinasOAti3V9lF/D6mb+20=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=grFDLCm+K4jFQPVXID7HwcI0Uo1fFcl+A9KMHu0ecqMUDlhbQBTz9Ws8+/1e9s5wM A07psv6vHoX6tSILoX4G6ZIYosgRymq5a1aNT7niMo5KuXm8dls8bP5X4+8uEYo440 sdwA8RlXao0YrpGdGk+zpgM/7B4PegBVExhzPivU= 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 5.19 561/717] openvswitch: Fix double reporting of drops in dropwatch Date: Sat, 22 Oct 2022 09:27:20 +0200 Message-Id: <20221022072523.192986693@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376295164831122?= X-GMAIL-MSGID: =?utf-8?q?1747376295164831122?= 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 6c9d153afbee..b68ba3c72519 100644 --- a/net/openvswitch/datapath.c +++ b/net/openvswitch/datapath.c @@ -252,10 +252,17 @@ void ovs_dp_process_packet(struct sk_buff *skb, struct sw_flow_key *key) 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 Sat Oct 22 07:27: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: 7597 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1106391wrr; Sat, 22 Oct 2022 01:37:44 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4f19BYwpsaiOlBw8dBDeFZQANezSwFzkCEK7eIpbTG8olS60c5ua43UZnDru/1DjwNdQph X-Received: by 2002:a05:6402:3592:b0:45c:fb8a:c57d with SMTP id y18-20020a056402359200b0045cfb8ac57dmr21599339edc.290.1666427864626; Sat, 22 Oct 2022 01:37:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666427864; cv=none; d=google.com; s=arc-20160816; b=kIuH7lclsMe1tiblyPMPQgS26EvqO061USYz61Z4L7xnlDiWf6MRY25denrqHNnQb/ XOLYEK/Ke0b4xNks0nRA8BaCxVQ+oAwdOFtTsBtFL6TYdpewlZAHlPusdb8pDFs0yn8e hPARBqbOkurYYjZhWaU+3vC7ssYTYtUWRxKKcjtj5DUy91IZqT/HDM94BBfkU/CDjggy BoPInArxlN6tjhbJ2lyiD6dsFCCCHSs9geNhQuk8X3/2Ppl74k2EVFjOflmqhw5I6css c/THTXuL7uRi2T7xFCianZd0TXnWv4jpPjc0gN5/LS6WAywuh+22gNrEUIb3vZ1vhrUy Vvdw== 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=upLYNCXacljai2OhbOt70SA01rjVr9a4nZA4cUWx1uU=; b=yhoenNPgLeuCPu1C/y2as/HkqiGSEvx2DsZRgcc0wHWliX7VgXvG4CpqEk0mss3B3e V2Y7k+9FREz8y+mdk8Mf1PXV6k9XfpD/j5NvbskZRZiMzuzzhhPTUE0QFUSOcMRzv/9V Hisy29ro+vVkOX1G1lqclNib9G65thzCTK9u5Wdsy4aFlYLSR3QUNIxQv81qwj5ERZrh EdhMwBYZpoyKmpUedcHnketbpYfRO2iF5iPPH9XsJrFVUBdHrtBOkqlDel1rIvAzQ8rW sRopNqy01smmdbC+vScPvTn3VX5flXAJKdXqfipTV5puvzD/mPOw6EDQUqFETyLi1TEc Uapg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=VrA7DBdj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 oz39-20020a1709077da700b0073d581b0906si25930420ejc.278.2022.10.22.01.37.19; Sat, 22 Oct 2022 01:37: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=VrA7DBdj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S234044AbiJVIc2 (ORCPT + 99 others); Sat, 22 Oct 2022 04:32:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52002 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234032AbiJVI3Q (ORCPT ); Sat, 22 Oct 2022 04:29:16 -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 BE7682C1737; Sat, 22 Oct 2022 01: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 44DBB60ADC; Sat, 22 Oct 2022 08:01:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 09933C43142; Sat, 22 Oct 2022 08:01:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425716; bh=F91BAdOXkp+xhwYRMD0QHptsZMxc0ARjOGzeltr8YbA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VrA7DBdj7K79r6sG8jvcO8IyO+OUkxyfZGapubgS0ruEVWyi1J4/xoKvykQQtoWEV JqHjxQOOcd/xLARZwYkZaRyxXxhHm1QaUF2blUAQEQwNLPU8Nbo46At5rG0wL8fQwR FDllUjCEVAhPJphpGMnz74ZpTwdflPIOvOZWx1e0= 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 5.19 562/717] openvswitch: Fix overreporting of drops in dropwatch Date: Sat, 22 Oct 2022 09:27:21 +0200 Message-Id: <20221022072523.240830899@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376264576481332?= X-GMAIL-MSGID: =?utf-8?q?1747376264576481332?= 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 b68ba3c72519..93c596e3b22b 100644 --- a/net/openvswitch/datapath.c +++ b/net/openvswitch/datapath.c @@ -558,8 +558,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 Sat Oct 22 07:27: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: 7616 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1106790wrr; Sat, 22 Oct 2022 01:39:03 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4qQyhrX2wgFOwk6tJLA+eCTVSqJRX5oZ9091ERnvuaJgT0hT8Vjy8zxIvm2KXwFM3RJ0Jh X-Received: by 2002:a17:907:a042:b0:7a0:3323:2883 with SMTP id gz2-20020a170907a04200b007a033232883mr2670669ejc.37.1666427942911; Sat, 22 Oct 2022 01:39:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666427942; cv=none; d=google.com; s=arc-20160816; b=fneJiq1ijUCTaKfhU/pBbE6pMjTOpM1F7gTqoZiaPf2AfNOJLHJQzbVpVsXg7EJ1TK xXHUWNtzynm1N7kgxMpqRdQ+j0RiBs4uXTipOm/xf5BJmlNabfJulugPfN97ZxEnwSAi ehbBOW8/EfT2sfjnd3u9xUTexXK1LdfCAkM1miW/J85XzkHKUz3K49GklPLNjEow1XXL yqxI80bvEuD5nO4W2CLyHi9nH2vEPsVkRfdH7y4fwooHe7kOcMKfhuz4xQ6H2W9VVqh7 BHJwQEouqEvln+nAZgBiDCgJlYL/D7c4rfozCKSxWR0nZsgi9KdKgEImB35yAU1ZUKPq 5DqQ== 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=Mb4XyV3j8u0MA0oDkGxPazSMPRiK9t5u9gOkSb7G8tA=; b=mqsSent6tzynftsCNqfJbIvbWQBpFIvW5MJ/IcKPdp7WQdU8eSa/NNMQOjNptDuats e7Wv8OEYAldqx6Ad87lnwUlzLWxUVEnRoz7KREljDWymWjRypKsRox1z2UeBDjyxdkd+ AhfmzXHRDe7rxx3fRbecGIf4UUK5q0HQ4JU4gRfi3QVVhkKEeYxdoUIolENiu5ygDm39 V9P+QURrF3jUr/WlT9TXSEvZ+IOEzLDvLwCNzwqWnvya5vQgiSMEthE/oAoiiseczK+O HQIMGDcgk5rViijcQqipne+Cza8dGb0l6LvdvZzxsGiINtT8peNAcqfJX4BGmRBZgchA GBzg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=BzXLvuEH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 y1-20020a056402440100b004585ac2edd4si27463770eda.348.2022.10.22.01.38.34; Sat, 22 Oct 2022 01:39: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=BzXLvuEH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S234056AbiJVIgN (ORCPT + 99 others); Sat, 22 Oct 2022 04:36:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59188 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234433AbiJVIav (ORCPT ); Sat, 22 Oct 2022 04:30: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 229EE2D0803; Sat, 22 Oct 2022 01:02:37 -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 ED899B82E07; Sat, 22 Oct 2022 08:02:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 49EEDC433C1; Sat, 22 Oct 2022 08:01:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425719; bh=IebTnLpoWf7M4ciH6d0K8DIBt9yynGumrjjHuoyIgc4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BzXLvuEHbtz5nzxm8pXHompPxauEWwE2axXmXGDvuGRI6nYZGTiyXz6pfmBsTBEuK ccwaT+adQTqFzL9IawkuewIFszV4qvb1+JBwc63Z2eSNnkSxdikjNYB2AtxN+mwcBD jgwaX4uP7ZDZA4FOko9IOwx0ivkqCl04WT6CWnLU= 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 5.19 563/717] tcp: annotate data-race around tcp_md5sig_pool_populated Date: Sat, 22 Oct 2022 09:27:22 +0200 Message-Id: <20221022072523.281628549@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376346491324605?= X-GMAIL-MSGID: =?utf-8?q?1747376346491324605?= 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 f82cd6eb7088..83fa8886f868 100644 --- a/net/ipv4/tcp.c +++ b/net/ipv4/tcp.c @@ -4349,12 +4349,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) { @@ -4365,7 +4369,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); @@ -4381,7 +4386,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 Sat Oct 22 07:27: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: 7547 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1105893wrr; Sat, 22 Oct 2022 01:36:27 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6hZ+4CGxHwlaEw/WIGLGUj5B0lvFIZgMXJgdjzOFhZN79t5y3u8S9Qe+eWJDMDqbeaBP/6 X-Received: by 2002:a63:6482:0:b0:46e:b96c:5591 with SMTP id y124-20020a636482000000b0046eb96c5591mr5880310pgb.24.1666427786997; Sat, 22 Oct 2022 01:36:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666427786; cv=none; d=google.com; s=arc-20160816; b=hMTa60Miq/nskdPVWAcbc4yNONTfEcadDBQ5f5YS55vsosPo3Ulnzwuch9nNBZkJDO VEFTMH4zScqypx85P3Z+sHi4rvcOu6yBofSQKPeYVQb49Cm4429Ya8+h0Qcn6yA7WZWV ynwNSHW9JjITgdeOJuZI28IIh9f8iHLgmIuU1q5BYKU5eJtz0Uaw7nUB9sCc2qycWK+e pOr+lyCxeB+c7qX00BZCiCsQ/sKyqgxZJ2oSBl2UR5Q2Y+LuOf2v1Iibfgk+7rXJYOoQ vh3rSGwJ+9k2YdFPqqSFN0kU8xSyJvWFX9w8sHTDbQfcXHzOkXEQgN9ffV0aGJSuSFoz 2H3w== 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=srna4Sr+Pg4Z+QZaPAmMHxutexXuQK+Be7sKBmRqIYA=; b=z17A4fsU0AZw5O0EgUuGJN0hhy6Ll66qADS6HgJtsL0XCSzw/IqLik522stGe1ro1M EG9XuYrUbkYUNslJVe161hGhJpVDb+kP/nxYKSgX99zofL85z4wUkqhdiRHbAm0aAOn4 hvz1vwjw1LW3YRets7fvtv3He9u4vYeWVWUvWKm3dS1Yy5zZYCP1rV4aXfKWayD0jsCX E9p+peFO2CCJsEoT5UTPHwO5ert7pdcFQlPV7//Dz2YkJLl2YeoxKGc5RNtdkfQ53wqf HH41P/jUylhnC38QePlUhBHVSUc/7H0leF+wmqdejAmeBb5rEtWXaU2IW2U+oMrrkRwc g7Bg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=e91XYWv0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 g9-20020a63fa49000000b0046ed15a820fsi2474928pgk.672.2022.10.22.01.36.12; Sat, 22 Oct 2022 01:36: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=e91XYWv0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S233898AbiJVI1z (ORCPT + 99 others); Sat, 22 Oct 2022 04:27:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37070 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233897AbiJVI1M (ORCPT ); Sat, 22 Oct 2022 04:27:12 -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 B06855D884; Sat, 22 Oct 2022 01:01: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 03FA8B82E3A; Sat, 22 Oct 2022 08:00:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 47592C433D7; Sat, 22 Oct 2022 08:00:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425629; bh=/LmuOibYq4SSvlEYG9tQkbKyOyx/DdrdHV6RwtqcukY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=e91XYWv0pFF2EWHFRJpPF9k4iN2EpPywCtd9Ur7rcIRui/RvnyEctEaHUmoC3+WWQ cVFhMw8T9tF1HoufetMDtCJRyChleBKSOspPwn1nowglaYOS+wQrL08XHYKBjfmUWb OWTpKUhvn2Kbfy4xjFrHqTeUAvOkBXsALIXyziO8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jane Chu , Borislav Petkov , Dan Williams , Ingo Molnar , Sasha Levin Subject: [PATCH 5.19 564/717] x86/mce: Retrieve poison range from hardware Date: Sat, 22 Oct 2022 09:27:23 +0200 Message-Id: <20221022072523.321590110@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376183397050234?= X-GMAIL-MSGID: =?utf-8?q?1747376183397050234?= From: Jane Chu [ Upstream commit f9781bb18ed828e7b83b7bac4a4ad7cd497ee7d7 ] When memory poison consumption machine checks fire, MCE notifier handlers like nfit_handle_mce() record the impacted physical address range which is reported by the hardware in the MCi_MISC MSR. The error information includes data about blast radius, i.e. how many cachelines did the hardware determine are impacted. A recent change 7917f9cdb503 ("acpi/nfit: rely on mce->misc to determine poison granularity") updated nfit_handle_mce() to stop hard coding the blast radius value of 1 cacheline, and instead rely on the blast radius reported in 'struct mce' which can be up to 4K (64 cachelines). It turns out that apei_mce_report_mem_error() had a similar problem in that it hard coded a blast radius of 4K rather than reading the blast radius from the error information. Fix apei_mce_report_mem_error() to convey the proper poison granularity. Signed-off-by: Jane Chu Signed-off-by: Borislav Petkov Reviewed-by: Dan Williams Reviewed-by: Ingo Molnar Link: https://lore.kernel.org/r/7ed50fd8-521e-cade-77b1-738b8bfb8502@oracle.com Link: https://lore.kernel.org/r/20220826233851.1319100-1-jane.chu@oracle.com Signed-off-by: Sasha Levin --- arch/x86/kernel/cpu/mce/apei.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/arch/x86/kernel/cpu/mce/apei.c b/arch/x86/kernel/cpu/mce/apei.c index 717192915f28..8ed341714686 100644 --- a/arch/x86/kernel/cpu/mce/apei.c +++ b/arch/x86/kernel/cpu/mce/apei.c @@ -29,15 +29,26 @@ void apei_mce_report_mem_error(int severity, struct cper_sec_mem_err *mem_err) { struct mce m; + int lsb; if (!(mem_err->validation_bits & CPER_MEM_VALID_PA)) return; + /* + * Even if the ->validation_bits are set for address mask, + * to be extra safe, check and reject an error radius '0', + * and fall back to the default page size. + */ + if (mem_err->validation_bits & CPER_MEM_VALID_PA_MASK) + lsb = find_first_bit((void *)&mem_err->physical_addr_mask, PAGE_SHIFT); + else + lsb = PAGE_SHIFT; + mce_setup(&m); m.bank = -1; /* Fake a memory read error with unknown channel */ m.status = MCI_STATUS_VAL | MCI_STATUS_EN | MCI_STATUS_ADDRV | MCI_STATUS_MISCV | 0x9f; - m.misc = (MCI_MISC_ADDR_PHYS << 6) | PAGE_SHIFT; + m.misc = (MCI_MISC_ADDR_PHYS << 6) | lsb; if (severity >= GHES_SEV_RECOVERABLE) m.status |= MCI_STATUS_UC; From patchwork Sat Oct 22 07:27: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: 7623 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1106903wrr; Sat, 22 Oct 2022 01:39:23 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7AJ0tIw1WQf5bFXQKePbWpfUjZJWdGJ7cxg9c7oxMGRAvBz8rZN0/UaES7SS1/UI5BwwjK X-Received: by 2002:a17:907:1c86:b0:78d:b8dd:4826 with SMTP id nb6-20020a1709071c8600b0078db8dd4826mr19018437ejc.492.1666427952379; Sat, 22 Oct 2022 01:39:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666427952; cv=none; d=google.com; s=arc-20160816; b=RHzZA/jdYvLIflP/UOSwDQkt09S/UnuCA8zugctpRl3PEHGOfRTyT9FswsSo1jk71w qLszdzjEQOrVVI66QGxiqTGSSceXcwVdkM9Q9ecdqJWOfbCGqWWqk4CfQXibBhy0xTQ5 nnrkJyLxuo//DSzXAWoS8bvsgQKH9Xz7HP5PE69iWETd9OwgbqpLqyidF44PKjFzePps soWy+mVGCOUJwU+4rgcVtpSvzVPnCbIzaur0Q3w1d+wzBnKAdZ/u0AUdkNBpQwn5D93x +spqEdzBM1XwPOpaid6P36WL7KU2EItakpW4tWUGd2N2u6Lym2nm31jYc0SYkDDfBgTs vpOw== 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=+B3kq4N4BrCK/RESHisUCjbzyKU4QB7y1C7UtMGW+4s=; b=JKXjWCmiKXj271/UBNb+bOmCV77nyaGG/Jf+YSoYcHkmrspoWIwxiHOCR58bPm+M17 ohGzd4d59npZW/qVZuuzH3C9z/YEkM0nisCPYFMqGglg32IhahRW38wyoc+ezkQcLVEs SvBYu7MD54zdeFrq3rbE1Vbnz1JeHh1NviGgVpy/OeVeVeIndlHP1enPTTtQ+5MNVP7K 8pPGFL4jX3hm8eI7+sYfKdy8g0XDhthOvHhJrdzZrqcnJE//15yp62v7yn2NCmlsNA48 REry1LNUtFT4lWzKVsVy7u46hc4UxOx0kVU7JaTgX5n0G3utMEQp45dP/JnJqVRWwpdM p3qw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=b6RNEj2b; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 dd10-20020a1709069b8a00b00781e6ba94ffsi27249096ejc.126.2022.10.22.01.38.46; Sat, 22 Oct 2022 01:39: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=b6RNEj2b; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S234095AbiJVIdb (ORCPT + 99 others); Sat, 22 Oct 2022 04:33:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59132 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234191AbiJVI3z (ORCPT ); Sat, 22 Oct 2022 04: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 A514F2AE25; Sat, 22 Oct 2022 01:02: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 4DF9E60B95; Sat, 22 Oct 2022 08:00:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3F808C433D6; Sat, 22 Oct 2022 08:00:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425632; bh=uFZzpqGeI0F+s1iei+vQqMl4q+FdPp2Sji8X1gj9HgQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=b6RNEj2bp92FJKcM8rFcIHgUVa3SvB3XUqAP1FHcX3jFbvdRTMZnEqcY17BLjb6Mf 8OnxE/Tp/tSOpT6Mph/i1+Pc5tPrBFhEdqftHejqj/21Agx03zRBm9O3o+R7OViWz/ wEmu+ptkO11SlSFUO1YBmzOP6bAEwzg8w8JocDnY= 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 5.19 565/717] wifi: ath9k: avoid uninit memory read in ath9k_htc_rx_msg() Date: Sat, 22 Oct 2022 09:27:24 +0200 Message-Id: <20221022072523.362883843@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376356720640378?= X-GMAIL-MSGID: =?utf-8?q?1747376356720640378?= 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 994ec48b2f66..ca05b07a45e6 100644 --- a/drivers/net/wireless/ath/ath9k/htc_hst.c +++ b/drivers/net/wireless/ath/ath9k/htc_hst.c @@ -364,33 +364,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"); } /* @@ -411,16 +405,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 @@ -432,21 +436,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 Sat Oct 22 07:27: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: 7792 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1123664wrr; Sat, 22 Oct 2022 02:34:12 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6fIc/2jgyGYxlDKzNwH5iJOiUOVoKsn2IMoFfggIxB2/SQB16zYifm/FmmDcJQOdbwD35o X-Received: by 2002:a05:6402:1906:b0:45d:db20:7709 with SMTP id e6-20020a056402190600b0045ddb207709mr20952137edz.406.1666431252564; Sat, 22 Oct 2022 02:34:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666431252; cv=none; d=google.com; s=arc-20160816; b=UkN6WctIAbBX0Pu2Dg+QLmqjMr5DU+rDsnPGV4xWIz4ZT79NXfuNsbu419dIFHfzXw WlYI7U/2vbHKdlPdX3RP6dDp/u/imak3QGVPKcoe02yb2RF6Ac988tCc0oueTFZUpVGM d1iYbaNOfkgBJhWGVZGuO3+rEqsJqiRRPLFTJfOSxZecpQhdHO1VTUJnSstKwH27p+WQ Z3qjlM/WjNzYfuU5A2b8VZ+O9lUQP2TJCxan+qoGWQn7ldACIfObPpT/phaKBBGATptp 78XS1lwL0UzUNxoSKtCnQvynGd0XYx38rVXyj8orzO9lgVCC3M3OTjl5WyKlu1NCQRDv 6X2w== 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=5SjYeNmmQz0jWUczzmNvG+HhlvqT2YIrT1BQru8gks8=; b=W2h6y7JA8Bk3Vzk19B+qu3ON2b+A0+w6A1PGgPqL1KwPfy1KM9tl4yDWvRNc9o4crn adLReEeBhdutcxXDX5+G84aNL5BjjKKRzT/9TMwlWgoRxtKxbngNsMFwW32WZn2Gds2M V3gaOlGsFhZhn7KHFIraJXspiWGSosinhPxqjvbUWxWtyfZhhqtFEJcvPyyQlzscBCYN hBiCoIlEZnLyLulwzFCaxBFvs6YPlwBK0PkwJ035dmV6EYu47k3IqK5TxlPyBNHYjtlc uk26un41YJzv/SGTOMguPL3HI3gBB/qFUZU3rMzKcYtupvgQLg1pO8S/sErDsWPzrlI3 YaKw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=U8S2bgFD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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-20020aa7ccca000000b004612220a97fsi4862275edt.100.2022.10.22.02.33.48; Sat, 22 Oct 2022 02:34: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=U8S2bgFD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S230393AbiJVJQ1 (ORCPT + 99 others); Sat, 22 Oct 2022 05:16:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40324 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230193AbiJVJP0 (ORCPT ); Sat, 22 Oct 2022 05:15:26 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 180EB5B720; Sat, 22 Oct 2022 01:30: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 461FD60B88; Sat, 22 Oct 2022 08:00:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 50D3EC433D6; Sat, 22 Oct 2022 08:00:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425635; bh=Hx4mL44wdPU71kowxGBfpLmQJGtZwfe5kyjz5eQ9nTs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=U8S2bgFDxCPQsTyzkdWJsjMHIoRY1RExGeHmf0dBpLV/UvSQnM1z/Ieh5gFrjjQxg lHyOThFIdQ1e2ukMVJ2WcIt3xMCLszab3vNDz9/dFD0CTBKle8/9/0ffzOiLeX/V+/ DQFNQA7DTLxgMwLhb5lUtFbN8eMe6PBS2D8c7JqM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mika Westerberg , "David S. Miller" , Sasha Levin Subject: [PATCH 5.19 566/717] thunderbolt: Add back Intel Falcon Ridge end-to-end flow control workaround Date: Sat, 22 Oct 2022 09:27:25 +0200 Message-Id: <20221022072523.413445963@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747379817119208991?= X-GMAIL-MSGID: =?utf-8?q?1747379817119208991?= From: Mika Westerberg [ Upstream commit 54669e2f17cb5a4c41ade89427f074dc22cecb17 ] As we are now enabling full end-to-end flow control to the Thunderbolt networking driver, in order for it to work properly on second generation Thunderbolt hardware (Falcon Ridge), we need to add back the workaround that was removed with commit 53f13319d131 ("thunderbolt: Get rid of E2E workaround"). However, this time we only apply it for Falcon Ridge controllers as a form of an additional quirk. For non-Falcon Ridge this does nothing. While there fix a typo 'reqister' -> 'register' in the comment. Signed-off-by: Mika Westerberg Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/thunderbolt/nhi.c | 49 +++++++++++++++++++++++++++++++++------ 1 file changed, 42 insertions(+), 7 deletions(-) diff --git a/drivers/thunderbolt/nhi.c b/drivers/thunderbolt/nhi.c index 1333b158a95e..407a89047473 100644 --- a/drivers/thunderbolt/nhi.c +++ b/drivers/thunderbolt/nhi.c @@ -28,7 +28,11 @@ #define RING_TYPE(ring) ((ring)->is_tx ? "TX ring" : "RX ring") #define RING_FIRST_USABLE_HOPID 1 - +/* + * Used with QUIRK_E2E to specify an unused HopID the Rx credits are + * transferred. + */ +#define RING_E2E_RESERVED_HOPID RING_FIRST_USABLE_HOPID /* * Minimal number of vectors when we use MSI-X. Two for control channel * Rx/Tx and the rest four are for cross domain DMA paths. @@ -38,7 +42,9 @@ #define NHI_MAILBOX_TIMEOUT 500 /* ms */ +/* Host interface quirks */ #define QUIRK_AUTO_CLEAR_INT BIT(0) +#define QUIRK_E2E BIT(1) static int ring_interrupt_index(struct tb_ring *ring) { @@ -458,8 +464,18 @@ static void ring_release_msix(struct tb_ring *ring) static int nhi_alloc_hop(struct tb_nhi *nhi, struct tb_ring *ring) { + unsigned int start_hop = RING_FIRST_USABLE_HOPID; int ret = 0; + if (nhi->quirks & QUIRK_E2E) { + start_hop = RING_FIRST_USABLE_HOPID + 1; + if (ring->flags & RING_FLAG_E2E && !ring->is_tx) { + dev_dbg(&nhi->pdev->dev, "quirking E2E TX HopID %u -> %u\n", + ring->e2e_tx_hop, RING_E2E_RESERVED_HOPID); + ring->e2e_tx_hop = RING_E2E_RESERVED_HOPID; + } + } + spin_lock_irq(&nhi->lock); if (ring->hop < 0) { @@ -469,7 +485,7 @@ static int nhi_alloc_hop(struct tb_nhi *nhi, struct tb_ring *ring) * Automatically allocate HopID from the non-reserved * range 1 .. hop_count - 1. */ - for (i = RING_FIRST_USABLE_HOPID; i < nhi->hop_count; i++) { + for (i = start_hop; i < nhi->hop_count; i++) { if (ring->is_tx) { if (!nhi->tx_rings[i]) { ring->hop = i; @@ -484,6 +500,11 @@ static int nhi_alloc_hop(struct tb_nhi *nhi, struct tb_ring *ring) } } + if (ring->hop > 0 && ring->hop < start_hop) { + dev_warn(&nhi->pdev->dev, "invalid hop: %d\n", ring->hop); + ret = -EINVAL; + goto err_unlock; + } if (ring->hop < 0 || ring->hop >= nhi->hop_count) { dev_warn(&nhi->pdev->dev, "invalid hop: %d\n", ring->hop); ret = -EINVAL; @@ -1097,12 +1118,26 @@ static void nhi_shutdown(struct tb_nhi *nhi) static void nhi_check_quirks(struct tb_nhi *nhi) { - /* - * Intel hardware supports auto clear of the interrupt status - * reqister right after interrupt is being issued. - */ - if (nhi->pdev->vendor == PCI_VENDOR_ID_INTEL) + if (nhi->pdev->vendor == PCI_VENDOR_ID_INTEL) { + /* + * Intel hardware supports auto clear of the interrupt + * status register right after interrupt is being + * issued. + */ nhi->quirks |= QUIRK_AUTO_CLEAR_INT; + + switch (nhi->pdev->device) { + case PCI_DEVICE_ID_INTEL_FALCON_RIDGE_2C_NHI: + case PCI_DEVICE_ID_INTEL_FALCON_RIDGE_4C_NHI: + /* + * Falcon Ridge controller needs the end-to-end + * flow control workaround to avoid losing Rx + * packets when RING_FLAG_E2E is set. + */ + nhi->quirks |= QUIRK_E2E; + break; + } + } } static int nhi_check_iommu_pdev(struct pci_dev *pdev, void *data) From patchwork Sat Oct 22 07:27: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: 7606 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1106581wrr; Sat, 22 Oct 2022 01:38:21 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4mmQcqbveDmGa/pVSKGB+G/hL8m4eUAeHD8S2teOncb3F0v+SoGfoDBOIVW7lKebNu5ha5 X-Received: by 2002:a17:907:80a:b0:783:2585:5d73 with SMTP id wv10-20020a170907080a00b0078325855d73mr19287621ejb.642.1666427901615; Sat, 22 Oct 2022 01:38:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666427901; cv=none; d=google.com; s=arc-20160816; b=mqqEfkkwDLLfrcR9zgG74/ZFQOH2TjmINJYZfmekR8MFIrxQRXviWFFHBKxP6LyO71 K/nVAvVYYZs/vv0OqDq84C9azx99a1dXYE2g5jKqHqkJvzDYRnlFEAyV0Xdg4LC7lCkL Nig3dxbPe8vuIeyvnXKx3SKNmNUxk5BP3N4jXmjZCkAUCELX5yIC9AcD/KhSKZpWB7O7 i1UcxwjA40ynr99f218zsxb5XUZS0Yf+bODhzQYqdTVb5VugWvLBicx1vDRRWmePEIVc szVtHwKt0az3MTEosHGtrUyRvUg+xS5xip+tws1sd2ooeiAVMkQaMPr1u381NffdxFDi j9cA== 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=S4KH0X67P3IrphcWRhATXvOT04sZBcpRV2BsUaUSjFg=; b=ug5d4pOiIot2rvRbo7yPwjHFolcPIs6d+MQb2ZSHGhcoqymxJGuIoVia+k+IcAfm8d rhuH8C0RTuvWChy0avNWE3PoAu/5TT+hcVGLzNES1wUXV9hBruWTKAixZNkazG/5QwcA y5k60+m/wOn9vvifygRNHrR941rnaUD3iaGu0qANFP2QpU/E93M/8SAYRQ5WRBoFuqq5 bZeKhZiVSa64gNrPweVl9l7d79ZZYNpj5+nwU/N3l6xqBpL7YDHk+1KvnjDBmwrAqvW2 OdXkYphTXxxDFbCb/Q66G/wP5v76m94X24hCRpSEmpxgV7wkeBfqH8MGmo0x5ZzyDoRh ZooQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="Hq2/sC/i"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 v5-20020a50d585000000b0045bcf2bdcf2si22250505edi.464.2022.10.22.01.37.49; Sat, 22 Oct 2022 01:38: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="Hq2/sC/i"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S234188AbiJVIeT (ORCPT + 99 others); Sat, 22 Oct 2022 04:34:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32996 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234376AbiJVIah (ORCPT ); Sat, 22 Oct 2022 04:30:37 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6DC88981EA; Sat, 22 Oct 2022 01: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 dfw.source.kernel.org (Postfix) with ESMTPS id 2371760B94; Sat, 22 Oct 2022 08:00:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 18036C43148; Sat, 22 Oct 2022 08:00:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425638; bh=p9/uPrBC7Lu8bZsaakjZjm9RpK1vd5dI6sAFxr8FY58=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Hq2/sC/is684GzHF1BmEEoYtsEPiygjIU3UtKDlCKHaNWlEO2rtaNanQPTWOvARR9 8E0sXVMOsFetraizS1v47AqDQP+x8K3wOdVnpB/GBWXPiurXHAXTGL9LpjuUpPOkXy +MpT4OQhmk653xvgmPE+YcZgCzE60Tkm6LZCPv2w= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Daniel Sneddon , Dave Hansen , Neelima Krishnan , Sasha Levin Subject: [PATCH 5.19 567/717] x86/apic: Dont disable x2APIC if locked Date: Sat, 22 Oct 2022 09:27:26 +0200 Message-Id: <20221022072523.463125265@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376303189198487?= X-GMAIL-MSGID: =?utf-8?q?1747376303189198487?= From: Daniel Sneddon [ Upstream commit b8d1d163604bd1e600b062fb00de5dc42baa355f ] The APIC supports two modes, legacy APIC (or xAPIC), and Extended APIC (or x2APIC). X2APIC mode is mostly compatible with legacy APIC, but it disables the memory-mapped APIC interface in favor of one that uses MSRs. The APIC mode is controlled by the EXT bit in the APIC MSR. The MMIO/xAPIC interface has some problems, most notably the APIC LEAK [1]. This bug allows an attacker to use the APIC MMIO interface to extract data from the SGX enclave. Introduce support for a new feature that will allow the BIOS to lock the APIC in x2APIC mode. If the APIC is locked in x2APIC mode and the kernel tries to disable the APIC or revert to legacy APIC mode a GP fault will occur. Introduce support for a new MSR (IA32_XAPIC_DISABLE_STATUS) and handle the new locked mode when the LEGACY_XAPIC_DISABLED bit is set by preventing the kernel from trying to disable the x2APIC. On platforms with the IA32_XAPIC_DISABLE_STATUS MSR, if SGX or TDX are enabled the LEGACY_XAPIC_DISABLED will be set by the BIOS. If legacy APIC is required, then it SGX and TDX need to be disabled in the BIOS. [1]: https://aepicleak.com/aepicleak.pdf Signed-off-by: Daniel Sneddon Signed-off-by: Dave Hansen Acked-by: Dave Hansen Tested-by: Neelima Krishnan Link: https://lkml.kernel.org/r/20220816231943.1152579-1-daniel.sneddon@linux.intel.com Signed-off-by: Sasha Levin --- .../admin-guide/kernel-parameters.txt | 4 ++ arch/x86/Kconfig | 7 ++- arch/x86/include/asm/cpu.h | 2 + arch/x86/include/asm/msr-index.h | 13 ++++++ arch/x86/kernel/apic/apic.c | 44 +++++++++++++++++-- 5 files changed, 65 insertions(+), 5 deletions(-) diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt index 1b38d0f70677..5ef5d727ca34 100644 --- a/Documentation/admin-guide/kernel-parameters.txt +++ b/Documentation/admin-guide/kernel-parameters.txt @@ -3765,6 +3765,10 @@ nox2apic [X86-64,APIC] Do not enable x2APIC mode. + NOTE: this parameter will be ignored on systems with the + LEGACY_XAPIC_DISABLED bit set in the + IA32_XAPIC_DISABLE_STATUS MSR. + nps_mtm_hs_ctr= [KNL,ARC] This parameter sets the maximum duration, in cycles, each HW thread of the CTOP can run diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig index 25e2b8b75e40..1cccedfc2a48 100644 --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig @@ -450,6 +450,11 @@ config X86_X2APIC This allows 32-bit apic IDs (so it can support very large systems), and accesses the local apic via MSRs not via mmio. + Some Intel systems circa 2022 and later are locked into x2APIC mode + and can not fall back to the legacy APIC modes if SGX or TDX are + enabled in the BIOS. They will be unable to boot without enabling + this option. + If you don't know what to do here, say N. config X86_MPPARSE @@ -1930,7 +1935,7 @@ endchoice config X86_SGX bool "Software Guard eXtensions (SGX)" - depends on X86_64 && CPU_SUP_INTEL + depends on X86_64 && CPU_SUP_INTEL && X86_X2APIC depends on CRYPTO=y depends on CRYPTO_SHA256=y select SRCU diff --git a/arch/x86/include/asm/cpu.h b/arch/x86/include/asm/cpu.h index 8cbf623f0ecf..b472ef76826a 100644 --- a/arch/x86/include/asm/cpu.h +++ b/arch/x86/include/asm/cpu.h @@ -94,4 +94,6 @@ static inline bool intel_cpu_signatures_match(unsigned int s1, unsigned int p1, return p1 & p2; } +extern u64 x86_read_arch_cap_msr(void); + #endif /* _ASM_X86_CPU_H */ diff --git a/arch/x86/include/asm/msr-index.h b/arch/x86/include/asm/msr-index.h index e057e039173c..9267bfe3c33f 100644 --- a/arch/x86/include/asm/msr-index.h +++ b/arch/x86/include/asm/msr-index.h @@ -155,6 +155,11 @@ * Return Stack Buffer Predictions. */ +#define ARCH_CAP_XAPIC_DISABLE BIT(21) /* + * IA32_XAPIC_DISABLE_STATUS MSR + * supported + */ + #define MSR_IA32_FLUSH_CMD 0x0000010b #define L1D_FLUSH BIT(0) /* * Writeback and invalidate the @@ -1046,4 +1051,12 @@ #define MSR_IA32_HW_FEEDBACK_PTR 0x17d0 #define MSR_IA32_HW_FEEDBACK_CONFIG 0x17d1 +/* x2APIC locked status */ +#define MSR_IA32_XAPIC_DISABLE_STATUS 0xBD +#define LEGACY_XAPIC_DISABLED BIT(0) /* + * x2APIC mode is locked and + * disabling x2APIC will cause + * a #GP + */ + #endif /* _ASM_X86_MSR_INDEX_H */ diff --git a/arch/x86/kernel/apic/apic.c b/arch/x86/kernel/apic/apic.c index 189d3a5e471a..665993b2e80d 100644 --- a/arch/x86/kernel/apic/apic.c +++ b/arch/x86/kernel/apic/apic.c @@ -61,6 +61,7 @@ #include #include #include +#include unsigned int num_processors; @@ -1756,11 +1757,26 @@ EXPORT_SYMBOL_GPL(x2apic_mode); enum { X2APIC_OFF, - X2APIC_ON, X2APIC_DISABLED, + /* All states below here have X2APIC enabled */ + X2APIC_ON, + X2APIC_ON_LOCKED }; static int x2apic_state; +static bool x2apic_hw_locked(void) +{ + u64 ia32_cap; + u64 msr; + + ia32_cap = x86_read_arch_cap_msr(); + if (ia32_cap & ARCH_CAP_XAPIC_DISABLE) { + rdmsrl(MSR_IA32_XAPIC_DISABLE_STATUS, msr); + return (msr & LEGACY_XAPIC_DISABLED); + } + return false; +} + static void __x2apic_disable(void) { u64 msr; @@ -1798,6 +1814,10 @@ static int __init setup_nox2apic(char *str) apicid); return 0; } + if (x2apic_hw_locked()) { + pr_warn("APIC locked in x2apic mode, can't disable\n"); + return 0; + } pr_warn("x2apic already enabled.\n"); __x2apic_disable(); } @@ -1812,10 +1832,18 @@ early_param("nox2apic", setup_nox2apic); void x2apic_setup(void) { /* - * If x2apic is not in ON state, disable it if already enabled + * Try to make the AP's APIC state match that of the BSP, but if the + * BSP is unlocked and the AP is locked then there is a state mismatch. + * Warn about the mismatch in case a GP fault occurs due to a locked AP + * trying to be turned off. + */ + if (x2apic_state != X2APIC_ON_LOCKED && x2apic_hw_locked()) + pr_warn("x2apic lock mismatch between BSP and AP.\n"); + /* + * If x2apic is not in ON or LOCKED state, disable it if already enabled * from BIOS. */ - if (x2apic_state != X2APIC_ON) { + if (x2apic_state < X2APIC_ON) { __x2apic_disable(); return; } @@ -1836,6 +1864,11 @@ static __init void x2apic_disable(void) if (x2apic_id >= 255) panic("Cannot disable x2apic, id: %08x\n", x2apic_id); + if (x2apic_hw_locked()) { + pr_warn("Cannot disable locked x2apic, id: %08x\n", x2apic_id); + return; + } + __x2apic_disable(); register_lapic_address(mp_lapic_addr); } @@ -1894,7 +1927,10 @@ void __init check_x2apic(void) if (x2apic_enabled()) { pr_info("x2apic: enabled by BIOS, switching to x2apic ops\n"); x2apic_mode = 1; - x2apic_state = X2APIC_ON; + if (x2apic_hw_locked()) + x2apic_state = X2APIC_ON_LOCKED; + else + x2apic_state = X2APIC_ON; } else if (!boot_cpu_has(X86_FEATURE_X2APIC)) { x2apic_state = X2APIC_DISABLED; } From patchwork Sat Oct 22 07:27: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: 7568 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1106094wrr; Sat, 22 Oct 2022 01:36:55 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5FXoYuHFVMKhUpEBbeN+fE4qqwzbjUDZKLqaY0vwii//Dk1xDgbdv7/qgjWFiXtryHWFFj X-Received: by 2002:a17:90b:3507:b0:20a:9d07:1656 with SMTP id ls7-20020a17090b350700b0020a9d071656mr26721848pjb.188.1666427804339; Sat, 22 Oct 2022 01:36:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666427804; cv=none; d=google.com; s=arc-20160816; b=qh8+N8XTaHXpUJ/VHlG5EwD+JCInZOyfvetowZVAKOeZ6L84hHUR0kSlpW9aLbhxZx +kaH2LJGlVB11nVLS7UHoWqqoycrwVZ5UHUiMemVYJlwRozMQj5/bkVJNpZddmitkMnc 7Uv1yyPr7ACXiEthLU5lRUjR1rS7/WLuy59huAQo+dS13Uxwtsk4+i8+KSA018yty9VO rlq6PN3WpVjfXBGR2z+Y5DDPeNY58/zTwjUwTMKYDY8oCwoQZ/OFXE9wXP7QkM3mTAbV EP42bjZDLxiUDZZNZgof6srxVVqeqIHTPGpa7dshv/HtXdBZowK95vgPPKH8HFfl/gI3 35XA== 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=G1e35DXQJqXbfULylnFzTSbfk+vTJgLZZ7QdIiRJDvI=; b=qAi9O5ZFeU3iF//wwn568oDZyB0fbPn2N7XSzzwVVOhNKnryJODi+p3yaSW5Ih+pQh NO3gyilp0cUCnakgL/fZ6mVwqFw7QutNCMN580hdIUceUtByz74Jf9L5fI5HQr04Qarj rzfbFsFLkxR7Ctv0letBdeIohOyRBCmi9TXo91OJgi4Oqj6bS9CCwKvNLNs/tUTuQdVk q0+37Lx78jnYQsuzdJ9mh896r6RDXQ/KAZdmP6tpqAADtatYduyMg6EfrGFrnjAXIPg8 4a6YmJGIKu8dp1fvaUH631wZFcT/q6U33oZayR+CO8TTp25Y2HNMv92RDBGTcyCWQHR4 wF0g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=gVeYf7aN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 26-20020a63105a000000b0045cbd4e43b8si29281574pgq.511.2022.10.22.01.36.27; Sat, 22 Oct 2022 01:36: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=gVeYf7aN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S233866AbiJVI2W (ORCPT + 99 others); Sat, 22 Oct 2022 04:28:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37776 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233857AbiJVI1c (ORCPT ); Sat, 22 Oct 2022 04:27:32 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B097627022B; Sat, 22 Oct 2022 01:01: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 4C4BA60B9B; Sat, 22 Oct 2022 08:00:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 12F27C43141; Sat, 22 Oct 2022 08:00:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425641; bh=R9mXsIyShsVWJOH9MSgqLniCVDqACxw0AMWjzPQJhRE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gVeYf7aN9Gj1EXAJV9c0bZrQjaYCnM+mruM93I6DHSMcICuegWdPIFN/yHTNt8uB0 xk9wj2U7IPXta22QCKEti4yDW++BYkRhHGDHSSMTq8W19wOH9ibD/7BX3lj0++9mEq Fq3SQ74CFrdkKfVNMXN38FnwT8b5u4RpwHkGL21w= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Robert Hancock , Jakub Kicinski , Sasha Levin Subject: [PATCH 5.19 568/717] net: axienet: Switch to 64-bit RX/TX statistics Date: Sat, 22 Oct 2022 09:27:27 +0200 Message-Id: <20221022072523.516220122@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376201370448230?= X-GMAIL-MSGID: =?utf-8?q?1747376201370448230?= From: Robert Hancock [ Upstream commit cb45a8bf4693965e89d115cd2c510f12bc127c37 ] The RX and TX byte/packet statistics in this driver could be overflowed relatively quickly on a 32-bit platform. Switch these stats to use the u64_stats infrastructure to avoid this. Signed-off-by: Robert Hancock Link: https://lore.kernel.org/r/20220829233901.3429419-1-robert.hancock@calian.com Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin --- drivers/net/ethernet/xilinx/xilinx_axienet.h | 12 ++++++ .../net/ethernet/xilinx/xilinx_axienet_main.c | 37 +++++++++++++++++-- 2 files changed, 45 insertions(+), 4 deletions(-) diff --git a/drivers/net/ethernet/xilinx/xilinx_axienet.h b/drivers/net/ethernet/xilinx/xilinx_axienet.h index f2e2261b4b7d..8ff4333de2ad 100644 --- a/drivers/net/ethernet/xilinx/xilinx_axienet.h +++ b/drivers/net/ethernet/xilinx/xilinx_axienet.h @@ -402,6 +402,9 @@ struct axidma_bd { * @rx_bd_num: Size of RX buffer descriptor ring * @rx_bd_ci: Stores the index of the Rx buffer descriptor in the ring being * accessed currently. + * @rx_packets: RX packet count for statistics + * @rx_bytes: RX byte count for statistics + * @rx_stat_sync: Synchronization object for RX stats * @napi_tx: NAPI TX control structure * @tx_dma_cr: Nominal content of TX DMA control register * @tx_bd_v: Virtual address of the TX buffer descriptor ring @@ -411,6 +414,9 @@ struct axidma_bd { * complete. Only updated at runtime by TX NAPI poll. * @tx_bd_tail: Stores the index of the next Tx buffer descriptor in the ring * to be populated. + * @tx_packets: TX packet count for statistics + * @tx_bytes: TX byte count for statistics + * @tx_stat_sync: Synchronization object for TX stats * @dma_err_task: Work structure to process Axi DMA errors * @tx_irq: Axidma TX IRQ number * @rx_irq: Axidma RX IRQ number @@ -458,6 +464,9 @@ struct axienet_local { dma_addr_t rx_bd_p; u32 rx_bd_num; u32 rx_bd_ci; + u64_stats_t rx_packets; + u64_stats_t rx_bytes; + struct u64_stats_sync rx_stat_sync; struct napi_struct napi_tx; u32 tx_dma_cr; @@ -466,6 +475,9 @@ struct axienet_local { u32 tx_bd_num; u32 tx_bd_ci; u32 tx_bd_tail; + u64_stats_t tx_packets; + u64_stats_t tx_bytes; + struct u64_stats_sync tx_stat_sync; struct work_struct dma_err_task; diff --git a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c index 1760930ec0c4..9262988d26a3 100644 --- a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c +++ b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c @@ -752,8 +752,10 @@ static int axienet_tx_poll(struct napi_struct *napi, int budget) if (lp->tx_bd_ci >= lp->tx_bd_num) lp->tx_bd_ci %= lp->tx_bd_num; - ndev->stats.tx_packets += packets; - ndev->stats.tx_bytes += size; + u64_stats_update_begin(&lp->tx_stat_sync); + u64_stats_add(&lp->tx_packets, packets); + u64_stats_add(&lp->tx_bytes, size); + u64_stats_update_end(&lp->tx_stat_sync); /* Matches barrier in axienet_start_xmit */ smp_mb(); @@ -984,8 +986,10 @@ static int axienet_rx_poll(struct napi_struct *napi, int budget) cur_p = &lp->rx_bd_v[lp->rx_bd_ci]; } - lp->ndev->stats.rx_packets += packets; - lp->ndev->stats.rx_bytes += size; + u64_stats_update_begin(&lp->rx_stat_sync); + u64_stats_add(&lp->rx_packets, packets); + u64_stats_add(&lp->rx_bytes, size); + u64_stats_update_end(&lp->rx_stat_sync); if (tail_p) axienet_dma_out_addr(lp, XAXIDMA_RX_TDESC_OFFSET, tail_p); @@ -1292,10 +1296,32 @@ static int axienet_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) return phylink_mii_ioctl(lp->phylink, rq, cmd); } +static void +axienet_get_stats64(struct net_device *dev, struct rtnl_link_stats64 *stats) +{ + struct axienet_local *lp = netdev_priv(dev); + unsigned int start; + + netdev_stats_to_stats64(stats, &dev->stats); + + do { + start = u64_stats_fetch_begin_irq(&lp->rx_stat_sync); + stats->rx_packets = u64_stats_read(&lp->rx_packets); + stats->rx_bytes = u64_stats_read(&lp->rx_bytes); + } while (u64_stats_fetch_retry_irq(&lp->rx_stat_sync, start)); + + do { + start = u64_stats_fetch_begin_irq(&lp->tx_stat_sync); + stats->tx_packets = u64_stats_read(&lp->tx_packets); + stats->tx_bytes = u64_stats_read(&lp->tx_bytes); + } while (u64_stats_fetch_retry_irq(&lp->tx_stat_sync, start)); +} + static const struct net_device_ops axienet_netdev_ops = { .ndo_open = axienet_open, .ndo_stop = axienet_stop, .ndo_start_xmit = axienet_start_xmit, + .ndo_get_stats64 = axienet_get_stats64, .ndo_change_mtu = axienet_change_mtu, .ndo_set_mac_address = netdev_set_mac_address, .ndo_validate_addr = eth_validate_addr, @@ -1850,6 +1876,9 @@ static int axienet_probe(struct platform_device *pdev) lp->rx_bd_num = RX_BD_NUM_DEFAULT; lp->tx_bd_num = TX_BD_NUM_DEFAULT; + u64_stats_init(&lp->rx_stat_sync); + u64_stats_init(&lp->tx_stat_sync); + netif_napi_add(ndev, &lp->napi_rx, axienet_rx_poll, NAPI_POLL_WEIGHT); netif_napi_add(ndev, &lp->napi_tx, axienet_tx_poll, NAPI_POLL_WEIGHT); From patchwork Sat Oct 22 07:27: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: 7554 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1105962wrr; Sat, 22 Oct 2022 01:36:36 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4K/Hvmrjjwqa3gwYXV9A6cLHWkjXDZ0nLReslkFMV9lJv7eaA58CzCqZzY1GKapNzSfNyP X-Received: by 2002:a17:90a:d3cb:b0:20d:92d6:a047 with SMTP id d11-20020a17090ad3cb00b0020d92d6a047mr60332325pjw.155.1666427786428; Sat, 22 Oct 2022 01:36:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666427786; cv=none; d=google.com; s=arc-20160816; b=dD8Km1dXMnlkEXPQC4BcfGhahXwy+u8RG0s/PEQDuum/Crtqin6Qy9aHWsGzgDTN3O OT82aDQTefF2IHc8j+6pcvsW2sNdwS7TWD5z+Js16C6DbVdapirvzR1i1Gt4Qkin6GH3 7iW6KoOuGKMKVtPmehLFnpbdV08cKGjga11WrKHpumqPGkQAfnfjvkNWkDfqvZmnU3yk PCCWmRjRjX2CQNkHueSHJjUIdx8RtWX8Jj6UyIvvfKqkoyrvi3quEj+Sw/ZReM6nzzJY 4HIxVHuBJLzNpAEqyTg8DAjVV0jEknFQlY7fqEpBFB7c9h7Ijn8LhcG6RfAPmzpDI0fo U3SQ== 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=BYMNpoEQ7NvbPSF1yibyBNPhMaS2p0TyDYcsjJ1RzN8=; b=r8ja1XjW4eEtrNlTU0p1bJ/Q6Tzo/uz1HOH4Mv0S0DrVms49w973ODT3bA0uu2aSQZ vV5kHuHOvh9nvA/pKWECmnqDbDOK/MxT6b3QiAD//k+QZETUjvutwdg6A47Y5bv3zCg8 2DMGhEoJNv/RjJIlUNnxyEnSyCliSXjY/nGfh6zdT7navmMtspWyiuFmmXsdYFg/HRK5 E94ufzmgQ9x2y8jJNTcvl7poibp0AT35Y7nzVsEvD4xXRB/nO3Yeib5yCKh1FkU7ZWn8 CsvR5jIQUluouTQ4YHqo04ULCj+2+C06BIvtvzPl4rjUpiozocLA7oa7MwP+nPF1zNqL sUXg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=HemO4p46; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 c4-20020a170902d48400b0017f577878edsi32779082plg.368.2022.10.22.01.36.12; Sat, 22 Oct 2022 01:36: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=HemO4p46; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S230467AbiJVI20 (ORCPT + 99 others); Sat, 22 Oct 2022 04:28:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37792 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230445AbiJVI1d (ORCPT ); Sat, 22 Oct 2022 04:27: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 85A21270D1A; Sat, 22 Oct 2022 01: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 F0FE8B82E39; Sat, 22 Oct 2022 08:00:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 466BCC4347C; Sat, 22 Oct 2022 08:00:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425644; bh=xklVpIJmlttcbRUn9vRu+iL6LZXyO7Eb5rTig1bQAy4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HemO4p46qpdCz2V8N9Tv5JHn7KGLVe9IOARc8N34ebyO74k0ETQ36ydZrtcYa1MuC IrxNTJTIm9BR//BU9dBM8JwnhrvjBESK4IfPeeNJX4JKm1UtAQrNWLD9DbqF7FaTiW pnPJx+f+IXEsE/pVtd2gnMC2eOHlxRFW1kAh1FJ4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Richard Gobert , David Ahern , Jakub Kicinski , Sasha Levin Subject: [PATCH 5.19 569/717] net-next: Fix IP_UNICAST_IF option behavior for connected sockets Date: Sat, 22 Oct 2022 09:27:28 +0200 Message-Id: <20221022072523.565650328@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376182597438773?= X-GMAIL-MSGID: =?utf-8?q?1747376182597438773?= From: Richard Gobert [ Upstream commit 0e4d354762cefd3e16b4cff8988ff276e45effc4 ] The IP_UNICAST_IF socket option is used to set the outgoing interface for outbound packets. The IP_UNICAST_IF socket option was added as it was needed by the Wine project, since no other existing option (SO_BINDTODEVICE socket option, IP_PKTINFO socket option or the bind function) provided the needed characteristics needed by the IP_UNICAST_IF socket option. [1] The IP_UNICAST_IF socket option works well for unconnected sockets, that is, the interface specified by the IP_UNICAST_IF socket option is taken into consideration in the route lookup process when a packet is being sent. However, for connected sockets, the outbound interface is chosen when connecting the socket, and in the route lookup process which is done when a packet is being sent, the interface specified by the IP_UNICAST_IF socket option is being ignored. This inconsistent behavior was reported and discussed in an issue opened on systemd's GitHub project [2]. Also, a bug report was submitted in the kernel's bugzilla [3]. To understand the problem in more detail, we can look at what happens for UDP packets over IPv4 (The same analysis was done separately in the referenced systemd issue). When a UDP packet is sent the udp_sendmsg function gets called and the following happens: 1. The oif member of the struct ipcm_cookie ipc (which stores the output interface of the packet) is initialized by the ipcm_init_sk function to inet->sk.sk_bound_dev_if (the device set by the SO_BINDTODEVICE socket option). 2. If the IP_PKTINFO socket option was set, the oif member gets overridden by the call to the ip_cmsg_send function. 3. If no output interface was selected yet, the interface specified by the IP_UNICAST_IF socket option is used. 4. If the socket is connected and no destination address is specified in the send function, the struct ipcm_cookie ipc is not taken into consideration and the cached route, that was calculated in the connect function is being used. Thus, for a connected socket, the IP_UNICAST_IF sockopt isn't taken into consideration. This patch corrects the behavior of the IP_UNICAST_IF socket option for connect()ed sockets by taking into consideration the IP_UNICAST_IF sockopt when connecting the socket. In order to avoid reconnecting the socket, this option is still ignored when applied on an already connected socket until connect() is called again by the Richard Gobert. Change the __ip4_datagram_connect function, which is called during socket connection, to take into consideration the interface set by the IP_UNICAST_IF socket option, in a similar way to what is done in the udp_sendmsg function. [1] https://lore.kernel.org/netdev/1328685717.4736.4.camel@edumazet-laptop/T/ [2] https://github.com/systemd/systemd/issues/11935#issuecomment-618691018 [3] https://bugzilla.kernel.org/show_bug.cgi?id=210255 Signed-off-by: Richard Gobert Reviewed-by: David Ahern Link: https://lore.kernel.org/r/20220829111554.GA1771@debian Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin --- net/ipv4/datagram.c | 2 ++ tools/testing/selftests/net/fcnal-test.sh | 30 +++++++++++++++++++++++ tools/testing/selftests/net/nettest.c | 16 ++++++++++-- 3 files changed, 46 insertions(+), 2 deletions(-) diff --git a/net/ipv4/datagram.c b/net/ipv4/datagram.c index ffd57523331f..405a8c2aea64 100644 --- a/net/ipv4/datagram.c +++ b/net/ipv4/datagram.c @@ -42,6 +42,8 @@ int __ip4_datagram_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len oif = inet->mc_index; if (!saddr) saddr = inet->mc_addr; + } else if (!oif) { + oif = inet->uc_index; } fl4 = &inet->cork.fl.u.ip4; rt = ip_route_connect(fl4, usin->sin_addr.s_addr, saddr, oif, diff --git a/tools/testing/selftests/net/fcnal-test.sh b/tools/testing/selftests/net/fcnal-test.sh index 03b586760164..31c3b6ebd388 100755 --- a/tools/testing/selftests/net/fcnal-test.sh +++ b/tools/testing/selftests/net/fcnal-test.sh @@ -1466,6 +1466,13 @@ ipv4_udp_novrf() run_cmd nettest -D -r ${a} -d ${NSA_DEV} -S -0 ${NSA_IP} log_test_addr ${a} $? 0 "Client, device bind via IP_UNICAST_IF" + log_start + run_cmd_nsb nettest -D -s & + sleep 1 + run_cmd nettest -D -r ${a} -d ${NSA_DEV} -S -0 ${NSA_IP} -U + log_test_addr ${a} $? 0 "Client, device bind via IP_UNICAST_IF, with connect()" + + log_start show_hint "Should fail 'Connection refused'" run_cmd nettest -D -r ${a} @@ -1525,6 +1532,13 @@ ipv4_udp_novrf() run_cmd nettest -D -d ${NSA_DEV} -S -r ${a} log_test_addr ${a} $? 0 "Global server, device client via IP_UNICAST_IF, local connection" + log_start + run_cmd nettest -s -D & + sleep 1 + run_cmd nettest -D -d ${NSA_DEV} -S -r ${a} -U + log_test_addr ${a} $? 0 "Global server, device client via IP_UNICAST_IF, local connection, with connect()" + + # IPv4 with device bind has really weird behavior - it overrides the # fib lookup, generates an rtable and tries to send the packet. This # causes failures for local traffic at different places @@ -1550,6 +1564,15 @@ ipv4_udp_novrf() sleep 1 run_cmd nettest -D -r ${a} -d ${NSA_DEV} -S log_test_addr ${a} $? 1 "Global server, device client via IP_UNICAST_IF, local connection" + + log_start + show_hint "Should fail since addresses on loopback are out of device scope" + run_cmd nettest -D -s & + sleep 1 + run_cmd nettest -D -r ${a} -d ${NSA_DEV} -S -U + log_test_addr ${a} $? 1 "Global server, device client via IP_UNICAST_IF, local connection, with connect()" + + done a=${NSA_IP} @@ -3157,6 +3180,13 @@ ipv6_udp_novrf() sleep 1 run_cmd nettest -6 -D -r ${a} -d ${NSA_DEV} -S log_test_addr ${a} $? 1 "Global server, device client via IP_UNICAST_IF, local connection" + + log_start + show_hint "Should fail 'No route to host' since addresses on loopback are out of device scope" + run_cmd nettest -6 -D -s & + sleep 1 + run_cmd nettest -6 -D -r ${a} -d ${NSA_DEV} -S -U + log_test_addr ${a} $? 1 "Global server, device client via IP_UNICAST_IF, local connection, with connect()" done a=${NSA_IP6} diff --git a/tools/testing/selftests/net/nettest.c b/tools/testing/selftests/net/nettest.c index d9a6fd2cd9d3..7900fa98eccb 100644 --- a/tools/testing/selftests/net/nettest.c +++ b/tools/testing/selftests/net/nettest.c @@ -127,6 +127,9 @@ struct sock_args { /* ESP in UDP encap test */ int use_xfrm; + + /* use send() and connect() instead of sendto */ + int datagram_connect; }; static int server_mode; @@ -979,6 +982,11 @@ static int send_msg(int sd, void *addr, socklen_t alen, struct sock_args *args) log_err_errno("write failed sending msg to peer"); return 1; } + } else if (args->datagram_connect) { + if (send(sd, msg, msglen, 0) < 0) { + log_err_errno("send failed sending msg to peer"); + return 1; + } } else if (args->ifindex && args->use_cmsg) { if (send_msg_cmsg(sd, addr, alen, args->ifindex, args->version)) return 1; @@ -1659,7 +1667,7 @@ static int connectsock(void *addr, socklen_t alen, struct sock_args *args) if (args->has_local_ip && bind_socket(sd, args)) goto err; - if (args->type != SOCK_STREAM) + if (args->type != SOCK_STREAM && !args->datagram_connect) goto out; if (args->password && tcp_md5sig(sd, addr, alen, args)) @@ -1854,7 +1862,7 @@ static int ipc_parent(int cpid, int fd, struct sock_args *args) return client_status; } -#define GETOPT_STR "sr:l:c:p:t:g:P:DRn:M:X:m:d:I:BN:O:SCi6xL:0:1:2:3:Fbqf" +#define GETOPT_STR "sr:l:c:p:t:g:P:DRn:M:X:m:d:I:BN:O:SUCi6xL:0:1:2:3:Fbqf" #define OPT_FORCE_BIND_KEY_IFINDEX 1001 #define OPT_NO_BIND_KEY_IFINDEX 1002 @@ -1891,6 +1899,7 @@ static void print_usage(char *prog) " -I dev bind socket to given device name - server mode\n" " -S use setsockopt (IP_UNICAST_IF or IP_MULTICAST_IF)\n" " to set device binding\n" + " -U Use connect() and send() for datagram sockets\n" " -f bind socket with the IP[V6]_FREEBIND option\n" " -C use cmsg and IP_PKTINFO to specify device binding\n" "\n" @@ -2074,6 +2083,9 @@ int main(int argc, char *argv[]) case 'x': args.use_xfrm = 1; break; + case 'U': + args.datagram_connect = 1; + break; default: print_usage(argv[0]); return 1; From patchwork Sat Oct 22 07:27: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: 7801 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1133705wrr; Sat, 22 Oct 2022 03:05:14 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6z2fyPEx7meI6Yf5hsjH8evv3ZAHR0Lvi4VMSv7XwrYM8rvqsuLuTHL3LtNMHpuZo/1c2Z X-Received: by 2002:a17:906:d54d:b0:78e:2fbf:ca2a with SMTP id cr13-20020a170906d54d00b0078e2fbfca2amr19793392ejc.488.1666433114282; Sat, 22 Oct 2022 03:05:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666433114; cv=none; d=google.com; s=arc-20160816; b=JSzQFAqYcfAZD0hlJk0NuZ3nNVYJQ4KXBGppZY76oAiy9qM+oDtwn4MjGIfjzPN966 FZkVKuHFvo4LrSEr4Dxpaynco//0KuL5iul2uwx1f/Hr9Qnk74MG5Ja3tzhzjubVuin5 71Jo1qQZaU+pRQ2hhtn2Sgc5TZk6G3ReI30SODIMOyO0nnidqtegshIs9Tqlv1xAxRej 0vQVB4xn3rqQ5Zsh3T7ce5LbpP4zv9sXUH40HT9e29ufrGKO0CsWR3otLuBN+ZD6sCjC zZ4eB8CYOc9iVBm/Oa6PUpJx+t9osqdmwK1X6A2gWJmRENAK0CjySx9MX4GFFaBjjVA7 9UHw== 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=9R3SVjxd/uFQX/hq2iVgj/y4Cke6BXejPQ59Zwficek=; b=oNDMm6R0v1CWtxWak5RCLEVU+xPiglAz/G+wtNTku05L1k3ubzD54gbajSOZCSvnZg QA265uI5a8yweVPSd+Vpt10LQ87GqIg3AGGWrKYUpN30EIESH8+EED+RScSGbIBFMTss R/EuRFhXbNlHZWwBCN54qXUSQAXUh6AqXOA2TDKuLtPjx3Cy22sQZdXuSFr0t7R5Myz2 mEmm6a6iULBqluuI4XNyoxnZUzJ9k3z+U1d3wrwDmBe1tcLW0RKXeY67qJML54R0cdH9 RBkeoYS4lnyAFacCqsrgobjbbE7hBFEW9yIfeKNXF5taiWiY7GGWagZue8cyOkB5mi07 EntQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=wcnlpNU8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 dn10-20020a17090794ca00b00791a84056d9si9925333ejc.751.2022.10.22.03.04.49; Sat, 22 Oct 2022 03:05: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=wcnlpNU8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S230398AbiJVJuY (ORCPT + 99 others); Sat, 22 Oct 2022 05:50:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37000 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230155AbiJVJtt (ORCPT ); Sat, 22 Oct 2022 05:49:49 -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 5A66E2D2C36; Sat, 22 Oct 2022 02:01: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 476DF60B4A; Sat, 22 Oct 2022 08:00:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2DC85C433D6; Sat, 22 Oct 2022 08:00:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425647; bh=0yRnkpEfxS7tWFboF4T+L+HG5P/SvlF22wbvGiSDb4M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wcnlpNU8U19wh9HbF0/BBh1U+R2MByKH8bgYibwr0cvNBBJzA7IPKtDseDqbDH7VZ GdQB412pm85LoiLjiE4N11bj+3Gf5vZXvs87mQ3bDH+bAeTqLxH6fdDnjR6e/lkoNc AStWtcJ+7zQ6FRXa+qUdXpMGE8cMLogKINnbtm+k= 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 5.19 570/717] xfrm: Update ipcomp_scratches with NULL when freed Date: Sat, 22 Oct 2022 09:27:29 +0200 Message-Id: <20221022072523.614085687@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 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?1747381769221263766?= X-GMAIL-MSGID: =?utf-8?q?1747381769221263766?= 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 cb40ff0ff28d..92ad336a83ab 100644 --- a/net/xfrm/xfrm_ipcomp.c +++ b/net/xfrm/xfrm_ipcomp.c @@ -203,6 +203,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 Sat Oct 22 07:27: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: 7757 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1117559wrr; Sat, 22 Oct 2022 02:16:42 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4HvTagP+I/WYkO0jfWKQRbW0Zj1XnxckjphBZRtn6o/R8U/TphYoVMhx/x6Li+mQLzPIPb X-Received: by 2002:a63:211a:0:b0:451:f444:3b55 with SMTP id h26-20020a63211a000000b00451f4443b55mr19099516pgh.60.1666430202468; Sat, 22 Oct 2022 02:16:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666430202; cv=none; d=google.com; s=arc-20160816; b=WqJaG3BcAFtQYbcO1P52+fxhF/zwCm7Q3NfQZc4BPcl1Ggcqn5YUISAX8sbFk15JkQ zMwJsFOJby26wdlRr5KhW3BWtk7seRJv/WCb4t0zRQ4n2NLhM4BOK9DqI2FBu9snPAJa 9hKdzrt1BpZxji56d9AB6awvT4HHvTy738gl0x7heQOUFacBh63oWA2TQ1XXfpUejzeQ eINa9RtsMJLy4WtturmzPMoxgkUH4rtFneAfzSpcCzgvSXNlRtvEkq/Nd/i3zvZWYOsY 3ejOGCOIlm/D81X8654pf5E0jX3DCj3AVVvh71HoPz1W8d9fYsfp+Rr8eg/QoWiKnHpN nrgQ== 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=xRs5jVhGvoJYvS/teW4WZtS88vXwJJIJzR536EdM4hI=; b=NtEnxHVpHQMaOPJcAMKbJi6eoXnzVZg9jv8fJTg4KveNyhWDRgp9JzNHCPTbNDDk4P Oxbqxv9S4gji+X01/sijZTr/yNhgyT8QFQkazALlpsqkzx6HwY6e5iEZATp0H5nv4s7L MpTcMgd0A9AWAqDm4vnYsVXsGQVhWyMRYzgzVwAtsPIh5s9vQJ0xOlqcu1jZQ1oiE9m6 zjD5pMJliPNSr/4fVC/pJmBgcmWj5ZlibBbI4UH/cP6jod/iOLGickkTfcIFvC+JvrB2 2DlyvBsoR4YwEcrovDJWzD+X0TisS/CADpC3EA99sKekyUj4KTJ6I3gCGIxqCOTZRdZz VKLA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=TEejyQoY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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-20020a170902ecc800b00184fa228b8dsi29579817plh.574.2022.10.22.02.16.19; Sat, 22 Oct 2022 02:16: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=TEejyQoY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S234943AbiJVIzh (ORCPT + 99 others); Sat, 22 Oct 2022 04:55:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44906 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235066AbiJVIyP (ORCPT ); Sat, 22 Oct 2022 04:54: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 6291B63D0A; Sat, 22 Oct 2022 01:13:22 -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 09A31B82E3B; Sat, 22 Oct 2022 08:00:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 47030C433D7; Sat, 22 Oct 2022 08:00:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425650; bh=PytxVOSr5jFXPJQvawqoj1wVm66oLH6DZCYSKa7TKrc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TEejyQoY9+lqSWWPoD1x6kdgalZlYzzbAk+l6H6g+EIkns4v/Xdd0U+fxo4xrsPT/ ih4lKcKVXHCvZr9vBsFR0saiDsefLLq2sMwjFhRDfUVyNHpGEZsJ1FMeCtYb3LO7zb YxDs9Ls+FNGeLrZohaBqDYNkgUa7ACx7oZfsKCQY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Manikanta Pubbisetty , Kalle Valo , Sasha Levin Subject: [PATCH 5.19 571/717] wifi: ath11k: Register shutdown handler for WCN6750 Date: Sat, 22 Oct 2022 09:27:30 +0200 Message-Id: <20221022072523.662784372@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747378716317872852?= X-GMAIL-MSGID: =?utf-8?q?1747378716317872852?= From: Manikanta Pubbisetty [ Upstream commit ac41c2b642b136a1e633379fcb87a9db0ee07f5b ] When the system shuts down, SMMU driver will be stopped and will not assist in IOVA translations. SMMU driver expects all of its consumers to shutdown before shutting down itself. WCN6750 being one of the consumer device should not perform any DMA operations after the SMMU has shutdown which will otherwise result in SMMU faults. SMMU driver will call the shutdown() callback of all its consumer devices and the consumers shall stop further DMA activity after the invocation of their respective shutdown() callbacks. Register the shutdown() callback to the platform core for WCN6750. Change will not impact other AHB ath11k devices. Tested-on: WCN6750 hw1.0 AHB WLAN.MSL.1.0.1-00887-QCAMSLSWPLZ-1 Signed-off-by: Manikanta Pubbisetty Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/20220720134710.15523-1-quic_mpubbise@quicinc.com Signed-off-by: Sasha Levin --- drivers/net/wireless/ath/ath11k/ahb.c | 58 ++++++++++++++++++++------ drivers/net/wireless/ath/ath11k/core.c | 2 + 2 files changed, 47 insertions(+), 13 deletions(-) diff --git a/drivers/net/wireless/ath/ath11k/ahb.c b/drivers/net/wireless/ath/ath11k/ahb.c index c47414710138..911eee9646a4 100644 --- a/drivers/net/wireless/ath/ath11k/ahb.c +++ b/drivers/net/wireless/ath/ath11k/ahb.c @@ -1088,20 +1088,10 @@ static int ath11k_ahb_probe(struct platform_device *pdev) return ret; } -static int ath11k_ahb_remove(struct platform_device *pdev) +static void ath11k_ahb_remove_prepare(struct ath11k_base *ab) { - struct ath11k_base *ab = platform_get_drvdata(pdev); unsigned long left; - if (test_bit(ATH11K_FLAG_QMI_FAIL, &ab->dev_flags)) { - ath11k_ahb_power_down(ab); - ath11k_debugfs_soc_destroy(ab); - ath11k_qmi_deinit_service(ab); - goto qmi_fail; - } - - reinit_completion(&ab->driver_recovery); - if (test_bit(ATH11K_FLAG_RECOVERY, &ab->dev_flags)) { left = wait_for_completion_timeout(&ab->driver_recovery, ATH11K_AHB_RECOVERY_TIMEOUT); @@ -1111,19 +1101,60 @@ static int ath11k_ahb_remove(struct platform_device *pdev) set_bit(ATH11K_FLAG_UNREGISTERING, &ab->dev_flags); cancel_work_sync(&ab->restart_work); + cancel_work_sync(&ab->qmi.event_work); +} + +static void ath11k_ahb_free_resources(struct ath11k_base *ab) +{ + struct platform_device *pdev = ab->pdev; - ath11k_core_deinit(ab); -qmi_fail: ath11k_ahb_free_irq(ab); ath11k_hal_srng_deinit(ab); ath11k_ahb_fw_resource_deinit(ab); ath11k_ce_free_pipes(ab); ath11k_core_free(ab); platform_set_drvdata(pdev, NULL); +} + +static int ath11k_ahb_remove(struct platform_device *pdev) +{ + struct ath11k_base *ab = platform_get_drvdata(pdev); + + if (test_bit(ATH11K_FLAG_QMI_FAIL, &ab->dev_flags)) { + ath11k_ahb_power_down(ab); + ath11k_debugfs_soc_destroy(ab); + ath11k_qmi_deinit_service(ab); + goto qmi_fail; + } + + ath11k_ahb_remove_prepare(ab); + ath11k_core_deinit(ab); + +qmi_fail: + ath11k_ahb_free_resources(ab); return 0; } +static void ath11k_ahb_shutdown(struct platform_device *pdev) +{ + struct ath11k_base *ab = platform_get_drvdata(pdev); + + /* platform shutdown() & remove() are mutually exclusive. + * remove() is invoked during rmmod & shutdown() during + * system reboot/shutdown. + */ + ath11k_ahb_remove_prepare(ab); + + if (!(test_bit(ATH11K_FLAG_REGISTERED, &ab->dev_flags))) + goto free_resources; + + ath11k_core_deinit(ab); + +free_resources: + ath11k_ahb_free_resources(ab); +} + static struct platform_driver ath11k_ahb_driver = { .driver = { .name = "ath11k", @@ -1131,6 +1162,7 @@ static struct platform_driver ath11k_ahb_driver = { }, .probe = ath11k_ahb_probe, .remove = ath11k_ahb_remove, + .shutdown = ath11k_ahb_shutdown, }; static int ath11k_ahb_init(void) diff --git a/drivers/net/wireless/ath/ath11k/core.c b/drivers/net/wireless/ath/ath11k/core.c index 6ddc698f4a2d..209345bedd09 100644 --- a/drivers/net/wireless/ath/ath11k/core.c +++ b/drivers/net/wireless/ath/ath11k/core.c @@ -1635,6 +1635,8 @@ static void ath11k_core_pre_reconfigure_recovery(struct ath11k_base *ab) wake_up(&ab->wmi_ab.tx_credits_wq); wake_up(&ab->peer_mapping_wq); + + reinit_completion(&ab->driver_recovery); } static void ath11k_core_post_reconfigure_recovery(struct ath11k_base *ab) From patchwork Sat Oct 22 07:27: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: 7699 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1109304wrr; Sat, 22 Oct 2022 01:48:00 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4F0ytaHzrEJg88oOKHPQfHLeqW8/kgZ9Y9TDsb8b6M2ngsEyzvb0F4uq1CRg2nllXU/ULY X-Received: by 2002:a17:907:1c96:b0:78d:fe6b:9891 with SMTP id nb22-20020a1709071c9600b0078dfe6b9891mr19075327ejc.746.1666428480220; Sat, 22 Oct 2022 01:48:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666428480; cv=none; d=google.com; s=arc-20160816; b=d8B/Ris+aC20YYAdwthRWYOwS0Na9VtbCfu6shVu3UWyD92SGRZlnRbD8tzRs+uy6E A46srVUnV1lPcR3+xkU9U7390GPIYHSsBDhPnfqmh9VI7OcYa4gOmUm4jKCUrzNIVR5n BaWf9mySH9hTHDTj4JWYCtK9bYjXcB5Epz37DI2PC9tS9FlHfjDMjih6NaHkv1Aoyga0 lw27BV4ihFuXeOqqRdZ2LgqY4KyZQ39VTxnOn6PusZZSxfNWjK9GtKzcOFRjroeZ+5o8 t5oKqhF/8iSBAx24t3HzyDtBGr0wE/5ctOXDWqcMNlMqtQTKkgfYQOniUT4UgDjvUx/p GFLg== 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=VnowpqzodCJVjRHd3VI+8q4j6jT9mcYiIOwg/lilhyw=; b=LPRv0itu+6XbAtLaIDce++RJw/uB0RwalgFdsf/vOsyUtsMlz4+bsSINtYHIw8fXSd VGt6fuXNrREURliL69I8SBu5w20a45pB99oFuGfjdQemBj24nWRwruAept79XxwtlcWh I0nzgMHkOyit6mOvrHcaK3Wk30hRFHxCSju5gatGCID4L5nO9+gcuC+9Agigkj5PGujA xCaEOepBTNAqvNdtIky5+6PPi3+2zflOhTKdb7kE7oD2H33lH/nqfZxd0PuGHigu/YyE ZtGlzBTYgshiK21iED00a+Wxq8ph0y4zsFhRoWpLyRiYvS6hHhzY5TthpGU+/txYLL8B kamQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=0uTP5fK5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 l20-20020aa7cad4000000b0045bc92ef2c0si19254362edt.195.2022.10.22.01.47.36; Sat, 22 Oct 2022 01:48: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=0uTP5fK5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S234879AbiJVIrF (ORCPT + 99 others); Sat, 22 Oct 2022 04:47:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52878 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235128AbiJVIom (ORCPT ); Sat, 22 Oct 2022 04:44:42 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 323372EBBA6; Sat, 22 Oct 2022 01:08: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 41C4560BA3; Sat, 22 Oct 2022 08:00:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 51ABEC433D6; Sat, 22 Oct 2022 08:00:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425653; bh=ihi/X+jRwStHBrEQc38wWsGR2lD4+0D/n45zAeO5vlU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0uTP5fK5PgMPf8G6iaQYDxqHFNNoqvW8UnVPEA/D7DFdm6BHdhHYazUahZ4vjprWS 6VH2I4v8Uzi6lQphGrfNnCHx73SBL/V/FnyKn8PmrIjbkeP0cnk+c2a3VoE9QNC7ox 637k2vCJVYE+qijGXyikBIwWUydG/tC1hnzllyUA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zong-Zhe Yang , Ping-Ke Shih , Kalle Valo , Sasha Levin Subject: [PATCH 5.19 572/717] rtw89: ser: leave lps with mutex Date: Sat, 22 Oct 2022 09:27:31 +0200 Message-Id: <20221022072523.707440640@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376909849946821?= X-GMAIL-MSGID: =?utf-8?q?1747376909849946821?= From: Zong-Zhe Yang [ Upstream commit 8676031bae1c91037d06341214f4150b33707c68 ] Calling rtw89_leave_lps() should hold rtwdev::mutex. So, fix it. Signed-off-by: Zong-Zhe Yang Signed-off-by: Ping-Ke Shih Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/20220704023453.19935-5-pkshih@realtek.com Signed-off-by: Sasha Levin --- drivers/net/wireless/realtek/rtw89/ser.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/net/wireless/realtek/rtw89/ser.c b/drivers/net/wireless/realtek/rtw89/ser.c index 9e95ed972710..5d88200cbd3e 100644 --- a/drivers/net/wireless/realtek/rtw89/ser.c +++ b/drivers/net/wireless/realtek/rtw89/ser.c @@ -152,7 +152,10 @@ static void ser_state_run(struct rtw89_ser *ser, u8 evt) rtw89_debug(rtwdev, RTW89_DBG_SER, "ser: %s receive %s\n", ser_st_name(ser), ser_ev_name(ser, evt)); + mutex_lock(&rtwdev->mutex); rtw89_leave_lps(rtwdev); + mutex_unlock(&rtwdev->mutex); + ser->st_tbl[ser->state].st_func(ser, evt); } From patchwork Sat Oct 22 07:27: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: 7551 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1105904wrr; Sat, 22 Oct 2022 01:36:29 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7xMpy0Y+Ko3vwZ8NX+OdmjndOm6SnUrXwodE7rssewUlXgT2s+G5toCxsjQPt7WfIZqszN X-Received: by 2002:a63:db58:0:b0:443:575e:d1ed with SMTP id x24-20020a63db58000000b00443575ed1edmr19341498pgi.468.1666427788978; Sat, 22 Oct 2022 01:36:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666427788; cv=none; d=google.com; s=arc-20160816; b=To+dPf1MI88XqCxKluFjA6lAqIs5/2ilxOToALT+D1+lP453v2/XNUh7Cb7iXy4+8V azw8c8SPdU27UgCm8CgSXbKrFb7UsSozj3qMVNPLTxKR0E97LUzUcHPmr0nDLtbClIG6 zzl3lKLvLHIU90iob44YMCVSwI1CMfrQOpDQD2c8LZlDN0/L8dz7i1Psn7UgydlqXv8e ESJWXb+CQ9dUgpHHwV0+oYGfMoMEuqO/NCk9fq7FqxTmNHfJqpdUB5d2Xtm/sS61M0SW NghLXf16xCVwRJl/oGWw2rAa3jD0+bArv+tZk734SAPrSp0Vo5SJygV8g+ZBXO8zvl3Q ZPkg== 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=k1AzmibCdITQKelm2NkcnU2QfPSD2aaXTkGEZsIaCIQ=; b=F6LjdqQHB95Iq8chStdmEgPIz08AMDtJkwgAkML7HA87Sr03PGR1ziX6gPTrD7NTxm m+ZTUOYwIlDWnCQ/WD+qGb2fpAsS1hapAeaBjlJHZPxxFJphrqdTaTIJevklvZ5sxXmQ 7jSA7xYNynJklKERuaueuxXai+tJJ+jBiJ2rM10wgmi3CONEpPQNX3nw/cGbpGFfkKKh 2NxaVvd16rvj0/g03Ne1ZU9NR9qPUHR4Tsd6lqxS5BXRqTIQ2GzyC+vImk9iiBQsI9DM NF90GBL5kGpPHVapbNkHdZO6h/Nk4P/u+3Sbg/6fn47ZaY8l+EF0VV6I3CXXgdlrvXDH rZfQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=SjYpLuF0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 j3-20020a654283000000b00452a7b4f50bsi27432373pgp.48.2022.10.22.01.36.13; Sat, 22 Oct 2022 01:36: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=SjYpLuF0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S233933AbiJVI2r (ORCPT + 99 others); Sat, 22 Oct 2022 04:28:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37068 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229930AbiJVI1m (ORCPT ); Sat, 22 Oct 2022 04:27: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 6D3D029CB9F; Sat, 22 Oct 2022 01:01: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 23DFCB82E37; Sat, 22 Oct 2022 08:00:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 50033C433D6; Sat, 22 Oct 2022 08:00:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425656; bh=mbOqe3BvSY+Utn4ID69aJOshzLQV9w7fqEBjvKww5wQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SjYpLuF0Kmn/AHnR38Q7K+1TVIs4+hMVctUiAeFEO5pfp3wVNLt5WPQNj/UxbFClH O8DBKTn0PS8YiBBwYWE1VkygEuhuWEbm31AQe8902f5pH77wocAj6FEJPgnkRvjA2o 8kX7LNX8D8MtqPdWGUrQhAevQCIt4GWp+x2390R4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Michal Jaron , Mateusz Palczewski , Konrad Jankowski , Tony Nguyen , Sasha Levin Subject: [PATCH 5.19 573/717] iavf: Fix race between iavf_close and iavf_reset_task Date: Sat, 22 Oct 2022 09:27:32 +0200 Message-Id: <20221022072523.758018450@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376185220978208?= X-GMAIL-MSGID: =?utf-8?q?1747376185220978208?= From: Michal Jaron [ Upstream commit 11c12adcbc1598d91e73ab6ddfa41d25a01478ed ] During stress tests with adding VF to namespace and changing vf's trust there was a race between iavf_reset_task and iavf_close. Sometimes when IAVF_FLAG_AQ_DISABLE_QUEUES from iavf_close was sent to PF after reset and before IAVF_AQ_GET_CONFIG was sent then PF returns error IAVF_NOT_SUPPORTED to disable queues request and following requests. There is need to get_config before other aq_required will be send but iavf_close clears all flags, if get_config was not sent before iavf_close, then it will not be send at all. In case when IAVF_FLAG_AQ_GET_OFFLOAD_VLAN_V2_CAPS was sent before IAVF_FLAG_AQ_DISABLE_QUEUES then there was rtnl_lock deadlock between iavf_close and iavf_adminq_task until iavf_close timeouts and disable queues was sent after iavf_close ends. There was also a problem with sending delete/add filters. Sometimes when filters was not yet added to PF and in iavf_close all filters was set to remove there might be a try to remove nonexistent filters on PF. Add aq_required_tmp to save aq_required flags and send them after disable_queues will be handled. Clear flags given to iavf_down different than IAVF_FLAG_AQ_GET_CONFIG as this flag is necessary to sent other aq_required. Remove some flags that we don't want to send as we are in iavf_close and we want to disable interface. Remove filters which was not yet sent and send del filters flags only when there are filters to remove. Signed-off-by: Michal Jaron Signed-off-by: Mateusz Palczewski Tested-by: Konrad Jankowski Signed-off-by: Tony Nguyen Signed-off-by: Sasha Levin --- drivers/net/ethernet/intel/iavf/iavf_main.c | 177 ++++++++++++++++---- 1 file changed, 141 insertions(+), 36 deletions(-) diff --git a/drivers/net/ethernet/intel/iavf/iavf_main.c b/drivers/net/ethernet/intel/iavf/iavf_main.c index 981c43b204ff..d3822c264642 100644 --- a/drivers/net/ethernet/intel/iavf/iavf_main.c +++ b/drivers/net/ethernet/intel/iavf/iavf_main.c @@ -1184,66 +1184,138 @@ static void iavf_up_complete(struct iavf_adapter *adapter) } /** - * iavf_down - Shutdown the connection processing + * iavf_clear_mac_vlan_filters - Remove mac and vlan filters not sent to PF + * yet and mark other to be removed. * @adapter: board private structure - * - * Expects to be called while holding the __IAVF_IN_CRITICAL_TASK bit lock. **/ -void iavf_down(struct iavf_adapter *adapter) +static void iavf_clear_mac_vlan_filters(struct iavf_adapter *adapter) { - struct net_device *netdev = adapter->netdev; - struct iavf_vlan_filter *vlf; - struct iavf_cloud_filter *cf; - struct iavf_fdir_fltr *fdir; - struct iavf_mac_filter *f; - struct iavf_adv_rss *rss; - - if (adapter->state <= __IAVF_DOWN_PENDING) - return; - - netif_carrier_off(netdev); - netif_tx_disable(netdev); - adapter->link_up = false; - iavf_napi_disable_all(adapter); - iavf_irq_disable(adapter); + struct iavf_vlan_filter *vlf, *vlftmp; + struct iavf_mac_filter *f, *ftmp; spin_lock_bh(&adapter->mac_vlan_list_lock); - /* clear the sync flag on all filters */ __dev_uc_unsync(adapter->netdev, NULL); __dev_mc_unsync(adapter->netdev, NULL); /* remove all MAC filters */ - list_for_each_entry(f, &adapter->mac_filter_list, list) { - f->remove = true; + list_for_each_entry_safe(f, ftmp, &adapter->mac_filter_list, + list) { + if (f->add) { + list_del(&f->list); + kfree(f); + } else { + f->remove = true; + } } /* remove all VLAN filters */ - list_for_each_entry(vlf, &adapter->vlan_filter_list, list) { - vlf->remove = true; + list_for_each_entry_safe(vlf, vlftmp, &adapter->vlan_filter_list, + list) { + if (vlf->add) { + list_del(&vlf->list); + kfree(vlf); + } else { + vlf->remove = true; + } } - spin_unlock_bh(&adapter->mac_vlan_list_lock); +} + +/** + * iavf_clear_cloud_filters - Remove cloud filters not sent to PF yet and + * mark other to be removed. + * @adapter: board private structure + **/ +static void iavf_clear_cloud_filters(struct iavf_adapter *adapter) +{ + struct iavf_cloud_filter *cf, *cftmp; /* remove all cloud filters */ spin_lock_bh(&adapter->cloud_filter_list_lock); - list_for_each_entry(cf, &adapter->cloud_filter_list, list) { - cf->del = true; + list_for_each_entry_safe(cf, cftmp, &adapter->cloud_filter_list, + list) { + if (cf->add) { + list_del(&cf->list); + kfree(cf); + adapter->num_cloud_filters--; + } else { + cf->del = true; + } } spin_unlock_bh(&adapter->cloud_filter_list_lock); +} + +/** + * iavf_clear_fdir_filters - Remove fdir filters not sent to PF yet and mark + * other to be removed. + * @adapter: board private structure + **/ +static void iavf_clear_fdir_filters(struct iavf_adapter *adapter) +{ + struct iavf_fdir_fltr *fdir, *fdirtmp; /* remove all Flow Director filters */ spin_lock_bh(&adapter->fdir_fltr_lock); - list_for_each_entry(fdir, &adapter->fdir_list_head, list) { - fdir->state = IAVF_FDIR_FLTR_DEL_REQUEST; + list_for_each_entry_safe(fdir, fdirtmp, &adapter->fdir_list_head, + list) { + if (fdir->state == IAVF_FDIR_FLTR_ADD_REQUEST) { + list_del(&fdir->list); + kfree(fdir); + adapter->fdir_active_fltr--; + } else { + fdir->state = IAVF_FDIR_FLTR_DEL_REQUEST; + } } spin_unlock_bh(&adapter->fdir_fltr_lock); +} + +/** + * iavf_clear_adv_rss_conf - Remove adv rss conf not sent to PF yet and mark + * other to be removed. + * @adapter: board private structure + **/ +static void iavf_clear_adv_rss_conf(struct iavf_adapter *adapter) +{ + struct iavf_adv_rss *rss, *rsstmp; /* remove all advance RSS configuration */ spin_lock_bh(&adapter->adv_rss_lock); - list_for_each_entry(rss, &adapter->adv_rss_list_head, list) - rss->state = IAVF_ADV_RSS_DEL_REQUEST; + list_for_each_entry_safe(rss, rsstmp, &adapter->adv_rss_list_head, + list) { + if (rss->state == IAVF_ADV_RSS_ADD_REQUEST) { + list_del(&rss->list); + kfree(rss); + } else { + rss->state = IAVF_ADV_RSS_DEL_REQUEST; + } + } spin_unlock_bh(&adapter->adv_rss_lock); +} + +/** + * iavf_down - Shutdown the connection processing + * @adapter: board private structure + * + * Expects to be called while holding the __IAVF_IN_CRITICAL_TASK bit lock. + **/ +void iavf_down(struct iavf_adapter *adapter) +{ + struct net_device *netdev = adapter->netdev; + + if (adapter->state <= __IAVF_DOWN_PENDING) + return; + + netif_carrier_off(netdev); + netif_tx_disable(netdev); + adapter->link_up = false; + iavf_napi_disable_all(adapter); + iavf_irq_disable(adapter); + + iavf_clear_mac_vlan_filters(adapter); + iavf_clear_cloud_filters(adapter); + iavf_clear_fdir_filters(adapter); + iavf_clear_adv_rss_conf(adapter); if (!(adapter->flags & IAVF_FLAG_PF_COMMS_FAILED)) { /* cancel any current operation */ @@ -1252,11 +1324,16 @@ void iavf_down(struct iavf_adapter *adapter) * here for this to complete. The watchdog is still running * and it will take care of this. */ - adapter->aq_required = IAVF_FLAG_AQ_DEL_MAC_FILTER; - adapter->aq_required |= IAVF_FLAG_AQ_DEL_VLAN_FILTER; - adapter->aq_required |= IAVF_FLAG_AQ_DEL_CLOUD_FILTER; - adapter->aq_required |= IAVF_FLAG_AQ_DEL_FDIR_FILTER; - adapter->aq_required |= IAVF_FLAG_AQ_DEL_ADV_RSS_CFG; + if (!list_empty(&adapter->mac_filter_list)) + adapter->aq_required |= IAVF_FLAG_AQ_DEL_MAC_FILTER; + if (!list_empty(&adapter->vlan_filter_list)) + adapter->aq_required |= IAVF_FLAG_AQ_DEL_VLAN_FILTER; + if (!list_empty(&adapter->cloud_filter_list)) + adapter->aq_required |= IAVF_FLAG_AQ_DEL_CLOUD_FILTER; + if (!list_empty(&adapter->fdir_list_head)) + adapter->aq_required |= IAVF_FLAG_AQ_DEL_FDIR_FILTER; + if (!list_empty(&adapter->adv_rss_list_head)) + adapter->aq_required |= IAVF_FLAG_AQ_DEL_ADV_RSS_CFG; adapter->aq_required |= IAVF_FLAG_AQ_DISABLE_QUEUES; } @@ -4082,6 +4159,7 @@ static int iavf_open(struct net_device *netdev) static int iavf_close(struct net_device *netdev) { struct iavf_adapter *adapter = netdev_priv(netdev); + u64 aq_to_restore; int status; mutex_lock(&adapter->crit_lock); @@ -4094,6 +4172,29 @@ static int iavf_close(struct net_device *netdev) set_bit(__IAVF_VSI_DOWN, adapter->vsi.state); if (CLIENT_ENABLED(adapter)) adapter->flags |= IAVF_FLAG_CLIENT_NEEDS_CLOSE; + /* We cannot send IAVF_FLAG_AQ_GET_OFFLOAD_VLAN_V2_CAPS before + * IAVF_FLAG_AQ_DISABLE_QUEUES because in such case there is rtnl + * deadlock with adminq_task() until iavf_close timeouts. We must send + * IAVF_FLAG_AQ_GET_CONFIG before IAVF_FLAG_AQ_DISABLE_QUEUES to make + * disable queues possible for vf. Give only necessary flags to + * iavf_down and save other to set them right before iavf_close() + * returns, when IAVF_FLAG_AQ_DISABLE_QUEUES will be already sent and + * iavf will be in DOWN state. + */ + aq_to_restore = adapter->aq_required; + adapter->aq_required &= IAVF_FLAG_AQ_GET_CONFIG; + + /* Remove flags which we do not want to send after close or we want to + * send before disable queues. + */ + aq_to_restore &= ~(IAVF_FLAG_AQ_GET_CONFIG | + IAVF_FLAG_AQ_ENABLE_QUEUES | + IAVF_FLAG_AQ_CONFIGURE_QUEUES | + IAVF_FLAG_AQ_ADD_VLAN_FILTER | + IAVF_FLAG_AQ_ADD_MAC_FILTER | + IAVF_FLAG_AQ_ADD_CLOUD_FILTER | + IAVF_FLAG_AQ_ADD_FDIR_FILTER | + IAVF_FLAG_AQ_ADD_ADV_RSS_CFG); iavf_down(adapter); iavf_change_state(adapter, __IAVF_DOWN_PENDING); @@ -4117,6 +4218,10 @@ static int iavf_close(struct net_device *netdev) msecs_to_jiffies(500)); if (!status) netdev_warn(netdev, "Device resources not yet released\n"); + + mutex_lock(&adapter->crit_lock); + adapter->aq_required |= aq_to_restore; + mutex_unlock(&adapter->crit_lock); return 0; } From patchwork Sat Oct 22 07:27: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: 7552 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1105919wrr; Sat, 22 Oct 2022 01:36:30 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7V2QiqrcSdlSoASe/goaBO9irPGmhcxd75evRGGvsA0NM4f9r5YMSYPshRLUqfx3+RmgX0 X-Received: by 2002:a17:90a:aa8f:b0:210:bec0:bde with SMTP id l15-20020a17090aaa8f00b00210bec00bdemr17692473pjq.109.1666427790240; Sat, 22 Oct 2022 01:36:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666427790; cv=none; d=google.com; s=arc-20160816; b=v2LapB6JC4TlChQQeU53D/gl4R6KPEVIqvG7pyHoEa7gywkgk0vaKxYCCKPrO4lJ8M hBcBemmpS1pi1nX23rSv/vDLsA5j70eFNKGeuff6vd/guqopuVGon85OoRX8gJgF/B66 EJcZYzHEzS264bcsYaXoSCYFMpEa9QgVel5HYVhDjJ/tifDFduDfKfk30bOi/a0z01IJ lmZwXgBf/6hZv+aDCPf2z7+MUY6016YoC7/C3jhLQzPRzWepFvgs13/ZMDF3/gPSGXv+ QgKTyTVgiE7oQewYRhsP5eAssaOwKWsGVlxnxv1eLnyVCivNbnt1QrvAIDCKpNTzPkO1 gMpg== 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=gacahjS1rHmlSOcc9cVNM/7AcquHVDiYf+nALwWQlCY=; b=eBl9y3fAtMEJCoAbbup86gRxvO88tkBAMntQpxDR8jDmTW54seCPwaKnRYpMIxaZg6 AMYgMJvxSMMpJB8ye/SghAgkbSDUjHrC3EIIsTaeBBFpIVRRzXz4zaQaFPsR41QhlEyy pY0ZU/U1KYvWIQEdz4PXA5MeRZAuDV2OmRI095IzsPspWTEjY3Z/6dCYj0qUGMnJJzv5 gGyIoWXX2ZKWWf8sQMpmTgRa+gV7Pajs8TspDJMdq5mEXXkulODSi6ETgLl+7nGY9HHy +VZs01ifVGgeO/cV/3AA3ETjFKmr7c9obi8VaSbPsz+X5b69XK95gvSabl+Si5Xtt1Kn 0HvQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="eMpAL8/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 g13-20020a63520d000000b004609faa2dbesi26882060pgb.285.2022.10.22.01.36.15; Sat, 22 Oct 2022 01:36: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="eMpAL8/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 S233943AbiJVI26 (ORCPT + 99 others); Sat, 22 Oct 2022 04:28:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54086 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233730AbiJVI2J (ORCPT ); Sat, 22 Oct 2022 04:28:09 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C6D7425E8A0; Sat, 22 Oct 2022 01: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 11AFB60B9D; Sat, 22 Oct 2022 08:01:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 20B48C433D6; Sat, 22 Oct 2022 08:01:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425662; bh=NHEjJVrZvUvMWNIvHVgwp4lBBm2EaaAchr0kmunblMM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eMpAL8/geS32970+90DAxKYofrw6ZWCGfzcDRzbo9ztMGppN9m+y2HqEJrTUj4ir+ 34lTMyglJf2uyDGWoARWSHUNi5pCN372m+RBPuY5D3BIRcRwLUKjleVIG+XLk1UwXV LV/FLZ2DRX2ceBoj306CqnptfEzK7ymAD2t3gssg= 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 5.19 574/717] wifi: brcmfmac: fix use-after-free bug in brcmf_netdev_start_xmit() Date: Sat, 22 Oct 2022 09:27:33 +0200 Message-Id: <20221022072523.806165233@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376186184734557?= X-GMAIL-MSGID: =?utf-8?q?1747376186184734557?= 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 87aef211b35f..12ee8b7163fd 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c @@ -296,6 +296,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); @@ -370,7 +371,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 Sat Oct 22 07:27: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: 7578 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1106273wrr; Sat, 22 Oct 2022 01:37:24 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5CwMXolscGVrVgVmVyFebxfgeSMQPBZ339TgC55GgijTGUtVEYXfVQPs68X+4kGMCFQ7sj X-Received: by 2002:a05:6402:d58:b0:458:5eca:a2c9 with SMTP id ec24-20020a0564020d5800b004585ecaa2c9mr21658649edb.306.1666427833301; Sat, 22 Oct 2022 01:37:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666427833; cv=none; d=google.com; s=arc-20160816; b=xzID+hyo1ikaIyeU1is389Nj7yeqbFyS4B2zlnlXJlM/rT2ByqyFog8iszyiW3cMF0 yy23azTXLBDYCMt/Q4Y4AJoPMfWknhzBzVYq7zOm81K5fzpuOOhx/rYM5f69rwtZjCfT fnEecEGmohKvsxoNI3Hr+AOX/J6tvSOIqP+t2HLjRmitZ8pZSXFt/I2BtFG3IixuoAig IZ+ueTyadXCT9RM684YEkFYZY0Ahcg32/8C7nI9MB2jYCSmCUa1rpyH6KgQ7sphsmv/E SSUYw1jg0sX2Mv6O9a7Mf4/BGXtCLxoa6PMkfBSF1Y8PJziNcxARg8dy5lsRx9xAKsaE gCVA== 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=8+1rqTQTPVNCkRIel0xMlChNibIJqrOfisvBx5QqSgY=; b=aAFjgETZANJli3m/HyfIppLoHNeJGQPX47QDJ4ApqEIp+C9YCF3wejckSTJouRq6Si M2VTZbNo5UElDom5yOqN2fdeCpHLZfdqUkcj1nz4gXFT9SKHShRaPdot5sPaluc4J8xL sKbYG5zWqa05PjtTFS9NQzISL+OtFeUX2DNt43iDozJb0RyRGQ5Cq9Pe9jfd6LaBs2ln pr4g3XDo4u+8+yvLCNCcZ8pXcLaqNzfdslvG4fWMDIsw511YuA31wAHeCzzKdF5EErqi Wi+HCulZcVIdmeCxqwyNQswlWZBrtN8ZLhmdEJ6TT0+wcyw1pVg1nMjIVq07rZPH0I9w gFjw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=hXZxQuyH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 ht22-20020a170907609600b007882936243fsi24443082ejc.772.2022.10.22.01.36.44; Sat, 22 Oct 2022 01:37: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=hXZxQuyH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S233812AbiJVIb0 (ORCPT + 99 others); Sat, 22 Oct 2022 04:31:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51522 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230445AbiJVI2i (ORCPT ); Sat, 22 Oct 2022 04:28:38 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7057F22E8FA; Sat, 22 Oct 2022 01:01: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 E6C3960B09; Sat, 22 Oct 2022 08:01:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 09143C433D6; Sat, 22 Oct 2022 08:01:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425665; bh=td0Bgb5k/mqBqt6ZeCIVd7jIB7tIe/i82PmDKrXTogw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hXZxQuyHjh1o51StCJCIcvCXIC5Oi8KsFtx1m0VFRcmJadRXuNLbFUfR4VqagzthO 5lfEoI4vrFYZZ+UEYzqe51faAzlZFpmn4hzi9Cx7UZhyUlXyj3A3Hm7YQOHO1pLSWz xYt+djKeROEwaawVhg8bFmtcdu5kF+o6f7S9aOmE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kiran K , Chethan T N , Luiz Augusto von Dentz , Sasha Levin Subject: [PATCH 5.19 575/717] Bluetooth: btintel: Mark Intel controller to support LE_STATES quirk Date: Sat, 22 Oct 2022 09:27:34 +0200 Message-Id: <20221022072523.850735102@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376231742858453?= X-GMAIL-MSGID: =?utf-8?q?1747376231742858453?= From: Kiran K [ Upstream commit dd0a1794f4334ddbf9b7c5e7d642aaffff38c69b ] HarrrisonPeak, CyclonePeak, SnowFieldPeak and SandyPeak controllers are marked to support HCI_QUIRK_LE_STATES. Signed-off-by: Kiran K Signed-off-by: Chethan T N Signed-off-by: Luiz Augusto von Dentz Signed-off-by: Sasha Levin --- drivers/bluetooth/btintel.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/drivers/bluetooth/btintel.c b/drivers/bluetooth/btintel.c index 818681c89db8..d44a96667517 100644 --- a/drivers/bluetooth/btintel.c +++ b/drivers/bluetooth/btintel.c @@ -2439,15 +2439,20 @@ static int btintel_setup_combined(struct hci_dev *hdev) INTEL_ROM_LEGACY_NO_WBS_SUPPORT)) set_bit(HCI_QUIRK_WIDEBAND_SPEECH_SUPPORTED, &hdev->quirks); + if (ver.hw_variant == 0x08 && ver.fw_variant == 0x22) + set_bit(HCI_QUIRK_VALID_LE_STATES, + &hdev->quirks); err = btintel_legacy_rom_setup(hdev, &ver); break; case 0x0b: /* SfP */ - case 0x0c: /* WsP */ case 0x11: /* JfP */ case 0x12: /* ThP */ case 0x13: /* HrP */ case 0x14: /* CcP */ + set_bit(HCI_QUIRK_VALID_LE_STATES, &hdev->quirks); + fallthrough; + case 0x0c: /* WsP */ /* Apply the device specific HCI quirks * * All Legacy bootloader devices support WBS @@ -2455,11 +2460,6 @@ static int btintel_setup_combined(struct hci_dev *hdev) set_bit(HCI_QUIRK_WIDEBAND_SPEECH_SUPPORTED, &hdev->quirks); - /* Valid LE States quirk for JfP/ThP familiy */ - if (ver.hw_variant == 0x11 || ver.hw_variant == 0x12) - set_bit(HCI_QUIRK_VALID_LE_STATES, - &hdev->quirks); - /* Setup MSFT Extension support */ btintel_set_msft_opcode(hdev, ver.hw_variant); @@ -2530,9 +2530,8 @@ static int btintel_setup_combined(struct hci_dev *hdev) */ set_bit(HCI_QUIRK_WIDEBAND_SPEECH_SUPPORTED, &hdev->quirks); - /* Valid LE States quirk for JfP/ThP familiy */ - if (ver.hw_variant == 0x11 || ver.hw_variant == 0x12) - set_bit(HCI_QUIRK_VALID_LE_STATES, &hdev->quirks); + /* Set Valid LE States quirk */ + set_bit(HCI_QUIRK_VALID_LE_STATES, &hdev->quirks); /* Setup MSFT Extension support */ btintel_set_msft_opcode(hdev, ver.hw_variant); From patchwork Sat Oct 22 07:27: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: 7856 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1160914wrr; Sat, 22 Oct 2022 04:29:01 -0700 (PDT) X-Google-Smtp-Source: AMsMyM68a6FGRSKj9fzPBLB0HMLbBZeUgnAOBo7ArejplQNHL9HOpkS1yzH3cv17ARAUZd3ACeCB X-Received: by 2002:a17:903:22c1:b0:185:5276:92e5 with SMTP id y1-20020a17090322c100b00185527692e5mr23885549plg.134.1666438140800; Sat, 22 Oct 2022 04:29:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666438140; cv=none; d=google.com; s=arc-20160816; b=C5szln619uWr9L9iiie42MlvdCP9UbRubtyKk2W31h6533W/EaPyINAJsVWtPGykWw +1i+Vd+wNvGr0cqy/bmOAaNGud0wGOYWmOjElZRPm5lFkeQlQvDaGyI1aJJuj6MBItTT e1HWuwVRaHJ0YeIJAan4lmnwutY0hE/6MJfSdYQXv0U5aePR3y27tPSeq8JxUg7bxISG /CBsJ+RDljkEnhlHACzQp7JdjqK9Z4swL1R2B/p2ST0745tKPDFGb5PwABWMHbSN/Z9Q mJTzv1uA7Zs6AtWhY+uuLipuJ1UToKLKc86jLtmIj3NFA341sNdKxxFL8/X0oE/qP9ts VTCw== 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=MS1/oJx9VSDkkg70x51KWEtO7x7lndaVvIDnXsbp9s0=; b=BNqVANOAPYOwEE0Pi6BYpq89p52xE2h1Seoip9AGfqDfyjGZwhj+CzFLHjhND24pn0 ntCYBSyOYpETHNPOMj3qLbRiIgsvKstDcQ8kVzNG9J92Fhw6qSWFNMB8LYt8ka/YlBVM sJLDwj8IH17Hv6d83WYZvzIbEVq/qIfwaMP30BPv8phsWVUpcGkyagx8w/af/4mzDJHq 5nF3cmWa3EKep9LGJl/niMmmJZSVdbImLLTXCgMMFPxuu2LeY3wxyyd3h+ddyJgMtSQu ruazLVDGcqeT5MYMvsFRPVv3i+CFRWrItE90rj3gc+tpC++QiXZMUMK5q2I9UojkEiRe XZkw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=sSz62sX6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 cj11-20020a056a00298b00b005567d823a2esi27701541pfb.306.2022.10.22.04.28.43; Sat, 22 Oct 2022 04:29: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=sSz62sX6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S229718AbiJVLTU (ORCPT + 99 others); Sat, 22 Oct 2022 07:19:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34158 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229891AbiJVLTC (ORCPT ); Sat, 22 Oct 2022 07:19:02 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3D45FB516C; Sat, 22 Oct 2022 03:46: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 7DFF8B82E2C; Sat, 22 Oct 2022 08:01:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DAA16C433C1; Sat, 22 Oct 2022 08:01:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425668; bh=e69ynLJuqC7qhUEJrETi/PJwrTuWrNPBE7bGAuEbq7s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sSz62sX6eCNAVniiwmRxvv2bQcUDIatY+XHNYm6eBOVV+JZs/ypMetdahk61ebO3e 1ufptsi33eZPJqxdy4Ahcz4b4lpI6OTj1QWACt0dU4wvxrizCf7mi9m5sJFwZNMIUi P8wrELy1giJM77thWsMYMK7kZENDlFATxfeZ8Flo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Patrick Rudolph , Mark Brown , Sasha Levin Subject: [PATCH 5.19 576/717] regulator: core: Prevent integer underflow Date: Sat, 22 Oct 2022 09:27:35 +0200 Message-Id: <20221022072523.902013293@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 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?1747387040055717093?= X-GMAIL-MSGID: =?utf-8?q?1747387040055717093?= From: Patrick Rudolph [ Upstream commit 8d8e16592022c9650df8aedfe6552ed478d7135b ] By using a ratio of delay to poll_enabled_time that is not integer time_remaining underflows and does not exit the loop as expected. As delay could be derived from DT and poll_enabled_time is defined in the driver this can easily happen. Use a signed iterator to make sure that the loop exits once the remaining time is negative. Signed-off-by: Patrick Rudolph Link: https://lore.kernel.org/r/20220909125954.577669-1-patrick.rudolph@9elements.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- drivers/regulator/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c index a9daaf4d5aaa..9567d2fc3f00 100644 --- a/drivers/regulator/core.c +++ b/drivers/regulator/core.c @@ -2680,7 +2680,7 @@ static int _regulator_do_enable(struct regulator_dev *rdev) * return -ETIMEDOUT. */ if (rdev->desc->poll_enabled_time) { - unsigned int time_remaining = delay; + int time_remaining = delay; while (time_remaining > 0) { _regulator_delay_helper(rdev->desc->poll_enabled_time); From patchwork Sat Oct 22 07:27: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: 7649 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1107792wrr; Sat, 22 Oct 2022 01:42:07 -0700 (PDT) X-Google-Smtp-Source: AMsMyM664Rg8FtzYGJcU3C9lWUM3DcGX6YUWrdi5eaG2tULM7KdHH+1jfttPG86HVq7PzVlrfZQ2 X-Received: by 2002:a17:906:4fcd:b0:78d:4b28:9d57 with SMTP id i13-20020a1709064fcd00b0078d4b289d57mr18915216ejw.303.1666428127632; Sat, 22 Oct 2022 01:42:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666428127; cv=none; d=google.com; s=arc-20160816; b=TQOvI3VAPy0budEoqLnEMbt3TY93/5c61pppDVIXEhPGnK7CyfHWeMqzsQlCASbOmj tza0b5uDi/JPKL0KmVz6QhyUeSYqQZee+kjZe6wcpi4AJzHm3ui7XohknQVZijdAwtqU hxF1zxN/eXpoqnfWeVsKHPZyWTkWN085K1NrEPdCfAazFchOY6NKaYPMMK4jF3rr1TIO LFy2vK19hV5PApxfBW1dxV/dXgnRyDYQ/aB+SO1yAGKktKQiqHB/OrKihF99BeJu7pd6 YvMy5IDoSi9yIP6iB+WFCsNwfAQCdxRFwkok11Mbl129av5zDFqglFWIYkh+iqayjRnF ZwCQ== 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=2VOXCrhkt3yMI2X3yLDsiYR4GyOqlswowtkIaYtOYnE=; b=cNX7L7eMn4HXRa9Dib+7gziu1xU3ASZALGf7Afv3s0b0A0tV9ZwKxiV9e68LybPAHd gz64BCudgkOZbBZmgsirZzOQxTvTuoSIeMGSheol4HHIfLiYOVMQ9zmH0DCg3EwKB830 E27ZzO4Hvpq/C/oO5c8bktypMiTS59d1arWn0nJAjzRKpI6avyJ7A51u5O9Fog6tjk82 MYCcuk7IwT6hyrI7/LIL3/BWRjK8dkh+CZ+OxyPCAk+OQGBX7z0ZPN5Fv6Ez1mfzoNV8 TZ3yNXSF2+/P7cPnVLC6oafeUb3Tz6r3bnZLIoSYDYBCwTW1TRFlnV3dI0npzWq7QM5M c2rw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=TivkKSJT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 hd43-20020a17090796ab00b0079fe11e92ddsi2199817ejc.906.2022.10.22.01.41.40; Sat, 22 Oct 2022 01:42: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=TivkKSJT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S234433AbiJVIiG (ORCPT + 99 others); Sat, 22 Oct 2022 04:38:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32996 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234021AbiJVIcX (ORCPT ); Sat, 22 Oct 2022 04:32: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 BCA5B2E533F; Sat, 22 Oct 2022 01: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 dfw.source.kernel.org (Postfix) with ESMTPS id ACEDE60B8C; Sat, 22 Oct 2022 08:01:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BF3F2C433D6; Sat, 22 Oct 2022 08:01:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425671; bh=KwB7yzHmIKvJrXcnQgncUVi1felkVMXMpemxmBu6DsM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TivkKSJTZtKGxkOWNeFX6cmmIORzVsVt30BEvkG7DZoO/AEhoKvnjBo8izbJHRMOT zzQmz3O/Tsqz55Klwi3hXfkvVD6tuDsRPpurmWAwE53DkwvxGVFFkFCvCaoB+6zH5f ME7TsmXqn7AzideB/oFrIqjGEchEstA5kTmlkB6U= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jianglei Nie , Jeff Johnson , Kalle Valo , Sasha Levin Subject: [PATCH 5.19 577/717] wifi: ath11k: mhi: fix potential memory leak in ath11k_mhi_register() Date: Sat, 22 Oct 2022 09:27:36 +0200 Message-Id: <20221022072523.940891229@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376540081726165?= X-GMAIL-MSGID: =?utf-8?q?1747376540081726165?= From: Jianglei Nie [ Upstream commit 43e7c3505ec70db3d3c6458824d5fa40f62e3e7b ] mhi_alloc_controller() allocates a memory space for mhi_ctrl. When gets some error, mhi_ctrl should be freed with mhi_free_controller(). But when ath11k_mhi_read_addr_from_dt() fails, the function returns without calling mhi_free_controller(), which will lead to a memory leak. We can fix it by calling mhi_free_controller() when ath11k_mhi_read_addr_from_dt() fails. Signed-off-by: Jianglei Nie Reviewed-by: Jeff Johnson Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/20220907073704.58806-1-niejianglei2021@163.com Signed-off-by: Sasha Levin --- drivers/net/wireless/ath/ath11k/mhi.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/drivers/net/wireless/ath/ath11k/mhi.c b/drivers/net/wireless/ath/ath11k/mhi.c index c44df17719f6..86995e8dc913 100644 --- a/drivers/net/wireless/ath/ath11k/mhi.c +++ b/drivers/net/wireless/ath/ath11k/mhi.c @@ -402,8 +402,7 @@ int ath11k_mhi_register(struct ath11k_pci *ab_pci) ret = ath11k_mhi_get_msi(ab_pci); if (ret) { ath11k_err(ab, "failed to get msi for mhi\n"); - mhi_free_controller(mhi_ctrl); - return ret; + goto free_controller; } if (!test_bit(ATH11K_FLAG_MULTI_MSI_VECTORS, &ab->dev_flags)) @@ -412,7 +411,7 @@ int ath11k_mhi_register(struct ath11k_pci *ab_pci) if (test_bit(ATH11K_FLAG_FIXED_MEM_RGN, &ab->dev_flags)) { ret = ath11k_mhi_read_addr_from_dt(mhi_ctrl); if (ret < 0) - return ret; + goto free_controller; } else { mhi_ctrl->iova_start = 0; mhi_ctrl->iova_stop = 0xFFFFFFFF; @@ -440,18 +439,22 @@ int ath11k_mhi_register(struct ath11k_pci *ab_pci) default: ath11k_err(ab, "failed assign mhi_config for unknown hw rev %d\n", ab->hw_rev); - mhi_free_controller(mhi_ctrl); - return -EINVAL; + ret = -EINVAL; + goto free_controller; } ret = mhi_register_controller(mhi_ctrl, ath11k_mhi_config); if (ret) { ath11k_err(ab, "failed to register to mhi bus, err = %d\n", ret); - mhi_free_controller(mhi_ctrl); - return ret; + goto free_controller; } return 0; + +free_controller: + mhi_free_controller(mhi_ctrl); + ab_pci->mhi_ctrl = NULL; + return ret; } void ath11k_mhi_unregister(struct ath11k_pci *ab_pci) From patchwork Sat Oct 22 07:27: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: 7579 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1106278wrr; Sat, 22 Oct 2022 01:37:24 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4G13oL1SyKNTGOnpkJ2sPBC3L/374Wud7hy6OYxvz2b+9RTFUHzNBbGLkh2cJo2XYdJRxL X-Received: by 2002:a17:907:971e:b0:78d:e7ed:7585 with SMTP id jg30-20020a170907971e00b0078de7ed7585mr18497018ejc.258.1666427844332; Sat, 22 Oct 2022 01:37:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666427844; cv=none; d=google.com; s=arc-20160816; b=S3cwpVmM4t8r1kYS1bxucSxBHgUFJhpJFE9lw3FtF9UmKqDSlKdMDtOJ7RfpDKjIVc vnGOivTakW1IWLywZzLntnwXE2ldyvjekBN+W3e3PchgCMhIUtyLNYBi4wNm8Ta/xd8v UEItj9wHfNfECJnnhcxlc82uOTpg1ABh/gcrUSmVvUzFrWO/F8Yplhi2Bk5/I2njiHOg CMqCcAg1hXuIRrVxlbQy4zsIVdg5BTKh9i1xEwXnHwkqgIJTI0lZf/pqVBCF5qhazYsM LUzDXUKzj4PZbSxkH78xVegblw775I3ART9X1FbwPYzsx6kiGBsyk570aK+2j9oZ/GUC 7JHw== 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=Kq/uWDtcplivhEjxnUibz83T5GU1afLSxHpEe6Nm1+w=; b=A0B9yNX/iQKALUWWsrd6eX21DDf4iXiJHE6gWehlGJ5TkQ+WuM99IMFwMznZZAbNt9 UtzyMdw15epB64iwDCQP3Fr+eAqSFSAjBlUxAlqXeyDtfMRS/Ul7YPlGgzBr91f84K2V fs48UrJy7s6YHYrTuEP0lO2p1S+mPoLrBZhzytsq7P0LWzkYGxGOVSsHAcMEAUVrRqYZ tzDD4JFBg1suH+srQuKA/AZl5j21y2bfJNetRPdVR+1M157+Jr7vwOZJQk4wiKvEaUUV KczVdwgqLip/1wWgmCzPk2K9JEtSOlfN1OrY8KkAP6ZVc62gxUNMOX/+4D8qrFmGLiBV PP2Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=fZ3hTFOH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 x20-20020a170906441400b0078a00ad1e31si20553319ejo.687.2022.10.22.01.36.55; Sat, 22 Oct 2022 01:37: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=fZ3hTFOH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S233962AbiJVIcb (ORCPT + 99 others); Sat, 22 Oct 2022 04:32:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37148 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234033AbiJVI3Q (ORCPT ); Sat, 22 Oct 2022 04:29:16 -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 1AA192E2B98; Sat, 22 Oct 2022 01: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 dfw.source.kernel.org (Postfix) with ESMTPS id B879960BA2; Sat, 22 Oct 2022 08:01:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B28DEC433D6; Sat, 22 Oct 2022 08:01:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425674; bh=WwmcjNzmw5OLFkIa+ZtNeTsYil3huvRGUhYuS9Nf6HE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fZ3hTFOHeyDGaxxu5ZkG4I3e20FzwQyS9UPuFp4OoqNLfg5d8LA6OsjTpCwpjH1pe YsdBpnRraBORJ/8qbJPqx7hXVRD27yLbCaB7820Eb3kE47b05I/gXMnnPk1lcJFYhs SwuqFOAogElEzE8FgE93V9E+idyVLOauhJUwiU5s= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, YN Chen , Sean Wang , Felix Fietkau , Sasha Levin Subject: [PATCH 5.19 578/717] wifi: mt76: mt7921: reset msta->airtime_ac while clearing up hw value Date: Sat, 22 Oct 2022 09:27:37 +0200 Message-Id: <20221022072523.988714336@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376243438779608?= X-GMAIL-MSGID: =?utf-8?q?1747376243438779608?= From: Sean Wang [ Upstream commit 1bf66dc31032ff5292f4d5b76436653f269fcfbd ] We should reset mstat->airtime_ac along with clear up the entries in the hardware WLAN table for the Rx and Rx accumulative airtime. Otherwsie, the value msta->airtime_ac - [tx, rx]_last may be a negative and that is not the actual airtime the device took in the last run. Reported-by: YN Chen Signed-off-by: Sean Wang Signed-off-by: Felix Fietkau Signed-off-by: Sasha Levin --- drivers/net/wireless/mediatek/mt76/mt7921/main.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/main.c b/drivers/net/wireless/mediatek/mt76/mt7921/main.c index 0316d226e38d..94dd0c1d4cb8 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7921/main.c +++ b/drivers/net/wireless/mediatek/mt76/mt7921/main.c @@ -738,6 +738,7 @@ void mt7921_mac_sta_assoc(struct mt76_dev *mdev, struct ieee80211_vif *vif, mt7921_mac_wtbl_update(dev, msta->wcid.idx, MT_WTBL_UPDATE_ADM_COUNT_CLEAR); + memset(msta->airtime_ac, 0, sizeof(msta->airtime_ac)); mt7921_mcu_sta_update(dev, sta, vif, true, MT76_STA_INFO_STATE_ASSOC); From patchwork Sat Oct 22 07:27: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: 7760 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1119712wrr; Sat, 22 Oct 2022 02:23:18 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7YwiOkYE/sgu1TL9Qr5BSXTX4VU2BemukIFKYMBBVmjFsstud/TyFmyiEOx2ucTp7ulBst X-Received: by 2002:a17:90b:4b0e:b0:20d:213b:1083 with SMTP id lx14-20020a17090b4b0e00b0020d213b1083mr27633397pjb.208.1666430587602; Sat, 22 Oct 2022 02:23:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666430587; cv=none; d=google.com; s=arc-20160816; b=f9EUHs2/4Yw8t2WPeqA6l8a2+xNsJgQ+M3hRlvWNdyzaEFIRcD1bSbdDjCh2yV+TMY AZxSSAQNMniGNnYMiHtv8tHMNHkcOY7KejoA52KwS+K4d7Sbqv7/1tTVWtFuJn31O8gr EApqL/YAnrpqauhE4Bwi1Mds+9NVD+JG1C3ix6ukA4Jb64ndpZjNYwcSBVCJT3aZNB7Y 7SEn/FrbUJj91cN++tr44WhgdcL1Cfqt/0mGD5nT3qzPCGICXBSYJImtgh8grRyXrdQZ wSvPG6mCFn8v+FcXx8xJul1Sm75WEXj14P/sQK1ALFV4YtFbVSynrdQ2PoWQdbjam7JA OPjA== 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=HNPTUUbcVN8xpr3mQMlV0dH8r18nleYLAfNm5tNbk5A=; b=B3LQ8DDYo+kuT3XRrDefykkGfRF5vKV/Sod43PHD++w96w+SkYFkea6hGK3RcBWgaL 2PrXuwnN1lycX6m8gxRbX6mhWRH9VYyeCb5/dOvfu0NhM5hTEKdrYQNMCtl8e2y5oXLH 9dS1QkY2VCJAsz9Qv0sESVwm6iYTGVhAMk0amzpFgITswTVdzCF1xMkeMYTtNIYhgPng P5LfSzTX5DR3fQ5iFEoU7ueIl7NYUGqYdBws5UXl04CU/rtw84Looz+1UAi3M8Qlw454 BXtFK4d0AGDdHKdfJjllVYfYnWaCSLTZ/q/0Ywf0DOfFN+z/om/uNWH/SvE5Dy04PfMl iKRw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=KsukZKZy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 i11-20020a170902cf0b00b0017f580f646fsi30918155plg.304.2022.10.22.02.22.54; Sat, 22 Oct 2022 02:23: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=KsukZKZy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231597AbiJVI5g (ORCPT + 99 others); Sat, 22 Oct 2022 04:57:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43206 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231946AbiJVI4x (ORCPT ); Sat, 22 Oct 2022 04:56: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 DE1AE52FEC; Sat, 22 Oct 2022 01:14: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 dfw.source.kernel.org (Postfix) with ESMTPS id EA68B60B9F; Sat, 22 Oct 2022 08:01:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AC221C433D6; Sat, 22 Oct 2022 08:01:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425677; bh=lhTMxcnaPY9F61jECeQTcv9FNk/rwyy5W+n0biYYB0E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KsukZKZys/QHAuo5bmPIZQeyBZO8lE1sNYmUohsiQnoyKKB9Uzxh/f8tWNais2f7j h8rQP9l1pjRb6X/8Z970mma0n+fgf8NojTMHZ3lXRKnLEFdeBVq351mH2W/8Ftl8FP hoZWZOuqOl17sCYWtf0j+xYRiAcjzClhtPQ6hCxk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Po-Hao Huang , Ping-Ke Shih , Kalle Valo , Sasha Levin Subject: [PATCH 5.19 579/717] wifi: rtw89: free unused skb to prevent memory leak Date: Sat, 22 Oct 2022 09:27:38 +0200 Message-Id: <20221022072524.035796781@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747379119844932396?= X-GMAIL-MSGID: =?utf-8?q?1747379119844932396?= From: Po-Hao Huang [ Upstream commit eae672f386049146058b9e5d3d33e9e4af9dca1d ] This avoid potential memory leak under power saving mode. Signed-off-by: Po-Hao Huang Signed-off-by: Ping-Ke Shih Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/20220916033811.13862-6-pkshih@realtek.com Signed-off-by: Sasha Levin --- drivers/net/wireless/realtek/rtw89/core.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/net/wireless/realtek/rtw89/core.c b/drivers/net/wireless/realtek/rtw89/core.c index a6a90572e74b..7313eb80fb1e 100644 --- a/drivers/net/wireless/realtek/rtw89/core.c +++ b/drivers/net/wireless/realtek/rtw89/core.c @@ -860,6 +860,7 @@ int rtw89_h2c_tx(struct rtw89_dev *rtwdev, rtw89_debug(rtwdev, RTW89_DBG_FW, "ignore h2c due to power is off with firmware state=%d\n", test_bit(RTW89_FLAG_FW_RDY, rtwdev->flags)); + dev_kfree_skb(skb); return 0; } From patchwork Sat Oct 22 07:27: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: 7567 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1106082wrr; Sat, 22 Oct 2022 01:36:52 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4PRDza7+ts8rh9MYWa89nPkRK8mW5J6vZuVCCydGcNc8Ib/NmfQcrAARtDUMxAdf8NTZav X-Received: by 2002:a17:90b:3e82:b0:20d:2fa1:d071 with SMTP id rj2-20020a17090b3e8200b0020d2fa1d071mr62593301pjb.58.1666427812556; Sat, 22 Oct 2022 01:36:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666427812; cv=none; d=google.com; s=arc-20160816; b=SGMdy8v8JLwIiM7DFHzoK+rkF19x9498cnIL3TP/8D4YgCSWkLylaPfwCfn/paiLR6 Bf1vmc3qmS5R7tIIyTCGnfdpGs/Ky5vneNFnz5GciojxlBBlP9IJZYSVXdZbkc3hED5A rpSmKlNZr6GdLbKWwx1toxU+GuJo3vcMwrCM5zp5cQ2s/5M0xzqsf0xGRupuw06ZpDad nE5Atdo7cY5kU1et9EOxGNo57Yzr3MJD35bbxf0UzU6t4kxrvmPncDQQtrdpb1qxuFM0 MhsS+xnE1Le6YIC+VDvlCYqN9xDdtGEb+5Uydj7eoeUDfbhNAuHx8QoC/mnbgRr6NGZW z9bg== 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=LXnCEAx+IYbyZQ3Nlb+J5mZCfELkW2ZqxzVZlWMS+G0=; b=RRr52+H+/c9XoZ/gdTgBoeBwGrH6asS+3h5JLW714cXN3OXBMCGwXHNcTw0ZJ/zyUj xJQ44tHwvKuNVYGa33qyQXZieen1I3dhjYMNSo9/3txRIAgLVkk2YXcWoWhZR+vgGCCm tlEZNqbqyx3sxtOHs3EmLtxvND4MxpHkx1EaMGKRa7VHQ9BBmiCHPkbGwbdqcjK6hrvj rZb1yF/Lw7ufLs2e0yAWIzglF7aqNYZtfw5Z25ypxCNles34sIckDGCYvLac3OIYkCKW 7MIAbG7oYcDPmv7sKXVvPBUCbubDVNOMZOS8Ech4eu1XkqR2ScFwi7EnPuh2besfiVGI P3ng== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=TU5uXb3v; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 n38-20020a635926000000b0041da571906fsi335816pgb.121.2022.10.22.01.36.37; Sat, 22 Oct 2022 01:36: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=TU5uXb3v; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S233937AbiJVIbw (ORCPT + 99 others); Sat, 22 Oct 2022 04:31:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52730 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233954AbiJVI27 (ORCPT ); Sat, 22 Oct 2022 04:28:59 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DB8392E22AC; Sat, 22 Oct 2022 01:01: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 1B7B560BA7; Sat, 22 Oct 2022 08:01:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2D24FC433C1; Sat, 22 Oct 2022 08:01:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425680; bh=f2P4qW12vwATxExY6+WR4wROaknevNhDDR2RJccBt28=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TU5uXb3vC5F3gRcr20CqGYINbREDdgut0oJdd1r6nzI1l9YOaXPML8ktIhX3Fv5c3 0UiwtlPkdHM/MVMNw/YMuWHungG9xkdyv+dr/PksN/j4KGy63bbBHLbbfGxsF8f/Sy VPxEcQPZSLPiTfJtde2ELraGziLfHKX6Pz1y+B9A= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Po-Hao Huang , Ping-Ke Shih , Kalle Valo , Sasha Levin Subject: [PATCH 5.19 580/717] wifi: rtw89: fix rx filter after scan Date: Sat, 22 Oct 2022 09:27:39 +0200 Message-Id: <20221022072524.085568032@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376210136121427?= X-GMAIL-MSGID: =?utf-8?q?1747376210136121427?= From: Po-Hao Huang [ Upstream commit 812825c2b204c491f1a5586c602e4ac75060493a ] In monitor mode we should be able to received all packets even if it's not destined to us. But after scan, the configuration was wrongly set, so we fix it. Signed-off-by: Po-Hao Huang Signed-off-by: Ping-Ke Shih Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/20220916033811.13862-7-pkshih@realtek.com Signed-off-by: Sasha Levin --- drivers/net/wireless/realtek/rtw89/fw.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/drivers/net/wireless/realtek/rtw89/fw.c b/drivers/net/wireless/realtek/rtw89/fw.c index 4718aced1428..e7f86d84d91d 100644 --- a/drivers/net/wireless/realtek/rtw89/fw.c +++ b/drivers/net/wireless/realtek/rtw89/fw.c @@ -2288,6 +2288,7 @@ void rtw89_hw_scan_start(struct rtw89_dev *rtwdev, struct ieee80211_vif *vif, { struct rtw89_vif *rtwvif = (struct rtw89_vif *)vif->drv_priv; struct cfg80211_scan_request *req = &scan_req->req; + u32 rx_fltr = rtwdev->hal.rx_fltr; u8 mac_addr[ETH_ALEN]; rtwdev->scan_info.scanning_vif = vif; @@ -2302,13 +2303,13 @@ void rtw89_hw_scan_start(struct rtw89_dev *rtwdev, struct ieee80211_vif *vif, ether_addr_copy(mac_addr, vif->addr); rtw89_core_scan_start(rtwdev, rtwvif, mac_addr, true); - rtwdev->hal.rx_fltr &= ~B_AX_A_BCN_CHK_EN; - rtwdev->hal.rx_fltr &= ~B_AX_A_BC; - rtwdev->hal.rx_fltr &= ~B_AX_A_A1_MATCH; + rx_fltr &= ~B_AX_A_BCN_CHK_EN; + rx_fltr &= ~B_AX_A_BC; + rx_fltr &= ~B_AX_A_A1_MATCH; rtw89_write32_mask(rtwdev, rtw89_mac_reg_by_idx(R_AX_RX_FLTR_OPT, RTW89_MAC_0), B_AX_RX_FLTR_CFG_MASK, - rtwdev->hal.rx_fltr); + rx_fltr); } void rtw89_hw_scan_complete(struct rtw89_dev *rtwdev, struct ieee80211_vif *vif, @@ -2322,9 +2323,6 @@ void rtw89_hw_scan_complete(struct rtw89_dev *rtwdev, struct ieee80211_vif *vif, if (!vif) return; - rtwdev->hal.rx_fltr |= B_AX_A_BCN_CHK_EN; - rtwdev->hal.rx_fltr |= B_AX_A_BC; - rtwdev->hal.rx_fltr |= B_AX_A_A1_MATCH; rtw89_write32_mask(rtwdev, rtw89_mac_reg_by_idx(R_AX_RX_FLTR_OPT, RTW89_MAC_0), B_AX_RX_FLTR_CFG_MASK, From patchwork Sat Oct 22 07:27: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: 7602 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1106527wrr; Sat, 22 Oct 2022 01:38:11 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4U9GRdmgbRPPxcroiaeIx4IEE1cahXY02Ma2VFclA21oPWW7/vWa6iYR1FapneKt5OVWJV X-Received: by 2002:a17:906:9bf8:b0:78d:41aa:5eea with SMTP id de56-20020a1709069bf800b0078d41aa5eeamr18564681ejc.137.1666427891344; Sat, 22 Oct 2022 01:38:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666427891; cv=none; d=google.com; s=arc-20160816; b=RAQglVWNsDA9wM48wLsBeKAdFYYbv92dGbk3JEcUo97pmdofa2SvaARLqrT4PFF8eT 9/MCG0uWsLEPEbsUsrZ+T9QMXz2Ays6rUVfefcfmCbGOhUbnJ+TwkaocFALrkTMfK+y3 YHGqhw1rlxBCrgIAxL992N3D49DiGhpNhnLXhJ9mCHkr6E8dnmEiF0lKDzH6st8CPgpN TOPQzwBicdTMOFcLorIXbVHmZVdY9B++8sNNNKNNxEDFF1rwRGjp9ALT7B4jCOBvipXB 8nwnqH0v1sZHEnf5/tW+SpPJjCucc8guzKwaQ8BfhK1TGpBHVUfsgCI0d39N2nc3MlKl xSMw== 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=T7oBMDL/+zqNr7/83gLsUW/OLkws9fXS+gIgfNI4Uzg=; b=o2xZQSa6/J6emo7WmDt0OsHmgwONbJD2GLjokerO4GTpzIUVvagQMWJYY8OBFOEyOw CafWshfQRxPYpx0AuYQVPVgsqEGCsM6UxACg+orej91bZuNbajy1VDqkGzNT5OH6wLvZ zHh67i9QFG3uiXU6RJkl6zy/uKAYxbSzL/QLS1OUnksv/AKFwE7p5Lfi0PSjjeIVKhxf i3oQmwbvWvxkmyU8SbVYHnL/mEpYsLh0MdNriNTXbB9CGIJwWob6lHJ5oh/Aj1imbLIS XpdXmSQpNXEnVG909Ps6yChieNIorRRRdgaSxCxZkvQ8NbJLIrIm3/Qr3fvao08Ndv3z MyBQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=eL62JVog; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 c15-20020a0564021f8f00b00458a0aa9216si3212627edc.634.2022.10.22.01.37.39; Sat, 22 Oct 2022 01:38: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=eL62JVog; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S234116AbiJVIeB (ORCPT + 99 others); Sat, 22 Oct 2022 04:34:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58026 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234285AbiJVIaU (ORCPT ); Sat, 22 Oct 2022 04:30:20 -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 1F97D2D03AE; Sat, 22 Oct 2022 01: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 ams.source.kernel.org (Postfix) with ESMTPS id E58D3B82DB3; Sat, 22 Oct 2022 08:01:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 26E8AC433C1; Sat, 22 Oct 2022 08:01:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425683; bh=3592LoTzidScQOi9UJbL8L3IbnDlfBGPUhJSSJvZHmo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eL62JVog+WtWw3XFe+nWtESB+qoWJvyhGsoP+EaA+MS5tootpbR6Q+Hqzs1IWXhsL qESDgLpT98LjUB5yZN4wBQ0+xuc3oYQpD5I6X/eNUiaulKmR5UmORi9ILb4gepVniw DaaN8EOWEJ0Le4HQAL6TOp3owDAKf6tZk4GKxoB0= 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 5.19 581/717] Bluetooth: L2CAP: initialize delayed works at l2cap_chan_create() Date: Sat, 22 Oct 2022 09:27:40 +0200 Message-Id: <20221022072524.127144002@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376292547904637?= X-GMAIL-MSGID: =?utf-8?q?1747376292547904637?= 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 48fbd0ae882b..a8835c8367af 100644 --- a/net/bluetooth/l2cap_core.c +++ b/net/bluetooth/l2cap_core.c @@ -61,6 +61,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) { @@ -476,6 +479,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; @@ -3319,10 +3325,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 Sat Oct 22 07:27: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: 7609 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1106626wrr; Sat, 22 Oct 2022 01:38:27 -0700 (PDT) X-Google-Smtp-Source: AMsMyM47xKb9qaNFLnua34C7nQybC7cwmG15zfU4DjsiBX64W01rMjh74Hj1P2uFlphsUg9T7JfJ X-Received: by 2002:a17:907:3f0c:b0:78e:2090:6924 with SMTP id hq12-20020a1709073f0c00b0078e20906924mr19635425ejc.332.1666427907733; Sat, 22 Oct 2022 01:38:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666427907; cv=none; d=google.com; s=arc-20160816; b=dSdxG3dfKifBl8AkMzrzdKvrWWEs8LK3F5MqaFHM9eiOitMOZZfCYHuf706rhzZ/W3 VgoWx/4zC9xkaATjR2uKGcAMaA193UMaCDGURd0jqLbeK9z2C7XK4J+RQsn0qLCpulYp 1pwQumj+Jryx6UH08cDM2tNtjq8mVJaGQj5GGr/9qSp+xTOu0CJdueLAlQbPq5tIDZfk 5osc2yZ61btP0WmlDCmURhqE3o/Z7SiYdzFbq5Kc+kL3v0po0L+uVpckK3gtkNfHJ7oC 48RGr79iP0A0wufuvfQTG8TdW2ESegrL3Lop6mjxBqIpVdLgQkRv85EM/2DxSN+GmJ9Z P+nw== 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=NJZfZNdcqE3SrvhkFsD6A4LRPV71IaZuZ5cU8F13qXA=; b=Y5ZME4ND2se0lNrLR9ftCPFKMrtqwdyK/uMfDYFOghRevs2h8eljiK6CTBr1g3P8PK /cdOUlQD/27cvoCG+6HzkBH2FP55pkADYdfmo7gjTzDBhMWxYlD8OV2J4sm1DbOEckHw x9B72NviKL+yadcEiOipCjZu7IhNE/sLnZDsklk/EDJxQCCLNSQUkLjwl8rbov8JRooZ xrRY6VAXeCrrS9JhwTmaeDD2kHJ9B+VYXoaDm7p4iEIyUgSckYDQ67m1tjMR5f1Pgv2F sGfv0YOvjaZNPMlgRx2imtatDOBVJoDmyf4im5pwcw+MrriAe2M/m/D0y04QZ+R71IOb trYQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=aUS5jjjz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 gn17-20020a1709070d1100b0078e254ae418si22046553ejc.640.2022.10.22.01.37.56; Sat, 22 Oct 2022 01:38: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=aUS5jjjz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S234098AbiJVIdj (ORCPT + 99 others); Sat, 22 Oct 2022 04:33:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58062 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234214AbiJVI36 (ORCPT ); Sat, 22 Oct 2022 04:29: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 1F9162D03AD; Sat, 22 Oct 2022 01: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 ams.source.kernel.org (Postfix) with ESMTPS id C72FEB82DF1; Sat, 22 Oct 2022 08:01:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 380B1C433C1; Sat, 22 Oct 2022 08:01:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425686; bh=Qq/nS/EG95y0I/Z0ahk81L6aZDYvt5NYsst/VyPOYko=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=aUS5jjjz0PbNuWuYx4O3lPB4RPDcRbk6sKrY6UmnPlFvUoFg4BIGFPivGgz1afU0k ISm/l+zB3RDoyMRxTzRyeZXCmnUsTmW2dNZLe7IyrNBLlLUl1JorMwmEaSQ/nbHlnM LEVwFQFzHcKtrbTaf2ifV0chuWXI9Cw0HgEl//Ak= 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 5.19 582/717] Bluetooth: hci_sysfs: Fix attempting to call device_add multiple times Date: Sat, 22 Oct 2022 09:27:41 +0200 Message-Id: <20221022072524.164978201@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376310019550582?= X-GMAIL-MSGID: =?utf-8?q?1747376310019550582?= 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 4e3e0451b08c..08542dfc2dc5 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 Sat Oct 22 07:27: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: 7600 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1106477wrr; Sat, 22 Oct 2022 01:38:00 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5BpyLNhLLgIvNneJ5Uo5rRHgSQhgdO/awQNvtbJJIWzmoAE22B9LOck2IDeM4Km3H5xWuq X-Received: by 2002:a17:90b:3505:b0:20d:2c35:9834 with SMTP id ls5-20020a17090b350500b0020d2c359834mr26580093pjb.122.1666427880266; Sat, 22 Oct 2022 01:38:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666427880; cv=none; d=google.com; s=arc-20160816; b=oJvoSRpTz8WEIOKoB2t+Fr14jaUx6+x3+xOBFWmFhYYoaZB1mPHX21hIJMR2JKfdt8 GcpP3nVolollETnxU7gzZ5n1PaZCRdxvD80x8oJBLrLqWeWFkxKpe6QMwMtbNh4+Xuhj 0NTL++ZKyFTbvlx65zEgsfrxWxiE+Vt+jo+2PHtHxuFNcEthu9fCRfiRTOUb7KrCdmKv WV4pKKNNEN4/RNJeSR21YThY04oa3wBYsK1W0t7b1pcyUMYZl4iBKxXowTOPp2WWWW0h tgDtbRNeS2hnDyPDD7OSDXwt3ZI3MS3C2HiMx7X8T/TZYrlpib1Zhg7jTy/6QAH3Tj+h lBFA== 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=u95MpHAAfzf6FFlDZJUXEyDup8IeV4MZHMz1A7Ogets=; b=RMDuggx/kDfzvGLZlSH0K15DgXjYDrRB/sNi2OLX3CLw7euxVaF5SggCnyDG3Y1fJS tE9QKMMvr9SbQwFIuJ+GaSTgpSdPcOqfyeVVIyc7tAbRLqG4xm9MjT6KYTjFBlx9Kw9p fhYIc5Or/BS2NCkYgSDi8imGq18b0Oxm68i52FBTcDTeXFrIVxwT8f6zKT7oI8++nwmg H3JeFDs2dTpgjECuFMPa+x9ki6uokOtrMdQRR6icIH6DTazIjhHVqbl2bsNwttu3yuoW TIHJQ/ETYv5os11QBbzVYZzUUV/jeFoRIb0zPROQMDdQM0v3XzyxQFFmQFyY0NFoV8M7 VldA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="l5SH/0mm"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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-20020a056a0024c800b005257035371bsi30145346pfv.108.2022.10.22.01.37.43; Sat, 22 Oct 2022 01:38: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="l5SH/0mm"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S234145AbiJVIeI (ORCPT + 99 others); Sat, 22 Oct 2022 04:34:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59700 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234333AbiJVIa3 (ORCPT ); Sat, 22 Oct 2022 04:30: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 D373225E8AF; Sat, 22 Oct 2022 01:02: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 ams.source.kernel.org (Postfix) with ESMTPS id F3325B82DF9; Sat, 22 Oct 2022 08:01:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 16CD1C433C1; Sat, 22 Oct 2022 08:01:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425689; bh=YHvVHIJX2HPHSLT4eGLhe20mkccL+miqWFxNvBZc7ac=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=l5SH/0mmTH/Dpn543hWJ81AadoByAYOrBjbJBJWe1wSqiW1fDSRZOOlp4yvdk1Blt WG9+g0GJx+Y4v8KIigdB/vM2pYyxiO1Tavy4/FOgyCwVxikJSn6lkxm2JI2zsiTQpr trO16pYN9bPXioU/LDexY8c4KAx3f8NDED+x4M/A= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Richard Cochran , Vadim Fedorenko , Michael Chan , Jakub Kicinski , Sasha Levin Subject: [PATCH 5.19 583/717] bnxt_en: replace reset with config timestamps Date: Sat, 22 Oct 2022 09:27:42 +0200 Message-Id: <20221022072524.213297711@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376280633129941?= X-GMAIL-MSGID: =?utf-8?q?1747376280633129941?= From: Vadim Fedorenko [ Upstream commit 8db3d514e96715c897fe793c4d5fc0fd86aca517 ] Any change to the hardware timestamps configuration triggers nic restart, which breaks transmition and reception of network packets for a while. But there is no need to fully restart the device because while configuring hardware timestamps. The code for changing configuration runs after all of the initialisation, when the NIC is actually up and running. This patch changes the code that ioctl will only update configuration registers and will not trigger carrier status change, but in case of timestamps for all rx packetes it fallbacks to close()/open() sequnce because of synchronization issues in the hardware. Tested on BCM57504. Cc: Richard Cochran Signed-off-by: Vadim Fedorenko Reviewed-by: Michael Chan Link: https://lore.kernel.org/r/20220922191038.29921-1-vfedorenko@novek.ru Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin --- drivers/net/ethernet/broadcom/bnxt/bnxt_ptp.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_ptp.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_ptp.c index 8e316367f6ce..2132ce63193c 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt_ptp.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_ptp.c @@ -505,9 +505,13 @@ static int bnxt_hwrm_ptp_cfg(struct bnxt *bp) ptp->tstamp_filters = flags; if (netif_running(bp->dev)) { - rc = bnxt_close_nic(bp, false, false); - if (!rc) - rc = bnxt_open_nic(bp, false, false); + if (ptp->rx_filter == HWTSTAMP_FILTER_ALL) { + rc = bnxt_close_nic(bp, false, false); + if (!rc) + rc = bnxt_open_nic(bp, false, false); + } else { + bnxt_ptp_cfg_tstamp_filters(bp); + } if (!rc && !ptp->tstamp_filters) rc = -EIO; } From patchwork Sat Oct 22 07:27: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: 7601 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1106500wrr; Sat, 22 Oct 2022 01:38:06 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7BH7XizclW+9b86GmZaqsTNQ1dtdtgDC2fGa4R9L+bGDHT2ox/n0qXtL2b7PkXEa0YssV1 X-Received: by 2002:a05:6402:1e88:b0:45d:237f:f468 with SMTP id f8-20020a0564021e8800b0045d237ff468mr20881918edf.45.1666427886232; Sat, 22 Oct 2022 01:38:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666427886; cv=none; d=google.com; s=arc-20160816; b=g8Ty8wUm6GrGZABfv2kXIwfKTg1sfd23U0m/T+0qGsNxIzgCjNHTxgBS9o3BZTkNbt JeMapOjrhu76jPtf7ASjfoRWZrQvC2c1Kp6doIKydnqCrQVd4bm9jyeQZz3mtax4JvAl ghhh2MMhrgG9/fClqAbRY7CzPyDHdessGMPMfqRUJS1ZqiLghmshH3+k+3RJmap6gHbm FoKLijKurc4xfIl0V6mev9bMedzKprm9KaIeenlkZSfmoklKfH9dxAftZNU7wDSQHHwU t+xkYuxp1ELpMTPTCT/3bggRHHUVA6Mejrf9zJDZB2wKd84YuRMru9H6AOM4+j2c06mp WTFA== 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=rdvUq6oC8llHPyJjqCSd1Mf00yHM3GF5rj9xuUaHSKA=; b=NdB24EOFGGj2AKLC9PkqFLuY8cfSMBjpYy2qP3XbN8PV520TKeVreBsvhv234sOdLl lpX8I1AFzHOsOwLyWEkC1Ok7IHEeGnEtV49O3JstPWhwIgTt8taKyqmQcu2AC62YnZdP P8FlbLN+KnByVOcS5AS9Ly2SiUrpGTrowjbD2tIEsEaUA2VY5bwE0J/CyeytgZ9x+cFk O8U67lD6azcPruUf7kaTBAgKZfzCyXaNRdtu8UfsoCV7K7SBSUPBczV80tX66+vXlH/d l+GbxCotbT9xILpC+mnFj3jWt3f2yzxuUFCPtZBCj9bF3QDdNZh59+oN7FGtyu3a2sTj 7vpg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="mFkv8A/L"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 z11-20020a056402274b00b0044711ea363esi25891708edd.21.2022.10.22.01.37.37; Sat, 22 Oct 2022 01:38: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="mFkv8A/L"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S234006AbiJVIdy (ORCPT + 99 others); Sat, 22 Oct 2022 04:33:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58736 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234260AbiJVIaO (ORCPT ); Sat, 22 Oct 2022 04:30:14 -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 860D62D083C; Sat, 22 Oct 2022 01:02: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 C5DB3B82DF2; Sat, 22 Oct 2022 08:01:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 27FFBC433D7; Sat, 22 Oct 2022 08:01:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425695; bh=sExncP2vEI4lKfEjoGTg9PlosArh89bqCxfpK8p7bwI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mFkv8A/L1b4gFcaMg6vfHyA3z9vpECxL+axQyfHT0LIb8f52yVW69T76DBOBuh6uz Yz0IXP4iIc/zpLcwtHVRdxGl5yxRAsHRmpymWfXMb48fQflbCsJ9JLgIjVza96c2cE wbI9CQZbNWei9xqR+sQLevbD/Y8cQatQVQwx+vuk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hou Tao , Martin KaFai Lau , Sasha Levin Subject: [PATCH 5.19 584/717] selftests/bpf: Free the allocated resources after test case succeeds Date: Sat, 22 Oct 2022 09:27:43 +0200 Message-Id: <20221022072524.258322725@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376287104927270?= X-GMAIL-MSGID: =?utf-8?q?1747376287104927270?= From: Hou Tao [ Upstream commit 103d002fb7d548fb1187e350f2b73788558128b9 ] Free the created fd or allocated bpf_object after test case succeeds, else there will be resource leaks. Spotted by using address sanitizer and checking the content of /proc/$pid/fd directory. Signed-off-by: Hou Tao Link: https://lore.kernel.org/r/20220921070035.2016413-3-houtao@huaweicloud.com Signed-off-by: Martin KaFai Lau Signed-off-by: Sasha Levin --- .../bpf/map_tests/array_map_batch_ops.c | 2 ++ .../bpf/map_tests/htab_map_batch_ops.c | 2 ++ .../bpf/map_tests/lpm_trie_map_batch_ops.c | 2 ++ tools/testing/selftests/bpf/test_maps.c | 24 ++++++++++++------- 4 files changed, 21 insertions(+), 9 deletions(-) diff --git a/tools/testing/selftests/bpf/map_tests/array_map_batch_ops.c b/tools/testing/selftests/bpf/map_tests/array_map_batch_ops.c index 78c76496b14a..b595556315bc 100644 --- a/tools/testing/selftests/bpf/map_tests/array_map_batch_ops.c +++ b/tools/testing/selftests/bpf/map_tests/array_map_batch_ops.c @@ -3,6 +3,7 @@ #include #include #include +#include #include #include @@ -137,6 +138,7 @@ static void __test_map_lookup_and_update_batch(bool is_pcpu) free(keys); free(values); free(visited); + close(map_fd); } static void array_map_batch_ops(void) diff --git a/tools/testing/selftests/bpf/map_tests/htab_map_batch_ops.c b/tools/testing/selftests/bpf/map_tests/htab_map_batch_ops.c index f807d53fd8dd..1230ccf90128 100644 --- a/tools/testing/selftests/bpf/map_tests/htab_map_batch_ops.c +++ b/tools/testing/selftests/bpf/map_tests/htab_map_batch_ops.c @@ -3,6 +3,7 @@ #include #include #include +#include #include #include @@ -255,6 +256,7 @@ void __test_map_lookup_and_delete_batch(bool is_pcpu) free(visited); if (!is_pcpu) free(values); + close(map_fd); } void htab_map_batch_ops(void) diff --git a/tools/testing/selftests/bpf/map_tests/lpm_trie_map_batch_ops.c b/tools/testing/selftests/bpf/map_tests/lpm_trie_map_batch_ops.c index 87d07b596e17..b66d56ddb7ef 100644 --- a/tools/testing/selftests/bpf/map_tests/lpm_trie_map_batch_ops.c +++ b/tools/testing/selftests/bpf/map_tests/lpm_trie_map_batch_ops.c @@ -7,6 +7,7 @@ #include #include #include +#include #include #include @@ -150,4 +151,5 @@ void test_lpm_trie_map_batch_ops(void) free(keys); free(values); free(visited); + close(map_fd); } diff --git a/tools/testing/selftests/bpf/test_maps.c b/tools/testing/selftests/bpf/test_maps.c index cbebfaa7c1e8..4d42ffea0038 100644 --- a/tools/testing/selftests/bpf/test_maps.c +++ b/tools/testing/selftests/bpf/test_maps.c @@ -658,13 +658,13 @@ static void test_sockmap(unsigned int tasks, void *data) { struct bpf_map *bpf_map_rx, *bpf_map_tx, *bpf_map_msg, *bpf_map_break; int map_fd_msg = 0, map_fd_rx = 0, map_fd_tx = 0, map_fd_break; + struct bpf_object *parse_obj, *verdict_obj, *msg_obj; int ports[] = {50200, 50201, 50202, 50204}; int err, i, fd, udp, sfd[6] = {0xdeadbeef}; u8 buf[20] = {0x0, 0x5, 0x3, 0x2, 0x1, 0x0}; int parse_prog, verdict_prog, msg_prog; struct sockaddr_in addr; int one = 1, s, sc, rc; - struct bpf_object *obj; struct timeval to; __u32 key, value; pid_t pid[tasks]; @@ -760,6 +760,7 @@ static void test_sockmap(unsigned int tasks, void *data) i, udp); goto out_sockmap; } + close(udp); /* Test update without programs */ for (i = 0; i < 6; i++) { @@ -822,27 +823,27 @@ static void test_sockmap(unsigned int tasks, void *data) /* Load SK_SKB program and Attach */ err = bpf_prog_test_load(SOCKMAP_PARSE_PROG, - BPF_PROG_TYPE_SK_SKB, &obj, &parse_prog); + BPF_PROG_TYPE_SK_SKB, &parse_obj, &parse_prog); if (err) { printf("Failed to load SK_SKB parse prog\n"); goto out_sockmap; } err = bpf_prog_test_load(SOCKMAP_TCP_MSG_PROG, - BPF_PROG_TYPE_SK_MSG, &obj, &msg_prog); + BPF_PROG_TYPE_SK_MSG, &msg_obj, &msg_prog); if (err) { printf("Failed to load SK_SKB msg prog\n"); goto out_sockmap; } err = bpf_prog_test_load(SOCKMAP_VERDICT_PROG, - BPF_PROG_TYPE_SK_SKB, &obj, &verdict_prog); + BPF_PROG_TYPE_SK_SKB, &verdict_obj, &verdict_prog); if (err) { printf("Failed to load SK_SKB verdict prog\n"); goto out_sockmap; } - bpf_map_rx = bpf_object__find_map_by_name(obj, "sock_map_rx"); + bpf_map_rx = bpf_object__find_map_by_name(verdict_obj, "sock_map_rx"); if (!bpf_map_rx) { printf("Failed to load map rx from verdict prog\n"); goto out_sockmap; @@ -854,7 +855,7 @@ static void test_sockmap(unsigned int tasks, void *data) goto out_sockmap; } - bpf_map_tx = bpf_object__find_map_by_name(obj, "sock_map_tx"); + bpf_map_tx = bpf_object__find_map_by_name(verdict_obj, "sock_map_tx"); if (!bpf_map_tx) { printf("Failed to load map tx from verdict prog\n"); goto out_sockmap; @@ -866,7 +867,7 @@ static void test_sockmap(unsigned int tasks, void *data) goto out_sockmap; } - bpf_map_msg = bpf_object__find_map_by_name(obj, "sock_map_msg"); + bpf_map_msg = bpf_object__find_map_by_name(verdict_obj, "sock_map_msg"); if (!bpf_map_msg) { printf("Failed to load map msg from msg_verdict prog\n"); goto out_sockmap; @@ -878,7 +879,7 @@ static void test_sockmap(unsigned int tasks, void *data) goto out_sockmap; } - bpf_map_break = bpf_object__find_map_by_name(obj, "sock_map_break"); + bpf_map_break = bpf_object__find_map_by_name(verdict_obj, "sock_map_break"); if (!bpf_map_break) { printf("Failed to load map tx from verdict prog\n"); goto out_sockmap; @@ -1124,7 +1125,9 @@ static void test_sockmap(unsigned int tasks, void *data) } close(fd); close(map_fd_rx); - bpf_object__close(obj); + bpf_object__close(parse_obj); + bpf_object__close(msg_obj); + bpf_object__close(verdict_obj); return; out: for (i = 0; i < 6; i++) @@ -1282,8 +1285,11 @@ static void test_map_in_map(void) printf("Inner map mim.inner was not destroyed\n"); goto out_map_in_map; } + + close(fd); } + bpf_object__close(obj); return; out_map_in_map: From patchwork Sat Oct 22 07:27: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: 7762 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1120816wrr; Sat, 22 Oct 2022 02:26:35 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6c2ml9utgXk3cDEjuSx33RvhhitozvhkKPiJyhUDRsdtCJIULx8+pivDX/xuyq2k0BJYn+ X-Received: by 2002:aa7:818f:0:b0:562:dc99:8a84 with SMTP id g15-20020aa7818f000000b00562dc998a84mr23384699pfi.30.1666430795180; Sat, 22 Oct 2022 02:26:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666430795; cv=none; d=google.com; s=arc-20160816; b=A0RofHy/nCJoQMOvweV8hJS/bKsk4biTyVzhaadUdv0we/QiUAwHL3e17z/8fFeUzy 8s59b3YgehEKQtl0gOhXCxSoC/8PIsLcXoSJYHKr2XzXoudTGMALXFuZ/kmVvj9qQd0E Ibxa0DcUe0+Uj0hjRxy+Z8LuVEU+u/LMygXkd7w6A9HnAmskLilrXfCZJ4zptN3fKb1k Ivp4ooXnkbZm8RkhCmKQBrpV4cC4MNGfJMitZdqEX3NNUyFGpB7Vh5617NLj7pd7mE1/ hZHB1yaRMsqvHbJj4W8KDsk8VlfoqzGJoF3hxBsi5VyA7DgGraPf6PJGPKU+02nhddNb rpVQ== 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=Bvop/fiX8oo9wmbXwfDKLsyD0kIhNNKOKZW1TjHzQEc=; b=mDIGiVMOwew8BtkcEBFDwLmEq6GtCL298WJZF+ygz4Ih/D1PW4YV5EzURQdGU1VTLH 8XBju0jGSYlnGNGsyJX1yOl8B/Gb5Z9ygJIfznOhSni6GT4CsEU5vOBlcLOixV52hxqh i6ePhJEzuqY30larlQOuP41xPoHx+n3e+3l4nM8ZN+sFTOh0YJg3zFQHW2CjIvHO87q0 19909sqU8Jx0+/dUgwCjHnUg+5wbn4seOUURvBagyibGo/RYuCZCm52VqTIXsMR/GIQw I3WXdr/LufaBzAmR2049EGpbQgzzElP5A1WUYfWX4SsqrYRrVYn/i1ofRIZoL232Q9R3 3uDA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="CL9yz/dY"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 h10-20020a170902748a00b001865c55049dsi9771322pll.570.2022.10.22.02.26.22; Sat, 22 Oct 2022 02:26: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="CL9yz/dY"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S230218AbiJVJDf (ORCPT + 99 others); Sat, 22 Oct 2022 05:03:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58746 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235092AbiJVJCr (ORCPT ); Sat, 22 Oct 2022 05:02:47 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1F7D12F7C34; Sat, 22 Oct 2022 01:17: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 B9CDDB82E18; Sat, 22 Oct 2022 08:01:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 32E5AC433C1; Sat, 22 Oct 2022 08:01:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425698; bh=Cq0O6Lq0YGpcmM8L/xBbBUGYACre6Ya9iOwxDcgfiwU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CL9yz/dYuHvfbmrfpu7e3/o0qO/RbMJ8UMf08Y0zP2qqFADmE5ivH/1oA9wqKSzmH Q3kMgyb32cnsrCgTJ6lo3U0TsKlfpND0NowwZGdHURoGxN7XoRgkuTMRPyIE6+MTjP uEhp1DWBWvwQscHpsLEdw5ASZ1KQuPR/YnYZXXdE= 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 5.19 585/717] can: bcm: check the result of can_send() in bcm_can_tx() Date: Sat, 22 Oct 2022 09:27:44 +0200 Message-Id: <20221022072524.309647985@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747379337447923440?= X-GMAIL-MSGID: =?utf-8?q?1747379337447923440?= 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 e60161bec850..f16271a7ae2e 100644 --- a/net/can/bcm.c +++ b/net/can/bcm.c @@ -274,6 +274,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) @@ -298,11 +299,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 Sat Oct 22 07:27: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: 7573 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1106187wrr; Sat, 22 Oct 2022 01:37:13 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7LM+aOy6UZgt4utd+WENbMku0PcwT5nNcTtCXGM1lOEHXzuOrbtNB4ANA2DncZJSIphXRx X-Received: by 2002:a05:6402:1394:b0:456:97cd:e9d4 with SMTP id b20-20020a056402139400b0045697cde9d4mr22149460edv.174.1666427833469; Sat, 22 Oct 2022 01:37:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666427833; cv=none; d=google.com; s=arc-20160816; b=q/z0eBsoje6sLDuKSdN6WsSAVHVGkq2Q848/kRaPM64uGBuI3rOvPR+cbDOS66HeqF ehEI5JrZgz0C3yzrRzcTkcfEMntlOXDLv5YWjJVaw5xjZrHxCqggmxDttIeDNH8Jscvi tDTtRRWgD3+qauT4lofyKnYbpiyy8QI3PRiPp+Y2kcwocOCxFEJedH50L3tS8Efcv2A6 pAxpxZ1LcDsh+vNK5M390AS+D6yeRyBNogaQ2IYF/0jS/QkIsgvmb2LFvBZw6/IR5JpS r9mwf1BtRn4JVl/33rMwFpGTtjszh666TFWxJ2Bt4cOHSxto1tEl7hWQeJ0y4+ZHCpew pJAQ== 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=Ske73MuT1IXEo+gGunIKu5I/82K9kQTDsYWeP0SL6fI=; b=rzOwPFIm55wVSgDWnOwuk5tP+LU/4artdDDJ5do+/JDNbxiAnXGaRgj6y8cQD3jmn4 T3SMt4mLzBIkMopC+A2L+apHWhJ5pVre7RFcedtYfOhZZs37fkUgpjZHoX/OOTYXY5Nt o5+AuVmDMEpcwECNqglyygxg+Y7rNLoF+Hzo8fEeMyMuoTIyKruWUE5u4GnVfF+Jc7fp chgVW1BkK0h38nZwTndLEefDcOQO4txiNdNfMuYaw3l6qerxyYq2pxO2RvRtrVoALLz3 5YeZfKYWRD3y9/gZJ/3VeOsP+ZoaqtHY5C4W6H/25dBBL0A8pUqRfziekcvcMEY5XNjB nayw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=bIew6r+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 xc13-20020a170907074d00b007a0f4d6bf83si1206255ejb.305.2022.10.22.01.36.45; Sat, 22 Oct 2022 01:37: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=bIew6r+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 S231598AbiJVIcK (ORCPT + 99 others); Sat, 22 Oct 2022 04:32:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38764 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234005AbiJVI3K (ORCPT ); Sat, 22 Oct 2022 04:29:10 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DBE96257600; Sat, 22 Oct 2022 01: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 075BB60BAF; Sat, 22 Oct 2022 08:01:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1B4E0C433C1; Sat, 22 Oct 2022 08:01:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425701; bh=F5C9xZeKmsTJNbgIxGRpnScpQISfkO8XGRXBB5xjG3o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bIew6r+k1CEz+walomXavC5ALUjxWjidrB4lRAIcx4wbkk8de15ncCdZG79hDhct6 DuhYrorWblXmq8144AqkjFymQVksFEj9u5x/ZF8KuC43ySTBb5CM6pBdRL/UmWwvLN URLIJ+4qOpwQ9IysrItnoW0CAc6BnI+QMncNuz5E= 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 5.19 586/717] wifi: rt2x00: dont run Rt5592 IQ calibration on MT7620 Date: Sat, 22 Oct 2022 09:27:45 +0200 Message-Id: <20221022072524.361651007@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376231926624295?= X-GMAIL-MSGID: =?utf-8?q?1747376231926624295?= 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 cbdaf7992f98..b4fb4d1bff57 100644 --- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c +++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c @@ -4365,7 +4365,8 @@ static void rt2800_config_channel(struct rt2x00_dev *rt2x00dev, reg = (rf->channel <= 14 ? 0x1c : 0x24) + 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 Sat Oct 22 07:27: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: 7772 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1121119wrr; Sat, 22 Oct 2022 02:27:33 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6BdQwUEqev+jBA3BU18XtennPB5NTL2MoGlqTqy8t/twXDFchunuI3Zv5gKe/369sfilJT X-Received: by 2002:a17:907:3f85:b0:733:3f0e:2f28 with SMTP id hr5-20020a1709073f8500b007333f0e2f28mr18574730ejc.376.1666430853555; Sat, 22 Oct 2022 02:27:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666430853; cv=none; d=google.com; s=arc-20160816; b=lA1enNN24GkZJb8fjFxGx2GdIKVxxNNdw/mmxmZglgKA5Q48w+CKmC/n3jqHqXF+bV ELkNxYR4ABqEL1ONW7onlOlut/8mnKo1jSMzIe/UdxSB4633UAafvL/EBQi+DB7gXdSC 2ndkfeEsPDGX5rcxczBz7ijzqvoKVNQtkBhtsL3Vs0tgZ8vLAJ0g2C9uTxW/s6x2wtiv zubd0iM69jAPKo250sXagmu4o5eumZPT2Go6PC5zYmv+Si8UqlW6bQ9ej8OdHY6osy8P XyYrj/34zgpCc/l7EH5dUFVjCmTTUTO1RqjCv/SgGweiSyBqBdUwIPnr/CVH7AhzY3Ux LZPQ== 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=hmnawpeGzLIrNHp3t1DpCkBIAJrMIRDzH2CozytF3W4=; b=Gz6zEAPyKoaZe1kZdc1WEaxQPYltjXoZf7edZvnkslUNH0ABCuXOa2fxbL1B4hJfsv dHtj3/w0NIsMcQzJIpbBJSHrMmNoEYs/hs+1cJJ7IC3ARAjQJSMwg/u2iCSUoNntvZ0+ lnJuNnSJiocTlbcAJoMoW/JbXjeaM3TWRhiDeyZzAnLeurbxmfD/h5FpJ71yMawyvKWO at+m2UNL1NdNH6h5sAc6D/I07okW+vbHeVdZ7mv4LAKFOQVA42L2BujSb9Ole6q/NqKc P8HzxOWYBKClshltl1ro1PAV6H/+od8eNDFsUq98LzX685jlS3nBaepK22eV6HqhpIaq aQsQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=QCLYih4F; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 cn1-20020a0564020ca100b00453b9f11b56si6065396edb.261.2022.10.22.02.27.09; Sat, 22 Oct 2022 02:27: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=QCLYih4F; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S229568AbiJVJFU (ORCPT + 99 others); Sat, 22 Oct 2022 05:05:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44010 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235110AbiJVJDr (ORCPT ); Sat, 22 Oct 2022 05:03: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 9292E2DCB06; Sat, 22 Oct 2022 01:19: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 28760B82DF2; Sat, 22 Oct 2022 08:03:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3CFABC433D6; Sat, 22 Oct 2022 08:03:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425819; bh=64BKziNuR3Z1Z/RqTCjglZOg+zcP3c9qVCoBpV4Iu6Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QCLYih4FXOHsNI+VyAHSpkBMp3Kn4KdaRrjbCHSjHidS4F2NVL/iV5BP4tez+w9EQ M2YVku7n2PL0f7QgrYGfJ5miMlvvPcopyPGI4hxmQIthABeokBZ9WJRiYogt3xobqk lWPDDiUU4JBKE6C5Uglh8r2DaIbaERFhKtbZNLMo= 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 5.19 587/717] wifi: rt2x00: set correct TX_SW_CFG1 MAC register for MT7620 Date: Sat, 22 Oct 2022 09:27:46 +0200 Message-Id: <20221022072524.403947326@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747379398383896543?= X-GMAIL-MSGID: =?utf-8?q?1747379398383896543?= 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 b4fb4d1bff57..854637b1db49 100644 --- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c +++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c @@ -5868,7 +5868,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, TX_ALC_VGA3, 0x00000000); rt2800_register_write(rt2x00dev, TX0_BB_GAIN_ATTEN, 0x0); From patchwork Sat Oct 22 07:27: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: 7638 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1107615wrr; Sat, 22 Oct 2022 01:41:31 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4SJaX61fBg8OgkT7zA6w1QL4N5FUDJIl0PWabA9bFqS1FUUm13gH0mF0M/Wi9QSCz9PEHo X-Received: by 2002:a17:906:8473:b0:77b:efa8:50e4 with SMTP id hx19-20020a170906847300b0077befa850e4mr18943690ejc.250.1666428091768; Sat, 22 Oct 2022 01:41:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666428091; cv=none; d=google.com; s=arc-20160816; b=IaDnozJFhbJTBUaZp1Z4jQAkZR3MlgErpd5U6MLqZemI48suTYkekzW251G56/NmeI S+nLnu5ltTwCnVBx5eUwapaRGbgl2CehmFlSPdocNB8SEBs+VkuBJeDq86kmWz++6db1 6dIl0MBwT7AopWW2/ptSSOKNJEmP0jaVrBL8EPCX7WdyW50wiRehn4Xtm0iX+TpiZ76R WM2T+0kZvoI/PQuPvUI3HNafc6Wd8TSEoW09cDtbFEU04Mxglj2zezBTs3/yCYU7sc6i 7d859M6y5eAh2SaC4K44PNBCg7dpwEok0v0GmStsWl0EyqKpBaUTAR1aKHHa2k0RZagg Na7Q== 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=YovZNANtpBrTthKQIKX+OeXDPcUMUvBF8a+sQjYAwlg=; b=IYIfI0oLNJfpPbFyUuRacnPHnfSXI08SbaQVtD0kP0pgO+3qcihWv5J6/YtuDuzbNe Rnh7QQq1cYVaUnG6hsBWaMGgTbg1/hDmAeZ71kfVeDfYGqzRziLnM5zfQWBP0LZDS9L3 68hXRAetiZfIRfxE0FntYAJuT7171ttXeIr3z/1PCPe0XklcLXHgELTNGape29uf5obz G+IaKpwEUQHayCivgNGKEi1+64SCiZnm5DsN1fwJv64ZKfIEiDmj3twsMnt92K8cdCD4 veS2O6n8W1NKMACURlT9QrjREwUKT7AySIu5t3Uwy/mftrgGEGdzQDr1C2beKlqHrWXk cApw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=JqBqnZ1U; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 b13-20020a056402084d00b0045c98bb5359si27887207edz.590.2022.10.22.01.41.06; Sat, 22 Oct 2022 01: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=JqBqnZ1U; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S234169AbiJVIeQ (ORCPT + 99 others); Sat, 22 Oct 2022 04:34:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58714 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234360AbiJVIae (ORCPT ); Sat, 22 Oct 2022 04:30: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 D1C2F981DB; Sat, 22 Oct 2022 01:02: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 ams.source.kernel.org (Postfix) with ESMTPS id 2324DB82E1E; Sat, 22 Oct 2022 08:02:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5961FC433C1; Sat, 22 Oct 2022 08:02:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425725; bh=3ShDxGhyePnM87c+choxm1LMKSGJtavEgMGFhBuaV7M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JqBqnZ1UGZWPsuRn8oNOD0JoqI5bBN5ihyFYQMlpZmN02i2EzwEcxH7BWbOjlsiZg DvEqWku2zEWfNV5Cz+7Kwv7MomQlVOd5MUS2EyRXQiHvm+UbqEztDBflPG8labf2xz FyTof6i1B5lQ4u+RC+fz2GfgH9JlTU+XkNEHd9t0= 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 5.19 588/717] wifi: rt2x00: set VGC gain for both chains of MT7620 Date: Sat, 22 Oct 2022 09:27:47 +0200 Message-Id: <20221022072524.443299385@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376502481633965?= X-GMAIL-MSGID: =?utf-8?q?1747376502481633965?= From: Daniel Golle [ Upstream commit 0e09768c085709e10ece3b68f6ac921d3f6a9caa ] Set bbp66 for all chains of the 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/29e161397e5c9d9399da0fe87d44458aa2b90a78.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 854637b1db49..c8fd4a1f9ed1 100644 --- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c +++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c @@ -5645,7 +5645,8 @@ static inline void rt2800_set_vgc(struct rt2x00_dev *rt2x00dev, if (qual->vgc_level != vgc_level) { if (rt2x00_rt(rt2x00dev, RT3572) || rt2x00_rt(rt2x00dev, RT3593) || - rt2x00_rt(rt2x00dev, RT3883)) { + rt2x00_rt(rt2x00dev, RT3883) || + rt2x00_rt(rt2x00dev, RT6352)) { rt2800_bbp_write_with_rx_chain(rt2x00dev, 66, vgc_level); } else if (rt2x00_rt(rt2x00dev, RT5592)) { From patchwork Sat Oct 22 07:27: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: 7756 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1115597wrr; Sat, 22 Oct 2022 02:10:56 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5r/a9mS7pOdI8h8xM/v42UiaTY/PhDIFULqN0MTqPPBJgCC7zbvX1ap6AxI8z6GSYY2RmG X-Received: by 2002:a05:6402:538a:b0:457:b602:d5a6 with SMTP id ew10-20020a056402538a00b00457b602d5a6mr21594921edb.371.1666429855948; Sat, 22 Oct 2022 02:10:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666429855; cv=none; d=google.com; s=arc-20160816; b=B4qSS9QltFS5K7F6I9QDK/6UaEC+lUEpwpIRs8rzBtn4IwIs4vdK7MR7kXf69qSOp+ dOrrPlhyQZaXozRRI4qTFxbAUcRocR73ZX88Oh6y+Ze9pHNbgi9nIy3WTp2Q4vOJg+m0 i+hhCILRBCwGN3xPr8Z86Q7hlu4ZUPSf9B1dFtdE52/42YW6AFNMvFphc7VHDzi1QoyU MV32SGUcxCICIZqyzGi1PDFiGP7UNVjeTJ2MxB/9yPruJz4akB55sLKYMAQRt46XWBMO K34BhPxEey/axQ9kX/Hai+1/LTfOlI6gYGt4ATb0hv08X/Xf7M5/HRKFJWiBmnGURla9 lvgg== 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=tSMmffX5XG/Ssf3u4tZLw6v8uX0DwjuaYi7Q7MiUv2A=; b=ZN0uXDWV0x3irignE170RcPBmx1NcGJ95HVDIbncksbx5d3oYc6iN0HmPdEJhAq4Gl Z8hwnv2SOWYlwwX0lajYZAunC2zxLYIUc6ZbnFdRrTM95iUFaSj0hvEUHYUtcCsSHa3u TusBvLJ8hEijw4Dt3kM/28uC+rbbmTGCwq3D1GXhNt5Rs+7qu79hBIbkpBHAIWTOgK8p /iB/TH2kQbcX3zBuZytr7ltB1TwFlIEBO4KWe/YzPMnqYFiD9nrf8BQptTX6LsjS52Hm +KxzcMMXe4PPKz5dSO5bkWACGyLJpUESL4rI/MSey4oCApzwvIdM6VlcEke9CjhdOP51 j6Jw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=uTvERsoK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 q10-20020a1709066aca00b0078db8fe2834si20387937ejs.245.2022.10.22.02.10.31; Sat, 22 Oct 2022 02:10: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=uTvERsoK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S230518AbiJVI7Y (ORCPT + 99 others); Sat, 22 Oct 2022 04:59:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44504 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232089AbiJVI6Z (ORCPT ); Sat, 22 Oct 2022 04:58:25 -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 2C48324F165; Sat, 22 Oct 2022 01:15: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 0F2EE60B45; Sat, 22 Oct 2022 08:02:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1E1D3C433C1; Sat, 22 Oct 2022 08:02:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425758; bh=NygH2U8z4vPiZfC8h/SGRJwm3TiRxiP8XVeO3Pm+GcI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uTvERsoKr1QNzXzZ0EnbIfz4Jqf5JjJq2+XZ6pxmnIrGb3R1VXSPzRi4XN5ekczJv /Ogn9fANZyAbY5W/qWJTn2XYX229v2RCoxvyJU/aKyIUw7sModL+N42W+q/PD7bBgF mXvwY07+1krFvTl/lnGw2gZz3JWS7ENjYk8UZsM4= 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 5.19 589/717] wifi: rt2x00: set SoC wmac clock register Date: Sat, 22 Oct 2022 09:27:48 +0200 Message-Id: <20221022072524.485562606@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747378352876277946?= X-GMAIL-MSGID: =?utf-8?q?1747378352876277946?= 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 c8fd4a1f9ed1..1efb80a98397 100644 --- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c +++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c @@ -6131,6 +6131,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 Sat Oct 22 07:27: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: 7645 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1107750wrr; Sat, 22 Oct 2022 01:41:59 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6UyZvV/huETHhWPEiqlRS43fedvCgOjhe+PMus1CDUcdyqtowjv/f3Ug3n3S7PeqE6h2T4 X-Received: by 2002:a17:906:cc0b:b0:78d:f3b9:ab15 with SMTP id ml11-20020a170906cc0b00b0078df3b9ab15mr18948253ejb.367.1666428119348; Sat, 22 Oct 2022 01:41:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666428119; cv=none; d=google.com; s=arc-20160816; b=XoMnAt1d/RCnwGqta7VbJD3DT+hU3oDUzkera8W7DZz64zXxXfKyBCF+mVtG/iyJU2 u8stlgvpe3Bwih5ZXGFDQgAo9mOiUxEa+xXsncJ2ffXH+cX7mOVc0iL11uGWd324G/3l X0SqmfJ+NcsHSOcpBZg4H2c/uC6TpHC0HKZR4FSj1AUJcsEBetZSFkMudPu2N5CbbEpK Pc4GXUIqGGgNG/bm7YCQQvHOqmYzUa1EdJ2DDO+GsKYTqqY1xHrlDFSz7svuDXDb7hlc 01h4Qp4yel5Q+A0ee+1vSLdavUogIjGsxnX+vb3sT0yaMlVC1c9wuiPx17ojouQmBUGK 7dzA== 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=12t60BSEqGi6TImFsmEUQZ63E90GshRStKCSLZR1eMg=; b=q0dfyUM9JWBE7wkMqtdf5mX+nroUEN1Fu1+s2DT7U+l647N1/duBi+gbp/3pypci99 vpLyZn0ZTkM7LJ79ocly3dohlRY02in9xkOU5Sc4/KsIzsHgrNzqAf2XMSark6O9HZKt TMKUgv5KT8YOovYAa16M3lKj3dfnvLRVRuKwr7HDYgptSIkJITGPq/Ei4ptGfNsyBtJi cjDqryZWDqDRs7oo4XJuf6oPMWXpqa+HliB/DppaUn+rAavuJmXXFhf8dp3yXO+rAf5S CrjffHKF9U1up+ffty6+6/uzccOEXIrCxN/aorMmfPcJQ2kkvnmt+Ae6VbW2E8vdeCkm eiOA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=WBJrV46x; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 dd16-20020a1709069b9000b0078e54eda758si19437223ejc.611.2022.10.22.01.41.34; Sat, 22 Oct 2022 01:41: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=WBJrV46x; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S234498AbiJVIit (ORCPT + 99 others); Sat, 22 Oct 2022 04:38:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58746 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234295AbiJVIer (ORCPT ); Sat, 22 Oct 2022 04:34:47 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E82C72A4E18; Sat, 22 Oct 2022 01:04: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 88B4160BB5; Sat, 22 Oct 2022 08:03:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4FA48C4314D; Sat, 22 Oct 2022 08:03:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425792; bh=mhQ4G0Nf0x6z4g4ltSMEwBamWtHb7+BVQzPIEGpstb0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WBJrV46xqSImKvaNph60+76yYlWDALx3O2XmBqt5SKvZhPetGr1yuGznHCwLaSoL+ x5NsPEGRYyY5jM3EQIhnmGH2cqcrxTg6A+XdDCYpJpnr4AHNhw+H+cdoVU/OjMkcTi pfbRcYLk2MEhj2xIJpmCBbZZGdsvhy9P2Mm/itN8= 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 5.19 590/717] wifi: rt2x00: correctly set BBP register 86 for MT7620 Date: Sat, 22 Oct 2022 09:27:49 +0200 Message-Id: <20221022072524.526336846@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376531805656095?= X-GMAIL-MSGID: =?utf-8?q?1747376531805656095?= 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 1efb80a98397..cf3ef44f18f2 100644 --- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c +++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c @@ -4164,7 +4164,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 Sat Oct 22 07:27: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: 7776 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1121178wrr; Sat, 22 Oct 2022 02:27:44 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6Bs5ZOnKx9Ilw9iuJkW00CEe0u7csBxOLl0i+GqFg32bwN4S5g+pyGXcvTpxttf9yg/6nO X-Received: by 2002:a17:90a:c984:b0:20a:ac88:d39d with SMTP id w4-20020a17090ac98400b0020aac88d39dmr61976923pjt.13.1666430863976; Sat, 22 Oct 2022 02:27:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666430863; cv=none; d=google.com; s=arc-20160816; b=X1hJPLPQqXhfs7MSAvl6kMbPwW0ScpGCbbLW63ehkMo1JM/+vYdxyO/LdoROeV2ssb q2Y7b0B/3Wdpe5dLCoWu3YYhGy/0EYDumVAzMdqf0hoqhzrS1MJMN0By/ABJUtWtJZS9 yHefC3odvS/ix4To1H3T1BWpkhW/yXmzCF596kuaFu4KmrgnkDfuEw+Qx0gs7F07obSn 6QvTitTszL/HHqiMthNx+KWku/uo2RmyD31V0dfPDh5rAgVCUgt3IYx+88WQXpfcRyxZ 07MOqAdU38uIFY97rptNcN0GOLLAdi26i9LWoQ8pYyiVCYLNFevFBHn02v9bBK1yy/Uu BSpQ== 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=wdSy2AMLBHsR0r0O87E+S3p7TRRvKcKur5NO1csm2CM=; b=MtTO+awmJYUVGkOcsGXAbRd+XU5yy2A35vP5wKJAP/TkrtE6zQDfIpdlxDjeWPlhQJ GQCX5Kh94PFEEoNA8I2Wi/+OCVi5nsdkdQkPpTQOkUWZpj7x+aJ689kowsjQVAM8mR9/ Awd/Mi9R7PrF2Xaq9iPw5gFtRPGjCuvvysfwDDj0/jKtxoPHaf0zjgFO4Rumk2T/te6f iGc6H0+NePbx2r1pNnuHxaJN7tu77K3B/16F/F5//w39S6HJGpAbK1nIT3P+ov+zi0vd /s0BPxIyyo88O5OPPDbaC7e+7jsmDT46SGzP1nKT9qLM9nZ08oc6p/RPqH8DynZ3v2Fm cNrw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="X/WyWtuJ"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 i11-20020a170902cf0b00b0017f580f646fsi30918155plg.304.2022.10.22.02.27.32; Sat, 22 Oct 2022 02:27: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="X/WyWtuJ"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S234772AbiJVJDn (ORCPT + 99 others); Sat, 22 Oct 2022 05:03:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34268 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231627AbiJVJCz (ORCPT ); Sat, 22 Oct 2022 05:02:55 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A38562FA5D4; Sat, 22 Oct 2022 01:18: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 dfw.source.kernel.org (Postfix) with ESMTPS id B7E0660BB8; Sat, 22 Oct 2022 08:03:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id ADE0EC433D6; Sat, 22 Oct 2022 08:03:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425801; bh=k3ZzKbC9zNarUtRLUEgprjT0EFS8qIm+is5xwTEYpXA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=X/WyWtuJZlgKxqtVukjR7L1b9jq1tN5Zwvo2zlxXIZiGl9leGf7ogYJ0xNElu9Knm 1wkrreNWRRILqZqzXUlY8iYn1mNhWGZImz885AsRdVaaVVpCdWSsA8XLY64GtQZts+ ghFzZPx67KwW1ST2R1eA/GGPZD0qw2utjGYHOSvk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Jason A. Donenfeld" , Guenter Roeck , Sasha Levin Subject: [PATCH 5.19 591/717] hwmon: (sht4x) do not overflow clamping operation on 32-bit platforms Date: Sat, 22 Oct 2022 09:27:50 +0200 Message-Id: <20221022072524.574695065@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747379409668291584?= X-GMAIL-MSGID: =?utf-8?q?1747379409668291584?= From: Jason A. Donenfeld [ Upstream commit f9c0cf8f26de367c58e48b02b1cdb9c377626e6f ] On 32-bit platforms, long is 32 bits, so (long)UINT_MAX is less than (long)SHT4X_MIN_POLL_INTERVAL, which means the clamping operation is bogus. Fix this by clamping at INT_MAX, so that the upperbound is the same on all platforms. Signed-off-by: Jason A. Donenfeld Link: https://lore.kernel.org/r/20220924101151.4168414-1-Jason@zx2c4.com Signed-off-by: Guenter Roeck Signed-off-by: Sasha Levin --- drivers/hwmon/sht4x.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/hwmon/sht4x.c b/drivers/hwmon/sht4x.c index c19df3ade48e..13ac2d8f22c7 100644 --- a/drivers/hwmon/sht4x.c +++ b/drivers/hwmon/sht4x.c @@ -129,7 +129,7 @@ static int sht4x_read_values(struct sht4x_data *data) static ssize_t sht4x_interval_write(struct sht4x_data *data, long val) { - data->update_interval = clamp_val(val, SHT4X_MIN_POLL_INTERVAL, UINT_MAX); + data->update_interval = clamp_val(val, SHT4X_MIN_POLL_INTERVAL, INT_MAX); return 0; } From patchwork Sat Oct 22 07:27: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: 7844 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1154017wrr; Sat, 22 Oct 2022 04:07:20 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4WffxEQdq3pOnknHXT072sugCGOer5vh+QB2mSubEFOP4YoBDAcmb9F8PfolULF4QjtVfu X-Received: by 2002:a63:8a4b:0:b0:460:7c54:1b2b with SMTP id y72-20020a638a4b000000b004607c541b2bmr19900776pgd.499.1666436840731; Sat, 22 Oct 2022 04:07:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666436840; cv=none; d=google.com; s=arc-20160816; b=HYoPkDcnoLN6FDS37GTKZfLP/3NWI5FOVrCHVszgh8UhQZgcCV+DPfebqh8Dna7yvp SqUWpzFYJFK2ZpPk4XHyI0uFB19CkdL4D5jeR5wyccvgM3ehOvXitkvgl1ER4kSaIZ4y DE2BZRia/ujvnkZO9+Ru1LRyQYzu4C5vEROpdXcNJ5jzaMRX9sjDbSVgRd+XdyVQ1gMU e/3Q8yBCCfGbLNcdCTgnjmtMe0K1+haKY2TTlfkoBvtRrQLNFubhvmXmtflkTLeUZ8qm 0wQ6n67A/wdG1i7tEAGULovuq1jcVFCitQxrvAS1FiOJavY4ZouPp3GCe3HntQ4keKPb aLpA== 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=1+bklmZqKkJKywX6JbVZVlgkso97nij6Q4Mg7vQ2y3s=; b=vIBBB2Z7TFOHN7YBHFn9lWebCN0zr9eClK2tF0yHF8Q7MBs/ViO4ZoDoCcAyGxaY55 CXZmh0Z0z2BDOkC2FZt4EVOTxn/ELI5ELkWCk/ONCDD7CY72Xdp1JDS3nFS5jTQGDWhr 8a3QkDgT0GVxz+G+P7bp7QW2sfhH0tTahbNnA22uHJBE2SJRH1cgvhIOoNj37RxbQDtv 5IbBS1zX5/T2LZ7dpvv6LFHL4QYLmADMLFjhwitEkO+lVoKMg1y6E/4jawXTOtII46tP 2mdgJNp6yg6SNmWXBl/WthONKXZ30+pNs+SwuJJFAsi4gsYG+PK1E9OVHb1XO8zpLEX0 2c3g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="xi9O/DIT"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 lr11-20020a17090b4b8b00b001fab0d18bcasi11718273pjb.66.2022.10.22.04.07.07; Sat, 22 Oct 2022 04:07: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="xi9O/DIT"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S230136AbiJVLD0 (ORCPT + 99 others); Sat, 22 Oct 2022 07:03:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52128 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230490AbiJVLCl (ORCPT ); Sat, 22 Oct 2022 07:02:41 -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 005F32FACFA; Sat, 22 Oct 2022 03:21: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 72AC5B82DED; Sat, 22 Oct 2022 08:03:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BF1F3C433D6; Sat, 22 Oct 2022 08:03:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425804; bh=FHmskZLC3rOyEZgjdwW+ifoYQUgvUC1l+yZwcFFvZY0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xi9O/DITqi2Eh+VtT1bgkazjzdiUTFfFIG1ObjYa9SR2hlTIVRBmOoPPUIMMgiLaL hajOBUZaPGKWduN36CgTZ+E/iSDriUjnHvij7rd7JtXmVya7N+cP2LKMabBFdFoEJy glxXpI/2AFj0jyfjJOv4k1ZH1WBjm7rJ9fg5+iU8= 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 5.19 592/717] net: If sock is dead dont access socks sk_wq in sk_stream_wait_memory Date: Sat, 22 Oct 2022 09:27:51 +0200 Message-Id: <20221022072524.625276095@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 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?1747385676477672602?= X-GMAIL-MSGID: =?utf-8?q?1747385676477672602?= 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 06b36c730ce8..2ee82115b919 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 Sat Oct 22 07:27: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: 7626 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1107496wrr; Sat, 22 Oct 2022 01:41:06 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6lPFpGa9tDqX34aSXN3+B2IejjrBMZow8eZPQ5stAz4Z6hoic+x15EWKv3sqbAqSBSe6jJ X-Received: by 2002:a17:907:a06b:b0:78d:d25f:b726 with SMTP id ia11-20020a170907a06b00b0078dd25fb726mr19318473ejc.203.1666428066715; Sat, 22 Oct 2022 01:41:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666428066; cv=none; d=google.com; s=arc-20160816; b=RhvY6Gu6/MEgYmRkAA5Pgv/NBnBUrb7D2G6J+63URa0GXxkJ2Lxi1BCr8nRDukHZB+ wTVFAV1UEvlwblvhGzaC47nBl8qjthASyB7eTjADcs/iz6pFW/P8Ur2KJWJNb+hdzWHb oppfuhqFDmVsdw5QxRKYa3DbglXdQuVcz8lmkO25uHSwm0RUlheLJ2kLXLtSxZKzEsml 9mL59a6nC/Bjz+NYWU/c/9OR2yc0ipme0YlbEWzoXLSw50xzMd3WDZeS+rTyFiCqNigj qxzHsjPnyS/AgDm8F05qoLjlWeq8HnZYfo/Ag8ZOH4+2wcl8U0cnLaWrFl/1jqH+2d5Y znsQ== 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=sCVYOWXp+0BSF9HTNK4AnTPesPRqj5RUvsuMbTRptno=; b=Dt4ds+i4mMH46cgUhLcOop2gTE/9azkJ16LdIXImxwhleqpRP8w8couFsplIYNH2kc 1/rbX1DwEOJQgVNqihx1clwUFROt4BQVGdfpIo1nrtiC34YiUn8OZ+wOH/YsPCkPw9C6 ey0/IPzsQ7npPHakJRjaxji3vlt8wVIB+6sHjScfqqWXYAmGxjoFU5+GVhN72Ns730c/ tod9qI5YtNkTjCxlI2Dmb6I+9dsSwdYbKU/qykcbqwJZYGoLQG5NqfCm3BGB6Sngv5lh 5h93JTeSxb7SYSh4NjM+Q9Xtw66zeyPjUSo2JWgM9h5/l4UyiPOcpKKFVvPihU5orvyA LduA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=YZaEH6RT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 i9-20020a0564020f0900b0046074707fc5si7134665eda.163.2022.10.22.01.40.38; Sat, 22 Oct 2022 01:41: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=YZaEH6RT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S234384AbiJVIhs (ORCPT + 99 others); Sat, 22 Oct 2022 04:37:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58062 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233959AbiJVIb7 (ORCPT ); Sat, 22 Oct 2022 04:31: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 937782D1285; Sat, 22 Oct 2022 01:03: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 ams.source.kernel.org (Postfix) with ESMTPS id B8AD9B82DEE; Sat, 22 Oct 2022 08:03:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EAB11C433D6; Sat, 22 Oct 2022 08:03:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425807; bh=73g0JsSReowuNUCn5pgQKkzbNbSYaz9WNv4ymMmfb/0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YZaEH6RTyOT9DOpgoaD2qImb/ekLbMtp1bYxspTVrpDaKcjQ4cO6K0GjHsAdeg4Sa sSbE/buFdZjj0ZG4W6P8eDcUE98/2EN/smaPQvuKJrcIviUmmehbwX2KpZ5s/OZBp0 uLpChOal7ZFW3CnK51Q2xL+jXA1eKye6Ha0Bh/Dk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Peter Zijlstra , Martynas Pumputis , Andrii Nakryiko , Jiri Olsa , Alexei Starovoitov , Sasha Levin Subject: [PATCH 5.19 593/717] bpf: Adjust kprobe_multi entry_ip for CONFIG_X86_KERNEL_IBT Date: Sat, 22 Oct 2022 09:27:52 +0200 Message-Id: <20221022072524.669631658@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376476471423963?= X-GMAIL-MSGID: =?utf-8?q?1747376476471423963?= From: Jiri Olsa [ Upstream commit c09eb2e578eb1668bbc84dc07e8d8bd6f04b9a02 ] Martynas reported bpf_get_func_ip returning +4 address when CONFIG_X86_KERNEL_IBT option is enabled. When CONFIG_X86_KERNEL_IBT is enabled we'll have endbr instruction at the function entry, which screws return value of bpf_get_func_ip() helper that should return the function address. There's short term workaround for kprobe_multi bpf program made by Alexei [1], but we need this fixup also for bpf_get_attach_cookie, that returns cookie based on the entry_ip value. Moving the fixup in the fprobe handler, so both bpf_get_func_ip and bpf_get_attach_cookie get expected function address when CONFIG_X86_KERNEL_IBT option is enabled. Also renaming kprobe_multi_link_handler entry_ip argument to fentry_ip so it's clearer this is an ftrace __fentry__ ip. [1] commit 7f0059b58f02 ("selftests/bpf: Fix kprobe_multi test.") Cc: Peter Zijlstra Reported-by: Martynas Pumputis Acked-by: Andrii Nakryiko Signed-off-by: Jiri Olsa Link: https://lore.kernel.org/r/20220926153340.1621984-5-jolsa@kernel.org Signed-off-by: Alexei Starovoitov Signed-off-by: Sasha Levin --- kernel/trace/bpf_trace.c | 20 +++++++++++++++++-- .../selftests/bpf/progs/kprobe_multi.c | 4 +--- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/kernel/trace/bpf_trace.c b/kernel/trace/bpf_trace.c index 88589d74a892..af13fdf1d86c 100644 --- a/kernel/trace/bpf_trace.c +++ b/kernel/trace/bpf_trace.c @@ -1026,6 +1026,22 @@ static const struct bpf_func_proto bpf_get_func_ip_proto_tracing = { .arg1_type = ARG_PTR_TO_CTX, }; +#ifdef CONFIG_X86_KERNEL_IBT +static unsigned long get_entry_ip(unsigned long fentry_ip) +{ + u32 instr; + + /* Being extra safe in here in case entry ip is on the page-edge. */ + if (get_kernel_nofault(instr, (u32 *) fentry_ip - 1)) + return fentry_ip; + if (is_endbr(instr)) + fentry_ip -= ENDBR_INSN_SIZE; + return fentry_ip; +} +#else +#define get_entry_ip(fentry_ip) fentry_ip +#endif + BPF_CALL_1(bpf_get_func_ip_kprobe, struct pt_regs *, regs) { struct kprobe *kp = kprobe_running(); @@ -2414,13 +2430,13 @@ kprobe_multi_link_prog_run(struct bpf_kprobe_multi_link *link, } static void -kprobe_multi_link_handler(struct fprobe *fp, unsigned long entry_ip, +kprobe_multi_link_handler(struct fprobe *fp, unsigned long fentry_ip, struct pt_regs *regs) { struct bpf_kprobe_multi_link *link; link = container_of(fp, struct bpf_kprobe_multi_link, fp); - kprobe_multi_link_prog_run(link, entry_ip, regs); + kprobe_multi_link_prog_run(link, get_entry_ip(fentry_ip), regs); } static int symbols_cmp_r(const void *a, const void *b, const void *priv) diff --git a/tools/testing/selftests/bpf/progs/kprobe_multi.c b/tools/testing/selftests/bpf/progs/kprobe_multi.c index 08f95a8155d1..98c3399e15c0 100644 --- a/tools/testing/selftests/bpf/progs/kprobe_multi.c +++ b/tools/testing/selftests/bpf/progs/kprobe_multi.c @@ -36,15 +36,13 @@ __u64 kretprobe_test6_result = 0; __u64 kretprobe_test7_result = 0; __u64 kretprobe_test8_result = 0; -extern bool CONFIG_X86_KERNEL_IBT __kconfig __weak; - static void kprobe_multi_check(void *ctx, bool is_return) { if (bpf_get_current_pid_tgid() >> 32 != pid) return; __u64 cookie = test_cookie ? bpf_get_attach_cookie(ctx) : 0; - __u64 addr = bpf_get_func_ip(ctx) - (CONFIG_X86_KERNEL_IBT ? 4 : 0); + __u64 addr = bpf_get_func_ip(ctx); #define SET(__var, __addr, __cookie) ({ \ if (((const void *) addr == __addr) && \ From patchwork Sat Oct 22 07:27: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: 7747 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1111183wrr; Sat, 22 Oct 2022 01:56:23 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5SjnVQV0JYf++20d+nHy0Y3pQJvJs8ap7AXVqMxyeB0x0m69BQZFhwOwZpmN7Aw8Yx0nrR X-Received: by 2002:a05:6402:11ce:b0:45c:a2a2:4207 with SMTP id j14-20020a05640211ce00b0045ca2a24207mr21156750edw.3.1666428982846; Sat, 22 Oct 2022 01:56:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666428982; cv=none; d=google.com; s=arc-20160816; b=L/cGJsouTlgVyvAAU0X6mv++D24mN1n9HRnT0Ze8JbtZiPNxDr3Zv+58ccb3mzfwXE PyjRpIK/OKEc9m7mlvI4rmKorNTXty+SsB8XBdB/TrUlWEDml3tjoHQTKlyhytlwyx3e oyDnUvBoR+IRzw7mzE3fUfm06Mt/+tVgrNBXZR/0GpQUCtiDa8enKkvZryUDAJcCulwG Z3WhHkHEVOV1U1uk5jLenOB5JK7HO4H/k/PW6Ph/c7xF0a5gI1Xf729MXZQttuF5zeQp OzOFw+M0tIaQUV6HwK5QlSTfSGImvocY4bVCshvy+L2HzWc53v2KNmm5p2zmuVm6HbuG pAtA== 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=9DgFNTkjxHk61wXOVFZzDG+IxjF2Sre4aRtiYt8DCDM=; b=LzF95/6+R5dwrjEZW9/Wm2EbR2TwEHfDn6UK51JQeK5o1ff2inZ1ZRyb0doNqwimdQ kAXui53uoAYWmUZgfy4dXusxDu4MsxmRsQVQ4hxHeSWHuPTG/zBUB1wCBKoQXmeir2yB gR5CarKsS09i+QnVdIlkibxeWNcrFO5+3T/0IVSysFU2wjpPPZRQ96Jebp5ETDa01D+i YgSfcDIgdidpZgvyzDkEHE4mfdVBFPYPhJumTZrUtAe6CvIlkZAXbrOs4bLQnX/YquXL WrPrI3tBaBftYhmsmQEFhX3z6F2KVNZ1R40sbNshpt+UeanmVCIyPL2hil34x8m9z5ei n4TQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=QF5Rjpxv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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-20020a1709071dd100b007912fb7ad6esi16191598ejc.893.2022.10.22.01.55.58; Sat, 22 Oct 2022 01:56: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=QF5Rjpxv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S234862AbiJVIzZ (ORCPT + 99 others); Sat, 22 Oct 2022 04:55:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47178 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234945AbiJVIxj (ORCPT ); Sat, 22 Oct 2022 04:53: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 EEDFB2F3D9C; Sat, 22 Oct 2022 01:12:52 -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 03A21B82DB3; Sat, 22 Oct 2022 08:03:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 08A29C433D6; Sat, 22 Oct 2022 08:03:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425810; bh=P064zGl/Sqny8pvIyR4fFYYmF7vFVYhkTnl0m4U6dEE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QF5Rjpxvq1ggDGENOYSx/x2x0ugT/V1nBSVvH+/FRFck1tRB2r9HzV5jD3QAnBsHV PgreiEsc8hge1kUGJd0deAHSBDRR7UQ9Im3mRRN+kFXuU98XX+GQCidhOnhLZqRcFM aEwwNj1zUXmmv173RSRv/hv2pSXpHWMv/9Oi7Too= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Song Liu , Alexei Starovoitov , Sasha Levin Subject: [PATCH 5.19 594/717] bpf: use bpf_prog_pack for bpf_dispatcher Date: Sat, 22 Oct 2022 09:27:53 +0200 Message-Id: <20221022072524.704369078@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747377437184411305?= X-GMAIL-MSGID: =?utf-8?q?1747377437184411305?= From: Song Liu [ Upstream commit 19c02415da2345d0dda2b5c4495bc17cc14b18b5 ] Allocate bpf_dispatcher with bpf_prog_pack_alloc so that bpf_dispatcher can share pages with bpf programs. arch_prepare_bpf_dispatcher() is updated to provide a RW buffer as working area for arch code to write to. This also fixes CPA W^X warnning like: CPA refuse W^X violation: 8000000000000163 -> 0000000000000163 range: ... Signed-off-by: Song Liu Link: https://lore.kernel.org/r/20220926184739.3512547-2-song@kernel.org Signed-off-by: Alexei Starovoitov Signed-off-by: Sasha Levin --- arch/x86/net/bpf_jit_comp.c | 16 ++++++++-------- include/linux/bpf.h | 3 ++- include/linux/filter.h | 5 +++++ kernel/bpf/core.c | 9 +++++++-- kernel/bpf/dispatcher.c | 27 +++++++++++++++++++++------ 5 files changed, 43 insertions(+), 17 deletions(-) diff --git a/arch/x86/net/bpf_jit_comp.c b/arch/x86/net/bpf_jit_comp.c index 41d170653e8d..fc4d899f10f6 100644 --- a/arch/x86/net/bpf_jit_comp.c +++ b/arch/x86/net/bpf_jit_comp.c @@ -2216,7 +2216,7 @@ int arch_prepare_bpf_trampoline(struct bpf_tramp_image *im, void *image, void *i return ret; } -static int emit_bpf_dispatcher(u8 **pprog, int a, int b, s64 *progs) +static int emit_bpf_dispatcher(u8 **pprog, int a, int b, s64 *progs, u8 *image, u8 *buf) { u8 *jg_reloc, *prog = *pprog; int pivot, err, jg_bytes = 1; @@ -2232,12 +2232,12 @@ static int emit_bpf_dispatcher(u8 **pprog, int a, int b, s64 *progs) EMIT2_off32(0x81, add_1reg(0xF8, BPF_REG_3), progs[a]); err = emit_cond_near_jump(&prog, /* je func */ - (void *)progs[a], prog, + (void *)progs[a], image + (prog - buf), X86_JE); if (err) return err; - emit_indirect_jump(&prog, 2 /* rdx */, prog); + emit_indirect_jump(&prog, 2 /* rdx */, image + (prog - buf)); *pprog = prog; return 0; @@ -2262,7 +2262,7 @@ static int emit_bpf_dispatcher(u8 **pprog, int a, int b, s64 *progs) jg_reloc = prog; err = emit_bpf_dispatcher(&prog, a, a + pivot, /* emit lower_part */ - progs); + progs, image, buf); if (err) return err; @@ -2276,7 +2276,7 @@ static int emit_bpf_dispatcher(u8 **pprog, int a, int b, s64 *progs) emit_code(jg_reloc - jg_bytes, jg_offset, jg_bytes); err = emit_bpf_dispatcher(&prog, a + pivot + 1, /* emit upper_part */ - b, progs); + b, progs, image, buf); if (err) return err; @@ -2296,12 +2296,12 @@ static int cmp_ips(const void *a, const void *b) return 0; } -int arch_prepare_bpf_dispatcher(void *image, s64 *funcs, int num_funcs) +int arch_prepare_bpf_dispatcher(void *image, void *buf, s64 *funcs, int num_funcs) { - u8 *prog = image; + u8 *prog = buf; sort(funcs, num_funcs, sizeof(funcs[0]), cmp_ips, NULL); - return emit_bpf_dispatcher(&prog, 0, num_funcs - 1, funcs); + return emit_bpf_dispatcher(&prog, 0, num_funcs - 1, funcs, image, buf); } struct x64_jit_data { diff --git a/include/linux/bpf.h b/include/linux/bpf.h index 647438166558..33ec4658c1ee 100644 --- a/include/linux/bpf.h +++ b/include/linux/bpf.h @@ -869,6 +869,7 @@ struct bpf_dispatcher { struct bpf_dispatcher_prog progs[BPF_DISPATCHER_MAX]; int num_progs; void *image; + void *rw_image; u32 image_off; struct bpf_ksym ksym; }; @@ -888,7 +889,7 @@ int bpf_trampoline_unlink_prog(struct bpf_tramp_link *link, struct bpf_trampolin struct bpf_trampoline *bpf_trampoline_get(u64 key, struct bpf_attach_target_info *tgt_info); void bpf_trampoline_put(struct bpf_trampoline *tr); -int arch_prepare_bpf_dispatcher(void *image, s64 *funcs, int num_funcs); +int arch_prepare_bpf_dispatcher(void *image, void *buf, s64 *funcs, int num_funcs); #define BPF_DISPATCHER_INIT(_name) { \ .mutex = __MUTEX_INITIALIZER(_name.mutex), \ .func = &_name##_func, \ diff --git a/include/linux/filter.h b/include/linux/filter.h index 8fd2e2f58eeb..e11335c70982 100644 --- a/include/linux/filter.h +++ b/include/linux/filter.h @@ -1052,6 +1052,8 @@ extern long bpf_jit_limit_max; typedef void (*bpf_jit_fill_hole_t)(void *area, unsigned int size); +void bpf_jit_fill_hole_with_zero(void *area, unsigned int size); + struct bpf_binary_header * bpf_jit_binary_alloc(unsigned int proglen, u8 **image_ptr, unsigned int alignment, @@ -1064,6 +1066,9 @@ void bpf_jit_free(struct bpf_prog *fp); struct bpf_binary_header * bpf_jit_binary_pack_hdr(const struct bpf_prog *fp); +void *bpf_prog_pack_alloc(u32 size, bpf_jit_fill_hole_t bpf_fill_ill_insns); +void bpf_prog_pack_free(struct bpf_binary_header *hdr); + static inline bool bpf_prog_kallsyms_verify_off(const struct bpf_prog *fp) { return list_empty(&fp->aux->ksym.lnode) || diff --git a/kernel/bpf/core.c b/kernel/bpf/core.c index cf44ff50b1f2..be736aa97927 100644 --- a/kernel/bpf/core.c +++ b/kernel/bpf/core.c @@ -822,6 +822,11 @@ struct bpf_prog_pack { unsigned long bitmap[]; }; +void bpf_jit_fill_hole_with_zero(void *area, unsigned int size) +{ + memset(area, 0, size); +} + #define BPF_PROG_SIZE_TO_NBITS(size) (round_up(size, BPF_PROG_CHUNK_SIZE) / BPF_PROG_CHUNK_SIZE) static size_t bpf_prog_pack_size = -1; @@ -892,7 +897,7 @@ static struct bpf_prog_pack *alloc_new_pack(bpf_jit_fill_hole_t bpf_fill_ill_ins return pack; } -static void *bpf_prog_pack_alloc(u32 size, bpf_jit_fill_hole_t bpf_fill_ill_insns) +void *bpf_prog_pack_alloc(u32 size, bpf_jit_fill_hole_t bpf_fill_ill_insns) { unsigned int nbits = BPF_PROG_SIZE_TO_NBITS(size); struct bpf_prog_pack *pack; @@ -936,7 +941,7 @@ static void *bpf_prog_pack_alloc(u32 size, bpf_jit_fill_hole_t bpf_fill_ill_insn return ptr; } -static void bpf_prog_pack_free(struct bpf_binary_header *hdr) +void bpf_prog_pack_free(struct bpf_binary_header *hdr) { struct bpf_prog_pack *pack = NULL, *tmp; unsigned int nbits; diff --git a/kernel/bpf/dispatcher.c b/kernel/bpf/dispatcher.c index 2444bd15cc2d..fa64b80b8bca 100644 --- a/kernel/bpf/dispatcher.c +++ b/kernel/bpf/dispatcher.c @@ -85,12 +85,12 @@ static bool bpf_dispatcher_remove_prog(struct bpf_dispatcher *d, return false; } -int __weak arch_prepare_bpf_dispatcher(void *image, s64 *funcs, int num_funcs) +int __weak arch_prepare_bpf_dispatcher(void *image, void *buf, s64 *funcs, int num_funcs) { return -ENOTSUPP; } -static int bpf_dispatcher_prepare(struct bpf_dispatcher *d, void *image) +static int bpf_dispatcher_prepare(struct bpf_dispatcher *d, void *image, void *buf) { s64 ips[BPF_DISPATCHER_MAX] = {}, *ipsp = &ips[0]; int i; @@ -99,12 +99,12 @@ static int bpf_dispatcher_prepare(struct bpf_dispatcher *d, void *image) if (d->progs[i].prog) *ipsp++ = (s64)(uintptr_t)d->progs[i].prog->bpf_func; } - return arch_prepare_bpf_dispatcher(image, &ips[0], d->num_progs); + return arch_prepare_bpf_dispatcher(image, buf, &ips[0], d->num_progs); } static void bpf_dispatcher_update(struct bpf_dispatcher *d, int prev_num_progs) { - void *old, *new; + void *old, *new, *tmp; u32 noff; int err; @@ -117,8 +117,14 @@ static void bpf_dispatcher_update(struct bpf_dispatcher *d, int prev_num_progs) } new = d->num_progs ? d->image + noff : NULL; + tmp = d->num_progs ? d->rw_image + noff : NULL; if (new) { - if (bpf_dispatcher_prepare(d, new)) + /* Prepare the dispatcher in d->rw_image. Then use + * bpf_arch_text_copy to update d->image, which is RO+X. + */ + if (bpf_dispatcher_prepare(d, new, tmp)) + return; + if (IS_ERR(bpf_arch_text_copy(new, tmp, PAGE_SIZE / 2))) return; } @@ -140,9 +146,18 @@ void bpf_dispatcher_change_prog(struct bpf_dispatcher *d, struct bpf_prog *from, mutex_lock(&d->mutex); if (!d->image) { - d->image = bpf_jit_alloc_exec_page(); + d->image = bpf_prog_pack_alloc(PAGE_SIZE, bpf_jit_fill_hole_with_zero); if (!d->image) goto out; + d->rw_image = bpf_jit_alloc_exec(PAGE_SIZE); + if (!d->rw_image) { + u32 size = PAGE_SIZE; + + bpf_arch_text_copy(d->image, &size, sizeof(size)); + bpf_prog_pack_free((struct bpf_binary_header *)d->image); + d->image = NULL; + goto out; + } bpf_image_ksym_add(d->image, &d->ksym); } From patchwork Sat Oct 22 07:27: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: 7643 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1107712wrr; Sat, 22 Oct 2022 01:41:50 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6zlgES1B+tbpGLhmaeeF6opz7UGqWDkAO68cRqHe3XyX0B8FMJmEexZCOLpuYIYCSbq8kZ X-Received: by 2002:a17:907:6e9e:b0:78e:214b:e3c2 with SMTP id sh30-20020a1709076e9e00b0078e214be3c2mr18796826ejc.15.1666428110116; Sat, 22 Oct 2022 01:41:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666428110; cv=none; d=google.com; s=arc-20160816; b=xZfi0ud8BG8Bs+6fqrfGqKTHA2EMiVpvyAkEdG8Jx+nr/8oO2EeEubeknzwRR4w8EK UVZN2vXSw8HPTsBUJxnG648d9k/L0p1Tn3idIhxqhzSRovx6ngBdCBc8dYUBtFDGQB5M oiWn1HFbP7/tEJ665AxeZ6jqY/MF5BRIB83ztqO48v8alJRMm0YhvFBF/iRGtkD5rEYk h8myTIoUbDzg25+nWop5SSlmaNtDY04ksURmj7UtsP+bFF/d/dYOpbdEwgeQQ+yqYka6 hURiXJhcoXf4dEFGLbz7OtjfBGF9fqYmMoVD2BAy18YdrGusIWeER5aqExmN951UyWVf loSg== 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=gQIX43JC2NEsOt1XeEc31mNSPitnl6+b/jcmjcU5Ju4=; b=eLpfTdajtV8BfuXzpG7XgWB+kBr7XsmUW0jEn9gxwtpjC9JYAVfxYtQeFq7T5Ztmh4 LDR6W2cw9JXyLm5Zb/WivpOB8P9wo5PIwDrt1P9Batdir1eKoYHTgh7lTFOZUJpd/LB3 kUzCKJfo/N2kGdUcvD7SabkBOqVMoP/G4su+9x2Iufjz+wG5mdwoJGFy55ZIS4iskBge IttY4pRdkIJiHy/lGQ2kYN/pV03svD+L5V4IhW24eUL+cgwThBZTvV/rk+KVAFvmlpEm R6jyg74AMpI1zwvdiKXSRBLYydOQo16ga+RK/+3LQk3ZPA/TpIyk1g+ieCDZ3AQFPKgX uucA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=DEy9QpaM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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-20020a1709073ea900b0077b6ecac099si22607416ejc.287.2022.10.22.01.41.23; Sat, 22 Oct 2022 01:41: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=DEy9QpaM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S234575AbiJVIjL (ORCPT + 99 others); Sat, 22 Oct 2022 04:39:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53068 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234422AbiJVIf1 (ORCPT ); Sat, 22 Oct 2022 04:35:27 -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 1EB7B31F82; Sat, 22 Oct 2022 01:04: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 5B21E60AFA; Sat, 22 Oct 2022 08:03:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4AC14C433D6; Sat, 22 Oct 2022 08:03:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425813; bh=x8/+lA1k8NbrcbGopMpHIBsbkpzGkwI75CILb2F9Tso=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DEy9QpaMHPT39qPUX9qZ5GEX5ol6sepV/y+s5bZEXqlsLgJ745QhGB+uxj5K0ViAt 54B330iqEI7GydBCPz8nAFszQFl57231v3/KfpncFI1j6Lk+Gpmco5SjcFm8NBSZ9D TUvRC4qzvu64k+NyolIGxCyzOwFbtyb/BlFxnEMc= 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 5.19 595/717] Bluetooth: L2CAP: Fix user-after-free Date: Sat, 22 Oct 2022 09:27:54 +0200 Message-Id: <20221022072524.756450268@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376521814673790?= X-GMAIL-MSGID: =?utf-8?q?1747376521814673790?= 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 a8835c8367af..0f98c5d8c4de 100644 --- a/net/bluetooth/l2cap_core.c +++ b/net/bluetooth/l2cap_core.c @@ -4308,6 +4308,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); @@ -4337,6 +4343,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 Sat Oct 22 07:27: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: 7790 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1123148wrr; Sat, 22 Oct 2022 02:32:47 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5NiFzEA81h5/HX8MC2Y+VDFs/nx4kr3kMxz6z3wCTIFiGa4CCzxl3Yu2PAcB6EnkHUMjby X-Received: by 2002:a50:85ca:0:b0:461:168c:83ab with SMTP id q10-20020a5085ca000000b00461168c83abmr10074906edh.359.1666431166874; Sat, 22 Oct 2022 02:32:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666431166; cv=none; d=google.com; s=arc-20160816; b=Dgn+WqZ79xXOjabOaEIcZcJZGDg0NDMpTKP/tg3ra7gu1wJ7mK8IegKTLAAw0Hqnnu CDcjb72Au7KMI680gb1KgX6m48siUtzFkMMTfsq4Lhk8YK5xmmO2mZ7nl+zjI8gODrFB CcxVttdmzzKBEzwxognuQDabYIodD+EYOE29Qmd+GIUZ+ebUZTM+/vLGyl8a+vLZcxIP MUrRV6drpP1QI1+UWmEoXqTph9tzeeA91EAg50aGFnBIOoK84t016w4/v19dRWFDwGI5 nfYFlTdBvtYYxm6Ghs4OeDjl/y1omMXzW6azYVrWYK4UV8ZIDnSfqm5k9nNpyorcNAx2 0HLg== 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=2MAEoHH6W1OVf/XG1TWO/OngIIi9aLMr3pc7Y+hGwYQ=; b=mKOVoDW+0kg/IxvpBxObLUx2hynN+LdwmOvvE4jArdp137zdjsMlxsoPyJlJC7gxtc bG36AgBtUzYJEkC6EIBJ/DLZEhap62vv8bn5bEMsudzfwruyYcyYBMjCVx1LG+5IkrYy +SMB4fzRXV13Lnxcntsi+Y1ottpP5+/MadZv1W/DpDbvIsQsmBpxTlis/bCNs5YdO1Ip JUd7xhunc/43t7WiJqSudnhxXKYy1lsQpJNlgthUs9KGhWafOkWg/Mz25y8PvzVndu/Z WR0RSNsHzGlBf1VRl2lr47l9omvdyRoojmj+3mmgM7/1eJKemZ7B9r4/2bqwsFDndHE/ /oVg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=WYs0tesc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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-20020a056402270a00b0045dc9b4c034si15180765edd.582.2022.10.22.02.32.22; Sat, 22 Oct 2022 02:32: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=WYs0tesc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231591AbiJVJPM (ORCPT + 99 others); Sat, 22 Oct 2022 05:15:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39476 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235062AbiJVJOh (ORCPT ); Sat, 22 Oct 2022 05:14:37 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B3E6C2E1B9F; Sat, 22 Oct 2022 01:29: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 655B360AE8; Sat, 22 Oct 2022 08:03:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5CD25C433C1; Sat, 22 Oct 2022 08:03:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425816; bh=6I0oFww5l0V1IzzU+8y7drAJe30wzaT6tIKTcnOoUOg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WYs0tescmOgMcpZp32FThZIosfAqZt5N/kvmD1KRXuMC7nET8ung7GJLSnm3FWM57 ImZPq59KE1kBmqcIDfs7FXPrWhIePMYXBxjPIA94azLFPSk/qY+Y24MSWGZ/3KKfnB 4ZuC/JUfBlbJ/Fn4azhjmYxE53LZ8EGu7kuh50Aw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Andy Shevchenko , Jarkko Nikula , Wolfram Sang , Sasha Levin Subject: [PATCH 5.19 596/717] i2c: designware-pci: Group AMD NAVI quirk parts together Date: Sat, 22 Oct 2022 09:27:55 +0200 Message-Id: <20221022072524.805124904@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747379727146507965?= X-GMAIL-MSGID: =?utf-8?q?1747379727146507965?= From: Andy Shevchenko [ Upstream commit 65769162ae4b7f2d82e54998be446226b05fcd8f ] The code is ogranized in a way that all related parts to the certain platform quirk go together. This is not the case for AMD NAVI. Shuffle code to make it happen. While at it, drop the frequency definition and use hard coded value as it's done for other platforms and add a comment to the PCI ID list. Signed-off-by: Andy Shevchenko Acked-by: Jarkko Nikula Signed-off-by: Wolfram Sang Signed-off-by: Sasha Levin --- drivers/i2c/busses/i2c-designware-pcidrv.c | 30 +++++++++++----------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/drivers/i2c/busses/i2c-designware-pcidrv.c b/drivers/i2c/busses/i2c-designware-pcidrv.c index 608e61209455..ca368482b246 100644 --- a/drivers/i2c/busses/i2c-designware-pcidrv.c +++ b/drivers/i2c/busses/i2c-designware-pcidrv.c @@ -27,7 +27,6 @@ #include "i2c-ccgx-ucsi.h" #define DRIVER_NAME "i2c-designware-pci" -#define AMD_CLK_RATE_HZ 100000 enum dw_pci_ctl_id_t { medfield, @@ -100,11 +99,6 @@ static u32 mfld_get_clk_rate_khz(struct dw_i2c_dev *dev) return 25000; } -static u32 navi_amd_get_clk_rate_khz(struct dw_i2c_dev *dev) -{ - return AMD_CLK_RATE_HZ; -} - static int mfld_setup(struct pci_dev *pdev, struct dw_pci_controller *c) { struct dw_i2c_dev *dev = dev_get_drvdata(&pdev->dev); @@ -126,15 +120,6 @@ static int mfld_setup(struct pci_dev *pdev, struct dw_pci_controller *c) return -ENODEV; } -static int navi_amd_setup(struct pci_dev *pdev, struct dw_pci_controller *c) -{ - struct dw_i2c_dev *dev = dev_get_drvdata(&pdev->dev); - - dev->flags |= MODEL_AMD_NAVI_GPU; - dev->timings.bus_freq_hz = I2C_MAX_STANDARD_MODE_FREQ; - return 0; -} - static int mrfld_setup(struct pci_dev *pdev, struct dw_pci_controller *c) { /* @@ -159,6 +144,20 @@ static u32 ehl_get_clk_rate_khz(struct dw_i2c_dev *dev) return 100000; } +static u32 navi_amd_get_clk_rate_khz(struct dw_i2c_dev *dev) +{ + return 100000; +} + +static int navi_amd_setup(struct pci_dev *pdev, struct dw_pci_controller *c) +{ + struct dw_i2c_dev *dev = dev_get_drvdata(&pdev->dev); + + dev->flags |= MODEL_AMD_NAVI_GPU; + dev->timings.bus_freq_hz = I2C_MAX_STANDARD_MODE_FREQ; + return 0; +} + static struct dw_pci_controller dw_pci_controllers[] = { [medfield] = { .bus_num = -1, @@ -389,6 +388,7 @@ static const struct pci_device_id i2_designware_pci_ids[] = { { PCI_VDEVICE(INTEL, 0x4bbe), elkhartlake }, { PCI_VDEVICE(INTEL, 0x4bbf), elkhartlake }, { PCI_VDEVICE(INTEL, 0x4bc0), elkhartlake }, + /* AMD NAVI */ { PCI_VDEVICE(ATI, 0x7314), navi_amd }, { PCI_VDEVICE(ATI, 0x73a4), navi_amd }, { PCI_VDEVICE(ATI, 0x73e4), navi_amd }, From patchwork Sat Oct 22 07:27: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: 7605 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1106565wrr; Sat, 22 Oct 2022 01:38:19 -0700 (PDT) X-Google-Smtp-Source: AMsMyM76BMDdWNFf89e2oqtVgNuridn1SBHHa86EFSIseVMjyt76trs1+l4tZeciHfS7011JC9hn X-Received: by 2002:a05:6402:1286:b0:461:4acc:6db with SMTP id w6-20020a056402128600b004614acc06dbmr6747658edv.183.1666427898952; Sat, 22 Oct 2022 01:38:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666427898; cv=none; d=google.com; s=arc-20160816; b=SQ4oh5xmf+CnOM+5eFsArIiVLSgugTbgaR9qb0xxVA3ZJjSVbUdpo4Ipo4DhmlPw3V cYVxP4/ikPZ0U/9ZZc01ppW1wQdXXUvfz9vyff8Hrl9j93g8yxsafdGxI9/jzINNSBzH SQyxFcCQXK0lTYPWO6NeWh3qWdRNhGsKPMiuY/j+3rO6Oy8tpk+gvLe+aLhYA69xmHxu ZA7hUluI4J80hszYFYLdZJ/U+UMEa/Pv8PqNA8A4XtrliL+DNN7EPpYnxL9dpKFxShlx 4TpfQmPDATI8cfSo7smR6MDdYuRGVv6DVyEhWhCjjA/C5jqKOmgmjNwC1HmiZQe0Znas GkoA== 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=2QcH7gw8Ij3inVsPITSl4QwAPCmbzyaRHL4uOpRaQzQ=; b=c0l5gxqBBdga3PraDLkGqYt5J5D3EYi2nfUCTkp4KqmSSxilChP3+iQDZuSIKQlkV5 GN3hfrBeAUtrrdbwxfXWb598pbgIsPnZxnQlK3l1aa9b6XiE6poFDEqsBFMLXR0Ocdso kcp/qf2zXaJ65NynW6DwNp7c4tdi1vQNrjZwF3eTBhOwlODY9sT+hkYxtayNbJAs2W4h QW4OcizWzlStjqoEg8jtjIPUUr/tHTwlsvpEbdYYPd5ZzAYxNVPSUZBq0CAI4I+6TCfN rWeufctDZ0F/zIJQ4MlsaMpkikjOymqwA76vsDCz7JRfJk8nCdcs3sBhR+rv8Ab6rv4Q K1mg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=RWVVGjyS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 bt14-20020a0564020a4e00b004604906b23csi5788913edb.545.2022.10.22.01.37.45; Sat, 22 Oct 2022 01:38: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=RWVVGjyS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S234158AbiJVIeM (ORCPT + 99 others); Sat, 22 Oct 2022 04:34:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58058 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234343AbiJVIaa (ORCPT ); Sat, 22 Oct 2022 04:30:30 -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 662DB285982; Sat, 22 Oct 2022 01: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 08286B82E1D; Sat, 22 Oct 2022 08:02:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 574F1C433D6; Sat, 22 Oct 2022 08:02:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425728; bh=Q7nL0WEUtaTUZsGTu8PhNbsvfvjXK7qqWWgILZtc6rQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RWVVGjySayjJ+7FDPKVnnl+y9/2H3Usq6W0xrGj9SJtV1bMlCS6PrYbyHdOFjndEc +Ie5aLd3inmNurGHqJ7WEtHVLwca1/A0vcCqVIpQaBcSeSfJcQJ868Z6Cu3ECkaN1t 6pPqEgSgUc4ux/jG0QDiO4aDRA9V4A9Jr1pRxaMQ= 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 5.19 597/717] r8152: Rate limit overflow messages Date: Sat, 22 Oct 2022 09:27:56 +0200 Message-Id: <20221022072524.855613955@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376300686258712?= X-GMAIL-MSGID: =?utf-8?q?1747376300686258712?= 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 688905ea0a6d..e7b0b59e2bc8 100644 --- a/drivers/net/usb/r8152.c +++ b/drivers/net/usb/r8152.c @@ -1874,7 +1874,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 Sat Oct 22 07:27: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: 7641 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1107658wrr; Sat, 22 Oct 2022 01:41:37 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5jVv2b+j5ivJrXYJuDkWGVXNKG9K6MduTPOR5wMm60qznVdDrXamvY2XOV7fiejqXspf8M X-Received: by 2002:a17:906:8a58:b0:7a1:1c25:3e82 with SMTP id gx24-20020a1709068a5800b007a11c253e82mr1654135ejc.185.1666428097706; Sat, 22 Oct 2022 01:41:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666428097; cv=none; d=google.com; s=arc-20160816; b=ltYFzKdIGCiZTVyoXCZ5NAyYMgCRP7Q6cRcMoi5esR4KaXGe57XBHmTUiUyJTCjFqz MzNI0+0srXrmWedWamMpWOgyDqH92WiILGKb5Iz3bVIzf4aFwfIFO2o2r324w6B7Z60Q 18JzJUXCHLrIz2FkKZcAsa4NyTM/KSm3H3j0woAQZIeL0OCcIPSE4v8gXYNltEnlOar+ wlR5YRy6+wWKwfNNr0vr4weRO9BCAtbbv9ns7f39yG+iS563rJ0TrUKs3WH/sNvgTeNk K3uVGoZvn/g5PEQmarc9N9pQ0eL4pRSaa/9bYIDSynspNspAfvu647ZsLQEGyO4ZE8sg 3t9g== 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=cm2Cbrlx9CimVZApLwOlsEj0o1/rhbQ4NGL5EXn5/m8=; b=LbqZoZfwp0YLtbySEU2EiPXRmbjMKen9iUZ+E1XrE9aEqfYVF9iTsf5WP8xnlfR1iN iRwUg9OTgxfaWI1yf2nzfPo1ClkfN/JvIcmMPSzszGKnkqBnSvWT9jYqxGFpQFx//uw/ Z7Thl22VjSFEJ4AUxyklobExXYSurSHglOilkEublPNNV1rs1YpqD+73PtIZ/lXsVN6m V7/nrANn3uEuXEQ5Ay+5wxMiYW583TOSdbuuegrpfGTVRO9h6Hl55wciWPPX0Pkq6PmD WxXPYRgWH6ogv07v7uLTJKmQcTt7u6TniFJ+qu9BBgTYycOkEF4rF7U5orozFUzOBlq1 pccg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="Iia/AAgF"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 q14-20020a056402040e00b0045d8bff7b1asi13185861edv.403.2022.10.22.01.41.11; Sat, 22 Oct 2022 01:41: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="Iia/AAgF"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S234521AbiJVIjE (ORCPT + 99 others); Sat, 22 Oct 2022 04:39:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55046 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234391AbiJVIfO (ORCPT ); Sat, 22 Oct 2022 04:35: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 4203636BF2; Sat, 22 Oct 2022 01:04: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 dfw.source.kernel.org (Postfix) with ESMTPS id 3AEA260ADC; Sat, 22 Oct 2022 08:02:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4BB9BC433D6; Sat, 22 Oct 2022 08:02:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425731; bh=Pn90kuPbeK/qdV/mITnz331Ur07Ew6mzmpWUpHOoTiM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Iia/AAgFpd8MOGLxdTYvP/OMRTIo7wwXmCiP7fR10v5J+MjOfb628CqCRUcvntcjv g1yQXuH1nlsSUfbMHHqushTfE+/iq2wWkISSWokDMMv8NGRicuv4Ofw5OxEHXyD0W2 8kHSSUuLVZbNxQMnTrW+m/QrbarZWgOnXSIT6RtU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jianglei Nie , Lyude Paul , Sasha Levin Subject: [PATCH 5.19 598/717] drm/nouveau/nouveau_bo: fix potential memory leak in nouveau_bo_alloc() Date: Sat, 22 Oct 2022 09:27:57 +0200 Message-Id: <20221022072524.907495788@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376509291157190?= X-GMAIL-MSGID: =?utf-8?q?1747376509291157190?= From: Jianglei Nie [ Upstream commit 6dc548745d5b5102e3c53dc5097296ac270b6c69 ] nouveau_bo_alloc() allocates a memory chunk for "nvbo" with kzalloc(). When some error occurs, "nvbo" should be released. But when WARN_ON(pi < 0)) equals true, the function return ERR_PTR without releasing the "nvbo", which will lead to a memory leak. We should release the "nvbo" with kfree() if WARN_ON(pi < 0)) equals true. Signed-off-by: Jianglei Nie Signed-off-by: Lyude Paul Reviewed-by: Lyude Paul Link: https://patchwork.freedesktop.org/patch/msgid/20220705094306.2244103-1-niejianglei2021@163.com Signed-off-by: Sasha Levin --- drivers/gpu/drm/nouveau/nouveau_bo.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/nouveau/nouveau_bo.c b/drivers/gpu/drm/nouveau/nouveau_bo.c index e29175e4b44c..07a327ad5e2a 100644 --- a/drivers/gpu/drm/nouveau/nouveau_bo.c +++ b/drivers/gpu/drm/nouveau/nouveau_bo.c @@ -281,8 +281,10 @@ nouveau_bo_alloc(struct nouveau_cli *cli, u64 *size, int *align, u32 domain, break; } - if (WARN_ON(pi < 0)) + if (WARN_ON(pi < 0)) { + kfree(nvbo); return ERR_PTR(-EINVAL); + } /* Disable compression if suitable settings couldn't be found. */ if (nvbo->comp && !vmm->page[pi].comp) { From patchwork Sat Oct 22 07:27: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: 7659 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1108061wrr; Sat, 22 Oct 2022 01:43:11 -0700 (PDT) X-Google-Smtp-Source: AMsMyM40DtTxYCH/+LqK2/kpr8SPJvb89v/duSOqravPnI+YDps/rVRvUdNN1jiPD3BhZ7XvzDNN X-Received: by 2002:a17:907:e88:b0:78d:fb98:6f5d with SMTP id ho8-20020a1709070e8800b0078dfb986f5dmr19326244ejc.5.1666428191402; Sat, 22 Oct 2022 01:43:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666428191; cv=none; d=google.com; s=arc-20160816; b=emCkB8eVzVPWt43Np77xF+NWzD7uNVtLOHEldnQ3Lp3sWJty+oZkTGq1zaZzrxW9lY tj4J+onhe7K4ioljxG3j3yZ4O5KMDFEPVITAktkj5E+NzWTqA65niZgSVoHCx/6osEG1 H676ZQey9FCzUWvpfvj3YETmsDDbLoOFLlUbFCLh+s88b5DhpJn5+Iq7dWbJwhSiLlLU mn4T64BefY3Smy3UMdFA9V+apYOWRJWDZR+1p76HZNyWkW7pISLyt5pI+890sa/oWLpH MVvPPi6llbmzvnE4OaT7x5Uc1Q6sc1Vx0cKdjiaOv40OZj+zly8Fo3taMUMFNl0EjW8C c9/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=p6i0eXXtXMN42kDKXAlDsESN02WWjm1DtOPHQaTy9CU=; b=zErfmwkWcyo/sTTZRfM0uEh3kg0qSi4/KEGxBAfFfsUjkXsQK3MjK8xg71uqukDkS+ a0x6TGgTdDzHyp1/JBvIT3Q0Sz1kJEHTucKjXzKJJArCmz+apRj5F+5FjuGE6XlhWe7b DYo7rDYUlQPoAcBZsAbGZjp9h4YgZvt+uGepTqXn7oBnH+Ffno0tPvKHMlDLT4SARf4V i+q1U+nqcsKHHr8kdLjYrkDv2QKmXr8ybKmsvQd5lM6TCFphCbXNSHFyNiToZxmlMtK/ 6bdUaY7vgjm/E96acUFmh0oLc1FmKHmBwyu2NFL1rc6ta4vN/UtaDmB2/PBuuhr9ja7j 07MA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=VXEadJPf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 j14-20020a05640211ce00b0045d079c8f20si26613071edw.43.2022.10.22.01.42.40; Sat, 22 Oct 2022 01:43: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=VXEadJPf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S234636AbiJVIlx (ORCPT + 99 others); Sat, 22 Oct 2022 04:41:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53740 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234342AbiJVIhO (ORCPT ); Sat, 22 Oct 2022 04:37:14 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1B3A91440B7; Sat, 22 Oct 2022 01:05: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 EF155B82D9F; Sat, 22 Oct 2022 08:02:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 57479C433D6; Sat, 22 Oct 2022 08:02:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425734; bh=tYTHxkJc9elNPtIm0h1+yrKoky5BT8EYR9ItYSUXyG0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VXEadJPfj1iEggktPZYaZmH5lAMnja8pOhyEZ7ZJp/b3oSVrTgyQoiZ80BdCUBcXc cpIr1aADsgCr0gEixELSiPmcpgm0xpEdis8vi3tA7H35gW/Rgy12wRUkO77vXi1/tv wzpLzWKjWUCROmnKdFtiUjqNWIDQOnuXF7DtssDg= 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 5.19 599/717] drm: Use size_t type for len variable in drm_copy_field() Date: Sat, 22 Oct 2022 09:27:58 +0200 Message-Id: <20221022072524.950296791@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376607296136035?= X-GMAIL-MSGID: =?utf-8?q?1747376607296136035?= 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 51fcf1298023..e6895699e696 100644 --- a/drivers/gpu/drm/drm_ioctl.c +++ b/drivers/gpu/drm/drm_ioctl.c @@ -472,7 +472,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 Sat Oct 22 07:27: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: 7630 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1107510wrr; Sat, 22 Oct 2022 01:41:08 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7Tf6JPUzMQzCxtvTNEd/8iWbUfezDqCcsodp9NujBs3FRBYPlmlLi4Mj8drurUXF0zIpPy X-Received: by 2002:a17:906:cc58:b0:78d:d47e:19f2 with SMTP id mm24-20020a170906cc5800b0078dd47e19f2mr19249239ejb.388.1666428067900; Sat, 22 Oct 2022 01:41:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666428067; cv=none; d=google.com; s=arc-20160816; b=XabSMcrdWVYjz70ikhm0NGYTYhSnFJjgZN2dLQte84kEK3zWfuUJ6n/NLAVH4gz0gI 8/23BkQS39PRXai6el2x42lZPW03N9B7CVFuvtu5TT1yiNLn1LhCVFvsXPc2CxJCKevq ejf5FNtwQoAiXpMBN3b0K+8Jk6L4KC7GO/GHLw6g1fKZ9hZaS2tAfLIW81mLLY4EyHg3 YmdWC0PzaLMDfFMRPJKCIs6gnN9T4Tm5+7J/s+uhzogBX9H9u9hnJIn3PPJlVVfh+re+ Y6rwxgObM9Qo1SH4don+2FudHT7dIM0c141tBSIMfIbzUeOu2PMul1iGWocuM/PxznTY CrLQ== 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=1Cux92VwDxBWsF5yxQGasTjz8IoNqv8WZvtYJfhjazc=; b=uvxYXAesacG0OTwy7RSkjwq+6Qd8EY7cYGt7WySdGi7owl5ZuoGKWqI+YPPzAE5dzV VqI6hbEcJB5dZVwf/L+Y3sZefn9UdPO3qkADKV703vDKJxOVhcBqc4qCA9hLVpxX8o39 0OA9EXUUFw9YLEzOao0/3B9eagXT4TDLeUBw9flnc8USHf9ToyUoPrI9ityjXwrzWDt1 QwhPqipvh4XD1alDixPQs6kknNaagXdZUWO1hyazc2XBVqpStgnC4PmkjmkidWGyFgcr cm59aOuRzUddb+DCx0KdNisNRA9zmFLIqqfwlple3TGV3nndiE9m8whEmPylhDohoEu0 yuhg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=n1YyTXTs; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 s5-20020a17090699c500b007a0b28c324esi1494377ejn.1008.2022.10.22.01.40.38; Sat, 22 Oct 2022 01:41: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=n1YyTXTs; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S234234AbiJVIgq (ORCPT + 99 others); Sat, 22 Oct 2022 04:36:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32802 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234488AbiJVIbA (ORCPT ); Sat, 22 Oct 2022 04:31:00 -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 898502793D4; Sat, 22 Oct 2022 01: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 1EF05B82E19; Sat, 22 Oct 2022 08:02:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4ED52C433D6; Sat, 22 Oct 2022 08:02:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425737; bh=+Db2M99MjxVvkO3bZMGG+2LF3XGDP7VuezNQyvscTSk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=n1YyTXTsw61vc0WXXIiDvqmFasUcFJaBIrG3bTMvvY8PY8VRThg9PdgDBvGAZN5eJ 3R0crQTFKp3QQH+NWb7hXE37gnqoLfZIIKzWQqX7pkhOESv8J7Y1Qwf4742usa/9mN Gn6bwNC/J9hieZL2C1H9TRaAIKf9F32IJw/6zkoI= 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 5.19 600/717] drm: Prevent drm_copy_field() to attempt copying a NULL pointer Date: Sat, 22 Oct 2022 09:27:59 +0200 Message-Id: <20221022072524.985199179@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376477809464312?= X-GMAIL-MSGID: =?utf-8?q?1747376477809464312?= 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 e6895699e696..7f1097947731 100644 --- a/drivers/gpu/drm/drm_ioctl.c +++ b/drivers/gpu/drm/drm_ioctl.c @@ -474,6 +474,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 Sat Oct 22 07:28: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: 7779 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1121351wrr; Sat, 22 Oct 2022 02:28:20 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5a7WoWtbmXsRhK2hOoyrliho16n3bgJVZVMxWLdLcFasDw6+gOFs43oaHCrCAZqEOpWAAf X-Received: by 2002:a05:6a00:198e:b0:566:9207:d340 with SMTP id d14-20020a056a00198e00b005669207d340mr23605992pfl.83.1666430899839; Sat, 22 Oct 2022 02:28:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666430899; cv=none; d=google.com; s=arc-20160816; b=oVZFtaQPCPe3ZIneD+re93TYQSNH11hiZD33x/Texk3HUT4myHbZ5Zrww+aLWFgpgg f4WWYeUXO71Dl0SvRhmEiNDlt7QAM0JKvkYc81YdCdlrJ0+LZtoH+PaHg7YMILMK48M9 /qh9FSyjRNT1w8MI4JaC9RJ/D0hAIutPX9Nv8KSxxjvJ71jRGb82ufVln5x++bRBTKNq itLDCjYFg6BvnimEvM7DGbVkgZwTRmilCNa2hL1SLFtgfpUNIveyWxXqBz8ZCsCPJNMp 9a71YTnxk4TgJYZcA6wJxYby/jDjfgysvTxsOQQrVS94COteCUCKqx+wWUKnIt4X8mni cO4w== 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=vvCixcDJmG2KQ3HDk9TFA6MUvf6/aLV54kMTPUwcDYI=; b=hz5ZJCmRxe+hw5W1CNTVDsqq20wRh2b0kZvpxa0t3Lwpiiz1PvJQVzGiyJ1B4xuopo Ccnm2oHLn76GzPviRyv4HRRskk8rGXiySmaciTGwBY15hqup7wSLTbnkHvY0aZSuA/OK 6DvVBJMFbE96qBV9n6cJ6VBLzQSiMA7mcNpwuC5HqwC6XSsGyPHDd3VyISSyf/V0WnVE sKyx72aL5+H/3le1qQebovcjmiDdDKje/NOhRlvYiFj11D1h2moh3RryW4DZOxJW/Ba5 6Rwu8/lvwyI3AkZDKXIvWpDhOCJC5u6EGqPmAqeAEhCkYtm6NaLd3Lsc37b4La46ZOSf rV5w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=VG3d+tXW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 68-20020a630347000000b0046ef00e6afbsi5801pgd.793.2022.10.22.02.28.07; Sat, 22 Oct 2022 02:28: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=VG3d+tXW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S230487AbiJVJHE (ORCPT + 99 others); Sat, 22 Oct 2022 05:07:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55260 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235031AbiJVJFl (ORCPT ); Sat, 22 Oct 2022 05:05:41 -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 A46AC39BA5; Sat, 22 Oct 2022 01:19: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 50D8760BA1; Sat, 22 Oct 2022 08:02:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 617AEC4347C; Sat, 22 Oct 2022 08:02:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425740; bh=a+sMAFLjX68L2kxSVMElN69vaO37Vkarqiw6jNLmAIs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VG3d+tXWVZUidNHZvcg8Ho+v20XQfFFMZfNrQ2DBOUPm83WjfumKYgPogLTUL33cr JgqBr8WyupSMsr7+wohKFvY9WHmOVDi9maySd7xZ6P+R+kKBjHjoEPG3Yzr/PFZ2L4 yle8jDuMHCu/ozj3k4H3zkmVg9CMtFFvzdmpLFDQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Carsten Haitzler , Liviu Dudau , Sasha Levin Subject: [PATCH 5.19 601/717] drm/komeda: Fix handling of atomic commits in the atomic_commit_tail hook Date: Sat, 22 Oct 2022 09:28:00 +0200 Message-Id: <20221022072525.038007820@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747379447258982632?= X-GMAIL-MSGID: =?utf-8?q?1747379447258982632?= From: Liviu Dudau [ Upstream commit eaa225b6b52233d45457fd33730e1528c604d92d ] Komeda driver relies on the generic DRM atomic helper functions to handle commits. It only implements an atomic_commit_tail hook for the mode_config_helper_funcs and even that one is pretty close to the generic implementation with the exception of additional dma_fence signalling. What the generic helper framework doesn't do is waiting for the actual hardware to signal that the commit parameters have been written into the appropriate registers. As we signal CRTC events only on the irq handlers, we need to flush the configuration and wait for the hardware to respond. Add the Komeda specific implementation for atomic_commit_hw_done() that flushes and waits for flip done before calling drm_atomic_helper_commit_hw_done(). The fix was prompted by a patch from Carsten Haitzler where he was trying to solve the same issue but in a different way that I think can lead to wrong event signaling to userspace. Reported-by: Carsten Haitzler Tested-by: Carsten Haitzler Reviewed-by: Carsten Haitzler Signed-off-by: Liviu Dudau Link: https://patchwork.freedesktop.org/patch/msgid/20220722122139.288486-1-liviu.dudau@arm.com Signed-off-by: Sasha Levin --- .../gpu/drm/arm/display/komeda/komeda_crtc.c | 4 ++-- .../gpu/drm/arm/display/komeda/komeda_kms.c | 21 ++++++++++++++++++- .../gpu/drm/arm/display/komeda/komeda_kms.h | 2 ++ 3 files changed, 24 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_crtc.c b/drivers/gpu/drm/arm/display/komeda/komeda_crtc.c index 59172acb9738..292f533d8cf0 100644 --- a/drivers/gpu/drm/arm/display/komeda/komeda_crtc.c +++ b/drivers/gpu/drm/arm/display/komeda/komeda_crtc.c @@ -235,7 +235,7 @@ void komeda_crtc_handle_event(struct komeda_crtc *kcrtc, crtc->state->event = NULL; drm_crtc_send_vblank_event(crtc, event); } else { - DRM_WARN("CRTC[%d]: FLIP happen but no pending commit.\n", + DRM_WARN("CRTC[%d]: FLIP happened but no pending commit.\n", drm_crtc_index(&kcrtc->base)); } spin_unlock_irqrestore(&crtc->dev->event_lock, flags); @@ -286,7 +286,7 @@ komeda_crtc_atomic_enable(struct drm_crtc *crtc, komeda_crtc_do_flush(crtc, old); } -static void +void komeda_crtc_flush_and_wait_for_flip_done(struct komeda_crtc *kcrtc, struct completion *input_flip_done) { diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_kms.c b/drivers/gpu/drm/arm/display/komeda/komeda_kms.c index 93b7f09b96ca..327051bba5b6 100644 --- a/drivers/gpu/drm/arm/display/komeda/komeda_kms.c +++ b/drivers/gpu/drm/arm/display/komeda/komeda_kms.c @@ -69,6 +69,25 @@ static const struct drm_driver komeda_kms_driver = { .minor = 1, }; +static void komeda_kms_atomic_commit_hw_done(struct drm_atomic_state *state) +{ + struct drm_device *dev = state->dev; + struct komeda_kms_dev *kms = to_kdev(dev); + int i; + + for (i = 0; i < kms->n_crtcs; i++) { + struct komeda_crtc *kcrtc = &kms->crtcs[i]; + + if (kcrtc->base.state->active) { + struct completion *flip_done = NULL; + if (kcrtc->base.state->event) + flip_done = kcrtc->base.state->event->base.completion; + komeda_crtc_flush_and_wait_for_flip_done(kcrtc, flip_done); + } + } + drm_atomic_helper_commit_hw_done(state); +} + static void komeda_kms_commit_tail(struct drm_atomic_state *old_state) { struct drm_device *dev = old_state->dev; @@ -81,7 +100,7 @@ static void komeda_kms_commit_tail(struct drm_atomic_state *old_state) drm_atomic_helper_commit_modeset_enables(dev, old_state); - drm_atomic_helper_commit_hw_done(old_state); + komeda_kms_atomic_commit_hw_done(old_state); drm_atomic_helper_wait_for_flip_done(dev, old_state); diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_kms.h b/drivers/gpu/drm/arm/display/komeda/komeda_kms.h index 456f3c435719..bf6e8fba5061 100644 --- a/drivers/gpu/drm/arm/display/komeda/komeda_kms.h +++ b/drivers/gpu/drm/arm/display/komeda/komeda_kms.h @@ -182,6 +182,8 @@ void komeda_kms_cleanup_private_objs(struct komeda_kms_dev *kms); void komeda_crtc_handle_event(struct komeda_crtc *kcrtc, struct komeda_events *evts); +void komeda_crtc_flush_and_wait_for_flip_done(struct komeda_crtc *kcrtc, + struct completion *input_flip_done); struct komeda_kms_dev *komeda_kms_attach(struct komeda_dev *mdev); void komeda_kms_detach(struct komeda_kms_dev *kms); From patchwork Sat Oct 22 07:28: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: 7613 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1106759wrr; Sat, 22 Oct 2022 01:38:55 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4pQ51rktu/42rEkHFjouS7DnPhWN3mTKUOwD3pFo65ZzOkcsFgdnyCVZ+44lBKAjSfGfiI X-Received: by 2002:a17:907:788:b0:741:4d1a:595d with SMTP id xd8-20020a170907078800b007414d1a595dmr18843478ejb.737.1666427935457; Sat, 22 Oct 2022 01:38:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666427935; cv=none; d=google.com; s=arc-20160816; b=oz20hSSpBuZnT/AB+kjoch1YKAIS311QJE+LPs1abnG3+hOPJzg+TU4NyZNIxwJJJH kew3ff8fqVHsxVzOHj+2p85ODYpxU4CNcZ665kqw+5x3ZdgMeedRUPzcxc7nHp/sW40C RFI/o91HPl5033NnI9Hyyrp2V2BuvCoNlga2tPlPnpcib/trc1UIIjRzc6O14mo1rzzj M6emH2VjZp4y3Gl7nhYEkSgq0qgUYnl5pcJd/Dxi8v6B6EbL+LUwCBXN5CEA0ZMUi0DA dwrHIr8soQtGRePX3WH/OnUZJ4NnYPMtgW+8mTvZWPUoPTN1UaxzBhfXzDeUphkoY5jE E/wQ== 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=jI+SEWVfgYFxaGTA+7Axbfg357KRHEdw6H4GSjcYGKE=; b=ByXCmFNIq9gR+Lxl7q0jAZzCgJ5xUhFZT2BAw1yWwrzjIbN0tVm/HmYw9of02xHvDC VKRpAdj9t1xU/80rHeTpvre+VH1ZC65I9AzrtwyyxMFxhuRo8beJ23lvFVa7x0EWkmun hLqtn1h/OmxHBC/+cAokjHMMnNoPUzumLZooHE0ZOAXTYHRoNZmuxMwJ/pGWpkmj8KOu EbB30j2q+i/gLIfrTRpGCohopYnY3SNGqqEp6YcxDqT05gXPLdbI9L5+JucIcs5QrVwz dSBboU+pxbnCzKPqmkMHu2ZK8z7xuQiJH1E8Itxg4flNOEGleWPvUphsZt7Wvc7TBUye ApaA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Rz6oxefb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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-20020a50cb84000000b00453688643fasi19920754edi.260.2022.10.22.01.38.27; Sat, 22 Oct 2022 01:38: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=Rz6oxefb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S234015AbiJVIgH (ORCPT + 99 others); Sat, 22 Oct 2022 04:36:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59156 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234425AbiJVIau (ORCPT ); Sat, 22 Oct 2022 04:30:50 -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 E5E8C2D0829; Sat, 22 Oct 2022 01: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 ams.source.kernel.org (Postfix) with ESMTPS id D04D7B82E03; Sat, 22 Oct 2022 08:02:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1CF6CC433C1; Sat, 22 Oct 2022 08:02:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425743; bh=MaQazHfFY/HDy6I/LWmFBbykNt6P66Lp3uE6fOgsq4Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Rz6oxefbpHORsr70LlnTVTKAgUlduKYUaO/SxrdQtn4mveQYUaBwjTOvrihSRDSmh meWSjhUenFKBCT5ZTa0fL0wgsGHo7aO2XZWD13/SrA1HgAi+6DlK3E1l2u5PkS0GWT c3g5NAejUEwWPVuGUyN3cOsYTl+Kf2sbSh1SeMOY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zeng Jingxiang , Robert Foss , Sasha Levin Subject: [PATCH 5.19 602/717] gpu: lontium-lt9611: Fix NULL pointer dereference in lt9611_connector_init() Date: Sat, 22 Oct 2022 09:28:01 +0200 Message-Id: <20221022072525.082141625@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376338855832113?= X-GMAIL-MSGID: =?utf-8?q?1747376338855832113?= From: Zeng Jingxiang [ Upstream commit ef8886f321c5dab8124b9153d25afa2a71d05323 ] A NULL check for bridge->encoder shows that it may be NULL, but it already been dereferenced on all paths leading to the check. 812 if (!bridge->encoder) { Dereference the pointer bridge->encoder. 810 drm_connector_attach_encoder(<9611->connector, bridge->encoder); Signed-off-by: Zeng Jingxiang Signed-off-by: Robert Foss Link: https://patchwork.freedesktop.org/patch/msgid/20220727073119.1578972-1-zengjx95@gmail.com Signed-off-by: Sasha Levin --- drivers/gpu/drm/bridge/lontium-lt9611.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/bridge/lontium-lt9611.c b/drivers/gpu/drm/bridge/lontium-lt9611.c index c0b182d1374e..7f688ebd36eb 100644 --- a/drivers/gpu/drm/bridge/lontium-lt9611.c +++ b/drivers/gpu/drm/bridge/lontium-lt9611.c @@ -807,13 +807,14 @@ static int lt9611_connector_init(struct drm_bridge *bridge, struct lt9611 *lt961 drm_connector_helper_add(<9611->connector, <9611_bridge_connector_helper_funcs); - drm_connector_attach_encoder(<9611->connector, bridge->encoder); if (!bridge->encoder) { DRM_ERROR("Parent encoder object not found"); return -ENODEV; } + drm_connector_attach_encoder(<9611->connector, bridge->encoder); + return 0; } From patchwork Sat Oct 22 07:28:02 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 7615 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1106791wrr; Sat, 22 Oct 2022 01:39:03 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6LL6VwQldZcCwBEFR8ddqYdD5GZpMtqp5yWCoO5w3ZobLAW/XcVPkvrjuf3Uv7SK28yLFU X-Received: by 2002:a17:907:78a:b0:782:2223:a7cd with SMTP id xd10-20020a170907078a00b007822223a7cdmr18698164ejb.532.1666427942913; Sat, 22 Oct 2022 01:39:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666427942; cv=none; d=google.com; s=arc-20160816; b=Pu/H7pCqYjFsSa6iNUBXeO8jW1ozLjqB1Aeem9iSdXRblPBT1nQ1J6RGfDqGHyjHts bkBCBdDdxpRIR6TocANgIEXIbLSAyYa7C+WxxjmoO5t/q+Ngpu1L0WY35MoTFp7e1R9u OP19IOaebmRBp35+4Tlp8Tfze1pmrLS6BKtZBU0I9nxVU3s6AQLQR6lG38CHa1LEBBJr GV8jgmxXB47viRPw1J219YPiP2sDQevLUlx3lim915P3JR18mUefpJuvRhENXroXWV90 EpNwKFmo9BGNXj5KC8sBxPgoyK2msUq+M0mVFNNsgXuly1xovMJZhKTZkBj2LCV8iOXX R3FQ== 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=YyopP+EbhMsXY87INQd8mfSPbYfh92OsPAQumiSylqY=; b=uFK+XL7JiWy14ee6DEMgUdiWWS3CwTkR20pG2iVJVx5qyAni0znJPuchU05l1HjzoF 1f+ahZRUgYCvBlksQeI564C9GsuNRtckgYETogbuk7QaOUNscmy/J8f4qCfydqE/NRsE LOX4BdNdKuWq8AkC/UakNhLZl8KL0j8IaOHdjjW/sAcZKn6Mei7l7S1DfbhXhBo3C8bp AyqcAdmP8OK7Lra6EqO9mn1aoI4vi+gJXJdvC+f87GwxHJHB8OaaHBnQeqZk8ooxHDiU F5j0WjK68YgfHEj/881bgufa52yUvA2R+J0hnHapxPopkGiiRrX9ebvx9URZE6teEz6O h8bg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=vvYM51Fj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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-20020aa7cf10000000b00456eaa4fb1fsi10619521edy.223.2022.10.22.01.38.35; Sat, 22 Oct 2022 01:39: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=vvYM51Fj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S234070AbiJVIgQ (ORCPT + 99 others); Sat, 22 Oct 2022 04:36:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58082 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234465AbiJVIa4 (ORCPT ); Sat, 22 Oct 2022 04:30: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 E99192E530A; Sat, 22 Oct 2022 01:02: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 EC1C8B82DFC; Sat, 22 Oct 2022 08:02:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2D7A9C433D7; Sat, 22 Oct 2022 08:02:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425746; bh=Bl4G7PhvvFyNlas+R2mIUh5HCYKgCqnCPCHdtZQ7cm4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vvYM51FjT1pLucHEk7UKNZEeGl6xO36lBkadEVqTVDekK4AtyTqmbUcwCRiDw7nk2 O1TEWW0gZCzD3IKwB8hE6c4dPOFDAvQt9ElPq6THBJnqiAbQlNQdvxxO1Ylja1qoNN 83EYxz6NDBOtJ/obvzCj9WivlKBfTvev+fQgA/TU= 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 5.19 603/717] drm/amd/display: fix overflow on MIN_I64 definition Date: Sat, 22 Oct 2022 09:28:02 +0200 Message-Id: <20221022072525.133450705@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376346347690556?= X-GMAIL-MSGID: =?utf-8?q?1747376346347690556?= 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/dml/calcs/bw_fixed.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/amd/display/dc/dml/calcs/bw_fixed.c b/drivers/gpu/drm/amd/display/dc/dml/calcs/bw_fixed.c index 6ca288fb5fb9..2d46bc527b21 100644 --- a/drivers/gpu/drm/amd/display/dc/dml/calcs/bw_fixed.c +++ b/drivers/gpu/drm/amd/display/dc/dml/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 Sat Oct 22 07:28: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: 7627 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1107508wrr; Sat, 22 Oct 2022 01:41:07 -0700 (PDT) X-Google-Smtp-Source: AMsMyM677WeT4rl/NpIdx40wvvD2lyW2z0mwjLPvgyAJJ0hNhOTgs0W1esMam1rttqygbCC7MLRN X-Received: by 2002:a17:907:320b:b0:780:280:7b72 with SMTP id xg11-20020a170907320b00b0078002807b72mr19765063ejb.146.1666428067693; Sat, 22 Oct 2022 01:41:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666428067; cv=none; d=google.com; s=arc-20160816; b=Byg04FLqDCzumgjflurYIeM0P/2yLvQWSQ1IrF9O4yrVzrcUY7LMNiiqPIqKAOSfET L/6WSMdQZBDQ15Hyv7F+o//tX1s2H0j/XowcxnCI4YAsOEKBULQdboSkkXmqUkKO955K f+LRHEr52AjRp4rYQ/dW3o5ZsXECYMs4Urtn5VIO59h73Ez9Bx9mrpiJ6jikhKM6KGVZ CGE/S7FDRWVe+0wDjnj1M5TphMHtsN/qAMQ2gL0/WaL4KH6eHkFxjUkX4MCBAqMHirjA C5GFYEHZ87qnmXvNhKpSp7fdAGWREJWh5b4sM3NUyLGDXCvnDvKI3IpzAA3XGgGsN/20 h5tQ== 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=XBp/6Qeck/3GIwSMAQqqqmzOfe3TYLRh9WmIS0BGw8M=; b=1GWmkSWyIta4/ipUCA3tb4AFEeNzylqHDoT52e/TXhJwTYeBR/dCiT4HiXukG0vQ5N ej/VQbCqkSwHVDOMekFdNCkbn+kEraT7Uq9bKPo78ydgxbGU2VewE2/1yY5/Jps34Hs0 lvOwzEUE5+5Ib6rMin/i5sK24FYk4ydALSEYZCLf4AWoS/GTKefsI7ZsSavrDyS7lMu+ DZjshGCGOAB0L4nJZpgXv0LhPZYJMXc9AB2TLkmnEUlu/W+ZyXOJPca43dAZAr9mruxx 6z0DDQxx9bVeGstvrECKvnSrN99gHn5K89Ym1r3TOyXV+e5/XUfmYdU/kkdMzcMiEGE3 q8JA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=EzNUTONG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 bv16-20020a170906b1d000b007809c50fd78si18880844ejb.262.2022.10.22.01.40.38; Sat, 22 Oct 2022 01:41: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=EzNUTONG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S234261AbiJVIg6 (ORCPT + 99 others); Sat, 22 Oct 2022 04:36:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32996 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234510AbiJVIbE (ORCPT ); Sat, 22 Oct 2022 04:31: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 5A02D981DC; Sat, 22 Oct 2022 01: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 C839AB82E25; Sat, 22 Oct 2022 08:02:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1E0C3C433D6; Sat, 22 Oct 2022 08:02:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425749; bh=yxGkSTZYL1lOGJSNqH0ReJY84nBjcJY52M5+93fYZ7c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EzNUTONGqYp07x+lpXqF/Q/5fnD0EvkChKjqxAVCLRzJF4EdRYYMVDM3dgMSPPaOE FtxogW/ubukch8S9WGq76/Wogd70BEaNC4JJ6bvYtqisnKUlsH7j+GujuacQRezRBQ KMFNPzbv4GxwUGUdyosix/WfIMbZ1Wo1mQH3ST0E= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, syzbot+c80e9ef5d8bb45894db0@syzkaller.appspotmail.com, Gerd Hoffmann , Vivek Kasireddy , Sasha Levin Subject: [PATCH 5.19 604/717] udmabuf: Set ubuf->sg = NULL if the creation of sg table fails Date: Sat, 22 Oct 2022 09:28:03 +0200 Message-Id: <20221022072525.182835062@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376477410807770?= X-GMAIL-MSGID: =?utf-8?q?1747376477410807770?= From: Vivek Kasireddy [ Upstream commit d9c04a1b7a15b5e74b2977461d9511e497f05d8f ] When userspace tries to map the dmabuf and if for some reason (e.g. OOM) the creation of the sg table fails, ubuf->sg needs to be set to NULL. Otherwise, when the userspace subsequently closes the dmabuf fd, we'd try to erroneously free the invalid sg table from release_udmabuf resulting in the following crash reported by syzbot: general protection fault, probably for non-canonical address 0xdffffc0000000000: 0000 [#1] PREEMPT SMP KASAN KASAN: null-ptr-deref in range [0x0000000000000000-0x0000000000000007] CPU: 0 PID: 3609 Comm: syz-executor487 Not tainted 5.19.0-syzkaller-13930-g7ebfc85e2cd7 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/22/2022 RIP: 0010:dma_unmap_sgtable include/linux/dma-mapping.h:378 [inline] RIP: 0010:put_sg_table drivers/dma-buf/udmabuf.c:89 [inline] RIP: 0010:release_udmabuf+0xcb/0x4f0 drivers/dma-buf/udmabuf.c:114 Code: 48 89 fa 48 c1 ea 03 80 3c 02 00 0f 85 2b 04 00 00 48 8d 7d 0c 4c 8b 63 30 48 b8 00 00 00 00 00 fc ff df 48 89 fa 48 c1 ea 03 <0f> b6 14 02 48 89 f8 83 e0 07 83 c0 03 38 d0 7c 08 84 d2 0f 85 e2 RSP: 0018:ffffc900037efd30 EFLAGS: 00010246 RAX: dffffc0000000000 RBX: ffffffff8cb67800 RCX: 0000000000000000 RDX: 0000000000000000 RSI: ffffffff84ad27e0 RDI: 0000000000000000 RBP: fffffffffffffff4 R08: 0000000000000005 R09: 0000000000000000 R10: 0000000000000000 R11: 000000000008c07c R12: ffff88801fa05000 R13: ffff888073db07e8 R14: ffff888025c25440 R15: 0000000000000000 FS: 0000555555fc4300(0000) GS:ffff8880b9a00000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007fc1c0ce06e4 CR3: 00000000715e6000 CR4: 00000000003506f0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 Call Trace: dma_buf_release+0x157/0x2d0 drivers/dma-buf/dma-buf.c:78 __dentry_kill+0x42b/0x640 fs/dcache.c:612 dentry_kill fs/dcache.c:733 [inline] dput+0x806/0xdb0 fs/dcache.c:913 __fput+0x39c/0x9d0 fs/file_table.c:333 task_work_run+0xdd/0x1a0 kernel/task_work.c:177 ptrace_notify+0x114/0x140 kernel/signal.c:2353 ptrace_report_syscall include/linux/ptrace.h:420 [inline] ptrace_report_syscall_exit include/linux/ptrace.h:482 [inline] syscall_exit_work kernel/entry/common.c:249 [inline] syscall_exit_to_user_mode_prepare+0x129/0x280 kernel/entry/common.c:276 __syscall_exit_to_user_mode_work kernel/entry/common.c:281 [inline] syscall_exit_to_user_mode+0x9/0x50 kernel/entry/common.c:294 do_syscall_64+0x42/0xb0 arch/x86/entry/common.c:86 entry_SYSCALL_64_after_hwframe+0x63/0xcd RIP: 0033:0x7fc1c0c35b6b Code: 0f 05 48 3d 00 f0 ff ff 77 45 c3 0f 1f 40 00 48 83 ec 18 89 7c 24 0c e8 63 fc ff ff 8b 7c 24 0c 41 89 c0 b8 03 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 35 44 89 c7 89 44 24 0c e8 a1 fc ff ff 8b 44 RSP: 002b:00007ffd78a06090 EFLAGS: 00000293 ORIG_RAX: 0000000000000003 RAX: 0000000000000000 RBX: 0000000000000007 RCX: 00007fc1c0c35b6b RDX: 0000000020000280 RSI: 0000000040086200 RDI: 0000000000000006 RBP: 0000000000000007 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000293 R12: 000000000000000c R13: 0000000000000003 R14: 00007fc1c0cfe4a0 R15: 00007ffd78a06140 Modules linked in: ---[ end trace 0000000000000000 ]--- RIP: 0010:dma_unmap_sgtable include/linux/dma-mapping.h:378 [inline] RIP: 0010:put_sg_table drivers/dma-buf/udmabuf.c:89 [inline] RIP: 0010:release_udmabuf+0xcb/0x4f0 drivers/dma-buf/udmabuf.c:114 Reported-by: syzbot+c80e9ef5d8bb45894db0@syzkaller.appspotmail.com Cc: Gerd Hoffmann Signed-off-by: Vivek Kasireddy Link: http://patchwork.freedesktop.org/patch/msgid/20220825063522.801264-1-vivek.kasireddy@intel.com Signed-off-by: Gerd Hoffmann Signed-off-by: Sasha Levin --- drivers/dma-buf/udmabuf.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/dma-buf/udmabuf.c b/drivers/dma-buf/udmabuf.c index 38e8767ec371..bf11d32205f3 100644 --- a/drivers/dma-buf/udmabuf.c +++ b/drivers/dma-buf/udmabuf.c @@ -124,17 +124,20 @@ static int begin_cpu_udmabuf(struct dma_buf *buf, { struct udmabuf *ubuf = buf->priv; struct device *dev = ubuf->device->this_device; + int ret = 0; if (!ubuf->sg) { ubuf->sg = get_sg_table(dev, buf, direction); - if (IS_ERR(ubuf->sg)) - return PTR_ERR(ubuf->sg); + if (IS_ERR(ubuf->sg)) { + ret = PTR_ERR(ubuf->sg); + ubuf->sg = NULL; + } } else { dma_sync_sg_for_cpu(dev, ubuf->sg->sgl, ubuf->sg->nents, direction); } - return 0; + return ret; } static int end_cpu_udmabuf(struct dma_buf *buf, From patchwork Sat Oct 22 07:28: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: 7608 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1106609wrr; Sat, 22 Oct 2022 01:38:26 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4vm+L/TEpxFyh3saUpLxkDYWPoAPmgjyFA/g4VVUOiyQoTWLp5M+rlT/CSZLIullKA9L3p X-Received: by 2002:a63:8349:0:b0:46b:2bd4:f291 with SMTP id h70-20020a638349000000b0046b2bd4f291mr19703722pge.75.1666427905789; Sat, 22 Oct 2022 01:38:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666427905; cv=none; d=google.com; s=arc-20160816; b=klW9DNqD/ibuOsXl1sFt/0A7Qu02kSfAQ8TDH80H5A07jnLoEihJer2os0wG+mF+qg 3TSw5bMr8yEaYmExFVtqHUH0P8H/dvihkTiq6tk7VUtx1z6hvXch8jkF8JoCGR8wz9QH kDuer4M9fPJgyYTtdk7SND3MnxMCCu4pEDxp7VHAnbA/WGTQDtjf6LDDrUa59ytugnmA ruaImb5R20zkaLmBrvCbtrs5WT/6gRP78fs9deH0JZ/qzZy6rGg+9V6KB1BzcO869ASu RliqEX0zEQ4EN0sRZ6vP7rW69cryHX3am5OEtKxOQh9MFUAs+xl92idXl8a0eVox8NoE SF4A== 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=qE0t9rO7V7EbPVXuzxbtutiptuaRCfpHq1mDUJsDtPI=; b=diGg/PABKUzwNKjCHHOuinr/gYc4o27VbZkM9CGIX6dqEIsHMMFnBS0OVqSCn13YEO ZRnBqaczT64TOg9P44rloxV7RVzLRWgIhiVzz+NqxLx9H7tjkRlYzS4y3E1ONUpeqAvY VhR6D5bJ1nKIn/q7uIx7r6FFqpub3tAkIExHO71TLo9foDVsm3Oy0pIrUOiqbZ1oSJZA ov8r7s9iOeniO4na3Fm4OYCfGuo6j0n+LjaRzdzpDyZB55NY6r0AatbxhikQJUk58457 C8oi5P5WDt4EYFyz5IdI4CRnRFUqylFTZES5nU8p51U3KzwTzL5WI6aDF2br/U9zmlJp ZW6A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=SH3oIMEm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 y4-20020a17090322c400b0017824f38242si33178166plg.75.2022.10.22.01.38.13; Sat, 22 Oct 2022 01:38: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=SH3oIMEm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S234191AbiJVIgW (ORCPT + 99 others); Sat, 22 Oct 2022 04:36:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59706 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234464AbiJVIa4 (ORCPT ); Sat, 22 Oct 2022 04:30: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 8F7F62E5330; Sat, 22 Oct 2022 01: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 A909EB82E37; Sat, 22 Oct 2022 08:02:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1220EC433D6; Sat, 22 Oct 2022 08:02:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425752; bh=T//Mq0MV/vPrzN/kQ3SK6QnEFdooxLJ2GbtjTJnDnIg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SH3oIMEmoLZZm8x0nfu9Tn7ujKk42o3ctivF5T/TKKZmRRAyuo5ejX1bEOfGnl3g4 A4Yz1ozO1cXlQuGwkktihA9/AADzCmr6VSPLen+Bl97HnQ0xC9JyLdGE0aA4oP6vxS hUF8dMOlG4veknDIkzhi7XHzCv6W833OQK2W+MJA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Andy Shevchenko , Hans de Goede , Sasha Levin Subject: [PATCH 5.19 605/717] platform/x86: pmc_atom: Improve quirk message to be less cryptic Date: Sat, 22 Oct 2022 09:28:04 +0200 Message-Id: <20221022072525.223941607@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376307726916868?= X-GMAIL-MSGID: =?utf-8?q?1747376307726916868?= From: Andy Shevchenko [ Upstream commit 32c9b75640aeb1b144f9e2963c1640f4cef7c6f2 ] Not everyone can get what "critclks" means in the message, improve it to make less cryptic. Signed-off-by: Andy Shevchenko Link: https://lore.kernel.org/r/20220801113734.36131-2-andriy.shevchenko@linux.intel.com Reviewed-by: Hans de Goede Signed-off-by: Hans de Goede Signed-off-by: Sasha Levin --- drivers/platform/x86/pmc_atom.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/platform/x86/pmc_atom.c b/drivers/platform/x86/pmc_atom.c index 5c757c7f64de..f4046572a9fe 100644 --- a/drivers/platform/x86/pmc_atom.c +++ b/drivers/platform/x86/pmc_atom.c @@ -354,7 +354,7 @@ static bool pmc_clk_is_critical = true; static int dmi_callback(const struct dmi_system_id *d) { - pr_info("%s critclks quirk enabled\n", d->ident); + pr_info("%s: PMC critical clocks quirk enabled\n", d->ident); return 1; } From patchwork Sat Oct 22 07:28: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: 7629 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1107509wrr; Sat, 22 Oct 2022 01:41:08 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4kBJ2NSvFw4EwUqZAnd/JHRnbB+S2xbLBdVmQVYImHWRlGQ7reGndayJqQMsDCQpsozK2n X-Received: by 2002:a17:907:60c8:b0:78d:bc56:8f04 with SMTP id hv8-20020a17090760c800b0078dbc568f04mr18460099ejc.560.1666428067901; Sat, 22 Oct 2022 01:41:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666428067; cv=none; d=google.com; s=arc-20160816; b=Y5cS3+sDZ9INoBglraUkGmilH8jrYPMWmXcpH5LzcLE0JUBkiQ3riSxUycOAzyiD7C H3yHITjYswfLmEa4NaY2QOnFs5pS9EUUmlfMQa1GhXNh5bH5hhDIXWdlQS1qVmJvBlBS qPFIflPmnTW6i6eNmLCNQeAFFNLUyUffnxk3D2L7iL+06/Li9eSGbDaxe8szGang4kPp Le2i+LJQe2BqLLZb/G/oIxZ3BjHRvjxeuVVHAw5B9jduv2yBhM7+hJd0cQs9LzqkfUI8 UwfvpIB+XsXWHjKmYQKMUNJJslty+mvvheSAEwtrC0dI3GEWPIi7oasMsDgu+bX0X9DX MpJg== 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=tc4OpjiKKYKziA7rO/RxrZ1lxajFcVj97yyhbHKtXlU=; b=Bj6pdWuJcZbdzdqUGjbAQItZEWWdEo+U77QGyj6tAgEqg3/xCEGiF8MulZjaM0n9oE 937LC2T18k0MTpU9kblVA4+35cLHgDP87hiS18R6xuKs5+miiwhrjwMTj0xbUoz2NCnB tte7NIMtLoBi0S+KwLirHpMmVK9Xpyk/cM9VBjd227/L2zehbVIoJIeVCebGpSDIF4L6 w5aCbQ3NTKXFywmrQMl3QYX0Hda5wq7mPseODBvWTkenYItsod7pVqO5XWsELrNXv/mO bb/d2WXxb2tfqGE2avwYvfvD0mLmog5/QcmP0yB4ULtEbdguaqB9QFyERhIPS+RuNv/r Ul9g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="U+/IR8lh"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 st11-20020a170907c08b00b007948b932e6bsi6271660ejc.227.2022.10.22.01.40.38; Sat, 22 Oct 2022 01:41: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="U+/IR8lh"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S234254AbiJVIgy (ORCPT + 99 others); Sat, 22 Oct 2022 04:36:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58716 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234491AbiJVIbB (ORCPT ); Sat, 22 Oct 2022 04:31:01 -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 479A82E5E01; Sat, 22 Oct 2022 01: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 CFCB7B82E11; Sat, 22 Oct 2022 08:02:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 25274C433C1; Sat, 22 Oct 2022 08:02:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425755; bh=VmgxIigWdW5PxGDKM9INkjR8myLbENkFTD+P5Yn5K18=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=U+/IR8lhQnei74q2ymeGbbD5XG66adln3hzYkIxYsWVn1Zy4ugiqfflFUhFAdYkNf ES947x95WKEGEyC0q54U3dZbSblangqXEFKIeQ+R+J+nf5qX+Bi62AV+5MeqPF3y4z R6v8ykDupPHqDHbyll9M04ERm/34EWb3gEP434kI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Lucas Stach , Robert Foss , Sasha Levin , Neil Armstrong Subject: [PATCH 5.19 606/717] drm: bridge: dw_hdmi: only trigger hotplug event on link change Date: Sat, 22 Oct 2022 09:28:05 +0200 Message-Id: <20221022072525.269053960@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376478082399708?= X-GMAIL-MSGID: =?utf-8?q?1747376478082399708?= From: Lucas Stach [ Upstream commit da09daf881082266e4075657fac53c7966de8e4d ] There are two events that signal a real change of the link state: HPD going high means the sink is newly connected or wants the source to re-read the EDID, RX sense going low is a indication that the link has been disconnected. Ignore the other two events that also trigger interrupts, but don't need immediate attention: HPD going low does not necessarily mean the link has been lost and should not trigger a immediate read of the status. RX sense going high also does not require a detect cycle, as HPD going high is the right point in time to read the EDID. Signed-off-by: Lucas Stach Reviewed-by: Neil Armstrong (v1) Reviewed-by: Robert Foss Signed-off-by: Robert Foss Link: https://patchwork.freedesktop.org/patch/msgid/20220826185733.3213248-1-l.stach@pengutronix.de Signed-off-by: Sasha Levin --- drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c index 3e1be9894ed1..0552e9a3c838 100644 --- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c @@ -3095,6 +3095,7 @@ static irqreturn_t dw_hdmi_irq(int irq, void *dev_id) { struct dw_hdmi *hdmi = dev_id; u8 intr_stat, phy_int_pol, phy_pol_mask, phy_stat; + enum drm_connector_status status = connector_status_unknown; intr_stat = hdmi_readb(hdmi, HDMI_IH_PHY_STAT0); phy_int_pol = hdmi_readb(hdmi, HDMI_PHY_POL0); @@ -3133,13 +3134,15 @@ static irqreturn_t dw_hdmi_irq(int irq, void *dev_id) cec_notifier_phys_addr_invalidate(hdmi->cec_notifier); mutex_unlock(&hdmi->cec_notifier_mutex); } - } - if (intr_stat & HDMI_IH_PHY_STAT0_HPD) { - enum drm_connector_status status = phy_int_pol & HDMI_PHY_HPD - ? connector_status_connected - : connector_status_disconnected; + if (phy_stat & HDMI_PHY_HPD) + status = connector_status_connected; + + if (!(phy_stat & (HDMI_PHY_HPD | HDMI_PHY_RX_SENSE))) + status = connector_status_disconnected; + } + if (status != connector_status_unknown) { dev_dbg(hdmi->dev, "EVENT=%s\n", status == connector_status_connected ? "plugin" : "plugout"); From patchwork Sat Oct 22 07:28: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: 7636 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1107588wrr; Sat, 22 Oct 2022 01:41:26 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7NofI20kpKQnHJfppwIDSoZjNNos53maixSENIjlAH+JUAf8m3LluuxI8yl4KvLWOKYeyu X-Received: by 2002:a17:90b:4a84:b0:20d:8953:5ab0 with SMTP id lp4-20020a17090b4a8400b0020d89535ab0mr62219040pjb.48.1666428085834; Sat, 22 Oct 2022 01:41:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666428085; cv=none; d=google.com; s=arc-20160816; b=Z0yqnW87OeBK0/sbhNhl5+GMEt6Y6q1439Ew0iGDCeeFbyep1byC9DPtzpSWNydnYv T6t4SWyRMp3oYxDP+pLCJoQR3w27uAiX473KlhBXY3peX1WbdyI8otbxk+nQPBMNxV6P v8DiHLQNnvsUJLJnb45T5JpbYzgQItSPUu5nWJ4ipr+Puq/aqWe7m98UxRVUAEO0IsZn lzsIagTPpK7Xbn4d2twHShVa1ZWiFI7zoq26hTaAMjfJzALmUt99TfQMsgphhgjE2lHz LNaWOZyiW3mawTzVUH4VAABKs+9mam2c8Yp9j99HCvsSkE56trGJrKAhIZ9iUVgfYrDe ZfJg== 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=fdEvwau9N/YbcB7d/XgephwtoRhttEd0AgCQlxrX2Q0=; b=eglWcqDrfDjI2nw/gAGRdL4hR8DB4uzgXVSSxkuUK0VydogIGpuHtszrHJC+KPNZ/M p6Vvm2pzKwf9QY+f+Zy2yGglls/8Az8rAdmtstZ3N9ZUFWi6jgwkFTUGDfr4rt6MTbZY tc2UBTN16XUGplbEZlOC+DfqYI5Ng/zebjdGrsbQ7oV6+XSpbVZo590/hvo48A5tfg9u CmvrU28aymgq42dTiA3Hg/8/YxTVt+yYmmyCaxFdW9pUmshwKiV0Bkbfizld9ym+Ju/L l9zPTSNTicguPauJFwjSb1bA3bEVGhiORgqhCvdg1d65sxk1ysJVaG5mUEX/5zYaVBBk /Qmg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=jKWAXt3e; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 k2-20020a170902c40200b001769541146bsi32649436plk.573.2022.10.22.01.41.10; Sat, 22 Oct 2022 01:41: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=jKWAXt3e; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S234509AbiJVIi7 (ORCPT + 99 others); Sat, 22 Oct 2022 04:38:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54758 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234370AbiJVIfD (ORCPT ); Sat, 22 Oct 2022 04:35: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 EE7962E716D; Sat, 22 Oct 2022 01: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 2191760B93; Sat, 22 Oct 2022 08:02:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 22DB5C433C1; Sat, 22 Oct 2022 08:02:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425761; bh=D57F51nhXs+6rwTKvULIB5lh9K58TqPulJrZALO2lFY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jKWAXt3eBWbsC3N8mcC5GvlVJCzk1aVNGvyao4M4T315sPxHiGuwfP1hGRTeZ88nq ouM4nokS7ZXV6KkyKMKhDU2WlY1nzX4w3snV6nq2Noh6oduO2W6OMNAwj4Y5xmcrIe FiaQkwEUKG5zT+aoV8S8e9JxJw8efMsUoFHHZyUw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?utf-8?q?Christian_K=C3=B6nig?= , Yifan Zha , Horace Chen , Hawking Zhang , Alex Deucher , Sasha Levin Subject: [PATCH 5.19 607/717] drm/amdgpu: Skip the program of MMMC_VM_AGP_* in SRIOV on MMHUB v3_0_0 Date: Sat, 22 Oct 2022 09:28:06 +0200 Message-Id: <20221022072525.304928125@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376496914828825?= X-GMAIL-MSGID: =?utf-8?q?1747376496914828825?= From: Yifan Zha [ Upstream commit c1026c6f319724dc88fc08d9d9d35bcbdf492b42 ] [Why] VF should not program these registers, the value were defined in the host. [How] Skip writing them in SRIOV environment and program them on host side. Acked-by: Christian König Signed-off-by: Yifan Zha Signed-off-by: Horace Chen Reviewed-by: Hawking Zhang Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin --- drivers/gpu/drm/amd/amdgpu/mmhub_v3_0.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/mmhub_v3_0.c b/drivers/gpu/drm/amd/amdgpu/mmhub_v3_0.c index bc11b2de37ae..a1d26c4d80b8 100644 --- a/drivers/gpu/drm/amd/amdgpu/mmhub_v3_0.c +++ b/drivers/gpu/drm/amd/amdgpu/mmhub_v3_0.c @@ -169,17 +169,17 @@ static void mmhub_v3_0_init_system_aperture_regs(struct amdgpu_device *adev) uint64_t value; uint32_t tmp; - /* Disable AGP. */ - WREG32_SOC15(MMHUB, 0, regMMMC_VM_AGP_BASE, 0); - WREG32_SOC15(MMHUB, 0, regMMMC_VM_AGP_TOP, 0); - WREG32_SOC15(MMHUB, 0, regMMMC_VM_AGP_BOT, 0x00FFFFFF); - if (!amdgpu_sriov_vf(adev)) { /* * the new L1 policy will block SRIOV guest from writing * these regs, and they will be programed at host. * so skip programing these regs. */ + /* Disable AGP. */ + WREG32_SOC15(MMHUB, 0, regMMMC_VM_AGP_BASE, 0); + WREG32_SOC15(MMHUB, 0, regMMMC_VM_AGP_TOP, 0); + WREG32_SOC15(MMHUB, 0, regMMMC_VM_AGP_BOT, 0x00FFFFFF); + /* Program the system aperture low logical page number. */ WREG32_SOC15(MMHUB, 0, regMMMC_VM_SYSTEM_APERTURE_LOW_ADDR, adev->gmc.vram_start >> 18); From patchwork Sat Oct 22 07:28: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: 7802 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1133976wrr; Sat, 22 Oct 2022 03:05:58 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6puUENW6+visfjlg2PiiR3HyWy/1iGL/m8gCW+nckPKIVzcR069rm987t+be7zsz3+zVCT X-Received: by 2002:a17:907:1687:b0:78e:4b6:1aff with SMTP id hc7-20020a170907168700b0078e04b61affmr18989142ejc.520.1666433157879; Sat, 22 Oct 2022 03:05:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666433157; cv=none; d=google.com; s=arc-20160816; b=mE/dleCjjvKUrmW/5uvmwG5ovWMpSkR2Xa7ILzqWGpJEE8T/i0PDP/BTRdQOvSpLBK sBm+kd9CrfiPi/xJBxCsFIhZD92jwAjvp/qA89JwioCiJftzPLgxoSIqrGLsUOsbVNSE fSycLp3EtxbBFQUohO+6Yt+UwPDQ5SlC8ECLLchEH977wL8L7LLL9dnyAljCgXw3DnMB pBWdrLEVy+SQFv3tspUWx1aMIvTM/vsY3F3jUlgS8hbMe2mr1KMSNxkP47Vd48qayT+z cdaHx3yYzkXNf44APEQC7AYrBgLzMlRo5YAwXhO0Bj+XZn7ZlPjCBrrqxbDr5bEdutjQ gqRQ== 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=toHBm9cliMBRRwVmFWHJh0D+AoyUzjQlzPqKqIc3bOE=; b=GwjGGPxllYvmLbCP7/vhSv2tjftO4jOw/i6ifdEXNil9i/eTwJ9G4Mn+W1P0qysJ6G xJTI86WddNf26nP5A87zdY1Y/n6DEgWziDXYALRTV+79bnStdZz1VXog+ke1HR49WA00 3J9EO7HoOn0Kz0Usr7CyebKPNK/GrdDnCAbkc3nyQGwKBPUZ5gjqwAebQ0AV6d+5BOuD Vm73LEKRnM9uSHzTM+0Emjh9+vTPv76gc/4iDiK+Efa17vxHxl9IuWhISzVr81y8CUYS CRCW50mrNNiD5QW9Ncd4uI07WEEA0TnjNYuG4feacU1U2wNSdyuDdKrzaD2VkcplPHTy U3Xw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=co16kPiT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 o9-20020a170906600900b0078054af5eeasi20597472ejj.374.2022.10.22.03.05.33; Sat, 22 Oct 2022 03:05: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=co16kPiT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S229792AbiJVKDv (ORCPT + 99 others); Sat, 22 Oct 2022 06:03:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51152 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230271AbiJVKDI (ORCPT ); Sat, 22 Oct 2022 06:03:08 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8627430A42D; Sat, 22 Oct 2022 02: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 0110C60BA9; Sat, 22 Oct 2022 08:02:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EA901C433D7; Sat, 22 Oct 2022 08:02:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425764; bh=GE2YQiTOCkVprWu/xnAquC2VU2jYU3qYnrea42lOiBk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=co16kPiTxzl20xiGBiXP/fqQ8Rr050toob6K5JFYbOV/Zsj/VwuZUqJ0gdhx5OBv5 z8NWwEGkATsh7mt6nLXD7kIvVyi2B+zUe1Urp70qDN2yC92URMGLKQN0Hqdb67CHnA Ksn3m44QK81LEolDTqOwnuSD5ByEE2BKfHzveEvw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?utf-8?q?Christian_K=C3=B6nig?= , Yifan Zha , Hawking Zhang , Alex Deucher , Sasha Levin Subject: [PATCH 5.19 608/717] drm/admgpu: Skip CG/PG on SOC21 under SRIOV VF Date: Sat, 22 Oct 2022 09:28:07 +0200 Message-Id: <20221022072525.353474342@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 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?1747381815014278111?= X-GMAIL-MSGID: =?utf-8?q?1747381815014278111?= From: Yifan Zha [ Upstream commit 828418259254863e0af5805bd712284e2bd88e3b ] [Why] There is no CG(Clock Gating)/PG(Power Gating) requirement on SRIOV VF. For multi VF, VF should not enable any CG/PG features. For one VF, PF will program CG/PG related registers. [How] Do not set any cg/pg flag bit at early init under sriov. Acked-by: Christian König Signed-off-by: Yifan Zha Reviewed-by: Hawking Zhang Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin --- drivers/gpu/drm/amd/amdgpu/soc21.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/gpu/drm/amd/amdgpu/soc21.c b/drivers/gpu/drm/amd/amdgpu/soc21.c index 8d5c452a9100..6d3bfb0f0346 100644 --- a/drivers/gpu/drm/amd/amdgpu/soc21.c +++ b/drivers/gpu/drm/amd/amdgpu/soc21.c @@ -551,6 +551,10 @@ static int soc21_common_early_init(void *handle) AMD_PG_SUPPORT_JPEG | AMD_PG_SUPPORT_ATHUB | AMD_PG_SUPPORT_MMHUB; + if (amdgpu_sriov_vf(adev)) { + adev->cg_flags = 0; + adev->pg_flags = 0; + } adev->external_rev_id = adev->rev_id + 0x1; // TODO: need update break; case IP_VERSION(11, 0, 2): From patchwork Sat Oct 22 07:28: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: 7670 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1108245wrr; Sat, 22 Oct 2022 01:44:02 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4GuwKz/aJG1wNekIYiCZSTXCMdr7Vq7w7MorIoJel+Wy+6PWoZNQ1woPa+g1ca6pD3srO1 X-Received: by 2002:a17:906:ee89:b0:73d:70c5:1a4e with SMTP id wt9-20020a170906ee8900b0073d70c51a4emr18367808ejb.683.1666428241885; Sat, 22 Oct 2022 01:44:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666428241; cv=none; d=google.com; s=arc-20160816; b=ATCHEs4QwM1WNTIhVEzs9TpAGRos4NXixVSzVqO2BfBA6fLCJXaoDxsryk0RmGqkIu vmQVvszCF2egbycgnbQOLISrGhaBvesPpDg53FLAudvfrLQnmfCzenRIVmFZ8+OGG+o5 UCwthNyAnPiJ4KJ0V9vvwfBGwnsf9wMC9n3vbzEnMapoNOkjih3SJOQO34bPfTjjmTYy rWusNX5QwAExFZjCjkTRkWg62sRqx0H9FVhR93wM66fQ5FCTHlVrOPP0IOdLV4v3rWfH Ttg4ClaR79gDYwg7G6zGljGH0JNZOX8LKX9HvVLzaZSSRRS6pFfk/NCzvvC7cheEsDWG 1KxA== 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=FzzW3Ju62+8zATfHjS5RjzbRVFFw5XE+Jq+MilECARc=; b=iNla+ilZG1AMWu03ZEv5r0mDVZCSfj5OCcyRH3UukeBE1iYKjivD15bV6jGsCnGGmp FW1fnvn7JiPmdgtngamG/FKOE4TqSiljlh5rGE6iDdeM2uIGhLqhs1hDhOvU4DICrgdC wJp7WkiDJlO6/7IxsSQu00h/s7A5ItZFv/woMqnPdK2AZLOr3JbwASg+0kJ6Hpb081iL KBlohL6PNeC0dA22TGS0lM4qsCGVZZYI3lV/Ns4t3yHXu506pchC9tW6uKgKSUCFh+Ms pBgYEzkKiUOPcB2uWp9KPnWH3IeUAC8Kthw9zOeVm52N3zylsly5xgDl+Oye5v4kOCIf ZPwg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=N6SlzfQH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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-20020a50ce43000000b00447b0cc1501si22109768edj.99.2022.10.22.01.43.37; Sat, 22 Oct 2022 01:44: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=N6SlzfQH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231213AbiJVImm (ORCPT + 99 others); Sat, 22 Oct 2022 04:42:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52306 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234859AbiJVIk1 (ORCPT ); Sat, 22 Oct 2022 04:40:27 -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 D7B0415A8D4; Sat, 22 Oct 2022 01:06: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 F0B8F60ADD; Sat, 22 Oct 2022 08:02:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E08E6C433D7; Sat, 22 Oct 2022 08:02:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425767; bh=uGfFf6JxFGTKu+bs+NRldKaM48ZJlL+YUEbBiFkj7P4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=N6SlzfQHL7A+uM8M+uhEq0JddHEQQr31RzLKtqS3NSg6t/criirNWIriTNGyNN3Bg vZPw199hGN6YmCD0MTcoASilEU1O4SDtzr4IqrVp1cTBv1eojDbplhjkz6BWnslnOZ XwslEUOdhFZiEzr9kPcD9i+P6KYn6UH2uwJv6z50= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Takashi Iwai , Sasha Levin Subject: [PATCH 5.19 609/717] ALSA: usb-audio: Register card at the last interface Date: Sat, 22 Oct 2022 09:28:08 +0200 Message-Id: <20221022072525.392275638@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376659884433046?= X-GMAIL-MSGID: =?utf-8?q?1747376659884433046?= From: Takashi Iwai [ Upstream commit 6392dcd1d0c7034ccf630ec55fc9e5810ecadf3b ] The USB-audio driver matches per interface, and as default, it registers the card instance at the very first instance. This can be a problem for the devices that have multiple interfaces to be probed, as the udev rule isn't applied properly for the later appearing interfaces. Although we introduced the delayed_register option and the quirks for covering those shortcomings, it's nothing but a workaround for specific devices. This patch is an another attempt to fix the problem in a more generic way. Now the driver checks the whole USB device descriptor at the very first time when an interface is attached to a sound card. It looks at each matching interface in the descriptor and remembers the last matching one. The snd_card_register() is invoked only when this last interface is probed. After this change, the quirks for the delayed registration become superfluous, hence they are removed along with the patch. OTOH, the delayed_register option is still kept, as it might be useful for some corner cases (e.g. a special driver overtakes the interface probe from the standard driver, and the last interface probe may miss). Link: https://lore.kernel.org/r/20220904161247.16461-1-tiwai@suse.de Signed-off-by: Takashi Iwai Signed-off-by: Sasha Levin --- sound/usb/card.c | 32 +++++++++++++++++++++++++------- sound/usb/quirks.c | 42 ------------------------------------------ sound/usb/quirks.h | 2 -- sound/usb/usbaudio.h | 1 + 4 files changed, 26 insertions(+), 51 deletions(-) --- a/sound/usb/card.c +++ b/sound/usb/card.c @@ -690,7 +690,7 @@ static bool get_alias_id(struct usb_devi return false; } -static bool check_delayed_register_option(struct snd_usb_audio *chip, int iface) +static int check_delayed_register_option(struct snd_usb_audio *chip) { int i; unsigned int id, inum; @@ -699,14 +699,31 @@ static bool check_delayed_register_optio if (delayed_register[i] && sscanf(delayed_register[i], "%x:%x", &id, &inum) == 2 && id == chip->usb_id) - return iface < inum; + return inum; } - return false; + return -1; } static const struct usb_device_id usb_audio_ids[]; /* defined below */ +/* look for the last interface that matches with our ids and remember it */ +static void find_last_interface(struct snd_usb_audio *chip) +{ + struct usb_host_config *config = chip->dev->actconfig; + struct usb_interface *intf; + int i; + + if (!config) + return; + for (i = 0; i < config->desc.bNumInterfaces; i++) { + intf = config->interface[i]; + if (usb_match_id(intf, usb_audio_ids)) + chip->last_iface = intf->altsetting[0].desc.bInterfaceNumber; + } + usb_audio_dbg(chip, "Found last interface = %d\n", chip->last_iface); +} + /* look for the corresponding quirk */ static const struct snd_usb_audio_quirk * get_alias_quirk(struct usb_device *dev, unsigned int id) @@ -813,6 +830,7 @@ static int usb_audio_probe(struct usb_in err = -ENODEV; goto __error; } + find_last_interface(chip); } if (chip->num_interfaces >= MAX_CARD_INTERFACES) { @@ -862,11 +880,11 @@ static int usb_audio_probe(struct usb_in chip->need_delayed_register = false; /* clear again */ } - /* we are allowed to call snd_card_register() many times, but first - * check to see if a device needs to skip it or do anything special + /* register card if we reach to the last interface or to the specified + * one given via option */ - if (!snd_usb_registration_quirk(chip, ifnum) && - !check_delayed_register_option(chip, ifnum)) { + if (check_delayed_register_option(chip) == ifnum || + chip->last_iface == ifnum) { err = snd_card_register(chip->card); if (err < 0) goto __error; --- a/sound/usb/quirks.c +++ b/sound/usb/quirks.c @@ -1729,48 +1729,6 @@ void snd_usb_audioformat_attributes_quir } /* - * registration quirk: - * the registration is skipped if a device matches with the given ID, - * unless the interface reaches to the defined one. This is for delaying - * the registration until the last known interface, so that the card and - * devices appear at the same time. - */ - -struct registration_quirk { - unsigned int usb_id; /* composed via USB_ID() */ - unsigned int interface; /* the interface to trigger register */ -}; - -#define REG_QUIRK_ENTRY(vendor, product, iface) \ - { .usb_id = USB_ID(vendor, product), .interface = (iface) } - -static const struct registration_quirk registration_quirks[] = { - REG_QUIRK_ENTRY(0x0951, 0x16d8, 2), /* Kingston HyperX AMP */ - REG_QUIRK_ENTRY(0x0951, 0x16ed, 2), /* Kingston HyperX Cloud Alpha S */ - REG_QUIRK_ENTRY(0x0951, 0x16ea, 2), /* Kingston HyperX Cloud Flight S */ - REG_QUIRK_ENTRY(0x0ecb, 0x1f46, 2), /* JBL Quantum 600 */ - REG_QUIRK_ENTRY(0x0ecb, 0x1f47, 2), /* JBL Quantum 800 */ - REG_QUIRK_ENTRY(0x0ecb, 0x1f4c, 2), /* JBL Quantum 400 */ - REG_QUIRK_ENTRY(0x0ecb, 0x2039, 2), /* JBL Quantum 400 */ - REG_QUIRK_ENTRY(0x0ecb, 0x203c, 2), /* JBL Quantum 600 */ - REG_QUIRK_ENTRY(0x0ecb, 0x203e, 2), /* JBL Quantum 800 */ - { 0 } /* terminator */ -}; - -/* return true if skipping registration */ -bool snd_usb_registration_quirk(struct snd_usb_audio *chip, int iface) -{ - const struct registration_quirk *q; - - for (q = registration_quirks; q->usb_id; q++) - if (chip->usb_id == q->usb_id) - return iface < q->interface; - - /* Register as normal */ - return false; -} - -/* * driver behavior quirk flags */ struct usb_audio_quirk_flags_table { --- a/sound/usb/quirks.h +++ b/sound/usb/quirks.h @@ -48,8 +48,6 @@ void snd_usb_audioformat_attributes_quir struct audioformat *fp, int stream); -bool snd_usb_registration_quirk(struct snd_usb_audio *chip, int iface); - void snd_usb_init_quirk_flags(struct snd_usb_audio *chip); #endif /* __USBAUDIO_QUIRKS_H */ --- a/sound/usb/usbaudio.h +++ b/sound/usb/usbaudio.h @@ -37,6 +37,7 @@ struct snd_usb_audio { unsigned int quirk_flags; unsigned int need_delayed_register:1; /* warn for delayed registration */ int num_interfaces; + int last_iface; int num_suspended_intf; int sample_rate_read_error; From patchwork Sat Oct 22 07:28:09 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 7634 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1107577wrr; Sat, 22 Oct 2022 01:41:22 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7bHMrnF/QLxme1tchMBeias3na9YTcoMU3ck9VSZ1f0bt6bTmY2Y615+lNO4O7jhFxMLze X-Received: by 2002:a05:6402:34d0:b0:460:96c4:94af with SMTP id w16-20020a05640234d000b0046096c494afmr11619986edc.365.1666428082634; Sat, 22 Oct 2022 01:41:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666428082; cv=none; d=google.com; s=arc-20160816; b=jprzi98QOUYeVhzsEQ/mI6N12+yqXlVK5apG5EowsprDn2+nwZZm+pColLxyHFuuI7 O9kkb4jQXho8FubllpiSH+LUwcY4wEc1ZU12VSy4Uk490VNY8r9zp7glzyU7KpKaPhUr ZLu3dPo75VgNU2a2KoACTbJymKyNWncOA9ovj01mJu9EkU+ULIcokEr6U/Bhx5QYoVdN nOAzqNDL/AybzsrFLk19Vsd1i6YkG/jYCStNiS6rFSyRczctR/HmzjP8e/ZKbgjkVQyJ 0U2Jo87LLpWi/P1S+RxMTgwJyq00l3cFszoSdlic+DiXqGPXjRePfMnGiCafCPSztTIs rpzw== 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=eK8pLtymwl12CRJdMtE2GMNvtXxO+HwsPAQcgMQaXfY=; b=q4muwoUYsLL1GBM/zzPiMnDX1zuwGCILVOwux/9WvfTQPJCLKImOWqEsPU+AvPi+uw uB4bg53cWQZp+tV0xdU8/f/yhZarzB0eGbkZMqiYC0cORrojbCck2efzPdtjOFL01jXD OIdTgNsWGhSUHt58Yi17UFn3l6otUijBqaMw9lfKB1CFth8+64Q5C+nI3S3JrCumZCGp nktW39XPJATMIcqo5fmt8pGPJHCoMQbI/Hojx1t4MBheQWjikOuXqOpvAoEYlD9Y7tT/ uvQ5nj//D44uCfKA+oK1zGev8YpIVLvTf3UBz2izdQj1hjt8WJMKkbNa+jpBPzHGMjV2 chkA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="Xh/Gt64j"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 pk21-20020a170906d7b500b0078db6f488c2si19945060ejb.56.2022.10.22.01.40.52; Sat, 22 Oct 2022 01:41: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="Xh/Gt64j"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S234346AbiJVIhS (ORCPT + 99 others); Sat, 22 Oct 2022 04:37:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41324 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233821AbiJVIba (ORCPT ); Sat, 22 Oct 2022 04:31:30 -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 E75B42E5E06; Sat, 22 Oct 2022 01: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 A7BD7B82DF2; Sat, 22 Oct 2022 08:02:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EEA06C433C1; Sat, 22 Oct 2022 08:02:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425770; bh=scH4qEzCtXeEEbH+HVY3DscdNarNOhCopKbgKjvj6Pc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Xh/Gt64j/V8oeaYN0PHXG5+4dNsNwYrWp9KhMw8kBb0aGk9JxijNG84jW4Iu7H9Ah ptdr+SHBdmp0Qung7t+YkbG9lSSfqfEpnKvma6X1ZsprMWLUD8aqONsZC8uj2Lf7t1 O2QxI+mPYVEEpekEFBp0K69yIAdq/V5ubdeOfdkA= 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 5.19 610/717] drm/vc4: vec: Fix timings for VEC modes Date: Sat, 22 Oct 2022 09:28:09 +0200 Message-Id: <20221022072525.433202326@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376493219100196?= X-GMAIL-MSGID: =?utf-8?q?1747376493219100196?= 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 11fc3d6f66b1..4e2250b8fa23 100644 --- a/drivers/gpu/drm/vc4/vc4_vec.c +++ b/drivers/gpu/drm/vc4/vc4_vec.c @@ -256,7 +256,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) }; @@ -278,7 +278,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 Sat Oct 22 07:28: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: 7624 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1107498wrr; Sat, 22 Oct 2022 01:41:06 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5HJKSayuu840EmWTFTrILO9OhdGGUfMYO2mWtbCcy06Zg5Bc1qmUacJjOZlt5hTe4tXXuy X-Received: by 2002:a17:907:a0e:b0:780:72bb:5ce4 with SMTP id bb14-20020a1709070a0e00b0078072bb5ce4mr19307717ejc.234.1666428066745; Sat, 22 Oct 2022 01:41:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666428066; cv=none; d=google.com; s=arc-20160816; b=d2Z2ajUC/p7jkZ/SChofpU4gZRrNW169x2cEMrElZdyQwOzmdNPqv4ik/Z1OvfVK34 iqqG6iZw/7onV6Uh99DKFZouNmIf93aE2SUsKxr8GCLHvLyHO/7ztjwxLP5xf+59k+C2 7hA+RAmeWr8HXVZI+NP1sFX/SK9o8914jxpFRVLn4ectMuZ4KEIbOcnrrKOuIbwj+CQU j4b41oHdF02jxT0Xe7xSJWEfLNdF5HXmv/PsCsI2NXovwxyDhzbf0y4HU8WAGnoZ3i1H UgAQaX6AnM4AbTqrukWZzguBJUAKtSeYHxBD0ddy2BxaSV47FUEtALg125x7+G8pYxYc 7dug== 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=3k/RfNZV3O/br/L16vm+/k54NmDPql9mQ9FYbS3zQZM=; b=W9N83yNnkiAycrzhWEl0ZmLdpU8aUOpStRJ6yoURn9Ij3VzgmiiVgXQuyvgP00f+ZH cxaflVi7aDbEam7G+bmkAqF+IVXWngBfidnuJ3Sy6Smr2xZXC8FnIvluXLLZiYrxHTPb Yl5UXSnXrybFH8u+lw9R8tUNwmIdY7xyksgY3Onc6b2sKiXCgq1Bx85A7q7M8dQUUHIc ZiSCISnqRio37tJyUl6VDlE45aSybXDwDB9FqIocKE0o1vEjvA6fg78VTPxuJsPvzLmT LZAZ03GwlSQ5E6In4jJp3RigtMpZg4F0Mjf1RVJMtcxKJlMl9M9BB2rjLLAF3peAN2RV 6C4Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="REz5h/qJ"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 nd27-20020a170907629b00b0078331a3b123si24708958ejc.572.2022.10.22.01.40.38; Sat, 22 Oct 2022 01:41: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="REz5h/qJ"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S234270AbiJVIhB (ORCPT + 99 others); Sat, 22 Oct 2022 04:37:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32994 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234507AbiJVIbE (ORCPT ); Sat, 22 Oct 2022 04:31: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 7F93E2D0818; Sat, 22 Oct 2022 01:03: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 859ACB82DEE; Sat, 22 Oct 2022 08:02:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D07DAC433D6; Sat, 22 Oct 2022 08:02:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425773; bh=KK5HySP1GwSnD/jfZaRzn+Bp85qL/Jum5XmZcPes1Ps=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=REz5h/qJDw2dGA7q5UzfeANpy2lyeRgXGBVoQ3I6ZNluhc9S1WIiAnnMD18NSzQqO oGq0d1yNay8ekhubJF7jeFZTjbeN3lGRnp/mzVb31hlIJdhpMBpxy5XCz4t4gQWi5Q mmmYVApCkT0s9HXDNcjre8YTMbZx1qYCLAkkv0II= 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 5.19 611/717] drm: panel-orientation-quirks: Add quirk for Anbernic Win600 Date: Sat, 22 Oct 2022 09:28:10 +0200 Message-Id: <20221022072525.471921643@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376476388683074?= X-GMAIL-MSGID: =?utf-8?q?1747376476388683074?= 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 d4e0f2e85548..a8681610ede7 100644 --- a/drivers/gpu/drm/drm_panel_orientation_quirks.c +++ b/drivers/gpu/drm/drm_panel_orientation_quirks.c @@ -128,6 +128,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 Sat Oct 22 07:28: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: 7619 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1106856wrr; Sat, 22 Oct 2022 01:39:12 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7EORYbCkPAjWIGNRG3c0l6atj5LGI2nRYWA2KR0bDRdrSFi1dj2rZBQYHaKondRFoOciqs X-Received: by 2002:a17:903:32cf:b0:185:c53f:7459 with SMTP id i15-20020a17090332cf00b00185c53f7459mr22285756plr.82.1666427952588; Sat, 22 Oct 2022 01:39:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666427952; cv=none; d=google.com; s=arc-20160816; b=uK+3QnMCft23FKObRsAe83CwRHc4zoSq4gLRqSyupC0rZWAvPZxo/vEWsc/Q0bQX+q SVdTMHZ4Upjru7eDsBye5yBVpBOZ5Hof8W4Jr2RkIpKvQQH9AbMm5yZnUTzH5S9eN+E+ HDdyrlVM0FPaYwEhMeyo+/W7M7oU+4/Y/AwjaRHBykKFEGe9V53MIC4AecBV5q+mLKCE 1ZnX7R6SqmPai8SX0cKCTemRFfQD0IKIqI1G+XB1HCtPeBDm+WcgjjLUS9uCoShJ/Ezd aADVUrLCg9GodXa5ds+s4s4BQcclFMV2IaWSG8NK67RHx63h8Fsfo3+nS+Jf/ipN8jD5 UlwQ== 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=1ogrTIElye4XxaG523m8eG9jUF9s+1R60fDyPfxnKuY=; b=XWZ85SS6ZOwf8thMZyDVvTYQQLynNEVmGRiCzUBGXkbGYimxbOX8Kksvcd3v6T8S0Z ItxkrLdOC7nvxgI8nuyqtDiTpz0rEhKNsT5DtDD9YslSwCZzp/5TzmGAaAgYkALB0hTI k3h1wH/I8VGWPLd3CdTCWdlXPyGNycgE/ytruxaX3NwUpDHn1HJ6ksnWsI/K//GH07dx w0aoN8YCx5NCRyinfSVi4ZoM6DA0iCkBLbD7EC293HGNW9HlobEC9p6glrO1O5h1c711 ch1RbyHPirK7NPSwJcAR1PoPSrPRTYM0qfas8hMO1mr9VFnHIwjNk27MoANKhoFFKqhx ag4Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=IAM2Jlnw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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-20020a170902cf4c00b001865b86ad09si10256465plg.419.2022.10.22.01.38.58; Sat, 22 Oct 2022 01:39: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=IAM2Jlnw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S234376AbiJVIhp (ORCPT + 99 others); Sat, 22 Oct 2022 04:37:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58052 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233912AbiJVIbl (ORCPT ); Sat, 22 Oct 2022 04:31:41 -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 535A22E5333; Sat, 22 Oct 2022 01:03: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 8364AB82DB3; Sat, 22 Oct 2022 08:02:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B3AA3C433C1; Sat, 22 Oct 2022 08:02:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425776; bh=+0zKgAKqPC/pm7jWIRGut0mCN0L5qdVXBbLQYphdH1w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IAM2JlnwihNy6tbgN4xpjsBgzdS3AZTqy6mqnXiq4tUNSoK7p/+C3VJ4vq5BpxodM MKhk4Dq5MWOjyIpm15erKSM2bhNqTurPehkLJuj6OjrxvEbFrfZQV/scaO72Bc/pgL vZVMc+LDwjTwzWsEreRGvpPdr5o/slEXbrbhvyJc= 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 5.19 612/717] drm: panel-orientation-quirks: Add quirk for Aya Neo Air Date: Sat, 22 Oct 2022 09:28:11 +0200 Message-Id: <20221022072525.522322236@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376356715046728?= X-GMAIL-MSGID: =?utf-8?q?1747376356715046728?= From: Maya Matuszczyk [ Upstream commit e10ea7b9b90219da305a16b3c1252169715a807b ] Yet another x86 gaming handheld. This one has many SKUs with quite a few of DMI strings, so let's just use a catchall, just as with Aya Neo Next. Signed-off-by: Maya Matuszczyk Signed-off-by: Hans de Goede Link: https://patchwork.freedesktop.org/patch/msgid/20220825191946.1678798-1-maccraft123mc@gmail.com Signed-off-by: Sasha Levin --- drivers/gpu/drm/drm_panel_orientation_quirks.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/drivers/gpu/drm/drm_panel_orientation_quirks.c b/drivers/gpu/drm/drm_panel_orientation_quirks.c index a8681610ede7..2d82f236d669 100644 --- a/drivers/gpu/drm/drm_panel_orientation_quirks.c +++ b/drivers/gpu/drm/drm_panel_orientation_quirks.c @@ -103,6 +103,12 @@ static const struct drm_dmi_panel_orientation_data lcd800x1280_rightside_up = { .orientation = DRM_MODE_PANEL_ORIENTATION_RIGHT_UP, }; +static const struct drm_dmi_panel_orientation_data lcd1080x1920_leftside_up = { + .width = 1080, + .height = 1920, + .orientation = DRM_MODE_PANEL_ORIENTATION_LEFT_UP, +}; + static const struct drm_dmi_panel_orientation_data lcd1200x1920_rightside_up = { .width = 1200, .height = 1920, @@ -158,6 +164,12 @@ static const struct dmi_system_id orientation_data[] = { DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "AYA NEO 2021"), }, .driver_data = (void *)&lcd800x1280_rightside_up, + }, { /* AYA NEO AIR */ + .matches = { + DMI_EXACT_MATCH(DMI_SYS_VENDOR, "AYANEO"), + DMI_MATCH(DMI_BOARD_NAME, "AIR"), + }, + .driver_data = (void *)&lcd1080x1920_leftside_up, }, { /* AYA NEO NEXT */ .matches = { DMI_EXACT_MATCH(DMI_BOARD_VENDOR, "AYANEO"), From patchwork Sat Oct 22 07:28: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: 7635 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1107585wrr; Sat, 22 Oct 2022 01:41:24 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7w5kcImSBgfxdFydEdwBYYHpZzgIH+s1dTuMlR3T4PzBvjc6tpM8sg80ti+CxVHkWss/XT X-Received: by 2002:a05:6402:1944:b0:457:fed7:5c30 with SMTP id f4-20020a056402194400b00457fed75c30mr20575558edz.278.1666428084298; Sat, 22 Oct 2022 01:41:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666428084; cv=none; d=google.com; s=arc-20160816; b=Tx8izLbsGUCCif/NYk5h0TA2aGPtsoRKGPc+Aa5c5UaNgmzmmAWlHUyHGHR1fAB2Ap 41hix448FSofk0+L7PXDfo06MWz0PtnDEp5i8ZZnhVEhrlRe7gcOYQenFsf6+RRgf0MU 72YPuljti5Fu4GVdi/sTL4zYzONMrvKaa/qCB6To4he8h6wtapCIirZhX03DuisgpkLp hs+jGHQpEwj2S8DfHkMWEK+267gBRXiHjL2P6ctRXUxlj7XsnYQgmz6rqTBnKGefv/xp 8nWAVax1lvONwIFFTS1q8ocDVpwto1DURayIbMwfGizenqs+oWUD8aflck/IWcy07fkm zfGw== 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=3AUJ4H+i8u/hCrOJRuq7xfaqW+0zQXMaMmcggqucrr4=; b=SnwnYs5/5qicZ6QVjEd8i9G5DyorpTppq65oYN++WZ3miuPrmpfo5tLrTys97b4FRH JZL/A/0w1nSYdllEGm79v4rNzGSjsqMPTr8uZjpBgTWCvdVrbc1Ro4Z1EqvzYgvcyqVR ziXB/2zP9Y2lt4R83qoNKbk3LtfSoMDrrJijaw4Whsa6cDecNhW0hfAeGTLAsiaYbeDb tLi4ENDp/Vo3mDQC6N8irE4woQRHKq9ZRNpCGmZhOjbMEYGpS7bHNTNnFA9J2RLcAOYo H/cCBe0Wy9Vl3qbURzCxtN6lSpe0NVnSYvaNBpiLBgvmqq5BKdLjfervqDw1i8+7JuZ0 7dGg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Ix7Az4aD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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-20020a50ce11000000b0045cda8e8383si20640106edi.542.2022.10.22.01.40.54; Sat, 22 Oct 2022 01:41: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=Ix7Az4aD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S234483AbiJVIih (ORCPT + 99 others); Sat, 22 Oct 2022 04:38:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41324 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234232AbiJVIec (ORCPT ); Sat, 22 Oct 2022 04:34:32 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CFFDF2E717D; Sat, 22 Oct 2022 01:04: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 D044D60B95; Sat, 22 Oct 2022 08:02:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B0C13C433C1; Sat, 22 Oct 2022 08:02:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425779; bh=M38r/E9gOiSMNUxlhb0oTig0PM5+yEimJHqsvloDPrY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ix7Az4aDiudhGBK8nY4RQuAEOjh6fIyO4LsME94sNq60mpcmT6LUX6uv+k7tBHT9n O98Jfbl3oeJxQzJ4oO5JmAcDWdr+5ZkXA7GG5iNWqx4Y0xZf0ATRqUpGis5bRPil1i pRmiW2uNCvgA1m7c+NUZ0sRvtz/92pGp96LojFl4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jameson Thies , Prashant Malani , Benson Leung , Tzung-Bi Shih , Sasha Levin Subject: [PATCH 5.19 613/717] platform/chrome: cros_ec: Notify the PM of wake events during resume Date: Sat, 22 Oct 2022 09:28:12 +0200 Message-Id: <20221022072525.573383019@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376494866552298?= X-GMAIL-MSGID: =?utf-8?q?1747376494866552298?= From: Jameson Thies [ Upstream commit 8edd2752b0aa498b3a61f3caee8f79f7e0567fad ] cros_ec_handle_event in the cros_ec driver can notify the PM of wake events. When a device is suspended, cros_ec_handle_event will not check MKBP events. Instead, received MKBP events are checked during resume by cros_ec_report_events_during_suspend. But cros_ec_report_events_during_suspend cannot notify the PM if received events are wake events, causing wake events to not be reported if received while the device is suspended. Update cros_ec_report_events_during_suspend to notify the PM of wake events during resume by calling pm_wakeup_event. Signed-off-by: Jameson Thies Reviewed-by: Prashant Malani Reviewed-by: Benson Leung Signed-off-by: Tzung-Bi Shih Link: https://lore.kernel.org/r/20220913204954.2931042-1-jthies@google.com Signed-off-by: Sasha Levin --- drivers/platform/chrome/cros_ec.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/platform/chrome/cros_ec.c b/drivers/platform/chrome/cros_ec.c index 00381490dd3e..4b0934ef7714 100644 --- a/drivers/platform/chrome/cros_ec.c +++ b/drivers/platform/chrome/cros_ec.c @@ -352,10 +352,16 @@ EXPORT_SYMBOL(cros_ec_suspend); static void cros_ec_report_events_during_suspend(struct cros_ec_device *ec_dev) { + bool wake_event; + while (ec_dev->mkbp_event_supported && - cros_ec_get_next_event(ec_dev, NULL, NULL) > 0) + cros_ec_get_next_event(ec_dev, &wake_event, NULL) > 0) { blocking_notifier_call_chain(&ec_dev->event_notifier, 1, ec_dev); + + if (wake_event && device_may_wakeup(ec_dev->dev)) + pm_wakeup_event(ec_dev->dev, 0); + } } /** From patchwork Sat Oct 22 07:28: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: 7675 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1108730wrr; Sat, 22 Oct 2022 01:45:54 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6ayBMd9CsyhN914TZq9d0JhN+aqU/kX/nGipxlMbpH1ZpOJCuCRHzrc3ser908o+LJi6re X-Received: by 2002:aa7:db01:0:b0:461:4dc9:74e with SMTP id t1-20020aa7db01000000b004614dc9074emr6332231eds.139.1666428354150; Sat, 22 Oct 2022 01:45:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666428354; cv=none; d=google.com; s=arc-20160816; b=Bef/qKr9tthcqDwTYG7kHVCz1Fp7pdzt+iWeKBiwkIDCaj+Dp9i2vjTHUzd76VTyZa o6HEVoT8Ntl7j5Zsy5dSdWTd+9k9m9A7q0XseDwUjSOH8IDNt2mWbvWXuzBejbonP3tZ 3ldMuF4ExzaFGzaxgghprRqod9W+oTe97jqfFdFkGsMggv+9CKBVUXwEc3m4CcJpoo0z kAJgyxqMzvttLToyjl13n9FYq3byZe8NMS2Of6xun6dI8QdlWv4Hl4X9QhOEGoHGAp0e oMtmz4R27eMrdMKfN+WPpdTo11iLslVC63ZXQXNr+K24eCeXA4HO9pN1pWj8fH7zDdPo I2Wg== 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=U3i6e5mz9lTrz0/598WA8qjJGMH8CDQktUCuLIpeUqw=; b=rqwRsU7qDrT2PeH6zoqLQWvYXbFTL9Qz2YFsBNmbj912fGY1rbBoGdiik+K2MV55Sy XB9cdm6IOSCCfPwoHhzzbQSLlgDNnpkSZt1wFmLkCadLZ0q72UAav/Oz5DxyQCzuuBLA Ylkcn8MvchzDI0IZR2/2za8TyVPeKn5FSOaZe/cvMDh4Ydz0stgwrli7Blmy41eBkQm1 5slZq3mp0wwzi4gq978bA2MpKldzS2li+o1kIevjSb0Xh3yi14tlyK7T7bLdWNJfeLGr 0SphoDcWk7U9y7lVknNdFb2gtBJqz46Xh7HJW8KdBt7Xfpae9NtcaAzQKr8Fi2qHzemv f87Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=nam186ku; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 q20-20020a1709060e5400b007835e4733cbsi16891773eji.201.2022.10.22.01.45.29; Sat, 22 Oct 2022 01:45: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=nam186ku; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S234623AbiJVInO (ORCPT + 99 others); Sat, 22 Oct 2022 04:43:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48384 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234615AbiJVIlu (ORCPT ); Sat, 22 Oct 2022 04:41:50 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 471982E86F2; Sat, 22 Oct 2022 01:06: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 DD85660B94; Sat, 22 Oct 2022 08:03:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D3C9AC433C1; Sat, 22 Oct 2022 08:03:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425782; bh=wLs1MRVkbxT3b8aKqZEYPEL1jHZDMLOF9qfa9pKqlWM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nam186kubsL1tYQwvXO9enRMUSP2DdwYyavlVc+JnhraC+fptcdCId0AeqNtNX2LA 1xEvcktzelu0Z5df/RdIUWdmTQtgBXQK/nejBSB95S8m1DsQ9MjbnKOmsWC148w4P/ SQAV2zp2XhPZr93fyKNm5NQxfj2rmc4RIHU3yRpo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jorge Lopez , Hans de Goede , Sasha Levin Subject: [PATCH 5.19 614/717] platform/x86: hp-wmi: Setting thermal profile fails with 0x06 Date: Sat, 22 Oct 2022 09:28:13 +0200 Message-Id: <20221022072525.622695236@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376778237440529?= X-GMAIL-MSGID: =?utf-8?q?1747376778237440529?= From: Jorge Lopez [ Upstream commit 00b1829294b7c88ecba92c661fbe6fe347b364d2 ] Error 0x06 (invalid command parameter) is reported by hp-wmi module when reading the current thermal profile and then proceed to set it back. The failing condition occurs in Linux NixOS after user configures the thermal profile to ‘quiet mode’ in Windows. Quiet Fan Mode is supported in Windows but was not supported in hp-wmi module. This fix adds support for PLATFORM_PROFILE_QUIET in hp-wmi module for HP notebooks other than HP Omen series. Quiet thermal profile is not supported in HP Omen series notebooks. Signed-off-by: Jorge Lopez Link: https://lore.kernel.org/r/20220912192603.4001-1-jorge.lopez2@hp.com Reviewed-by: Hans de Goede Signed-off-by: Hans de Goede Signed-off-by: Sasha Levin --- drivers/platform/x86/hp-wmi.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/drivers/platform/x86/hp-wmi.c b/drivers/platform/x86/hp-wmi.c index bc7020e9df9e..fc8dbbd6fc7c 100644 --- a/drivers/platform/x86/hp-wmi.c +++ b/drivers/platform/x86/hp-wmi.c @@ -177,7 +177,8 @@ enum hp_thermal_profile_omen_v1 { enum hp_thermal_profile { HP_THERMAL_PROFILE_PERFORMANCE = 0x00, HP_THERMAL_PROFILE_DEFAULT = 0x01, - HP_THERMAL_PROFILE_COOL = 0x02 + HP_THERMAL_PROFILE_COOL = 0x02, + HP_THERMAL_PROFILE_QUIET = 0x03, }; #define IS_HWBLOCKED(x) ((x & HPWMI_POWER_FW_OR_HW) != HPWMI_POWER_FW_OR_HW) @@ -1194,6 +1195,9 @@ static int hp_wmi_platform_profile_get(struct platform_profile_handler *pprof, case HP_THERMAL_PROFILE_COOL: *profile = PLATFORM_PROFILE_COOL; break; + case HP_THERMAL_PROFILE_QUIET: + *profile = PLATFORM_PROFILE_QUIET; + break; default: return -EINVAL; } @@ -1216,6 +1220,9 @@ static int hp_wmi_platform_profile_set(struct platform_profile_handler *pprof, case PLATFORM_PROFILE_COOL: tp = HP_THERMAL_PROFILE_COOL; break; + case PLATFORM_PROFILE_QUIET: + tp = HP_THERMAL_PROFILE_QUIET; + break; default: return -EOPNOTSUPP; } @@ -1263,6 +1270,8 @@ static int thermal_profile_setup(void) platform_profile_handler.profile_get = hp_wmi_platform_profile_get; platform_profile_handler.profile_set = hp_wmi_platform_profile_set; + + set_bit(PLATFORM_PROFILE_QUIET, platform_profile_handler.choices); } set_bit(PLATFORM_PROFILE_COOL, platform_profile_handler.choices); From patchwork Sat Oct 22 07:28: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: 7637 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1107605wrr; Sat, 22 Oct 2022 01:41:29 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5/kks9Z/NM5Rt/gOmP3PpMJfIqfR4JdjTG2F55YW6JOSeCDkIqlfMCwHqAtfgMm4gketKf X-Received: by 2002:a17:907:a40f:b0:790:540c:b6e3 with SMTP id sg15-20020a170907a40f00b00790540cb6e3mr19312744ejc.41.1666428089733; Sat, 22 Oct 2022 01:41:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666428089; cv=none; d=google.com; s=arc-20160816; b=FSQSj1aa4f9MQeTqUWcp+deg46O6ONeh5Slqak+iOLpA8D41zTMMoq0Ibi8uHSexg4 1LpR3FinT4TLVBUner5bzwsiHUpG1m8yAmPoc+XGhBzUPqIdNSBOzg+rm59XfBIHzDxr wQ1nqglgepvH3zOR+oRGiD+UJTFjy1ZuXwiv6jzDF8xUgdzPETJPvLegiMS+rg/xAzTw G/nvhJ34I1G0OdbJY9F0glRYBAx4yHF/C+Z51znvHxbBnCnq2ANCEUbmdZzXJCxkxwsD JPMITunUKC5zuzoyeIjlIXJU18Nu/eMD8agpdY/x5Jy3W16Z2VoDuTIC4Gm90+G+qpNP xDVg== 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=HKWcpNGSz/qO9umKP5O4jo5RzD6s32hka6dtmUVAbiY=; b=UwZRPa7BK1HNCcJPuDJWRijEfLk08quPATioAjhdjH9CbHoFjjyaf0JxUKa68StuvY Gc50XvlxrsK0e9f7YNU7LFNJRBc81v3AqJK6ZfXurYzRiSwFCfuYiRixjBB5QGnkG1Od APxskD2mqGzEFrSjRj67wsRASQv/ilGSgW5wdRxCTPIB9xR1HrgLvGRBJ4pHjnC6V6MH 8cFTELO+5c2lRSHJxJ5H7yKIP/goPaXFxYDmOTIkyhSUiBU/mOCufqgjMDTaN6SgUNXO taWHnbB9xmKCwNfzEk2u5MAtGsD9N6v0XBbDxfZ6LNWtAxCJgY7nxUE9/t5XfFDoC2cU aBXQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=HDaaIGj9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 c14-20020a05640227ce00b0045bd55b122csi25330777ede.332.2022.10.22.01.41.04; Sat, 22 Oct 2022 01: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=HDaaIGj9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S234487AbiJVIin (ORCPT + 99 others); Sat, 22 Oct 2022 04:38:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59174 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234242AbiJVIef (ORCPT ); Sat, 22 Oct 2022 04:34:35 -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 40B2F2D129C; Sat, 22 Oct 2022 01:04: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 1D67260B9D; Sat, 22 Oct 2022 08:03:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0A96CC433D6; Sat, 22 Oct 2022 08:03:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425785; bh=VyRbyK2ww2404bbaV+nZGsh7aEeNQVyazO8tGuaL5hY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HDaaIGj97gHA3SFddkcBpE7XWI02ZOyKyx07JD9uyFZLTAWqYYWSRjtkp2Fzpu7lX 5GNb+nJdYa+9A0HW7GTwXFFsZL2LrgNMyeLlAmduRJ4ZX0SLWeZj/A40r5N8A5j4px HXB9jZaTFYriQhLNresrHHkkTmAA3xCZZ0KFVDSY= 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 5.19 615/717] platform/x86: msi-laptop: Change DMI match / alias strings to fix module autoloading Date: Sat, 22 Oct 2022 09:28:14 +0200 Message-Id: <20221022072525.674204494@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376500489137588?= X-GMAIL-MSGID: =?utf-8?q?1747376500489137588?= 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 3e935303b143..0e804b6c2d24 100644 --- a/drivers/platform/x86/msi-laptop.c +++ b/drivers/platform/x86/msi-laptop.c @@ -596,11 +596,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 @@ -633,8 +632,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 Sat Oct 22 07:28: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: 7621 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1106887wrr; Sat, 22 Oct 2022 01:39:18 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7MdGKXMvVGs/Uo1cB4yLOwqZRDRkVmk6KmfO6biUfE8U3XGAiUCYp9RQZMc+tX3W1r5zTn X-Received: by 2002:a17:906:8a58:b0:7a1:1c25:3e82 with SMTP id gx24-20020a1709068a5800b007a11c253e82mr1648833ejc.185.1666427958409; Sat, 22 Oct 2022 01:39:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666427958; cv=none; d=google.com; s=arc-20160816; b=M6Q8n3KPoeg6koQuncc71zcivu2kTGwKbP804INwMWzuJr71+UT0bmUc5yVc9dM0PG DK3iLrKK043KKWSZrJgWE2/8FONK4flqPB1c0kD5m4/vk4mWdj/fd+GU+KdyOixklgy8 fEOOvLxZraurYR/2uVg6R+2Bk33dxPEMTPKyC6D9bXECJ2cTrc8FJoyi7bto+r3Yf2UO Cbj10CMOI2DhTOcfbGb1LxwLMo4yWFxbw3/MF52atBAdJXdMkdkbodE3kedf30kOEXV3 ZrKq/zU4MTcmqkTnA+YCJnQt+Sgx/4DOGB8N+zvqHuEfKvwQ6TyvQ8hjJ9K7kXgxL+gO OkwQ== 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=T2qBY2Bx4sSC3d2/KvPFYmYOaqkYiPPgbaD5eMTq25E=; b=CK20pxlMANRfLOH0UcfVrjIlvExRFxV42CTMn7X2o/dgaSVjM4VUXDc8jgECqZ0Is/ 5UZcevEaAUHQ3BUQcP7fiQC89DA1ie0CcDUB4R3aOnQTq58aX1Tft+DOsrS5UwrAffro dtO8eHYiip7mBsQi72KT2rS26gS0KHXjysH8cjuGQDbQuN2GktVI6FGO8GJLLUOZHuO7 PVOIW9V8T46plbcalR+EUcB0GfQWr23HG0PiThx6uKF8m7EcsjPdu9fCny7jxuLh9f19 wY5G2g6C7RPbU7Z7JFVxmaREgX5pGzeYEzrcr88z5DG2XndgcmDYswG+E5SxqAVu4ooz DSGQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=mJf0AqZl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 s4-20020a17090699c400b0078be5949d95si22564882ejn.962.2022.10.22.01.38.50; Sat, 22 Oct 2022 01:39: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=mJf0AqZl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S234288AbiJVIhK (ORCPT + 99 others); Sat, 22 Oct 2022 04:37:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33152 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234519AbiJVIbH (ORCPT ); Sat, 22 Oct 2022 04:31:07 -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 8EE772E5E0C; Sat, 22 Oct 2022 01:03: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 ams.source.kernel.org (Postfix) with ESMTPS id 0BAE8B82E03; Sat, 22 Oct 2022 08:03:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 35A2CC433C1; Sat, 22 Oct 2022 08:03:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425788; bh=czNl4+zmuXGorycVi+NqCYslMNtgLRZLXGWQqwWbTkc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mJf0AqZlaYhfs3bJP9pdWHQGcUJBZfPKaZK2DmQ40JrS0MvqFKtHgSErGU3uNOuFX JaukZeIMZIqwNF3GHMXh/e68j4xOQ3bzqW+difofdywg8jDbHBre6trPZ4DeYHN/xI vcRqy0VBZ7EaaVya22NmtS62QnFDzcQTA/bmTHfk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ranjani Sridharan , Muralidhar Reddy , Pierre-Louis Bossart , Mark Brown , Sasha Levin Subject: [PATCH 5.19 616/717] ALSA: intel-dspconfig: add ES8336 support for AlderLake-PS Date: Sat, 22 Oct 2022 09:28:15 +0200 Message-Id: <20221022072525.708704468@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376362783591347?= X-GMAIL-MSGID: =?utf-8?q?1747376362783591347?= From: Muralidhar Reddy [ Upstream commit 9db1c9fa214ef41d098633ff40a87284ca6e1870 ] added quirks for ESS8336 for AlderLake-PS Reviewed-by: Ranjani Sridharan Signed-off-by: Muralidhar Reddy Signed-off-by: Pierre-Louis Bossart Link: https://lore.kernel.org/r/20220919114548.42769-1-pierre-louis.bossart@linux.intel.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- sound/hda/intel-dsp-config.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/sound/hda/intel-dsp-config.c b/sound/hda/intel-dsp-config.c index ec9cbb219bc1..dbc7dfd00c44 100644 --- a/sound/hda/intel-dsp-config.c +++ b/sound/hda/intel-dsp-config.c @@ -422,6 +422,11 @@ static const struct config_entry config_table[] = { .device = 0x51cd, }, /* Alderlake-PS */ + { + .flags = FLAG_SOF, + .device = 0x51c9, + .codec_hid = &essx_83x6, + }, { .flags = FLAG_SOF | FLAG_SOF_ONLY_IF_DMIC_OR_SOUNDWIRE, .device = 0x51c9, From patchwork Sat Oct 22 07:28: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: 7640 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1107641wrr; Sat, 22 Oct 2022 01:41:35 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4e/kN9lqnT+Ew2V1tpsZPBzAtmtopeSWgT/Xrgfn5TxC9na7PI3TwpTtzCbm2QcNPngPAm X-Received: by 2002:aa7:d357:0:b0:45b:dab5:9789 with SMTP id m23-20020aa7d357000000b0045bdab59789mr21806905edr.222.1666428095357; Sat, 22 Oct 2022 01:41:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666428095; cv=none; d=google.com; s=arc-20160816; b=TbiSeaHhud84FGm7r7eVg+/3TgkxwJvje+hfGI4FGSp2vNOq8D9VSPFd8EpauZtlWu dizeBrMWSXS++oBB+R9+MMovcGwC6u/aZGKyAMYhlAPo8SUuygc3b3IHaJjlQ+JvzjkG jHe6IJ4pD4RW+JNLc2EpY19GLloA1zTMXVuqbbok2DC/XDbpbwFOOuEagWvlbv8+Y1gl S3HQpjwF1kXmXDqy4qPjOBpqbkKL3iqY1YA3mYbCeO38AII0sK7ozlaqREa+/V+xUMvZ O5PeQFj/wjLD9pGS0y7GT+PkrrDCEcPjzIojMHP+iOziU5eDY9MTfy1cVySUQfZxhokB H4BQ== 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=pVU5ACPm09g4WEu+LdsddffbfjXZe98V0tuL1COp4vY=; b=SaH7rBXb8vlh4JbZUUEv2DM+pV3Ur3IuKXhTBAXmkw7IlXeztBtLD2jS9uGKdZcB4w VvByWF3+UVxSt5GTTM/BkxE7EEV4+9FtK8HIxC7ws8pDkoDbBkHqZGww1hgYGbUcCxek ZsTvpb7vxN56bNYuqDbSgqBYE8Z0BCVUGInfjvC4OsNr+Qtbuzjebv9ffWxLrtpehKxt j2S+PkegPTIElkbourmwmZxZPpwwDq0y5I+ZicMtOTueSH48N2dE5aLLpWo10Ws/zj+J v9IaBfK/qobqQ3P3bP/Wf7BYM/d/VzKBsFi9+iMnxkp+KoorBYCJBY3CLu0D1RnRENqm JhGQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=A4DNURln; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 gn17-20020a1709070d1100b0078e254ae418si22027483ejc.640.2022.10.22.01.41.09; Sat, 22 Oct 2022 01:41: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=A4DNURln; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S234503AbiJVIiz (ORCPT + 99 others); Sat, 22 Oct 2022 04:38:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45606 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234314AbiJVIev (ORCPT ); Sat, 22 Oct 2022 04:34: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 AB8742D20CA; Sat, 22 Oct 2022 01:04: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 7F4B060BA2; Sat, 22 Oct 2022 08:03:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5A00BC433D6; Sat, 22 Oct 2022 08:03:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425794; bh=pMbxhj9oyvXcVZkWKcZXy1MVAYMbhd3RSfm4nlEApfQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=A4DNURlnQANhraDhNNaBv0qXlRjStBU7FqV/XfdDvhuW0Mhb7cTgGludFGZCX6LPb LogK2z+PQC41wK2tIJFUycnNkWWYDsGzZtGEbCMxBPGaf4bZrxyamMlCsd/Cq0OQo8 7z7u2PYXq/8yMbQnfM5Ec32NWlSiekMKpaCxn5eU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ranjani Sridharan , Chao Song , Curtis Malainey , Jairaj Arava , Curtis Malainey , Sathyanarayana Nujella , Pierre-Louis Bossart , Mark Brown , Sasha Levin Subject: [PATCH 5.19 617/717] ASoC: SOF: pci: Change DMI match info to support all Chrome platforms Date: Sat, 22 Oct 2022 09:28:16 +0200 Message-Id: <20221022072525.748473991@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376506217291703?= X-GMAIL-MSGID: =?utf-8?q?1747376506217291703?= From: Jairaj Arava [ Upstream commit c1c1fc8103f794a10c5c15e3c17879caf4f42c8f ] In some Chrome platforms if OEM's use their own string as SYS_VENDOR than "Google", it leads to firmware load failure from intel/sof/community path. Hence, changing SYS_VENDOR to PRODUCT_FAMILY in which "Google" is used as common prefix and is supported in all Chrome platforms. Reviewed-by: Ranjani Sridharan Reviewed-by: Chao Song Reviewed-by: Curtis Malainey Signed-off-by: Jairaj Arava Signed-off-by: Curtis Malainey Signed-off-by: Sathyanarayana Nujella Signed-off-by: Pierre-Louis Bossart Link: https://lore.kernel.org/r/20220919114429.42700-1-pierre-louis.bossart@linux.intel.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- sound/soc/sof/sof-pci-dev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sound/soc/sof/sof-pci-dev.c b/sound/soc/sof/sof-pci-dev.c index d627092b399d..643fd1036d60 100644 --- a/sound/soc/sof/sof-pci-dev.c +++ b/sound/soc/sof/sof-pci-dev.c @@ -138,7 +138,7 @@ static const struct dmi_system_id community_key_platforms[] = { .ident = "Google Chromebooks", .callback = chromebook_use_community_key, .matches = { - DMI_MATCH(DMI_SYS_VENDOR, "Google"), + DMI_MATCH(DMI_PRODUCT_FAMILY, "Google"), } }, {}, From patchwork Sat Oct 22 07:28: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: 7644 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1107719wrr; Sat, 22 Oct 2022 01:41:52 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4mEqVJX2kSHXcWzCy+oz4mreZPPE1I9fi8/3ZnmIT1pR89dbJV6Gi7F2e7fOsDkA2cthQX X-Received: by 2002:a05:6402:1941:b0:457:13a:cce9 with SMTP id f1-20020a056402194100b00457013acce9mr21531469edz.265.1666428112101; Sat, 22 Oct 2022 01:41:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666428112; cv=none; d=google.com; s=arc-20160816; b=Y7fzszS/JUXTqk+by/4pEVvlQwOCSpp9SWzlSP50doD13UKLdudNGTNzyyDAZpC1rk 6oLRHJucw0pgTxwdMyGGQm7eeIBIccQAfjNDv1Bqaoqw87jMG8wjSimAxhHlwshm+t/s KwTGgCuI35BOoxo4TTl1McGP5vlASNe1t+XMmtIt4z6fEDN8fl+Xj/m8LtyUl5cC76hr Qd6g/i09eEzpiUN3S35m3uwINq7STrNag3isy6FCf148es7EQstCmWAGBTqTxWPLoWX9 qS8TeBN0xgfs0KOzBZyKfl6bkeqDQGjFZ5GHxRpTvkJJCa+k04TRFlR3mxk1VMZFzxgs ixBg== 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=JLI3j3WO5NV75LYwkgTjwJt/bew8AJj9F7Ur2rNZhrg=; b=NmMRyBLD0gYnnv2hRU09bDgucouxtDocMEGTGAPTlrPSfkxwa4Ov8dIlmsiJljn1Gm J+X8lZ9Vq4dVWNrt8cgN+P0mbzT9k7/wJA9vsElqjJX1NdIvIzJQ4jkXaIXMCQtHinux dfDVpbIvIJt31SNjACYLxPCZHK32YoVnfRMuczUXsL0vRuEuDZwUIBIr0BIu1pEWWn3o mZRGDKxnKo8tFUgLMGIL7DXFIWTUmbDA/SSl31nF99aVyBxMjXH6AqC1e5aVnf1VPRD5 dqDF/qy+QCoPX6Jre97OMzap4q8yzM5pYBusSPFPaWIZgRhgFK17xYkkD6NX/yr4y9LZ b4eA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=MlrJHRm5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 b11-20020a056402084b00b0045b265a1712si27371732edz.595.2022.10.22.01.41.25; Sat, 22 Oct 2022 01: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=MlrJHRm5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S234601AbiJVIjR (ORCPT + 99 others); Sat, 22 Oct 2022 04:39:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53732 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234449AbiJVIfb (ORCPT ); Sat, 22 Oct 2022 04:35:31 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 04E391DDCD; Sat, 22 Oct 2022 01:04:25 -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 8978D60B81; Sat, 22 Oct 2022 08:03:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9C03BC433C1; Sat, 22 Oct 2022 08:03:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425798; bh=iRWAp7mT/u5ZsntRpuy7Qz6GdmF0Etd7XBAveRikPHo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MlrJHRm5pnas+PVRJjzU5xzxQzREXur+3HD4Ve7kXagmam+fwtRT35nY2whMHLBRK 0PoFRWfBfBfcZCIl+dJRGNl22GZpjvW0O/aBx4MMV347yE1Piywu6LpoVPRsLTKSKX aA102eee8ljdzc4lQnfS5hzAgRPpLC7sJVniDyH0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Pierre-Louis Bossart , Kai Vehmanen , Bard Liao , Mark Brown , Sasha Levin Subject: [PATCH 5.19 618/717] ASoC: SOF: add quirk to override topology mclk_id Date: Sat, 22 Oct 2022 09:28:17 +0200 Message-Id: <20221022072525.787620162@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376524314652843?= X-GMAIL-MSGID: =?utf-8?q?1747376524314652843?= From: Pierre-Louis Bossart [ Upstream commit d136949dd8e2e309dc2f186507486b71cbe9acdb ] Some Intel-based platforms rely on a topology file that hard-codes the use of MCLK0. This is incorrect in 10% of the cases. Rather than generating yet another set of topology files, this patch adds a kernel module parameter to override the topology value. In hindsight, we should never have allowed mclks to be specified in topology, this is a hardware-level information that should not have been visible in the topology. Future patches will try to set this value automagically, e.g. by parsing the NHLT content. Signed-off-by: Pierre-Louis Bossart Reviewed-by: Kai Vehmanen Reviewed-by: Bard Liao Link: https://lore.kernel.org/r/20220919115350.43104-3-pierre-louis.bossart@linux.intel.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- sound/soc/sof/intel/hda.c | 11 +++++++++++ sound/soc/sof/ipc3-topology.c | 7 +++++++ sound/soc/sof/sof-priv.h | 4 ++++ 3 files changed, 22 insertions(+) diff --git a/sound/soc/sof/intel/hda.c b/sound/soc/sof/intel/hda.c index 17f2f3a982c3..7d9e62ab9d0e 100644 --- a/sound/soc/sof/intel/hda.c +++ b/sound/soc/sof/intel/hda.c @@ -376,6 +376,10 @@ static int dmic_num_override = -1; module_param_named(dmic_num, dmic_num_override, int, 0444); MODULE_PARM_DESC(dmic_num, "SOF HDA DMIC number"); +static int mclk_id_override = -1; +module_param_named(mclk_id, mclk_id_override, int, 0444); +MODULE_PARM_DESC(mclk_id, "SOF SSP mclk_id"); + #if IS_ENABLED(CONFIG_SND_SOC_SOF_HDA) static bool hda_codec_use_common_hdmi = IS_ENABLED(CONFIG_SND_HDA_CODEC_HDMI); module_param_named(use_common_hdmi, hda_codec_use_common_hdmi, bool, 0444); @@ -1433,6 +1437,13 @@ struct snd_soc_acpi_mach *hda_machine_select(struct snd_sof_dev *sdev) sof_pdata->tplg_filename = tplg_filename; } + + /* check if mclk_id should be modified from topology defaults */ + if (mclk_id_override >= 0) { + dev_info(sdev->dev, "Overriding topology with MCLK %d from kernel_parameter\n", mclk_id_override); + sdev->mclk_id_override = true; + sdev->mclk_id_quirk = mclk_id_override; + } } /* diff --git a/sound/soc/sof/ipc3-topology.c b/sound/soc/sof/ipc3-topology.c index e97f50d5bcba..b8ec302bc887 100644 --- a/sound/soc/sof/ipc3-topology.c +++ b/sound/soc/sof/ipc3-topology.c @@ -1233,6 +1233,7 @@ static int sof_link_afe_load(struct snd_soc_component *scomp, struct snd_sof_dai static int sof_link_ssp_load(struct snd_soc_component *scomp, struct snd_sof_dai_link *slink, struct sof_ipc_dai_config *config, struct snd_sof_dai *dai) { + struct snd_sof_dev *sdev = snd_soc_component_get_drvdata(scomp); struct snd_soc_tplg_hw_config *hw_config = slink->hw_configs; struct sof_dai_private_data *private = dai->private; u32 size = sizeof(*config); @@ -1257,6 +1258,12 @@ static int sof_link_ssp_load(struct snd_soc_component *scomp, struct snd_sof_dai config[i].hdr.size = size; + if (sdev->mclk_id_override) { + dev_dbg(scomp->dev, "tplg: overriding topology mclk_id %d by quirk %d\n", + config[i].ssp.mclk_id, sdev->mclk_id_quirk); + config[i].ssp.mclk_id = sdev->mclk_id_quirk; + } + /* copy differentiating hw configs to ipc structs */ config[i].ssp.mclk_rate = le32_to_cpu(hw_config[i].mclk_rate); config[i].ssp.bclk_rate = le32_to_cpu(hw_config[i].bclk_rate); diff --git a/sound/soc/sof/sof-priv.h b/sound/soc/sof/sof-priv.h index f11f575fd1da..544e5be9d10e 100644 --- a/sound/soc/sof/sof-priv.h +++ b/sound/soc/sof/sof-priv.h @@ -585,6 +585,10 @@ struct snd_sof_dev { /* to protect the ipc_rx_handler_list and dsp_state_handler_list list */ struct mutex client_event_handler_mutex; + /* quirks to override topology values */ + bool mclk_id_override; + u16 mclk_id_quirk; /* same size as in IPC3 definitions */ + void *private; /* core does not touch this */ }; From patchwork Sat Oct 22 07:28:18 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 7782 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1121508wrr; Sat, 22 Oct 2022 02:28:48 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7PZq75z8Lp9QB3gBhP4BeQDlrgYZosvBW3IGKX1o88EabSghNnucMf7FZN7hrvgiwTYa/n X-Received: by 2002:a17:907:72cb:b0:793:30b3:7f89 with SMTP id du11-20020a17090772cb00b0079330b37f89mr13917585ejc.259.1666430928149; Sat, 22 Oct 2022 02:28:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666430928; cv=none; d=google.com; s=arc-20160816; b=RwBByCuv86aZTcW+v4o+yAEBLoCCMRGnLOV3HMom/1Fdo+TFQtmFPnVrxLKFEHxzQI dHc/nmGkpPAXmbTGRKfOU5xnhCnaff+rKTSvWWfSD4qxPciLQuqcgef2QrI0lZowRbV4 WpTMJQoYl0zH71cJNVv5GoVt1tft64zHoZWdNjNIHFuJC7Nyamj80Y36DWyQgTyn5+WU Nh+m9Ai4cZMubB8xVrah4PbWPnkRXM/qR/U61pKPPlo2jhq6INgi0I69IefpV4asDnbz W5+EvLge7dYKdB1FfFOqSDaF0lzHslMjCaLlG8UufOZr2AV6Oau7bd66u52Jykq8Rvx6 Ek0w== 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=IRvL89iu3AsYoBNtyhQYCs/DDPqSHzhlIPhLiEwM0o0=; b=acWF6s/m1I2w7mPY9TesxUeFqVjyBy4pLGKRlZetRm+kSW2wkcWPPFC6MPAm03mXaI Td62Lkln8KkPmsEsuGVB74rJ/yKefVi2Jo5yyCCbCNfmUwyLBKhHoxrZGCG42RuXAslK MmMOTuWNJtUXVMavw7WnSoMVXeJlSxlpVEzog7Xq7Ox+kUaPdzxUp7L3c5uUX1VY6ijt pBOZoMyQM+NnUzQwcG8VUk1wW6TFbpnNyPm5cG2jjyPkISDCpFTU/keB+jP0qQeBiX7p yLaWAqa07c8FdIt6Ki0RlwRz6HFanZ27Uj+39DoNgHJHQKpV1u2QaKI3A2Y5AcrSkJ1h 7HRg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=VQD4egYx; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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-20020a056402270a00b0045dc9b4c034si15180765edd.582.2022.10.22.02.28.23; Sat, 22 Oct 2022 02:28: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=VQD4egYx; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S234173AbiJVJDH (ORCPT + 99 others); Sat, 22 Oct 2022 05:03:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54582 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231305AbiJVJCf (ORCPT ); Sat, 22 Oct 2022 05:02:35 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9AD6B2DB954; Sat, 22 Oct 2022 01:17: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 7D5C7B82E37; Sat, 22 Oct 2022 08:05:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EC2F9C433C1; Sat, 22 Oct 2022 08:05:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425922; bh=Syyww4aE/A9q2YbgecUDjN7WhpYEeXohYESQpJiSY+w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VQD4egYxjrwz4wIDEG+zjcgDgf8bsJBrGQVGu4h8lXQf/uTkYPqoDZqDZX/ur21Yc qACnaHHXgzbRlYOfhPga4l3zXfRQ05Dgid+Vr+0SbSy7wo8zJRCy8C9GM8923g+/VK KOnTCjgAbSI4pmSYsXLnFMwRtAfhqAS4mhCACSo4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Philip Yang , Felix Kuehling , =?utf-8?q?Christian_K=C3=B6nig?= , Alex Deucher , Sasha Levin Subject: [PATCH 5.19 619/717] drm/amdgpu: SDMA update use unlocked iterator Date: Sat, 22 Oct 2022 09:28:18 +0200 Message-Id: <20221022072525.839645654@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747379476989066951?= X-GMAIL-MSGID: =?utf-8?q?1747379476989066951?= From: Philip Yang [ Upstream commit 3913f0179ba366f7d7d160c506ce00de1602bbc4 ] SDMA update page table may be called from unlocked context, this generate below warning. Use unlocked iterator to handle this case. WARNING: CPU: 0 PID: 1475 at drivers/dma-buf/dma-resv.c:483 dma_resv_iter_next Call Trace: dma_resv_iter_first+0x43/0xa0 amdgpu_vm_sdma_update+0x69/0x2d0 [amdgpu] amdgpu_vm_ptes_update+0x29c/0x870 [amdgpu] amdgpu_vm_update_range+0x2f6/0x6c0 [amdgpu] svm_range_unmap_from_gpus+0x115/0x300 [amdgpu] svm_range_cpu_invalidate_pagetables+0x510/0x5e0 [amdgpu] __mmu_notifier_invalidate_range_start+0x1d3/0x230 unmap_vmas+0x140/0x150 unmap_region+0xa8/0x110 Signed-off-by: Philip Yang Suggested-by: Felix Kuehling Reviewed-by: Christian König Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin --- drivers/gpu/drm/amd/amdgpu/amdgpu_vm_sdma.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm_sdma.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm_sdma.c index 1fd3cbca20a2..718db7d98e5a 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm_sdma.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm_sdma.c @@ -211,12 +211,15 @@ static int amdgpu_vm_sdma_update(struct amdgpu_vm_update_params *p, int r; /* Wait for PD/PT moves to be completed */ - dma_resv_for_each_fence(&cursor, bo->tbo.base.resv, - DMA_RESV_USAGE_KERNEL, fence) { + dma_resv_iter_begin(&cursor, bo->tbo.base.resv, DMA_RESV_USAGE_KERNEL); + dma_resv_for_each_fence_unlocked(&cursor, fence) { r = amdgpu_sync_fence(&p->job->sync, fence); - if (r) + if (r) { + dma_resv_iter_end(&cursor); return r; + } } + dma_resv_iter_end(&cursor); do { ndw = p->num_dw_left; From patchwork Sat Oct 22 07:28: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: 7780 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1121383wrr; Sat, 22 Oct 2022 02:28:25 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5Tverxtjk6jJaDqgWnxWsXEqDjoFgtuV51CU1qUFglFwNgx7ix6RTjPdKSvGdtJpsm4jc9 X-Received: by 2002:a17:90a:aa8f:b0:210:bec0:bde with SMTP id l15-20020a17090aaa8f00b00210bec00bdemr17885159pjq.109.1666430904777; Sat, 22 Oct 2022 02:28:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666430904; cv=none; d=google.com; s=arc-20160816; b=fwNObcn4MDy+VumLDmH7mPLhSxl8C3aaIP9AMiXU873jx23Z1BCoTpVrsLjpJW9Vaa jPga4BAHc3Qa62MiWiaYISWZRayRPrpbb9qYBht1RaiWl4j/OZb/kF2yTiT5B+BYjvSy zWDd5Y2nXFu44ChKMKulgLCjZr2qFJ/rWl5g+ComLWWGCMSDxCoASfuSWP80Nf/9PY9m Gc6cpQdl2YblKjBONl9xj+bwQ4tm7W2TnNjhaiHxN3KV/DWq6ECUdm1fofcR2Qxut64X uyMSeYldSQDCh9mSTf99Qv5FO+6vVzEaHIl9/BTp3TXB6ltzg56T+cwsFmMSDaojFuiN Hq7g== 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=HCmJahcVlWv6D9XJvkOVU7B1N9TZHv8rjw87YsweF64=; b=rA8TWxW36lBt9U3ikav3Q/ciw9Gr3HmIzFywjy97rY8mAGPFn4MOghSUgo32V3DPQ6 TnJQ6s/YdRscyxLItVh7evlLTnAX9KnB1wtHb/h1WdbIFV3aT87noQJuZN2bY2XCCJkn ZWHYTqwZsPPOLGnqtv/igOMea9rDi5CWk6KRcM5dBls4ySgPBZ62dhjmAWHcKFaPjgya 2guI3fkdjpqFqSXetIL8Oz+F2BtGEsycfmIVGm9HBfYGBs5w500FFmILM/lv91PBJP/l 6ooEsCnk9WeEJe4YOGGeCjrjyeEQ4pn5Vxsytz7l5rGdGG4lQm6UrsKxAU/qV8kKRg86 LGaA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="cz/sK5rV"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 z13-20020a170902cccd00b0018659ff71d2si10503635ple.62.2022.10.22.02.28.12; Sat, 22 Oct 2022 02:28: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="cz/sK5rV"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S233000AbiJVJHI (ORCPT + 99 others); Sat, 22 Oct 2022 05:07:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60644 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232428AbiJVJGr (ORCPT ); Sat, 22 Oct 2022 05:06: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 03C71158D6E; Sat, 22 Oct 2022 01:20: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 39A2FB82DF9; Sat, 22 Oct 2022 08:03:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7F9F5C433C1; Sat, 22 Oct 2022 08:03:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425823; bh=/qVHldP64B5xa9jg2xsijaphwXXl0NsLnQSVOzxEN8M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cz/sK5rVf+IRaMiroYqeXqcwJC4AdjoZjz77L/CuzdEc4tvYpxbbh7riYW19lEWoO l5Gtpb2hu1d1mUh1Fkq3aZZ97LOVPrDqeCW+cs6eq+3f/OXfamAbAmXCx5DBEwFQ5K FGV8hVSlTLn8pmVQlSOyrp09HBTxF5aJRatQINwc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Charlene Liu , Wayne Lin , Sherry Wang , Daniel Wheeler , Alex Deucher , Sasha Levin Subject: [PATCH 5.19 620/717] drm/amd/display: correct hostvm flag Date: Sat, 22 Oct 2022 09:28:19 +0200 Message-Id: <20221022072525.887022856@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747379452331722557?= X-GMAIL-MSGID: =?utf-8?q?1747379452331722557?= From: Sherry Wang [ Upstream commit 796d6a37ff5ffaf9f2dc0f3f4bf9f4a1034c00de ] [Why] Hostvm should be enabled/disabled accordding to the status of riommu_active, but hostvm always be disabled on DCN31 which causes underflow [How] Set correct hostvm flag on DCN31 Reviewed-by: Charlene Liu Acked-by: Wayne Lin Signed-off-by: Sherry Wang Tested-by: Daniel Wheeler Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin --- drivers/gpu/drm/amd/display/dc/dcn31/dcn31_resource.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/amd/display/dc/dcn31/dcn31_resource.c b/drivers/gpu/drm/amd/display/dc/dcn31/dcn31_resource.c index 3d9f07d4770b..8a0de6bfc716 100644 --- a/drivers/gpu/drm/amd/display/dc/dcn31/dcn31_resource.c +++ b/drivers/gpu/drm/amd/display/dc/dcn31/dcn31_resource.c @@ -892,7 +892,7 @@ static const struct dc_debug_options debug_defaults_drv = { .enable_sw_cntl_psr = true, .apply_vendor_specific_lttpr_wa = true, .enable_z9_disable_interface = true, /* Allow support for the PMFW interface for disable Z9*/ - .dml_hostvm_override = DML_HOSTVM_OVERRIDE_FALSE, + .dml_hostvm_override = DML_HOSTVM_NO_OVERRIDE, }; static const struct dc_debug_options debug_defaults_diags = { From patchwork Sat Oct 22 07:28: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: 7809 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1139891wrr; Sat, 22 Oct 2022 03:23:47 -0700 (PDT) X-Google-Smtp-Source: AMsMyM78GzZKV/OpsLmWYXaL/K3uONOyCY2E6nzdQqkK2rJiKqmyOSOQldYhppPP6+XZZZMVfsfX X-Received: by 2002:a17:906:8a48:b0:79e:da2d:c13f with SMTP id gx8-20020a1709068a4800b0079eda2dc13fmr4175551ejc.477.1666434227028; Sat, 22 Oct 2022 03:23:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666434227; cv=none; d=google.com; s=arc-20160816; b=TgWInA0xDmBbUZK5D6Q2KwSoTXG5D/bBCIF/hfpx1R841s41z4FmYvjkeAZfLSQ9qy BP0enI2wkwMf+SWEYtempMngdD97bXgxRhISPasKzk9BTG0BOXh3edKICFq5HohciHqb nsoQzaaTVoqbxL5kc5fbSt/YhMPiBhjY8+wLTjDAaf6d0cPZ3Pvj63oNjwige04n4I7y 2NG3I2DXpnYTHNNhgLpUXSk/dOWa+0+z95CfaNpCxNhlb4gMPzK/LnFkYySxElXBcgG6 7ZnQGagFuqjMAz7mWInnkpnE2K0gI87FgZK0LJERb4/PdLcvv41yYoLP1TrhxB2XGyUh vGFQ== 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=oWrM3ZblDF16QnG7wJFkpCv003izt5dSUqGwlTU/cxg=; b=QzHUkscWblO30UORo3bXOdGEQfuOn29VUhKM2LQHb1PSPXeA4mF7f1MJbSxWXfVnRQ rIbAIgyfAM+H5XTCwGPnn7ygXXUoR8/QJsVUXp/dQO8xu0nMpEllI+O+3uI0ZrR+BtXy MlKqk7v0pmpaojNoSknedcYVMTOTDoJ3DMttw/T97Ibf09VrCQNx0nvp5wtjxP4ZgIbs aX6OtbcaN9L98UaeNJK/E6jMOAGD51DB+rJHx7NOwZBRZZAXyAYcXDuy6WrHET8BR2N1 OoAlyB0lfDIcDTaFQt25W1fBz3v1AMwFcnle/DqSzTb25aRN7RuQ2dcaqCkRAliCZPZW 3f8g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=twCAaLJb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 dm10-20020a170907948a00b0078de8d119d8si8237294ejc.853.2022.10.22.03.23.22; Sat, 22 Oct 2022 03:23: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=twCAaLJb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S230292AbiJVKPx (ORCPT + 99 others); Sat, 22 Oct 2022 06:15:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49926 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230036AbiJVKPV (ORCPT ); Sat, 22 Oct 2022 06:15: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 2239422B10; Sat, 22 Oct 2022 02: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 C4B85B82E03; Sat, 22 Oct 2022 08:04:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 11A27C433C1; Sat, 22 Oct 2022 08:04:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425856; bh=zvWGShizebvrdEFUd9n0bZ6NDl0vKJL3PrigdSbA9rg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=twCAaLJb85C9DNVsd9Np63lSQX4oG8X4TiHye6ESYXLdJL2GnKhZiMuuUz98yGFey LunVKieF+6yXnnkKHzwjKhVKVInRwLPgeP0+vgGwe+F3vy8f5teGDDxnDWPjgW/AWD dG5JgdT+0Fl4wqPYtAXbhKBH4W72RmBQEG8twmi8= 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 5.19 621/717] drm/amdgpu: fix initial connector audio value Date: Sat, 22 Oct 2022 09:28:20 +0200 Message-Id: <20221022072525.921840066@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 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?1747382936028550943?= X-GMAIL-MSGID: =?utf-8?q?1747382936028550943?= 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 b7933c2ce765..491d4846fc02 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c @@ -1674,10 +1674,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; @@ -1799,6 +1801,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, @@ -1852,6 +1855,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, @@ -1902,6 +1906,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 Sat Oct 22 07:28:21 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 7657 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1108050wrr; Sat, 22 Oct 2022 01:43:05 -0700 (PDT) X-Google-Smtp-Source: AMsMyM61wBBFszCyPnsTKqO1JWbGj+j/tAHxttPCxlHJJ4LN9EQtCblPrHDTu7/aEKdp4KweE+TB X-Received: by 2002:a17:907:6e11:b0:78e:3057:f631 with SMTP id sd17-20020a1709076e1100b0078e3057f631mr18719217ejc.333.1666428185239; Sat, 22 Oct 2022 01:43:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666428185; cv=none; d=google.com; s=arc-20160816; b=HDr9nuNR8MXVq+8vCKmCrGMFsQKcgb/yA1tfqgjLd7o/9WDaY+n5qUKQyrvr7CdWJ5 6AGyxpQFlqYui+aEXv1/8gs6LDQ05OIKXh32UReDOn07bQwqPZk9szI22a0qWp8GdLKK QjnEEToopPyggw+KBljNd3yNxHlzZiQ2k65XNwezraKrwSzY4U22l3aP94ZyBi4P3IgA 6mrl2e4+e0OHqiqWVd7tcnMx/EMC4EayGXu02O8hjw6U2qwdKEWo6WeU8BhFcamUuD27 bg95iAxdsAk/pd2QEar4+JfFnJ74IYZxNh344OGSopmQz6HvDeLh7oV34cVsfRDwn98e 5Xqg== 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=byk8dukZUgOfEz/hwrYh6XtljyfOBPNN38YFi468OBs=; b=YusXOQgxOhmwzVuHxQfJ4StesyN7kuIk3A6jVSJL9oL4HBfiLDrDTTYj6eQ2Uo+D5Z FCRE1c21ffMkenIjZi0jgsBKi2irFKv1hFq4Icj5iU7y29hIdFWn+12ZIT7WDEiPx16F zE9EQEcqc2zozK6S0t2CqpRORI1tlcY8qWKwG0umWQYmvsL4VPTf2HHjk2r3Ypzm/+Si I0LU0FJE63YC1uoRZAF4N1IIkLrc8FGxSCtkHLDHi29SV3v8kDK+1AXOIn1Izwyb3fsc k0JfkbJGZEV3qFPwKYE6ClvTeIg08wOCT119y/0nOfDieMN74PgCTaonj7Bi9f8ID1ZZ nekA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="FpiJ4sV/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 t13-20020a170906268d00b0078356aaeb61si1741805ejc.286.2022.10.22.01.42.33; Sat, 22 Oct 2022 01:43: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="FpiJ4sV/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S234594AbiJVIlm (ORCPT + 99 others); Sat, 22 Oct 2022 04:41:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45168 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234307AbiJVIhN (ORCPT ); Sat, 22 Oct 2022 04:37: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 DA4A69184B; Sat, 22 Oct 2022 01: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 dfw.source.kernel.org (Postfix) with ESMTPS id 7F08560AFA; Sat, 22 Oct 2022 08:04:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7EE73C433D6; Sat, 22 Oct 2022 08:04:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425890; bh=5aAshN+FiXLo+cw/dQPsDHOuHlVtKNPBBkoCEdY0WK8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FpiJ4sV/Zvbphf4sIMWJrVGjEAldlGzZdF6pDX/bNVObXwgVOWAep9fGuHkY/HFiR u87naejJD8kwVbV+1JNIYsomwzII2ufCBkrwDe0f6PgTWCMVNvUfpyQbtVdxGXvl96 OnDkXKmS1vyRsmNf4mnjFcQNiD241FdM2ThyumME= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?utf-8?q?Adri=C3=A1n_Larumbe?= , Neil Armstrong , Sasha Levin Subject: [PATCH 5.19 622/717] drm/meson: reorder driver deinit sequence to fix use-after-free bug Date: Sat, 22 Oct 2022 09:28:21 +0200 Message-Id: <20221022072525.962151931@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376601058387068?= X-GMAIL-MSGID: =?utf-8?q?1747376601058387068?= From: Adrián Larumbe [ Upstream commit 31c519981eb141c7ec39bfd5be25d35f02edb868 ] Unloading the driver triggers the following KASAN warning: [ +0.006275] ============================================================= [ +0.000029] BUG: KASAN: use-after-free in __list_del_entry_valid+0xe0/0x1a0 [ +0.000026] Read of size 8 at addr ffff000020c395e0 by task rmmod/2695 [ +0.000019] CPU: 5 PID: 2695 Comm: rmmod Tainted: G C O 5.19.0-rc6-lrmbkasan+ #1 [ +0.000013] Hardware name: Hardkernel ODROID-N2Plus (DT) [ +0.000008] Call trace: [ +0.000007] dump_backtrace+0x1ec/0x280 [ +0.000013] show_stack+0x24/0x80 [ +0.000008] dump_stack_lvl+0x98/0xd4 [ +0.000011] print_address_description.constprop.0+0x80/0x520 [ +0.000011] print_report+0x128/0x260 [ +0.000007] kasan_report+0xb8/0xfc [ +0.000008] __asan_report_load8_noabort+0x3c/0x50 [ +0.000010] __list_del_entry_valid+0xe0/0x1a0 [ +0.000009] drm_atomic_private_obj_fini+0x30/0x200 [drm] [ +0.000172] drm_bridge_detach+0x94/0x260 [drm] [ +0.000145] drm_encoder_cleanup+0xa4/0x290 [drm] [ +0.000144] drm_mode_config_cleanup+0x118/0x740 [drm] [ +0.000143] drm_mode_config_init_release+0x1c/0x2c [drm] [ +0.000144] drm_managed_release+0x170/0x414 [drm] [ +0.000142] drm_dev_put.part.0+0xc0/0x124 [drm] [ +0.000143] drm_dev_put+0x20/0x30 [drm] [ +0.000142] meson_drv_unbind+0x1d8/0x2ac [meson_drm] [ +0.000028] take_down_aggregate_device+0xb0/0x160 [ +0.000016] component_del+0x18c/0x360 [ +0.000009] meson_dw_hdmi_remove+0x28/0x40 [meson_dw_hdmi] [ +0.000015] platform_remove+0x64/0xb0 [ +0.000009] device_remove+0xb8/0x154 [ +0.000009] device_release_driver_internal+0x398/0x5b0 [ +0.000009] driver_detach+0xac/0x1b0 [ +0.000009] bus_remove_driver+0x158/0x29c [ +0.000009] driver_unregister+0x70/0xb0 [ +0.000008] platform_driver_unregister+0x20/0x2c [ +0.000008] meson_dw_hdmi_platform_driver_exit+0x1c/0x30 [meson_dw_hdmi] [ +0.000012] __do_sys_delete_module+0x288/0x400 [ +0.000011] __arm64_sys_delete_module+0x5c/0x80 [ +0.000009] invoke_syscall+0x74/0x260 [ +0.000009] el0_svc_common.constprop.0+0xcc/0x260 [ +0.000009] do_el0_svc+0x50/0x70 [ +0.000007] el0_svc+0x68/0x1a0 [ +0.000012] el0t_64_sync_handler+0x11c/0x150 [ +0.000008] el0t_64_sync+0x18c/0x190 [ +0.000018] Allocated by task 0: [ +0.000007] (stack is not available) [ +0.000011] Freed by task 2695: [ +0.000008] kasan_save_stack+0x2c/0x5c [ +0.000011] kasan_set_track+0x2c/0x40 [ +0.000008] kasan_set_free_info+0x28/0x50 [ +0.000009] ____kasan_slab_free+0x128/0x1d4 [ +0.000008] __kasan_slab_free+0x18/0x24 [ +0.000007] slab_free_freelist_hook+0x108/0x230 [ +0.000011] kfree+0x110/0x35c [ +0.000008] release_nodes+0xf0/0x16c [ +0.000009] devres_release_group+0x180/0x270 [ +0.000008] component_unbind+0x128/0x1e0 [ +0.000010] component_unbind_all+0x1b8/0x264 [ +0.000009] meson_drv_unbind+0x1a0/0x2ac [meson_drm] [ +0.000025] take_down_aggregate_device+0xb0/0x160 [ +0.000009] component_del+0x18c/0x360 [ +0.000009] meson_dw_hdmi_remove+0x28/0x40 [meson_dw_hdmi] [ +0.000012] platform_remove+0x64/0xb0 [ +0.000008] device_remove+0xb8/0x154 [ +0.000009] device_release_driver_internal+0x398/0x5b0 [ +0.000009] driver_detach+0xac/0x1b0 [ +0.000009] bus_remove_driver+0x158/0x29c [ +0.000008] driver_unregister+0x70/0xb0 [ +0.000008] platform_driver_unregister+0x20/0x2c [ +0.000008] meson_dw_hdmi_platform_driver_exit+0x1c/0x30 [meson_dw_hdmi] [ +0.000011] __do_sys_delete_module+0x288/0x400 [ +0.000010] __arm64_sys_delete_module+0x5c/0x80 [ +0.000008] invoke_syscall+0x74/0x260 [ +0.000008] el0_svc_common.constprop.0+0xcc/0x260 [ +0.000008] do_el0_svc+0x50/0x70 [ +0.000007] el0_svc+0x68/0x1a0 [ +0.000009] el0t_64_sync_handler+0x11c/0x150 [ +0.000009] el0t_64_sync+0x18c/0x190 [ +0.000014] The buggy address belongs to the object at ffff000020c39000 which belongs to the cache kmalloc-4k of size 4096 [ +0.000008] The buggy address is located 1504 bytes inside of 4096-byte region [ffff000020c39000, ffff000020c3a000) [ +0.000016] The buggy address belongs to the physical page: [ +0.000009] page:fffffc0000830e00 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x20c38 [ +0.000013] head:fffffc0000830e00 order:3 compound_mapcount:0 compound_pincount:0 [ +0.000008] flags: 0xffff00000010200(slab|head|node=0|zone=0|lastcpupid=0xffff) [ +0.000019] raw: 0ffff00000010200 fffffc0000fd4808 fffffc0000126208 ffff000000002e80 [ +0.000009] raw: 0000000000000000 0000000000020002 00000001ffffffff 0000000000000000 [ +0.000008] page dumped because: kasan: bad access detected [ +0.000011] Memory state around the buggy address: [ +0.000008] ffff000020c39480: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb [ +0.000007] ffff000020c39500: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb [ +0.000007] >ffff000020c39580: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb [ +0.000007] ^ [ +0.000007] ffff000020c39600: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb [ +0.000007] ffff000020c39680: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb [ +0.000006] ================================================================== The reason this is happening is unloading meson-dw-hdmi will cause the component API to take down the aggregate device, which in turn will cause all devres-managed memory to be freed, including the struct dw_hdmi allocated in dw_hdmi_probe. This struct embeds a struct drm_bridge that is added at the end of the function, and which is later on picked up in meson_encoder_hdmi_init. However, when attaching the bridge to the encoder created in meson_encoder_hdmi_init, it's linked to the encoder's bridge chain, from where it never leaves, even after devres_release_group is called when the driver's components are unbound and the embedding structure freed. Then, when calling drm_dev_put in the aggregate driver's unbind function, drm_bridge_detach is called for every single bridge linked to the encoder, including the one whose memory had already been deallocated. Fix by calling component_unbind_all after drm_dev_put. Signed-off-by: Adrián Larumbe Reviewed-by: Neil Armstrong Signed-off-by: Neil Armstrong Link: https://patchwork.freedesktop.org/patch/msgid/20220919010940.419893-2-adrian.larumbe@collabora.com Signed-off-by: Sasha Levin --- drivers/gpu/drm/meson/meson_drv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/meson/meson_drv.c b/drivers/gpu/drm/meson/meson_drv.c index bd4ca11d3ff5..7df149d42728 100644 --- a/drivers/gpu/drm/meson/meson_drv.c +++ b/drivers/gpu/drm/meson/meson_drv.c @@ -388,9 +388,9 @@ static void meson_drv_unbind(struct device *dev) drm_dev_unregister(drm); drm_kms_helper_poll_fini(drm); drm_atomic_helper_shutdown(drm); - component_unbind_all(dev, drm); free_irq(priv->vsync_irq, drm); drm_dev_put(drm); + component_unbind_all(dev, drm); if (priv->afbcd.ops) priv->afbcd.ops->exit(priv); From patchwork Sat Oct 22 07:28:22 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 7677 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1108734wrr; Sat, 22 Oct 2022 01:45:54 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6vXdUbSivCWZUQzuG1SySkkheCVuwFYptlZFn51CY/LVl2iC0ibUVkurp2ogIfIxqU4teU X-Received: by 2002:a17:907:2cf5:b0:78d:f9cc:794a with SMTP id hz21-20020a1709072cf500b0078df9cc794amr18298063ejc.577.1666428354367; Sat, 22 Oct 2022 01:45:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666428354; cv=none; d=google.com; s=arc-20160816; b=Ro/FuoIFdVLh64GnukLnRV7Q1jdkKt9Hf963XljAcuvixv3xWb8sYDw20mPaIPlblv nxB6bFxz0A7WOawW9hiKAow1U7NKMpASKUgqxSdhUKt2yqTcf14sOsS/UsSt+hgJQP4q BW1VhVdwirCG+Q+orA8QS8gW18q4dLDT8F24ms7vQKem4zAKBSbN5xIA22cJXglhuJqu 1CxOu4b/qqNujQIEAWXfKCQc+keeKODnOtQ/1uXbNZk31wR5Ya9AzVNBrAuR0qHbJVsu LMCPTU66MWV3GhjPbOdmwrRbSrRay/Yzhz9jxM6Ohm5LYiofKqcoqE7Jl9LtjK8vyEdn DjEA== 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=G8TwT/qhJK3P8UPb7pRxzGyJzW8U+u/MVCkfmTVfpL4=; b=vWjGA6mRVIW2oSaYgCKjN5ogdaMAJUabHHPM81Qo3Gm2im6nu6NT3SJumA923nJddH J/BteFmBLITjOCrTz5QZoMb+Cein8CKTFrZzQdkKo01gh1q5ToxIb284Stz3IcrHZaHe Yp5yH8f7YIvVEn+IgQfXpkaLYLCBOJZ2jftrrCm3EXO8Uh/4P563RfRvB1mmCdxEpx8A kKocuGFbvR0mPvlqskMXxIvq20O46yR5/XRqVagHNE1qvXe2gQP/tbH2vVM7hrT+ZjBt xRSzGpGpFBH8ruyhREH/DX0HDWQDVVag0jxqjxKvdfK1H+AstsJ6R+Ynm1EkSvhaOVi+ dLrQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=FRMDKbJN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 s5-20020a17090699c500b007a0b28c324esi1500088ejn.1008.2022.10.22.01.45.29; Sat, 22 Oct 2022 01:45: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=FRMDKbJN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S234464AbiJVIlX (ORCPT + 99 others); Sat, 22 Oct 2022 04:41:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54742 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234069AbiJVIgQ (ORCPT ); Sat, 22 Oct 2022 04:36:16 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C49BEBC449; Sat, 22 Oct 2022 01: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 20D2B60B81; Sat, 22 Oct 2022 08:05:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2F088C433C1; Sat, 22 Oct 2022 08:05:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425902; bh=VPX5uY0+vC4kQAyQ2AZ1elDZASWNeRriFOJsrmT6Rtc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FRMDKbJN9xrHKbOEE9VSKinfj7SLydYdLoiUuFUtl3ru3yG0D4EXy6nhqU4g6/8i6 YW4pOWVlE6U0KlmxCABPAqCl9Nk/oQiUYoMnmNFjyGutT37zY2w297bHLIV0wpzgyU ul1ATOStltsp+MIyXCcMLPnDDJ9fTKCIPcdCqbVI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?utf-8?q?Adri=C3=A1n_Larumbe?= , Neil Armstrong , Sasha Levin Subject: [PATCH 5.19 623/717] drm/meson: explicitly remove aggregate driver at module unload time Date: Sat, 22 Oct 2022 09:28:22 +0200 Message-Id: <20221022072526.000992357@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376778202857792?= X-GMAIL-MSGID: =?utf-8?q?1747376778202857792?= From: Adrián Larumbe [ Upstream commit 8616f2a0589a80e08434212324250eb22f6a66ce ] Because component_master_del wasn't being called when unloading the meson_drm module, the aggregate device would linger forever in the global aggregate_devices list. That means when unloading and reloading the meson_dw_hdmi module, component_add would call into try_to_bring_up_aggregate_device and find the unbound meson_drm aggregate device. This would in turn dereference some of the aggregate_device's struct entries which point to memory automatically freed by the devres API when unbinding the aggregate device from meson_drv_unbind, and trigger an use-after-free bug: [ +0.000014] ============================================================= [ +0.000007] BUG: KASAN: use-after-free in find_components+0x468/0x500 [ +0.000017] Read of size 8 at addr ffff000006731688 by task modprobe/2536 [ +0.000018] CPU: 4 PID: 2536 Comm: modprobe Tainted: G C O 5.19.0-rc6-lrmbkasan+ #1 [ +0.000010] Hardware name: Hardkernel ODROID-N2Plus (DT) [ +0.000008] Call trace: [ +0.000005] dump_backtrace+0x1ec/0x280 [ +0.000011] show_stack+0x24/0x80 [ +0.000007] dump_stack_lvl+0x98/0xd4 [ +0.000010] print_address_description.constprop.0+0x80/0x520 [ +0.000011] print_report+0x128/0x260 [ +0.000007] kasan_report+0xb8/0xfc [ +0.000007] __asan_report_load8_noabort+0x3c/0x50 [ +0.000009] find_components+0x468/0x500 [ +0.000008] try_to_bring_up_aggregate_device+0x64/0x390 [ +0.000009] __component_add+0x1dc/0x49c [ +0.000009] component_add+0x20/0x30 [ +0.000008] meson_dw_hdmi_probe+0x28/0x34 [meson_dw_hdmi] [ +0.000013] platform_probe+0xd0/0x220 [ +0.000008] really_probe+0x3ac/0xa80 [ +0.000008] __driver_probe_device+0x1f8/0x400 [ +0.000008] driver_probe_device+0x68/0x1b0 [ +0.000008] __driver_attach+0x20c/0x480 [ +0.000009] bus_for_each_dev+0x114/0x1b0 [ +0.000007] driver_attach+0x48/0x64 [ +0.000009] bus_add_driver+0x390/0x564 [ +0.000007] driver_register+0x1a8/0x3e4 [ +0.000009] __platform_driver_register+0x6c/0x94 [ +0.000007] meson_dw_hdmi_platform_driver_init+0x30/0x1000 [meson_dw_hdmi] [ +0.000014] do_one_initcall+0xc4/0x2b0 [ +0.000008] do_init_module+0x154/0x570 [ +0.000010] load_module+0x1a78/0x1ea4 [ +0.000008] __do_sys_init_module+0x184/0x1cc [ +0.000008] __arm64_sys_init_module+0x78/0xb0 [ +0.000008] invoke_syscall+0x74/0x260 [ +0.000008] el0_svc_common.constprop.0+0xcc/0x260 [ +0.000009] do_el0_svc+0x50/0x70 [ +0.000008] el0_svc+0x68/0x1a0 [ +0.000009] el0t_64_sync_handler+0x11c/0x150 [ +0.000009] el0t_64_sync+0x18c/0x190 [ +0.000014] Allocated by task 902: [ +0.000007] kasan_save_stack+0x2c/0x5c [ +0.000009] __kasan_kmalloc+0x90/0xd0 [ +0.000007] __kmalloc_node+0x240/0x580 [ +0.000010] memcg_alloc_slab_cgroups+0xa4/0x1ac [ +0.000010] memcg_slab_post_alloc_hook+0xbc/0x4c0 [ +0.000008] kmem_cache_alloc_node+0x1d0/0x490 [ +0.000009] __alloc_skb+0x1d4/0x310 [ +0.000010] alloc_skb_with_frags+0x8c/0x620 [ +0.000008] sock_alloc_send_pskb+0x5ac/0x6d0 [ +0.000010] unix_dgram_sendmsg+0x2e0/0x12f0 [ +0.000010] sock_sendmsg+0xcc/0x110 [ +0.000007] sock_write_iter+0x1d0/0x304 [ +0.000008] new_sync_write+0x364/0x460 [ +0.000007] vfs_write+0x420/0x5ac [ +0.000008] ksys_write+0x19c/0x1f0 [ +0.000008] __arm64_sys_write+0x78/0xb0 [ +0.000007] invoke_syscall+0x74/0x260 [ +0.000008] el0_svc_common.constprop.0+0x1a8/0x260 [ +0.000009] do_el0_svc+0x50/0x70 [ +0.000007] el0_svc+0x68/0x1a0 [ +0.000008] el0t_64_sync_handler+0x11c/0x150 [ +0.000008] el0t_64_sync+0x18c/0x190 [ +0.000013] Freed by task 2509: [ +0.000008] kasan_save_stack+0x2c/0x5c [ +0.000007] kasan_set_track+0x2c/0x40 [ +0.000008] kasan_set_free_info+0x28/0x50 [ +0.000008] ____kasan_slab_free+0x128/0x1d4 [ +0.000008] __kasan_slab_free+0x18/0x24 [ +0.000007] slab_free_freelist_hook+0x108/0x230 [ +0.000010] kfree+0x110/0x35c [ +0.000008] release_nodes+0xf0/0x16c [ +0.000008] devres_release_all+0xfc/0x180 [ +0.000008] device_unbind_cleanup+0x24/0x164 [ +0.000008] device_release_driver_internal+0x3e8/0x5b0 [ +0.000010] driver_detach+0xac/0x1b0 [ +0.000008] bus_remove_driver+0x158/0x29c [ +0.000008] driver_unregister+0x70/0xb0 [ +0.000009] platform_driver_unregister+0x20/0x2c [ +0.000007] 0xffff800003722d98 [ +0.000012] __do_sys_delete_module+0x288/0x400 [ +0.000009] __arm64_sys_delete_module+0x5c/0x80 [ +0.000008] invoke_syscall+0x74/0x260 [ +0.000008] el0_svc_common.constprop.0+0xcc/0x260 [ +0.000008] do_el0_svc+0x50/0x70 [ +0.000007] el0_svc+0x68/0x1a0 [ +0.000008] el0t_64_sync_handler+0x11c/0x150 [ +0.000009] el0t_64_sync+0x18c/0x190 [ +0.000013] Last potentially related work creation: [ +0.000007] kasan_save_stack+0x2c/0x5c [ +0.000007] __kasan_record_aux_stack+0xb8/0xf0 [ +0.000009] kasan_record_aux_stack_noalloc+0x14/0x20 [ +0.000008] insert_work+0x54/0x290 [ +0.000009] __queue_work+0x48c/0xd24 [ +0.000008] queue_work_on+0x90/0x11c [ +0.000008] call_usermodehelper_exec+0x188/0x404 [ +0.000010] kobject_uevent_env+0x5a8/0x794 [ +0.000010] kobject_uevent+0x14/0x20 [ +0.000008] driver_register+0x230/0x3e4 [ +0.000009] __platform_driver_register+0x6c/0x94 [ +0.000007] gxbb_driver_init+0x28/0x34 [ +0.000010] do_one_initcall+0xc4/0x2b0 [ +0.000008] do_initcalls+0x20c/0x24c [ +0.000010] kernel_init_freeable+0x22c/0x278 [ +0.000009] kernel_init+0x3c/0x170 [ +0.000008] ret_from_fork+0x10/0x20 [ +0.000013] The buggy address belongs to the object at ffff000006731600 which belongs to the cache kmalloc-256 of size 256 [ +0.000009] The buggy address is located 136 bytes inside of 256-byte region [ffff000006731600, ffff000006731700) [ +0.000015] The buggy address belongs to the physical page: [ +0.000008] page:fffffc000019cc00 refcount:1 mapcount:0 mapping:0000000000000000 index:0xffff000006730a00 pfn:0x6730 [ +0.000011] head:fffffc000019cc00 order:2 compound_mapcount:0 compound_pincount:0 [ +0.000008] flags: 0xffff00000010200(slab|head|node=0|zone=0|lastcpupid=0xffff) [ +0.000016] raw: 0ffff00000010200 fffffc00000c3d08 fffffc0000ef2b08 ffff000000002680 [ +0.000009] raw: ffff000006730a00 0000000000150014 00000001ffffffff 0000000000000000 [ +0.000006] page dumped because: kasan: bad access detected [ +0.000011] Memory state around the buggy address: [ +0.000007] ffff000006731580: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc [ +0.000007] ffff000006731600: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb [ +0.000007] >ffff000006731680: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb [ +0.000007] ^ [ +0.000006] ffff000006731700: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc [ +0.000007] ffff000006731780: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc [ +0.000006] ================================================================== Fix by adding 'remove' driver callback for meson-drm, and explicitly deleting the aggregate device. Signed-off-by: Adrián Larumbe Reviewed-by: Neil Armstrong Signed-off-by: Neil Armstrong Link: https://patchwork.freedesktop.org/patch/msgid/20220919010940.419893-3-adrian.larumbe@collabora.com Signed-off-by: Sasha Levin --- drivers/gpu/drm/meson/meson_drv.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/gpu/drm/meson/meson_drv.c b/drivers/gpu/drm/meson/meson_drv.c index 7df149d42728..8444d90165fb 100644 --- a/drivers/gpu/drm/meson/meson_drv.c +++ b/drivers/gpu/drm/meson/meson_drv.c @@ -493,6 +493,13 @@ static int meson_drv_probe(struct platform_device *pdev) return 0; }; +static int meson_drv_remove(struct platform_device *pdev) +{ + component_master_del(&pdev->dev, &meson_drv_master_ops); + + return 0; +} + static struct meson_drm_match_data meson_drm_gxbb_data = { .compat = VPU_COMPATIBLE_GXBB, }; @@ -530,6 +537,7 @@ static const struct dev_pm_ops meson_drv_pm_ops = { static struct platform_driver meson_drm_platform_driver = { .probe = meson_drv_probe, + .remove = meson_drv_remove, .shutdown = meson_drv_shutdown, .driver = { .name = "meson-drm", From patchwork Sat Oct 22 07:28: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: 7655 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1107976wrr; Sat, 22 Oct 2022 01:42:46 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5vl/P5x65DwiP0jz3XO7WMlvD1KCa4+/eP2YyJEtTiVCRm8WhNsjPdNuftvY2fFTS8bPew X-Received: by 2002:a05:6402:496:b0:443:a5f5:d3b with SMTP id k22-20020a056402049600b00443a5f50d3bmr21915817edv.331.1666428166608; Sat, 22 Oct 2022 01:42:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666428166; cv=none; d=google.com; s=arc-20160816; b=tqcWEoztflU2kQiDIGd4AI4LYiSyEVMkFjmfJ4hLBsfjz7Hxrovz91zbk7h5sduRxx MbrxlBc/QCrhRYxpx0W1DedkARGl3PNU9FvGIU51eidS4tgIpwkv/oHoMvMnr6gVXZhN ojXMPTPQTNn6IzyT09115iB2swJKnl+ca448U3WdXGo87tzYFEcVOHO6snytfkGzwyhv u9RqPEl3Yv4nGOlbdjobzTUwDst2aa/cYGw5WEuRGOJi4Q+GLW6dxz1+IVcACF6JgSmi pinqXDK7p+97F1KX3Kqlt6AZeVnSeX6IIHR5HcjsY0zMY4SQAHfnJ7GswV/rapi+wFbG Fa8g== 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=dDIegEUXXvJnWR90mMR7/6o8tTBVXp2yk2wzCePJJgg=; b=bUd+uQnszV5f+BbyTqH/YZIVq9IHx73GcTreQ3TbX+GP3ryxVfXH1BuR26KtQSKAhJ H+DXnMgXJFtpDkhTiwJ9MTqmSl23LSFA5YGL9ZqiATdeEwDJ8XcdnhJyZ0xFoqTsjEch 2cvOLI9MQA/LerWaCEDZiEXJVy4DwttQUtSrwuBGT2km8I9spm27+NB3bN0fbOhAfC8o WnAO0Ocos6tyq1DxPjS2d7kTwALI6/W4yMtjtCcX8+UgjdRBL4baZfuiJGUYzvbMIQbA QAnpdFhnt7c8ENY2j2T4YVgp26IYtGAjDe17HMUV8rwpUnE65ooB+o/9TQnkJfA+UzPQ qeyg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Hk3EUBVm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 m7-20020a056402510700b0045935adb5b1si24764427edd.395.2022.10.22.01.42.22; Sat, 22 Oct 2022 01:42: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=Hk3EUBVm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S234504AbiJVIla (ORCPT + 99 others); Sat, 22 Oct 2022 04:41:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54942 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234181AbiJVIgW (ORCPT ); Sat, 22 Oct 2022 04:36:22 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2535DCABD5; Sat, 22 Oct 2022 01:05: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 68E8160ADF; Sat, 22 Oct 2022 08:05:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 419BAC433D6; Sat, 22 Oct 2022 08:05:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425905; bh=yQMzmi3/xHCBOzJ1cZr79veCLv7Gm5AMH6ZpJQs9X10=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Hk3EUBVmDwp9qlV3fsqaz2I8MWSVary71Kk9/LvpMwMalvOAD0XwLSefxhSbXitwK no9FpAN2KAEJQYma5B6ceD3sD/vcJxrevXT3Ka8HDWhWNTTcQ/zMhxYWKI2mAN+4Pp S2mORJGe5eq1v+6akF7ZXSlAbqX+/a4CjZJKdT7U= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?utf-8?q?Adri=C3=A1n_Larumbe?= , Neil Armstrong , Sasha Levin Subject: [PATCH 5.19 624/717] drm/meson: remove drm bridges at aggregate driver unbind time Date: Sat, 22 Oct 2022 09:28:23 +0200 Message-Id: <20221022072526.050296514@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376581218190970?= X-GMAIL-MSGID: =?utf-8?q?1747376581218190970?= From: Adrián Larumbe [ Upstream commit 09847723c12fc2753749cec3939a02ee92dac468 ] drm bridges added by meson_encoder_hdmi_init and meson_encoder_cvbs_init were not manually removed at module unload time, which caused dangling references to freed memory to remain linked in the global bridge_list. When loading the driver modules back in, the same functions would again call drm_bridge_add, and when traversing the global bridge_list, would end up peeking into freed memory. Once again KASAN revealed the problem: [ +0.000095] ============================================================= [ +0.000008] BUG: KASAN: use-after-free in __list_add_valid+0x9c/0x120 [ +0.000018] Read of size 8 at addr ffff00003da291f0 by task modprobe/2483 [ +0.000018] CPU: 3 PID: 2483 Comm: modprobe Tainted: G C O 5.19.0-rc6-lrmbkasan+ #1 [ +0.000011] Hardware name: Hardkernel ODROID-N2Plus (DT) [ +0.000008] Call trace: [ +0.000006] dump_backtrace+0x1ec/0x280 [ +0.000012] show_stack+0x24/0x80 [ +0.000008] dump_stack_lvl+0x98/0xd4 [ +0.000011] print_address_description.constprop.0+0x80/0x520 [ +0.000011] print_report+0x128/0x260 [ +0.000008] kasan_report+0xb8/0xfc [ +0.000008] __asan_report_load8_noabort+0x3c/0x50 [ +0.000009] __list_add_valid+0x9c/0x120 [ +0.000009] drm_bridge_add+0x6c/0x104 [drm] [ +0.000165] dw_hdmi_probe+0x1900/0x2360 [dw_hdmi] [ +0.000022] meson_dw_hdmi_bind+0x520/0x814 [meson_dw_hdmi] [ +0.000014] component_bind+0x174/0x520 [ +0.000012] component_bind_all+0x1a8/0x38c [ +0.000010] meson_drv_bind_master+0x5e8/0xb74 [meson_drm] [ +0.000032] meson_drv_bind+0x20/0x2c [meson_drm] [ +0.000027] try_to_bring_up_aggregate_device+0x19c/0x390 [ +0.000010] component_master_add_with_match+0x1c8/0x284 [ +0.000009] meson_drv_probe+0x274/0x280 [meson_drm] [ +0.000026] platform_probe+0xd0/0x220 [ +0.000009] really_probe+0x3ac/0xa80 [ +0.000009] __driver_probe_device+0x1f8/0x400 [ +0.000009] driver_probe_device+0x68/0x1b0 [ +0.000009] __driver_attach+0x20c/0x480 [ +0.000008] bus_for_each_dev+0x114/0x1b0 [ +0.000009] driver_attach+0x48/0x64 [ +0.000008] bus_add_driver+0x390/0x564 [ +0.000009] driver_register+0x1a8/0x3e4 [ +0.000009] __platform_driver_register+0x6c/0x94 [ +0.000008] meson_drm_platform_driver_init+0x3c/0x1000 [meson_drm] [ +0.000027] do_one_initcall+0xc4/0x2b0 [ +0.000011] do_init_module+0x154/0x570 [ +0.000011] load_module+0x1a78/0x1ea4 [ +0.000008] __do_sys_init_module+0x184/0x1cc [ +0.000009] __arm64_sys_init_module+0x78/0xb0 [ +0.000009] invoke_syscall+0x74/0x260 [ +0.000009] el0_svc_common.constprop.0+0xcc/0x260 [ +0.000008] do_el0_svc+0x50/0x70 [ +0.000007] el0_svc+0x68/0x1a0 [ +0.000012] el0t_64_sync_handler+0x11c/0x150 [ +0.000008] el0t_64_sync+0x18c/0x190 [ +0.000016] Allocated by task 879: [ +0.000008] kasan_save_stack+0x2c/0x5c [ +0.000011] __kasan_kmalloc+0x90/0xd0 [ +0.000007] __kmalloc+0x278/0x4a0 [ +0.000011] mpi_resize+0x13c/0x1d0 [ +0.000011] mpi_powm+0xd24/0x1570 [ +0.000009] rsa_enc+0x1a4/0x30c [ +0.000009] pkcs1pad_verify+0x3f0/0x580 [ +0.000009] public_key_verify_signature+0x7a8/0xba4 [ +0.000010] public_key_verify_signature_2+0x40/0x60 [ +0.000008] verify_signature+0xb4/0x114 [ +0.000008] pkcs7_validate_trust_one.constprop.0+0x3b8/0x574 [ +0.000009] pkcs7_validate_trust+0xb8/0x15c [ +0.000008] verify_pkcs7_message_sig+0xec/0x1b0 [ +0.000012] verify_pkcs7_signature+0x78/0xac [ +0.000007] mod_verify_sig+0x110/0x190 [ +0.000009] module_sig_check+0x114/0x1e0 [ +0.000009] load_module+0xa0/0x1ea4 [ +0.000008] __do_sys_init_module+0x184/0x1cc [ +0.000008] __arm64_sys_init_module+0x78/0xb0 [ +0.000008] invoke_syscall+0x74/0x260 [ +0.000009] el0_svc_common.constprop.0+0x1a8/0x260 [ +0.000008] do_el0_svc+0x50/0x70 [ +0.000007] el0_svc+0x68/0x1a0 [ +0.000009] el0t_64_sync_handler+0x11c/0x150 [ +0.000009] el0t_64_sync+0x18c/0x190 [ +0.000013] Freed by task 2422: [ +0.000008] kasan_save_stack+0x2c/0x5c [ +0.000009] kasan_set_track+0x2c/0x40 [ +0.000007] kasan_set_free_info+0x28/0x50 [ +0.000009] ____kasan_slab_free+0x128/0x1d4 [ +0.000008] __kasan_slab_free+0x18/0x24 [ +0.000007] slab_free_freelist_hook+0x108/0x230 [ +0.000010] kfree+0x110/0x35c [ +0.000008] release_nodes+0xf0/0x16c [ +0.000009] devres_release_group+0x180/0x270 [ +0.000008] take_down_aggregate_device+0xcc/0x160 [ +0.000010] component_del+0x18c/0x360 [ +0.000009] meson_dw_hdmi_remove+0x28/0x40 [meson_dw_hdmi] [ +0.000013] platform_remove+0x64/0xb0 [ +0.000008] device_remove+0xb8/0x154 [ +0.000009] device_release_driver_internal+0x398/0x5b0 [ +0.000009] driver_detach+0xac/0x1b0 [ +0.000009] bus_remove_driver+0x158/0x29c [ +0.000008] driver_unregister+0x70/0xb0 [ +0.000009] platform_driver_unregister+0x20/0x2c [ +0.000007] meson_dw_hdmi_platform_driver_exit+0x1c/0x30 [meson_dw_hdmi] [ +0.000012] __do_sys_delete_module+0x288/0x400 [ +0.000009] __arm64_sys_delete_module+0x5c/0x80 [ +0.000009] invoke_syscall+0x74/0x260 [ +0.000008] el0_svc_common.constprop.0+0xcc/0x260 [ +0.000008] do_el0_svc+0x50/0x70 [ +0.000007] el0_svc+0x68/0x1a0 [ +0.000008] el0t_64_sync_handler+0x11c/0x150 [ +0.000009] el0t_64_sync+0x18c/0x190 [ +0.000013] The buggy address belongs to the object at ffff00003da29000 which belongs to the cache kmalloc-1k of size 1024 [ +0.000008] The buggy address is located 496 bytes inside of 1024-byte region [ffff00003da29000, ffff00003da29400) [ +0.000015] The buggy address belongs to the physical page: [ +0.000009] page:fffffc0000f68a00 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x3da28 [ +0.000012] head:fffffc0000f68a00 order:3 compound_mapcount:0 compound_pincount:0 [ +0.000009] flags: 0xffff00000010200(slab|head|node=0|zone=0|lastcpupid=0xffff) [ +0.000019] raw: 0ffff00000010200 fffffc0000eb5c08 fffffc0000d96608 ffff000000002a80 [ +0.000008] raw: 0000000000000000 00000000000a000a 00000001ffffffff 0000000000000000 [ +0.000008] page dumped because: kasan: bad access detected [ +0.000011] Memory state around the buggy address: [ +0.000009] ffff00003da29080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb [ +0.000007] ffff00003da29100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb [ +0.000007] >ffff00003da29180: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb [ +0.000007] ^ [ +0.000008] ffff00003da29200: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb [ +0.000006] ffff00003da29280: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb [ +0.000007] ================================================================== Fix by keeping track of which encoders were initialised in the meson_drm structure and manually removing their bridges at aggregate driver's unbind time. Signed-off-by: Adrián Larumbe Reviewed-by: Neil Armstrong Signed-off-by: Neil Armstrong Link: https://patchwork.freedesktop.org/patch/msgid/20220920222842.1053234-1-adrian.larumbe@collabora.com Signed-off-by: Sasha Levin --- drivers/gpu/drm/meson/meson_drv.c | 4 ++++ drivers/gpu/drm/meson/meson_drv.h | 7 +++++++ drivers/gpu/drm/meson/meson_encoder_cvbs.c | 13 +++++++++++++ drivers/gpu/drm/meson/meson_encoder_cvbs.h | 1 + drivers/gpu/drm/meson/meson_encoder_hdmi.c | 13 +++++++++++++ drivers/gpu/drm/meson/meson_encoder_hdmi.h | 1 + 6 files changed, 39 insertions(+) diff --git a/drivers/gpu/drm/meson/meson_drv.c b/drivers/gpu/drm/meson/meson_drv.c index 8444d90165fb..86b90d0f5780 100644 --- a/drivers/gpu/drm/meson/meson_drv.c +++ b/drivers/gpu/drm/meson/meson_drv.c @@ -390,6 +390,10 @@ static void meson_drv_unbind(struct device *dev) drm_atomic_helper_shutdown(drm); free_irq(priv->vsync_irq, drm); drm_dev_put(drm); + + meson_encoder_hdmi_remove(priv); + meson_encoder_cvbs_remove(priv); + component_unbind_all(dev, drm); if (priv->afbcd.ops) diff --git a/drivers/gpu/drm/meson/meson_drv.h b/drivers/gpu/drm/meson/meson_drv.h index 177dac3ca3be..c62ee358456f 100644 --- a/drivers/gpu/drm/meson/meson_drv.h +++ b/drivers/gpu/drm/meson/meson_drv.h @@ -25,6 +25,12 @@ enum vpu_compatible { VPU_COMPATIBLE_G12A = 3, }; +enum { + MESON_ENC_CVBS = 0, + MESON_ENC_HDMI, + MESON_ENC_LAST, +}; + struct meson_drm_match_data { enum vpu_compatible compat; struct meson_afbcd_ops *afbcd_ops; @@ -51,6 +57,7 @@ struct meson_drm { struct drm_crtc *crtc; struct drm_plane *primary_plane; struct drm_plane *overlay_plane; + void *encoders[MESON_ENC_LAST]; const struct meson_drm_soc_limits *limits; diff --git a/drivers/gpu/drm/meson/meson_encoder_cvbs.c b/drivers/gpu/drm/meson/meson_encoder_cvbs.c index 8110a6e39320..5675bc2a92cf 100644 --- a/drivers/gpu/drm/meson/meson_encoder_cvbs.c +++ b/drivers/gpu/drm/meson/meson_encoder_cvbs.c @@ -281,5 +281,18 @@ int meson_encoder_cvbs_init(struct meson_drm *priv) } drm_connector_attach_encoder(connector, &meson_encoder_cvbs->encoder); + priv->encoders[MESON_ENC_CVBS] = meson_encoder_cvbs; + return 0; } + +void meson_encoder_cvbs_remove(struct meson_drm *priv) +{ + struct meson_encoder_cvbs *meson_encoder_cvbs; + + if (priv->encoders[MESON_ENC_CVBS]) { + meson_encoder_cvbs = priv->encoders[MESON_ENC_CVBS]; + drm_bridge_remove(&meson_encoder_cvbs->bridge); + drm_bridge_remove(meson_encoder_cvbs->next_bridge); + } +} diff --git a/drivers/gpu/drm/meson/meson_encoder_cvbs.h b/drivers/gpu/drm/meson/meson_encoder_cvbs.h index 61d9d183ce7f..09710fec3c66 100644 --- a/drivers/gpu/drm/meson/meson_encoder_cvbs.h +++ b/drivers/gpu/drm/meson/meson_encoder_cvbs.h @@ -25,5 +25,6 @@ struct meson_cvbs_mode { extern struct meson_cvbs_mode meson_cvbs_modes[MESON_CVBS_MODES_COUNT]; int meson_encoder_cvbs_init(struct meson_drm *priv); +void meson_encoder_cvbs_remove(struct meson_drm *priv); #endif /* __MESON_VENC_CVBS_H */ diff --git a/drivers/gpu/drm/meson/meson_encoder_hdmi.c b/drivers/gpu/drm/meson/meson_encoder_hdmi.c index a7692584487c..af6025037ecc 100644 --- a/drivers/gpu/drm/meson/meson_encoder_hdmi.c +++ b/drivers/gpu/drm/meson/meson_encoder_hdmi.c @@ -446,6 +446,8 @@ int meson_encoder_hdmi_init(struct meson_drm *priv) meson_encoder_hdmi->cec_notifier = notifier; } + priv->encoders[MESON_ENC_HDMI] = meson_encoder_hdmi; + dev_dbg(priv->dev, "HDMI encoder initialized\n"); return 0; @@ -454,3 +456,14 @@ int meson_encoder_hdmi_init(struct meson_drm *priv) of_node_put(remote); return ret; } + +void meson_encoder_hdmi_remove(struct meson_drm *priv) +{ + struct meson_encoder_hdmi *meson_encoder_hdmi; + + if (priv->encoders[MESON_ENC_HDMI]) { + meson_encoder_hdmi = priv->encoders[MESON_ENC_HDMI]; + drm_bridge_remove(&meson_encoder_hdmi->bridge); + drm_bridge_remove(meson_encoder_hdmi->next_bridge); + } +} diff --git a/drivers/gpu/drm/meson/meson_encoder_hdmi.h b/drivers/gpu/drm/meson/meson_encoder_hdmi.h index ed19494f0956..a6cd38eb5f71 100644 --- a/drivers/gpu/drm/meson/meson_encoder_hdmi.h +++ b/drivers/gpu/drm/meson/meson_encoder_hdmi.h @@ -8,5 +8,6 @@ #define __MESON_ENCODER_HDMI_H int meson_encoder_hdmi_init(struct meson_drm *priv); +void meson_encoder_hdmi_remove(struct meson_drm *priv); #endif /* __MESON_ENCODER_HDMI_H */ From patchwork Sat Oct 22 07:28: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: 7672 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1108313wrr; Sat, 22 Oct 2022 01:44:20 -0700 (PDT) X-Google-Smtp-Source: AMsMyM67LVHwwtPMiYWjwkbWgdX88y1cNs2Sm392ZmteWTkc6NlxT0KV2jivSWFMLpxTlNxsmp0+ X-Received: by 2002:a50:fe85:0:b0:458:5562:bf1e with SMTP id d5-20020a50fe85000000b004585562bf1emr21002518edt.167.1666428260775; Sat, 22 Oct 2022 01:44:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666428260; cv=none; d=google.com; s=arc-20160816; b=a0B9Do7KTwlbotIwTHiAjSEZAaKETIG1Ju3sgvTyAncXK/eV2hbTwFlh7TSGzITnhk B5l9EV527kF0ST0TW0sHdFw+lZN1IgwTshQbK0PzmIhW/rSSX39ye5HpJHsygspc6BzM PGCxz+astRwOnV+qweX8eA4uGNxKtm0zOG5jGZV7YB6BxOqXx50SALfklvsxX2xOrV9e 6hGHbXqziDUVDiENkoOBn0hffGa5nrNCEzvYJ8XxM0RakOxOR48Mux5hmyRFyuyMwutP kQIoJsxyf3PDmD5bpUNWLI78kbKImen38lqkWy31Ug5aYqvbk5wo3VGD9QhuOZk2H2xO iULw== 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=t9iHjmrIaXOkUWC5Tr+UIpzncU5OqM+/tIexRDddLFE=; b=bPETzlLcQe1thDC1oAWr2OBsQ2B0gCpsiK4HDy6rNWz+jA/7IHPUfpNsIW20oSjWmu mqSZzTcYlA+wE5qFLxmjHGcsonaoLoyBPvnEefUbkD2aWa/AQDfHOrCA4OI+IElsITWh mswZVdpkLTI1EO5G3H4kWOVMS29Z/EkaQAlNWtSNyajVNO6j8WFQLapHYpB2cHB5D9GF dyq1NBiu7jPc+O8YqNCQOy2XHSW5juNZ23gTZV/EAD+Ay0f0BQJytiOxbSaF+SCTuQIX mDn/NoIzn2JEMuMF4fAduYKSXccG/VoFUzz5zaYSxeydBjpL9SULTlrwzYwSWCdOYV6/ Drsg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=OjxV7obM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 b11-20020a0564021f0b00b0045bf23171d5si21498965edb.165.2022.10.22.01.43.56; Sat, 22 Oct 2022 01: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=OjxV7obM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S234488AbiJVInG (ORCPT + 99 others); Sat, 22 Oct 2022 04:43:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41534 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234457AbiJVIlV (ORCPT ); Sat, 22 Oct 2022 04:41:21 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4AB3F2E8D8A; Sat, 22 Oct 2022 01:06: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 ams.source.kernel.org (Postfix) with ESMTPS id E4E3DB82E1B; Sat, 22 Oct 2022 08:05:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0C9BDC433D6; Sat, 22 Oct 2022 08:05:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425909; bh=nHlhI1QWXEppbMON++/kcW8SsBgmXCnr015giDmAqlE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OjxV7obM45MpqvLCGzwJNG+Z0GMH0wAG0yFITe6jJ+LVZUtYA0W4SRCzEOSvS3NYw ZFUcrXkL1qmpd3fdfgM59J2NtI1NJufCn0kLvdVVTnsAPm6Rs1eMlfY44biUMqdQN3 enx3hZIY0iaKNq4cHFArLRJ+Sla65Qozve10fNJ4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Imre Deak , Jani Nikula , Or Cochvi , Khaled Almahallawy , Sasha Levin Subject: [PATCH 5.19 625/717] drm/dp: Dont rewrite link config when setting phy test pattern Date: Sat, 22 Oct 2022 09:28:24 +0200 Message-Id: <20221022072526.098026922@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376679550469789?= X-GMAIL-MSGID: =?utf-8?q?1747376679550469789?= From: Khaled Almahallawy [ Upstream commit 7b4d8db657192066bc6f1f6635d348413dac1e18 ] The sequence for Source DP PHY CTS automation is [2][1]: 1- Emulate successful Link Training(LT) 2- Short HPD and change link rates and number of lanes by LT. (This is same flow for Link Layer CTS) 3- Short HPD and change PHY test pattern and swing/pre-emphasis levels (This step should not trigger LT) The problem is with DP PHY compliance setup as follow: [DPTX + on board LTTPR]------Main Link--->[Scope] ^ | | | | | ----------Aux Ch------>[Aux Emulator] At step 3, before writing TRAINING_LANEx_SET/LINK_QUAL_PATTERN_SET to declare the pattern/swing requested by scope, we write link config in LINK_BW_SET/LANE_COUNT_SET on a port that has LTTPR. As LTTPR snoops aux transaction, LINK_BW_SET/LANE_COUNT_SET writes indicate a LT will start [Check DP 2.0 E11 -Sec 3.6.8.2 & 3.6.8.6.3], and LTTPR will reset the link and stop sending DP signals to DPTX/Scope causing the measurements to fail. Note that step 3 will not trigger LT and DP link will never recovered by the Aux Emulator/Scope. The reset of link can be tested with a monitor connected to LTTPR port simply by writing to LINK_BW_SET or LANE_COUNT_SET as follow igt/tools/dpcd_reg write --offset=0x100 --value 0x14 --device=2 OR printf '\x14' | sudo dd of=/dev/drm_dp_aux2 bs=1 count=1 conv=notrunc seek=$((0x100)) This single aux write causes the screen to blank, sending short HPD to DPTX, setting LINK_STATUS_UPDATE = 1 in DPCD 0x204, and triggering LT. As stated in [1]: "Before any TX electrical testing can be performed, the link between a DPTX and DPRX (in this case, a piece of test equipment), including all LTTPRs within the path, shall be trained as defined in this Standard." In addition, changing Phy pattern/Swing/Pre-emphasis (Step 3) uses the same link rate and lane count applied on step 2, so no need to redo LT. The fix is to not rewrite link config in step 3, and just writes TRAINING_LANEx_SET and LINK_QUAL_PATTERN_SET [1]: DP 2.0 E11 - 3.6.11.1 LTTPR DPTX_PHY Electrical Compliance [2]: Configuring UnigrafDPTC Controller - Automation Test Sequence https://www.keysight.com/us/en/assets/9922-01244/help-files/ D9040DPPC-DisplayPort-Test-Software-Online-Help-latest.chm Cc: Imre Deak Cc: Jani Nikula Cc: Or Cochvi Signed-off-by: Khaled Almahallawy Signed-off-by: Jani Nikula Link: https://patchwork.freedesktop.org/patch/msgid/20220916054900.415804-1-khaled.almahallawy@intel.com Signed-off-by: Sasha Levin --- drivers/gpu/drm/display/drm_dp_helper.c | 9 --------- 1 file changed, 9 deletions(-) diff --git a/drivers/gpu/drm/display/drm_dp_helper.c b/drivers/gpu/drm/display/drm_dp_helper.c index e7c22c2ca90c..f27cd710bc86 100644 --- a/drivers/gpu/drm/display/drm_dp_helper.c +++ b/drivers/gpu/drm/display/drm_dp_helper.c @@ -2636,17 +2636,8 @@ int drm_dp_set_phy_test_pattern(struct drm_dp_aux *aux, struct drm_dp_phy_test_params *data, u8 dp_rev) { int err, i; - u8 link_config[2]; u8 test_pattern; - link_config[0] = drm_dp_link_rate_to_bw_code(data->link_rate); - link_config[1] = data->num_lanes; - if (data->enhanced_frame_cap) - link_config[1] |= DP_LANE_COUNT_ENHANCED_FRAME_EN; - err = drm_dp_dpcd_write(aux, DP_LINK_BW_SET, link_config, 2); - if (err < 0) - return err; - test_pattern = data->phy_pattern; if (dp_rev < 0x12) { test_pattern = (test_pattern << 2) & From patchwork Sat Oct 22 07:28: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: 7660 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1108082wrr; Sat, 22 Oct 2022 01:43:15 -0700 (PDT) X-Google-Smtp-Source: AMsMyM55yVIEJ5qP+Z3fcO58F74V9QMK9XqS6Tj7b//hCvMIaJQGJLznAZ+pqXa5J2Hv+LtTUieH X-Received: by 2002:a05:6402:c07:b0:461:87ab:78aa with SMTP id co7-20020a0564020c0700b0046187ab78aamr703607edb.258.1666428195163; Sat, 22 Oct 2022 01:43:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666428195; cv=none; d=google.com; s=arc-20160816; b=j+V0BlC2hRVOVVRa1ocgIRBG9JjS3Cs+gCo53ftuljUJJPr+BYTUzeHKB2+YEoK4bc pNfg9HEgFWqAeHdFj/37JEKYqjS5hg3Qb4qmy9SLGdsO3FpP6+8K1ise+HMrXoeC9r5R JLJ05n7F3xGg/Nat2rxN1fhMHA8/OxPdOwZpV8Hlfji8qdvNvLEnYrDJvBzjldIRN/Ro JAsAwIOeajgEIP8Ib1fctFisYgastBlS0b4bNFQaeUKYSAQiy61fSpW82Tlu/45wmRJP mXbPYp7SNu9e+0NipeNO9lXdp1U1ZxAWUru+BiYJ5fwaqWINQYBZFvQqAaZg3jAQ3Wfb tkQQ== 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=2n8qMQ0QAlcfYnRUhOgGCmM8FbJNRc7VJxJqdkY3Mnw=; b=RyMYvBOmqgc/xp8F3ErM8loYR3dxOaB9X9mwTm5+YL2yo6J+cVTTuol+PbwTZv4JEv QWVQQWIQ88Rtu6QAhidXbQzxs5iXNNc1FtfTipb/QOaqf9aw6jBJq+Vsissm2J8o3Bq5 PtZKWeVdQH0lj6jjqpzhdfDj7Qzbt6BzO/XKBcWqDNqzuJ7ie0D1QvnUIj3wlkTnBhpb 2//vnnFty2i5JTY1l9NzSPFFUmzXDJ00WgpXKrp4qGAsEPUI2L3Bdn3L120rhaGRuVdD kYHETJUKwyPK0KjNeTexdVFPi4tAsaDJu6FaBjzW4WmzyEpvRBqluHZyMiTfqXCMpTo2 /BzA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=1x2YLjia; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 i12-20020a05640242cc00b0045bccc84cebsi26316993edc.71.2022.10.22.01.42.43; Sat, 22 Oct 2022 01:43: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=1x2YLjia; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S234653AbiJVIl6 (ORCPT + 99 others); Sat, 22 Oct 2022 04:41:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54020 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234371AbiJVIhh (ORCPT ); Sat, 22 Oct 2022 04:37:37 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BDE4315A8DC; Sat, 22 Oct 2022 01:05: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 D538560B40; Sat, 22 Oct 2022 08:05:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E99B0C433D7; Sat, 22 Oct 2022 08:05:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425913; bh=KHeH/veQXK9e9vaTszK2hpVy92B/G+tiu9lNn5UDWDA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1x2YLjiaDaQcR4jRS5zOmmSktwE8XpRe1VjTKqiobw6r6ITTImuvwzi7A8Tky3X6E AmCHL01KKLROP2q+ZxaPwttijWrjDUDJY9fPJq8zNnl7/1je8ZQW6RHcUYhPH8M323 ou+aJuNu7IP4ZSqgNR7ofjqPknmtVb0HlEraWsE8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jaehyun Chung , Jasdeep Dhillon , Aric Cyr , Daniel Wheeler , Alex Deucher , Sasha Levin Subject: [PATCH 5.19 626/717] drm/amd/display: Remove interface for periodic interrupt 1 Date: Sat, 22 Oct 2022 09:28:25 +0200 Message-Id: <20221022072526.146536060@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376611148701548?= X-GMAIL-MSGID: =?utf-8?q?1747376611148701548?= From: Aric Cyr [ Upstream commit 97d8d6f075bd8f988589be02b91f6fa644d0b0b8 ] [why] Only a single VLINE interrupt is available so interface should not expose the second one which is used by DMU firmware. [how] Remove references to periodic_interrupt1 and VLINE1 from DC interfaces. Reviewed-by: Jaehyun Chung Acked-by: Jasdeep Dhillon Signed-off-by: Aric Cyr Tested-by: Daniel Wheeler Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin --- drivers/gpu/drm/amd/display/dc/core/dc.c | 16 +++------ drivers/gpu/drm/amd/display/dc/dc_stream.h | 6 ++-- .../amd/display/dc/dcn10/dcn10_hw_sequencer.c | 35 ++++++------------- .../amd/display/dc/dcn10/dcn10_hw_sequencer.h | 3 +- .../gpu/drm/amd/display/dc/inc/hw_sequencer.h | 8 +---- 5 files changed, 18 insertions(+), 50 deletions(-) diff --git a/drivers/gpu/drm/amd/display/dc/core/dc.c b/drivers/gpu/drm/amd/display/dc/core/dc.c index 9dbd965d8afb..6ca29b887fce 100644 --- a/drivers/gpu/drm/amd/display/dc/core/dc.c +++ b/drivers/gpu/drm/amd/display/dc/core/dc.c @@ -2632,11 +2632,8 @@ static void copy_stream_update_to_stream(struct dc *dc, if (update->abm_level) stream->abm_level = *update->abm_level; - if (update->periodic_interrupt0) - stream->periodic_interrupt0 = *update->periodic_interrupt0; - - if (update->periodic_interrupt1) - stream->periodic_interrupt1 = *update->periodic_interrupt1; + if (update->periodic_interrupt) + stream->periodic_interrupt = *update->periodic_interrupt; if (update->gamut_remap) stream->gamut_remap_matrix = *update->gamut_remap; @@ -2723,13 +2720,8 @@ static void commit_planes_do_stream_update(struct dc *dc, if (!pipe_ctx->top_pipe && !pipe_ctx->prev_odm_pipe && pipe_ctx->stream == stream) { - if (stream_update->periodic_interrupt0 && - dc->hwss.setup_periodic_interrupt) - dc->hwss.setup_periodic_interrupt(dc, pipe_ctx, VLINE0); - - if (stream_update->periodic_interrupt1 && - dc->hwss.setup_periodic_interrupt) - dc->hwss.setup_periodic_interrupt(dc, pipe_ctx, VLINE1); + if (stream_update->periodic_interrupt && dc->hwss.setup_periodic_interrupt) + dc->hwss.setup_periodic_interrupt(dc, pipe_ctx); if ((stream_update->hdr_static_metadata && !stream->use_dynamic_meta) || stream_update->vrr_infopacket || diff --git a/drivers/gpu/drm/amd/display/dc/dc_stream.h b/drivers/gpu/drm/amd/display/dc/dc_stream.h index 58941f4defb3..a7f319d404a1 100644 --- a/drivers/gpu/drm/amd/display/dc/dc_stream.h +++ b/drivers/gpu/drm/amd/display/dc/dc_stream.h @@ -200,8 +200,7 @@ struct dc_stream_state { /* DMCU info */ unsigned int abm_level; - struct periodic_interrupt_config periodic_interrupt0; - struct periodic_interrupt_config periodic_interrupt1; + struct periodic_interrupt_config periodic_interrupt; /* from core_stream struct */ struct dc_context *ctx; @@ -268,8 +267,7 @@ struct dc_stream_update { struct dc_info_packet *hdr_static_metadata; unsigned int *abm_level; - struct periodic_interrupt_config *periodic_interrupt0; - struct periodic_interrupt_config *periodic_interrupt1; + struct periodic_interrupt_config *periodic_interrupt; struct dc_info_packet *vrr_infopacket; struct dc_info_packet *vsc_infopacket; diff --git a/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c b/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c index d9ab27991535..33c87e53b6a3 100644 --- a/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c +++ b/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c @@ -3623,7 +3623,7 @@ void dcn10_calc_vupdate_position( { const struct dc_crtc_timing *dc_crtc_timing = &pipe_ctx->stream->timing; int vline_int_offset_from_vupdate = - pipe_ctx->stream->periodic_interrupt0.lines_offset; + pipe_ctx->stream->periodic_interrupt.lines_offset; int vupdate_offset_from_vsync = dc->hwss.get_vupdate_offset_from_vsync(pipe_ctx); int start_position; @@ -3648,18 +3648,10 @@ void dcn10_calc_vupdate_position( static void dcn10_cal_vline_position( struct dc *dc, struct pipe_ctx *pipe_ctx, - enum vline_select vline, uint32_t *start_line, uint32_t *end_line) { - enum vertical_interrupt_ref_point ref_point = INVALID_POINT; - - if (vline == VLINE0) - ref_point = pipe_ctx->stream->periodic_interrupt0.ref_point; - else if (vline == VLINE1) - ref_point = pipe_ctx->stream->periodic_interrupt1.ref_point; - - switch (ref_point) { + switch (pipe_ctx->stream->periodic_interrupt.ref_point) { case START_V_UPDATE: dcn10_calc_vupdate_position( dc, @@ -3668,7 +3660,9 @@ static void dcn10_cal_vline_position( end_line); break; case START_V_SYNC: - // Suppose to do nothing because vsync is 0; + // vsync is line 0 so start_line is just the requested line offset + *start_line = pipe_ctx->stream->periodic_interrupt.lines_offset; + *end_line = *start_line + 2; break; default: ASSERT(0); @@ -3678,24 +3672,15 @@ static void dcn10_cal_vline_position( void dcn10_setup_periodic_interrupt( struct dc *dc, - struct pipe_ctx *pipe_ctx, - enum vline_select vline) + struct pipe_ctx *pipe_ctx) { struct timing_generator *tg = pipe_ctx->stream_res.tg; + uint32_t start_line = 0; + uint32_t end_line = 0; - if (vline == VLINE0) { - uint32_t start_line = 0; - uint32_t end_line = 0; + dcn10_cal_vline_position(dc, pipe_ctx, &start_line, &end_line); - dcn10_cal_vline_position(dc, pipe_ctx, vline, &start_line, &end_line); - - tg->funcs->setup_vertical_interrupt0(tg, start_line, end_line); - - } else if (vline == VLINE1) { - pipe_ctx->stream_res.tg->funcs->setup_vertical_interrupt1( - tg, - pipe_ctx->stream->periodic_interrupt1.lines_offset); - } + tg->funcs->setup_vertical_interrupt0(tg, start_line, end_line); } void dcn10_setup_vupdate_interrupt(struct dc *dc, struct pipe_ctx *pipe_ctx) diff --git a/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.h b/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.h index 9ae07c77fdc0..0ef7bf7ddb75 100644 --- a/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.h +++ b/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.h @@ -175,8 +175,7 @@ void dcn10_set_cursor_attribute(struct pipe_ctx *pipe_ctx); void dcn10_set_cursor_sdr_white_level(struct pipe_ctx *pipe_ctx); void dcn10_setup_periodic_interrupt( struct dc *dc, - struct pipe_ctx *pipe_ctx, - enum vline_select vline); + struct pipe_ctx *pipe_ctx); enum dc_status dcn10_set_clock(struct dc *dc, enum dc_clock_type clock_type, uint32_t clk_khz, diff --git a/drivers/gpu/drm/amd/display/dc/inc/hw_sequencer.h b/drivers/gpu/drm/amd/display/dc/inc/hw_sequencer.h index 05053f3b4ab7..21a9eedec092 100644 --- a/drivers/gpu/drm/amd/display/dc/inc/hw_sequencer.h +++ b/drivers/gpu/drm/amd/display/dc/inc/hw_sequencer.h @@ -32,11 +32,6 @@ #include "inc/hw/link_encoder.h" #include "core_status.h" -enum vline_select { - VLINE0, - VLINE1 -}; - struct pipe_ctx; struct dc_state; struct dc_stream_status; @@ -116,8 +111,7 @@ struct hw_sequencer_funcs { int group_index, int group_size, struct pipe_ctx *grouped_pipes[]); void (*setup_periodic_interrupt)(struct dc *dc, - struct pipe_ctx *pipe_ctx, - enum vline_select vline); + struct pipe_ctx *pipe_ctx); void (*set_drr)(struct pipe_ctx **pipe_ctx, int num_pipes, struct dc_crtc_timing_adjust adjust); void (*set_static_screen_control)(struct pipe_ctx **pipe_ctx, From patchwork Sat Oct 22 07:28: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: 7674 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1108726wrr; Sat, 22 Oct 2022 01:45:53 -0700 (PDT) X-Google-Smtp-Source: AMsMyM483iSqGl6TkzJ0nrqziECMI7ohvY+bne/yfm0U1b8Uum7V8Gx3tIYXcyzaairbjjxHbIa+ X-Received: by 2002:a05:6402:f96:b0:459:4180:6cf4 with SMTP id eh22-20020a0564020f9600b0045941806cf4mr21261463edb.64.1666428353570; Sat, 22 Oct 2022 01:45:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666428353; cv=none; d=google.com; s=arc-20160816; b=NTK/Wd0Rd2Hv7qVvM9na04yV6QDkcVjySORAPZhIRU8aq6iUrHgD54/ZFVjaWl4ehJ J6/1gmiloph7Nq+l1A0HVGlS8vmsgj5fmIkRrQMwit0n0YHtjhf55XG23rLybgppcnsa 1hqa7mEN39u9n0CAPWOXAGKEhp0XlNzMulrQ7hkCPe/3Fvr8BoIQzhvauLUTRDnWeGFw akeJPRz5NCU2y1Jh+5mLZucTUA/tLpO+WDLIphHfy+14SmZHJoKmHXOzkLecAfH6Xp91 zSAdneOjjIOohsyro2gTOYEBuIU2IDmu6RGfUC3/s1fxdWn8Rgv066OWhQudQKZ/BUmD H/Fg== 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=ASw7rQcgGchXNtvOPeuTpiqU2jtJjAeTsM/B4BbCHE4=; b=UEwu3xmhjmru9iV5ztrxaK1mhEPtEEA+mNWxe9fygIuesWVH8JK2REcLvF3PYzMCR5 2GJL/Jevjl9eH6p1+MMd8D62+XBmW5jU4EBkviSHuAxNFmPg5hcw63b8hr62zDfSh9n3 q3sUo0X+fjoYtlARZURqEw8n7pYLiLrHMt+VFAgLOi0/bBp/GqAsgrCvXdlH14S9s5gs KFXF4Q8y7KiCF2CbhS52xd0y2ftodqBsW9B2NslsGbGi6U5AZwznVaJ3QSBdRQdkVAF6 +F7Jnn/oEkYYkEM0btqyfi/xZvPzt4qoKBhnDTpaSmdPEwfXnVdZISetSathgJ1wDKbp D8fg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=cCT65868; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 v3-20020a170906338300b0078e1206d934si20150419eja.162.2022.10.22.01.45.26; Sat, 22 Oct 2022 01:45: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=cCT65868; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S234589AbiJVInK (ORCPT + 99 others); Sat, 22 Oct 2022 04:43:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52220 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234490AbiJVIlY (ORCPT ); Sat, 22 Oct 2022 04:41: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 B2812B87BA; Sat, 22 Oct 2022 01:06: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 80506B82E40; Sat, 22 Oct 2022 08:05:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9784BC433C1; Sat, 22 Oct 2022 08:05:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425916; bh=Ol+2Xj2+b+tySJ+C/RyQP4TaRR4MLjLtzXy+zmFgurg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cCT65868Lai2MZbtICuL4+IJnFd4m43CI011rSupSJAdZ26KCSuVNg280se7rwUYd t6xXa3hPm932ZcEVT7eys0Dah6td550RgUhGomHP7by+YQGt/b5SoaFVhKIHmUvzxN 1a8n3YJ2KPWC8j4qiQFM2vI/XmvT/b2YsZeSXGVY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ariel Bernstein , Jasdeep Dhillon , Wenjing Liu , Daniel Wheeler , Alex Deucher , Sasha Levin Subject: [PATCH 5.19 627/717] drm/amd/display: polling vid stream status in hpo dp blank Date: Sat, 22 Oct 2022 09:28:26 +0200 Message-Id: <20221022072526.194343496@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376777446042863?= X-GMAIL-MSGID: =?utf-8?q?1747376777446042863?= From: Wenjing Liu [ Upstream commit e32df0c7ecead95d70ca89f39b1b2b02a59ff691 ] [why] vid stream control is double bufferred, if we don't wait for video stream enable set to 0, we may get temporary image corruption showing on the stream when setting PIXEL_TO_SYMBOL_FIFO_ENABLE to 0. Reviewed-by: Ariel Bernstein Acked-by: Jasdeep Dhillon Signed-off-by: Wenjing Liu Tested-by: Daniel Wheeler Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin --- .../drm/amd/display/dc/dcn31/dcn31_hpo_dp_stream_encoder.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/amd/display/dc/dcn31/dcn31_hpo_dp_stream_encoder.c b/drivers/gpu/drm/amd/display/dc/dcn31/dcn31_hpo_dp_stream_encoder.c index 23621ff08c90..52fb2bf3d578 100644 --- a/drivers/gpu/drm/amd/display/dc/dcn31/dcn31_hpo_dp_stream_encoder.c +++ b/drivers/gpu/drm/amd/display/dc/dcn31/dcn31_hpo_dp_stream_encoder.c @@ -150,9 +150,9 @@ static void dcn31_hpo_dp_stream_enc_dp_blank( * 10us*5000=50ms. This covers 41.7ms of minimum 24 Hz mode + * a little more because we may not trust delay accuracy. */ - //REG_WAIT(DP_SYM32_ENC_VID_STREAM_CONTROL, - // VID_STREAM_STATUS, 0, - // 10, 5000); + REG_WAIT(DP_SYM32_ENC_VID_STREAM_CONTROL, + VID_STREAM_STATUS, 0, + 10, 5000); /* Disable SDP tranmission */ REG_UPDATE(DP_SYM32_ENC_SDP_CONTROL, From patchwork Sat Oct 22 07:28: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: 7679 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1108770wrr; Sat, 22 Oct 2022 01:45:59 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5jyiZO5KYUG6h0cRQdET8Wzxl5eL6v0Y34QeXhO3curUZDw/tXa6/m3Yw9+XJn5zJL5EaD X-Received: by 2002:a05:6402:50d4:b0:45d:fe2:45 with SMTP id h20-20020a05640250d400b0045d0fe20045mr21825282edb.221.1666428359733; Sat, 22 Oct 2022 01:45:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666428359; cv=none; d=google.com; s=arc-20160816; b=XMV/j7MIBVuVyjrutZ8bkhmM5EUG77InHqfFEhxhTBC8xrzSsxpY2wf/XBQDL7xt86 k8aLEI81MDa+DiIBN0m21NdwPsfdwCVhSQ4Zdp3ZzuRYr4xjzzT+cjA83gDjSiFM9TEr sQi5snRyO9B2UOzEeerAbNxGxaXSojKwZQAEfXA+NFhT1CWXgWHaQufqEH3fUfVgnYtp uhH9PhyQbqB0Xf3TeupakhypGA7o+R826Jc94i1CBvAZ5VhwDuMYGPgcTa1c3flxQpAw fICps7lew9P2V6hJSZ2h3qcQE5SHVM2PPbEsPc+RqpzY0DfwnIsjjsGF99hGLitfMHgR NU6A== 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=uHhcwSPdlBDaocEN6zt5HXT7/z4E6ddhR0NhFRFVQO8=; b=AleCk0ytoi9nLdKlg+zUoYC4dmuCA074TmO95YLrlozAiPTudHN87by3A1LzOPoK2E UcBqdf5xRETKRVn4gqSxTKeAVknjHZi33fLKEauzqKGYI5gK1jmA3dif2YvvImpdQNSc PcsTT0C/3Cfd7yOxj3FYc7HIhW5wlJz70isJD/QuojWj+vNjuWXNM9TwxY5DKxxuGM2i hNYYxrnDi7BCyzGMTp/RvsXvH7W7+dXbifY1LX1QKWwhLG2PVk/PWm2WZ6Y3c+09FY8r L9lvvcvvyHLPVTfKm3gO6uwb3zItq8qSSsAiD/9wqA36lmUAgW6m/jwR+0cs0j0Xs93x Ug8Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=SeHrdDuw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 g8-20020a170906538800b0073dbc331a40si18619965ejo.188.2022.10.22.01.45.35; Sat, 22 Oct 2022 01:45: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=SeHrdDuw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S234854AbiJVInt (ORCPT + 99 others); Sat, 22 Oct 2022 04:43:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52928 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234758AbiJVImi (ORCPT ); Sat, 22 Oct 2022 04:42: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 C24902E8D8B; Sat, 22 Oct 2022 01:06: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 5A2FBB82E13; Sat, 22 Oct 2022 08:05:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B630AC433D6; Sat, 22 Oct 2022 08:05:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425919; bh=k1aIw9YxKECaGaO2jmbXqWliP/zH74AICWyaTZxJlzY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SeHrdDuwZaQBDX6YjEHvPj32brHotlhPh/knXgM7Z2jVGigQrNig2Y7gBr0E/dVhG b0fcbVB9klOKnGjlLhJSv0yh0IpNoVMzytWwNzjv2kitdlpqunODbjAs4rqUDNJEz1 lI91QbfCXcXfudiAMzJFGYR+YP7XeXJOs32p3aQA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ellis Michael , Felix Kuehling , Graham Sider , Alex Deucher , Sasha Levin Subject: [PATCH 5.19 628/717] drm/amdkfd: Fix UBSAN shift-out-of-bounds warning Date: Sat, 22 Oct 2022 09:28:27 +0200 Message-Id: <20221022072526.233866903@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376784176195295?= X-GMAIL-MSGID: =?utf-8?q?1747376784176195295?= From: Felix Kuehling [ Upstream commit b292cafe2dd02d96a07147e4b160927e8399d5cc ] This was fixed in initialize_cpsch before, but not in initialize_nocpsch. Factor sdma bitmap initialization into a helper function to apply the correct implementation in both cases without duplicating it. v2: Added a range check Reported-by: Ellis Michael Signed-off-by: Felix Kuehling Reviewed-by: Graham Sider Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin --- .../drm/amd/amdkfd/kfd_device_queue_manager.c | 45 +++++++++---------- 1 file changed, 21 insertions(+), 24 deletions(-) diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c b/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c index e1797657b04c..7d3fc5849466 100644 --- a/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c +++ b/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c @@ -1232,6 +1232,24 @@ static void init_interrupts(struct device_queue_manager *dqm) dqm->dev->kfd2kgd->init_interrupts(dqm->dev->adev, i); } +static void init_sdma_bitmaps(struct device_queue_manager *dqm) +{ + unsigned int num_sdma_queues = + min_t(unsigned int, sizeof(dqm->sdma_bitmap)*8, + get_num_sdma_queues(dqm)); + unsigned int num_xgmi_sdma_queues = + min_t(unsigned int, sizeof(dqm->xgmi_sdma_bitmap)*8, + get_num_xgmi_sdma_queues(dqm)); + + if (num_sdma_queues) + dqm->sdma_bitmap = GENMASK_ULL(num_sdma_queues-1, 0); + if (num_xgmi_sdma_queues) + dqm->xgmi_sdma_bitmap = GENMASK_ULL(num_xgmi_sdma_queues-1, 0); + + dqm->sdma_bitmap &= ~get_reserved_sdma_queues_bitmap(dqm); + pr_info("sdma_bitmap: %llx\n", dqm->sdma_bitmap); +} + static int initialize_nocpsch(struct device_queue_manager *dqm) { int pipe, queue; @@ -1260,11 +1278,7 @@ static int initialize_nocpsch(struct device_queue_manager *dqm) memset(dqm->vmid_pasid, 0, sizeof(dqm->vmid_pasid)); - dqm->sdma_bitmap = ~0ULL >> (64 - get_num_sdma_queues(dqm)); - dqm->sdma_bitmap &= ~(get_reserved_sdma_queues_bitmap(dqm)); - pr_info("sdma_bitmap: %llx\n", dqm->sdma_bitmap); - - dqm->xgmi_sdma_bitmap = ~0ULL >> (64 - get_num_xgmi_sdma_queues(dqm)); + init_sdma_bitmaps(dqm); return 0; } @@ -1442,9 +1456,6 @@ static int set_sched_resources(struct device_queue_manager *dqm) static int initialize_cpsch(struct device_queue_manager *dqm) { - uint64_t num_sdma_queues; - uint64_t num_xgmi_sdma_queues; - pr_debug("num of pipes: %d\n", get_pipes_per_mec(dqm)); mutex_init(&dqm->lock_hidden); @@ -1453,24 +1464,10 @@ static int initialize_cpsch(struct device_queue_manager *dqm) dqm->active_cp_queue_count = 0; dqm->gws_queue_count = 0; dqm->active_runlist = false; - - num_sdma_queues = get_num_sdma_queues(dqm); - if (num_sdma_queues >= BITS_PER_TYPE(dqm->sdma_bitmap)) - dqm->sdma_bitmap = ULLONG_MAX; - else - dqm->sdma_bitmap = (BIT_ULL(num_sdma_queues) - 1); - - dqm->sdma_bitmap &= ~(get_reserved_sdma_queues_bitmap(dqm)); - pr_info("sdma_bitmap: %llx\n", dqm->sdma_bitmap); - - num_xgmi_sdma_queues = get_num_xgmi_sdma_queues(dqm); - if (num_xgmi_sdma_queues >= BITS_PER_TYPE(dqm->xgmi_sdma_bitmap)) - dqm->xgmi_sdma_bitmap = ULLONG_MAX; - else - dqm->xgmi_sdma_bitmap = (BIT_ULL(num_xgmi_sdma_queues) - 1); - INIT_WORK(&dqm->hw_exception_work, kfd_process_hw_exception); + init_sdma_bitmaps(dqm); + return 0; } From patchwork Sat Oct 22 07:28: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: 7661 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1108097wrr; Sat, 22 Oct 2022 01:43:19 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7aEQODsAwn+rK/0Ld3S8ZhKwrSZu2S0iBlPSmCBEXP5Zr6FhzoPFLLD93uq881i0vc4Vyi X-Received: by 2002:a17:906:3e01:b0:781:6462:700f with SMTP id k1-20020a1709063e0100b007816462700fmr19328664eji.307.1666428199128; Sat, 22 Oct 2022 01:43:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666428199; cv=none; d=google.com; s=arc-20160816; b=zTA3EN3PU7EYdqUoSAJfEIJ3Ugt3OWn8YqGBSnAezhiokXpd72+LFXDKnCEkgT2Kso a6z/zT/uvkXA4gIb2docBpB4cy0uw6cM7VOEEEg1SpS6j00Ab+SX4zjubBqq8yB6jMnA te4aWH+0FPDpgQ0b6E7ZJgMmLwZlvXOqL1VP0EflmkR6/ujP0BoNxnuyiTZwPMYmITZa o4rVoOK41SNQAZQNwwYsjKJEeylznxFoNLjC3FE8HhzVFOFKG80eN6mRN15v6rFBWxxD dMSJFdBnf6/aMgc8VMmI7vx5HKXosJr+GrsjPx+D8fCHaKnkA2j1scihqimYsNScg7n0 w62g== 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=JKN+X0V6f7CHHPhjfxydipXH6VFofT/0PExwpPI+6L0=; b=sT8iV0zxY2He82MtqCXgmJhQCb2xeTORDkfAV+ufoW3Hg4gDilJ8V3a3D4ubhGfQfh PqEvsBO/dcyb/EvyVc6yzeJlJPCOwnQpFicAXrB7DX8jd0SaJc/C9C4VkMZeXZtblQAV te5niXvmLIX2UEyBPxTePU3yklABEjrv+p/C7s531h/uL2lh3hmwFN06FVIXx9KAJkw+ GiHtxmr70S0AnLYUFa1gdN/Z+g/cDpWOoWwABAPW4423/QiYmRYxX+W3VP2t6h5FlT4z UQq29be9/FUDun83t+7JAscWxLeABjEe8ZxcdTaRN6UbgpIkgTA9dhGFB1lXfvgbb42j 038g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=HgQXBwoq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 qk32-20020a1709077fa000b0078dfd359c52si15092222ejc.602.2022.10.22.01.42.48; Sat, 22 Oct 2022 01:43: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=HgQXBwoq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S234667AbiJVImO (ORCPT + 99 others); Sat, 22 Oct 2022 04:42:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41534 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234616AbiJVIjV (ORCPT ); Sat, 22 Oct 2022 04:39:21 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 596951BA1E6; Sat, 22 Oct 2022 01:05: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 62C83B82E09; Sat, 22 Oct 2022 08:03:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 90A62C433D6; Sat, 22 Oct 2022 08:03:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425826; bh=4ee12yKSQ/35Nz7CmDVqwURep8FFoi1o/s/f03kHQTA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HgQXBwoqYSCsMCvVFc81vWPnt1HjUbzb+GrmJ4QUZvgE2XV5+vPdN4fbLZgZVU3hS qQFElGHlKWBDasLqHzr48LkstZum0661AhUMFumTrO67XJ97i10bqmU+wwYJB/EX5q +z5646dnScLdx6mXUA3FeMwJ6pfN17qbrLQVREjw= 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 5.19 629/717] ARM: dts: imx6: delete interrupts property if interrupts-extended is set Date: Sat, 22 Oct 2022 09:28:28 +0200 Message-Id: <20221022072526.269028018@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376615141404064?= X-GMAIL-MSGID: =?utf-8?q?1747376615141404064?= From: Alexander Stein [ Upstream commit c9d38ff7080b2c4fa6786b82210fa13115895aae ] In most cases this is related to fsl,err006687-workaround-present, which requires a GPIO interrupt next a GIC interrupt. This fixes the dtbs_check warning: imx6dl-mba6a.dtb: ethernet@2188000: More than one condition true in oneOf schema: {'$filename': 'Documentation/devicetree/bindings/net/fsl,fec.yaml', [...] Signed-off-by: Alexander Stein Signed-off-by: Shawn Guo Signed-off-by: Sasha Levin --- arch/arm/boot/dts/imx6dl-riotboard.dts | 1 + arch/arm/boot/dts/imx6q-arm2.dts | 1 + arch/arm/boot/dts/imx6q-evi.dts | 1 + arch/arm/boot/dts/imx6q-mccmon6.dts | 1 + arch/arm/boot/dts/imx6qdl-nit6xlite.dtsi | 1 + arch/arm/boot/dts/imx6qdl-nitrogen6_max.dtsi | 1 + arch/arm/boot/dts/imx6qdl-nitrogen6_som2.dtsi | 1 + arch/arm/boot/dts/imx6qdl-nitrogen6x.dtsi | 1 + arch/arm/boot/dts/imx6qdl-sabreauto.dtsi | 1 + arch/arm/boot/dts/imx6qdl-tqma6a.dtsi | 1 + arch/arm/boot/dts/imx6qdl-ts7970.dtsi | 1 + 11 files changed, 11 insertions(+) diff --git a/arch/arm/boot/dts/imx6dl-riotboard.dts b/arch/arm/boot/dts/imx6dl-riotboard.dts index e7d9bfbfd0e4..e7be05f205d3 100644 --- a/arch/arm/boot/dts/imx6dl-riotboard.dts +++ b/arch/arm/boot/dts/imx6dl-riotboard.dts @@ -90,6 +90,7 @@ pinctrl-0 = <&pinctrl_enet>; phy-mode = "rgmii-id"; phy-handle = <&rgmii_phy>; + /delete-property/ interrupts; interrupts-extended = <&gpio1 6 IRQ_TYPE_LEVEL_HIGH>, <&intc 0 119 IRQ_TYPE_LEVEL_HIGH>; fsl,err006687-workaround-present; diff --git a/arch/arm/boot/dts/imx6q-arm2.dts b/arch/arm/boot/dts/imx6q-arm2.dts index 0b40f52268b3..75586299d9ca 100644 --- a/arch/arm/boot/dts/imx6q-arm2.dts +++ b/arch/arm/boot/dts/imx6q-arm2.dts @@ -178,6 +178,7 @@ pinctrl-names = "default"; pinctrl-0 = <&pinctrl_enet>; phy-mode = "rgmii"; + /delete-property/ interrupts; interrupts-extended = <&gpio1 6 IRQ_TYPE_LEVEL_HIGH>, <&intc 0 119 IRQ_TYPE_LEVEL_HIGH>; fsl,err006687-workaround-present; diff --git a/arch/arm/boot/dts/imx6q-evi.dts b/arch/arm/boot/dts/imx6q-evi.dts index c63f371ede8b..78d941fef5df 100644 --- a/arch/arm/boot/dts/imx6q-evi.dts +++ b/arch/arm/boot/dts/imx6q-evi.dts @@ -146,6 +146,7 @@ pinctrl-0 = <&pinctrl_enet>; phy-mode = "rgmii"; phy-reset-gpios = <&gpio1 25 GPIO_ACTIVE_LOW>; + /delete-property/ interrupts; interrupts-extended = <&gpio1 6 IRQ_TYPE_LEVEL_HIGH>, <&intc 0 119 IRQ_TYPE_LEVEL_HIGH>; fsl,err006687-workaround-present; diff --git a/arch/arm/boot/dts/imx6q-mccmon6.dts b/arch/arm/boot/dts/imx6q-mccmon6.dts index 55692c73943d..64ab01018b71 100644 --- a/arch/arm/boot/dts/imx6q-mccmon6.dts +++ b/arch/arm/boot/dts/imx6q-mccmon6.dts @@ -100,6 +100,7 @@ pinctrl-0 = <&pinctrl_enet>; phy-mode = "rgmii"; phy-reset-gpios = <&gpio1 27 GPIO_ACTIVE_LOW>; + /delete-property/ interrupts; interrupts-extended = <&gpio1 6 IRQ_TYPE_LEVEL_HIGH>, <&intc 0 119 IRQ_TYPE_LEVEL_HIGH>; status = "okay"; diff --git a/arch/arm/boot/dts/imx6qdl-nit6xlite.dtsi b/arch/arm/boot/dts/imx6qdl-nit6xlite.dtsi index 0ad4cb4f1e82..a53a5d0766a5 100644 --- a/arch/arm/boot/dts/imx6qdl-nit6xlite.dtsi +++ b/arch/arm/boot/dts/imx6qdl-nit6xlite.dtsi @@ -192,6 +192,7 @@ phy-mode = "rgmii"; phy-handle = <ðphy>; phy-reset-gpios = <&gpio1 27 GPIO_ACTIVE_LOW>; + /delete-property/ interrupts; interrupts-extended = <&gpio1 6 IRQ_TYPE_LEVEL_HIGH>, <&intc 0 119 IRQ_TYPE_LEVEL_HIGH>; fsl,err006687-workaround-present; diff --git a/arch/arm/boot/dts/imx6qdl-nitrogen6_max.dtsi b/arch/arm/boot/dts/imx6qdl-nitrogen6_max.dtsi index beaa2dcd436c..57c21a01f126 100644 --- a/arch/arm/boot/dts/imx6qdl-nitrogen6_max.dtsi +++ b/arch/arm/boot/dts/imx6qdl-nitrogen6_max.dtsi @@ -334,6 +334,7 @@ phy-mode = "rgmii"; phy-handle = <ðphy>; phy-reset-gpios = <&gpio1 27 GPIO_ACTIVE_LOW>; + /delete-property/ interrupts; interrupts-extended = <&gpio1 6 IRQ_TYPE_LEVEL_HIGH>, <&intc 0 119 IRQ_TYPE_LEVEL_HIGH>; fsl,err006687-workaround-present; diff --git a/arch/arm/boot/dts/imx6qdl-nitrogen6_som2.dtsi b/arch/arm/boot/dts/imx6qdl-nitrogen6_som2.dtsi index ee7e2371f94b..000e9dc97b1a 100644 --- a/arch/arm/boot/dts/imx6qdl-nitrogen6_som2.dtsi +++ b/arch/arm/boot/dts/imx6qdl-nitrogen6_som2.dtsi @@ -263,6 +263,7 @@ pinctrl-names = "default"; pinctrl-0 = <&pinctrl_enet>; phy-mode = "rgmii"; + /delete-property/ interrupts; interrupts-extended = <&gpio1 6 IRQ_TYPE_LEVEL_HIGH>, <&intc 0 119 IRQ_TYPE_LEVEL_HIGH>; fsl,err006687-workaround-present; diff --git a/arch/arm/boot/dts/imx6qdl-nitrogen6x.dtsi b/arch/arm/boot/dts/imx6qdl-nitrogen6x.dtsi index 904d5d051d63..731759bdd7f5 100644 --- a/arch/arm/boot/dts/imx6qdl-nitrogen6x.dtsi +++ b/arch/arm/boot/dts/imx6qdl-nitrogen6x.dtsi @@ -267,6 +267,7 @@ phy-mode = "rgmii"; phy-handle = <ðphy>; phy-reset-gpios = <&gpio1 27 GPIO_ACTIVE_LOW>; + /delete-property/ interrupts; interrupts-extended = <&gpio1 6 IRQ_TYPE_LEVEL_HIGH>, <&intc 0 119 IRQ_TYPE_LEVEL_HIGH>; fsl,err006687-workaround-present; diff --git a/arch/arm/boot/dts/imx6qdl-sabreauto.dtsi b/arch/arm/boot/dts/imx6qdl-sabreauto.dtsi index 1368a4762037..3dbb460ef102 100644 --- a/arch/arm/boot/dts/imx6qdl-sabreauto.dtsi +++ b/arch/arm/boot/dts/imx6qdl-sabreauto.dtsi @@ -295,6 +295,7 @@ pinctrl-names = "default"; pinctrl-0 = <&pinctrl_enet>; phy-mode = "rgmii-id"; + /delete-property/ interrupts; interrupts-extended = <&gpio1 6 IRQ_TYPE_LEVEL_HIGH>, <&intc 0 119 IRQ_TYPE_LEVEL_HIGH>; fsl,err006687-workaround-present; diff --git a/arch/arm/boot/dts/imx6qdl-tqma6a.dtsi b/arch/arm/boot/dts/imx6qdl-tqma6a.dtsi index 7dc3f0005b0f..0a36e1bce375 100644 --- a/arch/arm/boot/dts/imx6qdl-tqma6a.dtsi +++ b/arch/arm/boot/dts/imx6qdl-tqma6a.dtsi @@ -7,6 +7,7 @@ #include &fec { + /delete-property/ interrupts; interrupts-extended = <&gpio1 6 IRQ_TYPE_LEVEL_HIGH>, <&intc 0 119 IRQ_TYPE_LEVEL_HIGH>; fsl,err006687-workaround-present; diff --git a/arch/arm/boot/dts/imx6qdl-ts7970.dtsi b/arch/arm/boot/dts/imx6qdl-ts7970.dtsi index d6ba4b2a60f6..c096d25a6f5b 100644 --- a/arch/arm/boot/dts/imx6qdl-ts7970.dtsi +++ b/arch/arm/boot/dts/imx6qdl-ts7970.dtsi @@ -192,6 +192,7 @@ pinctrl-names = "default"; pinctrl-0 = <&pinctrl_enet>; phy-mode = "rgmii"; + /delete-property/ interrupts; interrupts-extended = <&gpio1 6 IRQ_TYPE_LEVEL_HIGH>, <&intc 0 119 IRQ_TYPE_LEVEL_HIGH>; fsl,err006687-workaround-present; From patchwork Sat Oct 22 07:28: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: 7700 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1109326wrr; Sat, 22 Oct 2022 01:48:05 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4bw+7vOFi3gwunIHZHB1g/UdGoT0kHspHgApUaVEaUulTGiTHpAnV8FyGu302riDGK+bzw X-Received: by 2002:a17:906:6a8d:b0:741:6a3b:536e with SMTP id p13-20020a1709066a8d00b007416a3b536emr19745903ejr.11.1666428485266; Sat, 22 Oct 2022 01:48:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666428485; cv=none; d=google.com; s=arc-20160816; b=Wa4VflCxFLiyYDq7MsxNzQFoUzmR5ei+/RP6hDYMlcGGiI5ES+pb6byKl3JbzpICe4 FxSwtl/uboaV5e9Khpmr1Vo8APDtWFpGQ7hzdT3gtrdQGHOc4Zq6kN+CnMmfQTcfs8Xt /Y+IHxSCHedCpujfWZ1GjSiNspZAYKeT3aCM6qO6xhQf8iXCI5nocqtnG/WODXRpST+F RjhNPYk3MWAp0DkdQENUUzmnwp/SWRi53OvnCwLGZV1jQ850Mgr1tyikNPsY/ZBsPka4 ngyImDEd8YxnVZRQgpk0tZK3iNWpe8ELMH9+zmbdik6izTOA+Y2mHUxjbIwlCRG8cR0w fjrg== 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=maJ1kE83y3vFUOoNuWEPZO7i6ifiutMTuh7az7+yGpY=; b=ezArEFqpHky+OixUBl/hFkT0VpJj1sIBHp+FkLC2MPpmwIhhpYq0vuiRcXVBotOd7W cxP2uRfu67PkI5invEXsK0EeRMtV0Yckvuow4xPVXN3kLFjcvXw6dvgbJI1RgAc3x4uR fho/ylyVLqJ1/tUcq+qPPndiVt21TN9tSeWXGtll1Yzf1tqUeAcWif3kwjs4xU9qS5AR B8Dx3ogo31Df8ewjM8TRtxj5cj2sWRRMdJErzsQ0EpuIW8slcEXJDXI5RX89jkzq+M/1 ddCrBtCNrHlO8DCJz3YS3s4KwTppeNPCbeI7k0hsF74sR3zeu0sHZuRe7f47/KxEztqY Uv+g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=HCcAEu0M; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 ga29-20020a1709070c1d00b0078d43ae07e1si24055780ejc.649.2022.10.22.01.47.41; Sat, 22 Oct 2022 01:48: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=HCcAEu0M; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S234300AbiJVIrL (ORCPT + 99 others); Sat, 22 Oct 2022 04:47:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42658 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235163AbiJVIor (ORCPT ); Sat, 22 Oct 2022 04:44: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 5D8042CB8ED; Sat, 22 Oct 2022 01: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 ams.source.kernel.org (Postfix) with ESMTPS id 55466B82E07; Sat, 22 Oct 2022 08:03:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A2C53C433D6; Sat, 22 Oct 2022 08:03:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425829; bh=j17G9n8n5cw424st9/lYCBhpD1u/9YWJsXZaGfWD4Hg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HCcAEu0MVARuLX9RXm/Sjbn7taGmpGceM8qewHQE4EbNZNU5mcXH6gJdPJxGFDBzs oQntuoe+H0e3cQVbrOa3q0e2xZ0wwqZwmbpakYpqdnpiH4YFhGCSLhUdXYyZ90KZyN f1DF/z1Rfsq9GOc5ZFVPUGIB77FMauR8PSBBzAyU= 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 5.19 630/717] ARM: dts: imx7d-sdb: config the max pressure for tsc2046 Date: Sat, 22 Oct 2022 09:28:29 +0200 Message-Id: <20221022072526.318983956@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376915573596591?= X-GMAIL-MSGID: =?utf-8?q?1747376915573596591?= 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 f053f5122741..0fe0a2f5e433 100644 --- a/arch/arm/boot/dts/imx7d-sdb.dts +++ b/arch/arm/boot/dts/imx7d-sdb.dts @@ -206,12 +206,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 Sat Oct 22 07:28: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: 7651 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1107877wrr; Sat, 22 Oct 2022 01:42:22 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4mz48z0xztWLGr0hwWNks3BzE6qd3fq4dlt0io4J3UGTvlW2ml9nKEQV56wEafgwU6UBWu X-Received: by 2002:a17:907:3e0f:b0:791:9529:3674 with SMTP id hp15-20020a1709073e0f00b0079195293674mr19036699ejc.503.1666428141832; Sat, 22 Oct 2022 01:42:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666428141; cv=none; d=google.com; s=arc-20160816; b=OKgENpnthMNsHCUrNprOQx2bWhm2Uvw5Y018UWmlUf67xKaSWI3bI1eZGFa7PNsoD/ kB+YLRlE4gWU9xAOJFd4650SPwf767LCJIUcKzXOwbpTQphDN5SmkCPutnnYfqyZUeHd na8OzbN0h2d8DNo5sNNfOd1+d3eTLPceJPFqVb143ho1DgcRgVaoS3JG2c5MXUtY3dS4 l0r/rP4IhpYMrsCyYS1rfbbvGSxQcCSczePWna/ql48C53enfZhWdCM3fc95x4F8JMSl 4JSY0VekTVaWZCX2bMnIgAj5A2ud0OeoGNz17THzmB35HPBq+KrCCvTaCXL/pkKVanwt Wezw== 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=1DjiRGTUDN3Lr319L9h/nbdSn1HqjFrn22lSiB6PJMk=; b=cNH5N71nZE0V6XIqALiqFiXCTgf0ApJtDeiKSVcQT9JNZr8SV/gwIKUAQqgqbHkBgi qX9tzkqw+2N2FWuD42lsxLUKL6cprAEeZDYlprG57Q97niJFfWLWnNSwaaGDXPXxo7um IJ5YzjjURxmRp9WiD4GECzmcasxuaHBWqzux3tTS+7GSa8MrzttWGT2dqf6uELp/0x63 KKNgOMOp53Edyg1kJqqurfpomHWeQfGxzO+LYPCnADCxeY2GcaJJCkN3KjPEoheL1ihG V3MhuHnlmsnI371VkTTuXiCnFZIqTPE0mLgwHFNqy2EsXzd1QmC6vXIiJ/NAzgu2egDb RhxQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=0hUVtKNJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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-20020a50eac2000000b004513a465ec6si20452128edp.94.2022.10.22.01.41.57; Sat, 22 Oct 2022 01: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=0hUVtKNJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S234622AbiJVIjW (ORCPT + 99 others); Sat, 22 Oct 2022 04:39:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53730 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234450AbiJVIfb (ORCPT ); Sat, 22 Oct 2022 04:35: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 90514367A3; Sat, 22 Oct 2022 01:04: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 dfw.source.kernel.org (Postfix) with ESMTPS id A0F2D60AD9; Sat, 22 Oct 2022 08:03:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A78B7C433C1; Sat, 22 Oct 2022 08:03:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425832; bh=ayp+jSaaPfe5I/1EVdF9jc4RB+HfOEqcgk5Y8Zys60E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0hUVtKNJyFoAfraqe7xKXj7YQ/zNECy10x/C+QzBfGr2rcTEcE1IX8uWdaPGUndi5 8peuu0VMbeEizCBC78rULFuNtq/KL/DcQxWms2VXsv5G2/f/D6hEpQGOfhLW9kb5IZ JK8PAwGLNTp65Kv3lPn4VXg5IyU5HLmmRlRe4mfo= 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 5.19 631/717] ARM: dts: imx6q: add missing properties for sram Date: Sat, 22 Oct 2022 09:28:30 +0200 Message-Id: <20221022072526.368245474@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376555211897658?= X-GMAIL-MSGID: =?utf-8?q?1747376555211897658?= 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 9caba4529c71..a8069e0a8fe8 100644 --- a/arch/arm/boot/dts/imx6q.dtsi +++ b/arch/arm/boot/dts/imx6q.dtsi @@ -163,6 +163,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 Sat Oct 22 07:28: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: 7654 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1107934wrr; Sat, 22 Oct 2022 01:42:36 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7bWG3kh1XYdVd+RCFMVnn1sI+8SBrWAgJomTFsKf5fFlXA/rIlSuECQPzVcTuwXhs4Bpqz X-Received: by 2002:a05:6402:5cd:b0:446:5965:f4af with SMTP id n13-20020a05640205cd00b004465965f4afmr21096174edx.12.1666428156276; Sat, 22 Oct 2022 01:42:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666428156; cv=none; d=google.com; s=arc-20160816; b=TnTGxw8X9Ioh1bVh2uHzbUHMrHGRUUAnKKAMl5L9LS9Z7u0JvSygWt1SKXsRBWIVMi IIuocYtV70J0n2QPgg7mrKEDtIalYpL0c73AaY07xFHRle6OVkbLvLSSVouzNMzM+Hcb J8iJUJ89okzvTWlB4YsTyWV4yKOcbxCEKcirutTQzbVqT46jPzItEEMY+QyIvsageA/9 Bf5B6sYeUonkLn2pcik8unlGkyv1mS5pT4esuoQMRdfi3E/v6iBDLX0pRpu0iGLDu+ub lmQB/sDUEy6J/FEvXLvdznI8lglLdF26wBjJk3Vm5O4MvaYOh6mM06ZhcNi0bg0BL2zo UQqg== 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=7nzlRDQQs4xMcjeVuIzRa9t5sck3BV27cgI5ew6IoQs=; b=JDp1Hjm+8XkabOB7UFMiWLEnUm2zcQ+yo30w2fZFO6//8ffwMwLJp0EllTb+A6wqK2 oCxPB3fRvtDJ8qry1jYaGDItpkoEu49w/m/MP1y+VDGXQE9V4e5zv8b6oKVx09hrzQu/ ggiN17VYfFgsH/3DIijayhn1aoBDVr/6KeKbunUDER9PM1Jwra4oCVDDz6RFNQiJOHdo fA9sbP+aF01nFMFnGWCmv1mOiGJ9hcHBsRgbfEvnKBJeon7Mif9p862PIWt6e4sGQXn8 xxQIRPLG/9NtSwU4nyWLLa0/XSeE1FNG5SpC+h5AolHo5n0ckZgkB5Xc30fJRB4FPdOx R8vQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="zK/eJTD0"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 qa43-20020a17090786ab00b00782b261ea1asi21871458ejc.67.2022.10.22.01.42.12; Sat, 22 Oct 2022 01:42: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="zK/eJTD0"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S234425AbiJVIlK (ORCPT + 99 others); Sat, 22 Oct 2022 04:41:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45210 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234559AbiJVIfu (ORCPT ); Sat, 22 Oct 2022 04:35:50 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 72A71422E1; Sat, 22 Oct 2022 01: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 dfw.source.kernel.org (Postfix) with ESMTPS id BAC4D60B39; Sat, 22 Oct 2022 08:03:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id ACC35C433D6; Sat, 22 Oct 2022 08:03:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425835; bh=iKZ/2Bz6UW9cY4lla+MqAFAxTOi1scQ+KSJMNOOVpDE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zK/eJTD0l4rhSK8lOCHv1/c7D63q3z7mg2q/5VrjRQW95zfTZF/lrsRvsK7Bv8P5U aJF644h+N1KkDlm0Up/Mfr4JIHwsW67ABJ9++7UGg+Jj8PMi256tAHxoNFlQ06Rcru nTKc+AjuQCWsnhiYMQeIkQy/mxF2NA1+WV95htxU= 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 5.19 632/717] ARM: dts: imx6dl: add missing properties for sram Date: Sat, 22 Oct 2022 09:28:31 +0200 Message-Id: <20221022072526.405725607@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376570395178377?= X-GMAIL-MSGID: =?utf-8?q?1747376570395178377?= 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 fdd81fdc3f35..cd3183c36488 100644 --- a/arch/arm/boot/dts/imx6dl.dtsi +++ b/arch/arm/boot/dts/imx6dl.dtsi @@ -84,6 +84,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 Sat Oct 22 07:28: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: 7783 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1121513wrr; Sat, 22 Oct 2022 02:28:49 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7EaFzK33I9qktu44RmAHchD85oDi9xbbUnsot2KHgqFAOpE07kklQli37AU9GorGHA173e X-Received: by 2002:a17:902:9308:b0:182:b2ba:755 with SMTP id bc8-20020a170902930800b00182b2ba0755mr23636564plb.107.1666430918743; Sat, 22 Oct 2022 02:28:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666430918; cv=none; d=google.com; s=arc-20160816; b=NegnykWn5fBCak3mORCWSwD7yRLWiOkHH/JIrolm/2BJXdlap3Zmiem4n8sON4/wf1 Es8zWMc2Gvr3tE8D2J1OLijzrJ3QhMNZQ+Adt8y31eD8QXa/YNca4UaS7wX+uFQlC5BM n+XoMlJHZjrcoO+kgrp+EGJnJHQKgyP3fC9j62UKlNXWPytl2OBYrYFnaXgCal82MbdQ SID27ZCU7UREbXOzukyxBP/sf2TGted5M5BBs7QykrEP3Cmx9ulYhgU4wQNleED7tEqn ErMPkfHzmwYYeJqQ6EUcYbM9mTiwRq123pcx9VTT9y9wnOsXJ+YQuMOetRIoAbQty6CR 3v/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=g/W2IHSbl+5B1G/xoZdlCTg2aCCVNxJ2a1lkQ+7hyjI=; b=0wmwifG7Z05k5h8FFyQVt7XvHF4DvCGpX2GECpy9QZ7ZzeKf7NOp7KVFo18/muZU71 puY+S/k+ygOn0TLP4lRuXZ/lsZypms3R4M2SQM/G7MVYZz4DGPpe6ImYsEYYDbqfFYxW fouzS2MwkoZcsdOkdFbgCvIbdehi90V0ILrfPBOLwLDwbN+F70JF0FmBleI9V1jLScwp YPYY5G1LsoEeG1M7JwX76bitO6ft02ykM62aC7yiChDo15S/lCqt0uNVdrGEnjgY8WBp 61B1y5eIUEiEWWkIF2qb5ZHz9xSnx3Nz2ZVDzxsiCJcylhW0TdwsqOljfHUmNbEZpLeG kcag== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=MHqTlhTS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 j191-20020a6380c8000000b0046ec396db31si3762218pgd.857.2022.10.22.02.28.26; Sat, 22 Oct 2022 02:28: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=MHqTlhTS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S232865AbiJVJIG (ORCPT + 99 others); Sat, 22 Oct 2022 05:08:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55266 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232017AbiJVJHj (ORCPT ); Sat, 22 Oct 2022 05:07: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 71F24300709; Sat, 22 Oct 2022 01:21: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 AFFD460B16; Sat, 22 Oct 2022 08:03:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BEA29C433D6; Sat, 22 Oct 2022 08:03:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425838; bh=LnPRrEoDzH7H8HbDkKzRjnxiAaycDy98ULWnwDlGX2c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MHqTlhTS0MHIChyDKHMzukibmWAyINztdEl5Z9LQJHfzJO9SrBQdnvXQJnG97jJ/7 6PeY+2mxbDrUIq9wN4KuECzDDxnjm3thjMHzv/TN3oR+qFMbktOiGExZ8gq0QcrL9K 1qGVgBi4I+FqL0VzMjncKJ6kfOUb+ML9EAnkewE0= 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 5.19 633/717] ARM: dts: imx6qp: add missing properties for sram Date: Sat, 22 Oct 2022 09:28:32 +0200 Message-Id: <20221022072526.443420238@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747379467215158801?= X-GMAIL-MSGID: =?utf-8?q?1747379467215158801?= 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 050365513836..fc164991d2ae 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 Sat Oct 22 07:28: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: 7646 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1107761wrr; Sat, 22 Oct 2022 01:42:00 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4iOkPOyLWUl7Fni5bt018VXoL9oLAOwLSPOJ2IA9lts+viS/Jwzk1PhP8MUT5LNpcHCLu2 X-Received: by 2002:a17:906:8457:b0:78d:b793:5511 with SMTP id e23-20020a170906845700b0078db7935511mr19009807ejy.393.1666428120348; Sat, 22 Oct 2022 01:42:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666428120; cv=none; d=google.com; s=arc-20160816; b=tRQkG0RgBbXoYHBvlLOEsSUQyG/X5AYSh/5Yf86wDm9w9EVN5r81+x0WGTz/YyFyXS HAwHaTFoWmwH1ntyy51zbiS+BHG8IiLXxZPJk0CsgYIP7J8PQaG5axLhL1Eq6f9ernow qyq8hqddJk68p+cdnMfKCZ/MSvMdTAUY6XVQpXP8qQNZf3dCsW33qDl8w3lMFybn6Sse 40mHpJXdyAbKj6lZ6qOY7Nu/KkM8L6r0te+9WiLxcbrnyQqTbYkUqs2QAQ69TrnkmsQO RRf65Xmm0plfEFzZ1M3igSn4cPjgLzmqrqJR6/FcOFV8EUvfFH6ldNzVwdvcWpSOWxCV Sjrw== 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=B3Y3Xl8TFPorfZKxUW93YkzptNKqsIxMjjmC1jqlxSY=; b=BefYLnI3HWd+tjvNq3GGKAYs4CGeUIjX/Yt2p/5CwjZ1fSdz2qCZEzjMQl9Jm6o+6X XKzYyo81xFCqCtUqQ1eiYCxLxk2OnmWQ19TV9/WxrI/G0qSRy+r/r1lPcbDJ27iDSvjr RIRT+Iji+GLJ1ZBWRHjOneeO4fpEFF9pV2aoIg6tW/tZ/oyKI1ibtJMShj8TZTg8N/TM KnqvsvWR5tndBlXc8cwtG240KKBWO/HU5rN/MQZDokDb/wTF86PY7Dj4V3YxIusjf76k pcvZnm5X5jzAwiPIV8sTC1/2kUxgDPCU6ZGG7wl0mPPRb6yH6fUzjtZD7xl0VrgiCtED pisw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=awLK3IyB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 b10-20020a056402084a00b0045a11b60c57si27783839edz.121.2022.10.22.01.41.33; Sat, 22 Oct 2022 01:42: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=awLK3IyB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S234013AbiJVIkj (ORCPT + 99 others); Sat, 22 Oct 2022 04:40:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54268 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234473AbiJVIfh (ORCPT ); Sat, 22 Oct 2022 04:35: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 5AFC025E9D; Sat, 22 Oct 2022 01:04: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 AC1A760B49; Sat, 22 Oct 2022 08:04:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A502AC433D7; Sat, 22 Oct 2022 08:04:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425841; bh=01jDxhgdXrSDbn6vPLVwOQpBBL5rmQYUKZArmb7rDrI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=awLK3IyBK9niqc9lhBQPnS4KHw2q/yVkkViLuTR6tihaYc6cUjjMYHW38QlkOjapj QU4ptzhFzawNz5WKHF2RAfJawG44GuYGh8TcqD0QJ4NdPC6llyGNkXZwa/hMUeYNk9 VoCXfEkgzuaqgHBB8DyRCYAJyTWhzPaw48YSJc6U= 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 5.19 634/717] ARM: dts: imx6sl: add missing properties for sram Date: Sat, 22 Oct 2022 09:28:33 +0200 Message-Id: <20221022072526.483888522@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376532891528623?= X-GMAIL-MSGID: =?utf-8?q?1747376532891528623?= 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 06a515121dfc..cfd6b4972ae7 100644 --- a/arch/arm/boot/dts/imx6sl.dtsi +++ b/arch/arm/boot/dts/imx6sl.dtsi @@ -115,6 +115,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 Sat Oct 22 07:28: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: 7664 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1108141wrr; Sat, 22 Oct 2022 01:43:30 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5T3ypy9DndO29rmogiBb92ktYVn7JVPexFXS1D/isIvOM4dB4PqSZbmxzKyMye5b0soA8o X-Received: by 2002:a17:907:760b:b0:78d:9d67:83b9 with SMTP id jx11-20020a170907760b00b0078d9d6783b9mr18878713ejc.568.1666428210344; Sat, 22 Oct 2022 01:43:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666428210; cv=none; d=google.com; s=arc-20160816; b=yASeFZBZEhe74sXUiXb654pZtrBwNNzzo9yzvJLNKNSK8nSPlxf3fQ0WPG/E1BzN+x JfpbHioJn9RFIwH27WHy+GMMkuqAPc3PKrYwXkQ2LiY3NAyd27PKV/xydyszJikA1Wfw iua5WH8paufsYj9Q3PWa04ZKuG//Id3rZrmC/Z/XBDAgdkyfaJFWGUB6j6NXpxYjSs+f 14JQj55odLUGGBnnQvZXh6Ve8zY8NQZUUC/dZc8dzXUu60QbByOws8My77aaYxH7hef6 5bwR/HOFQc/4DB2dhvZE5qZCmuMdM2DkFJNGWMcwuSW7J6rx2IkQleBpuDKPOpreRCNG eQCg== 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=xvowuL+lCFpjsbAANtcCPq3hpe73Ispu60nW0ikKK8w=; b=vOk/358YKK9ZTdgrxsO0kdPllHw1D+gvJjcPc+HZIbny8WQdySxX3JS3Sc4u18Pum4 9sVRo/KqBRveb72DTJtDooedQl1dizHzmvlN1EQUhq5xXp9T+eNbw7kD1H7N1VqHxbsW L+2pERRrErnXGGemaxpLfSvnpVg6J75PTNecRXX9Qu9lTlB6AkU7S4V+qpQZA2CzniH4 nnS4R+g3BOBXCtHhQwe7SJpdYcN31lgFhjXcZIJAYJ4wT/dqHkiOpOhDAOhxKIUpzltd zoE/gg/5Dc+5zSYV7FNr0zK5m5PS6rE/oJD96UaFCLvNJcTUNru/YDbMsCHPB9x30g1v GKOg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=TuI21YQO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 ce12-20020a170906b24c00b0073d9c29892csi18193029ejb.939.2022.10.22.01.43.06; Sat, 22 Oct 2022 01:43: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=TuI21YQO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S234682AbiJVImV (ORCPT + 99 others); Sat, 22 Oct 2022 04:42:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56488 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234699AbiJVIjd (ORCPT ); Sat, 22 Oct 2022 04:39:33 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 35E3B2C6369; Sat, 22 Oct 2022 01:05: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 65EA0B82DFC; Sat, 22 Oct 2022 08:04:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AF3AFC433D6; Sat, 22 Oct 2022 08:04:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425844; bh=hC7weKyqCI/bOmZ+4VQhssSCJ6Wn8R/IKSruyt9fD58=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TuI21YQOxoLxruKrdqaZtvx0BitmCfA2yQRQaAKEX6h/BHVDK+W5P3dB7Bbxf5Xqw n+2qdgM/Dm0Uj7ZhEVjBNJuSSLGxhGlLCxfQJyH71Io55dguR4gykvcoACpBex0non rf6OP2CSmsDWy3JKV+rbFUVIEUyYrApPlIYDMHnQ= 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 5.19 635/717] ARM: dts: imx6sll: add missing properties for sram Date: Sat, 22 Oct 2022 09:28:34 +0200 Message-Id: <20221022072526.532542038@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376627440088761?= X-GMAIL-MSGID: =?utf-8?q?1747376627440088761?= 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 d4a000c3dde7..2873369a57c0 100644 --- a/arch/arm/boot/dts/imx6sll.dtsi +++ b/arch/arm/boot/dts/imx6sll.dtsi @@ -115,6 +115,9 @@ ocram: sram@900000 { compatible = "mmio-sram"; reg = <0x00900000 0x20000>; + ranges = <0 0x00900000 0x20000>; + #address-cells = <1>; + #size-cells = <1>; }; intc: interrupt-controller@a01000 { From patchwork Sat Oct 22 07:28: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: 7648 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1107781wrr; Sat, 22 Oct 2022 01:42:04 -0700 (PDT) X-Google-Smtp-Source: AMsMyM52dEzwKwsYVxRHqL/J3iWj2GbbuHCah6xsYsqYdOFSuFy+KmqSdqaTm8I8xOWdWNxubWPS X-Received: by 2002:a05:6402:4441:b0:454:8a74:5459 with SMTP id o1-20020a056402444100b004548a745459mr20870759edb.155.1666428124483; Sat, 22 Oct 2022 01:42:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666428124; cv=none; d=google.com; s=arc-20160816; b=SbFoeCVnb4KiuBUyUfwO/ZrQXO3Vy+jbqdDl7qIWByyTlcanSKoYMaf2Yd/PKojCzH ZILsJk+XTZhLoY/42GpFr8YZGXHxgnogq4pHB+WOULyr8EK0PX3sQ2ns+j9er0RBhLp3 EfS36aM2d4c45zo+Gxb8LIWR4eMM+cd8+H76RWRTMMu2Qj+a9uA4wT+wvHc6RmcOuoT9 CW4UXcTDJsf40QLwu5kA/zNpnx8mQUQZ5uIKl2AQJrOiVwAqrSG/SzKM0/67uyNuzGH4 y9a4GHUD3YKMSyFw8cu7JvfGSGSanQMVvnyOvQiU8SXN/4NMuJrGN9A5IpupECKMTv5c DyIg== 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=gTuPkiXC8LVpndEXT2aC+Nyq+bFKqn3AcnGPZNr8hKE=; b=AiC5l8JkOY4/+rYbP+2dxFpL4QOpgy9LeEB3sjdCzClmISjVcf65XdflmCBPnZ5S1W 8GH7rl8sbCmFqMOhZdkKuM5Or1wHwnU//dMWv/YaY/M/K3PBqGrAFjkZ2kKswTbx5Zhl ks8KNRx9Mcpi8TE5RIGSY/mQS7Nr6bO5qtx+VWpqrQMozJkr39wo+GioUJP5xdEjOtqU c13T7U/CuZMxZQLm3Ixf+QT9sRwbyTH3E1Aj6Jt8w5dh0Nq58LXgdTDeWHjeWZwRnZoM U7Xamwp3/3LAR7R6cviSIQbarpY9I+Gy5wLRvkBTB4LJklcHV7kZfYO5sCbThW6koiPC 1Quw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=uZ3KYc2q; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 g5-20020a50d0c5000000b004597db487cdsi22323408edf.604.2022.10.22.01.41.39; Sat, 22 Oct 2022 01: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=uZ3KYc2q; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S234277AbiJVIkn (ORCPT + 99 others); Sat, 22 Oct 2022 04:40:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54262 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234490AbiJVIfk (ORCPT ); Sat, 22 Oct 2022 04:35:40 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EA3742CCBA; Sat, 22 Oct 2022 01:04: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 10DF860B80; Sat, 22 Oct 2022 08:04:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C12C5C433C1; Sat, 22 Oct 2022 08:04:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425847; bh=0HElxxTVQHby19MK1PWO8lnoCrlZIj7jRwzNME49DeM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uZ3KYc2qY/VedJG8io/Pazq27oVdE0hvIsJEO9H222XR/kb+/+TTUD2uz+DnOsXvB OBjoUmZF1T9ZKc3DlcARPOA/Nv/pkbgIOwD4KrLf7UP3DEOTW5gCGoQylE/4hig7L9 C9JwdLJsStaJVsD1igWKLTklem3bkmdCT20qbj1k= 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 5.19 636/717] ARM: dts: imx6sx: add missing properties for sram Date: Sat, 22 Oct 2022 09:28:35 +0200 Message-Id: <20221022072526.573669223@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376537134382520?= X-GMAIL-MSGID: =?utf-8?q?1747376537134382520?= 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 fc6334336b3d..719c61f7e914 100644 --- a/arch/arm/boot/dts/imx6sx.dtsi +++ b/arch/arm/boot/dts/imx6sx.dtsi @@ -164,12 +164,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 Sat Oct 22 07:28: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: 7765 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1120972wrr; Sat, 22 Oct 2022 02:27:03 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4p7Yu4r4uFY8z822JQirqUAEBjLW1qLMdu9zsYH7Ft0HZAw61mTV2YA5lrCSt37Wi6e7c7 X-Received: by 2002:a63:ef49:0:b0:463:1a9:c723 with SMTP id c9-20020a63ef49000000b0046301a9c723mr19163799pgk.384.1666430823584; Sat, 22 Oct 2022 02:27:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666430823; cv=none; d=google.com; s=arc-20160816; b=D2YEtI16GzvOVVsBZxogJBiNneC+jF/75LHNWPjUWA5aGSq5Fr3MiFko1qtt8DB6fx aEBDKHz5r3qxRIO7Z4xIskiZGBqzY0dmGeSAjdqozqPUWctwrMb7tbZzv4Sn8OZxSXf9 t+7pP5lF3sgFjcFnY2UYGduhfHEw9uDTOYyG0xbQslCG6oSsZiAhvzRcWhaWOFzVf2JB 57U6xkUZ+OZix826nwze6bOQr9mj4A97AKfmP5YGsH6u7T2rEOEG5ONQzm3K60LjwXMR sxjuv6a7eyzMvrFGJfCf8Y4ePUjzbPcwTH9VfOvjgk2n085W2HaZ5l0vQMRxZ+t7uLMV c2wQ== 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=MjIEC0xZMITsarOtOrMSLjV0JjcBwUbOpJ9XoLej8g4=; b=ugy3btH4tOwGpP3OuWTTa6X8Hg84tFYb1elX6keltJYXNQ5B/s2PWTmDB/HY2qKj0v kvXAlSTUsCX+3/oJ6IulHY9UkBTNxNSAb6edI0yE+TFN6MWlOTkED8XAFG6f+yJKKqDY 3FM7Ylu13HRmsQ9RpRqYxO6Mvy1/Oo33rXHEmZdIlnJlaPoZh3C0HWq6O6js6rtFGsQZ YKDbatWWJFtfQK5zcYOpShy03knPKi/0xp2lmRRkUEFkOuWbFY5yxJ6+n3Hb7b57v670 1FD1oFiA7RVYT5RlYqmylgoKVRfRRnDFWaasH6ZtdaIef/RuvZFs8/JzFoQkouzrbCsM EpxA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=0IeNMsY2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 y12-20020a17090aa40c00b00209b614417esi2178343pjp.88.2022.10.22.02.26.50; Sat, 22 Oct 2022 02:27: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=0IeNMsY2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S232198AbiJVJEr (ORCPT + 99 others); Sat, 22 Oct 2022 05:04:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42354 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232281AbiJVJD1 (ORCPT ); Sat, 22 Oct 2022 05:03:27 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 256102FACC5; Sat, 22 Oct 2022 01:18:37 -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 CD000B82DEE; Sat, 22 Oct 2022 08:04:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 29F4DC433D6; Sat, 22 Oct 2022 08:04:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425850; bh=teLkVvsGmTvEmoonmZOWurIfqTWLncO4ba3j6bGrtxA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0IeNMsY2447Lhuf8ngQrYIsFHdvgDTTTr8bctZwGGgyS5/TTQgA4e2j+VSNlmV15Q 6BQ059teO6YaQCdke+4UhaW7geHXMF7edTeSyWavRl4B1IWj6CWWK82jK+8cNo9yIn AwkRAM4n4YRWCuSKICbL6Lgv1CW7ksXmlcZzFjrQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Marcel Ziswiler , Shawn Guo , Sasha Levin Subject: [PATCH 5.19 637/717] ARM: dts: imx6sl: use tabs for code indent Date: Sat, 22 Oct 2022 09:28:36 +0200 Message-Id: <20221022072526.616634824@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747379367146475427?= X-GMAIL-MSGID: =?utf-8?q?1747379367146475427?= From: Marcel Ziswiler [ Upstream commit 218db824a7519856d0eaaeb5c41ca504ed550210 ] This fixes the following error: arch/arm/boot/dts/imx6sl.dtsi:714: error: code indent should use tabs where possible Signed-off-by: Marcel Ziswiler Signed-off-by: Shawn Guo Signed-off-by: Sasha Levin --- arch/arm/boot/dts/imx6sl.dtsi | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/arch/arm/boot/dts/imx6sl.dtsi b/arch/arm/boot/dts/imx6sl.dtsi index cfd6b4972ae7..01122ddfdc0d 100644 --- a/arch/arm/boot/dts/imx6sl.dtsi +++ b/arch/arm/boot/dts/imx6sl.dtsi @@ -61,10 +61,10 @@ <792000 1175000>, <396000 975000>; fsl,soc-operating-points = - /* ARM kHz SOC-PU uV */ - <996000 1225000>, - <792000 1175000>, - <396000 1175000>; + /* ARM kHz SOC-PU uV */ + <996000 1225000>, + <792000 1175000>, + <396000 1175000>; clock-latency = <61036>; /* two CLK32 periods */ #cooling-cells = <2>; clocks = <&clks IMX6SL_CLK_ARM>, <&clks IMX6SL_CLK_PLL2_PFD2>, @@ -225,7 +225,7 @@ uart5: serial@2018000 { compatible = "fsl,imx6sl-uart", - "fsl,imx6q-uart", "fsl,imx21-uart"; + "fsl,imx6q-uart", "fsl,imx21-uart"; reg = <0x02018000 0x4000>; interrupts = <0 30 IRQ_TYPE_LEVEL_HIGH>; clocks = <&clks IMX6SL_CLK_UART>, @@ -238,7 +238,7 @@ uart1: serial@2020000 { compatible = "fsl,imx6sl-uart", - "fsl,imx6q-uart", "fsl,imx21-uart"; + "fsl,imx6q-uart", "fsl,imx21-uart"; reg = <0x02020000 0x4000>; interrupts = <0 26 IRQ_TYPE_LEVEL_HIGH>; clocks = <&clks IMX6SL_CLK_UART>, @@ -251,7 +251,7 @@ uart2: serial@2024000 { compatible = "fsl,imx6sl-uart", - "fsl,imx6q-uart", "fsl,imx21-uart"; + "fsl,imx6q-uart", "fsl,imx21-uart"; reg = <0x02024000 0x4000>; interrupts = <0 27 IRQ_TYPE_LEVEL_HIGH>; clocks = <&clks IMX6SL_CLK_UART>, @@ -312,7 +312,7 @@ uart3: serial@2034000 { compatible = "fsl,imx6sl-uart", - "fsl,imx6q-uart", "fsl,imx21-uart"; + "fsl,imx6q-uart", "fsl,imx21-uart"; reg = <0x02034000 0x4000>; interrupts = <0 28 IRQ_TYPE_LEVEL_HIGH>; clocks = <&clks IMX6SL_CLK_UART>, @@ -325,7 +325,7 @@ uart4: serial@2038000 { compatible = "fsl,imx6sl-uart", - "fsl,imx6q-uart", "fsl,imx21-uart"; + "fsl,imx6q-uart", "fsl,imx21-uart"; reg = <0x02038000 0x4000>; interrupts = <0 29 IRQ_TYPE_LEVEL_HIGH>; clocks = <&clks IMX6SL_CLK_UART>, @@ -714,7 +714,7 @@ #power-domain-cells = <0>; power-supply = <®_pu>; clocks = <&clks IMX6SL_CLK_GPU2D_OVG>, - <&clks IMX6SL_CLK_GPU2D_PODF>; + <&clks IMX6SL_CLK_GPU2D_PODF>; }; pd_disp: power-domain@2 { From patchwork Sat Oct 22 07:28: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: 7665 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1108152wrr; Sat, 22 Oct 2022 01:43:34 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7EnUb1Lehs2551Dmu3dE0qQoTmJZVRccoz9MsN+UKIEqYFU8Jap/4Y+d1UbCAi2O/xDagR X-Received: by 2002:a17:907:c27:b0:791:81f2:f2b1 with SMTP id ga39-20020a1709070c2700b0079181f2f2b1mr19459821ejc.436.1666428214311; Sat, 22 Oct 2022 01:43:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666428214; cv=none; d=google.com; s=arc-20160816; b=1HtsbexpeUUl+6KAc5rWoW7yKbDEw0KT7IaThZ+OGUm/tsy9KE03S+TzuuwlnrxdUk oP5uNeUZK7sgZy15nTNyp0qeVOAmPFdBv2z1fPvVNjiyOBqXFUedZmNmy/YCnXAnDErC STLvBsxoKod8lG9xiBYnsdMjcIBEACOrhgyPcCN1t4v/bCfSg7uVjc/ob2y4GlWeLb7q JLnPUvakOloHaJzf/hJ4dbdvihDaixMwGyfJUX6DHYuoOMG1rx0O1CV/aP1IXMZ/qHG3 gcuJ2uPWcygb2+xaqgH0eu/ToZz5j9XNyrV797+ojM7kjG2+KmsYlW1jDkiZtu4x3en3 HivA== 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=NcoPaPHVfJFDveYjF6/vwYvXghdIv70K7/fWbnw5E/A=; b=WA6s5qUHH/OfTLAqMRdrdAkzCXYNugF4Mo59HwijgLNocmVogmHC5EXtbiIMSE+zvG UERfjK4gfVZjtFzzt/Q/WLmgyJRD3FTe+tjVMa0TKvBTmPF8EdiNZZeiIjbKcmp2YCdK tFQzNDkLo1YIG6hJWKk9esAonNjrQoGpTOj4HdLKgzTDovRle72Wcowyn18YE5OssomL mj/nrsCLbZKetcQ7/nNU9lM7WcF0NO7G3Pe+A1VFuWxhvW0GoY32g6hDuIu6+ZsboZaj nkmhcFtxE/cUveg230RHVTpdC6kW6grCVEJUlzwk599ZrTslC2zqjaWQqKipibsXCa+z nsQw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=t7uVWK2b; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 c15-20020a05640227cf00b0045eec876883si11618633ede.229.2022.10.22.01.43.09; Sat, 22 Oct 2022 01:43: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=t7uVWK2b; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S234702AbiJVImY (ORCPT + 99 others); Sat, 22 Oct 2022 04:42:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54942 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234755AbiJVIjn (ORCPT ); Sat, 22 Oct 2022 04:39:43 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 23522CABE0; Sat, 22 Oct 2022 01:06: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 C557CB82E11; Sat, 22 Oct 2022 08:04:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 17FEAC433D6; Sat, 22 Oct 2022 08:04:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425853; bh=V3gHEUw1Kk05qfDus0qF9T3OcYJdKc5uRN6/d7kBomw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=t7uVWK2bc+3ntJupJ6HN7DY1jIbnoXyfYdxME50+6O2pa0QOS5u+3KJVafRDeRVc6 OP2UkrKKPEIPiUHzuVPOwk+odOCOTEnVx9Ddxfr0vXvmcWK8QeJdZjQGfggEMCNJvl hXsWAsaYABZhS1vHYpAsu6snLX6/fmMRmo4axXZs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Marcel Ziswiler , Shawn Guo , Sasha Levin Subject: [PATCH 5.19 638/717] ARM: dts: imx6sx-udoo-neo: dont use multiple blank lines Date: Sat, 22 Oct 2022 09:28:37 +0200 Message-Id: <20221022072526.649211292@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376631421939082?= X-GMAIL-MSGID: =?utf-8?q?1747376631421939082?= From: Marcel Ziswiler [ Upstream commit fd2dd7077c7498765e7326c1b7f34bde85f1a975 ] This fixes the following warning: arch/arm/boot/dts/imx6sx-udoo-neo.dtsi:309: check: Please don't use multiple blank lines While at it, use tabs indent for some pinctrl entries. Signed-off-by: Marcel Ziswiler Signed-off-by: Shawn Guo Signed-off-by: Sasha Levin --- arch/arm/boot/dts/imx6sx-udoo-neo.dtsi | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/arch/arm/boot/dts/imx6sx-udoo-neo.dtsi b/arch/arm/boot/dts/imx6sx-udoo-neo.dtsi index 35861bbea94e..c84ea1fac5e9 100644 --- a/arch/arm/boot/dts/imx6sx-udoo-neo.dtsi +++ b/arch/arm/boot/dts/imx6sx-udoo-neo.dtsi @@ -226,7 +226,7 @@ &iomuxc { pinctrl_bt_reg: btreggrp { fsl,pins = - ; + ; }; pinctrl_enet1: enet1grp { @@ -306,7 +306,6 @@ >; }; - pinctrl_uart1: uart1grp { fsl,pins = , @@ -347,24 +346,23 @@ pinctrl_otg1_reg: otg1grp { fsl,pins = - ; + ; }; - pinctrl_otg2_reg: otg2grp { fsl,pins = - ; + ; }; pinctrl_usb_otg1: usbotg1grp { fsl,pins = - , - ; + , + ; }; pinctrl_usb_otg2: usbot2ggrp { fsl,pins = - ; + ; }; pinctrl_usdhc2: usdhc2grp { From patchwork Sat Oct 22 07:28: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: 7795 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1124375wrr; Sat, 22 Oct 2022 02:36:26 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6CVvxqund7+ywt0fdO7UoI7iDk8Y+FRVHkUS+GzgZSlp4Do/RZplScMVcrXOv7i0BC4zIZ X-Received: by 2002:a17:907:a068:b0:78d:cbcf:f7bc with SMTP id ia8-20020a170907a06800b0078dcbcff7bcmr19093955ejc.519.1666431375763; Sat, 22 Oct 2022 02:36:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666431375; cv=none; d=google.com; s=arc-20160816; b=uqJZRpNpMcKQF19Ymco7hLwpdb2QGFJa4/oJpDxlcsDWY71VP3qR87+3soyiMlB/ZH b8rVt5kNATxvJ3mT3P3mhiPXZaM5l8vYxFWc2q9ccTfF5i5VKupb/L+73NzPzF+Yw5WC 657mPaUi1TzsJXKpTVMoPuVCo3w3gOemfwi9dzHB7e9K3THkfIxH2B02eIQpZPaRDfSd HFXsui1WoJQVjxWabarON3eglMm5H4/bJQS359hS7ICO/iprIxWkROTcpFeu5+5eaD5x VkL1m6cq9dXsSPhsxGo5SHsW7xQPrkjwhXSzTusTjxgzVssp0/6eTJLsc/0EAqV8gfak /ULg== 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=gmNVKqHj52xvuWQOZbrsjyGqZ8EVspUwCPvyaLVnFyg=; b=Of2a8vIQBu8J+hTqKxIUyBgQ4aTGOa4l8RYYG+IONq4MpsFPwpD8rgYaAnKlidIofR /wM0YO5stpZZBIG8JkBBZaHTWri75qdxcUwiDmewKKAZfSou3Fth0dpIMfpqdw5K9CzF JQD8py8c/IOeUDeYuyWJRLbM1B8NdnXg2Cy9G0UyvanUzT9/1n1fHynyWPj379ojpnUi WJfeLbdzH/Oj02pbzea9wmhnQrKluDm2Q00HnKrl8TfHij12mcpSZI3eo+El0GQeMMyQ kOZwo3PG8RPkCFxXQg7kV3iFMWjnQZtlq7OaRCskQcOcH476iqmCp5NekRUtykL9AVgT yCiw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=UO3opyeN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 jl25-20020a17090775d900b0078d9c7451c4si20110202ejc.718.2022.10.22.02.35.51; Sat, 22 Oct 2022 02:36: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=UO3opyeN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S230098AbiJVJVP (ORCPT + 99 others); Sat, 22 Oct 2022 05:21:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36436 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230070AbiJVJUq (ORCPT ); Sat, 22 Oct 2022 05:20:46 -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 8540FAE6A; Sat, 22 Oct 2022 01:34: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 dfw.source.kernel.org (Postfix) with ESMTPS id 21BD460B90; Sat, 22 Oct 2022 08:04:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2D7CCC433D6; Sat, 22 Oct 2022 08:04:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425859; bh=xlDA8pfPkFAaw/9xQEsxhHEEkQh9btgLLPQGvlm7iec=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UO3opyeNqpkRbFo8uZv86FTAJ+jr3Cia1hkvDLM5JoW+Bvqff9c6faL0KRUPjNr4v lqeA76u8TJDpJmHYCMD1goxN6qJfP6zzpAD4fOj5zqMD7Tv1ULSsrPsWuKM0KOtE9t VPsTAlRfjAMDzHeaOXVxOq96PdduTiVM4bwIfzww= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mark Brown , Catalin Marinas , Sasha Levin Subject: [PATCH 5.19 639/717] kselftest/arm64: Fix validatation termination record after EXTRA_CONTEXT Date: Sat, 22 Oct 2022 09:28:38 +0200 Message-Id: <20221022072526.690184750@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747379945892688496?= X-GMAIL-MSGID: =?utf-8?q?1747379945892688496?= From: Mark Brown [ Upstream commit 5c152c2f66f9368394b89ac90dc7483476ef7b88 ] When arm64 signal context data overflows the base struct sigcontext it gets placed in an extra buffer pointed to by a record of type EXTRA_CONTEXT in the base struct sigcontext which is required to be the last record in the base struct sigframe. The current validation code attempts to check this by using GET_RESV_NEXT_HEAD() to step forward from the current record to the next but that is a macro which assumes it is being provided with a struct _aarch64_ctx and uses the size there to skip forward to the next record. Instead validate_extra_context() passes it a struct extra_context which has a separate size field. This compiles but results in us trying to validate a termination record in completely the wrong place, at best failing validation and at worst just segfaulting. Fix this by passing the struct _aarch64_ctx we meant to into the macro. Signed-off-by: Mark Brown Link: https://lore.kernel.org/r/20220829160703.874492-4-broonie@kernel.org Signed-off-by: Catalin Marinas Signed-off-by: Sasha Levin --- tools/testing/selftests/arm64/signal/testcases/testcases.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/testing/selftests/arm64/signal/testcases/testcases.c b/tools/testing/selftests/arm64/signal/testcases/testcases.c index 84c36bee4d82..d98828cb542b 100644 --- a/tools/testing/selftests/arm64/signal/testcases/testcases.c +++ b/tools/testing/selftests/arm64/signal/testcases/testcases.c @@ -33,7 +33,7 @@ bool validate_extra_context(struct extra_context *extra, char **err) return false; fprintf(stderr, "Validating EXTRA...\n"); - term = GET_RESV_NEXT_HEAD(extra); + term = GET_RESV_NEXT_HEAD(&extra->head); if (!term || term->magic || term->size) { *err = "Missing terminator after EXTRA context"; return false; From patchwork Sat Oct 22 07:28: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: 7652 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1107886wrr; Sat, 22 Oct 2022 01:42:25 -0700 (PDT) X-Google-Smtp-Source: AMsMyM59ifKEeM0o6peWPnBdIsxz6SC083toA3WEPxsNxfdOkiH/IH+7OiH7b7lYtdpRqu7FnDnz X-Received: by 2002:a05:6402:5489:b0:43b:b935:db37 with SMTP id fg9-20020a056402548900b0043bb935db37mr21882365edb.347.1666428145437; Sat, 22 Oct 2022 01:42:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666428145; cv=none; d=google.com; s=arc-20160816; b=VenP+2/oLuJdPBxafbxI7QY/Rf2Q1bBOV4y4WfXia6zN+K6XlpvU2h+eXw1RGz8bU9 DQIGMU/PDU5haoRBcwseNNe4kYLQGa23Gt9Tq7aYbEzyB/G59DrzgF2JZ5KavmZXuumx i40kRQxUh6n5bgD+97QJL/wv+Sse2tpCyT5F2eJ+jtbsoLkrR39LpJST+v2f3fK5vz5Z 8dow/b01X2fVuN21rdKnWSFqO/csBf5AmTSmgKHZczLlPgrH4+LgJ3EpNJmcjjuZoKNW Bch0b8TLXH6D8ogt6Arcc2dErWS8Bkge4tpHU1pFWO7QTZm4HJmtVlJMjb6jdm/JPKh5 Me2A== 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=znJ33oZa3MkKH/OF1WUCb7Nf+L5apWN0T5CuBPR8zgg=; b=YzagvETNKrI8ZmSiwqrdzu0n0CBER1NGUzMGH3poXOz+23Uwwpz7opaDbP+P/HMfWT cxo/BenprAUrv5VGOHe15Qsn+0InuruguLWAsOBPHofjg3qpOrOsd+KL6nDMpl5XEODb 3n53UZHBAa7ufHqPfRYgwQGP5hVNS3Tr/qRRP+oxP+wjU0un0NXqkCL3al4sgV965cYa T+I5cbv96UOENkAyad5s8K4EWYG6Bd1l1NYC6WtkMa4mkdmGCO4I00hxcDwN1/T7tBsF XE6wYI0OhmyP9uSDgtxeijm8wXcDCk17XntB7AYc/eP3FwJyc84hcAKpvfd09866HVWY VtIQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=2V3SWDir; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 qa6-20020a170907868600b007836ec6999dsi23498430ejc.904.2022.10.22.01.42.00; Sat, 22 Oct 2022 01:42: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=2V3SWDir; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S234356AbiJVIk5 (ORCPT + 99 others); Sat, 22 Oct 2022 04:40:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55562 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234527AbiJVIfp (ORCPT ); Sat, 22 Oct 2022 04:35: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 4811148A12; Sat, 22 Oct 2022 01:04: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 B8E8160B95; Sat, 22 Oct 2022 08:04:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3F0BAC43470; Sat, 22 Oct 2022 08:04:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425863; bh=9k1/VbHeguU3yVKC6fiS5SarwOPVXS7nqwlfeyR3xoI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=2V3SWDiraC7WsKbE48vMEY9vedL1846MEVZj3dKolG0WroM22hxJk7HbG5OGYJECk TOM/1zG0vPvYJnB/0w+IQwZ2D2szhpTrn9xdkI5KCAKRzTmT/QPEykFIvHriHbfl+C mX+vPg5VJQV2j+TghkNw10r0jzClmkUAZqHsngek= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Heiko Thiery , Frieder Schrempf , Shawn Guo , Sasha Levin Subject: [PATCH 5.19 640/717] arm64: dts: imx8mm-kontron: Use the VSELECT signal to switch SD card IO voltage Date: Sat, 22 Oct 2022 09:28:39 +0200 Message-Id: <20221022072526.737289436@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376559079149594?= X-GMAIL-MSGID: =?utf-8?q?1747376559079149594?= From: Frieder Schrempf [ Upstream commit eef2c0217e02b6c7ed5b10b82ea944127145e113 ] It turns out that it is not necessary to declare the VSELECT signal as GPIO and let the PMIC driver set it to a fixed high level. This switches the voltage between 3.3V and 1.8V by setting the PMIC register for LDO5 accordingly. Instead we can do it like other boards already do and simply mux the VSELECT signal of the USDHC interface to the pin. This makes sure that the correct voltage is selected by setting the PMIC's SD_VSEL input to high or low accordingly. Reported-by: Heiko Thiery Signed-off-by: Frieder Schrempf Reviewed-by: Heiko Thiery Signed-off-by: Shawn Guo Signed-off-by: Sasha Levin --- arch/arm64/boot/dts/freescale/imx8mm-kontron-n801x-s.dts | 3 +++ arch/arm64/boot/dts/freescale/imx8mm-kontron-n801x-som.dtsi | 2 -- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/arch/arm64/boot/dts/freescale/imx8mm-kontron-n801x-s.dts b/arch/arm64/boot/dts/freescale/imx8mm-kontron-n801x-s.dts index 23be1ec538ba..c54536c0a2ba 100644 --- a/arch/arm64/boot/dts/freescale/imx8mm-kontron-n801x-s.dts +++ b/arch/arm64/boot/dts/freescale/imx8mm-kontron-n801x-s.dts @@ -321,6 +321,7 @@ MX8MM_IOMUXC_SD2_DATA2_USDHC2_DATA2 0x1d0 MX8MM_IOMUXC_SD2_DATA3_USDHC2_DATA3 0x1d0 MX8MM_IOMUXC_SD2_CD_B_GPIO2_IO12 0x019 + MX8MM_IOMUXC_GPIO1_IO04_USDHC2_VSELECT 0x1d0 >; }; @@ -333,6 +334,7 @@ MX8MM_IOMUXC_SD2_DATA2_USDHC2_DATA2 0x1d4 MX8MM_IOMUXC_SD2_DATA3_USDHC2_DATA3 0x1d4 MX8MM_IOMUXC_SD2_CD_B_GPIO2_IO12 0x019 + MX8MM_IOMUXC_GPIO1_IO04_USDHC2_VSELECT 0x1d0 >; }; @@ -345,6 +347,7 @@ MX8MM_IOMUXC_SD2_DATA2_USDHC2_DATA2 0x1d6 MX8MM_IOMUXC_SD2_DATA3_USDHC2_DATA3 0x1d6 MX8MM_IOMUXC_SD2_CD_B_GPIO2_IO12 0x019 + MX8MM_IOMUXC_GPIO1_IO04_USDHC2_VSELECT 0x1d0 >; }; }; diff --git a/arch/arm64/boot/dts/freescale/imx8mm-kontron-n801x-som.dtsi b/arch/arm64/boot/dts/freescale/imx8mm-kontron-n801x-som.dtsi index 8f90eb02550d..6307af803429 100644 --- a/arch/arm64/boot/dts/freescale/imx8mm-kontron-n801x-som.dtsi +++ b/arch/arm64/boot/dts/freescale/imx8mm-kontron-n801x-som.dtsi @@ -86,7 +86,6 @@ pinctrl-0 = <&pinctrl_pmic>; interrupt-parent = <&gpio1>; interrupts = <0 IRQ_TYPE_LEVEL_LOW>; - sd-vsel-gpios = <&gpio1 4 GPIO_ACTIVE_HIGH>; regulators { reg_vdd_soc: BUCK1 { @@ -229,7 +228,6 @@ pinctrl_pmic: pmicgrp { fsl,pins = < MX8MM_IOMUXC_GPIO1_IO00_GPIO1_IO0 0x141 - MX8MM_IOMUXC_GPIO1_IO04_GPIO1_IO4 0x141 >; }; From patchwork Sat Oct 22 07:28: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: 7673 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1108329wrr; Sat, 22 Oct 2022 01:44:24 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5ZhkTr/tm2sUfRpgAJ+Xnm46vo/j0Rnccf9UMQGX9MvO3zmWL8wBvWQclQxZ8m4fTsoPth X-Received: by 2002:a05:6402:5483:b0:45c:1336:6d9b with SMTP id fg3-20020a056402548300b0045c13366d9bmr21353213edb.100.1666428253532; Sat, 22 Oct 2022 01:44:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666428253; cv=none; d=google.com; s=arc-20160816; b=PasO2Cik1fJfN/BUUVbSRpAf3Bx10biKdepaA1cDASaVEGQvXVYm7MlZTICjkQ+6Ov FH9Zy77g7+9L4mzZNYvMDnFRcAWmQ0mLYwTeZxb8s/pNo2bZZgcfdFuWlSDKBPh+Ry5u MTA0mXKOU3XAJEJBO7YXOa2qkNM5b6CQ7O+jZc659ojZ3CSA3pAHBF07Vavgsj15CVvZ jBOUVCQHIrwbbHbRasovV2DlUJylyhX1rEf4a7Xv49pknpEe76WH/aR9HX4o8ke8UJWg 6sEqw92xX6OWy6KlHbV+eE5rQAi3BhCS2JWzj8ETuxn+sYcEoOXrjWa0RUPfZ8C6VrQF 9h7A== 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=lfeW0cifs4TbJYNPN88aMQje0bqdDAa/QAWN3Yfr2Dg=; b=xwKDlX09t2nYT2UteQq7ClJpL+MGWqm+Cjbf4O1vXo/LexVUpdAYmyUIlVRoptIlD/ OO+DbGqI+/7Q8y5rIFveyrhVvya0xXLwTuYqpJwCl3SmnMqLDFmY3Umo53Zu0XIS/9tv hrrs1bXJ1GZniJeRjeiWhy/SXvaZnLS/OOQGetstAwgsWmccTGNt1l7gjTrwRG0W5nBC 3vSoeqolbfdRr+liYLNt9cMaB2IUgl3BQUxC8DhbgkbJAozjILgOYHZQkEnH3j+WDldE FNW3oEzAeiHQXHxqaxJqckA5Dy5ZHgkHLoKYXKAqVs0qmXh6vhb0rEIcLeLrQkYtu//J 9qpQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=G4LgoH6X; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 bv16-20020a170906b1d000b007809c50fd78si18884635ejb.262.2022.10.22.01.43.49; Sat, 22 Oct 2022 01:44: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=G4LgoH6X; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S234784AbiJVImp (ORCPT + 99 others); Sat, 22 Oct 2022 04:42:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52864 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234905AbiJVIkg (ORCPT ); Sat, 22 Oct 2022 04:40:36 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1EA202C6E09; Sat, 22 Oct 2022 01:06: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 69014B82E0D; Sat, 22 Oct 2022 08:04:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C55E3C433C1; Sat, 22 Oct 2022 08:04:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425866; bh=8HZAZLu18rQXJO9oL8pm8b+Lx0P+qsOk9LqgjcoX2Zg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=G4LgoH6XFr7ofdCTfe1HJzduxkBJChDG3sbyO5ML5dpYKPQdE7W+kEcNiQEhT5dO/ P4HJrh4WX0HAXKHSBtNY8MTDTLP6ejIyB7oxaxYlSBmKUpr85JStysuOwdNjzsm0OX 3ns8qzOHU/qANonkRXGj0GXIWnW/wx8Nf437HdXA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sebastian Krzyszkowiak , Martin Kepplinger , Shawn Guo , Sasha Levin Subject: [PATCH 5.19 641/717] arm64: dts: imx8mq-librem5: Add bq25895 as max17055s power supply Date: Sat, 22 Oct 2022 09:28:40 +0200 Message-Id: <20221022072526.789058181@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376672173613176?= X-GMAIL-MSGID: =?utf-8?q?1747376672173613176?= From: Sebastian Krzyszkowiak [ Upstream commit 6effe295e1a87408033c29dbcea9d5a5c8b937d5 ] This allows the userspace to notice that there's not enough current provided to charge the battery, and also fixes issues with 0% SOC values being considered invalid. Signed-off-by: Sebastian Krzyszkowiak Signed-off-by: Martin Kepplinger Signed-off-by: Shawn Guo Signed-off-by: Sasha Levin --- arch/arm64/boot/dts/freescale/imx8mq-librem5.dtsi | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm64/boot/dts/freescale/imx8mq-librem5.dtsi b/arch/arm64/boot/dts/freescale/imx8mq-librem5.dtsi index 587e55aaa57b..11f56138c533 100644 --- a/arch/arm64/boot/dts/freescale/imx8mq-librem5.dtsi +++ b/arch/arm64/boot/dts/freescale/imx8mq-librem5.dtsi @@ -1077,6 +1077,7 @@ interrupts = <20 IRQ_TYPE_LEVEL_LOW>; pinctrl-names = "default"; pinctrl-0 = <&pinctrl_gauge>; + power-supplies = <&bq25895>; maxim,over-heat-temp = <700>; maxim,over-volt = <4500>; maxim,rsns-microohm = <5000>; From patchwork Sat Oct 22 07: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: 7650 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1107872wrr; Sat, 22 Oct 2022 01:42:21 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6WQR0uYa3+OdAsKwsUAx8AATljlZnIVBY3lEJFkO4AjM/yCx9sERrnrBEpjPnCRM2t09Qa X-Received: by 2002:aa7:ce92:0:b0:461:78c7:dfe2 with SMTP id y18-20020aa7ce92000000b0046178c7dfe2mr2034854edv.342.1666428141333; Sat, 22 Oct 2022 01:42:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666428141; cv=none; d=google.com; s=arc-20160816; b=hCjCUVn2/J022Jr9VkQ2wthanPh6bFl41xeIh8vtVsHxHlxFWpBwQM++rldtZTfSBl mfu2APo5onMNz/PHRbjsdoYb7YWwvDMTK+gowavqXN8m6gfXp9Sqfigs5gdNLkxb1+BJ UWtobGjD1zeAIQWWnQ+8GE1soa8/YWV6rfkn/2dpIRK+dZwod58emfQnK5MLPDTUhnI7 my8J2KTOhUMSfbDB+T/hUFvHwXaJziBiWvNulQlLbA2ec1TCpZ0ZBC1KKUGXI8G4VTup BIwgXbyuTBDxVjRmlkeMGTomraOB3p7Y6oqFxuK/b559CJHBmdIQkw5InrGC+b75oQeM t4ww== 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=2Dy5fW4udrPL9eT64rpudFX1d89p05yNbSniuvel9pc=; b=CWdoR1z+liwbozwWpWbVZ8Qqj0vUZiDhmU0CUN1Berst8cPka7ewkEWIwCSpFXjthY aow7V0D//nAUT+Acigkf2s6tbNo0kHTDIQHBSFtiJLCNCyL9ZLFfwS7z1qvPzRKHWIgd db48DwV4sTwRRON0IpW9AjsNt96CGhn5KD4CmAISVEs0TO+zimCqY0DrxNLlyRYMHhTB XYnsM92WxES9//fkOZpf3PW3xW8aBzmRv47vIzRlIsPPfLsXONrJWqYfkdgfB+f429Fm NFvmm/ToYTf3jQKjBkGoqjOT1islokZKshnYhEimfks0t8hbZc44t+GblPWITu5GEwhW pwRQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=HCWCIZbJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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-20020a056402190900b0045d9ceae633si19035680edz.55.2022.10.22.01.41.55; Sat, 22 Oct 2022 01: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=HCWCIZbJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S234333AbiJVIkv (ORCPT + 99 others); Sat, 22 Oct 2022 04:40:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54780 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234514AbiJVIfn (ORCPT ); Sat, 22 Oct 2022 04:35: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 48B71491C2; Sat, 22 Oct 2022 01:04: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 E871C60B8C; Sat, 22 Oct 2022 08:04:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DF183C433D6; Sat, 22 Oct 2022 08:04:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425869; bh=TlFvzsGM4Nex1avejFrjzErcNggEJVizUEc0EWbwmEE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HCWCIZbJ+BfSgD1rMQ04suN/eiJXWuZkubvyS7BPtr6Rboo+9fv6zH+b7Nqzq3G8O Iw4vdUitwmN5jqx9fUuSsSVyla6D2OedR1qa0estQD8++GplGKc0Q9qQaVFXoGGrl/ iPSvNSKxgZHVP3sACh3MI6Ne6sKLel5qtiHR/UjY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Anand Jain , Qu Wenruo , David Sterba , Sasha Levin Subject: [PATCH 5.19 642/717] btrfs: dump extra info if one free space cache has more bitmaps than it should Date: Sat, 22 Oct 2022 09:28:41 +0200 Message-Id: <20221022072526.841385048@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376554778350409?= X-GMAIL-MSGID: =?utf-8?q?1747376554778350409?= From: Qu Wenruo [ Upstream commit 62cd9d4474282a1eb84f945955c56cbfc42e1ffe ] There is an internal report on hitting the following ASSERT() in recalculate_thresholds(): ASSERT(ctl->total_bitmaps <= max_bitmaps); Above @max_bitmaps is calculated using the following variables: - bytes_per_bg 8 * 4096 * 4096 (128M) for x86_64/x86. - block_group->length The length of the block group. @max_bitmaps is the rounded up value of block_group->length / 128M. Normally one free space cache should not have more bitmaps than above value, but when it happens the ASSERT() can be triggered if CONFIG_BTRFS_ASSERT is also enabled. But the ASSERT() itself won't provide enough info to know which is going wrong. Is the bg too small thus it only allows one bitmap? Or is there something else wrong? So although I haven't found extra reports or crash dump to do further investigation, add the extra info to make it more helpful to debug. Reviewed-by: Anand Jain Signed-off-by: Qu Wenruo Reviewed-by: David Sterba Signed-off-by: David Sterba Signed-off-by: Sasha Levin --- fs/btrfs/free-space-cache.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/fs/btrfs/free-space-cache.c b/fs/btrfs/free-space-cache.c index b1ae3ba2ca2c..16710d4571da 100644 --- a/fs/btrfs/free-space-cache.c +++ b/fs/btrfs/free-space-cache.c @@ -693,6 +693,12 @@ static void recalculate_thresholds(struct btrfs_free_space_ctl *ctl) max_bitmaps = max_t(u64, max_bitmaps, 1); + if (ctl->total_bitmaps > max_bitmaps) + btrfs_err(block_group->fs_info, +"invalid free space control: bg start=%llu len=%llu total_bitmaps=%u unit=%u max_bitmaps=%llu bytes_per_bg=%llu", + block_group->start, block_group->length, + ctl->total_bitmaps, ctl->unit, max_bitmaps, + bytes_per_bg); ASSERT(ctl->total_bitmaps <= max_bitmaps); /* From patchwork Sat Oct 22 07: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: 7671 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1108292wrr; Sat, 22 Oct 2022 01:44:15 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6ShsC4e9xmlqJQk4k1wbcVRcz5ANhXHDA/+Zh3u2AycY2CSlsIUdPjttSGsze5PJjinkEm X-Received: by 2002:a17:906:1e08:b0:73d:c724:4876 with SMTP id g8-20020a1709061e0800b0073dc7244876mr18723462ejj.62.1666428255055; Sat, 22 Oct 2022 01:44:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666428255; cv=none; d=google.com; s=arc-20160816; b=ngEKtSEFFFxIraOn9d09GzkGASJNucMIn+5NCPSA2ju6HVsEonNFjvYPE9+IhxlTpx 0mrjG7wO72ZzUXayEmjLlcCfg42Hkbl56/LHvIjooloWyTIRRYiNat00r/tcLT/uUm/q 9GBqHZ3FvDBQzZ9s17k+L6bn429bT7sG8LZjQ4T1XlwKXiwkkuWkjD+W126RZTRElSOW ILj3Gha+Xkkr2wub/ak2gRtA66D0Eof8a5LDQzceWGXRGpPj0e31N3aOIZVHeEFmbSWr x/vcMV5jdz0GfvcvhbRHoIQmlnLn2UNi7BpgPcwMns0KhqiWQgGiKjZ3rfkgb3feIF5r D//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=kG5S2myMqDGABm6ic1Di4sDJQBZXAv2jT6pB3OL6J7c=; b=G0lFd8Io11Pnd9TwEYwIZIZoNluxvCrvD8qsyIxd7pMMLg/obbyEe8WNcf8CxpWmX0 NzRzz96Cs/uAYvuUcKsBf+Rpo33JnaJdN7zQB8NsAggPp2CvRiDrOtpOhxy6TlPFkLvs GB99fEFQie4o9KQwh4OsQeUloAr9u7H5uLUo8YTVCT2Ayw/42cylQXKwnHVRhgRcvS+g SPWkz8t5zEvsIw7k1PoGzO00j0NitBU4DB0kWQu28pBB/JTJDhjm+IJ0zCWRSgSdBdcd qQPmLKqHdsperhaqwM1A1mKLWJTr9RAzwmFr4mw667KtW1RV6OEZlSiAD+o9stOHFjAZ a88w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=teeoaA1h; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 y18-20020a50e612000000b0045caa1628c6si20631639edm.216.2022.10.22.01.43.51; Sat, 22 Oct 2022 01:44: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=teeoaA1h; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S234803AbiJVImr (ORCPT + 99 others); Sat, 22 Oct 2022 04:42:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51872 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234293AbiJVIkq (ORCPT ); Sat, 22 Oct 2022 04:40: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 EC0C22E7144; Sat, 22 Oct 2022 01:06: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 C2C62B82DF1; Sat, 22 Oct 2022 08:04:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2B061C433C1; Sat, 22 Oct 2022 08:04:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425872; bh=mZXZ26tA7ttCTsWuOIwX3tsboXgN7RDn17R3Kdc+NzI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=teeoaA1hurxO8/6gpC90UGqrk1tahzLWJQvtnn3MXDwT3AI3X9bkBGEOeLWyn/sa3 iTBySWPVtziZW9XrHCKoZGzpi2T5yuq+a9isJ8O8mJLxiH24bdaz4d3RXdLgJb5/LW vn94kF9kyXvv+T1rIHUWh7ezWwCuvcFYKQd5zd10= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Qu Wenruo , David Sterba , Sasha Levin Subject: [PATCH 5.19 643/717] btrfs: scrub: properly report super block errors in system log Date: Sat, 22 Oct 2022 09:28:42 +0200 Message-Id: <20221022072526.881175601@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376674101713460?= X-GMAIL-MSGID: =?utf-8?q?1747376674101713460?= From: Qu Wenruo [ Upstream commit e69bf81c9a339f1b2c041b112a6fbb9f60fc9340 ] [PROBLEM] Unlike data/metadata corruption, if scrub detected some error in the super block, the only error message is from the updated device status: BTRFS info (device dm-1): scrub: started on devid 2 BTRFS error (device dm-1): bdev /dev/mapper/test-scratch2 errs: wr 0, rd 0, flush 0, corrupt 1, gen 0 BTRFS info (device dm-1): scrub: finished on devid 2 with status: 0 This is not helpful at all. [CAUSE] Unlike data/metadata error reporting, there is no visible report in kernel dmesg to report supper block errors. In fact, return value of scrub_checksum_super() is intentionally skipped, thus scrub_handle_errored_block() will never be called for super blocks. [FIX] Make super block errors to output an error message, now the full dmesg would looks like this: BTRFS info (device dm-1): scrub: started on devid 2 BTRFS warning (device dm-1): super block error on device /dev/mapper/test-scratch2, physical 67108864 BTRFS error (device dm-1): bdev /dev/mapper/test-scratch2 errs: wr 0, rd 0, flush 0, corrupt 1, gen 0 BTRFS info (device dm-1): scrub: finished on devid 2 with status: 0 BTRFS info (device dm-1): scrub: started on devid 2 This fix involves: - Move the super_errors reporting to scrub_handle_errored_block() This allows the device status message to show after the super block error message. But now we no longer distinguish super block corruption and generation mismatch, now all counted as corruption. - Properly check the return value from scrub_checksum_super() - Add extra super block error reporting for scrub_print_warning(). Signed-off-by: Qu Wenruo Reviewed-by: David Sterba Signed-off-by: David Sterba Signed-off-by: Sasha Levin --- fs/btrfs/scrub.c | 33 ++++++++++++--------------------- 1 file changed, 12 insertions(+), 21 deletions(-) diff --git a/fs/btrfs/scrub.c b/fs/btrfs/scrub.c index e7b0323e6efd..f62bfa023178 100644 --- a/fs/btrfs/scrub.c +++ b/fs/btrfs/scrub.c @@ -731,6 +731,13 @@ static void scrub_print_warning(const char *errstr, struct scrub_block *sblock) dev = sblock->sectors[0]->dev; fs_info = sblock->sctx->fs_info; + /* Super block error, no need to search extent tree. */ + if (sblock->sectors[0]->flags & BTRFS_EXTENT_FLAG_SUPER) { + btrfs_warn_in_rcu(fs_info, "%s on device %s, physical %llu", + errstr, rcu_str_deref(dev->name), + sblock->sectors[0]->physical); + return; + } path = btrfs_alloc_path(); if (!path) return; @@ -806,7 +813,7 @@ static inline void scrub_put_recover(struct btrfs_fs_info *fs_info, static int scrub_handle_errored_block(struct scrub_block *sblock_to_check) { struct scrub_ctx *sctx = sblock_to_check->sctx; - struct btrfs_device *dev; + struct btrfs_device *dev = sblock_to_check->sectors[0]->dev; struct btrfs_fs_info *fs_info; u64 logical; unsigned int failed_mirror_index; @@ -827,13 +834,15 @@ static int scrub_handle_errored_block(struct scrub_block *sblock_to_check) fs_info = sctx->fs_info; if (sblock_to_check->sectors[0]->flags & BTRFS_EXTENT_FLAG_SUPER) { /* - * if we find an error in a super block, we just report it. + * If we find an error in a super block, we just report it. * They will get written with the next transaction commit * anyway */ + scrub_print_warning("super block error", sblock_to_check); spin_lock(&sctx->stat_lock); ++sctx->stat.super_errors; spin_unlock(&sctx->stat_lock); + btrfs_dev_stat_inc_and_print(dev, BTRFS_DEV_STAT_CORRUPTION_ERRS); return 0; } logical = sblock_to_check->sectors[0]->logical; @@ -842,7 +851,6 @@ static int scrub_handle_errored_block(struct scrub_block *sblock_to_check) is_metadata = !(sblock_to_check->sectors[0]->flags & BTRFS_EXTENT_FLAG_DATA); have_csum = sblock_to_check->sectors[0]->have_csum; - dev = sblock_to_check->sectors[0]->dev; if (!sctx->is_dev_replace && btrfs_repair_one_zone(fs_info, logical)) return 0; @@ -1773,7 +1781,7 @@ static int scrub_checksum(struct scrub_block *sblock) else if (flags & BTRFS_EXTENT_FLAG_TREE_BLOCK) ret = scrub_checksum_tree_block(sblock); else if (flags & BTRFS_EXTENT_FLAG_SUPER) - (void)scrub_checksum_super(sblock); + ret = scrub_checksum_super(sblock); else WARN_ON(1); if (ret) @@ -1912,23 +1920,6 @@ static int scrub_checksum_super(struct scrub_block *sblock) if (memcmp(calculated_csum, s->csum, sctx->fs_info->csum_size)) ++fail_cor; - if (fail_cor + fail_gen) { - /* - * if we find an error in a super block, we just report it. - * They will get written with the next transaction commit - * anyway - */ - spin_lock(&sctx->stat_lock); - ++sctx->stat.super_errors; - spin_unlock(&sctx->stat_lock); - if (fail_cor) - btrfs_dev_stat_inc_and_print(sector->dev, - BTRFS_DEV_STAT_CORRUPTION_ERRS); - else - btrfs_dev_stat_inc_and_print(sector->dev, - BTRFS_DEV_STAT_GENERATION_ERRS); - } - return fail_cor + fail_gen; } From patchwork Sat Oct 22 07:28: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: 7719 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1109886wrr; Sat, 22 Oct 2022 01:50:25 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5sDKaSf0PB53yrNp9MannBxioeLhVvPM3W3306/QJGGqzRVDIYVBBc9QRW7RyL7WBuMpWD X-Received: by 2002:a17:907:6296:b0:787:d066:9fcf with SMTP id nd22-20020a170907629600b00787d0669fcfmr18185269ejc.692.1666428625551; Sat, 22 Oct 2022 01:50:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666428625; cv=none; d=google.com; s=arc-20160816; b=d9TMQ1NoOnK2r3ye6iST13zYeeo5zfzGo52lxHW+195wtkS3yn5PkH3t8kQytoMhIV ehHJgyjrBYaJddkDIEXfsD31BKk1imKyL2sXMh/UOyLH/l9yhVAXpcUctdp8tyNKbFHG +3cjqHYm65crSHh00TkJgHeeiI1W3ANGQnjmqztqFGQyFYD3rL2QkHQtrOuDNX6O08XO lT1WLJrpFzmaBXU7RffnyBwzwByG72oJAPCPsok/l96wQgsc4gjY9/VwvzTsa3gSU0sZ H6YqILGaZe76mrwC7iusc/7njFpFtLtLm7B7f4RWG/DuSksQpWhNxEa5L9CF2FhkrdTh KP/g== 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=OMtXJ+eEuP4kibItUUryVP57CSD3RDZJ9K/PMH4Uce0=; b=nU4GnBbECrqsMvkvpyt5mef/fUXJpdBejeVxyf6wBu5XsI+wFxjjZgcXynnyufoIdl z15ixjD/jOXg8fGCe9KNQw5hXTJAKniqCjG2AekvK356j0fTzikXQ5fxQFcEJDpMhejX Uw5TC8sBV6XqkcrDj9EDQZmPkjFB/V6oVURi24NEdteHb6OGJ95Rl61VLtcuhG2ugIGU FPgpKhqDodhkodF5uX6wvvgoHY1E/cCjrk8+yEneWCcNH9GKxfLnhuHEXLRzOb2KO8jb 5HJhwIfjvb+xUI/AOUj3F6xvmQG333jj0osoVxZzvdRlM9yFTLtON+mMlIXS/0FBXLJp h88Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=MS0XXYfx; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 l9-20020a1709061c4900b00787af558937si18096463ejg.313.2022.10.22.01.50.01; Sat, 22 Oct 2022 01:50: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=MS0XXYfx; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S234377AbiJVIsg (ORCPT + 99 others); Sat, 22 Oct 2022 04:48:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45836 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235388AbiJVIp0 (ORCPT ); Sat, 22 Oct 2022 04:45:26 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 88DF832AA9; Sat, 22 Oct 2022 01:09: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 080D5B82E15; Sat, 22 Oct 2022 08:04:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3EFB8C433D6; Sat, 22 Oct 2022 08:04:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425875; bh=utvZx2zyUFJMYQMIX7YK1QsEzU1Uj+lHms/CgOf1vGE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MS0XXYfxUe+bf9I5/+0F3+4ijy5C3wdoEMORDnFWpPC1nMlgoxOtoWobJHaKvTmkK q68ckC29ASgB1PbVrcj+0TUj2o+YcLt9DLgcbjzcCqP2dgLlMV+c93H1OWXxcC7fTt TuCkgUMTzmwcqVlg2h/5chP437yXwNJh/zNj/2rY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Qu Wenruo , David Sterba , Sasha Levin Subject: [PATCH 5.19 644/717] btrfs: scrub: try to fix super block errors Date: Sat, 22 Oct 2022 09:28:43 +0200 Message-Id: <20221022072526.931023131@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747377062454890077?= X-GMAIL-MSGID: =?utf-8?q?1747377062454890077?= From: Qu Wenruo [ Upstream commit f9eab5f0bba76742af654f33d517bf62a0db8f12 ] [BUG] The following script shows that, although scrub can detect super block errors, it never tries to fix it: mkfs.btrfs -f -d raid1 -m raid1 $dev1 $dev2 xfs_io -c "pwrite 67108864 4k" $dev2 mount $dev1 $mnt btrfs scrub start -B $dev2 btrfs scrub start -Br $dev2 umount $mnt The first scrub reports the super error correctly: scrub done for f3289218-abd3-41ac-a630-202f766c0859 Scrub started: Tue Aug 2 14:44:11 2022 Status: finished Duration: 0:00:00 Total to scrub: 1.26GiB Rate: 0.00B/s Error summary: super=1 Corrected: 0 Uncorrectable: 0 Unverified: 0 But the second read-only scrub still reports the same super error: Scrub started: Tue Aug 2 14:44:11 2022 Status: finished Duration: 0:00:00 Total to scrub: 1.26GiB Rate: 0.00B/s Error summary: super=1 Corrected: 0 Uncorrectable: 0 Unverified: 0 [CAUSE] The comments already shows that super block can be easily fixed by committing a transaction: /* * If we find an error in a super block, we just report it. * They will get written with the next transaction commit * anyway */ But the truth is, such assumption is not always true, and since scrub should try to repair every error it found (except for read-only scrub), we should really actively commit a transaction to fix this. [FIX] Just commit a transaction if we found any super block errors, after everything else is done. We cannot do this just after scrub_supers(), as btrfs_commit_transaction() will try to pause and wait for the running scrub, thus we can not call it with scrub_lock hold. Signed-off-by: Qu Wenruo Reviewed-by: David Sterba Signed-off-by: David Sterba Signed-off-by: Sasha Levin --- fs/btrfs/scrub.c | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/fs/btrfs/scrub.c b/fs/btrfs/scrub.c index f62bfa023178..a14f97bf2a40 100644 --- a/fs/btrfs/scrub.c +++ b/fs/btrfs/scrub.c @@ -4112,6 +4112,7 @@ int btrfs_scrub_dev(struct btrfs_fs_info *fs_info, u64 devid, u64 start, int ret; struct btrfs_device *dev; unsigned int nofs_flag; + bool need_commit = false; if (btrfs_fs_closing(fs_info)) return -EAGAIN; @@ -4215,6 +4216,12 @@ int btrfs_scrub_dev(struct btrfs_fs_info *fs_info, u64 devid, u64 start, */ nofs_flag = memalloc_nofs_save(); if (!is_dev_replace) { + u64 old_super_errors; + + spin_lock(&sctx->stat_lock); + old_super_errors = sctx->stat.super_errors; + spin_unlock(&sctx->stat_lock); + btrfs_info(fs_info, "scrub: started on devid %llu", devid); /* * by holding device list mutex, we can @@ -4223,6 +4230,16 @@ int btrfs_scrub_dev(struct btrfs_fs_info *fs_info, u64 devid, u64 start, mutex_lock(&fs_info->fs_devices->device_list_mutex); ret = scrub_supers(sctx, dev); mutex_unlock(&fs_info->fs_devices->device_list_mutex); + + spin_lock(&sctx->stat_lock); + /* + * Super block errors found, but we can not commit transaction + * at current context, since btrfs_commit_transaction() needs + * to pause the current running scrub (hold by ourselves). + */ + if (sctx->stat.super_errors > old_super_errors && !sctx->readonly) + need_commit = true; + spin_unlock(&sctx->stat_lock); } if (!ret) @@ -4249,6 +4266,25 @@ int btrfs_scrub_dev(struct btrfs_fs_info *fs_info, u64 devid, u64 start, scrub_workers_put(fs_info); scrub_put_ctx(sctx); + /* + * We found some super block errors before, now try to force a + * transaction commit, as scrub has finished. + */ + if (need_commit) { + struct btrfs_trans_handle *trans; + + trans = btrfs_start_transaction(fs_info->tree_root, 0); + if (IS_ERR(trans)) { + ret = PTR_ERR(trans); + btrfs_err(fs_info, + "scrub: failed to start transaction to fix super block errors: %d", ret); + return ret; + } + ret = btrfs_commit_transaction(trans); + if (ret < 0) + btrfs_err(fs_info, + "scrub: failed to commit transaction to fix super block errors: %d", ret); + } return ret; out: scrub_workers_put(fs_info); From patchwork Sat Oct 22 07: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: 7653 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1107930wrr; Sat, 22 Oct 2022 01:42:35 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6kF7LQLzwTQbyea2CXGWI9OYF9K80iHt1ZhHE/3WtePBLxmMAnBW/FtSLWyRlFbBhrwl3J X-Received: by 2002:a05:6402:2146:b0:458:15d7:b99a with SMTP id bq6-20020a056402214600b0045815d7b99amr21437404edb.24.1666428153007; Sat, 22 Oct 2022 01:42:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666428153; cv=none; d=google.com; s=arc-20160816; b=aHJye7n0oAk5XG/uQGKRsjClfSXqCZVRsyps3u62vbNgZ6nlR8QqX1VbfE0teMFWGr +SKCGj6613QLnC8sn0vCLxqekNHpIKpCbq30ap50Lfq7FPjjF1HD4mNQSpQww1+92SeB TAeDQW3KG3DMniiB6IEyiMBW/qE+AzfY/4T6lmHogI0aYnkcn2KuTEUVIT4DGAqbCQxs bReI0H+BZX7yNWFgqgthmFCoi0tHlfsAtGxXZ5MsNKjXWoHYo9OTSWzbhAb8UiGU/jeQ qnfWMvhnvPId2nuTx3tl/iwdU2gijOGShu9Z+0aM2T/7+GTOFhZEJvZiw6IY3+YEGt+M lheQ== 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=8/5WGQOgUtJF04iD3l19K1Z/hBtmCUYVubVnCh/OhSs=; b=mBlFtELyttg2iGS2ycHzZaqQh0KvnOsXJ8b7txJMr+gH4a4CDQDFGPYZpNpd9L2z/Y n0H4x9q9lV00EfIeVSTTZGT4nRxye9vybQXGztWuFMRzh+p1ydK2hUe3x4aN0MGrdi9/ xoUcN4xUVeuenJXgggvuiNS+Nco4qbLBC4K4QN2wTMYb0qGWNJugohedfAEKjm5BeNI2 fn8dREjZrUlxGTPBnn/PqfdYJ5u1RmIkGTR65nbsC0GdYt2gBNPPpTloRGQ8xC2O0nkm V/ZbOZu3cgklAcssEteNSCBFOfUyLbca599c/n+bPaTgL8wMAafsQowlQntRv5Y4Wuge D4OA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=pp7HeD1k; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 hd35-20020a17090796a300b0078df86528d3si24857189ejc.99.2022.10.22.01.42.08; Sat, 22 Oct 2022 01: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=pp7HeD1k; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S234420AbiJVIlE (ORCPT + 99 others); Sat, 22 Oct 2022 04:41:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56922 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234553AbiJVIfu (ORCPT ); Sat, 22 Oct 2022 04:35: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 075604D260; Sat, 22 Oct 2022 01:04: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 4ACBF60ADF; Sat, 22 Oct 2022 08:04:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 46681C433D6; Sat, 22 Oct 2022 08:04:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425878; bh=4O5d+EgAI+grdQT/IsMomF8H66EeYR+P3dOvQGe44kc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pp7HeD1k3XnWleu6sWx/oQrb32agnj2l72dqUDPQNv8hpqMIq01ZEjH1kePP5SM3Z 2afNEXpHBwyfyspgV+SZemZvQAmswPFvwjRPNj+FkMvR2KTofQwqFoZcKNGKnW8Q// ikTYAV+oSAmK90HCXI+JNGxHVwAtzKxgGYaBdEmE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Maciej S. Szmigiero" , David Sterba , Sasha Levin Subject: [PATCH 5.19 645/717] btrfs: dont print information about space cache or tree every remount Date: Sat, 22 Oct 2022 09:28:44 +0200 Message-Id: <20221022072526.979757336@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376567009152160?= X-GMAIL-MSGID: =?utf-8?q?1747376567009152160?= From: Maciej S. Szmigiero [ Upstream commit dbecac26630014d336a8e5ea67096ff18210fb9c ] btrfs currently prints information about space cache or free space tree being in use on every remount, regardless whether such remount actually enabled or disabled one of these features. This is actually unnecessary since providing remount options changing the state of these features will explicitly print the appropriate notice. Let's instead print such unconditional information just on an initial mount to avoid filling the kernel log when, for example, laptop-mode-tools remount the fs on some events. Signed-off-by: Maciej S. Szmigiero Reviewed-by: David Sterba Signed-off-by: David Sterba Signed-off-by: Sasha Levin --- fs/btrfs/super.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c index 72923496490f..b2a5291e5e4b 100644 --- a/fs/btrfs/super.c +++ b/fs/btrfs/super.c @@ -625,6 +625,7 @@ int btrfs_parse_options(struct btrfs_fs_info *info, char *options, int saved_compress_level; bool saved_compress_force; int no_compress = 0; + const bool remounting = test_bit(BTRFS_FS_STATE_REMOUNTING, &info->fs_state); if (btrfs_fs_compat_ro(info, FREE_SPACE_TREE)) btrfs_set_opt(info->mount_opt, FREE_SPACE_TREE); @@ -1136,10 +1137,12 @@ int btrfs_parse_options(struct btrfs_fs_info *info, char *options, } if (!ret) ret = btrfs_check_mountopts_zoned(info); - if (!ret && btrfs_test_opt(info, SPACE_CACHE)) - btrfs_info(info, "disk space caching is enabled"); - if (!ret && btrfs_test_opt(info, FREE_SPACE_TREE)) - btrfs_info(info, "using free space tree"); + if (!ret && !remounting) { + if (btrfs_test_opt(info, SPACE_CACHE)) + btrfs_info(info, "disk space caching is enabled"); + if (btrfs_test_opt(info, FREE_SPACE_TREE)) + btrfs_info(info, "using free space tree"); + } return ret; } From patchwork Sat Oct 22 07: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: 7761 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1120746wrr; Sat, 22 Oct 2022 02:26:19 -0700 (PDT) X-Google-Smtp-Source: AMsMyM46lgosPxbi4iTneNHrxw4EFru1KyOOXAbpFOIRF1c2Nnlly8lief7Vn8WRoncRwAHsRyOA X-Received: by 2002:a05:6402:2211:b0:461:5d0a:6678 with SMTP id cq17-20020a056402221100b004615d0a6678mr5026208edb.378.1666430778854; Sat, 22 Oct 2022 02:26:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666430778; cv=none; d=google.com; s=arc-20160816; b=aRXyfir+Wk4O5aOet/geZT1xOFReGqPRrgFlDR7TitYwe730hSbCooqWD5q0VWJiYE lLJ23JcJnOOgin57VEc/s5Ezccv7YcQ8bf8F4YO2pmNyPPQXH95vwd5rSPNl5oND+mOH qWEK23QodcyYtUA7mRbG+GykQD9AK9wUO3Py85gDFgP2jVzm/tP1CXIK/6jeWx/p7byW +JSLDTdue66KWB/KtMBQTZ3HyFvaWNo11AhvZKSoc8eqGsQPgmMRLkbf+hiYajFTSMoB MEue3AMUzM8reJog31qQc/oJz40ys/AhOkyty/OO7ePor3UITUOT2FVK/Mbpp7Zy0HgX zBBQ== 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=wytThTImOBRPJ0d12pVMCynEebnkKc7zTfPv9FhUm84=; b=fDlMotT6I8SDL8Gh/+P27yc4ofS1iZsfALJV9aq/LoGzAM3RXKqHBUhxExDBaUyPIo zhi45z59fa2VYuh5W3zTEtOl5aEq/Yf6VRLuNCzGbFGpbz/dBz4hiK6JdQnF9m6ixAqi laNqwuBonXk3QjFzomNddHTj8yrnOTjBaTRM7tx+VzfJKLjPIk3zWFahz+Ry6xbJk17g W6KmGzMlcHe8Q2tFhyswapuoThvfwnASCjP3lc3crkBV8qnqGVd7Uqz5T50KClMsV6JW Bb0T5RHG/9M62uOZEpQ2kAzMzFURjuCuPscHRqeKFWYdSLR3qUOdR6BF74VFDpVQBbBl cOYg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="Na9M/vZP"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 s11-20020a056402014b00b0045ca331c2ebsi19175595edu.232.2022.10.22.02.25.53; Sat, 22 Oct 2022 02:26: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="Na9M/vZP"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S235055AbiJVJAs (ORCPT + 99 others); Sat, 22 Oct 2022 05:00:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37036 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235173AbiJVI7U (ORCPT ); Sat, 22 Oct 2022 04:59:20 -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 0A7B9295B1F; Sat, 22 Oct 2022 01:16: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 3E44F60B23; Sat, 22 Oct 2022 08:04:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 40393C433C1; Sat, 22 Oct 2022 08:04:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425881; bh=68QUrxDYF+PVlFxrrny2cf5HOMi/5kXxGhpmdQA+QS0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Na9M/vZPiCzv5xFqRVLiJnppF0aEVWQtqopCGDV/5Qz1mN6frcoUICehK6Uu3Rifk +N3Pr6lqkS3Nm/kRzAemTEd4qcAZGfeDVqodOgeQSiw4+2/p1n+pQeW9cUn0mqOnCV 0shRMDaGJu+ZxK7eOkSPmCN79oHJw/HRdzzmib6Y= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Josef Bacik , David Sterba , Sasha Levin Subject: [PATCH 5.19 646/717] btrfs: call __btrfs_remove_free_space_cache_locked on cache load failure Date: Sat, 22 Oct 2022 09:28:45 +0200 Message-Id: <20221022072527.027923827@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747379320343256376?= X-GMAIL-MSGID: =?utf-8?q?1747379320343256376?= From: Josef Bacik [ Upstream commit 8a1ae2781dee9fc21ca82db682d37bea4bd074ad ] Now that lockdep is staying enabled through our entire CI runs I started seeing the following stack in generic/475 ------------[ cut here ]------------ WARNING: CPU: 1 PID: 2171864 at fs/btrfs/discard.c:604 btrfs_discard_update_discardable+0x98/0xb0 CPU: 1 PID: 2171864 Comm: kworker/u4:0 Not tainted 5.19.0-rc8+ #789 Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.13.0-2.fc32 04/01/2014 Workqueue: btrfs-cache btrfs_work_helper RIP: 0010:btrfs_discard_update_discardable+0x98/0xb0 RSP: 0018:ffffb857c2f7bad0 EFLAGS: 00010246 RAX: 0000000000000000 RBX: ffff8c85c605c200 RCX: 0000000000000001 RDX: 0000000000000000 RSI: ffffffff86807c5b RDI: ffffffff868a831e RBP: ffff8c85c4c54000 R08: 0000000000000000 R09: 0000000000000000 R10: ffff8c85c66932f0 R11: 0000000000000001 R12: ffff8c85c3899010 R13: ffff8c85d5be4f40 R14: ffff8c85c4c54000 R15: ffff8c86114bfa80 FS: 0000000000000000(0000) GS:ffff8c863bd00000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007f2e7f168160 CR3: 000000010289a004 CR4: 0000000000370ee0 Call Trace: __btrfs_remove_free_space_cache+0x27/0x30 load_free_space_cache+0xad2/0xaf0 caching_thread+0x40b/0x650 ? lock_release+0x137/0x2d0 btrfs_work_helper+0xf2/0x3e0 ? lock_is_held_type+0xe2/0x140 process_one_work+0x271/0x590 ? process_one_work+0x590/0x590 worker_thread+0x52/0x3b0 ? process_one_work+0x590/0x590 kthread+0xf0/0x120 ? kthread_complete_and_exit+0x20/0x20 ret_from_fork+0x1f/0x30 This is the code ctl = block_group->free_space_ctl; discard_ctl = &block_group->fs_info->discard_ctl; lockdep_assert_held(&ctl->tree_lock); We have a temporary free space ctl for loading the free space cache in order to avoid having allocations happening while we're loading the cache. When we hit an error we free it all up, however this also calls btrfs_discard_update_discardable, which requires block_group->free_space_ctl->tree_lock to be held. However this is our temporary ctl so this lock isn't held. Fix this by calling __btrfs_remove_free_space_cache_locked instead so that we only clean up the entries and do not mess with the discardable stats. Signed-off-by: Josef Bacik Signed-off-by: David Sterba Signed-off-by: Sasha Levin --- fs/btrfs/free-space-cache.c | 53 +++++++++++++++++++++++++++----------------- 1 file changed, 33 insertions(+), 20 deletions(-) --- a/fs/btrfs/free-space-cache.c +++ b/fs/btrfs/free-space-cache.c @@ -48,6 +48,25 @@ static void bitmap_clear_bits(struct btr struct btrfs_free_space *info, u64 offset, u64 bytes, bool update_stats); +static void __btrfs_remove_free_space_cache_locked( + struct btrfs_free_space_ctl *ctl) +{ + struct btrfs_free_space *info; + struct rb_node *node; + + while ((node = rb_last(&ctl->free_space_offset)) != NULL) { + info = rb_entry(node, struct btrfs_free_space, offset_index); + if (!info->bitmap) { + unlink_free_space(ctl, info, true); + kmem_cache_free(btrfs_free_space_cachep, info); + } else { + free_bitmap(ctl, info); + } + + cond_resched_lock(&ctl->tree_lock); + } +} + static struct inode *__lookup_free_space_inode(struct btrfs_root *root, struct btrfs_path *path, u64 offset) @@ -881,7 +900,14 @@ out: return ret; free_cache: io_ctl_drop_pages(&io_ctl); - __btrfs_remove_free_space_cache(ctl); + + /* + * We need to call the _locked variant so we don't try to update the + * discard counters. + */ + spin_lock(&ctl->tree_lock); + __btrfs_remove_free_space_cache_locked(ctl); + spin_unlock(&ctl->tree_lock); goto out; } @@ -1007,7 +1033,13 @@ int load_free_space_cache(struct btrfs_b if (ret == 0) ret = 1; } else { + /* + * We need to call the _locked variant so we don't try to update + * the discard counters. + */ + spin_lock(&tmp_ctl.tree_lock); __btrfs_remove_free_space_cache(&tmp_ctl); + spin_unlock(&tmp_ctl.tree_lock); btrfs_warn(fs_info, "block group %llu has wrong amount of free space", block_group->start); @@ -2970,25 +3002,6 @@ static void __btrfs_return_cluster_to_fr btrfs_put_block_group(block_group); } -static void __btrfs_remove_free_space_cache_locked( - struct btrfs_free_space_ctl *ctl) -{ - struct btrfs_free_space *info; - struct rb_node *node; - - while ((node = rb_last(&ctl->free_space_offset)) != NULL) { - info = rb_entry(node, struct btrfs_free_space, offset_index); - if (!info->bitmap) { - unlink_free_space(ctl, info, true); - kmem_cache_free(btrfs_free_space_cachep, info); - } else { - free_bitmap(ctl, info); - } - - cond_resched_lock(&ctl->tree_lock); - } -} - void __btrfs_remove_free_space_cache(struct btrfs_free_space_ctl *ctl) { spin_lock(&ctl->tree_lock); From patchwork Sat Oct 22 07: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: 7658 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1108059wrr; Sat, 22 Oct 2022 01:43:09 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5ki5w/z9cjNtfLsalKOulD5VTDRrCLYkyxw9F8WRsfcdPzBi91ZZ/GA5RnkofYMFGRvbgt X-Received: by 2002:a17:907:b0b:b0:78d:8877:9f9e with SMTP id h11-20020a1709070b0b00b0078d88779f9emr18926337ejl.693.1666428189659; Sat, 22 Oct 2022 01:43:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666428189; cv=none; d=google.com; s=arc-20160816; b=JQLbMEMe0TxWXTByC8b/QXprbdIfR9DXhMd9p2s4DESubqO8GxQG8JdqUAqVUqwNPL RIogQQwmO8Uci9X6D6nGV+iDR0aZcZGBWNvOpmB5nOwZXHaRfLqYE4/krWz+eCj7yxU4 GU2SGTYt3Ma4iWp6hrSelqqmZ8hqL0gDN0r97yEMWdufGEl7I0yl5gmE/eQmG3WFaSJN wXCaLjeS8/1jUDsqzHigBiKpDG9nyg2TjO5wHa5p9YEjCzMktln4XeOo1iUR/R9QC25P sCkib43oWR2+C/+Wfco9o94JPi0P27jUSYOOMm3CD8My1cZAHiVruZ3RvF+Ln4SIdnWN CVSg== 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=bH4dHZzbIwvguSxePi0OwlXmu34A5nrw9qglcwJmnB4=; b=cImi2XBT5nsztqa254K6sOF8JAo2M+XPWIse5jf9XBuzR5Q6TDhFqr3WaBCtMcTsJf zksQFxXgw5mqKJeo80PJNK1fX+oU+rWNhX3AD1QHMCayXyf8nO4oHC49Rksx28h32cZR aMPHpTS9JKJB9K8QGDKsrM1oU52MLdW+GZ6ZmTHVr9/0wuo0L9r7TGB/yiP1EhcdLuwn 0p8OAmODlgBL9YOhtl7/ARFl30OluzPDNZaoaKrtkK/pP6x7fmU/8qx7ujzr3Pto6iex bBodoqEHIA4dEdrt265VDUU+gXVLaD0Ai/6YCYMt8jQ05CPLj4xPZyxgWrux/ya4rKmI YHKQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=SEI+ECDo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 qf1-20020a1709077f0100b007823754ecd5si968236ejc.43.2022.10.22.01.42.38; Sat, 22 Oct 2022 01:43: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=SEI+ECDo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S234447AbiJVIlO (ORCPT + 99 others); Sat, 22 Oct 2022 04:41:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53732 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234576AbiJVIfx (ORCPT ); Sat, 22 Oct 2022 04:35:53 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A118153D1D; Sat, 22 Oct 2022 01:04: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 4C18560ADC; Sat, 22 Oct 2022 08:04:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 53503C433D6; Sat, 22 Oct 2022 08:04:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425884; bh=eHV1aJFxZYib1ONBCUtCKxxKWY0nN7MLKb5IBx+tpRE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SEI+ECDov1noYbDcR7rOw8/SYsdf6k2sKvHpckl+8/cPgzNIIfFxDmi1wWRr57Egz 37w9Oum7wfS7jVna6YQKSoYELAeBxNZvsvi2ImNwVwQEwxct6ctLWA6uaK2sQ0HxNt HsqCO4xdgWWEFD845UrYhSa8LOZdM18+b8ODcZKM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Li Huafei , Linus Waleij , "Russell King (Oracle)" , Sasha Levin Subject: [PATCH 5.19 647/717] ARM: 9233/1: stacktrace: Skip frame pointer boundary check for call_with_stack() Date: Sat, 22 Oct 2022 09:28:46 +0200 Message-Id: <20221022072527.063409588@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376605401665014?= X-GMAIL-MSGID: =?utf-8?q?1747376605401665014?= From: Li Huafei [ Upstream commit 5854e4d8530e6ed4c2532a71a6b0474e199d44dd ] When using the frame pointer unwinder, it was found that the stack trace output of stack_trace_save() is incomplete if the stack contains call_with_stack(): [0x7f00002c] dump_stack_task+0x2c/0x90 [hrtimer] [0x7f0000a0] hrtimer_hander+0x10/0x18 [hrtimer] [0x801a67f0] __hrtimer_run_queues+0x1b0/0x3b4 [0x801a7350] hrtimer_run_queues+0xc4/0xd8 [0x801a597c] update_process_times+0x3c/0x88 [0x801b5a98] tick_periodic+0x50/0xd8 [0x801b5bf4] tick_handle_periodic+0x24/0x84 [0x8010ffc4] twd_handler+0x38/0x48 [0x8017d220] handle_percpu_devid_irq+0xa8/0x244 [0x80176e9c] generic_handle_domain_irq+0x2c/0x3c [0x8052e3a8] gic_handle_irq+0x7c/0x90 [0x808ab15c] generic_handle_arch_irq+0x60/0x80 [0x8051191c] call_with_stack+0x1c/0x20 For the frame pointer unwinder, unwind_frame() checks stackframe::fp by stackframe::sp. Since call_with_stack() switches the SP from one stack to another, stackframe::fp and stackframe: :sp will point to different stacks, so we can no longer check stackframe::fp by stackframe::sp. Skip checking stackframe::fp at this point to avoid this problem. Signed-off-by: Li Huafei Reviewed-by: Linus Waleij Signed-off-by: Russell King (Oracle) Signed-off-by: Sasha Levin --- arch/arm/kernel/stacktrace.c | 40 ++++++++++++++++++++++++++++------ arch/arm/lib/call_with_stack.S | 2 ++ 2 files changed, 35 insertions(+), 7 deletions(-) diff --git a/arch/arm/kernel/stacktrace.c b/arch/arm/kernel/stacktrace.c index d0fa2037460a..af87040b0353 100644 --- a/arch/arm/kernel/stacktrace.c +++ b/arch/arm/kernel/stacktrace.c @@ -9,6 +9,8 @@ #include #include +#include "reboot.h" + #if defined(CONFIG_FRAME_POINTER) && !defined(CONFIG_ARM_UNWIND) /* * Unwind the current stack frame and store the new register values in the @@ -39,29 +41,53 @@ * Note that with framepointer enabled, even the leaf functions have the same * prologue and epilogue, therefore we can ignore the LR value in this case. */ -int notrace unwind_frame(struct stackframe *frame) + +extern unsigned long call_with_stack_end; + +static int frame_pointer_check(struct stackframe *frame) { unsigned long high, low; unsigned long fp = frame->fp; + unsigned long pc = frame->pc; + + /* + * call_with_stack() is the only place we allow SP to jump from one + * stack to another, with FP and SP pointing to different stacks, + * skipping the FP boundary check at this point. + */ + if (pc >= (unsigned long)&call_with_stack && + pc < (unsigned long)&call_with_stack_end) + return 0; /* only go to a higher address on the stack */ low = frame->sp; high = ALIGN(low, THREAD_SIZE); -#ifdef CONFIG_CC_IS_CLANG /* check current frame pointer is within bounds */ +#ifdef CONFIG_CC_IS_CLANG if (fp < low + 4 || fp > high - 4) return -EINVAL; - - frame->sp = frame->fp; - frame->fp = READ_ONCE_NOCHECK(*(unsigned long *)(fp)); - frame->pc = READ_ONCE_NOCHECK(*(unsigned long *)(fp + 4)); #else - /* check current frame pointer is within bounds */ if (fp < low + 12 || fp > high - 4) return -EINVAL; +#endif + + return 0; +} + +int notrace unwind_frame(struct stackframe *frame) +{ + unsigned long fp = frame->fp; + + if (frame_pointer_check(frame)) + return -EINVAL; /* restore the registers from the stack frame */ +#ifdef CONFIG_CC_IS_CLANG + frame->sp = frame->fp; + frame->fp = READ_ONCE_NOCHECK(*(unsigned long *)(fp)); + frame->pc = READ_ONCE_NOCHECK(*(unsigned long *)(fp + 4)); +#else frame->fp = READ_ONCE_NOCHECK(*(unsigned long *)(fp - 12)); frame->sp = READ_ONCE_NOCHECK(*(unsigned long *)(fp - 8)); frame->pc = READ_ONCE_NOCHECK(*(unsigned long *)(fp - 4)); diff --git a/arch/arm/lib/call_with_stack.S b/arch/arm/lib/call_with_stack.S index 0a268a6c513c..5030d4e8d126 100644 --- a/arch/arm/lib/call_with_stack.S +++ b/arch/arm/lib/call_with_stack.S @@ -46,4 +46,6 @@ UNWIND( .setfp fpreg, sp ) pop {fpreg, pc} UNWIND( .fnend ) #endif + .globl call_with_stack_end +call_with_stack_end: ENDPROC(call_with_stack) From patchwork Sat Oct 22 07: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: 7663 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1108125wrr; Sat, 22 Oct 2022 01:43:27 -0700 (PDT) X-Google-Smtp-Source: AMsMyM68Sv5TWrg4Bg1h/w7QcN18hhBfLUaHvnCYiHJn8shw1lhhSZzj2a3hnvRJAHSIrWUqf0Xp X-Received: by 2002:a17:907:761b:b0:78d:4990:3f3e with SMTP id jx27-20020a170907761b00b0078d49903f3emr18906691ejc.228.1666428207250; Sat, 22 Oct 2022 01:43:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666428207; cv=none; d=google.com; s=arc-20160816; b=hZs0PqWvdsR2qEs9MFwCkgUfts/9sPHIwYbV4mKXYYv3mQAT2mgQzpZJjNgr0YZGg6 njA1wLjWx2aHxeysvu0r03gxAPVCO3O4r7qCeRTAVvO8FYTchcuxaVmvHFF+JR3Q4016 w1AEfdgogKQwtNynR/IbscmV62Gz3GRbXZC+bME+hVAEAyHZMqWbQIM6+R65Lwp2ac5j bEdcO5aUssafw7WKEVgFhTF3d3j4PNcsuk0fFAsGu5xoM+CUhyI8ghjnk2lTRiyMEpAr PQCI4Mr/xLvcnV+OjBSRHl1WoEKgJY5PkbWUxuYOzrJ6mPSWEgB2whpRZ2722eiYvM4U Bo6Q== 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=HgAW6ipeS5MKvobZvTgmL7Gernce+Vu46Dw3iRa2qXI=; b=x/AcSbZBDI7OZozbVhiY8Ay3UV2novfEYQ23B7304ZSrmGKDWXZ5xTZnnLJI4nVQo4 nmmV9vIeYss6NSQGJN9UCkZw9TEamiQgj5TcEpVz6ykOalnbKkfFk4Uh9PxKvMsXkwQZ 6FPn4f6K6uiKiQ1PdY0EqnQEXgVUJqESaGMtVh6mutjlUyncB92oM7FNVfGyxOddGzIk H8NTT46CjUx4E5DCwqdL9Y4y2wVnZ76BRG6brj7yo61h9BdPGyS/eWTR2Lhq0AFKyhs7 dYsxtzYQg5LhRaJ060ZZYr7ux15zpWiVu4t09ePmDWiIj53x4S1BwmF7Use0Qh6cwYfk 0EcA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=WsZoqnid; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 gt39-20020a1709072da700b00787e1d77943si24347311ejc.49.2022.10.22.01.42.56; Sat, 22 Oct 2022 01:43: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=WsZoqnid; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S234585AbiJVIlh (ORCPT + 99 others); Sat, 22 Oct 2022 04:41:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52594 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234190AbiJVIgW (ORCPT ); Sat, 22 Oct 2022 04:36: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 A3E5B7C19D; Sat, 22 Oct 2022 01:04: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 dfw.source.kernel.org (Postfix) with ESMTPS id 70CF360AE4; Sat, 22 Oct 2022 08:04:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6D3AFC433C1; Sat, 22 Oct 2022 08:04:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425887; bh=G8CuIdsxyRmJZ0HZZZ+6AWbhH4w906IufRABNPKTnM0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WsZoqnid2zjCP5UrrDCskqv0M+XQ1NSRHCWFq4EY9MUZQnJj7fp7Wp88H9HCRIETo ErnYKF4gqfW/LWptduecfbdpA5MXrE/FY8yZBoPmj3ifzcr6trV6xTnVf/UoOWLPgP QMOIePdjdcLZn7jZHw3eSdjjdqtXlPqJW6VBCPoc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Li Huafei , Linus Waleij , "Russell King (Oracle)" , Sasha Levin Subject: [PATCH 5.19 648/717] ARM: 9234/1: stacktrace: Avoid duplicate saving of exception PC value Date: Sat, 22 Oct 2022 09:28:47 +0200 Message-Id: <20221022072527.102144435@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376623765587139?= X-GMAIL-MSGID: =?utf-8?q?1747376623765587139?= From: Li Huafei [ Upstream commit 752ec621ef5c30777958cc5eb5f1cf394f7733f4 ] Because an exception stack frame is not created in the exception entry, save_trace() does special handling for the exception PC, but this is only needed when CONFIG_FRAME_POINTER_UNWIND=y. When CONFIG_ARM_UNWIND=y, unwind annotations have been added to the exception entry and save_trace() will repeatedly save the exception PC: [0x7f000090] hrtimer_hander+0x8/0x10 [hrtimer] [0x8019ec50] __hrtimer_run_queues+0x18c/0x394 [0x8019f760] hrtimer_run_queues+0xbc/0xd0 [0x8019def0] update_process_times+0x34/0x80 [0x801ad2a4] tick_periodic+0x48/0xd0 [0x801ad3dc] tick_handle_periodic+0x1c/0x7c [0x8010f2e0] twd_handler+0x30/0x40 [0x80177620] handle_percpu_devid_irq+0xa0/0x23c [0x801718d0] generic_handle_domain_irq+0x24/0x34 [0x80502d28] gic_handle_irq+0x74/0x88 [0x8085817c] generic_handle_arch_irq+0x58/0x78 [0x80100ba8] __irq_svc+0x88/0xc8 [0x80108114] arch_cpu_idle+0x38/0x3c [0x80108114] arch_cpu_idle+0x38/0x3c <==== duplicate saved exception PC [0x80861bf8] default_idle_call+0x38/0x130 [0x8015d5cc] do_idle+0x150/0x214 [0x8015d978] cpu_startup_entry+0x18/0x1c [0x808589c0] rest_init+0xd8/0xdc [0x80c00a44] arch_post_acpi_subsys_init+0x0/0x8 We can move the special handling of the exception PC in save_trace() to the unwind_frame() of the frame pointer unwinder. Signed-off-by: Li Huafei Reviewed-by: Linus Waleij Signed-off-by: Russell King (Oracle) Signed-off-by: Sasha Levin --- arch/arm/include/asm/stacktrace.h | 6 +++++ arch/arm/kernel/return_address.c | 1 + arch/arm/kernel/stacktrace.c | 44 +++++++++++++++++++++---------- 3 files changed, 37 insertions(+), 14 deletions(-) diff --git a/arch/arm/include/asm/stacktrace.h b/arch/arm/include/asm/stacktrace.h index 3e78f921b8b2..39be2d1aa27b 100644 --- a/arch/arm/include/asm/stacktrace.h +++ b/arch/arm/include/asm/stacktrace.h @@ -21,6 +21,9 @@ struct stackframe { struct llist_node *kr_cur; struct task_struct *tsk; #endif +#ifdef CONFIG_UNWINDER_FRAME_POINTER + bool ex_frame; +#endif }; static __always_inline @@ -34,6 +37,9 @@ void arm_get_current_stackframe(struct pt_regs *regs, struct stackframe *frame) frame->kr_cur = NULL; frame->tsk = current; #endif +#ifdef CONFIG_UNWINDER_FRAME_POINTER + frame->ex_frame = in_entry_text(frame->pc); +#endif } extern int unwind_frame(struct stackframe *frame); diff --git a/arch/arm/kernel/return_address.c b/arch/arm/kernel/return_address.c index 8aac1e10b117..38f1ea9c724d 100644 --- a/arch/arm/kernel/return_address.c +++ b/arch/arm/kernel/return_address.c @@ -47,6 +47,7 @@ void *return_address(unsigned int level) frame.kr_cur = NULL; frame.tsk = current; #endif + frame.ex_frame = false; walk_stackframe(&frame, save_return_addr, &data); diff --git a/arch/arm/kernel/stacktrace.c b/arch/arm/kernel/stacktrace.c index af87040b0353..85443b5d1922 100644 --- a/arch/arm/kernel/stacktrace.c +++ b/arch/arm/kernel/stacktrace.c @@ -82,6 +82,27 @@ int notrace unwind_frame(struct stackframe *frame) if (frame_pointer_check(frame)) return -EINVAL; + /* + * When we unwind through an exception stack, include the saved PC + * value into the stack trace. + */ + if (frame->ex_frame) { + struct pt_regs *regs = (struct pt_regs *)frame->sp; + + /* + * We check that 'regs + sizeof(struct pt_regs)' (that is, + * ®s[1]) does not exceed the bottom of the stack to avoid + * accessing data outside the task's stack. This may happen + * when frame->ex_frame is a false positive. + */ + if ((unsigned long)®s[1] > ALIGN(frame->sp, THREAD_SIZE)) + return -EINVAL; + + frame->pc = regs->ARM_pc; + frame->ex_frame = false; + return 0; + } + /* restore the registers from the stack frame */ #ifdef CONFIG_CC_IS_CLANG frame->sp = frame->fp; @@ -98,6 +119,9 @@ int notrace unwind_frame(struct stackframe *frame) (void *)frame->fp, &frame->kr_cur); #endif + if (in_entry_text(frame->pc)) + frame->ex_frame = true; + return 0; } #endif @@ -128,7 +152,6 @@ static int save_trace(struct stackframe *frame, void *d) { struct stack_trace_data *data = d; struct stack_trace *trace = data->trace; - struct pt_regs *regs; unsigned long addr = frame->pc; if (data->no_sched_functions && in_sched_functions(addr)) @@ -139,19 +162,6 @@ static int save_trace(struct stackframe *frame, void *d) } trace->entries[trace->nr_entries++] = addr; - - if (trace->nr_entries >= trace->max_entries) - return 1; - - if (!in_entry_text(frame->pc)) - return 0; - - regs = (struct pt_regs *)frame->sp; - if ((unsigned long)®s[1] > ALIGN(frame->sp, THREAD_SIZE)) - return 0; - - trace->entries[trace->nr_entries++] = regs->ARM_pc; - return trace->nr_entries >= trace->max_entries; } @@ -193,6 +203,9 @@ static noinline void __save_stack_trace(struct task_struct *tsk, frame.kr_cur = NULL; frame.tsk = tsk; #endif +#ifdef CONFIG_UNWINDER_FRAME_POINTER + frame.ex_frame = false; +#endif walk_stackframe(&frame, save_trace, &data); } @@ -214,6 +227,9 @@ void save_stack_trace_regs(struct pt_regs *regs, struct stack_trace *trace) frame.kr_cur = NULL; frame.tsk = current; #endif +#ifdef CONFIG_UNWINDER_FRAME_POINTER + frame.ex_frame = in_entry_text(frame.pc); +#endif walk_stackframe(&frame, save_trace, &data); } From patchwork Sat Oct 22 07: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: 7754 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1114967wrr; Sat, 22 Oct 2022 02:09:02 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4ZbrVz1ZboYMm8tKiXxbYV6wnziicpmu1QSr7s9kCrBhOEsw8aSaLv1sUnBDdArnUk4ExR X-Received: by 2002:a17:902:bd47:b0:17f:685b:27ee with SMTP id b7-20020a170902bd4700b0017f685b27eemr22589345plx.22.1666429742620; Sat, 22 Oct 2022 02:09:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666429742; cv=none; d=google.com; s=arc-20160816; b=gxHXWJFD2CY7GnhSVoz3bVXuHhnbaXnlKWGzfZtm7qppldCBBsYI4EaKK/tuGQltMd n2Dx+xHd/IXj3erLQ5jVkQ7VxgDvpgkIsscvHoSkYbXFuh7C10EjXeVroAeydQiaHX3n tRFBMrBr/SBNuKRajYkU3GZr8zLcD0So7ycD76tP+dGIY4/7yL7kPhx/7q/gTO2K3fiy ZccuV+nc09nvBEHLFqvx6Sk+7HN0rdSx/UEdbbeYNzCv/epjEgCUTYkhoxnUiSEovtTw Ay7aRH+dzIoQY6wY5YfPtxnPU9LsDm1TR4GwRYnbsFu8UoRdxSDGx7gwhOXBRAGuJ1fb eU0A== 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=ZYKs19NpNds32LIG5eISO4IzsDRW1ep9Llc5g9G0PkQ=; b=WitIVD10QRkPfvtkVLvbIz7kWJJBCSXrwCn9zPChVuKa+kwWzAAlniN4wG+UlWV48L WsQukudsY0qzrmrxP/ZxMblDA2+yXCnXp24w6w3pMRJrpFEfBEqAAuD19DrfK0/ZNyqZ VP3kFgmDRMEMZkWXkIExm/5iik2lyDlkUYY2NXXss2y1QCspVqqw14PWH70lxn7kV/OI X1T0iHi2UDsLOQr39ujfA0A+ausDHfe7hkoIuaje222dDKoWfzPzYY5KTv8OSQP2c64e T2eJYSP8PVTvpbEndFU8brJXtUUihxp1TaJlvTgtrDpvLLbuuvGw2HSQUqrN25Q5M/bl XI1A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=1TZmoSMg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 cm4-20020a17090afa0400b00208606154f7si7338068pjb.117.2022.10.22.02.08.49; Sat, 22 Oct 2022 02:09: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=1TZmoSMg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S235048AbiJVI46 (ORCPT + 99 others); Sat, 22 Oct 2022 04:56:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43206 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230518AbiJVI4T (ORCPT ); Sat, 22 Oct 2022 04:56: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 745BB1F2FD; Sat, 22 Oct 2022 01:14: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 61B7E60B49; Sat, 22 Oct 2022 08:04:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6F76BC433C1; Sat, 22 Oct 2022 08:04:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425893; bh=TvPV0O+Kmdv7gIYS3XYbXJAt0YZQk0UJbeoYiMjrHmI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1TZmoSMgvPpNQEbxROGg+d88DmVkm459sgcEasXvu1uMTjz9cCPoW7CQp+FeXerp2 5/s9DtClFkia1QWgodDHupEjsUmUiN9+cf3xUmDVG5+57xLTlQiUwCYntFwF+rQQgz FUOAZCy25Q9pmW7j0BMNtUrvzOg5DzYChhj6NsN0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Linus Walleij , Alexander Sverdlin , "Russell King (Oracle)" , Sasha Levin Subject: [PATCH 5.19 649/717] ARM: 9242/1: kasan: Only map modules if CONFIG_KASAN_VMALLOC=n Date: Sat, 22 Oct 2022 09:28:48 +0200 Message-Id: <20221022072527.144212718@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747378233835765290?= X-GMAIL-MSGID: =?utf-8?q?1747378233835765290?= From: Alex Sverdlin [ Upstream commit 823f606ab6b4759a1faf0388abcf4fb0776710d2 ] In case CONFIG_KASAN_VMALLOC=y kasan_populate_vmalloc() allocates the shadow pages dynamically. But even worse is that kasan_release_vmalloc() releases them, which is not compatible with create_mapping() of MODULES_VADDR..MODULES_END range: BUG: Bad page state in process kworker/9:1 pfn:2068b page:e5e06160 refcount:0 mapcount:0 mapping:00000000 index:0x0 flags: 0x1000(reserved) raw: 00001000 e5e06164 e5e06164 00000000 00000000 00000000 ffffffff 00000000 page dumped because: PAGE_FLAGS_CHECK_AT_FREE flag(s) set bad because of flags: 0x1000(reserved) Modules linked in: ip_tables CPU: 9 PID: 154 Comm: kworker/9:1 Not tainted 5.4.188-... #1 Hardware name: LSI Axxia AXM55XX Workqueue: events do_free_init unwind_backtrace show_stack dump_stack bad_page free_pcp_prepare free_unref_page kasan_depopulate_vmalloc_pte __apply_to_page_range apply_to_existing_page_range kasan_release_vmalloc __purge_vmap_area_lazy _vm_unmap_aliases.part.0 __vunmap do_free_init process_one_work worker_thread kthread Reviewed-by: Linus Walleij Signed-off-by: Alexander Sverdlin Signed-off-by: Russell King (Oracle) Signed-off-by: Sasha Levin --- arch/arm/mm/kasan_init.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/arch/arm/mm/kasan_init.c b/arch/arm/mm/kasan_init.c index 5ad0d6c56d56..29d7233e5ad2 100644 --- a/arch/arm/mm/kasan_init.c +++ b/arch/arm/mm/kasan_init.c @@ -264,12 +264,17 @@ void __init kasan_init(void) /* * 1. The module global variables are in MODULES_VADDR ~ MODULES_END, - * so we need to map this area. + * so we need to map this area if CONFIG_KASAN_VMALLOC=n. With + * VMALLOC support KASAN will manage this region dynamically, + * refer to kasan_populate_vmalloc() and ARM's implementation of + * module_alloc(). * 2. PKMAP_BASE ~ PKMAP_BASE+PMD_SIZE's shadow and MODULES_VADDR * ~ MODULES_END's shadow is in the same PMD_SIZE, so we can't * use kasan_populate_zero_shadow. */ - create_mapping((void *)MODULES_VADDR, (void *)(PKMAP_BASE + PMD_SIZE)); + if (!IS_ENABLED(CONFIG_KASAN_VMALLOC) && IS_ENABLED(CONFIG_MODULES)) + create_mapping((void *)MODULES_VADDR, (void *)(MODULES_END)); + create_mapping((void *)PKMAP_BASE, (void *)(PKMAP_BASE + PMD_SIZE)); /* * KAsan may reuse the contents of kasan_early_shadow_pte directly, so From patchwork Sat Oct 22 07: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: 7766 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1120987wrr; Sat, 22 Oct 2022 02:27:07 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7OB5hnYSzDryhdKKAvCb4fM2lST2zXaOkBTLuCz+Isxuy8rZ5w+q21CVbolJC3MvkWbHvs X-Received: by 2002:a63:5553:0:b0:43c:5c1e:424f with SMTP id f19-20020a635553000000b0043c5c1e424fmr19751210pgm.353.1666430827217; Sat, 22 Oct 2022 02:27:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666430827; cv=none; d=google.com; s=arc-20160816; b=PKS9SPJM0HMSfpMdb8OS5Ugr7nHUkiAkF0Tq7MEQMOpZYYYBJ+8uKF6apzjLgbnNIu P5M0dpGKmM4PiLV+3JIWyfmnX7S2NumMbluEA2K5QpUKWcI4guqDbsYvksnNUWomt8pe yfaDmzErAIFjbDH1Pw5ViBfyPxSF4Hc4lx6VmgY9lIT6U32LQUIfha9Dr8hWziAxKjBn ISoiMElmTx092ZG210QP1OX/Goy5ECoOrtC1FHNTirmRKgnvRUXha5Zyvb9yHLhHOLaO E4jJP2WMkWs5rLQOUFb/07NWaP0T+K+SULbHLQwuTKl0ZMlSmSDUzJCvP/MC0pr/PiG6 1lSg== 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=Zm1RQ7ZeO+3TNCjzULgAkLZXWeTo1wN2lWPNPRAjYec=; b=I0Z882HUPUNxm4IigmBavDa6yi4CKodl//VQmNMzz1Gz/zIWYpL1fvA657cNRPdUcY IN9ji/rwGw5puJxnxxr7HA7IlyP/DFXecEINXTeo9gqG0oKYDTbw34btzRpGg8XZqFax On3p8TxrUSQSTheS+Qt/YYvpQdKklVq+IqG+52mAVF2qnUFTdfoAbDzs5gQ+Fw2ku7VE nngX4HJCzy9/41KHVDX1BXTTbwp55PlmRpZxfJ+vPT0TGMhMyOBP40TxcD1Cv06ZuU5T 89PvtbOaj+OenWbELcHCayDq/9gxAFcjBfnF49MNVRYxcWoNSxW/ZDe79rBG0kaiN+bk Yq3g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Y2wNfUTw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 f1-20020a637541000000b0045a2b6e23b6si28898561pgn.290.2022.10.22.02.26.53; Sat, 22 Oct 2022 02:27: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=Y2wNfUTw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231228AbiJVJFB (ORCPT + 99 others); Sat, 22 Oct 2022 05:05:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55650 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234992AbiJVJDn (ORCPT ); Sat, 22 Oct 2022 05:03:43 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1A5062FBDE9; Sat, 22 Oct 2022 01:18:52 -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 E34B0B82E17; Sat, 22 Oct 2022 08:04:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3CD9AC433D7; Sat, 22 Oct 2022 08:04:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425896; bh=JANyCe8JQE5s7goiFOxXvXCylmib8YtSbUs1+M+zqNI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Y2wNfUTwBcEk1RzFFGyX0Gt0bId5GeZMoybb2CE6MDQ2oaZpcRFnzP7SBi41oFCre arD4okeuZ2nUiUWxA2HNpeZDe/ky3J3+rcZUTUZ0yP8X+kvs3A4pxEfuLX2ZLU12pd ltgaSgeqUBkQ25183ckVk8gOYEEXDH55Tfk1o73A= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ian Nam , Shubhrajyoti Datta , Michal Simek , Stephen Boyd , Sasha Levin Subject: [PATCH 5.19 650/717] clk: zynqmp: Fix stack-out-of-bounds in strncpy` Date: Sat, 22 Oct 2022 09:28:49 +0200 Message-Id: <20221022072527.183908712@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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,T_FILL_THIS_FORM_SHORT 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?1747379371255019631?= X-GMAIL-MSGID: =?utf-8?q?1747379371255019631?= From: Ian Nam [ Upstream commit dd80fb2dbf1cd8751efbe4e53e54056f56a9b115 ] "BUG: KASAN: stack-out-of-bounds in strncpy+0x30/0x68" Linux-ATF interface is using 16 bytes of SMC payload. In case clock name is longer than 15 bytes, string terminated NULL character will not be received by Linux. Add explicit NULL character at last byte to fix issues when clock name is longer. This fixes below bug reported by KASAN: ================================================================== BUG: KASAN: stack-out-of-bounds in strncpy+0x30/0x68 Read of size 1 at addr ffff0008c89a7410 by task swapper/0/1 CPU: 1 PID: 1 Comm: swapper/0 Not tainted 5.4.0-00396-g81ef9e7-dirty #3 Hardware name: Xilinx Versal vck190 Eval board revA (QSPI) (DT) Call trace: dump_backtrace+0x0/0x1e8 show_stack+0x14/0x20 dump_stack+0xd4/0x108 print_address_description.isra.0+0xbc/0x37c __kasan_report+0x144/0x198 kasan_report+0xc/0x18 __asan_load1+0x5c/0x68 strncpy+0x30/0x68 zynqmp_clock_probe+0x238/0x7b8 platform_drv_probe+0x6c/0xc8 really_probe+0x14c/0x418 driver_probe_device+0x74/0x130 __device_attach_driver+0xc4/0xe8 bus_for_each_drv+0xec/0x150 __device_attach+0x160/0x1d8 device_initial_probe+0x10/0x18 bus_probe_device+0xe0/0xf0 device_add+0x528/0x950 of_device_add+0x5c/0x80 of_platform_device_create_pdata+0x120/0x168 of_platform_bus_create+0x244/0x4e0 of_platform_populate+0x50/0xe8 zynqmp_firmware_probe+0x370/0x3a8 platform_drv_probe+0x6c/0xc8 really_probe+0x14c/0x418 driver_probe_device+0x74/0x130 device_driver_attach+0x94/0xa0 __driver_attach+0x70/0x108 bus_for_each_dev+0xe4/0x158 driver_attach+0x30/0x40 bus_add_driver+0x21c/0x2b8 driver_register+0xbc/0x1d0 __platform_driver_register+0x7c/0x88 zynqmp_firmware_driver_init+0x1c/0x24 do_one_initcall+0xa4/0x234 kernel_init_freeable+0x1b0/0x24c kernel_init+0x10/0x110 ret_from_fork+0x10/0x18 The buggy address belongs to the page: page:ffff0008f9be1c88 refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 raw: 0008d00000000000 ffff0008f9be1c90 ffff0008f9be1c90 0000000000000000 raw: 0000000000000000 0000000000000000 00000000ffffffff page dumped because: kasan: bad access detected addr ffff0008c89a7410 is located in stack of task swapper/0/1 at offset 112 in frame: zynqmp_clock_probe+0x0/0x7b8 this frame has 3 objects: [32, 44) 'response' [64, 80) 'ret_payload' [96, 112) 'name' Memory state around the buggy address: ffff0008c89a7300: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ffff0008c89a7380: 00 00 00 00 f1 f1 f1 f1 00 04 f2 f2 00 00 f2 f2 >ffff0008c89a7400: 00 00 f3 f3 00 00 00 00 00 00 00 00 00 00 00 00 ^ ffff0008c89a7480: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ffff0008c89a7500: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ================================================================== Signed-off-by: Ian Nam Signed-off-by: Shubhrajyoti Datta Link: https://lore.kernel.org/r/20220510070154.29528-3-shubhrajyoti.datta@xilinx.com Acked-by: Michal Simek Signed-off-by: Stephen Boyd Signed-off-by: Sasha Levin --- drivers/clk/zynqmp/clkc.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/clk/zynqmp/clkc.c b/drivers/clk/zynqmp/clkc.c index eb25303eefed..2c9da6623b84 100644 --- a/drivers/clk/zynqmp/clkc.c +++ b/drivers/clk/zynqmp/clkc.c @@ -710,6 +710,13 @@ static void zynqmp_get_clock_info(void) FIELD_PREP(CLK_ATTR_NODE_INDEX, i); zynqmp_pm_clock_get_name(clock[i].clk_id, &name); + + /* + * Terminate with NULL character in case name provided by firmware + * is longer and truncated due to size limit. + */ + name.name[sizeof(name.name) - 1] = '\0'; + if (!strcmp(name.name, RESERVED_CLK_NAME)) continue; strncpy(clock[i].clk_name, name.name, MAX_NAME_LEN); From patchwork Sat Oct 22 07: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: 7662 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1108110wrr; Sat, 22 Oct 2022 01:43:21 -0700 (PDT) X-Google-Smtp-Source: AMsMyM52/HZP1h2cjPB44pX6y7Sat+Iqk+pQklOYjpiHPgWkfLBM9PhGpH46EYYrLKDhJuUmlzP/ X-Received: by 2002:aa7:db16:0:b0:461:4059:eb8e with SMTP id t22-20020aa7db16000000b004614059eb8emr7286044eds.284.1666428201468; Sat, 22 Oct 2022 01:43:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666428201; cv=none; d=google.com; s=arc-20160816; b=e/vjc/8geKl0CEY5aFAmNa9jUTYSwNW0k7MMrJNMMSy/z2yGK31zovz+3l7zA7OIc3 hDWBr0WGEnvhXRQX3mpJWmVm4ZR6M9tlFlpnlbFLtAJSe4nRswEEnz10/5DXUuqPhTdJ MZ4TFVod21HX79j4HViNlmuNFg4cRzzGp6Ex0Nw5sUgZW/wF4ig8s5zWWrVWDkHHbDfW B8oD04ct7WxiNn8bQG5e1+XWt7wX3RFuNN3KLuJZ+to3du13lZLaxFwIdwQkoH4Bj7Gf ypNLLYLHOoHWp9RiF1WrYpAWtT5e1Im/6yJV55ewJFZA0lxOnTyjrIbIumxS/qIMSwkC jxPA== 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=V79x5QVuo8Dh1jOJMhjkI2tEpNr7+uJ1KMJgO1fLzFo=; b=tNfphZmJ9nehyxz2jfcykklcrn4NiStQbxj61emr7lSk83pAMFV+axI5A+mlcEz1N1 xmo+17CC+FmueUUEN4K+FEodtEQRrs/Bwzh5NeaNZdZvcRWbZ8o+QnnvXLDbf+1Vn7YZ EIc05gmJoPVIUpPM7xh79sEVhrBTg5IP7mMdUMLWXLUUFmBJSbtmOjdXKY4pRUwKZx8l 1qDg3yb2UbRpwL3VdzDiKJm3mFKmvhTA3ZrdgtF8TA3DsXw6/VFuID0D5W8ixiCeOi47 Sb0DYBs69o7mNtwxfCCTY9wcOlWazZmdkVqrLG38sYUrK0bQm0giUKuwxZvFZZsfUnYM YuUg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=OWdi+CyJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 md8-20020a170906ae8800b007828388864dsi17616262ejb.692.2022.10.22.01.42.49; Sat, 22 Oct 2022 01:43: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=OWdi+CyJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S234557AbiJVIld (ORCPT + 99 others); Sat, 22 Oct 2022 04:41:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54936 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234178AbiJVIgW (ORCPT ); Sat, 22 Oct 2022 04:36: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 C465FB2D97; Sat, 22 Oct 2022 01: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 450B560B8C; Sat, 22 Oct 2022 08:05:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3CEA7C433D6; Sat, 22 Oct 2022 08:04:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425899; bh=u/bw0MPMS/QV/9IoNFCmnYBw0YZ8rHNhw+FhHjhGJJE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OWdi+CyJfCfuaFS8rimk0gtnrFHZ4M3WChFW5w26SgLJXaBn+SoKfNxO67FqitWB1 KdhkzRC7XA3TvLV6JF9ZSC8fWSplci0Vi6a4yunqm9cPDmM3lq2lm86g+nDZUXZBpy Itg/viCIPZIm6Z7czgMTPq+dVEjNobmWxRecituE= 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 5.19 651/717] media: cx88: Fix a null-ptr-deref bug in buffer_prepare() Date: Sat, 22 Oct 2022 09:28:50 +0200 Message-Id: <20221022072527.222339473@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376617696381990?= X-GMAIL-MSGID: =?utf-8?q?1747376617696381990?= 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 a075788c64d4..469aeaa725ad 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 d3729be89252..b509c2a03852 100644 --- a/drivers/media/pci/cx88/cx88-video.c +++ b/drivers/media/pci/cx88/cx88-video.c @@ -431,6 +431,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; @@ -445,35 +446,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, @@ -481,7 +482,7 @@ static int buffer_prepare(struct vb2_buffer *vb) buf, buf->vb.vb2_buf.index, __func__, core->width, core->height, dev->fmt->depth, dev->fmt->fourcc, (unsigned long)buf->risc.dma); - return 0; + return ret; } static void buffer_finish(struct vb2_buffer *vb) From patchwork Sat Oct 22 07: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: 7681 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1108859wrr; Sat, 22 Oct 2022 01:46:18 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5ex6owJVRQaW9KbOyOtcOUBoKh/p6y7w9dkQ67R56bkMkMtlToq5zTNClfyAfSNplhwMTV X-Received: by 2002:a17:906:36d1:b0:76c:a723:9445 with SMTP id b17-20020a17090636d100b0076ca7239445mr18249533ejc.548.1666428378835; Sat, 22 Oct 2022 01:46:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666428378; cv=none; d=google.com; s=arc-20160816; b=c1EQsjqOi1lEB4mar2qTftXtObGkqkFpL9evpYhwInayU0GOrGXxTcO8aooEm5vNAQ AxT5Uxa78loKgwtMWeSID6pDx63F5QJuJfTwO6/B2jIVLMq7wyckpHLmXIexvV4nfKO+ Rlq2UD0wDmjQTiVDsbEVXBBbp5nnDfGRTZZS/D6qBJihLi5DONZR59Upk0e6uPpMrjIp 7PYNPd1x0fbXxddiHV7yb1rR38qxEMQlednSkZpWo+cwYl3aeyg3XisRAEg+JP30vE43 o6YjHCzYiJPDftOUjIvdPcUmH+0ZrOwqkIYdRltUwQsBLxblw7UmyYLj6eg2+CoEo2+o e3XQ== 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=G4EW3BoP8UR9xOHn7agT63lsNF6Gd1odFaXIjcFSj6g=; b=G8QOwjemaw5BkzzWAK7/wHZXHRnPsLpE7F72yeYFQkMsal1VB9Kmm+nfPcNncQut1L V3Vkc34yLDIMXANL7IM2tHSPQDMWUtM57A7a4ydI5kq5bBFQmfXbPvirIxqN3g4kdyxJ LP0tg8UD3BKencvUiAXOci/OvRQ/VLW+mhmvRQjceR7IFNB0S2UHs7hN99fjhSRG4doc 2gpv3JEdJGqSYatRUq8WeHthBov4Bhf0PN3BfKurr6TgoqPxIKWEBorY/jKbryv8KxTT Pj0wxvFydQMyRSJerHKcdcU8yWKyWoPkMLDNZIEFEOOSh6Va7o5J/7qlLn0iXd+32zso n/RA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=1OT8JYlj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 by26-20020a0564021b1a00b004533149e228si19618330edb.618.2022.10.22.01.45.54; Sat, 22 Oct 2022 01:46: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=1OT8JYlj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S234882AbiJVIn5 (ORCPT + 99 others); Sat, 22 Oct 2022 04:43:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52146 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234381AbiJVIm4 (ORCPT ); Sat, 22 Oct 2022 04:42:56 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 943CB2E7B80; Sat, 22 Oct 2022 01:07: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 A072B60B9B; Sat, 22 Oct 2022 08:06:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 91E67C433C1; Sat, 22 Oct 2022 08:06:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666426018; bh=Hn/ow9Xin3Od8mQZtZIgLBDPeR+Aq7EySKsOMGbYcTw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1OT8JYlj+i+zbvYs5YSKA1QvYHVbQxPDiCShshWRcjNckvvfMKDWP5+p6CegPs6uQ K9LPGMeR1bdQsa2ScpkKS9ue+bDOEfSLgm7iN2s+Ifo8+z8vo3Igi6O7xTvPhBEpsS w1BHzdI0+6pYfQ4wqLjDG5CXVnZngJ9LGA/Mipd0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hangyu Hua , Hans Verkuil , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.19 652/717] media: platform: fix some double free in meson-ge2d and mtk-jpeg and s5p-mfc Date: Sat, 22 Oct 2022 09:28:51 +0200 Message-Id: <20221022072527.269070264@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376803645638586?= X-GMAIL-MSGID: =?utf-8?q?1747376803645638586?= From: Hangyu Hua [ Upstream commit c65c3f3a2cbf21ed429d9b9c725bdb5dc6abf4cf ] video_unregister_device will release device internally. There is no need to call video_device_release after video_unregister_device. Signed-off-by: Hangyu Hua Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin --- drivers/media/platform/amlogic/meson-ge2d/ge2d.c | 1 - drivers/media/platform/mediatek/jpeg/mtk_jpeg_core.c | 1 - drivers/media/platform/samsung/s5p-mfc/s5p_mfc.c | 3 +-- 3 files changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/media/platform/amlogic/meson-ge2d/ge2d.c b/drivers/media/platform/amlogic/meson-ge2d/ge2d.c index 5e7b319f300d..142d421a8d76 100644 --- a/drivers/media/platform/amlogic/meson-ge2d/ge2d.c +++ b/drivers/media/platform/amlogic/meson-ge2d/ge2d.c @@ -1030,7 +1030,6 @@ static int ge2d_remove(struct platform_device *pdev) video_unregister_device(ge2d->vfd); v4l2_m2m_release(ge2d->m2m_dev); - video_device_release(ge2d->vfd); v4l2_device_unregister(&ge2d->v4l2_dev); clk_disable_unprepare(ge2d->clk); diff --git a/drivers/media/platform/mediatek/jpeg/mtk_jpeg_core.c b/drivers/media/platform/mediatek/jpeg/mtk_jpeg_core.c index bc5b0a0168ec..6aa73f1cde18 100644 --- a/drivers/media/platform/mediatek/jpeg/mtk_jpeg_core.c +++ b/drivers/media/platform/mediatek/jpeg/mtk_jpeg_core.c @@ -1411,7 +1411,6 @@ static int mtk_jpeg_remove(struct platform_device *pdev) pm_runtime_disable(&pdev->dev); video_unregister_device(jpeg->vdev); - video_device_release(jpeg->vdev); v4l2_m2m_release(jpeg->m2m_dev); v4l2_device_unregister(&jpeg->v4l2_dev); diff --git a/drivers/media/platform/samsung/s5p-mfc/s5p_mfc.c b/drivers/media/platform/samsung/s5p-mfc/s5p_mfc.c index 761341934925..f85d1eebafac 100644 --- a/drivers/media/platform/samsung/s5p-mfc/s5p_mfc.c +++ b/drivers/media/platform/samsung/s5p-mfc/s5p_mfc.c @@ -1399,6 +1399,7 @@ static int s5p_mfc_probe(struct platform_device *pdev) /* Deinit MFC if probe had failed */ err_enc_reg: video_unregister_device(dev->vfd_dec); + dev->vfd_dec = NULL; err_dec_reg: video_device_release(dev->vfd_enc); err_enc_alloc: @@ -1444,8 +1445,6 @@ static int s5p_mfc_remove(struct platform_device *pdev) video_unregister_device(dev->vfd_enc); video_unregister_device(dev->vfd_dec); - video_device_release(dev->vfd_enc); - video_device_release(dev->vfd_dec); v4l2_device_unregister(&dev->v4l2_dev); s5p_mfc_unconfigure_dma_memory(dev); From patchwork Sat Oct 22 07: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: 7680 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1108792wrr; Sat, 22 Oct 2022 01:46:06 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6sGU0LvTgmlW6teblvH7fMnzP3cay9xL+m02HS/zhif19kRK+u9p+HKN/FlTnzRgsNjRNN X-Received: by 2002:a17:906:4fce:b0:78d:9fcb:50c7 with SMTP id i14-20020a1709064fce00b0078d9fcb50c7mr19608218ejw.63.1666428365936; Sat, 22 Oct 2022 01:46:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666428365; cv=none; d=google.com; s=arc-20160816; b=ToIJ7AyZt74AYEZTp/+3zPp/HeQ39OYoxojQ5zvgwq9AWbKOZ233ubTSnx8JKmuxmX HIFQoBLl5YVJEAId/38kv52j/WII4chmx3uRHeZVWA0bfFP0vlb87dFriPnxQrvkOwn0 Qgmy1SLWSIIOQ6FZovO5qnf/azze83enitekupLgLZ+g3O7r5c6fMd1bLrE95WY2xZ4+ ziUI4cO2CqXK8gX63oWYA9u9vLm7CiSmIXOWmVxqQAxzqhUtktwYQVWbarHvrNVd8z6U CbOidbHeTzmRM+Qskv/ha0q05/s2uiG3s3OZJcAm3IcUj2FaMLfTmgvd5oWk3z0oFhl3 wfgw== 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=8+G/2Du0XuxubuCfDN8v+J3rkn9TxxkYAp2SWkRg5gg=; b=ANZyYCI7gdgaIS9jJ1UGQILOOhV2bMYQEzoDw0xNQEIfiGqr7tEpCUyH6wcEweWDRI pteC7dxqnuRX2ZZttczeRT4zfkyMFDdvYjoK7ldMPhSUyUVeCvAVLoCHTLAR3Mppsh5d TnZthVGFbx9ypI3uYuQlh80rUlv6fBsmz+t0vQEjlHEunaVuTk7Aem/D8OUoZGdKtox7 sB2orlJYdJZ1T1qYTu3FH3C1N4qLGuKFpV868TZsRFSterXtKeP1HKozTGIZlW3N2onR GRu/4Wz/5yLTsFFK8KwRnoFT4ZSAgEbUpAICZFI7m5JT1IEtvFMjb4BNIZYEkMLkdorR 2AJA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="Wm0o7JH/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 ka3-20020a170907990300b0078c3603b4f6si18198004ejc.784.2022.10.22.01.45.41; Sat, 22 Oct 2022 01: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="Wm0o7JH/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S234592AbiJVInx (ORCPT + 99 others); Sat, 22 Oct 2022 04:43:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46718 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234766AbiJVImj (ORCPT ); Sat, 22 Oct 2022 04:42:39 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BACF52E9696; Sat, 22 Oct 2022 01:07: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 7ED3AB82E41; Sat, 22 Oct 2022 08:05:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AFAF9C433D6; Sat, 22 Oct 2022 08:05:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425925; bh=GvZod3RFAjidyXSUoKZ273KLjuujQzygOSc6mBdthnY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Wm0o7JH/Ku44PsWE0hSubder0cWQ5PlIzWF+kKZY8jr64WaZ4DDDbOtx/JWJUDUA5 W4sWgYpfgX7Fow7akiDclSuHN/cBfSzou4L6HyPWxXwfvZL5Ylpitn7fh5pryxt3xP iC/qUPVZpVldexVwSSM/w0NkdO9NFECobpTm6q5w= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Quanyang Wang , Shubhrajyoti Datta , Stephen Boyd , Sasha Levin Subject: [PATCH 5.19 653/717] clk: zynqmp: pll: rectify rate rounding in zynqmp_pll_round_rate Date: Sat, 22 Oct 2022 09:28:52 +0200 Message-Id: <20221022072527.308699359@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376790190214589?= X-GMAIL-MSGID: =?utf-8?q?1747376790190214589?= From: Quanyang Wang [ Upstream commit 30eaf02149ecc3c5815e45d27187bf09e925071d ] The function zynqmp_pll_round_rate is used to find a most appropriate PLL frequency which the hardware can generate according to the desired frequency. For example, if the desired frequency is 297MHz, considering the limited range from PS_PLL_VCO_MIN (1.5GHz) to PS_PLL_VCO_MAX (3.0GHz) of PLL, zynqmp_pll_round_rate should return 1.872GHz (297MHz * 5). There are two problems with the current code of zynqmp_pll_round_rate: 1) When the rate is below PS_PLL_VCO_MIN, it can't find a correct rate when the parameter "rate" is an integer multiple of *prate, in other words, if "f" is zero, zynqmp_pll_round_rate won't return a valid frequency which is from PS_PLL_VCO_MIN to PS_PLL_VCO_MAX. For example, *prate is 33MHz and the rate is 660MHz, zynqmp_pll_round_rate will not boost up rate and just return 660MHz, and this will cause clk_calc_new_rates failure since zynqmp_pll_round_rate returns an invalid rate out of its boundaries. 2) Even if the rate is higher than PS_PLL_VCO_MIN, there is still a risk that zynqmp_pll_round_rate returns an invalid rate because the function DIV_ROUND_CLOSEST makes some loss in the fractional part. If the parent clock *prate is 33333333Hz and we want to set the PLL rate to 1.5GHz, this function will return 1499999985Hz by using the formula below: value = *prate * DIV_ROUND_CLOSEST(rate, *prate)). This value is also invalid since it's slightly smaller than PS_PLL_VCO_MIN. because DIV_ROUND_CLOSEST makes some loss in the fractional part. Signed-off-by: Quanyang Wang Link: https://lore.kernel.org/r/20220826142030.213805-1-quanyang.wang@windriver.com Reviewed-by: Shubhrajyoti Datta Signed-off-by: Stephen Boyd Signed-off-by: Sasha Levin --- drivers/clk/zynqmp/pll.c | 31 +++++++++++++++---------------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/drivers/clk/zynqmp/pll.c b/drivers/clk/zynqmp/pll.c index 91a6b4cc910e..0d3e1377b092 100644 --- a/drivers/clk/zynqmp/pll.c +++ b/drivers/clk/zynqmp/pll.c @@ -102,26 +102,25 @@ static long zynqmp_pll_round_rate(struct clk_hw *hw, unsigned long rate, unsigned long *prate) { u32 fbdiv; - long rate_div, f; + u32 mult, div; - /* Enable the fractional mode if needed */ - rate_div = (rate * FRAC_DIV) / *prate; - f = rate_div % FRAC_DIV; - if (f) { - if (rate > PS_PLL_VCO_MAX) { - fbdiv = rate / PS_PLL_VCO_MAX; - rate = rate / (fbdiv + 1); - } - if (rate < PS_PLL_VCO_MIN) { - fbdiv = DIV_ROUND_UP(PS_PLL_VCO_MIN, rate); - rate = rate * fbdiv; - } - return rate; + /* Let rate fall inside the range PS_PLL_VCO_MIN ~ PS_PLL_VCO_MAX */ + if (rate > PS_PLL_VCO_MAX) { + div = DIV_ROUND_UP(rate, PS_PLL_VCO_MAX); + rate = rate / div; + } + if (rate < PS_PLL_VCO_MIN) { + mult = DIV_ROUND_UP(PS_PLL_VCO_MIN, rate); + rate = rate * mult; } fbdiv = DIV_ROUND_CLOSEST(rate, *prate); - fbdiv = clamp_t(u32, fbdiv, PLL_FBDIV_MIN, PLL_FBDIV_MAX); - return *prate * fbdiv; + if (fbdiv < PLL_FBDIV_MIN || fbdiv > PLL_FBDIV_MAX) { + fbdiv = clamp_t(u32, fbdiv, PLL_FBDIV_MIN, PLL_FBDIV_MAX); + rate = *prate * fbdiv; + } + + return rate; } /** From patchwork Sat Oct 22 07: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: 7758 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1117916wrr; Sat, 22 Oct 2022 02:17:40 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5spWXnfNcFx4IEjgANw6/QEijiqi+ZL0HjrjVfld5kqJppVv2A/cChGhP5y/z5zzCtyzYK X-Received: by 2002:a63:90c1:0:b0:45f:c9a7:15c3 with SMTP id a184-20020a6390c1000000b0045fc9a715c3mr19712396pge.304.1666430260469; Sat, 22 Oct 2022 02:17:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666430260; cv=none; d=google.com; s=arc-20160816; b=hYALR+Yyp+zOcEVYSJVxm7lHYD2vW6BS2Q/p4Ns0Eg/AThVoezdLkFegofYlvBDQ7p fbvPuxerenIaJXrUTX4Zz2ADGKoRVnZAM6VM2qwNVGgIPRjdzMBBYnmQG+ZM/0fs4wRq yNRbycUNHJSfeRcQzGMOstn4JNoCNmYR5toP1a2ce14wZjaICgURgG3fana/lthY9uqG 0SGnq2l7QuSLevpUjokosZEr/gLQxsDzGAww9PVXLKVBCNNN7+pD2C3LoMK+0pNnYZM9 89+2b4eRozlQdQcMr3++IdOULGs84jd5aA7EKqnrV5hWFGw7IWn8EhnljVXTRrmWsnA4 lXVA== 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=LNEljwYhzdpsteIcbSmCMOtcT8vPHf/PaAn/Jkp12Zc=; b=eAEFB+cv9huXBmGeq4aaoFo4VJfMyn1tpRmGdlZHoMK9ipoqg0xCSSYWcHPoADTBJy aPgklNc99ZucETuI1zAHep4Z0gVN2ZWkhysE7HrR8jxaYhSc7YCSa0XrIM/1xAw8k7Tu elCsvWMLM+njS5lH4NQm3MtRxw5Lx3EGxOVUYxBhn+sHFr3IOKIUt0xB67x8+EvriSXr JuFRz0WFCIdhyFp5seusFMUjTdqS1aT9O4SB9FgNRqU3ty3VLIcgGC5Pc7UKDIl5zdsE UTAdDybvM9eUOOydhKljtJzGYpLyiWLgVAAOicxt+bttJJoIB8akgDqQn/B3jgF/SVKo 1ojQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="ZF9gjC1/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 i11-20020a170902cf0b00b0017f580f646fsi30918155plg.304.2022.10.22.02.17.28; Sat, 22 Oct 2022 02:17: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="ZF9gjC1/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S234812AbiJVI5k (ORCPT + 99 others); Sat, 22 Oct 2022 04:57:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37042 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233790AbiJVI47 (ORCPT ); Sat, 22 Oct 2022 04:56: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 BF565DEF35; Sat, 22 Oct 2022 01:15: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 dfw.source.kernel.org (Postfix) with ESMTPS id 5E95160ADC; Sat, 22 Oct 2022 08:05:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 73773C433C1; Sat, 22 Oct 2022 08:05:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425957; bh=7La2O9nGNKQitcBs24OLPlXs/LRT+Ca0fFDBGqHMwGA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZF9gjC1/emEg6mDqXRWhxHirYxfLBcv+AtcdYWuUEt9eCJklZ3PqVPg0nYsJa2NgF gebTaQ3u7tbe8Ej6r9DGsmlYwpFIPuEFrugNPnpRXS0P0M+MU8IWB8b9VeQPHjJJ+a WDsNjnSf4YaQDtC8gw73G/1wkKYBZGwVHdUpzl64= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Daisuke Matsuda , Leon Romanovsky , Sasha Levin Subject: [PATCH 5.19 654/717] RDMA/rxe: Delete error messages triggered by incoming Read requests Date: Sat, 22 Oct 2022 09:28:53 +0200 Message-Id: <20221022072527.341237628@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747378776640698824?= X-GMAIL-MSGID: =?utf-8?q?1747378776640698824?= From: Daisuke Matsuda [ Upstream commit 2c02249fcbfc066bd33e2a7375c7006d4cb367f6 ] An incoming Read request causes multiple Read responses. If a user MR to copy data from is unavailable or responder cannot send a reply, then the error messages can be printed for each response attempt, resulting in message overflow. Link: https://lore.kernel.org/r/20220829071218.1639065-1-matsuda-daisuke@fujitsu.com Signed-off-by: Daisuke Matsuda Signed-off-by: Leon Romanovsky Signed-off-by: Sasha Levin --- drivers/infiniband/sw/rxe/rxe_resp.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/drivers/infiniband/sw/rxe/rxe_resp.c b/drivers/infiniband/sw/rxe/rxe_resp.c index e38bf958ab48..2ef21a1cba81 100644 --- a/drivers/infiniband/sw/rxe/rxe_resp.c +++ b/drivers/infiniband/sw/rxe/rxe_resp.c @@ -787,10 +787,8 @@ static enum resp_states read_reply(struct rxe_qp *qp, if (!skb) return RESPST_ERR_RNR; - err = rxe_mr_copy(mr, res->read.va, payload_addr(&ack_pkt), - payload, RXE_FROM_MR_OBJ); - if (err) - pr_err("Failed copying memory\n"); + rxe_mr_copy(mr, res->read.va, payload_addr(&ack_pkt), + payload, RXE_FROM_MR_OBJ); if (mr) rxe_put(mr); @@ -801,10 +799,8 @@ static enum resp_states read_reply(struct rxe_qp *qp, } err = rxe_xmit_packet(qp, &ack_pkt, skb); - if (err) { - pr_err("Failed sending RDMA reply.\n"); + if (err) return RESPST_ERR_RNR; - } res->read.va += payload; res->read.resid -= payload; From patchwork Sat Oct 22 07: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: 7724 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1109972wrr; Sat, 22 Oct 2022 01:50:49 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7KGkIWkvanMsNcUDFKzGScv0+EItjFeTwnPvgZwSj7cFz9fohivRUXBMnq26lmxAJ+6vVF X-Received: by 2002:a05:6402:190f:b0:45d:2c25:3a1d with SMTP id e15-20020a056402190f00b0045d2c253a1dmr21915544edz.175.1666428649398; Sat, 22 Oct 2022 01:50:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666428649; cv=none; d=google.com; s=arc-20160816; b=WAEwl8wubd/DH3vkiDSVsLw36ej+RZxHp0aKmi7fCDFs+9xDNgVnscj6vzwZyB/01h ud9V6iCwpaWk3ejMDibxUXJwim+bB8O5TEY6VSokE1lpgZlYwuLEQjh9spo/hrQGG42f J5UydYltk9M7/Rg2ehLVUjR6f4Xzxi0TXAG+WcwDohUC7K9zm2iNHsPn9rKKt2sAbDoW iBqNTT97QUpi1Y9wJx4yPAGrkEsDNFbvuOHPuxJP1gVTMeqcYz00Rj3twqxt5pbscZej hKqKjCTa34HNCtOdMZy+kdxbbgq7uV9FD1Zzb6EM2bGDrFs6tsfatm0+1kaKXmMNLx63 bdHA== 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=x0N2yxRtUT6+XAXdn0Z2VnXss3cMJQrlmvLLA4Fqsbw=; b=lT1M2flT7KgdVsatQbv6cvU6GxrWzK5t08fGvgzhGmBMie7d/ipxetRUq1G2YyRcIa 3h7T2ERcRheynVNJSu86WcphOjmFrVoDu8qd6GLZa7FhQBszevhfohH6wG4JCBt3mkcW D66oeJ1eTJyjD9IxmX7LtilLuae/jdzBZn6KDZKnrrD+QvNwLDwPbG4gczB9ybylgGp8 L5SpaHO7dXZId1/inFd4DrnbUKZ1U5SmW0xvg2zwJQaRHHoNpQw+jEajNN3reeDy8YWc 21XmFvaD2Wpdd9KlidQCLy/RojviM4qwzc2572KawQSHbJw+uiHbgFq97spPvoUpMjPI UFQQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=RwTqQDoT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 x21-20020a170906805500b0076fa1e1274bsi18978064ejw.202.2022.10.22.01.50.24; Sat, 22 Oct 2022 01:50: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=RwTqQDoT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S234871AbiJVItG (ORCPT + 99 others); Sat, 22 Oct 2022 04:49:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43998 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234877AbiJVIqb (ORCPT ); Sat, 22 Oct 2022 04:46:31 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6D9234B9A3; Sat, 22 Oct 2022 01:09: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 A5305B82E1A; Sat, 22 Oct 2022 08:06:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id ED3D3C4314B; Sat, 22 Oct 2022 08:06:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425991; bh=COvMImI5EhtK7DDUN4rrlXlj6Olbp9bHPrM5fbNPEo8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RwTqQDoT9ysKXYqtbughlfOaBbqosNziKaz5M32/TZSV00jL0+JPeUceMTXcibsVn WAW+DleQGn4FubijEzD4tOz/5fQSsnBqyb7X4vTp/x7y7by2JmDXFhqwMgmpYWgjO3 zUBu+h8Dj8I+v4aHm9p0+DUj0+VLacZFpU56qqDE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Florian Fainelli , Justin Chen , Sasha Levin Subject: [PATCH 5.19 655/717] usb: host: xhci-plat: suspend and resume clocks Date: Sat, 22 Oct 2022 09:28:54 +0200 Message-Id: <20221022072527.371600576@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747377087222305708?= X-GMAIL-MSGID: =?utf-8?q?1747377087222305708?= From: Justin Chen [ Upstream commit 8bd954c56197caf5e3a804d989094bc3fe6329aa ] Introduce XHCI_SUSPEND_RESUME_CLKS quirk as a means to suspend and resume clocks if the hardware is capable of doing so. We assume that clocks will be needed if the device may wake. Reviewed-by: Florian Fainelli Signed-off-by: Justin Chen Link: https://lore.kernel.org/r/1660170455-15781-2-git-send-email-justinpopo6@gmail.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/usb/host/xhci-plat.c | 16 +++++++++++++++- drivers/usb/host/xhci.h | 1 + 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c index a8641b6536ee..ef10982ad482 100644 --- a/drivers/usb/host/xhci-plat.c +++ b/drivers/usb/host/xhci-plat.c @@ -437,7 +437,16 @@ static int __maybe_unused xhci_plat_suspend(struct device *dev) * xhci_suspend() needs `do_wakeup` to know whether host is allowed * to do wakeup during suspend. */ - return xhci_suspend(xhci, device_may_wakeup(dev)); + ret = xhci_suspend(xhci, device_may_wakeup(dev)); + if (ret) + return ret; + + if (!device_may_wakeup(dev) && (xhci->quirks & XHCI_SUSPEND_RESUME_CLKS)) { + clk_disable_unprepare(xhci->clk); + clk_disable_unprepare(xhci->reg_clk); + } + + return 0; } static int __maybe_unused xhci_plat_resume(struct device *dev) @@ -446,6 +455,11 @@ static int __maybe_unused xhci_plat_resume(struct device *dev) struct xhci_hcd *xhci = hcd_to_xhci(hcd); int ret; + if (!device_may_wakeup(dev) && (xhci->quirks & XHCI_SUSPEND_RESUME_CLKS)) { + clk_prepare_enable(xhci->clk); + clk_prepare_enable(xhci->reg_clk); + } + ret = xhci_priv_resume_quirk(hcd); if (ret) return ret; diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h index 7caa0db5e826..6dfbf73ee840 100644 --- a/drivers/usb/host/xhci.h +++ b/drivers/usb/host/xhci.h @@ -1899,6 +1899,7 @@ struct xhci_hcd { #define XHCI_NO_SOFT_RETRY BIT_ULL(40) #define XHCI_BROKEN_D3COLD BIT_ULL(41) #define XHCI_EP_CTX_BROKEN_DCS BIT_ULL(42) +#define XHCI_SUSPEND_RESUME_CLKS BIT_ULL(43) unsigned int num_active_eps; unsigned int limit_active_eps; From patchwork Sat Oct 22 07: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: 7734 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1110247wrr; Sat, 22 Oct 2022 01:51:52 -0700 (PDT) X-Google-Smtp-Source: AMsMyM66Sl/BB/quFv5XeH9R4u5SyMOyQjJXmvNwDlDGdCJhu0Kgn719Mg3vyfz933uFR/lw8WsL X-Received: by 2002:a05:6402:1808:b0:461:52dd:499c with SMTP id g8-20020a056402180800b0046152dd499cmr5927754edy.120.1666428712242; Sat, 22 Oct 2022 01:51:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666428712; cv=none; d=google.com; s=arc-20160816; b=A8pUf2VJ8NAq3jl075YNvkJI4xUcpY5GzjElaZCkunRw1DeAiGrPGE6jZP9AV8mfl3 RwXUbL2zwIZUuHRzosVdatyAlfc6QcHY41jyiixpBlKBcrPg/INxGrnAM0v7g7ZnBW7g 2cHmi1W7YClWWgjzecEN2k54FbqYxkjy0IIUj3IJUkU4NNHXRbXrkQF2uJ/pBJFxOFsq gVHddNZBqWhGJSpH6z4NnJIcgmNly8BMmaxahuKDxJ3TvFGVjasOSJMxHpNAP01+n/sj NAyCwLeWFqJg52kglgXu3WLz75AX/7qVFAp23WrZu4IKLnFPfVUF55FPVSxCgJjmT8yH Hwlw== 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=izjwTOmlbg5Yn4vW3i1r2UFyZ3cnTPLxTlGNLQ+qTRA=; b=S726h/H/yTvlsi4dv5UxveD57ejhYhhEwcu7tFRIz4omB5toDxt1rB9386gAIgKCPz qijB4Qea3Bou5xLjKf607rII2wzkG1fen41XijTYa11nwGpyZn+nSA1Vs6JoZrNZ45o3 VEPkPflrSj5xGDmSe9cNHCdYQ2LuhIBFdFpqBosIuMHJH7wymaIgJxUZ3wP01R1Z92Yq Ub9XZLQm6r8ywV3cemiZwJmpHGZbw9t6GMTv7DN83EgoBMTOBXOt2+kXruQ2icevlzFR S59N0zrPSioAnQMvVh5aPgWi+v8S+0ye3n4Emgjuj9kLS+aWh5yqkdnaOp4pNitT51Gv HtuQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=yfulSeMF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 a24-20020a50c318000000b00461237816efsi5817836edb.120.2022.10.22.01.51.28; Sat, 22 Oct 2022 01:51: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=yfulSeMF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S234839AbiJVIuY (ORCPT + 99 others); Sat, 22 Oct 2022 04:50:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45572 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234904AbiJVItH (ORCPT ); Sat, 22 Oct 2022 04:49: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 D30A4119BE6; Sat, 22 Oct 2022 01:10: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 dfw.source.kernel.org (Postfix) with ESMTPS id 9085F60B4D; Sat, 22 Oct 2022 08:06:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 92A85C433D6; Sat, 22 Oct 2022 08:06:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666426000; bh=1TJHyyfg+QsA6U78R8mxqIahZXicXXqn1XHvFq8xnAo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=yfulSeMFg3DtIv+nxC1WLrYy+yryeeq3DmFvenguGCpLD4uFobCm9t3NSt1jdUjzO bQK3+T43YsJWb/Y/1EZArWPysF41/Fz9mKa/RViME/dhJ0RkLWZWPLkLiHfTuv+h1F xyV2TnUuWFQTZxKdgsuxwpB5XXlClf1g+J/kW7Hs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Florian Fainelli , Justin Chen , Sasha Levin Subject: [PATCH 5.19 656/717] usb: host: xhci-plat: suspend/resume clks for brcm Date: Sat, 22 Oct 2022 09:28:55 +0200 Message-Id: <20221022072527.415643934@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747377153374616040?= X-GMAIL-MSGID: =?utf-8?q?1747377153374616040?= From: Justin Chen [ Upstream commit c69400b09e471a3f1167adead55a808f0da6534a ] The xhci_plat_brcm xhci block can enter suspend with clock disabled to save power and re-enable them on resume. Make use of the XHCI_SUSPEND_RESUME_CLKS quirk to do so. Reviewed-by: Florian Fainelli Signed-off-by: Justin Chen Link: https://lore.kernel.org/r/1660170455-15781-3-git-send-email-justinpopo6@gmail.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/usb/host/xhci-plat.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c index ef10982ad482..5fb55bf19493 100644 --- a/drivers/usb/host/xhci-plat.c +++ b/drivers/usb/host/xhci-plat.c @@ -123,7 +123,7 @@ static const struct xhci_plat_priv xhci_plat_renesas_rcar_gen3 = { }; static const struct xhci_plat_priv xhci_plat_brcm = { - .quirks = XHCI_RESET_ON_RESUME, + .quirks = XHCI_RESET_ON_RESUME | XHCI_SUSPEND_RESUME_CLKS, }; static const struct of_device_id usb_xhci_of_match[] = { From patchwork Sat Oct 22 07:28: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: 7725 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1109984wrr; Sat, 22 Oct 2022 01:50:52 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4mmogjgkmutV8exuUSlq8mK4uJGkKYUYSfo6AKWrGIM47blbDjJ7tlaeZHspGYXzmuTJeU X-Received: by 2002:a05:6402:5419:b0:457:c955:a40f with SMTP id ev25-20020a056402541900b00457c955a40fmr20669340edb.391.1666428652702; Sat, 22 Oct 2022 01:50:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666428652; cv=none; d=google.com; s=arc-20160816; b=jjvsAci7etRtYxxJl1/fDHN+VYztF45GZs80I1jvo1jxupI5R7Hy5v/5X1qSpmwxWO fStX+2J2j95woF+maSx22DNnWWQLq66RqTiNNkisn6fmkoK4iXYPxVI52KIIgb/BibBa K8vfs3+ejJO4R1409ET6W5k2raeP2rjIZ9LBvv0Ve66BooUnw1DF9aJytUK5lsduIker hf+v2yzWTtWusrUCuFH/KWhUvV890FwHhQjfGCJNWN88Pbvv6X3HvaU2XlgsKoscLuVT M0KtfGIdeUE6z7XCpkYLD4xT3sTcwBKY/qe0/Funl3OelcGatSEP4HuLrRj6Q77Taruy RRKA== 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=nP+zCCEqeSPA4JQWBDFyMAt0mF7WHKpjyGjdsDTE5gc=; b=f2CE6KoM0s3ouA3RwqnJf1eSPRWoEuiUQirmuN/aq9HIsCqPbJ6AL9IXgKZyRmeFfy IPDqmjPmeNXp/kTsuH9m6wq3uKtTKe+VNHU8vUybqY/5JStAN6dRyMvMMhI7eAR09M89 +TVePXCWYrwLwR1ADvfofIEre8JR6jP/nGxX0q0Mky14l0KmG5O07AYBNm6QtFA372aP akPOaNOFc6II5DfXcWlcCpCudELnD3zCWSp5jlOQWNJ+6oibyoAynaM+LBcI1Xe5ke4Z mlA6k4VoMNDQJlGSjN1LKChlAv1Q0ISN0N+QLrNmH+nvwIgGiKi6hAB00Uc246IuQBYO XO/w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=kHcI2kDF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 hw9-20020a170907a0c900b007a20c586f4esi430840ejc.876.2022.10.22.01.50.28; Sat, 22 Oct 2022 01:50: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=kHcI2kDF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S234909AbiJVItI (ORCPT + 99 others); Sat, 22 Oct 2022 04:49:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44492 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234886AbiJVIrV (ORCPT ); Sat, 22 Oct 2022 04:47: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 7A34E1B1F1; Sat, 22 Oct 2022 01:09: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 A1A3EB82E0D; Sat, 22 Oct 2022 08:06:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D72F3C433D6; Sat, 22 Oct 2022 08:06:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666426003; bh=ZFoYiT9y2/iVY1FbCrXKpOhrfl3lZzZKHp9H5oPiBIU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kHcI2kDFfhNbaZN/54J/hgEec2hb0d0fpSCfKCFs/mChB67bIiZyiZsMApG8kvWzd 3tD42fS1wGCtE030KqAeAnnBNT312MQc3Ym3eIhv/CFT/86jvwCnc8b83N14rfQM9C VWmIrB7vHT78OELjsz2qxKnGiLX9Dthgy6YUyOi4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Justin Tee , James Smart , "Martin K. Petersen" , Sasha Levin Subject: [PATCH 5.19 657/717] scsi: lpfc: Fix null ndlp ptr dereference in abnormal exit path for GFT_ID Date: Sat, 22 Oct 2022 09:28:56 +0200 Message-Id: <20221022072527.464672525@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747377091134412916?= X-GMAIL-MSGID: =?utf-8?q?1747377091134412916?= From: James Smart [ Upstream commit 59b7e210a522b836a01516c71ee85d1d92c1f075 ] An error case exit from lpfc_cmpl_ct_cmd_gft_id() results in a call to lpfc_nlp_put() with a null pointer to a nodelist structure. Changed lpfc_cmpl_ct_cmd_gft_id() to initialize nodelist pointer upon entry. Link: https://lore.kernel.org/r/20220819011736.14141-3-jsmart2021@gmail.com Co-developed-by: Justin Tee Signed-off-by: Justin Tee Signed-off-by: James Smart Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin --- drivers/scsi/lpfc/lpfc_ct.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/drivers/scsi/lpfc/lpfc_ct.c b/drivers/scsi/lpfc/lpfc_ct.c index 13dfe285493d..b555ccb5ae34 100644 --- a/drivers/scsi/lpfc/lpfc_ct.c +++ b/drivers/scsi/lpfc/lpfc_ct.c @@ -1509,7 +1509,7 @@ lpfc_cmpl_ct_cmd_gft_id(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, struct lpfc_sli_ct_request *CTrsp; int did; struct lpfc_nodelist *ndlp = NULL; - struct lpfc_nodelist *ns_ndlp = NULL; + struct lpfc_nodelist *ns_ndlp = cmdiocb->ndlp; uint32_t fc4_data_0, fc4_data_1; u32 ulp_status = get_job_ulpstatus(phba, rspiocb); u32 ulp_word4 = get_job_word4(phba, rspiocb); @@ -1522,15 +1522,12 @@ lpfc_cmpl_ct_cmd_gft_id(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, ulp_status, ulp_word4, did); /* Ignore response if link flipped after this request was made */ - if ((uint32_t) cmdiocb->event_tag != phba->fc_eventTag) { + if ((uint32_t)cmdiocb->event_tag != phba->fc_eventTag) { lpfc_printf_vlog(vport, KERN_INFO, LOG_DISCOVERY, "9046 Event tag mismatch. Ignoring NS rsp\n"); goto out; } - /* Preserve the nameserver node to release the reference. */ - ns_ndlp = cmdiocb->ndlp; - if (ulp_status == IOSTAT_SUCCESS) { /* Good status, continue checking */ CTrsp = (struct lpfc_sli_ct_request *)outp->virt; From patchwork Sat Oct 22 07: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: 7778 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1121302wrr; Sat, 22 Oct 2022 02:28:08 -0700 (PDT) X-Google-Smtp-Source: AMsMyM552D15w3IM7j5P46Egg9zPiRn9uK/c/KsYNVZxPVlsaLYxn03aoiUu2+CpYXct8ycH1yiq X-Received: by 2002:a63:cc4a:0:b0:439:1c48:2fed with SMTP id q10-20020a63cc4a000000b004391c482fedmr19844516pgi.618.1666430888170; Sat, 22 Oct 2022 02:28:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666430888; cv=none; d=google.com; s=arc-20160816; b=FvTCPH0Uog5qBoRlKCTjzrvE77bVv8Pgtd2RDJuJ+BUSTETApjRWiP0wP8TNpBhDvW cFm/TyHW4yWB8fwTTJVhppAZlvifJcSD35ucMTtvfQdrpE87A8MFJXi0ZwkF0BWC5+zu sU2wGNWt1Jqo7rKVR331sqdt01KzZ5twNi+rhJDvb7Sk7k+FeBIGX9kOSb4ZXFAoKAik ZgdcFAtkFzmSisu1yDmWl6xkDWjF6u8jKokbqvhnToF2tiRKNyULhc42h2b5aLJPwtRI /32X/CCqP88Z0J4KggDTPmOcXZ7JsfXt2k51pD/04g1/FXgzQm2o3tNeU505Z4WFz9AU /rfw== 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=iGWVMjzuvGo5lj1+uXc7eAKNp3H0ETUNtDk9fSJTgWk=; b=PgMUytemVvjem3wsd7LBqKLGtw1CTV5p2TQIxg9Cc4jfG0Mr4zN8Xh/5yTGhybQQ7w oXKo298X6uJfYsmk4zaO1ubt8iFtokHf6oab8W0vs8baFVdjs1a6lv8ftTk2pvpf6dmY S9f2pz9qGq0gSgiMxW1TrGvEqqHYasF7mzdsVYPSoGV9wWr1UVUtAKsdxUK0ne4IEZEI V8Ksq8ZpDiJO4ShZFwW30+t2puOvBrE8ZyjhR1AZGBQUcFgMCxtxJQPxCKseCjqpHhqZ TI/lNkQ+rqPe5T18J/Hx5Mv56NVRK4Am1X1EyHXF9ofdVO5EzaI1tdcU+3RU0FGvhpdV cuEg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=hFZI1nF9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 l17-20020a656811000000b0045a2d89c9cfsi28301602pgt.348.2022.10.22.02.27.55; Sat, 22 Oct 2022 02:28: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=hFZI1nF9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S233297AbiJVJEh (ORCPT + 99 others); Sat, 22 Oct 2022 05:04:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58548 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235090AbiJVJD1 (ORCPT ); Sat, 22 Oct 2022 05:03:27 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 95EE52FACF4; Sat, 22 Oct 2022 01:18: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 dfw.source.kernel.org (Postfix) with ESMTPS id 13DA260B39; Sat, 22 Oct 2022 08:06:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 06459C433D6; Sat, 22 Oct 2022 08:06:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666426006; bh=M+GQYKj7W9Q9eqQVTrqZvdk+oerpuJZZbVXvQ6MtdVg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hFZI1nF9mVHWZOEz8hQ2MZcejhXv/TpTeQte8aGQDMH0uycwmr+fG77wlX/YJTYIA BFRxYtn+x7kYh5y9gd4jJuypJSUuM57u+L+z1OSJajDp9F2OwxNSApn76ht/zxwwDP hDmoCo9iczHC54QvgS9H5lcW3vq9rtIeMDKQsOIA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Vaishnav Achath , Peter Ujfalusi , Vinod Koul , Sasha Levin Subject: [PATCH 5.19 658/717] dmaengine: ti: k3-udma: Reset UDMA_CHAN_RT byte counters to prevent overflow Date: Sat, 22 Oct 2022 09:28:57 +0200 Message-Id: <20221022072527.497849815@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747379435059121760?= X-GMAIL-MSGID: =?utf-8?q?1747379435059121760?= From: Vaishnav Achath [ Upstream commit 7c94dcfa8fcff2dba53915f1dabfee49a3df8b88 ] UDMA_CHAN_RT_*BCNT_REG stores the real-time channel bytecount statistics. These registers are 32-bit hardware counters and the driver uses these counters to monitor the operational progress status for a channel, when transferring more than 4GB of data it was observed that these counters overflow and completion calculation of a operation gets affected and the transfer hangs indefinitely. This commit adds changes to decrease the byte count for every complete transaction so that these registers never overflow and the proper byte count statistics is maintained for ongoing transaction by the RT counters. Earlier uc->bcnt used to maintain a count of the completed bytes at driver side, since the RT counters maintain the statistics of current transaction now, the maintenance of uc->bcnt is not necessary. Signed-off-by: Vaishnav Achath Acked-by: Peter Ujfalusi Link: https://lore.kernel.org/r/20220802054835.19482-1-vaishnav.a@ti.com Signed-off-by: Vinod Koul Signed-off-by: Sasha Levin --- drivers/dma/ti/k3-udma.c | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/drivers/dma/ti/k3-udma.c b/drivers/dma/ti/k3-udma.c index 2f0d2c68c93c..fcfcde947b30 100644 --- a/drivers/dma/ti/k3-udma.c +++ b/drivers/dma/ti/k3-udma.c @@ -300,8 +300,6 @@ struct udma_chan { struct udma_tx_drain tx_drain; - u32 bcnt; /* number of bytes completed since the start of the channel */ - /* Channel configuration parameters */ struct udma_chan_config config; @@ -757,6 +755,20 @@ static void udma_reset_rings(struct udma_chan *uc) } } +static void udma_decrement_byte_counters(struct udma_chan *uc, u32 val) +{ + if (uc->desc->dir == DMA_DEV_TO_MEM) { + udma_rchanrt_write(uc, UDMA_CHAN_RT_BCNT_REG, val); + udma_rchanrt_write(uc, UDMA_CHAN_RT_SBCNT_REG, val); + udma_rchanrt_write(uc, UDMA_CHAN_RT_PEER_BCNT_REG, val); + } else { + udma_tchanrt_write(uc, UDMA_CHAN_RT_BCNT_REG, val); + udma_tchanrt_write(uc, UDMA_CHAN_RT_SBCNT_REG, val); + if (!uc->bchan) + udma_tchanrt_write(uc, UDMA_CHAN_RT_PEER_BCNT_REG, val); + } +} + static void udma_reset_counters(struct udma_chan *uc) { u32 val; @@ -790,8 +802,6 @@ static void udma_reset_counters(struct udma_chan *uc) val = udma_rchanrt_read(uc, UDMA_CHAN_RT_PEER_BCNT_REG); udma_rchanrt_write(uc, UDMA_CHAN_RT_PEER_BCNT_REG, val); } - - uc->bcnt = 0; } static int udma_reset_chan(struct udma_chan *uc, bool hard) @@ -1115,7 +1125,7 @@ static void udma_check_tx_completion(struct work_struct *work) if (uc->desc) { struct udma_desc *d = uc->desc; - uc->bcnt += d->residue; + udma_decrement_byte_counters(uc, d->residue); udma_start(uc); vchan_cookie_complete(&d->vd); break; @@ -1168,7 +1178,7 @@ static irqreturn_t udma_ring_irq_handler(int irq, void *data) vchan_cyclic_callback(&d->vd); } else { if (udma_is_desc_really_done(uc, d)) { - uc->bcnt += d->residue; + udma_decrement_byte_counters(uc, d->residue); udma_start(uc); vchan_cookie_complete(&d->vd); } else { @@ -1204,7 +1214,7 @@ static irqreturn_t udma_udma_irq_handler(int irq, void *data) vchan_cyclic_callback(&d->vd); } else { /* TODO: figure out the real amount of data */ - uc->bcnt += d->residue; + udma_decrement_byte_counters(uc, d->residue); udma_start(uc); vchan_cookie_complete(&d->vd); } @@ -3809,7 +3819,6 @@ static enum dma_status udma_tx_status(struct dma_chan *chan, bcnt = udma_tchanrt_read(uc, UDMA_CHAN_RT_BCNT_REG); } - bcnt -= uc->bcnt; if (bcnt && !(bcnt % uc->desc->residue)) residue = 0; else From patchwork Sat Oct 22 07: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: 7836 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1152712wrr; Sat, 22 Oct 2022 04:03:54 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5Wusa8zz4PuQyjp93GSCcJ/6EWSMOEzbZho/MIwuII/2RiSbyCiF+hsHrKMzVMHcY1Lv8p X-Received: by 2002:a17:907:60d5:b0:78d:f741:7f9b with SMTP id hv21-20020a17090760d500b0078df7417f9bmr19272641ejc.314.1666436633901; Sat, 22 Oct 2022 04:03:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666436633; cv=none; d=google.com; s=arc-20160816; b=SDaLyU8Md0ciU4HRUBN8RI6qeQ3rI9MTUBsV5Yw7sKInmTJIh/opWbqmaIcmeVzgFS Pwd6w0RxyR9ytLuh31PvBzDxryYKYvYrKaYvMuT0Gj9FQwrV1By4Oo96yYMi5A/ytWso msF2tUz4BKdgJeO2eYkWSk7xMWTqw2Ze9ixqZBy7xenvdXoPyBAQC0rA4ivWVZKN+5Io YwlXfhvfECpZ8h1bVDYUrx4oAfRtMODqVSquo8e0E9AUm/N1/iPmdRhGchn4adVnjEmS OLyDHrY5CLBacAsNYg3QIzvHhBAza7hwfe8dZPGmwJFCJxi6BVeCmFwk2cZeQh6eTA4B zsCg== 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=NyFvXrgHPwpCuFHn+Gg/htzby8c/N8ygfLM+53TiBfo=; b=xFtv43WgXBHiCzq5kg0xWuciaHJ0K/096pbsNP1BcvlwN0RV0IkO1W9EWMiuq1K+A8 b+p2ToGEzjKLPXIlZVwoRVgH29kdWy/8BU2fSNBwdtuYa37cHvxk4laQMDJlKpdli0lc UPbVN5yJLkfSLjHjCwXxrKgccJ6BgvhLaAuty6d4bGDECPR0fD/rDJdb+RdfCOZ9Hp0Z gFL97+NUj6KsIh9QjBv0lVtZd8HFEWFAqf+QLFGq85DwVbuxmiAdeUGBW8g658SmiTxh XkSJVItPdJ8/K0vN7WjJ2aIU6a6QVo0YY9Kj56LKnPhAUXRhGd6e/sQrCs9BVOaaHTZ2 NfKQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=J49PEHrY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 hv20-20020a17090760d400b00791a67e4c00si11375981ejc.835.2022.10.22.04.03.20; Sat, 22 Oct 2022 04:03: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=J49PEHrY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S230478AbiJVKzg (ORCPT + 99 others); Sat, 22 Oct 2022 06:55:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33162 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230210AbiJVKzK (ORCPT ); Sat, 22 Oct 2022 06: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 5BA9C9AFEC; Sat, 22 Oct 2022 03:13: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 EA40860BA7; Sat, 22 Oct 2022 08:06:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E6071C433C1; Sat, 22 Oct 2022 08:06:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666426009; bh=Es5nmzJdT+oW3VwkRSQOa1PJ6ac1UPOFRjBXyXVSk/o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=J49PEHrYgybiGMY8wFJW28tu3250YZBwNoSucz+C9pmbozVZPmiSTNOCJe/fZr6bA b95yTW5QXpnwCdlpbUrKlcAUsdyciRHqnHmGmPRyWasecpgZ7aMh7WztCVZLRJnhjz n71VHis3BmNk+kI/HeWzT7KM9iLPap+Mnhso8+2k= 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 5.19 659/717] scsi: 3w-9xxx: Avoid disabling device if failing to enable it Date: Sat, 22 Oct 2022 09:28:58 +0200 Message-Id: <20221022072527.546168155@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 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?1747385459864036450?= X-GMAIL-MSGID: =?utf-8?q?1747385459864036450?= 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 cd823ff5deab..6cb9cca9565b 100644 --- a/drivers/scsi/3w-9xxx.c +++ b/drivers/scsi/3w-9xxx.c @@ -2006,7 +2006,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 Sat Oct 22 07: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: 7727 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1110039wrr; Sat, 22 Oct 2022 01:51:05 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7Mmogdon1K8bTgdXIDetHqBzX49hcmiEms4dMhq+kD7eitrbjkFKdFdIDKBU2a+sygJw9h X-Received: by 2002:a17:907:7fa9:b0:791:a5c2:e25 with SMTP id qk41-20020a1709077fa900b00791a5c20e25mr16230566ejc.444.1666428665773; Sat, 22 Oct 2022 01:51:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666428665; cv=none; d=google.com; s=arc-20160816; b=p2BmtGC26XcfGLRk0AgkFCldx0CpUsbQ+EAJsA42Fo/d71wzzDQIhZjuTE43PsW4mc KjkcBGQyESk9q3Qe303H4NvJAqQkq5PGebJ7erGUdXKKI2jveXphpVT/OJuD9/2jvSMw 8Cwz3GNdgAMOOyrS6c7GKMZ5kZ55/IOq8dkJLWdso4tcJggAdWDCK57GrIBzj3j+hin4 t3Sae2XQtiK7aJ2y1m1Vq+iySw2tDmtRjSZFxW5phPJc+Giqkv+zrHyvccG9IZMMkE9Z DjZY5lk5xcjjQrF/vYuhjYtYN330zmCk83KjAdC9Q1tRROeohkVOs5onPwdntg5OhGcT nTNQ== 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=ufNDMjjxo9BePpoAwHqlXIDDm3IgUDOGDL5vHRJUpeQ=; b=QfIiKe6gJnQPogU0KeieI1aw2ZP4o9ZBx9b10OFSKxO1z7HSfryJOKeElalsduvPcu Q7+j5TfGKxZZ5WeiQsf/dLph3OLh92JEzfHtL/S+WIG2uO8ipOFVUZwWWCGG5WgjZnAe mNTSK6Jkw8wV+CMLsMV8lkE11+h7jozpYvR39V9E5WWQmyYM77aOhg1+lX5q5A4qBCMr efF0irie8y0DHZeacJe1A0E+ZVBvwz3j60BNWDa6SmYYhN50HUFRcbyASszG+T16elzt bQrN8zk9rh0da2HmuMcXtagtWnokrW7PFuLdMU+/beetK1Fz22JENCFCSuPe2EFMVJuw y8LQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=G54kT+or; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 oz42-20020a1709077daa00b0077ed84da316si23691188ejc.217.2022.10.22.01.50.40; Sat, 22 Oct 2022 01:51: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=G54kT+or; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231319AbiJVIuD (ORCPT + 99 others); Sat, 22 Oct 2022 04:50:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45570 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234807AbiJVIrt (ORCPT ); Sat, 22 Oct 2022 04:47:49 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 235957D1D0; Sat, 22 Oct 2022 01:10: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 86F02B82E19; Sat, 22 Oct 2022 08:06:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C3903C433C1; Sat, 22 Oct 2022 08:06:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666426012; bh=eguKnLad2H8M6bUVtKYKwm5h06Y8UI6NP/VWTx8rUIM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=G54kT+orGCcqgpWnboH36xHylUZBIlwD1TMx8kZ4q0w9S6Rbq85U4FZm8VVSweDSr mLLJOD5BRwFPN3QRbn7PbSVauH6qYHgXTitu5TAoHpoxDK1N7YDao3k0SMT7f7WQd3 S2BR9+U9uyaM9jigSUXrcyIOnTwaRukk7VU1VekI= 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 5.19 660/717] nbd: Fix hung when signal interrupts nbd_start_device_ioctl() Date: Sat, 22 Oct 2022 09:28:59 +0200 Message-Id: <20221022072527.585225648@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747377104217548214?= X-GMAIL-MSGID: =?utf-8?q?1747377104217548214?= 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 20e9c53eec53..3a3680b3c4fe 100644 --- a/drivers/block/nbd.c +++ b/drivers/block/nbd.c @@ -1414,10 +1414,12 @@ static int nbd_start_device_ioctl(struct nbd_device *nbd) 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(nbd); /* user requested, ignore socket errors */ From patchwork Sat Oct 22 07: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: 7678 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1108763wrr; Sat, 22 Oct 2022 01:45:58 -0700 (PDT) X-Google-Smtp-Source: AMsMyM711RxPMdq1cRk0ad7zfdQlHauCBX+oPOC2xm/I3lZ9eO+AavD2cHlEZvH0raz9eRSUFIsL X-Received: by 2002:a17:907:9625:b0:78d:bb06:9072 with SMTP id gb37-20020a170907962500b0078dbb069072mr19172032ejc.472.1666428357944; Sat, 22 Oct 2022 01:45:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666428357; cv=none; d=google.com; s=arc-20160816; b=cxZt8kyQKAyC6hI3FzkJFBskKm00Ru0C93kQ/KuQwl3/Cznuj/qpu/ncXsextG84Dt lmhFrVIXlGE4TG6ECPRa62wknrvYdTnwWGJsWSl6PY2fhn0rtFYkFA+5gERl7gW+ZTul JYxbTsJCKjpdfPeCSW73qjzGhmKTjIQ+v4T5POOC7Uqw1/Rm5axX6KI5RQQbWubUDUgh rbGRuUxErYSTQoq4jNwUf+EVoZDkrWdAC/lkbhD57/BJKF9NjR/Hiy7lYkEqr7DnUD6Z OJxOGZpdOU2j4vzFEeEVTXrA2MMdAmbZHcsTEWBVYsSaw3e0bTSagq1u9zPa8ItLy2Cb n7qw== 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=zfRt1IgQHQfzVWu8VMHJQfDrkPN25LJnWQhPCU2JvDM=; b=dw3MB1XcNP904ZEVmDUH1cdn6RmcDrr9YBfuosCfi1kunakl5ZcfC3AdbeJ0tZGgT8 2dI+xA801rX1dPbUEKg1oxyi8jFpWgWT/J1Od36VeDlj1YB/DOi8ur8Wk6AcydLhNPoK 8L5gP1+OUZYojkLLGsoY+f7HT5zb1syPxHfIyQ3c4vzM9yeP8QrQ9qqk/AJKLtQgS5UA fYIVbG9F1H5WBA0Ny1DMcECiSFmT1HpJP2gQVXM2wZ6yNaOKXqzGg5et14f0T7gf27cD FwDeU0lmhrosLoxkmlH2pZvuOvtViIcWN/AtawDQUHMTKI/gilCkCe2AIeK0y2i+L3sH h1Og== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=E4BEEnO8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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-20020a170906854400b0077b287e3adesi17769187ejy.190.2022.10.22.01.45.32; Sat, 22 Oct 2022 01:45: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=E4BEEnO8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S234698AbiJVInf (ORCPT + 99 others); Sat, 22 Oct 2022 04:43:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52858 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234696AbiJVImW (ORCPT ); Sat, 22 Oct 2022 04:42:22 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C23492E7BB8; Sat, 22 Oct 2022 01:06: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 dfw.source.kernel.org (Postfix) with ESMTPS id 9C63460B40; Sat, 22 Oct 2022 08:06:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B20A9C433D6; Sat, 22 Oct 2022 08:06:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666426015; bh=aZVzA0Fqpt2J+xf2p0wOtv5uyqkIk7yWq6pL5/lVCu8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=E4BEEnO8CFmXOmgHucZ0YQdcwUnQIzMWlwnWFZib0uXeNPCB90Xa31XNIA4dpuvoC eilOdcsl/8o0ungUUncqaWfYik63YbCw5AMXiqIPLXjGKxwldM28gBIl7bJaWTN+b0 J1BvCGR2NPsU5b3hmVTXY88VgWf1SzMd9v7yJ3S8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Will Deacon , Yicong Yang , John Garry , Mathieu Poirier , Sasha Levin Subject: [PATCH 5.19 661/717] iommu/arm-smmu-v3: Make default domain type of HiSilicon PTT device to identity Date: Sat, 22 Oct 2022 09:29:00 +0200 Message-Id: <20221022072527.636321501@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376781545571394?= X-GMAIL-MSGID: =?utf-8?q?1747376781545571394?= From: Yicong Yang [ Upstream commit 24b6c7798a0122012ca848ea0d25e973334266b0 ] The DMA operations of HiSilicon PTT device can only work properly with identical mappings. So add a quirk for the device to force the domain as passthrough. Acked-by: Will Deacon Signed-off-by: Yicong Yang Reviewed-by: John Garry Link: https://lore.kernel.org/r/20220816114414.4092-2-yangyicong@huawei.com Signed-off-by: Mathieu Poirier Signed-off-by: Sasha Levin --- drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c index 88817a3376ef..e119ff8396c9 100644 --- a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c +++ b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c @@ -2839,6 +2839,26 @@ static int arm_smmu_dev_disable_feature(struct device *dev, } } +/* + * HiSilicon PCIe tune and trace device can be used to trace TLP headers on the + * PCIe link and save the data to memory by DMA. The hardware is restricted to + * use identity mapping only. + */ +#define IS_HISI_PTT_DEVICE(pdev) ((pdev)->vendor == PCI_VENDOR_ID_HUAWEI && \ + (pdev)->device == 0xa12e) + +static int arm_smmu_def_domain_type(struct device *dev) +{ + if (dev_is_pci(dev)) { + struct pci_dev *pdev = to_pci_dev(dev); + + if (IS_HISI_PTT_DEVICE(pdev)) + return IOMMU_DOMAIN_IDENTITY; + } + + return 0; +} + static struct iommu_ops arm_smmu_ops = { .capable = arm_smmu_capable, .domain_alloc = arm_smmu_domain_alloc, @@ -2856,6 +2876,7 @@ static struct iommu_ops arm_smmu_ops = { .sva_unbind = arm_smmu_sva_unbind, .sva_get_pasid = arm_smmu_sva_get_pasid, .page_response = arm_smmu_page_response, + .def_domain_type = arm_smmu_def_domain_type, .pgsize_bitmap = -1UL, /* Restricted during device attach */ .owner = THIS_MODULE, .default_domain_ops = &(const struct iommu_domain_ops) { From patchwork Sat Oct 22 07: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: 7854 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1157473wrr; Sat, 22 Oct 2022 04:17:33 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4Kl0JGdXCE3EguRXQ2r4VuNa+pVEsxeIftDUPJZKZsUFvMVl5RSZhdNBf7Bxf3CXt/YXvU X-Received: by 2002:a17:902:e886:b0:186:6eea:cd35 with SMTP id w6-20020a170902e88600b001866eeacd35mr11232446plg.116.1666437452774; Sat, 22 Oct 2022 04:17:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666437452; cv=none; d=google.com; s=arc-20160816; b=Trw8nAvDiWoo4LlOxR2JgW12Nko3hweMBR7sG0FQvbBH0+e1XyQoMoqeddVzqvM4+R G9u0VeBtg7arAYAbCuukmS8THGMdNnvZSahUJQfxG1nPRjm7/DjG6G9OUZiAen9CAwmP +4AeAV/8S6qX8LUtdhoQOcQS/1Jpfc0SYUzdEIwmO6akxlt3FkMEDR9YncRwKZ5LleIZ s24xyyHKUh67LQ8ktrZhzGKpgeZ0I/G/nnt7rmkPgxUfjztIyfwTu3Vn+llL0pem3BuO WMnadj4oSj8sbYD00c8ld9PrNlDP+LZfYKfsNv2fz5q0L43mEbHNKEwxrbTMoXUJRJ1Z ICcA== 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=n0E7RCyo5gwJf8JdydLgA0GE6aibESPVwZUZVA7t2tE=; b=FxasQbWGN3HbA+vnCR5CGUPEhRF7GzkjaOn9uhRmA6GV8jce8jZ8S6TO80u16iAcph L3MjJffhuVJiuY/HK5NhXHW2wzISuJvV3RD+nS4vgo7e/eLbjczPFhgXcmqGPti9UELq uk6VCB+bRcmOX280hmNz9k1iJld+J3/OJ1s1SzBi1JBqrzqDct3REY3KqJ391vMHbGsr Q8qg2z2T8k7+GyS6OGOpJ9UQtpfHM3dHEuzDmXrGluPxg8Oif+fjKrjtbbYqo4d+Nzwb olMaLA+7ExDjwPtcA45Gu/TDcoOQrL9oQmlsF5wCskicBFwIad3L2QYs+C/oqba2BOxc ACxg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ebRoYM1I; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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-20020a63ff61000000b0042be0a584cfsi3979290pgk.698.2022.10.22.04.17.20; Sat, 22 Oct 2022 04:17: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=ebRoYM1I; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231219AbiJVLQ5 (ORCPT + 99 others); Sat, 22 Oct 2022 07:16:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53708 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231199AbiJVLQi (ORCPT ); Sat, 22 Oct 2022 07:16: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 9679C4363A; Sat, 22 Oct 2022 03:41: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 5B854B82D9F; Sat, 22 Oct 2022 08:05:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C147AC433C1; Sat, 22 Oct 2022 08:05:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425928; bh=ZLE1CSNMbyO4wlg97VRaWaPwROidpEs6zu78zaQFPic=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ebRoYM1IKJPxyhb58wdm6yWzlDwLvofDOxzmA/RHs1PcJq6ICbXNHfwLqpflMy0o/ xQsIwwh8oBl76ms9P7v1cbk8Lkiq+aSv7UXW1HL1uB6WdIU5FD6UzeGsi4aZ4wa/1W 86mjoxP6ATs9Pj21/m1kS0CBCgnjjpKqk32GkWXA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Michael Grzeschik , Sasha Levin Subject: [PATCH 5.19 662/717] usb: gadget: uvc: increase worker prio to WQ_HIGHPRI Date: Sat, 22 Oct 2022 09:29:01 +0200 Message-Id: <20221022072527.671569804@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 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?1747386318327739488?= X-GMAIL-MSGID: =?utf-8?q?1747386318327739488?= From: Michael Grzeschik [ Upstream commit 9b91a65230784a9ef644b8bdbb82a79ba4ae9456 ] This patch is changing the simple workqueue in the gadget driver to be allocated as async_wq with a higher priority. The pump worker, that is filling the usb requests, will have a higher priority and will not be scheduled away so often while the video stream is handled. This will lead to fewer streaming underruns. Signed-off-by: Michael Grzeschik Link: https://lore.kernel.org/r/20220907215818.2670097-1-m.grzeschik@pengutronix.de Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/usb/gadget/function/f_uvc.c | 4 ++++ drivers/usb/gadget/function/uvc.h | 1 + drivers/usb/gadget/function/uvc_v4l2.c | 2 +- drivers/usb/gadget/function/uvc_video.c | 9 +++++++-- 4 files changed, 13 insertions(+), 3 deletions(-) diff --git a/drivers/usb/gadget/function/f_uvc.c b/drivers/usb/gadget/function/f_uvc.c index 86bb0098fb66..7ec223849d94 100644 --- a/drivers/usb/gadget/function/f_uvc.c +++ b/drivers/usb/gadget/function/f_uvc.c @@ -897,10 +897,14 @@ static void uvc_function_unbind(struct usb_configuration *c, { struct usb_composite_dev *cdev = c->cdev; struct uvc_device *uvc = to_uvc(f); + struct uvc_video *video = &uvc->video; long wait_ret = 1; uvcg_info(f, "%s()\n", __func__); + if (video->async_wq) + destroy_workqueue(video->async_wq); + /* * If we know we're connected via v4l2, then there should be a cleanup * of the device from userspace either via UVC_EVENT_DISCONNECT or diff --git a/drivers/usb/gadget/function/uvc.h b/drivers/usb/gadget/function/uvc.h index 58e383afdd44..1a31e6c6a5ff 100644 --- a/drivers/usb/gadget/function/uvc.h +++ b/drivers/usb/gadget/function/uvc.h @@ -88,6 +88,7 @@ struct uvc_video { struct usb_ep *ep; struct work_struct pump; + struct workqueue_struct *async_wq; /* Frame parameters */ u8 bpp; diff --git a/drivers/usb/gadget/function/uvc_v4l2.c b/drivers/usb/gadget/function/uvc_v4l2.c index fd8f73bb726d..fddc392b8ab9 100644 --- a/drivers/usb/gadget/function/uvc_v4l2.c +++ b/drivers/usb/gadget/function/uvc_v4l2.c @@ -170,7 +170,7 @@ uvc_v4l2_qbuf(struct file *file, void *fh, struct v4l2_buffer *b) return ret; if (uvc->state == UVC_STATE_STREAMING) - schedule_work(&video->pump); + queue_work(video->async_wq, &video->pump); return ret; } diff --git a/drivers/usb/gadget/function/uvc_video.c b/drivers/usb/gadget/function/uvc_video.c index c00ce0e91f5d..bb037fcc90e6 100644 --- a/drivers/usb/gadget/function/uvc_video.c +++ b/drivers/usb/gadget/function/uvc_video.c @@ -277,7 +277,7 @@ uvc_video_complete(struct usb_ep *ep, struct usb_request *req) spin_unlock_irqrestore(&video->req_lock, flags); if (uvc->state == UVC_STATE_STREAMING) - schedule_work(&video->pump); + queue_work(video->async_wq, &video->pump); } static int @@ -485,7 +485,7 @@ int uvcg_video_enable(struct uvc_video *video, int enable) video->req_int_count = 0; - schedule_work(&video->pump); + queue_work(video->async_wq, &video->pump); return ret; } @@ -499,6 +499,11 @@ int uvcg_video_init(struct uvc_video *video, struct uvc_device *uvc) spin_lock_init(&video->req_lock); INIT_WORK(&video->pump, uvcg_video_pump); + /* Allocate a work queue for asynchronous video pump handler. */ + video->async_wq = alloc_workqueue("uvcgadget", WQ_UNBOUND | WQ_HIGHPRI, 0); + if (!video->async_wq) + return -EINVAL; + video->uvc = uvc; video->fcc = V4L2_PIX_FMT_YUYV; video->bpp = 16; From patchwork Sat Oct 22 07: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: 7685 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1108969wrr; Sat, 22 Oct 2022 01:46:46 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4SZ8K3+fRVP5m0sqav5JK6d5XpC+qcwl6KLxseGKLKAySZ4E+SIMxEPa2EiO+6UDpr2yXP X-Received: by 2002:a17:907:2ceb:b0:78d:b765:c50d with SMTP id hz11-20020a1709072ceb00b0078db765c50dmr19095815ejc.73.1666428405910; Sat, 22 Oct 2022 01:46:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666428405; cv=none; d=google.com; s=arc-20160816; b=gxRG7PUdWhA/8NnbbGlqv+FLWVD8M+XT3Hedck3gl1v1Ivc8TEPm1CJPzpr9eija2l TPtqwbi/vgNb2Hh/vIkVYLw8kO+I6jeiduQUPModsteufca+4XZNjmVFsvzdbJWDmA0V WF2VNejuNoDoamTx2oie5rBQ9eDmldG6HTIixa+TOxd9ssT8fG2fuwrv7qFbF56YqNiE csdhMU4v8WUJ1DAjb7ygvwravSaYtgOjSl51MVApuY6NKhUbJmeyX2jjUtbLxOFqWQYz IzyrqHJaUUg2bTV7IK+HaGS+zTNvUhRXhwr4kPXNYBfTb7FigrfIYMPtHwMdVLy/V6Aa CSAA== 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=mbeuuKyS1JYr9BJ4A8TldBavJoN2bhxICYGV6ZtSC3g=; b=Ien8M8CGorerIlw8I261tTwiPsa+Zh1b2I3iDmsiO97UElGQaTXnXr5VWuVkmxdzyU 5U24r87bSq+N2n5iKNLB0bBEebFCAydf/RE/dcqPs+QknLMZEopi8+dSkmQIf0fwjmK9 J7sK0e2sF69CEBnxAQB7mcnrHJedfRLtxSDfyhyBRwHkag6TK6ImOCjf88EbB4HTTayJ rp4cZC1esh+3YzNif5ffpByswfcvcesxMiiPVnjfxNmzfCVg+BUz1aqTVl+xPGhhZhKx nwnG/wlrWkKCbv7n+qK5mEZu6Al2FZqRpNP/7OniKsesbjJpIJThAm9d0JGU94TOPhUV dDBg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=aHxEysoY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 g11-20020a056402320b00b004613ae68ca0si4425585eda.442.2022.10.22.01.46.20; Sat, 22 Oct 2022 01:46: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=aHxEysoY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231854AbiJVIp2 (ORCPT + 99 others); Sat, 22 Oct 2022 04:45:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46262 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234490AbiJVInL (ORCPT ); Sat, 22 Oct 2022 04:43: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 2AC732E96B6; Sat, 22 Oct 2022 01: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 ams.source.kernel.org (Postfix) with ESMTPS id 7C1B8B82E39; Sat, 22 Oct 2022 08:05:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B8A34C433D6; Sat, 22 Oct 2022 08:05:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425931; bh=PyVuP224LTfOgKeY7PGhWDcswJIc+RIZ/ujbhn1tRm4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=aHxEysoYtx0YQgZ3g7DWu0/1W0TUiTLFXBipaNMQF/3h4HPltWp1Co3LnBQ7e2gp/ cCajn5bopvErNy3Ulaqipww46kJyKpdQttyZXgPaXuLh8q4Lp0lc+Gkgf2PeyK0aKv 2sYbRGW4pN/XV+IwC9MwTfEdeurhL5MjwGe4ONzM= 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 5.19 663/717] power: supply: adp5061: fix out-of-bounds read in adp5061_get_chg_type() Date: Sat, 22 Oct 2022 09:29:02 +0200 Message-Id: <20221022072527.715316714@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376832481127222?= X-GMAIL-MSGID: =?utf-8?q?1747376832481127222?= 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 003557043ab3..daee1161c305 100644 --- a/drivers/power/supply/adp5061.c +++ b/drivers/power/supply/adp5061.c @@ -427,11 +427,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 Sat Oct 22 07: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: 7744 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1111039wrr; Sat, 22 Oct 2022 01:55:43 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4AzxLVZISYO6SXUGcArPhIJVHjiEm1uTKrahNY/3zbDOwBEQOCUApW+Kr6QTdeSMt3lbbo X-Received: by 2002:a17:907:6d9a:b0:7a0:d2d9:31cc with SMTP id sb26-20020a1709076d9a00b007a0d2d931ccmr2018783ejc.747.1666428943652; Sat, 22 Oct 2022 01:55:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666428943; cv=none; d=google.com; s=arc-20160816; b=kOfBaGcJLAqt2Lgm31PpBm+a6DjMAA6c3N0U4VFl+NDu6dQ3LMOHdKPQNiG2ryydGV RLfwDPfOQ8D31QK62tvKNID/RmBsjiny7KII4me/d02JtZQeeGKYZy1rDQYPHWWQcj8/ Dukhs74EulULgKLRStDcF6V2wcxzXPZ6b2QzCQN37lYMoOHPg/59UJu+S7smMToJqjWe oEhRU9dQp52hPaCK+cjOYW6LiUq0jU9BZzVNWC0zeahDRtzXDagwerIaZysMEEV/ozId HsToyRadsLRRv9Mh6F8h8x/ezmt1KK6m1sLgw9qSAb1q7Suq2G503wRzXEqpSPk1KeTr F1jA== 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=y+7SeGmAR1knAc1kQp0LMed0dnmeTwiDcUIDxNFVKA0=; b=Xu0Pv3q9bElLfXPmoCa5h+6KUPiBLyAvG4reNyx3kDRI+Yo1tMi8cWN61RvpJepwgK MPF0XZZ5Z9c0hUBZgBynfNQ0yGV67ph4cdYBLzAipmyoYxcqW4qgPzKkNe/ARd6rKEDd l320dj3aogPqR7QNPzU453JGbLgRg7chCBz3SEp0QHUD1MZFFvj97jQvOWirJDHNSx7P b21gZWL7yrHiy6RXadEIBoz7wGDLHmlvyCkGuWZMrbzXkF0t5ezPLfQLBlb1eFdPkReF yxtNsC/FuN+VlIN26uhtwbHkHcgAykg1A6oxWXbc3CCqUGtO/egtvLJrrxtjPSiutCDD S77w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=qFuhRjOB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 hq4-20020a1709073f0400b00791910ecd0fsi19494879ejc.540.2022.10.22.01.55.19; Sat, 22 Oct 2022 01:55: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=qFuhRjOB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S234932AbiJVIxj (ORCPT + 99 others); Sat, 22 Oct 2022 04:53:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39102 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231858AbiJVIwu (ORCPT ); Sat, 22 Oct 2022 04:52:50 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2DCE1635E1; Sat, 22 Oct 2022 01:12: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 dfw.source.kernel.org (Postfix) with ESMTPS id C193660ADF; Sat, 22 Oct 2022 08:05:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D8A8BC433D6; Sat, 22 Oct 2022 08:05:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425934; bh=D/w4+tNdgXpjzCLigmMkqIOrd6AKbniJcwUCMTZWcE4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qFuhRjOBeBpBC3+lEN36tYhWEpqJQEK8Fiw/uffV9/qnb8giRZDULmIzwShC0KswQ ZqjztbUi0QUiMRhi9BXJkk2ycOeQ9Igo35jMf+px1esNuF0uWadhcWo0zB4y+tV1O3 8qPH7saBSMMLN4jSYxoJDiN8lpypla6ow8pKuLMI= 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 5.19 664/717] staging: vt6655: fix potential memory leak Date: Sat, 22 Oct 2022 09:29:03 +0200 Message-Id: <20221022072527.766676824@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747377396082999994?= X-GMAIL-MSGID: =?utf-8?q?1747377396082999994?= 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 ecb8c3934bc6..a91c834c96c0 100644 --- a/drivers/staging/vt6655/device_main.c +++ b/drivers/staging/vt6655/device_main.c @@ -675,7 +675,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 Sat Oct 22 07: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: 7682 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1108891wrr; Sat, 22 Oct 2022 01:46:27 -0700 (PDT) X-Google-Smtp-Source: AMsMyM43MXSUnXPxzwsH0qZhfqltHbXEVROnVPflHPSUTubufNmvZD66szJ3hPjXm2M01jI6lPdb X-Received: by 2002:aa7:d614:0:b0:458:f796:f86a with SMTP id c20-20020aa7d614000000b00458f796f86amr21382204edr.294.1666428386653; Sat, 22 Oct 2022 01:46:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666428386; cv=none; d=google.com; s=arc-20160816; b=ENQ1PAwfGAqF7+YeEWub+hr5G4b5kAU+Wu35ITuWoGe2/GFcYdqJ+dXHsnLZeURN6o LfGVYVfVxfFxgA3UewRLlW1uVcjBzRGc34+fDhsVubjM0i+axv3zT1NcHndUgkrDvu1X G+TKckzuodbl6TXCG7i7Cx/+BrICFphFVGgj0a9y9YpvGYig1rKe0HWlizk75nA5EG1P PO+YvSs1757AnyP4c0q2WuVkM89hNq8/2cGfrRTS5Uj4bIVpxWU4hqP883aHAQVNK/fJ rstvptUZINb2iD10Lx3qaJILvdUaUBBtAusCXpwTWQ7g9w2haXUk6W9SEXlbvmOd7WIP 0ZUw== 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=MLyGy1DGICMMC1rqPP1dPuXWXK8MtdqP/UrWLDfzXTU=; b=VmsDmoawS0nvLKweLRhHEcTQ3ryvsNPpCTUO1vJpW4UGstL7fPPveTPyCnjQ9C+I3Q PzCqJBxGw3xk53iSaft9z0FyeXgBmQMlRdDYL6LWPapyykMJxKIXTZHIvCBxCTf7GRQQ CrJgoSgL/xBZ2LVpfR1VScDLKKano9rUJ6VwG/reVGMoOOCRu2PDmXvigtha6c94T1JG nb8JIJIBQVW1RqYsi6xUcp9qvRZ31ap645KgPhpsl8z5cpbJ9TGvW9EtbJlZR1a9Qppr DeB+lirX+fmd4f/lglNu1Km6Fuwt/WRIx2Ohp6M78HNG0lXKeegdyl5Ohtp4+9SHr4Mx HlZg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="Qv4/panU"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 p11-20020a50cd8b000000b00459a988ca2csi20287288edi.116.2022.10.22.01.46.01; Sat, 22 Oct 2022 01:46: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="Qv4/panU"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S234450AbiJVIpc (ORCPT + 99 others); Sat, 22 Oct 2022 04:45:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52862 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234659AbiJVInW (ORCPT ); Sat, 22 Oct 2022 04:43:22 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D27762E96A8; Sat, 22 Oct 2022 01:07: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 B22E4B82E33; Sat, 22 Oct 2022 08:05:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C43D2C433C1; Sat, 22 Oct 2022 08:05:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425937; bh=LNGbMV8ZTXHP0BvFmkjIFu88R3KVUozTm+4VCWX6gBw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Qv4/panUUqAihJU0ODJyGLa4XuUOrd1K1fW76bALmQ6kQDroCq2dhVoUn7j4hN/8d /fCeuH7n8itKR5jeerwU52XrxJrZgeWIBSOFyvLuSb2+OiRauBRXUvJTLzN2HleMJv 0NNfk+vu4xLMlsGVvT5ZtO0lDIZN73bQCevk6A1M= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Yu Kuai , Tejun Heo , Jens Axboe , Sasha Levin Subject: [PATCH 5.19 665/717] blk-throttle: prevent overflow while calculating wait time Date: Sat, 22 Oct 2022 09:29:04 +0200 Message-Id: <20221022072527.815483038@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376812038584634?= X-GMAIL-MSGID: =?utf-8?q?1747376812038584634?= From: Yu Kuai [ Upstream commit 8d6bbaada2e0a65f9012ac4c2506460160e7237a ] There is a problem found by code review in tg_with_in_bps_limit() that 'bps_limit * jiffy_elapsed_rnd' might overflow. Fix the problem by calling mul_u64_u64_div_u64() instead. Signed-off-by: Yu Kuai Acked-by: Tejun Heo Link: https://lore.kernel.org/r/20220829022240.3348319-3-yukuai1@huaweicloud.com Signed-off-by: Jens Axboe Signed-off-by: Sasha Levin --- block/blk-throttle.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/block/blk-throttle.c b/block/blk-throttle.c index 387783980024..acdd85a07f92 100644 --- a/block/blk-throttle.c +++ b/block/blk-throttle.c @@ -806,7 +806,7 @@ static bool tg_with_in_bps_limit(struct throtl_grp *tg, struct bio *bio, u64 bps_limit, unsigned long *wait) { bool rw = bio_data_dir(bio); - u64 bytes_allowed, extra_bytes, tmp; + u64 bytes_allowed, extra_bytes; unsigned long jiffy_elapsed, jiffy_wait, jiffy_elapsed_rnd; unsigned int bio_size = throtl_bio_data_size(bio); @@ -824,10 +824,8 @@ static bool tg_with_in_bps_limit(struct throtl_grp *tg, struct bio *bio, jiffy_elapsed_rnd = tg->td->throtl_slice; jiffy_elapsed_rnd = roundup(jiffy_elapsed_rnd, tg->td->throtl_slice); - - tmp = bps_limit * jiffy_elapsed_rnd; - do_div(tmp, HZ); - bytes_allowed = tmp; + bytes_allowed = mul_u64_u64_div_u64(bps_limit, (u64)jiffy_elapsed_rnd, + (u64)HZ); if (tg->bytes_disp[rw] + bio_size <= bytes_allowed) { if (wait) From patchwork Sat Oct 22 07: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: 7676 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1108729wrr; Sat, 22 Oct 2022 01:45:54 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7uLO+15v0FYEWrEnou8fV0qxGqab0OoEUpI7JB2RLkf/jZRyC4mHZmpPzN89P+tUTWQx8c X-Received: by 2002:a17:907:843:b0:73a:5b0e:8352 with SMTP id ww3-20020a170907084300b0073a5b0e8352mr19431205ejb.438.1666428354095; Sat, 22 Oct 2022 01:45:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666428354; cv=none; d=google.com; s=arc-20160816; b=pUzJ1FwOvso520q/ysIW99fh31C/2bmCwIBF72cQI1ZjF/TyoBgZSoQKrJVYcYygmg Lcf2H8y9IGKgvMWaHWuHPxjErJc3o8a9AqBAq+to0o/DM5lS2m5A4l6WPOUcIXHTDOnt FvpfJhP6fEL18nV8Cdx0Vnxj2+1Hp0mQcFQunKhFwG6wWquDDKVifEza188Oo8deTX20 dmgs7v3+4k07CLaCfSLiuHdbuQY+M5qw2ruaZyCVcUDQSG7LpDxJl94QIk+YR66plcpU HuX5fgolcyHal+UBVEKzjl/z33S2Z8ZCH3zMRj94C3X1zPgRJVMYrEBdaYwZ0THff22Z lKuQ== 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=lTFY5OeVKumRcKrxOMgwJQOcmNa8efBx2Q4pZMeHoiU=; b=kdjCTNLd28N8aEkTMp6H7guWOAt3OAhhurpJ7QvEnRuYHt0HXqmJx8dHGIDPFdEfli Sz7GR8cXGgmAvCFgF1mBRbKp0cNbger/3goPRBbh4vKulOGA59jxCb0uw0YhlNQb5cHp 5t8+Keh3k2E1G4DQHl5becPuw2c9whP8Ux2/7xIGIYPdGCe6RhN64goSBQY2iwV2WdxN vREPxfLxdpWFGEDjjiYnOjn0IppRzAakjojTzuWcc5VOOfeUvpFIlzsnCuWTe0CytC1Y 35ml4GGH6lGZob/I4xjr6/+JdSX6bBvPNPlk4qxbSLVleZ3tfMnOL4Ro7kZSZvFINFLk ljFw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=vfWDLaUm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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-20020a170906974800b0073db512d918si22237767ejy.765.2022.10.22.01.45.30; Sat, 22 Oct 2022 01:45: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=vfWDLaUm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S234675AbiJVImR (ORCPT + 99 others); Sat, 22 Oct 2022 04:42:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54272 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234632AbiJVIjX (ORCPT ); Sat, 22 Oct 2022 04:39:23 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6E5EF2505F0; Sat, 22 Oct 2022 01:05: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 0CAD160ADC; Sat, 22 Oct 2022 08:05:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 06B19C433D6; Sat, 22 Oct 2022 08:05:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425940; bh=YBukERdAxHkU57EcJR6ZhFZ2hlJha5Z6ys8hKW3Glgs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vfWDLaUmwChhDB3qlJCUO2D1Szh8FrnKcMzfN0i4cSInzQe2z5docbKt+ZoytklDH wftEZuDVVDgM+rVtlIexiyRbicpoNbKGgJW4U1iKsRkrZtfKG0nsYrYCSLBQGvYHgB rixL7VphuL30U9HjiBUnY0Rqf5ZVnW6gSeCZRhoM= 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 5.19 666/717] ata: libahci_platform: Sanity check the DT child nodes number Date: Sat, 22 Oct 2022 09:29:05 +0200 Message-Id: <20221022072527.857706859@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376778142995107?= X-GMAIL-MSGID: =?utf-8?q?1747376778142995107?= 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 32495ae96567..986f1923a76d 100644 --- a/drivers/ata/libahci_platform.c +++ b/drivers/ata/libahci_platform.c @@ -451,14 +451,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 Sat Oct 22 07: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: 7773 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1121128wrr; Sat, 22 Oct 2022 02:27:35 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6h70OYelkgXUbwgZiB0lrmqVhQcJsBLGgV5rR8wW8UfdWTYct8nzhhh3P4VT1UILnF6/t4 X-Received: by 2002:a17:902:d58c:b0:17f:998a:76cd with SMTP id k12-20020a170902d58c00b0017f998a76cdmr23235558plh.155.1666430855292; Sat, 22 Oct 2022 02:27:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666430855; cv=none; d=google.com; s=arc-20160816; b=pzvMFY22HXP0N6SE99C+S6eZZ1wmiN3gbShKe/3AQYE70RR1UkdTQUTZ1kfQxVOktx htFJFX0CF3n5qtM7Ww8LLGPPkBaehIRqhTjda37DK4WRgWc62kA8+b8rwonaqT7ckk/6 7Q30vR+YiU9VR/u1L4uPRD8JHUSoYl1ogRtGJxzFZ0NUqqVdpNVoUtpvx8HVEsovn/f1 W1+k5ddU90QQbZRxz5ODumfi3CPu/ufVu5TnFXtg54JxI2KFJCgKmHPoWbLWOPQ/qII4 0R5O3I6hZKZ/famDL8UHPTE+1aF/juWBJ2ih0fAcPfAFX06IW7FyQSCD7yuGxV7pu+FH DpNA== 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=wcDkUeUQc/SkDILmiI0yP+JqNGi2jytDuErkXD01vOI=; b=0d/NXXKXYz+MTWRoZ3ZSgFoJ3kLl9cqoJd6/L77WSvNZR78nc5Fc6UpAvjj0Zl4gVX 1Lbuc1dxv2T3G4B3CxgbukXF2McFNj3DEGniQ/4X8u9+B5o0ArbBasW23KUlRmEotplF MTOw3yy9oNK9g4yajejPtp0JebY9jFZmozojnhjpSBpivwcmTUDOWeqCXYgxd5vjKN1v T5V+ASYx/VdRj/Q55HqZebkiLDEIMoS6NNx+D+0uhXHbclY0AvLnOu+Y/TQI4KMIlHzL MAj2TPVd5ujfOZkevgyYXc4VhLpDhMdE5NkMtmMYnqZjar9clhA8fwSa/EcbcRMQgQ5E J0CQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="tZ/VpPLx"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 y14-20020a17090aa40e00b0020a74d5486esi2183390pjp.21.2022.10.22.02.27.22; Sat, 22 Oct 2022 02:27: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="tZ/VpPLx"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S232931AbiJVJDD (ORCPT + 99 others); Sat, 22 Oct 2022 05:03:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58322 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231966AbiJVJCG (ORCPT ); Sat, 22 Oct 2022 05:02:06 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6C3C12DCB27; Sat, 22 Oct 2022 01:17: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 ams.source.kernel.org (Postfix) with ESMTPS id 8918CB82E25; Sat, 22 Oct 2022 08:05:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F1181C433D6; Sat, 22 Oct 2022 08:05:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425943; bh=pyFqEjCsJm/B3AhoMs/+9UBXpGWPBTmE33Qm6IaChXk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tZ/VpPLxMtoqhxJGEfHDZMLidJu9ivGNZzSroYVCnSq+xHraFP7xMnmaNiFH8ZcNL 8Tnl7Yp27+mZnSmlu/5zFRagYg+raYfehh95+xChIPyr9TPY/q03bWjxnwXrfDC/rH klaqe/kcDc6GK1+zTE7P8mKmzVTMW/nTDmdmdx0g= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mingzhe Zou , Coly Li , Jens Axboe , Sasha Levin Subject: [PATCH 5.19 667/717] bcache: fix set_at_max_writeback_rate() for multiple attached devices Date: Sat, 22 Oct 2022 09:29:06 +0200 Message-Id: <20221022072527.909354906@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747379400847349695?= X-GMAIL-MSGID: =?utf-8?q?1747379400847349695?= From: Coly Li [ Upstream commit d2d05b88035d2d51a5bb6c5afec88a0880c73df4 ] Inside set_at_max_writeback_rate() the calculation in following if() check is wrong, if (atomic_inc_return(&c->idle_counter) < atomic_read(&c->attached_dev_nr) * 6) Because each attached backing device has its own writeback thread running and increasing c->idle_counter, the counter increates much faster than expected. The correct calculation should be, (counter / dev_nr) < dev_nr * 6 which equals to, counter < dev_nr * dev_nr * 6 This patch fixes the above mistake with correct calculation, and helper routine idle_counter_exceeded() is added to make code be more clear. Reported-by: Mingzhe Zou Signed-off-by: Coly Li Acked-by: Mingzhe Zou Link: https://lore.kernel.org/r/20220919161647.81238-6-colyli@suse.de Signed-off-by: Jens Axboe Signed-off-by: Sasha Levin --- drivers/md/bcache/writeback.c | 73 +++++++++++++++++++++++++---------- 1 file changed, 52 insertions(+), 21 deletions(-) diff --git a/drivers/md/bcache/writeback.c b/drivers/md/bcache/writeback.c index 3f0ff3aab6f2..9c227e4a8465 100644 --- a/drivers/md/bcache/writeback.c +++ b/drivers/md/bcache/writeback.c @@ -157,6 +157,53 @@ static void __update_writeback_rate(struct cached_dev *dc) dc->writeback_rate_target = target; } +static bool idle_counter_exceeded(struct cache_set *c) +{ + int counter, dev_nr; + + /* + * If c->idle_counter is overflow (idel for really long time), + * reset as 0 and not set maximum rate this time for code + * simplicity. + */ + counter = atomic_inc_return(&c->idle_counter); + if (counter <= 0) { + atomic_set(&c->idle_counter, 0); + return false; + } + + dev_nr = atomic_read(&c->attached_dev_nr); + if (dev_nr == 0) + return false; + + /* + * c->idle_counter is increased by writeback thread of all + * attached backing devices, in order to represent a rough + * time period, counter should be divided by dev_nr. + * Otherwise the idle time cannot be larger with more backing + * device attached. + * The following calculation equals to checking + * (counter / dev_nr) < (dev_nr * 6) + */ + if (counter < (dev_nr * dev_nr * 6)) + return false; + + return true; +} + +/* + * Idle_counter is increased every time when update_writeback_rate() is + * called. If all backing devices attached to the same cache set have + * identical dc->writeback_rate_update_seconds values, it is about 6 + * rounds of update_writeback_rate() on each backing device before + * c->at_max_writeback_rate is set to 1, and then max wrteback rate set + * to each dc->writeback_rate.rate. + * In order to avoid extra locking cost for counting exact dirty cached + * devices number, c->attached_dev_nr is used to calculate the idle + * throushold. It might be bigger if not all cached device are in write- + * back mode, but it still works well with limited extra rounds of + * update_writeback_rate(). + */ static bool set_at_max_writeback_rate(struct cache_set *c, struct cached_dev *dc) { @@ -167,21 +214,8 @@ static bool set_at_max_writeback_rate(struct cache_set *c, /* Don't set max writeback rate if gc is running */ if (!c->gc_mark_valid) return false; - /* - * Idle_counter is increased everytime when update_writeback_rate() is - * called. If all backing devices attached to the same cache set have - * identical dc->writeback_rate_update_seconds values, it is about 6 - * rounds of update_writeback_rate() on each backing device before - * c->at_max_writeback_rate is set to 1, and then max wrteback rate set - * to each dc->writeback_rate.rate. - * In order to avoid extra locking cost for counting exact dirty cached - * devices number, c->attached_dev_nr is used to calculate the idle - * throushold. It might be bigger if not all cached device are in write- - * back mode, but it still works well with limited extra rounds of - * update_writeback_rate(). - */ - if (atomic_inc_return(&c->idle_counter) < - atomic_read(&c->attached_dev_nr) * 6) + + if (!idle_counter_exceeded(c)) return false; if (atomic_read(&c->at_max_writeback_rate) != 1) @@ -195,13 +229,10 @@ static bool set_at_max_writeback_rate(struct cache_set *c, dc->writeback_rate_change = 0; /* - * Check c->idle_counter and c->at_max_writeback_rate agagain in case - * new I/O arrives during before set_at_max_writeback_rate() returns. - * Then the writeback rate is set to 1, and its new value should be - * decided via __update_writeback_rate(). + * In case new I/O arrives during before + * set_at_max_writeback_rate() returns. */ - if ((atomic_read(&c->idle_counter) < - atomic_read(&c->attached_dev_nr) * 6) || + if (!idle_counter_exceeded(c) || !atomic_read(&c->at_max_writeback_rate)) return false; From patchwork Sat Oct 22 07:29: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: 7707 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1109447wrr; Sat, 22 Oct 2022 01:48:36 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4ZlKHpWukcd/Vhvb+WuCAy3GHE+IF1zkRU3YVvMf187t8acHwQyJf15UyA73iCmX0u8Ou2 X-Received: by 2002:a17:907:845:b0:731:2f6c:6dbd with SMTP id ww5-20020a170907084500b007312f6c6dbdmr18986371ejb.551.1666428516223; Sat, 22 Oct 2022 01:48:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666428516; cv=none; d=google.com; s=arc-20160816; b=kdT6yNNuvbho2Fillvs0vvNn03bL2kmbEwln+ln4XB/FPX9+kKFQ5VZH8oKN3y+AP5 hgw3X8TRdsWixp5FfKSBiVCHUy8brf4i3Q028emyNbeLYlkcY7pAD2Q4SiXUa5OUOICC JpWeVOmk7H7yfm+QMi8pcU7FDV8YqJw/H7gSZBux2/I6cu7W9e1OZoENVAc5669tHu1u UavsZVYDtauVbtZ0nmiUhXEnQvqEdXChDN9FjtNuEu6FldAaN6Bm3816rkE9+7LNmGZZ lT9j/fFY6VAtzxzmbzgjAwbpZpqzF9C0Kksj9dXVE429T22BMD4Yn2lnjKe0WogfuO1Y B5HA== 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=SdgYdefcGCbU65olKFZB7iZPHeAGecHJXR2fG4geXHM=; b=vHIZzybsgNGHDXkPulgX+ckI7RE8XC0HpSuyPqUPG7jAsKq+ZzU0NaqfmRF93/FQNZ 4Nzdct0jwTljf5rdjpzywXH9Mxp5VbRKXMJfYx2v9jjTVCJZPHqHcFtm6M5MX9Zq0Q34 HcQTgvyATtsGQF+LuBAZ8YHG732GtTYInLieUMCMdxKILxJuMVgocluAIl+RUHCfTxoE QyUc0Rgebr5hlHFeYqwbDO2ycABmOaPb3HI6TuKE1i02MVN6DtRTSZg+lSBQa9vHu/ly VJ3itYfav3V1LMrDS4OK5UcP99eyMWRjQVj4cnTM1tHjTCG4RXWj1htQd0QAgOCo4mRy +C7g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=0LvcuYE9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 t30-20020a056402241e00b0046069e4590bsi6831852eda.104.2022.10.22.01.48.12; Sat, 22 Oct 2022 01:48: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=0LvcuYE9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S234138AbiJVIrn (ORCPT + 99 others); Sat, 22 Oct 2022 04:47:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52128 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234859AbiJVInt (ORCPT ); Sat, 22 Oct 2022 04:43: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 CDAA42EA28A; Sat, 22 Oct 2022 01:07: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 67F0BB82E42; Sat, 22 Oct 2022 08:05:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D98AFC433C1; Sat, 22 Oct 2022 08:05:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425946; bh=VZBw5DsUX6oh/4FnMOXMdw0076F1lklCffGNz1UYs/M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0LvcuYE9o+/SC8IFH0eWsm4sq+3oy1vspom2ZeYrRuFPw/CQhGglClGHI+2pZRBM7 ZwJaPWmG7CU4BzK38zxHKbAQOIazrHV+zn3iUPRBzNQVPokXvnF7fGwSykvCgKm7WL 6Y7Er7yzYIIU533ytROSZwgJw8Wlv9wAVFE8C/lc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Richard Fitzgerald , Pierre-Louis Bossart , Vinod Koul , Sasha Levin Subject: [PATCH 5.19 668/717] soundwire: cadence: Dont overwrite msg->buf during write commands Date: Sat, 22 Oct 2022 09:29:07 +0200 Message-Id: <20221022072527.960194151@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376947946818957?= X-GMAIL-MSGID: =?utf-8?q?1747376947946818957?= From: Richard Fitzgerald [ Upstream commit ba05b39d265bdd16913f7684600d9d41e2796745 ] The buf passed in struct sdw_msg must only be written for a READ, in that case the RDATA part of the response is the data value of the register. For a write command there is no RDATA, and buf should be assumed to be const and unmodifable. The original caller should not expect its data buffer to be corrupted by an sdw_nwrite(). Signed-off-by: Richard Fitzgerald Reviewed-by: Pierre-Louis Bossart Link: https://lore.kernel.org/r/20220916103505.1562210-1-rf@opensource.cirrus.com Signed-off-by: Vinod Koul Signed-off-by: Sasha Levin --- drivers/soundwire/cadence_master.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/soundwire/cadence_master.c b/drivers/soundwire/cadence_master.c index 4fbb19557f5e..42c5fae80efb 100644 --- a/drivers/soundwire/cadence_master.c +++ b/drivers/soundwire/cadence_master.c @@ -544,9 +544,12 @@ cdns_fill_msg_resp(struct sdw_cdns *cdns, return SDW_CMD_IGNORED; } - /* fill response */ - for (i = 0; i < count; i++) - msg->buf[i + offset] = FIELD_GET(CDNS_MCP_RESP_RDATA, cdns->response_buf[i]); + if (msg->flags == SDW_MSG_FLAG_READ) { + /* fill response */ + for (i = 0; i < count; i++) + msg->buf[i + offset] = FIELD_GET(CDNS_MCP_RESP_RDATA, + cdns->response_buf[i]); + } return SDW_CMD_OK; } From patchwork Sat Oct 22 07:29: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: 7690 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1109111wrr; Sat, 22 Oct 2022 01:47:18 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7/TSaAJvJGazROAnFyY8bUTCE+C+af+zvGX0pRhV6y4yolCS5j7N8yXVXevttDuqEHOJli X-Received: by 2002:a05:6402:2791:b0:45d:3a94:3494 with SMTP id b17-20020a056402279100b0045d3a943494mr21010284ede.91.1666428438126; Sat, 22 Oct 2022 01:47:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666428438; cv=none; d=google.com; s=arc-20160816; b=jGbrjgaXybiHoQDEsL2Jp5taRTuNp2zpb1HZXbvi+2F9efEnkvUPBMgJ+FhSvvZmBl SC7fUhAzxeRtYgaNEVDhJqG+eGMRmkf6ShpyGDpVwjtGTcOGBV/oj0tWv9Z/zCejatfL AlMUuDfGJFUBX+4tSH97fDYoehfKFNMe+1TwvbxyXBEiTjeTooUzoNzdy2EbNKd1N3Bj 5cJwbOCJYWU4wiKMoKGQ/2g6NvCigmRJxvMM62bBYVpkBfUDkTHv4j8W1ijGNR6Be3qX tkWrqyMrDPe7xhobPiZkrSpIOMmzow3q+WvznQspRCKwSgiHz8arKC27baRtaWS5AARJ 1zTw== 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=/KEHr116Y/UJP7Jpz4xy6Bt1+vShjV+4HPr0IIAuhxQ=; b=Hp1Ff84yp1xTLBjQ8PCY5a7yKnAiF00ETXjZ6ZDlxjR74+w5zIgOKIdkFD0E5NAKGv 7fTUpGv2ZoFmB8LuUkrPhlqrqgu1SB5gCTb3RarGzDC26fpiUVerRFExJZxQP+BiFGGe EziE1H/yXVO40P9KloL8rvlH4ZSQjYGELomokV0+hKKI9GS/DQjpTpJ33pKWi+Oyqe1J QqSWbd7SnZpY25SERv9wQ8+oMgVPXzvYTOti66cjqh5ppsmowfo4a/Pdk7jmBg+ctxI9 /WyED/yWNagYFdH6dBKRbl+v+sKhabydThJEM0pThOyaK1526IPkf+lMY/hQamvAVCZJ HqBA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=0o7674sL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 ee32-20020a056402292000b00458ec94d128si4367628edb.513.2022.10.22.01.46.53; Sat, 22 Oct 2022 01:47: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=0o7674sL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S234566AbiJVIqG (ORCPT + 99 others); Sat, 22 Oct 2022 04:46:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46290 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234895AbiJVIn7 (ORCPT ); Sat, 22 Oct 2022 04:43:59 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 48E2D2EA29C; Sat, 22 Oct 2022 01:07: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 5CB53B82E1D; Sat, 22 Oct 2022 08:05:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BF2DFC433C1; Sat, 22 Oct 2022 08:05:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425949; bh=W+yRkhVnvuDn6P4WhQFBQd4IV6hCCgQ3Bo73XUYdjqM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0o7674sLU8rxZBGDRjx6Igvwu+VmWakCzElqIJRdeA7AGRIpe5aETpSfoN3iiKf7H 0nqAAknjtlZn4Z+m3+oiNepSSBtbzh/MWOCE7j9wDwcGMhuBGAQ1BtGS4qP9U0FVWf mQOjeCklitGQoFq5n6zaO2Mq/YL0DtyXaORGepvc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Pierre-Louis Bossart , Rander Wang , Bard Liao , Vinod Koul , Sasha Levin Subject: [PATCH 5.19 669/717] soundwire: intel: fix error handling on dai registration issues Date: Sat, 22 Oct 2022 09:29:08 +0200 Message-Id: <20221022072528.010061771@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376866282424192?= X-GMAIL-MSGID: =?utf-8?q?1747376866282424192?= From: Pierre-Louis Bossart [ Upstream commit c6867cda906aadbce5e71efde9c78a26108b2bad ] The call to intel_register_dai() may fail because of memory allocation issues or problems reported by the ASoC core. In all cases, when a error is thrown the component is not registered, it's invalid to unregister it. Signed-off-by: Pierre-Louis Bossart Reviewed-by: Rander Wang Signed-off-by: Bard Liao Link: https://lore.kernel.org/r/20220919175721.354679-2-yung-chuan.liao@linux.intel.com Signed-off-by: Vinod Koul Signed-off-by: Sasha Levin --- drivers/soundwire/intel.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/soundwire/intel.c b/drivers/soundwire/intel.c index 505c5ef061e3..865d91ecb862 100644 --- a/drivers/soundwire/intel.c +++ b/drivers/soundwire/intel.c @@ -1401,7 +1401,6 @@ int intel_link_startup(struct auxiliary_device *auxdev) ret = intel_register_dai(sdw); if (ret) { dev_err(dev, "DAI registration failed: %d\n", ret); - snd_soc_unregister_component(dev); goto err_interrupt; } From patchwork Sat Oct 22 07: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: 7810 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1139997wrr; Sat, 22 Oct 2022 03:24:08 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7yUMJej4YfNlM9aYyKdM2UCYUhO8URhZzQsQQ2QpAwFqKfKX9b817ylejOmqHvbcB78l1q X-Received: by 2002:a05:6402:496:b0:443:a5f5:d3b with SMTP id k22-20020a056402049600b00443a5f50d3bmr22221813edv.331.1666434248501; Sat, 22 Oct 2022 03:24:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666434248; cv=none; d=google.com; s=arc-20160816; b=pRIFP2aVMwylM72P3sKIYDIK7xPoo5EMwdubxZjGthmHefPx+zwHsA2AOwFHW/5jZv hzONJNDzvt1oDkEoD5QUnFfXT6eTDUVtQkgzu8Ch9yFy+wdHh9W0jd89w1XhousZVkrb Mj5tVbiBZE8p8MiJ9gkVWxYtQYnrc/Lg0dscNJVkgGbYNlMWq3ZhnZKdwjwFgN0I76Ed NgfLdct7piigdvGx5bB0mCxVI5gD5WcXFAfwl/sXglf8FLgEzuuxVMfumwdbEEL9A/do 8X0HbfYoheylmISy2dmVkloXILaJlwdPJC29voL97l+lCRUXuUjKFBlT1h7cGmDQ+5sz C9cw== 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=5P7OA4B75wnBVFRAjCvIgkQqC+x3HUTAZ2cBg5af3nU=; b=Sk+R/+k8+RZ9KuL68zhcg2fWw7CsE4K92BRrQeARSDjKY5lI1jV9iU3LrxwKUsu++t M9PtIsgOPv650hp1sAm1JpWs9ZGCU8AZLHIoqC9LxjkPX9HgHjqBgQs9VYqWqLxVKbfL JKF9m5APaFy2lmkKZK37UDC85BJTqUTTyuzXbLMINWqdqx0FaIXUXeoh4nAPaMFReBE4 0D1hCbq3TURZKxoT6CdVHZeKci97Q61fK5qPnQaPVkhnDYNt/372ah7MeEcLWczdFuHF 6eXtT04kpM16Cz4KmETgomtYKt9ZoCW99DgLL8wlnBjVP0KJEbNaES7btkDq4dly0y5y yF1A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=0dATC2Li; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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-20020a1709063a1100b0078dcbd7d244si18879034eje.376.2022.10.22.03.23.32; Sat, 22 Oct 2022 03:24: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=0dATC2Li; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S230143AbiJVKQv (ORCPT + 99 others); Sat, 22 Oct 2022 06:16:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49164 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230139AbiJVKQZ (ORCPT ); Sat, 22 Oct 2022 06:16: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 F0E11319CF2; Sat, 22 Oct 2022 02:33: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 ams.source.kernel.org (Postfix) with ESMTPS id 6A7C9B82E1E; Sat, 22 Oct 2022 08:05:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B8001C433C1; Sat, 22 Oct 2022 08:05:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425952; bh=D8ozL383GaaeAGtKQvIA9IdpVRSMEvGm6dPoBfIkAio=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0dATC2LipFa9yolX/NNlirQ/Yza/zgl7fqEI8A4J6pEmtzl0GEvcTt3ItX7jX3tLA klW96q1Dw58mYoyd7htQ8D3/zB1Uaqdl2B7MZ1R6USgBYVBrA3ng4dCj4Q0ZRDii1E eyVHLhRYB90Dy0/yelvIB9oAHRXTyed+GXCvCQxo= 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 5.19 670/717] HID: roccat: Fix use-after-free in roccat_read() Date: Sat, 22 Oct 2022 09:29:09 +0200 Message-Id: <20221022072528.061729377@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 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?1747382958590698221?= X-GMAIL-MSGID: =?utf-8?q?1747382958590698221?= 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 26373b82fe81..6da80e442fdd 100644 --- a/drivers/hid/hid-roccat.c +++ b/drivers/hid/hid-roccat.c @@ -257,6 +257,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 */ @@ -276,6 +278,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 Sat Oct 22 07: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: 7684 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1108937wrr; Sat, 22 Oct 2022 01:46:38 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5Dv6mTcyGhWplhVmDvzn+XT0VET8vehR3zkKoGf4KJS8GFK0lkURX+2s59R8lc5YnAy93l X-Received: by 2002:a05:6402:410:b0:451:ea13:4ed7 with SMTP id q16-20020a056402041000b00451ea134ed7mr22169781edv.262.1666428397927; Sat, 22 Oct 2022 01:46:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666428397; cv=none; d=google.com; s=arc-20160816; b=vmtJ+ixB7uu6gPJhNTGaGTTCf8H1pxj3roU5A4yhQ6GYBsUMIZyzox5OMg2wi5AMHb FWr73EVRonT2kojuPtBZ0wkYVLyff1vuOfXBG2eukcXt2hyWSu6Bo2PESjdLdYEeO7zx FJQ+bF0Sn5IuA5hAqrvXMBLd2onVtB/Z25xdOjuggvfXe1Gv8L66bvm6cNoqajQlCrJk PZZdbAdSKdoo3pvdufoZJo6xHtUgoVK02Y4dWvIRQ/W5rvCVQgBzCYad5oy3xyI0RPXz RtSBjv/RWq8+5fpapg/YTQvfF/vQkzBoJfApByNEWa0rp1uwrnBHW9wc/vJiMp8X5RHJ bb2Q== 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=oE8v8I/OPPmIQvXUBMjTG2uCUa+g4At7jc105F86al0=; b=W49N7Iu6d2PvwfM8vxewjt//5O2kFNefT6GRAOPVf5fIcbFywuZmM9Hg5kMYYcqlpt 5xQwrjUtRmPGSg1Re+zQyJtYrLLCnDIEgVR37ZcrQBGilOJto8pCDFcx1c8tfjvK1YwY 4K4G8oeUPaxPLPcvpB4s26FJ9gHPvSoZ7gj6mi9WX443P7dlPFwRXmByi5ez0ySsE8Xa JBybirQVr0NL5zI56zQwuTIDff6eSnCZWTIX2GCNl5clijUEClRZQKskWuIfY6XHi9Qd GRrHdnsnpUgqo+RFkC2m+QZwYB23O/nEaXL8jc04XqX8+ylZ1r8jZ2wZ3s6+PaO67Bi5 B0/g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=lAeXce0C; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 go11-20020a1709070d8b00b0078ac0d5d03esi19052019ejc.562.2022.10.22.01.46.13; Sat, 22 Oct 2022 01:46: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=lAeXce0C; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S234710AbiJVIpt (ORCPT + 99 others); Sat, 22 Oct 2022 04:45:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37284 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234861AbiJVInv (ORCPT ); Sat, 22 Oct 2022 04:43: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 322B82EA963; Sat, 22 Oct 2022 01:07: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 598D2B82E21; Sat, 22 Oct 2022 08:05:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A76D8C433C1; Sat, 22 Oct 2022 08:05:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425955; bh=fSjG4RXvpX46fKNLE6mDdtR1CXfA7oy7Me+/3xuP4Bk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lAeXce0CnTyjnWKBMabAn5950XUBzBJN5HO0rri0U/i/r7BhJ3QvilGYaj5oAtUo2 UMQA7cqOZJemRTZlgUomHsxh2olJ5/dTpX8alkdQfwP5l8exr+75eO1FMtb9gk/nK+ DifXB/bk9srExLIa4iCOU5mFZ59Bu8AuLIi1hMxI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jianglei Nie , Sebastian Reichel , Sasha Levin Subject: [PATCH 5.19 671/717] HSI: ssi_protocol: fix potential resource leak in ssip_pn_open() Date: Sat, 22 Oct 2022 09:29:10 +0200 Message-Id: <20221022072528.112564165@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376823753209502?= X-GMAIL-MSGID: =?utf-8?q?1747376823753209502?= From: Jianglei Nie [ Upstream commit b28dbcb379e6a7f80262c2732a57681b1ee548ca ] ssip_pn_open() claims the HSI client's port with hsi_claim_port(). When hsi_register_port_event() gets some error and returns a negetive value, the HSI client's port should be released with hsi_release_port(). Fix it by calling hsi_release_port() when hsi_register_port_event() fails. Signed-off-by: Jianglei Nie Signed-off-by: Sebastian Reichel Signed-off-by: Sasha Levin --- drivers/hsi/clients/ssi_protocol.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/hsi/clients/ssi_protocol.c b/drivers/hsi/clients/ssi_protocol.c index 21f11a5b965b..49ffd808d17f 100644 --- a/drivers/hsi/clients/ssi_protocol.c +++ b/drivers/hsi/clients/ssi_protocol.c @@ -931,6 +931,7 @@ static int ssip_pn_open(struct net_device *dev) if (err < 0) { dev_err(&cl->device, "Register HSI port event failed (%d)\n", err); + hsi_release_port(cl); return err; } dev_dbg(&cl->device, "Configuring SSI port\n"); From patchwork Sat Oct 22 07: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: 7789 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1122682wrr; Sat, 22 Oct 2022 02:31:38 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4BQaEk13qenHcnwZE1Kll7jNDrYPefh/MG4Kxrrj7ymY/DVYG1/oAWvEGHzkYmrxh5Mp/j X-Received: by 2002:a05:6a00:198f:b0:56b:95aa:3952 with SMTP id d15-20020a056a00198f00b0056b95aa3952mr766717pfl.20.1666431098147; Sat, 22 Oct 2022 02:31:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666431098; cv=none; d=google.com; s=arc-20160816; b=oN4OdbCUHqkdsOyx9F+5KnjxklrJf+FXUjNVa2EAGYA5CaQNFqWXpXWYjUWY9mdwH8 Co+GRFIgBFMiaRROR5We5vKlr+LwM4/N8WVDCPhjWaymHvEty4FErNJv/Z0xCm9++yEF Qe1X33OT8mcbn58m48Nw9+G9CIb7EZ+6iJWGYeOWRn9vOprm7rmLTM1gw2vfmqRyby5W 17kDmS8hMzl64BIXuWBPJgT+N3pBgjtdh3Bwr6t1K/XWNMcgWwYR43hD3mR091w/U2qt Gk7sp84KmI5fEDFPbP4Wp+SnqqN+YOnezureRm6zDNRZKUiARlpOA3Bf+TQNyF/k8fhs vBIA== 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=KwTWPWOSoYHsOjKUND+Iazop6uJPomLVZtlmOMQfEOE=; b=CzyvCF3pNbYUPTMbrGIhlNRTUm5WlsDKkA1NeITNc4Xh4LGewHJGmnqO00AjXmO+KI U2lbV8Nq46ZLAtL2+li03rseFZ3mOIuDCVlqAGc7U2BEEZQTTzKAnSE/GLZ6zXHjoy63 9KDsOruA01ptIog5QSkOp5HrNwAqDAD8wEZF88daqYmkOK39kLKKnotjrrOkkl+omNDz 8wVTYmMID9JPBLMTkdqyJ5j8KMJHYjBCKJWXk3itPwEG2+J516U40NYgak7OqplvExk/ NBWzURBwBpFIrxRRXQLQT8nC2uzDb+3VAuzCg1eu1m0MdVINIhHW0HnIq5GChB78HdJd Vl9Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=HZGI5Wp1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 c13-20020a63d14d000000b00439e032756fsi25022639pgj.65.2022.10.22.02.31.24; Sat, 22 Oct 2022 02:31: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=HZGI5Wp1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S230238AbiJVJQW (ORCPT + 99 others); Sat, 22 Oct 2022 05:16:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54478 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231694AbiJVJPP (ORCPT ); Sat, 22 Oct 2022 05:15:15 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C554157543; Sat, 22 Oct 2022 01:29: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 982D960AE4; Sat, 22 Oct 2022 08:06:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6FA6BC433C1; Sat, 22 Oct 2022 08:06:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425961; bh=UOnueW/PyZnrz3FegMDaggbsCd7whTzND7A2kW84/4M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HZGI5Wp1lSoppcYAftGjLGgF2Akp5aknZu52IfLtd2sRB89aMf5ls5DQeNROsEI7A cXqOyUGYx+CHJfw7iePi75E6p0t+QLZyQS6tVa0Cd4q+Jpi2sp548hetggJdrAPSyM OPbQKrSHW1Ny2+cVAlQsQck+b0yn5fvyPKqJoMmI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Johnothan King , Benjamin Tissoires , Sasha Levin , Arne Wendt Subject: [PATCH 5.19 672/717] HID: nintendo: check analog user calibration for plausibility Date: Sat, 22 Oct 2022 09:29:11 +0200 Message-Id: <20221022072528.159495833@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747379655317725053?= X-GMAIL-MSGID: =?utf-8?q?1747379655317725053?= From: Johnothan King [ Upstream commit 50503e360eeb968a3d00234c9cc4057d774c3e9a ] Arne Wendt writes: Cheap clone controllers may (falsely) report as having a user calibration for the analog sticks in place, but return wrong/impossible values for the actual calibration data. In the present case at mine, the controller reports having a user calibration in place and successfully executes the read commands. The reported user calibration however is min = center = max = 0. This pull request addresses problems of this kind by checking the provided user calibration-data for plausibility (min < center < max) and falling back to the default values if implausible. I'll note that I was experiencing a crash because of this bug when using the GuliKit KingKong 2 controller. The crash manifests as a divide by zero error in the kernel logs: kernel: divide error: 0000 [#1] PREEMPT SMP NOPTI Link: https://github.com/nicman23/dkms-hid-nintendo/pull/25 Link: https://github.com/DanielOgorchock/linux/issues/36 Co-authored-by: Arne Wendt Signed-off-by: Johnothan King Signed-off-by: Benjamin Tissoires Link: https://lore.kernel.org/r/gvpL2G6VwXGJPvxX5KRiu9pVjvTivgayug_jdKDY6zfuAaAqncP9BkKLosjwUXNlgVVTMfJSKfwPF1K79cKAkwGComyC21vCV3q9B3EXNkE=@protonmail.com Signed-off-by: Sasha Levin --- drivers/hid/hid-nintendo.c | 55 +++++++++++++++++++++----------------- 1 file changed, 30 insertions(+), 25 deletions(-) diff --git a/drivers/hid/hid-nintendo.c b/drivers/hid/hid-nintendo.c index f33a03c96ba6..cce324887952 100644 --- a/drivers/hid/hid-nintendo.c +++ b/drivers/hid/hid-nintendo.c @@ -761,12 +761,31 @@ static int joycon_read_stick_calibration(struct joycon_ctlr *ctlr, u16 cal_addr, cal_y->max = cal_y->center + y_max_above; cal_y->min = cal_y->center - y_min_below; - return 0; + /* check if calibration values are plausible */ + if (cal_x->min >= cal_x->center || cal_x->center >= cal_x->max || + cal_y->min >= cal_y->center || cal_y->center >= cal_y->max) + ret = -EINVAL; + + return ret; } static const u16 DFLT_STICK_CAL_CEN = 2000; static const u16 DFLT_STICK_CAL_MAX = 3500; static const u16 DFLT_STICK_CAL_MIN = 500; +static void joycon_use_default_calibration(struct hid_device *hdev, + struct joycon_stick_cal *cal_x, + struct joycon_stick_cal *cal_y, + const char *stick, int ret) +{ + hid_warn(hdev, + "Failed to read %s stick cal, using defaults; e=%d\n", + stick, ret); + + cal_x->center = cal_y->center = DFLT_STICK_CAL_CEN; + cal_x->max = cal_y->max = DFLT_STICK_CAL_MAX; + cal_x->min = cal_y->min = DFLT_STICK_CAL_MIN; +} + static int joycon_request_calibration(struct joycon_ctlr *ctlr) { u16 left_stick_addr = JC_CAL_FCT_DATA_LEFT_ADDR; @@ -794,38 +813,24 @@ static int joycon_request_calibration(struct joycon_ctlr *ctlr) &ctlr->left_stick_cal_x, &ctlr->left_stick_cal_y, true); - if (ret) { - hid_warn(ctlr->hdev, - "Failed to read left stick cal, using dflts; e=%d\n", - ret); - - ctlr->left_stick_cal_x.center = DFLT_STICK_CAL_CEN; - ctlr->left_stick_cal_x.max = DFLT_STICK_CAL_MAX; - ctlr->left_stick_cal_x.min = DFLT_STICK_CAL_MIN; - ctlr->left_stick_cal_y.center = DFLT_STICK_CAL_CEN; - ctlr->left_stick_cal_y.max = DFLT_STICK_CAL_MAX; - ctlr->left_stick_cal_y.min = DFLT_STICK_CAL_MIN; - } + if (ret) + joycon_use_default_calibration(ctlr->hdev, + &ctlr->left_stick_cal_x, + &ctlr->left_stick_cal_y, + "left", ret); /* read the right stick calibration data */ ret = joycon_read_stick_calibration(ctlr, right_stick_addr, &ctlr->right_stick_cal_x, &ctlr->right_stick_cal_y, false); - if (ret) { - hid_warn(ctlr->hdev, - "Failed to read right stick cal, using dflts; e=%d\n", - ret); - - ctlr->right_stick_cal_x.center = DFLT_STICK_CAL_CEN; - ctlr->right_stick_cal_x.max = DFLT_STICK_CAL_MAX; - ctlr->right_stick_cal_x.min = DFLT_STICK_CAL_MIN; - ctlr->right_stick_cal_y.center = DFLT_STICK_CAL_CEN; - ctlr->right_stick_cal_y.max = DFLT_STICK_CAL_MAX; - ctlr->right_stick_cal_y.min = DFLT_STICK_CAL_MIN; - } + if (ret) + joycon_use_default_calibration(ctlr->hdev, + &ctlr->right_stick_cal_x, + &ctlr->right_stick_cal_y, + "right", ret); hid_dbg(ctlr->hdev, "calibration:\n" "l_x_c=%d l_x_max=%d l_x_min=%d\n" From patchwork Sat Oct 22 07: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: 7722 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1109918wrr; Sat, 22 Oct 2022 01:50:35 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6b3VLDBoF7rXbc73ZDgswPxqSD6PMmwlDgD60Hb3hGHkAKSUlWmqdyPv8Qgc3hlZomzTtf X-Received: by 2002:a05:6402:528a:b0:454:8613:6560 with SMTP id en10-20020a056402528a00b0045486136560mr22177745edb.252.1666428635456; Sat, 22 Oct 2022 01:50:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666428635; cv=none; d=google.com; s=arc-20160816; b=FRjD9Eqgah1/kaGVcZbJmQLsh4gi8ItPcabNx+CJSrquSfBgF2wt2kOTAJKOBiT2zX OJKMnBBUoVuxxnN4nknWaJ994IF7ihymLPPY5aweo+Y6hkV+bjWNyMYJpteU0d2YIbwq OG/m4/DVqHbEcR0YK+Z2B2t+kcrrjIwJKUo4tetWDHWYKaZJXBcBkMHox0otJayq2kPT 0472i1cxLsPg8uQeWulJTFPa37nNP8Qengcn3csDPD+nnMztbnsHXVlOEHvrHJ+wFcMa GZxGHdJvtH5aOerMyeS4hx9YZ8EUa0wpAcm+2VFluTslly4XcmhFd8EYPTzSyDIsGQvB CLxA== 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=+yMAdfvg47D5284nSl89wNn8LNC3+9uRMIfc5Wycjrg=; b=fVZlZkiTa5LDG3BkhWowkbk+AJoIC3xxUxFTlbxhef35JgR8D0oZbq2kpTgnevRpsS BXW6XbtyKtpdvnX5NMkZtOKhsFxNrEGhRMA/rphWn9Ds7x2OGHt0HK2VCcwLQhwsrBYk 9xuRnzCY7mMkj/VCJBmyelgSb3FzgrMs4M/nsaE8u0lYG9mKQ+UUt6amdgYkLBAsGWp4 nLr96lF0KhCuYIKvWzra8ZO4fhoxUWYJg1UuUhLDlpC1FcQO7WxJdskwDEAN1ZpE5rAM g2OVbUXBK46IviYWieKp4FbPRg0/pjTLuAgT8WM0nxX7XlFvi/3wwv+Gk++6AqTqm/7X qMNA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=SAROwZfc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 d26-20020a056402401a00b0045fb9d7dd25si7679937eda.298.2022.10.22.01.50.11; Sat, 22 Oct 2022 01:50: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=SAROwZfc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S234643AbiJVIsv (ORCPT + 99 others); Sat, 22 Oct 2022 04:48:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45578 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234846AbiJVIqO (ORCPT ); Sat, 22 Oct 2022 04:46: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 6D9C94B9BD; Sat, 22 Oct 2022 01:09: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 A8BF560B81; Sat, 22 Oct 2022 08:06:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9BA13C433C1; Sat, 22 Oct 2022 08:06:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425964; bh=65OQIF2TZJuQiwOc2TEY9Dne2mpIqXtPwuvl01EMQCs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SAROwZfccZX3vB688CGoiyowRrBGHgG5QBDk8MSWABZ5IOx1WHMcByBmuCqQ3Q5gW k9ySylwbNJD9hn5TR4y9XQMidbqYzXraEwAds06cI5fuZF8/d3UdxoDoh2gK+3UFUo 9LMmbHtTUIq46zvvAO9qBQH3tWeM7hDIELXonc3w= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dylan Yudaken , Jens Axboe , Sasha Levin Subject: [PATCH 5.19 673/717] eventfd: guard wake_up in eventfd fs calls as well Date: Sat, 22 Oct 2022 09:29:12 +0200 Message-Id: <20221022072528.210304370@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747377073019909643?= X-GMAIL-MSGID: =?utf-8?q?1747377073019909643?= From: Dylan Yudaken [ Upstream commit 9f0deaa12d832f488500a5afe9b912e9b3cfc432 ] Guard wakeups that the user can trigger, and that may end up triggering a call back into eventfd_signal. This is in addition to the current approach that only guards in eventfd_signal. Rename in_eventfd_signal -> in_eventfd at the same time to reflect this. Without this there would be a deadlock in the following code using libaio: int main() { struct io_context *ctx = NULL; struct iocb iocb; struct iocb *iocbs[] = { &iocb }; int evfd; uint64_t val = 1; evfd = eventfd(0, EFD_CLOEXEC); assert(!io_setup(2, &ctx)); io_prep_poll(&iocb, evfd, POLLIN); io_set_eventfd(&iocb, evfd); assert(1 == io_submit(ctx, 1, iocbs)); write(evfd, &val, 8); } Signed-off-by: Dylan Yudaken Reviewed-by: Jens Axboe Link: https://lore.kernel.org/r/20220816135959.1490641-1-dylany@fb.com Signed-off-by: Jens Axboe Signed-off-by: Sasha Levin --- fs/eventfd.c | 10 +++++++--- include/linux/eventfd.h | 2 +- include/linux/sched.h | 2 +- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/fs/eventfd.c b/fs/eventfd.c index 3627dd7d25db..c0ffee99ad23 100644 --- a/fs/eventfd.c +++ b/fs/eventfd.c @@ -69,17 +69,17 @@ __u64 eventfd_signal(struct eventfd_ctx *ctx, __u64 n) * it returns false, the eventfd_signal() call should be deferred to a * safe context. */ - if (WARN_ON_ONCE(current->in_eventfd_signal)) + if (WARN_ON_ONCE(current->in_eventfd)) return 0; spin_lock_irqsave(&ctx->wqh.lock, flags); - current->in_eventfd_signal = 1; + current->in_eventfd = 1; if (ULLONG_MAX - ctx->count < n) n = ULLONG_MAX - ctx->count; ctx->count += n; if (waitqueue_active(&ctx->wqh)) wake_up_locked_poll(&ctx->wqh, EPOLLIN); - current->in_eventfd_signal = 0; + current->in_eventfd = 0; spin_unlock_irqrestore(&ctx->wqh.lock, flags); return n; @@ -253,8 +253,10 @@ static ssize_t eventfd_read(struct kiocb *iocb, struct iov_iter *to) __set_current_state(TASK_RUNNING); } eventfd_ctx_do_read(ctx, &ucnt); + current->in_eventfd = 1; if (waitqueue_active(&ctx->wqh)) wake_up_locked_poll(&ctx->wqh, EPOLLOUT); + current->in_eventfd = 0; spin_unlock_irq(&ctx->wqh.lock); if (unlikely(copy_to_iter(&ucnt, sizeof(ucnt), to) != sizeof(ucnt))) return -EFAULT; @@ -301,8 +303,10 @@ static ssize_t eventfd_write(struct file *file, const char __user *buf, size_t c } if (likely(res > 0)) { ctx->count += ucnt; + current->in_eventfd = 1; if (waitqueue_active(&ctx->wqh)) wake_up_locked_poll(&ctx->wqh, EPOLLIN); + current->in_eventfd = 0; } spin_unlock_irq(&ctx->wqh.lock); diff --git a/include/linux/eventfd.h b/include/linux/eventfd.h index 305d5f19093b..30eb30d6909b 100644 --- a/include/linux/eventfd.h +++ b/include/linux/eventfd.h @@ -46,7 +46,7 @@ void eventfd_ctx_do_read(struct eventfd_ctx *ctx, __u64 *cnt); static inline bool eventfd_signal_allowed(void) { - return !current->in_eventfd_signal; + return !current->in_eventfd; } #else /* CONFIG_EVENTFD */ diff --git a/include/linux/sched.h b/include/linux/sched.h index 6d877c7e22ff..e02dc270fa2c 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h @@ -934,7 +934,7 @@ struct task_struct { #endif #ifdef CONFIG_EVENTFD /* Recursion prevention for eventfd_signal() */ - unsigned in_eventfd_signal:1; + unsigned in_eventfd:1; #endif #ifdef CONFIG_IOMMU_SVA unsigned pasid_activated:1; From patchwork Sat Oct 22 07: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: 7755 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1115505wrr; Sat, 22 Oct 2022 02:10:39 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5PpXeMehmi7BjkyjWLUWx44hfDeCXBBeadmgCWlch+/zSalIc86Kv7wzCMbC1YKgViNSKy X-Received: by 2002:a17:907:7da5:b0:78e:2c3b:55a2 with SMTP id oz37-20020a1709077da500b0078e2c3b55a2mr18952539ejc.96.1666429839016; Sat, 22 Oct 2022 02:10:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666429839; cv=none; d=google.com; s=arc-20160816; b=Lfo4sp6kD1nH5SUU3ej2L7a4iTHuqUwx0+NW0j+uMWp8/iz1lKzPggREMXB9TNG601 G/TCCZm9DoLJVfI/7PJa0Cm4HaGrrILVdLBFGcXydOzoJMQ/3yEsMn+buLYsBzAujAHI Mi+a8viNcmmRm1KTw6JUn79DlXhsPiYfNGxSWxkR5MHuMz+3ce1K4aEpAuVqxgJmud2r FLloLI19ZxJi8R8g7Ll6wH/q2pYlfLIhqhRaMEdJhBt95bFxHNZb+GM2fIn7X1Bhwf05 x1OjKDqWSk7x7QX/nBqkMlJHpxaU8KZc5fRU4MwtDY2p6A4ymhrrsVXUTeE/eaN9resJ +sVA== 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=4QEwRS3tJx1GWlbCl2E6tSzQVEWCXp0gdVVQcRD5qUA=; b=UNAzAErTaBqVuIIKDL8HqBiYw7jIUMbB48IdR+imeOStfrl6G0cVwZXb+50aZaC2/h AHu15LoucOHbNi0ait0OFYY2zYMU2/SgpGSUquj3X0/mhuYjSs17PqwUAOJjw9fwhRoF x6rT5UcLeNnEsO7CrNoXAUyFQjEjJR1c/N89z6s62MR+Q5pcaf3OD/TtBo6NNBpvoewn KuEZjHEO4p8OOef4y9JjUd44EOEH0uk2KT7uVEF5I3WkGvV/vggLBoqel82kMiACQJgb jxOATV7ueX6ZuYBpzJcRhrJVx+1P+/VZSKSKnKOaOOzcIJBTSDfBDQoCIVjpY/B37EnF bV9A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=TP0ehTu+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 wu13-20020a170906eecd00b00780636887fesi25476050ejb.797.2022.10.22.02.10.13; Sat, 22 Oct 2022 02:10: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=TP0ehTu+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S234952AbiJVJAP (ORCPT + 99 others); Sat, 22 Oct 2022 05:00:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50586 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235102AbiJVI7G (ORCPT ); Sat, 22 Oct 2022 04:59:06 -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 10EC02995E7; Sat, 22 Oct 2022 01:16: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 817A260B95; Sat, 22 Oct 2022 08:06:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 80F2EC433C1; Sat, 22 Oct 2022 08:06:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425967; bh=hqUIUWi+JMfm2ovdL636jIECw9DPfV1HvPqpdyrFIOE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TP0ehTu++CEUhtKXmvLrUeg1OOvYCiOt2LR45aotix0r62Uj5mkgjp8+W71mhNnyx fIHpRqx712iCtOfxF/UXgbR8fxHWi4mzk2rHM/USD+8r86yTEaJsruhStcH0iCeUuZ T3VG4n3jHxfJVKyIz25Ff3EUdLSi0U7b1ck+lcHg= 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 5.19 674/717] md/raid5: Wait for MD_SB_CHANGE_PENDING in raid5d Date: Sat, 22 Oct 2022 09:29:13 +0200 Message-Id: <20221022072528.253788254@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747378334743813443?= X-GMAIL-MSGID: =?utf-8?q?1747378334743813443?= 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 f498bd4af8c2..cdb5ae435b78 100644 --- a/drivers/md/raid5.c +++ b/drivers/md/raid5.c @@ -36,6 +36,7 @@ */ #include +#include #include #include #include @@ -6552,7 +6553,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 Sat Oct 22 07: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: 7852 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1156628wrr; Sat, 22 Oct 2022 04:15:18 -0700 (PDT) X-Google-Smtp-Source: AMsMyM55e/QMMAkl5J5Qy0OnyKLBbdUgNbVut9uTF2iEH/suXmyJNeiz7s9PhQVSqkCe/hn3DlyV X-Received: by 2002:a05:6402:8cc:b0:45c:a5c9:c0a with SMTP id d12-20020a05640208cc00b0045ca5c90c0amr21541252edz.135.1666437318750; Sat, 22 Oct 2022 04:15:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666437318; cv=none; d=google.com; s=arc-20160816; b=pkDsMRxnbkXohxTOAEdqBNFqFapmHnjVvolP21dQsPmIf69sVlNpA/s1UgIaf7i8n/ +ycshj9HoKdPNeu+8So40k0nGJ1mLQZ83pSmLa9ckhdMowDPjvC08/AjEWYiScgK4CpT /SD4tS61ZsateviRZYeEiddZXDApoypcNqNq+jw/DU21CvsBpiJOEvfW8iLAC8npoWdG UJLZfxgDKzhNRyzAGSlv7oF0IDlAragFrhpXU2jdgV8P6HMc+ebUSj0UjLw2G9MR6rIx Q9p+p/ufH7jUu5bHlOqe4sISQOP2ZyBhqNamoNI3km2wMEF5qPDIep1b+5kKXsIYtonU 5bLg== 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=uyr7uFQITT7cUiRiakbXxfBQAjTfnvRmynMmmSOTFiU=; b=Wv2mYRiSM3W2b5d1Vq2voMm9ZNSN9CJ6JVjSRhvYEIPpNpHCY3UjeUuW6zC9c1Kpw2 yuLT0kh9zSo66PnRGZ+CqoB1d88kJlNeXDsckQLMPj9BqA/taqOKm4hkw+tkzcz/UEVS pRvgDma39uIZjwAB0pAonCWeQtvEj35onfO1nhpHe9zkGizKw6QdQsxQnSlugvQui203 5cmFY959cKV0b6cyZznYHJnKS2ylC68+DunkaX4QQRmcyUSyrbaE1qN7C8vavC9lULdK 6NoKpYkn2ewFf2BDjMCJTdAKRvVEKvsFrAMQSiXkyB7tym8wYNaWiIG6O41YPSNLLA49 0mQw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=L95dKkbD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 n1-20020a17090625c100b007417c6edb0asi19053495ejb.402.2022.10.22.04.14.52; Sat, 22 Oct 2022 04:15: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=L95dKkbD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S230345AbiJVLO0 (ORCPT + 99 others); Sat, 22 Oct 2022 07:14:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36178 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231258AbiJVLOH (ORCPT ); Sat, 22 Oct 2022 07:14:07 -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 C28502F79A2; Sat, 22 Oct 2022 03:36: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 2E4AFB80E4D; Sat, 22 Oct 2022 08:06:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 783D4C433D6; Sat, 22 Oct 2022 08:06:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425970; bh=QmYPBt2tuHklhPv5OYIPoGItdJBIj0Kc3kuoPwcl3Q0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=L95dKkbDzvTH9EkX7y3JkUOjvvEZAF+1745g/LEpKe9IkcNtFq+k5xpjX8AwPJL3S YjSr7RyB0z142+xs6IoW5c2xjePx5tXWG+DD6kdQSvqloxOadGVP06Y4dUu3iMB1Vh WUAleLCf3C3JGz8ku3FlmgXzlKfdPuNBQxrj47pY= 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 5.19 675/717] usb: host: xhci: Fix potential memory leak in xhci_alloc_stream_info() Date: Sat, 22 Oct 2022 09:29:14 +0200 Message-Id: <20221022072528.297892220@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 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?1747386178208357563?= X-GMAIL-MSGID: =?utf-8?q?1747386178208357563?= 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 8c19e151a945..9e56aa28efcd 100644 --- a/drivers/usb/host/xhci-mem.c +++ b/drivers/usb/host/xhci-mem.c @@ -641,7 +641,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); @@ -702,6 +702,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 Sat Oct 22 07: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: 7714 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1109584wrr; Sat, 22 Oct 2022 01:49:08 -0700 (PDT) X-Google-Smtp-Source: AMsMyM63vavpWvYXE/z9iUfUm2OOqvMM39ASn1Inz2SDmfAnxYVnYpLd7TG9HYkY2DZS19jJ+ep+ X-Received: by 2002:a50:cc07:0:b0:453:4427:a918 with SMTP id m7-20020a50cc07000000b004534427a918mr21332062edi.121.1666428548533; Sat, 22 Oct 2022 01:49:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666428548; cv=none; d=google.com; s=arc-20160816; b=BjKh9NmctFsm+BgEC3KiVuY7Z4B/i2pnFDrWEx8I+Qa1SmwkWWBbXBd617Vct7hVcS MaP0tCvTQ/2cEmnPOCUTS2GXOLkZvlOD5s1ykUThVxZc1Vt84/Go0/Ob5M3iBmD5TcoR 0K4MHo0+g6+sVhUbEhSMnu/ARhemTquvfmBxM04/iAn58U573kyhPJIiPv6ukbCi6KRq G94PD5rv3tDpn/wELfEBJy8LC7h65y28HEHpZ9XoQx4LtQxuLRzh7S9edlfDLL80Uvf5 +3D6e4BYIZ+ISgusq8XAqDW4gm8EKZ1Sfg9bdna/vmI2C03ycUxcSMEKt1AxtLSFvnu+ Uvgw== 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=RKTDUWkUciSeeq3A6RkM37kx17U/KmXem/jIRO4xbng=; b=MyyRcOBrBK04Wzu/Ecu6E/aBijVetuuuFGCu6VoSmlgicuDXkeVqYFNHWT4Nqd12UA Kn1zf3O3jAqtgrAnoAm9PjnGFY70d4B9koJRmTyQ7oOVvpgVW8sKx9RyY2mI4BcLHI3I XH13pJvCvslPpEWScAPvG1n0hP0+BUCI39He5qOW9kiTxJFWlo+kQQR3b1UuUjEosNEU eF8MZEhXcSHXnlDMIRFxlJjJFrZD4GYrYBK9ctD02sU4LdMiAfZPIgUfL+O06ZZk96xR NCoOZySLjK0tzV6B0C1fcc0dpxQQIgrIdNgDRoMg5+SAZXeJwWHXBQwdOP5gGj51ZnGk hFaQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=C9nbywEU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 b13-20020a0564021f0d00b0046054d6b3a8si6385455edb.302.2022.10.22.01.48.44; Sat, 22 Oct 2022 01:49: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=C9nbywEU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S234544AbiJVIsK (ORCPT + 99 others); Sat, 22 Oct 2022 04:48:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41150 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235280AbiJVIpH (ORCPT ); Sat, 22 Oct 2022 04:45:07 -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 4F0522ECF66; Sat, 22 Oct 2022 01:09: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 10BD1B82E22; Sat, 22 Oct 2022 08:06:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 58A72C433C1; Sat, 22 Oct 2022 08:06:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425973; bh=yy1LzY/k4eWn7O3Bo53AqA6dt4/zM2XYo6Qw9qUfJl4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=C9nbywEUmqS7lUmpqM91fNNcnSNbnBNzk56FtIpaC0gm5BeO/eIKPHLEq6Yiz8Eo+ J50M/AgmWxwyTDDINMkhppV5g+HhWJ31TATPQkgpSfpBpEw+H14gWiq8P35EvIQU/w hqYstFFuwx7R9xeBS0bcq0k2B65Yr43bXu+xZ+Lw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Robin Guo , Sasha Levin Subject: [PATCH 5.19 676/717] usb: musb: Fix musb_gadget.c rxstate overflow bug Date: Sat, 22 Oct 2022 09:29:15 +0200 Message-Id: <20221022072528.347982177@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376981308620543?= X-GMAIL-MSGID: =?utf-8?q?1747376981308620543?= 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 51274b87f46c..dc67fff8e941 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 Sat Oct 22 07: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: 7717 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1109633wrr; Sat, 22 Oct 2022 01:49:18 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5FbmslujirsqcNr13i1ZnjPxxenpBYdDJhoiov6gywGhut0UsthOHOvwkA0WBJlJrNPAXf X-Received: by 2002:a17:907:843:b0:73a:5b0e:8352 with SMTP id ww3-20020a170907084300b0073a5b0e8352mr19438224ejb.438.1666428558552; Sat, 22 Oct 2022 01:49:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666428558; cv=none; d=google.com; s=arc-20160816; b=xv7qYwVC5uiyNWYAC0YqvCq3Gqd8piWlK70AjfskQr2Dzbv6U1/CMGLc3LjAK45uop fdgA/zxMHiW0AO7ru8N9TQrxuM0YCUN5DxQU/EHS4UML9W6QFCuVAElhOHoTaaWCjxMA I7xyXzw86XySzfzVUZ27/GwWLpcYRYXvnxAdw40mIR1Xi1PQXf/OpLbjnufFXoVcpEK4 ugiGUSSPXoc7/mw1TWtUGI6nktdlp69GwTZ7dLYNPa069ok1jfUi+PYdY2M4Drn73T9d 0qDBzFKzTJbPdX5U2Bl+i8I+3Ljd96BPFOVex8wivHohXwkx7D2NIj5tUcIJh3l+uLaa E8Dg== 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=6uAvL9wo6C04pVHhRvq1k07p+lJ6SdCYq0HXfZzlwao=; b=o7LYnANEZsHuP/BCuZno0sEs2QrEJwnDEXAPZvC0ZkTny4s/3nVfdBNGCVxa9sUBGQ uL4dTJ7r5pCSooYxxa1WkH+olkrh4tvlkprlPq8PB15tRYfYWtFUegLmWbHyge3Uc5XQ 3GlxTP/fYU7Sj7zzochCyyLyKh4Fz/8vvMMHnbW+GoQS0E4lddS4ksPyG/4asi1DbiTa tK1ZctlMOInaY6TBu4ohJMRkdOypsY5nT5QkvfnPahZob7+T5I5FpO83w2YrwU86xXz5 nNEpECJ6xe6+RSrziAcqkLOt+CqxbTra9STk+qMY4rVtizlLpFFgYWZW42iiQ+ziare4 z+Lw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=1NTbpj3l; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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-20020a056402518600b0045981993486si23497477edd.227.2022.10.22.01.48.54; Sat, 22 Oct 2022 01:49: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=1NTbpj3l; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S234711AbiJVIsY (ORCPT + 99 others); Sat, 22 Oct 2022 04:48:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43978 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235347AbiJVIpX (ORCPT ); Sat, 22 Oct 2022 04:45: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 4AFCA248D0; Sat, 22 Oct 2022 01: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 BDDEBB82E3C; Sat, 22 Oct 2022 08:06:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1E8D2C433D6; Sat, 22 Oct 2022 08:06:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425976; bh=zzeTxq+NJr4+UGNGle8Ow5HqL2y9QFZGSXLWwWD6MgE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1NTbpj3l8IzWaC4e3jeqBW/MNbMZpcSKTrplk6kpRFaL80pHGreMFK3w43HiFfwlW 4xWpAcZUV1hfJEuY5GtHqrnrakCkvZBgAFtHI4uSkToOk4fMsVssI13OfUFtPugHgM 7BZcWW4GSyjfU/xl7kEEQL98Ng4jTZkyHrvwmEmg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Li Jun , Alexander Stein , Sasha Levin Subject: [PATCH 5.19 677/717] usb: dwc3: core: add gfladj_refclk_lpm_sel quirk Date: Sat, 22 Oct 2022 09:29:16 +0200 Message-Id: <20221022072528.396117530@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376992224308393?= X-GMAIL-MSGID: =?utf-8?q?1747376992224308393?= From: Alexander Stein [ Upstream commit a6fc2f1b092787e9d7dbe472d720cede81680315 ] This selects the SOF/ITP counter be running on ref_clk. As documented U2_FREECLK_EXISTS has to be set to 0 as well. Reviewed-by: Li Jun Signed-off-by: Alexander Stein Link: https://lore.kernel.org/r/20220915062855.751881-3-alexander.stein@ew.tq-group.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/usb/dwc3/core.c | 8 +++++++- drivers/usb/dwc3/core.h | 2 ++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c index 2419ef828f9b..02733b6a9061 100644 --- a/drivers/usb/dwc3/core.c +++ b/drivers/usb/dwc3/core.c @@ -407,6 +407,10 @@ static void dwc3_ref_clk_period(struct dwc3 *dwc) reg |= FIELD_PREP(DWC3_GFLADJ_REFCLK_FLADJ_MASK, fladj) | FIELD_PREP(DWC3_GFLADJ_240MHZDECR, decr >> 1) | FIELD_PREP(DWC3_GFLADJ_240MHZDECR_PLS1, decr & 1); + + if (dwc->gfladj_refclk_lpm_sel) + reg |= DWC3_GFLADJ_REFCLK_LPM_SEL; + dwc3_writel(dwc->regs, DWC3_GFLADJ, reg); } @@ -788,7 +792,7 @@ static int dwc3_phy_setup(struct dwc3 *dwc) else reg |= DWC3_GUSB2PHYCFG_ENBLSLPM; - if (dwc->dis_u2_freeclk_exists_quirk) + if (dwc->dis_u2_freeclk_exists_quirk || dwc->gfladj_refclk_lpm_sel) reg &= ~DWC3_GUSB2PHYCFG_U2_FREECLK_EXISTS; dwc3_writel(dwc->regs, DWC3_GUSB2PHYCFG(0), reg); @@ -1490,6 +1494,8 @@ static void dwc3_get_properties(struct dwc3 *dwc) "snps,dis-tx-ipgap-linecheck-quirk"); dwc->parkmode_disable_ss_quirk = device_property_read_bool(dev, "snps,parkmode-disable-ss-quirk"); + dwc->gfladj_refclk_lpm_sel = device_property_read_bool(dev, + "snps,gfladj-refclk-lpm-sel-quirk"); dwc->tx_de_emphasis_quirk = device_property_read_bool(dev, "snps,tx_de_emphasis_quirk"); diff --git a/drivers/usb/dwc3/core.h b/drivers/usb/dwc3/core.h index 81c486b3941c..725fb17e4a9e 100644 --- a/drivers/usb/dwc3/core.h +++ b/drivers/usb/dwc3/core.h @@ -390,6 +390,7 @@ #define DWC3_GFLADJ_30MHZ_SDBND_SEL BIT(7) #define DWC3_GFLADJ_30MHZ_MASK 0x3f #define DWC3_GFLADJ_REFCLK_FLADJ_MASK GENMASK(21, 8) +#define DWC3_GFLADJ_REFCLK_LPM_SEL BIT(23) #define DWC3_GFLADJ_240MHZDECR GENMASK(30, 24) #define DWC3_GFLADJ_240MHZDECR_PLS1 BIT(31) @@ -1309,6 +1310,7 @@ struct dwc3 { unsigned dis_del_phy_power_chg_quirk:1; unsigned dis_tx_ipgap_linecheck_quirk:1; unsigned parkmode_disable_ss_quirk:1; + unsigned gfladj_refclk_lpm_sel:1; unsigned tx_de_emphasis_quirk:1; unsigned tx_de_emphasis:2; From patchwork Sat Oct 22 07:29: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: 7860 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1161636wrr; Sat, 22 Oct 2022 04:30:57 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7bodXbonHC4ahXLHHgo4VN2T3EZUiDtmhIHc8o2PYZlTdGVzRSbORqfVqV8JaluFeActkF X-Received: by 2002:a17:902:ecc2:b0:181:b55a:f954 with SMTP id a2-20020a170902ecc200b00181b55af954mr23742640plh.32.1666438257040; Sat, 22 Oct 2022 04:30:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666438257; cv=none; d=google.com; s=arc-20160816; b=oLJpiVnjk8o1PCh/LUpOeOm+ckq6TwaNlMRr724wR0JX6xQ/ZpJE6I42V7ntUYXROV YXzt6k5Nqz6NTKDxkNyMg4SvD8S8rrT9biO3WBSa25l5IWEQVLjEk6vNoJrWFe5fZhOH YkG70gSL8ymGAqi7OUD+HtNQhfRwKh2j9qbBTDUZ1lHvZJR8I68cfnpARBQTS7SNBwqq qnfUjz5VdX+yOk4P4/zuGjHCrCqGeI+pdKQnQJ9gV5LcRQ48X9WfRkSW2+p6rLK9PAwt /IyhQYV4Ao3OWMn4gYSI4IbovZNJ0TvWzm/XumLp0Wf0OXnt+UL3ARaKaGcAkHu2nhyx wjTw== 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=MDN4dmobED0mE4SuglA3l4oPZiJIVUlu9ajyPJp+6RE=; b=UbdrcQpjYjLjDeuHKzl+TFO9XuhrCjC5Wgu/VtTo/hnNXkPGixdQvzyr1uXnkBlGIT sgjI/+s1LTswVyo3kth2iswLSHky71Yq9FWNYWrDkPDJuBqu9v1PDa723Qpz7aZgifnV qJDM2eUU+pfAti+kBr1CAiORlkYMH0tZ8Jq4BrFErQhgr4hIHibmh5NaOh02SIsOR8Xb G9vvpLUW7cIDF2T0Ri4GbmK9q4JUq9MInvxBRBiTRMCBgaKRt8bxtKGiPH+ynOhIcIXG X26ZCQqLKziMbngTkinc0QT2q9hMWRR1RTnty6vxS9xIjkT8jrLC91OAMa9niUt0cKNo 5hlw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="ro7zgT/m"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 u20-20020a63b554000000b0046ec7b397e1si4302273pgo.759.2022.10.22.04.30.43; Sat, 22 Oct 2022 04:30: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="ro7zgT/m"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231249AbiJVLTo (ORCPT + 99 others); Sat, 22 Oct 2022 07:19:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32864 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230413AbiJVLTI (ORCPT ); Sat, 22 Oct 2022 07:19:08 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E68E42475F2; Sat, 22 Oct 2022 03:46: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 C8055B82E20; Sat, 22 Oct 2022 08:06:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 302F3C433D6; Sat, 22 Oct 2022 08:06:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425979; bh=94z56aiI4+SooN/wyKW9c92h9jRrR2o8RQM1g9fDeF0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ro7zgT/m05dXInNMAmKT4npILRM8JteIYhwKGE1rvl9SAzje4AGPJbivvYEPU+Tdg TY0z4jXrSR8W460anAMlmGYcL4lUvJLLNiEKEpYHsCilIknrIJalWYD6W+y6rfH7py q70cOsPmmhqUZNo8hEg4qz0RbmMY1LNUEG1iT2vA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alexander Stein , Sasha Levin Subject: [PATCH 5.19 678/717] arm64: dts: imx8mp: Add snps,gfladj-refclk-lpm-sel quirk to USB nodes Date: Sat, 22 Oct 2022 09:29:17 +0200 Message-Id: <20221022072528.449215556@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 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?1747387161567387693?= X-GMAIL-MSGID: =?utf-8?q?1747387161567387693?= From: Alexander Stein [ Upstream commit 5c3d5ecf48ab06c709c012bf1e8f0c91e1fcd7ad ] With this set the SOF/ITP counter is based on ref_clk when 2.0 ports are suspended. snps,dis-u2-freeclk-exists-quirk can be removed as snps,gfladj-refclk-lpm-sel also clears the free running clock configuration bit. Signed-off-by: Alexander Stein Link: https://lore.kernel.org/r/20220915062855.751881-4-alexander.stein@ew.tq-group.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- arch/arm64/boot/dts/freescale/imx8mp.dtsi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/arm64/boot/dts/freescale/imx8mp.dtsi b/arch/arm64/boot/dts/freescale/imx8mp.dtsi index 410d0d5e6f1e..7faf2d71ba4f 100644 --- a/arch/arm64/boot/dts/freescale/imx8mp.dtsi +++ b/arch/arm64/boot/dts/freescale/imx8mp.dtsi @@ -1168,7 +1168,7 @@ interrupts = ; phys = <&usb3_phy0>, <&usb3_phy0>; phy-names = "usb2-phy", "usb3-phy"; - snps,dis-u2-freeclk-exists-quirk; + snps,gfladj-refclk-lpm-sel-quirk; }; }; @@ -1210,7 +1210,7 @@ interrupts = ; phys = <&usb3_phy1>, <&usb3_phy1>; phy-names = "usb2-phy", "usb3-phy"; - snps,dis-u2-freeclk-exists-quirk; + snps,gfladj-refclk-lpm-sel-quirk; }; }; From patchwork Sat Oct 22 07: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: 7857 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1161037wrr; Sat, 22 Oct 2022 04:29:25 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4+OBnCtAswhG9k+M9OSXUdtw424TvSTSZFPlJ32dUSGZuzTz4IZhUXzUuuGqG3k9WRs1xy X-Received: by 2002:a05:6a00:181c:b0:563:2c6c:2a7a with SMTP id y28-20020a056a00181c00b005632c6c2a7amr23956974pfa.28.1666438165548; Sat, 22 Oct 2022 04:29:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666438165; cv=none; d=google.com; s=arc-20160816; b=qaJMoY5eeGT6YguuBKQVSvKMmKUpRf5GLql6EH5XgVRtNnksLNaCG7Mkz2GObGz4gr RuqJb3SOndYhNazC0OYVZ/qqS6VJpOMjqt9FsYbtaSSGaVMvUOX8IVAgVLjNbfm1t44h Yx8Izx+O6pM4Th3GUi/it9vlFi4pP59kWAp1Ewlp9EOHZZYe2P3mESb8dr7KR0sLz7cf HwvHufOf2plglL1GzB/SYaRhhRThpycC4gO9covTxdWouVn8E0x1pwHZIa1xt1K3osG8 VZUBkYa6WLEzbbWW8sqIZd/94RAda2ZmB23hpGVbcRxOisztgscJDJ0JS/aWs0yNgaza 9gTw== 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=Sk/x/0bsr7ZhGqqlTQbyVWPXzydaDt13QZpCfy5kA/g=; b=zZ1YDcjj220D/u51yWP++dHmLE5RLlrMZh/Gizmv8w7JfMRoYdimyi71cwsbQUOQrl EAxIvrErGyaxHPJB1XrLQNFaA/Xv61C4Jp1InOKpmWekCUXrRrrtY3jCiL5Mu6O2OGxK roas8VNn0PEb/JENzHJVwzB9Y0V3PpJYDzXmP58tXnMqmWGWo28CzyW2LTJh9dyy0XK6 bt7O8jUV/Wek/Fr6pmGtbqhGZ7jV5nxyO9pZSfWIEbjC3EZ9CbR89lWUc/iIJtWV9Lal GXNKqipCqMLDaJl21c4amV0rkB9b6+VQkavOSByVDOoKY1qni83GZY/0YoIDc6H2nprG Xiiw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=QjKoZtLX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 73-20020a63064c000000b0041b86985526si21045201pgg.189.2022.10.22.04.29.12; Sat, 22 Oct 2022 04:29: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=QjKoZtLX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231236AbiJVLTZ (ORCPT + 99 others); Sat, 22 Oct 2022 07:19:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54936 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230101AbiJVLTC (ORCPT ); Sat, 22 Oct 2022 07:19:02 -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 3D4F6C34E2; Sat, 22 Oct 2022 03:46: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 D6AE8B82E0A; Sat, 22 Oct 2022 08:06:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 27F2EC433C1; Sat, 22 Oct 2022 08:06:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425982; bh=XFbVraSKgtVlDZpUMTUZW1AWVbio9XzAhaag5AnjlnI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QjKoZtLXq1gz2TBTzZt8q0bHyiAYAtAzA2H8WQ0Oyp3Sfm7aHRci6PKobAdimYgiy bBmya49InFwTgqfz7lEeWX2kaJ3CJWdTE3e5ddJk+P9vC2hDWDD+PbBiR8gfasPAw/ lTI6hib+msuY3mhSshP+52iMDCtRH1BV1WLAa+KM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Piyush Mehta , Sasha Levin Subject: [PATCH 5.19 679/717] usb: dwc3: core: Enable GUCTL1 bit 10 for fixing termination error after resume bug Date: Sat, 22 Oct 2022 09:29:18 +0200 Message-Id: <20221022072528.496796656@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 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?1747387066359259236?= X-GMAIL-MSGID: =?utf-8?q?1747387066359259236?= From: Piyush Mehta [ Upstream commit 63d7f9810a38102cdb8cad214fac98682081e1a7 ] When configured in HOST mode, after issuing U3/L2 exit controller fails to send proper CRC checksum in CRC5 field. Because of this behavior Transaction Error is generated, resulting in reset and re-enumeration of usb device attached. Enabling chicken bit 10 of GUCTL1 will correct this problem. When this bit is set to '1', the UTMI/ULPI opmode will be changed to "normal" along with HS terminations, term, and xcvr signals after EOR. This option is to support certain legacy UTMI/ULPI PHYs. Added "snps,resume-hs-terminations" quirk to resolved the above issue. Signed-off-by: Piyush Mehta Link: https://lore.kernel.org/r/20220920052235.194272-3-piyush.mehta@amd.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/usb/dwc3/core.c | 17 +++++++++++++++++ drivers/usb/dwc3/core.h | 4 ++++ 2 files changed, 21 insertions(+) diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c index 02733b6a9061..21fa2e2795d8 100644 --- a/drivers/usb/dwc3/core.c +++ b/drivers/usb/dwc3/core.c @@ -1149,6 +1149,21 @@ static int dwc3_core_init(struct dwc3 *dwc) dwc3_writel(dwc->regs, DWC3_GUCTL2, reg); } + /* + * When configured in HOST mode, after issuing U3/L2 exit controller + * fails to send proper CRC checksum in CRC5 feild. Because of this + * behaviour Transaction Error is generated, resulting in reset and + * re-enumeration of usb device attached. All the termsel, xcvrsel, + * opmode becomes 0 during end of resume. Enabling bit 10 of GUCTL1 + * will correct this problem. This option is to support certain + * legacy ULPI PHYs. + */ + if (dwc->resume_hs_terminations) { + reg = dwc3_readl(dwc->regs, DWC3_GUCTL1); + reg |= DWC3_GUCTL1_RESUME_OPMODE_HS_HOST; + dwc3_writel(dwc->regs, DWC3_GUCTL1, reg); + } + if (!DWC3_VER_IS_PRIOR(DWC3, 250A)) { reg = dwc3_readl(dwc->regs, DWC3_GUCTL1); @@ -1492,6 +1507,8 @@ static void dwc3_get_properties(struct dwc3 *dwc) "snps,dis-del-phy-power-chg-quirk"); dwc->dis_tx_ipgap_linecheck_quirk = device_property_read_bool(dev, "snps,dis-tx-ipgap-linecheck-quirk"); + dwc->resume_hs_terminations = device_property_read_bool(dev, + "snps,resume-hs-terminations"); dwc->parkmode_disable_ss_quirk = device_property_read_bool(dev, "snps,parkmode-disable-ss-quirk"); dwc->gfladj_refclk_lpm_sel = device_property_read_bool(dev, diff --git a/drivers/usb/dwc3/core.h b/drivers/usb/dwc3/core.h index 725fb17e4a9e..b9fa0fa5ba7c 100644 --- a/drivers/usb/dwc3/core.h +++ b/drivers/usb/dwc3/core.h @@ -262,6 +262,7 @@ #define DWC3_GUCTL1_DEV_FORCE_20_CLK_FOR_30_CLK BIT(26) #define DWC3_GUCTL1_DEV_L1_EXIT_BY_HW BIT(24) #define DWC3_GUCTL1_PARKMODE_DISABLE_SS BIT(17) +#define DWC3_GUCTL1_RESUME_OPMODE_HS_HOST BIT(10) /* Global Status Register */ #define DWC3_GSTS_OTG_IP BIT(10) @@ -1094,6 +1095,8 @@ struct dwc3_scratchpad_array { * change quirk. * @dis_tx_ipgap_linecheck_quirk: set if we disable u2mac linestate * check during HS transmit. + * @resume-hs-terminations: Set if we enable quirk for fixing improper crc + * generation after resume from suspend. * @parkmode_disable_ss_quirk: set if we need to disable all SuperSpeed * instances in park mode. * @tx_de_emphasis_quirk: set if we enable Tx de-emphasis quirk @@ -1309,6 +1312,7 @@ struct dwc3 { unsigned dis_u2_freeclk_exists_quirk:1; unsigned dis_del_phy_power_chg_quirk:1; unsigned dis_tx_ipgap_linecheck_quirk:1; + unsigned resume_hs_terminations:1; unsigned parkmode_disable_ss_quirk:1; unsigned gfladj_refclk_lpm_sel:1; From patchwork Sat Oct 22 07: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: 7721 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1109906wrr; Sat, 22 Oct 2022 01:50:30 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4fM9CSGMa53Cw9CpXrEMpn4MTSV1gDxr+h7LNzM4FerUu+GlX1Cix2FjfPXgax9kskcRUs X-Received: by 2002:a05:6402:11c9:b0:45d:aa9b:5193 with SMTP id j9-20020a05640211c900b0045daa9b5193mr21291102edw.372.1666428630196; Sat, 22 Oct 2022 01:50:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666428630; cv=none; d=google.com; s=arc-20160816; b=oGsuuC6HkyxGjXWJXwhe1pjayZ9A/o4+a9jtu/kf+j3dBGAjyAIt/r79jc+SPpayOY oApTJcRROq1rXCuwkuBBn0yv97xEb++SL1hhbuSsz32jKLpfSC38Vnlb5zE7hZW+XnhS 3qQ8uVuTRNCpfOIrAp28jKCYgOt51ZXQ+LhanbIM31lGwrvglXgan39SDi7D28nqhuXf o9ubuHLdNvn02CmubaHJJ1QgSv9NhDld2MmQQpCTGPa5HzQwRw6W+CymyyJGUukl237s GNcyBQ0vQQprqy/z7RgQngvjvA6/FxrMzKLwv4EVjSJC1w43ouQ/1OjW+rt4AipsAjnX vGUw== 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=xJQEd/tw+5bihUtS8xNDx4uOCFTFc7l87/IjfaVZf1w=; b=EM3fLPZcip2fAadVNwfdFf0YmePnzudG+a4r56gaSLMAbAsxrN8THUv8XVfzJ+7ESe Te0npbVg2hegKoxwpQE8Wtze5Z5lfPGmQbptUWaODe4i0cN2+bPyN4gReZNZ8WHXN8gw jjIS8q1hYfHE7vre0sdc8erhB+txaqnO7CTw9SEfXj/Jf1/gYFKokC3hUCGt6ip+N9iR sym3tIL+vj+bDGu1moEWojz2/IuOyEPxJVy99huSIJh8YL8/WahRmiKZsRv2kq9LUmm+ 09dbEYXQyVhIrS0gNmvpc/XXw2yUmfSSdqunFZIBzH0szyO+BlLeVw7gvvo7FFb/TPCM 0/fw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=RofjZBJG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 ds1-20020a170907724100b00782a3405722si19938844ejc.40.2022.10.22.01.50.06; Sat, 22 Oct 2022 01:50: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=RofjZBJG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S234326AbiJVIss (ORCPT + 99 others); Sat, 22 Oct 2022 04:48:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42050 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234643AbiJVIpv (ORCPT ); Sat, 22 Oct 2022 04:45: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 909031FCFD; Sat, 22 Oct 2022 01:09: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 B589EB82E38; Sat, 22 Oct 2022 08:06:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0B2A9C433D6; Sat, 22 Oct 2022 08:06:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425985; bh=6vbKmmz0ryFxKZLGyy2yrARzgTOezGzvxGBhsplRrh8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RofjZBJG5GTZgE02VIy2nT1mxRHEwDa2T8Dav/Yad8edJc/9ofhHAPOfmsfWAg2tI F6J3R6UN1HXfdJoxdjtR9mW5EhEMrLQgJZIrxJumxP7EviygCbHOfx+tVQEKnKUFFY nks5apVJpA4tCnezT3zWbILFm0QVT9kG7ysVoRB8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, sunghwan jung , Sasha Levin Subject: [PATCH 5.19 680/717] Revert "usb: storage: Add quirk for Samsung Fit flash" Date: Sat, 22 Oct 2022 09:29:19 +0200 Message-Id: <20221022072528.541040261@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747377067411412100?= X-GMAIL-MSGID: =?utf-8?q?1747377067411412100?= 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 4993227ab293..20dcbccb290b 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 Sat Oct 22 07: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: 7850 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1155431wrr; Sat, 22 Oct 2022 04:11:50 -0700 (PDT) X-Google-Smtp-Source: AMsMyM53/ZQEH43oSP4bIgdSGuMdpZyz/U48BQzacIkBXGBy5789ioTKdhevdm+IzQfH/0BmX57u X-Received: by 2002:aa7:8d17:0:b0:560:485a:e242 with SMTP id j23-20020aa78d17000000b00560485ae242mr23960666pfe.31.1666437109961; Sat, 22 Oct 2022 04:11:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666437109; cv=none; d=google.com; s=arc-20160816; b=Qa7Fy256IgMZ7NJJbwNpGCc4cARsTh1t0LrXn+X6uK+HZ9W8CarTMUxkLEUO8rM8LM GiN87WkMZ0gLaaJtH0QdO/6ImxYFn667xPJGebEK18rCRR3Juk+43hL71e1UB+yAZrfV Ssc5exbzwXVk+ZC+xGVdf0GVkzH2tR+epP6kaXs1BXFVU5G5ZGfs40u2qEFz5KVNmSkj Jxk33DjL7EJ+vPQSrqE5SRN9P9GuHlRJkgFXv3CmnExI3vynSKQQtNf4rOT++IXAv5yj w2+O1AS2Ww5atw7l7EwazlP7PMNxQxRVQ0U1vZn/C277VHw50BzneyV7K9JHH9iozYjM /9pQ== 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=y+BsHAJRDvz5QiRCJsFRXVtWVLW/Kh41cNxu5ogLHtc=; b=VenNqY5hKrdYPa2DjzWSrUg7AQmG4wzq6INMp1C0n5cHK+BVcMsbYo1oen0x9sguC2 cyqnogxofzchOdlEEDtdo1Do2H7tiQEWAThcuPvrAohTA2LXbhFuJk2T/q4X6baJSulr 0aRi/kl2WfRLGf6Mk2IH9L3E8WeqJcYModKx1KCOWMXtvjta9VxxSfuW3/Ndr5D8bWGa aDgY82el5O5qs72VCQfHwQ/SLqTtz8AKSPQAW7PfXwXvXzkBSaSO4eN/GZGSgG6tbXh2 LSnFjGgMoXuN2Lf9MEaQnsL6efg+9dF8JItQjIJmgxQAhfK+jhARmQwdHUExhMh0oZWM oXlg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=l6GpWIJ6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 j4-20020a170902da8400b0017f6557bf88si33910703plx.588.2022.10.22.04.11.37; Sat, 22 Oct 2022 04:11: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=l6GpWIJ6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S230016AbiJVLJV (ORCPT + 99 others); Sat, 22 Oct 2022 07:09:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44024 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231236AbiJVLI4 (ORCPT ); Sat, 22 Oct 2022 07:08:56 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D6EE131857E; Sat, 22 Oct 2022 03:27: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 DC41660B7B; Sat, 22 Oct 2022 08:06:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 012AFC433C1; Sat, 22 Oct 2022 08:06:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425988; bh=v54vnW+bX4cKUN2tJYHQtuvmIGDk0z24Qkca/Gc9l6g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=l6GpWIJ6siapBAji6Wm6HaF6nnvMBtGRQISybi2Vz4U3E9UohYqZEzvqr0/VN1lxO 4SG5cjxiDE6MeCK8nlQY+xZ1TfvKq4XBUth9/hPiU9wT7qQoGpB46023BveTGbgtSn ZZWsr1pHSkQmihkOCx1eiUJT/0A+POV1Igd+Gi4w= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Xiaoke Wang , Sasha Levin Subject: [PATCH 5.19 681/717] staging: rtl8723bs: fix potential memory leak in rtw_init_drv_sw() Date: Sat, 22 Oct 2022 09:29:20 +0200 Message-Id: <20221022072528.588527042@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 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?1747385959304328046?= X-GMAIL-MSGID: =?utf-8?q?1747385959304328046?= From: Xiaoke Wang [ Upstream commit 5a5aa9cce621e2c0e25a1e5d72d6be1749167cc0 ] In rtw_init_drv_sw(), there are various init functions are called to populate the padapter structure and some checks for their return value. However, except for the first one error path, the other five error paths do not properly release the previous allocated resources, which leads to various memory leaks. This patch fixes them and keeps the success and error separate. Note that these changes keep the form of `rtw_init_drv_sw()` in "drivers/staging/r8188eu/os_dep/os_intfs.c". As there is no proper device to test with, no runtime testing was performed. Signed-off-by: Xiaoke Wang Link: https://lore.kernel.org/r/tencent_C3B899D2FC3F1BC827F3552E0B0734056006@qq.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/staging/rtl8723bs/os_dep/os_intfs.c | 60 +++++++++++---------- 1 file changed, 31 insertions(+), 29 deletions(-) diff --git a/drivers/staging/rtl8723bs/os_dep/os_intfs.c b/drivers/staging/rtl8723bs/os_dep/os_intfs.c index 380d8c9e1239..68bba3c0e757 100644 --- a/drivers/staging/rtl8723bs/os_dep/os_intfs.c +++ b/drivers/staging/rtl8723bs/os_dep/os_intfs.c @@ -664,51 +664,36 @@ void rtw_reset_drv_sw(struct adapter *padapter) u8 rtw_init_drv_sw(struct adapter *padapter) { - u8 ret8 = _SUCCESS; - rtw_init_default_value(padapter); rtw_init_hal_com_default_value(padapter); - if (rtw_init_cmd_priv(&padapter->cmdpriv)) { - ret8 = _FAIL; - goto exit; - } + if (rtw_init_cmd_priv(&padapter->cmdpriv)) + return _FAIL; padapter->cmdpriv.padapter = padapter; - if (rtw_init_evt_priv(&padapter->evtpriv)) { - ret8 = _FAIL; - goto exit; - } + if (rtw_init_evt_priv(&padapter->evtpriv)) + goto free_cmd_priv; - - if (rtw_init_mlme_priv(padapter) == _FAIL) { - ret8 = _FAIL; - goto exit; - } + if (rtw_init_mlme_priv(padapter) == _FAIL) + goto free_evt_priv; init_mlme_ext_priv(padapter); - if (_rtw_init_xmit_priv(&padapter->xmitpriv, padapter) == _FAIL) { - ret8 = _FAIL; - goto exit; - } + if (_rtw_init_xmit_priv(&padapter->xmitpriv, padapter) == _FAIL) + goto free_mlme_ext; - if (_rtw_init_recv_priv(&padapter->recvpriv, padapter) == _FAIL) { - ret8 = _FAIL; - goto exit; - } + if (_rtw_init_recv_priv(&padapter->recvpriv, padapter) == _FAIL) + goto free_xmit_priv; /* add for CONFIG_IEEE80211W, none 11w also can use */ spin_lock_init(&padapter->security_key_mutex); /* We don't need to memset padapter->XXX to zero, because adapter is allocated by vzalloc(). */ /* memset((unsigned char *)&padapter->securitypriv, 0, sizeof (struct security_priv)); */ - if (_rtw_init_sta_priv(&padapter->stapriv) == _FAIL) { - ret8 = _FAIL; - goto exit; - } + if (_rtw_init_sta_priv(&padapter->stapriv) == _FAIL) + goto free_recv_priv; padapter->stapriv.padapter = padapter; padapter->setband = GHZ24_50; @@ -719,9 +704,26 @@ u8 rtw_init_drv_sw(struct adapter *padapter) rtw_hal_dm_init(padapter); -exit: + return _SUCCESS; + +free_recv_priv: + _rtw_free_recv_priv(&padapter->recvpriv); + +free_xmit_priv: + _rtw_free_xmit_priv(&padapter->xmitpriv); + +free_mlme_ext: + free_mlme_ext_priv(&padapter->mlmeextpriv); - return ret8; + rtw_free_mlme_priv(&padapter->mlmepriv); + +free_evt_priv: + rtw_free_evt_priv(&padapter->evtpriv); + +free_cmd_priv: + rtw_free_cmd_priv(&padapter->cmdpriv); + + return _FAIL; } void rtw_cancel_all_timer(struct adapter *padapter) From patchwork Sat Oct 22 07: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: 7769 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1121046wrr; Sat, 22 Oct 2022 02:27:19 -0700 (PDT) X-Google-Smtp-Source: AMsMyM61kd3ksQagxbjb1zqUFMBMsLSGqUdU3zXjPWmw5jsyggclHDzhA8/bwJv85FTm5Yon8EDL X-Received: by 2002:a17:902:e5c9:b0:186:4f8a:d6a with SMTP id u9-20020a170902e5c900b001864f8a0d6amr20975254plf.150.1666430838852; Sat, 22 Oct 2022 02:27:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666430838; cv=none; d=google.com; s=arc-20160816; b=XpyyM3FFCf84Id8rxdovO6Mt8wFoAnyDFbupW14UaEXtpabuKSRhobOGW5s+YU3xLN UTGQq4ByZ2XoKgWG4eJpdQJ/ciP8lyBZYjcn2UdnHQrripmKvqsMMyPfwd/D5SGn+SKh zxSyCxFbtb2UYt/f0uzQ+CbeLMRwBKNYQGk0gDvewGGvLlDfj5eqAy1RutxP0Oxl/QLy SOeMD0stQaE+dJxvz2yZHyQmiKvx39mUjVZo5CaF2IMwBmlenijPk0k39RyuYGYO3LG2 h3r8x3TjwEP/Y/W6ZaFI6vqOmPp7+i862YqruJhjgeLClbcqr7NZx/HxqOTAFHZ4feuS jpKw== 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=sWvH+VtmPoJG7mrgB6m66v6mI7zgSRonMny6Q5/Knok=; b=yHzG5R0WXbj1i4QvjAY9TBMDdPL6rsIFjoTJKd6SIQCym37MSeZQ6p38ZrkRMHW9r0 ZoiddSIc9Ptl1NogGAXahV8JH7YBa3q9TWyeknI5GNzLu1lyRc68uNLyE7gZPvM/Qgze g//QMuJKZ39q//RIDeLE7HCAoWx3lc1NNt5qlKeQmKzpVtwmWXC8c2RAdsIdVAq3BQec NUtA8xml/G/hJoOVWy6Bd2ZW9J//VrbJRpr+e7sbe/dKtvzyZjIUrcK0Um71IHCJJkrs dsqKaxO2x3xJ5k/nsNHKlAEtVaoKuSGdiGl9YpUMWiW8E8poNqH/hI22BiToa/miQ5KV Yp6Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Y9KaCJvp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 j70-20020a638b49000000b0046ebcc1c65bsi4607536pge.739.2022.10.22.02.27.06; Sat, 22 Oct 2022 02:27: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=Y9KaCJvp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S235106AbiJVJDr (ORCPT + 99 others); Sat, 22 Oct 2022 05:03:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55652 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235133AbiJVJCx (ORCPT ); Sat, 22 Oct 2022 05:02:53 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 47B822F92A7; Sat, 22 Oct 2022 01:17: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 BCBA0B82E46; Sat, 22 Oct 2022 08:06:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0AEDFC433C1; Sat, 22 Oct 2022 08:06:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425994; bh=lDR61PbfI7H5eQX4Ti6CnNOBp3xkPZ74M3x0TE5CuNE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Y9KaCJvpcKC9gVt6+b9W4cpRPq1pA+aoUmN6grNW75TJpBLWV80/EV7pWk6PK2Yhj 9WlV+ezBNj8mRcVoSUyxXWDvFYco+BWJk8hmsEvfwXZR7kVRLXCNuTLQSIazX0yNzQ f3C2r04zQXUs1AfxWb0v9OVU54bfvCF4bvzPUyuI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Xiaoke Wang , Sasha Levin Subject: [PATCH 5.19 682/717] staging: rtl8723bs: fix a potential memory leak in rtw_init_cmd_priv() Date: Sat, 22 Oct 2022 09:29:21 +0200 Message-Id: <20221022072528.637631891@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747379383254877641?= X-GMAIL-MSGID: =?utf-8?q?1747379383254877641?= From: Xiaoke Wang [ Upstream commit 708056fba733a73d926772ea4ce9a42d240345da ] In rtw_init_cmd_priv(), if `pcmdpriv->rsp_allocated_buf` is allocated in failure, then `pcmdpriv->cmd_allocated_buf` will be not properly released. Besides, considering there are only two error paths and the first one can directly return, so we do not need implicitly jump to the `exit` tag to execute the error handler. So this patch added `kfree(pcmdpriv->cmd_allocated_buf);` on the error path to release the resource and simplified the return logic of rtw_init_cmd_priv(). As there is no proper device to test with, no runtime testing was performed. Signed-off-by: Xiaoke Wang Link: https://lore.kernel.org/r/tencent_2B7931B79BA38E22205C5A09EFDF11E48805@qq.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/staging/rtl8723bs/core/rtw_cmd.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/drivers/staging/rtl8723bs/core/rtw_cmd.c b/drivers/staging/rtl8723bs/core/rtw_cmd.c index b4170f64d118..03c2c66dbf66 100644 --- a/drivers/staging/rtl8723bs/core/rtw_cmd.c +++ b/drivers/staging/rtl8723bs/core/rtw_cmd.c @@ -161,8 +161,6 @@ static struct cmd_hdl wlancmds[] = { int rtw_init_cmd_priv(struct cmd_priv *pcmdpriv) { - int res = 0; - init_completion(&pcmdpriv->cmd_queue_comp); init_completion(&pcmdpriv->terminate_cmdthread_comp); @@ -175,18 +173,16 @@ int rtw_init_cmd_priv(struct cmd_priv *pcmdpriv) pcmdpriv->cmd_allocated_buf = rtw_zmalloc(MAX_CMDSZ + CMDBUFF_ALIGN_SZ); - if (!pcmdpriv->cmd_allocated_buf) { - res = -ENOMEM; - goto exit; - } + if (!pcmdpriv->cmd_allocated_buf) + return -ENOMEM; pcmdpriv->cmd_buf = pcmdpriv->cmd_allocated_buf + CMDBUFF_ALIGN_SZ - ((SIZE_PTR)(pcmdpriv->cmd_allocated_buf) & (CMDBUFF_ALIGN_SZ-1)); pcmdpriv->rsp_allocated_buf = rtw_zmalloc(MAX_RSPSZ + 4); if (!pcmdpriv->rsp_allocated_buf) { - res = -ENOMEM; - goto exit; + kfree(pcmdpriv->cmd_allocated_buf); + return -ENOMEM; } pcmdpriv->rsp_buf = pcmdpriv->rsp_allocated_buf + 4 - ((SIZE_PTR)(pcmdpriv->rsp_allocated_buf) & 3); @@ -196,8 +192,8 @@ int rtw_init_cmd_priv(struct cmd_priv *pcmdpriv) pcmdpriv->rsp_cnt = 0; mutex_init(&pcmdpriv->sctx_mutex); -exit: - return res; + + return 0; } static void c2h_wk_callback(struct work_struct *work); From patchwork Sat Oct 22 07: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: 7731 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1110142wrr; Sat, 22 Oct 2022 01:51:31 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5tpOcRdzegNkSGI7hm6EaT4RwUxcL0yzTHJc8+6kh7OQGFB/xrHdtyB8LyDICFM6Qj6uZA X-Received: by 2002:a17:907:7e9a:b0:796:7a21:1520 with SMTP id qb26-20020a1709077e9a00b007967a211520mr13204123ejc.236.1666428691529; Sat, 22 Oct 2022 01:51:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666428691; cv=none; d=google.com; s=arc-20160816; b=t9oA3RJViiFmBiO0nAFtabBEDyjBEFHeZCEZvy9DiRJf+DbrGjV+t9hUe7YtLwK2nE gPjatihlkH1xnt485VyQR7ZF2R96HeQmbyDdpVwOxGlD6GxpQPwzFH75vtoDjftbUnCT uECkcSwIOm+y+3B00tWuEJZnJJBQgSZmGaaL/+1nBU1aGLSa2vzjAGefQLGTDJ0oNiAt Xg0a5YE1vp+IH3+5Rv8cBj04EzeVsuznFubO7iYJ/cbMooCV4U3+J2osM+kKda69rnlG D7ecQzKdaXb2CA2ZocYuvjeff2agQprRbFmILIPsFr7EiGE+am21HnCOveF0iA0VuZQB 1HgQ== 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=aCrVrmCgsXg/0gj68/SN/ZZ8DR1FtDZ1Blrqf3dGLX8=; b=pVhsBe3mGaMQtN6cBo9626no9VHIQiww+44MzWnMvbhbhXdFgWg7DnoNq3SvDe6hCH HufuoYRh5gL44X5RILxOE6lnzh2O1sQt7RVLGlbqwJ2odzL3IXnIiL7BtFAwOFRngmGb 0AEplY4ZCJOdohrGuNHTFS50hnmn4mTAYBa9dDmG6t+iBOqDGEIPv5hC6kvPECPH7yya 7vsI4yn4q/mTtxY/qfCj3phwaJjJekTx2svY2cQ67hcHjLeyzSkMxqxyWnoxtOTEpVBD Z0S0rpDRc6W4z4TpzD+Tb5XVepUmxDIP0ife58b50p/ssgLT+I8xxNsSKP/YKrRKboM8 u3Gw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=UhWx7ZuL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 ev16-20020a056402541000b004596d6e78e3si18603469edb.144.2022.10.22.01.51.07; Sat, 22 Oct 2022 01:51: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=UhWx7ZuL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S234893AbiJVIuc (ORCPT + 99 others); Sat, 22 Oct 2022 04:50:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45834 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234942AbiJVItM (ORCPT ); Sat, 22 Oct 2022 04:49: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 CB6211CDCF7; Sat, 22 Oct 2022 01:10: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 CA65460ADD; Sat, 22 Oct 2022 08:06:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C6A5AC433C1; Sat, 22 Oct 2022 08:06:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425997; bh=AovMnUVFaDgnuucVmCvW2YnL6/FL1thsQNXgFxRaPiw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UhWx7ZuL0GCwf3DQQCRPGWG0E85sH9tVyF78GhaOtezCnoYkPT+SytG6eyJ+SxF5N kVjuo7+AMstmQjZpZAZKgO5Vt7yRkxqFSujerCxmbh8eKlW9jUOHSDjskXVHVuDzGb /SmGJTOOrldwj5Qiy9JW4Qgf5z64FETrXSWLwNe0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, kernel test robot , "Steven Rostedt (Google)" , Arun Easi , "Martin K. Petersen" , Sasha Levin Subject: [PATCH 5.19 683/717] scsi: tracing: Fix compile error in trace_array calls when TRACING is disabled Date: Sat, 22 Oct 2022 09:29:22 +0200 Message-Id: <20221022072528.688051704@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747377131822728620?= X-GMAIL-MSGID: =?utf-8?q?1747377131822728620?= From: Arun Easi [ Upstream commit 1a77dd1c2bb5d4a58c16d198cf593720787c02e4 ] Fix this compilation error seen when CONFIG_TRACING is not enabled: drivers/scsi/qla2xxx/qla_os.c: In function 'qla_trace_init': drivers/scsi/qla2xxx/qla_os.c:2854:25: error: implicit declaration of function 'trace_array_get_by_name'; did you mean 'trace_array_set_clr_event'? [-Werror=implicit-function-declaration] 2854 | qla_trc_array = trace_array_get_by_name("qla2xxx"); | ^~~~~~~~~~~~~~~~~~~~~~~ | trace_array_set_clr_event drivers/scsi/qla2xxx/qla_os.c: In function 'qla_trace_uninit': drivers/scsi/qla2xxx/qla_os.c:2869:9: error: implicit declaration of function 'trace_array_put' [-Werror=implicit-function-declaration] 2869 | trace_array_put(qla_trc_array); | ^~~~~~~~~~~~~~~ Link: https://lore.kernel.org/r/20220907233308.4153-2-aeasi@marvell.com Reported-by: kernel test robot Reviewed-by: Steven Rostedt (Google) Signed-off-by: Arun Easi Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin --- include/linux/trace.h | 36 ++++++++++++++++++++++++++++++++++-- 1 file changed, 34 insertions(+), 2 deletions(-) diff --git a/include/linux/trace.h b/include/linux/trace.h index bf169612ffe1..b5e16e438448 100644 --- a/include/linux/trace.h +++ b/include/linux/trace.h @@ -2,8 +2,6 @@ #ifndef _LINUX_TRACE_H #define _LINUX_TRACE_H -#ifdef CONFIG_TRACING - #define TRACE_EXPORT_FUNCTION BIT(0) #define TRACE_EXPORT_EVENT BIT(1) #define TRACE_EXPORT_MARKER BIT(2) @@ -28,6 +26,8 @@ struct trace_export { int flags; }; +#ifdef CONFIG_TRACING + int register_ftrace_export(struct trace_export *export); int unregister_ftrace_export(struct trace_export *export); @@ -48,6 +48,38 @@ void osnoise_arch_unregister(void); void osnoise_trace_irq_entry(int id); void osnoise_trace_irq_exit(int id, const char *desc); +#else /* CONFIG_TRACING */ +static inline int register_ftrace_export(struct trace_export *export) +{ + return -EINVAL; +} +static inline int unregister_ftrace_export(struct trace_export *export) +{ + return 0; +} +static inline void trace_printk_init_buffers(void) +{ +} +static inline int trace_array_printk(struct trace_array *tr, unsigned long ip, + const char *fmt, ...) +{ + return 0; +} +static inline int trace_array_init_printk(struct trace_array *tr) +{ + return -EINVAL; +} +static inline void trace_array_put(struct trace_array *tr) +{ +} +static inline struct trace_array *trace_array_get_by_name(const char *name) +{ + return NULL; +} +static inline int trace_array_destroy(struct trace_array *tr) +{ + return 0; +} #endif /* CONFIG_TRACING */ #endif /* _LINUX_TRACE_H */ From patchwork Sat Oct 22 07: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: 7742 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1110730wrr; Sat, 22 Oct 2022 01:54:03 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4LBfTzRuCrNm2CQT1qMcWGATML7BmMOfNmSjI3DQ4Uyd7G6HAq1bB741CE/aamx3+Q7xz1 X-Received: by 2002:a17:906:4fcb:b0:791:9a26:376f with SMTP id i11-20020a1709064fcb00b007919a26376fmr19245877ejw.431.1666428843449; Sat, 22 Oct 2022 01:54:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666428843; cv=none; d=google.com; s=arc-20160816; b=s7rQdX9A7EdveAptVsUB9wvKsnHLpSKTZA7y+1eldrf5m+4bVzNWI0ZZmZRv2ideMD Otp7TAEH4aDqP9CnqBGxuh31O1Hp5a1S605Ggylns1vCFzgOlPOrdLXIQFMgIhtd/QK3 0khKZPpY0ZpfZ1LSFEa3ab6EWhSQ8hiMcTOGPINaKDXYKKMHEgNVsGt8KbKLw75cAhAB uHREbG+Ld2LA2DoR9RV8belreN08nWmFAaATpu8TPGfsyUtk+aVJeRGxB+ACiON2WqQ7 CcxnBV6VJ/KtiC1e70Lp8CMgrYCu2IAPYGFB4rUQHzgaX62Jb6LCdT0ia7X4+6pxI7TW BQRg== 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=TV9yc9KtCRVANsKEA2EbDEYEXeAXEzwa1MbV+Yew/K0=; b=B3tFkzaVy/8cFXlrPkUumef+RbqLbE7CMjSLz3RTFTjXYDwtxNSYYHy1QxlKFt54oW jL0MsDqJh2xIOtMup1LGUsX5t9nBJ/JYoSDkXwdgja1NV+pUx/V2qh1mer5njybNOPt6 h7P6LeT0vW3L9lorJL26zkMiQEFRH1xiIiOPFNh9GZfeirs94iaM5UeVnKW4jSbnRbGk wKy10vbebleh94ru3xzUxkT1iNaYoF22/CUBRoHo3yI7TG3AC20v5tiYWs3S5sOJlE62 GFyn1Lq/8KBM7+CIz7KE78nBQOO75nXUI/xmIyVxdJXx4srJxGpMZb0cXe0mNbcWNolO qlqw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=EY7pgBMN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 wu13-20020a170906eecd00b00780636887fesi25446513ejb.797.2022.10.22.01.53.39; Sat, 22 Oct 2022 01:54: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=EY7pgBMN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S234983AbiJVIwz (ORCPT + 99 others); Sat, 22 Oct 2022 04:52:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47134 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231131AbiJVIwL (ORCPT ); Sat, 22 Oct 2022 04:52: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 426402F1412; Sat, 22 Oct 2022 01:11:56 -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 0527560AC3; Sat, 22 Oct 2022 08:08:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E7FEAC433C1; Sat, 22 Oct 2022 08:08:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666426118; bh=zlvOBi7kgkZoA/S+XkPCVsAvu3dMCz50xTOYDIk7Qeg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EY7pgBMNP6CWZqOwGyD8EbG771nR4SIf7I6qeJGlWhHEBf4JwyodwxprlYiL3Ty4C jzfbnGc8ECfjNiG3tG3CeYZODGshiZzCrAXPpHzVcD3zU+js/UTJne5r3Yu2PeejEi aSsbjSm7JbU3E2Iww2NHGCBLfiKIquDA9DMDJE4s= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, syzbot+0f2f7e65a3007d39539f@syzkaller.appspotmail.com, Jan Kara , Sasha Levin Subject: [PATCH 5.19 684/717] ext2: Use kvmalloc() for group descriptor array Date: Sat, 22 Oct 2022 09:29:23 +0200 Message-Id: <20221022072528.739528361@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747377290980566126?= X-GMAIL-MSGID: =?utf-8?q?1747377290980566126?= From: Jan Kara [ Upstream commit e7c7fbb9a8574ebd89cc05db49d806c7476863ad ] Array of group descriptor block buffers can get rather large. In theory in can reach 1MB for perfectly valid filesystem and even more for maliciously crafted ones. Use kvmalloc() to allocate the array to avoid straining memory allocator with large order allocations unnecessarily. Reported-by: syzbot+0f2f7e65a3007d39539f@syzkaller.appspotmail.com Signed-off-by: Jan Kara Signed-off-by: Sasha Levin --- fs/ext2/super.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/fs/ext2/super.c b/fs/ext2/super.c index b3232845d0c4..f53ab39bb8e8 100644 --- a/fs/ext2/super.c +++ b/fs/ext2/super.c @@ -163,7 +163,7 @@ static void ext2_put_super (struct super_block * sb) db_count = sbi->s_gdb_count; for (i = 0; i < db_count; i++) brelse(sbi->s_group_desc[i]); - kfree(sbi->s_group_desc); + kvfree(sbi->s_group_desc); kfree(sbi->s_debts); percpu_counter_destroy(&sbi->s_freeblocks_counter); percpu_counter_destroy(&sbi->s_freeinodes_counter); @@ -1093,7 +1093,7 @@ static int ext2_fill_super(struct super_block *sb, void *data, int silent) } db_count = (sbi->s_groups_count + EXT2_DESC_PER_BLOCK(sb) - 1) / EXT2_DESC_PER_BLOCK(sb); - sbi->s_group_desc = kmalloc_array(db_count, + sbi->s_group_desc = kvmalloc_array(db_count, sizeof(struct buffer_head *), GFP_KERNEL); if (sbi->s_group_desc == NULL) { @@ -1219,7 +1219,7 @@ static int ext2_fill_super(struct super_block *sb, void *data, int silent) for (i = 0; i < db_count; i++) brelse(sbi->s_group_desc[i]); failed_mount_group_desc: - kfree(sbi->s_group_desc); + kvfree(sbi->s_group_desc); kfree(sbi->s_debts); failed_mount: brelse(bh); From patchwork Sat Oct 22 07: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: 7683 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1108911wrr; Sat, 22 Oct 2022 01:46:32 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5jOFtuKIDdfsUa1wcgRxa+5X6m/H18gbLXBl+dXNY7ViG+rAxc/X5OF+mNEW54n3oa0ECT X-Received: by 2002:a05:6402:169a:b0:458:fe61:d3b4 with SMTP id a26-20020a056402169a00b00458fe61d3b4mr20822631edv.140.1666428392271; Sat, 22 Oct 2022 01:46:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666428392; cv=none; d=google.com; s=arc-20160816; b=nDMCWMQZXAmXMvir4lqza/s1Mt3IKp6/9/UyCJnMMZCDuJ5tQmBAU3X2czjSuQpkb4 R4JtWqYLHMgbHN+bcjsfy6mMhGY3W1bsco9q5RjsQIL7tP5xzX7f1r9s2GiiGzToymDf TH9GwWB8NuLQrmV+zrQwOtYHYkO8UYaSmtq6CgCNuD90CeJkUBoKImo8dhiZyPkt2Idm rhaqPDGhbGp1le4y1emFnj+Am16oyWVbr1B7UFCf2xGqudG2X8pqqrhv+/FJE9kt3TS9 wmYoZFIfRjQX+PvviqoZlvE4wVZPRAU40u2ny+Df5/K0Xn0M8d+/PC0K+q+Q+guas1Jk nqCg== 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=CZKpwtlKDlBG+/Tm1m4O6p+Z1HH49jmOq0ULDv1q6V8=; b=ao/xsysDM7UFCMrRztkUjB62s18yWJJXtKsrtRNxp+gslZSMljvIJtzJUpaV7Gffbi e2lbaeoJJoFZ8cEcHWTawo52a51vNtt4y+Og2Uhix7QRSpux9X1E1QrdmOMV66mIptvD 4HXo5V0GdbyHzt3kPSsqwavKjnQTUVmM7cq61fmdqqMpCBoc8cQSwdqFipe7XJ4LI3YG IxhGOblbvP+tJpSF76sFcP/k1sWlK0dfAW3DBmLPLP1zJQvhSLc3Xlqoe0ZkhQq1m5O1 XADv5ywTRJhoKfBScJGOzCqt8RZilRNGE1SGTrwuK4LJ9cJVsrBvG2Z5EvnPigybYqsI krXQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=mawu8gre; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 e25-20020a170906c01900b0073d8a8fedbfsi19294769ejz.386.2022.10.22.01.46.06; Sat, 22 Oct 2022 01:46: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=mawu8gre; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S234696AbiJVIpi (ORCPT + 99 others); Sat, 22 Oct 2022 04:45:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36476 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234713AbiJVInj (ORCPT ); Sat, 22 Oct 2022 04:43:39 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A5B552E9E17; Sat, 22 Oct 2022 01:07: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 CA3E660B94; Sat, 22 Oct 2022 08:07:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A3CBBC433C1; Sat, 22 Oct 2022 08:07:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666426021; bh=Bwh7M+IYDioMz+ftqtGfp/Hd9LUyK5obbUWZGXdGeUQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mawu8gre/JZTSlkTuE4B9NLH+Gf4wAIb5oCV7Pig7Ex7cXbKBjSuGpM4bq0ieZn8a 6t+X5clq3Z0P/r0maUnNFUIE8fL0duMCsic1so1MVLOyHxW01Z7dqZVkUhlPVtrACS pmTHcNO0IfsPLvjShDM3lXmhjZgrFIAMLid9vb24= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jonathan Derrick , Keith Busch , Sagi Grimberg , Chao Leng , Christoph Hellwig , Sasha Levin Subject: [PATCH 5.19 685/717] nvme: handle effects after freeing the request Date: Sat, 22 Oct 2022 09:29:24 +0200 Message-Id: <20221022072528.792980614@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376817601241000?= X-GMAIL-MSGID: =?utf-8?q?1747376817601241000?= From: Keith Busch [ Upstream commit bc8fb906b0ff9339b4286698cb7cd9cd5b8c53eb ] If a reset occurs after the scan work attempts to issue a command, the reset may quisce the admin queue, which blocks the scan work's command from dispatching. The scan work will not be able to complete while the queue is quiesced. Meanwhile, the reset work will cancel all outstanding admin tags and wait until all requests have transitioned to idle, which includes the passthrough request. But the passthrough request won't be set to idle until after the scan_work flushes, so we're deadlocked. Fix this by handling the end effects after the request has been freed. Link: https://bugzilla.kernel.org/show_bug.cgi?id=216354 Reported-by: Jonathan Derrick Signed-off-by: Keith Busch Reviewed-by: Sagi Grimberg Reviewed-by: Chao Leng Signed-off-by: Christoph Hellwig Signed-off-by: Sasha Levin --- drivers/nvme/host/core.c | 17 ++++++----------- drivers/nvme/host/ioctl.c | 9 ++++++++- drivers/nvme/host/nvme.h | 4 +++- drivers/nvme/target/passthru.c | 7 ++++++- 4 files changed, 23 insertions(+), 14 deletions(-) diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c index 326ad33537ed..47fd9d528c83 100644 --- a/drivers/nvme/host/core.c +++ b/drivers/nvme/host/core.c @@ -1089,8 +1089,8 @@ static u32 nvme_passthru_start(struct nvme_ctrl *ctrl, struct nvme_ns *ns, return effects; } -static void nvme_passthru_end(struct nvme_ctrl *ctrl, u32 effects, - struct nvme_command *cmd, int status) +void nvme_passthru_end(struct nvme_ctrl *ctrl, u32 effects, + struct nvme_command *cmd, int status) { if (effects & NVME_CMD_EFFECTS_CSE_MASK) { nvme_unfreeze(ctrl); @@ -1126,21 +1126,16 @@ static void nvme_passthru_end(struct nvme_ctrl *ctrl, u32 effects, break; } } +EXPORT_SYMBOL_NS_GPL(nvme_passthru_end, NVME_TARGET_PASSTHRU); -int nvme_execute_passthru_rq(struct request *rq) +int nvme_execute_passthru_rq(struct request *rq, u32 *effects) { struct nvme_command *cmd = nvme_req(rq)->cmd; struct nvme_ctrl *ctrl = nvme_req(rq)->ctrl; struct nvme_ns *ns = rq->q->queuedata; - u32 effects; - int ret; - effects = nvme_passthru_start(ctrl, ns, cmd->common.opcode); - ret = nvme_execute_rq(rq, false); - if (effects) /* nothing to be done for zero cmd effects */ - nvme_passthru_end(ctrl, effects, cmd, ret); - - return ret; + *effects = nvme_passthru_start(ctrl, ns, cmd->common.opcode); + return nvme_execute_rq(rq, false); } EXPORT_SYMBOL_NS_GPL(nvme_execute_passthru_rq, NVME_TARGET_PASSTHRU); diff --git a/drivers/nvme/host/ioctl.c b/drivers/nvme/host/ioctl.c index a2e89db1cd63..15a60e1f290a 100644 --- a/drivers/nvme/host/ioctl.c +++ b/drivers/nvme/host/ioctl.c @@ -136,9 +136,11 @@ static int nvme_submit_user_cmd(struct request_queue *q, unsigned bufflen, void __user *meta_buffer, unsigned meta_len, u32 meta_seed, u64 *result, unsigned timeout, bool vec) { + struct nvme_ctrl *ctrl; struct request *req; void *meta = NULL; struct bio *bio; + u32 effects; int ret; req = nvme_alloc_user_request(q, cmd, ubuffer, bufflen, meta_buffer, @@ -147,8 +149,9 @@ static int nvme_submit_user_cmd(struct request_queue *q, return PTR_ERR(req); bio = req->bio; + ctrl = nvme_req(req)->ctrl; - ret = nvme_execute_passthru_rq(req); + ret = nvme_execute_passthru_rq(req, &effects); if (result) *result = le64_to_cpu(nvme_req(req)->result.u64); @@ -158,6 +161,10 @@ static int nvme_submit_user_cmd(struct request_queue *q, if (bio) blk_rq_unmap_user(bio); blk_mq_free_request(req); + + if (effects) + nvme_passthru_end(ctrl, effects, cmd, ret); + return ret; } diff --git a/drivers/nvme/host/nvme.h b/drivers/nvme/host/nvme.h index 5558f8812157..e154e2304203 100644 --- a/drivers/nvme/host/nvme.h +++ b/drivers/nvme/host/nvme.h @@ -994,7 +994,9 @@ static inline bool nvme_ctrl_sgl_supported(struct nvme_ctrl *ctrl) u32 nvme_command_effects(struct nvme_ctrl *ctrl, struct nvme_ns *ns, u8 opcode); -int nvme_execute_passthru_rq(struct request *rq); +int nvme_execute_passthru_rq(struct request *rq, u32 *effects); +void nvme_passthru_end(struct nvme_ctrl *ctrl, u32 effects, + struct nvme_command *cmd, int status); struct nvme_ctrl *nvme_ctrl_from_file(struct file *file); struct nvme_ns *nvme_find_get_ns(struct nvme_ctrl *ctrl, unsigned nsid); void nvme_put_ns(struct nvme_ns *ns); diff --git a/drivers/nvme/target/passthru.c b/drivers/nvme/target/passthru.c index 6f39a29828b1..94d3153bae54 100644 --- a/drivers/nvme/target/passthru.c +++ b/drivers/nvme/target/passthru.c @@ -215,9 +215,11 @@ static void nvmet_passthru_execute_cmd_work(struct work_struct *w) { struct nvmet_req *req = container_of(w, struct nvmet_req, p.work); struct request *rq = req->p.rq; + struct nvme_ctrl *ctrl = nvme_req(rq)->ctrl; + u32 effects; int status; - status = nvme_execute_passthru_rq(rq); + status = nvme_execute_passthru_rq(rq, &effects); if (status == NVME_SC_SUCCESS && req->cmd->common.opcode == nvme_admin_identify) { @@ -238,6 +240,9 @@ static void nvmet_passthru_execute_cmd_work(struct work_struct *w) req->cqe->result = nvme_req(rq)->result; nvmet_req_complete(req, status); blk_mq_free_request(rq); + + if (effects) + nvme_passthru_end(ctrl, effects, req->cmd, status); } static void nvmet_passthru_req_done(struct request *rq, From patchwork Sat Oct 22 07: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: 7859 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1161106wrr; Sat, 22 Oct 2022 04:29:38 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7f/4svG43rPC7cBWt41hH/H8S+9zTt6aKar1LqVg6o4cw5X8ulu9g+sO+ey44dzPuw5/ul X-Received: by 2002:a05:6a00:2305:b0:565:60b0:40d9 with SMTP id h5-20020a056a00230500b0056560b040d9mr23711851pfh.77.1666438178380; Sat, 22 Oct 2022 04:29:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666438178; cv=none; d=google.com; s=arc-20160816; b=lYv5OWvK60pGb5CRRAK7mPY8BYd2PP/4naSyA+xjLw+PCb2q43AU7dCF2H2+LaphiO ZQb8kL51wcuxoE6zLeg4j3xWOsgHLz94gpoJx6j/0D3Nje42uB2IHinVfVnHF5GV/ir6 /kt6+VDPB21jDuZdCQ4J4vpmZgjPzGugBy5hJ86wXWrEUUGMXcNkbkFHEzLGpyfJhmvR FRze4/hWq+rZtgS01dvE7k2qX2hR9E3LvfvO42kvQpuui3bz9ruXOpZ2fpQqM35X2uO5 2cg2oXMHB15knRa/xTGQ4yugjXK7CLQ+4ZBpX53eZkKZFONM/TeLwt4rby/XU+BE4D6C 88xA== 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=i2y/p7vxWmX9iOormToxEIsattVjo1I9VVd2Yv65t88=; b=t6wDvbOj6R0uC1vmet3x1/nQDRrWNukEvX7ufCJQwuc+9HypIZb02bexqjMWLnMrzS Hv5HwYiKkwJAAVmYRZ7BnQzrddR0HqbfF4OiXEzEX+BwKl55d+Ln0AnpGXD3/eivP+gP bsiuPTbnUHNziX/4o2X+67m06ft6Irwr3mVB7+uxWtBQeUxzMCpa0OUE1F7ypF5Ff2l8 9y8eOWvlOmj+ufkVyo7dhAF3TzuwwVRladzLGmXl5hrcX6CZf+YUTrLb7Gya+TnkRqrF YN/uIpJ7DpRHV5uIvhWfJ8nRssxTQYeXv5IUQJe3NVOuMVjCeqeI80fJ/VWmJt5eeuKC 2vtw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=wT4vddH4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 c4-20020a17090a8d0400b0020038eb8b5asi9056309pjo.21.2022.10.22.04.29.26; Sat, 22 Oct 2022 04:29: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=wT4vddH4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S230117AbiJVLT2 (ORCPT + 99 others); Sat, 22 Oct 2022 07:19:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53348 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230257AbiJVLTD (ORCPT ); Sat, 22 Oct 2022 07:19:03 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3D1695F231; Sat, 22 Oct 2022 03:46: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 4376FB82E45; Sat, 22 Oct 2022 08:07:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6A074C433D7; Sat, 22 Oct 2022 08:07:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666426053; bh=mfF7iVgzEiNCmdKqx1IbQXbWdrARJ0crLzZe8h5R+h0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wT4vddH4d0rJencWI6DWGxJReXc5bciO6T25XCibm5fNn3j1Z2ZmDeWcHnzEnNH1o wwW7kMcfymS7oxY0JQl275TiJGZaCmSNdK57EaAW+NFTGvHzoKMlxB7uDr4u+lL1rX IzHo6fzR9ofGUc4oaiOkVEIR1WWB1tG8RcI4WQ7E= 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 5.19 686/717] nvme: copy firmware_rev on each init Date: Sat, 22 Oct 2022 09:29:25 +0200 Message-Id: <20221022072528.833925702@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 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?1747387079670526091?= X-GMAIL-MSGID: =?utf-8?q?1747387079670526091?= 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 47fd9d528c83..698e65883d82 100644 --- a/drivers/nvme/host/core.c +++ b/drivers/nvme/host/core.c @@ -2796,7 +2796,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; @@ -3015,6 +3014,8 @@ static 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 Sat Oct 22 07: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: 7716 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1109614wrr; Sat, 22 Oct 2022 01:49:14 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5DR47s8Y86f9Z8WF6UyuZr/cz92zfxcykUZCE1elHdD3Ov6rNBtyC40TSFBfrPdrfAu48n X-Received: by 2002:a17:907:7d8e:b0:78d:ed30:643b with SMTP id oz14-20020a1709077d8e00b0078ded30643bmr18783591ejc.253.1666428553827; Sat, 22 Oct 2022 01:49:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666428553; cv=none; d=google.com; s=arc-20160816; b=wDnhTho+cDmIp3EPeirIdPCMNJ480km2WOXUQ25MMHPPwAiXFglI9Sqkz4GT3+L3xB xKSlUolOsN4Bp6iCdW2dAW7afWhpJ/WH8ijs9iNlLyPeLu7fuhE1I3qzlaZ7y+v5XV79 z4VNMNKxczCDQIWL0UrQdgtlic1QdZqI5StxqIBLv8n583EV0iqoHp/ZljPzlqLnep3K oN9NwpIsziohsE+/vlTtA7kHYMdJJivzt0yIwLi673OIgZRzOs9hzVczCicIPAMBGVQO Lxd4OSQ81BpuF20fACfPbwnyFp7J64qreNTcYkSgt2oYBVT6D/VZf0wRxCgJuHhT2Zx+ JTxg== 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=+2rjujWWhfgfG5tiQA0YDLR0d/ewQAf1OGHqtKrMnW4=; b=duQ/Ub4xhfgwaxBICN3qN1Zr5XIXW/XLeJaA0NU7oK6NMulqqozy3uPxq9jAqvKIB1 qTa7r2he+2xUWIqRTwuqCPirxD8VfnjIbKjQ1iH4sZsZ10nzjNfmKha6uNOJe+eJ4S8f M63IJkTbUiF3ReD7SelCcgjU9ee5sIi7kfRUTPdYfAR810/sM+mT8uWvD/Cuqlhl1wZe 35Us+fu482MWT9PzUiEBkAKkOpRkMUBR7rH/Ap+aP6THi6c6ZK0xTiEwdrtyK3krGcbS HVs2i5Ez6DpTOv4ebnNnTJj7wOEfldX2g1IqvzbyNfpIhfMuOMd/7gQDa5LuoBGaPmzb iJvg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="LY/XsOsE"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 t19-20020a056402525300b00458ebf5aee0si25723081edd.344.2022.10.22.01.48.50; Sat, 22 Oct 2022 01:49: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="LY/XsOsE"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S234811AbiJVIsS (ORCPT + 99 others); Sat, 22 Oct 2022 04:48:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44486 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235298AbiJVIpK (ORCPT ); Sat, 22 Oct 2022 04:45:10 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 252BE2ECF79; Sat, 22 Oct 2022 01:09: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 3083860B40; Sat, 22 Oct 2022 08:08:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1F092C433D6; Sat, 22 Oct 2022 08:08:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666426087; bh=dwDcdLbwsITSd0znTm2jm+ojffy7JRp4bA5tasq8cI4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LY/XsOsEx8etMhovH+bGMvR8liGgzvKaxkSeDCYBjDo8ha07p/fwwbxGHwFFoxMvr 0gTGj+31GbgoXqQJxc4OyvpPIP9FmFUMaYd8s8cuh1IlrytcR8Zw1itvIL2teKT216 blgfwCPEBhTnpvevS8yc+wONJ0F1IIEnKrQuNFKY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Varun Prakash , Sagi Grimberg , Christoph Hellwig , Sasha Levin Subject: [PATCH 5.19 687/717] nvmet-tcp: add bounds check on Transfer Tag Date: Sat, 22 Oct 2022 09:29:26 +0200 Message-Id: <20221022072528.879668076@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376987311038096?= X-GMAIL-MSGID: =?utf-8?q?1747376987311038096?= From: Varun Prakash [ Upstream commit b6a545ffa2c192b1e6da4a7924edac5ba9f4ea2b ] ttag is used as an index to get cmd in nvmet_tcp_handle_h2c_data_pdu(), add a bounds check to avoid out-of-bounds access. Signed-off-by: Varun Prakash Reviewed-by: Sagi Grimberg Signed-off-by: Christoph Hellwig Signed-off-by: Sasha Levin --- drivers/nvme/target/tcp.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/drivers/nvme/target/tcp.c b/drivers/nvme/target/tcp.c index a3694a32f6d5..7dcf88cde189 100644 --- a/drivers/nvme/target/tcp.c +++ b/drivers/nvme/target/tcp.c @@ -935,10 +935,17 @@ static int nvmet_tcp_handle_h2c_data_pdu(struct nvmet_tcp_queue *queue) struct nvme_tcp_data_pdu *data = &queue->pdu.data; struct nvmet_tcp_cmd *cmd; - if (likely(queue->nr_cmds)) + if (likely(queue->nr_cmds)) { + if (unlikely(data->ttag >= queue->nr_cmds)) { + pr_err("queue %d: received out of bound ttag %u, nr_cmds %u\n", + queue->idx, data->ttag, queue->nr_cmds); + nvmet_tcp_fatal_error(queue); + return -EPROTO; + } cmd = &queue->cmds[data->ttag]; - else + } else { cmd = &queue->connect; + } if (le32_to_cpu(data->data_offset) != cmd->rbytes_done) { pr_err("ttag %u unexpected data offset %u (expected %u)\n", From patchwork Sat Oct 22 07: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: 7718 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1109885wrr; Sat, 22 Oct 2022 01:50:25 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5ZgIKAwEI4dZ9RNjTePSGm7P9lenaENjcJ6738Lyxcz4YBc0D1y2bdne9AxSmXR1arhUBz X-Received: by 2002:a05:6402:5ca:b0:445:c80a:3c2 with SMTP id n10-20020a05640205ca00b00445c80a03c2mr21315159edx.247.1666428625544; Sat, 22 Oct 2022 01:50:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666428625; cv=none; d=google.com; s=arc-20160816; b=tuG8x0UC43TAsn9xOoyoDp8ufYQrpb0ix4IXc0A/EmbFic0txlR2rF8Jj7zRn866qx T4cC9aoGlMoepTRR28xMrLgrvTHmp6mCmvVHjywFdmTXoWM0oXX/Qrh2+XgyyGDbc+4X tk3fJ0t3MDPGgnej76/YIKlwgfG+M5d8F3mzE4CSQe/9xxJVC4ykpVyEyfCQ/c8151Xw anu5MUrOVofCRkhA15Jbsz9rDRxpqkQ7vAX5r2DSRGj8XXjl9f9K3rGOIzPrMa6n4FHr vBkscwC+u2/P7sV1eTUf8hAyR7B5PMTh5Xdf1klT6a+pm8QFurEF9HaXKN8ack9CJnmo bdXQ== 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=iEyLnsxdEbZpgMXxUMGXoRqchhpdzybvnC2uj9cSaYU=; b=CIdUKwmGhQJawLwiwNx/iZzek8s+/6z/OInEPWSVEG+vF65+Qfn/gz1QRUW0TS8tKi P/Z0EFC3482F67LrDybJP27KU6fY4RcwDD0g0Qlvwpx8bXm9Vuo82NngIvHWov07m8AS vby6fP+vyFJ09gW+rWbrAHS8tF75iL4Qb1rFJN+KAtXkwmndmkfNk9JzvQz+IeK0p4a+ uJ9zlcTaTpyVs26qADn+kPfn4r/NvBdlhC82LYZ/ld96iTnRxXuXzQg38Su7QsBEP6h6 TLHVAV1ep1ovun9F+eyTNPjyHpIOMyjERfHeHbL8lxy/pC3SpzkkedtpuPuvHiqVjY5q KZMg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=k5Ok7wZa; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 w10-20020a056402268a00b0045d25cf222csi23965805edd.362.2022.10.22.01.50.01; Sat, 22 Oct 2022 01:50: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=k5Ok7wZa; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S234200AbiJVIs3 (ORCPT + 99 others); Sat, 22 Oct 2022 04:48:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44002 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235374AbiJVIp0 (ORCPT ); Sat, 22 Oct 2022 04:45:26 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 28EB83471D; Sat, 22 Oct 2022 01:09: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 dfw.source.kernel.org (Postfix) with ESMTPS id 4F5A460AD9; Sat, 22 Oct 2022 08:08:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4BD5CC43141; Sat, 22 Oct 2022 08:08:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666426099; bh=2ZxUg/1wAsgJI7Aj9gDfm/S13ITpUsPEtiIhR3IIIoc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=k5Ok7wZantfD4RIXKjX+UI3KFuQcin5WnUzHFAyAloBbiG1i7w0V5FrlkoBdhY6ST xG1NK3S+ChwPgVqes5/crG265Zhigf+x4rJgMyFvconX7Qgb7FFFe/s6qtjpX9Ev7y j1vy2AYezYAxeQsw2oP7VFpRZX7a54f0OGQWk+FM= 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 5.19 688/717] usb: idmouse: fix an uninit-value in idmouse_open Date: Sat, 22 Oct 2022 09:29:27 +0200 Message-Id: <20221022072528.929522756@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747377062509074017?= X-GMAIL-MSGID: =?utf-8?q?1747377062509074017?= 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 e9437a176518..ea39243efee3 100644 --- a/drivers/usb/misc/idmouse.c +++ b/drivers/usb/misc/idmouse.c @@ -177,10 +177,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) @@ -192,6 +188,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 Sat Oct 22 07: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: 7720 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1109899wrr; Sat, 22 Oct 2022 01:50:28 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5576t9tlq9QzvndJr3/4FvbtrL0Ys8v4M8zfwo2mFp9lzLceoq1igEok1+OY7FeePv3I5H X-Received: by 2002:a17:907:2d0f:b0:78e:9ca5:62af with SMTP id gs15-20020a1709072d0f00b0078e9ca562afmr18846451ejc.334.1666428628467; Sat, 22 Oct 2022 01:50:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666428628; cv=none; d=google.com; s=arc-20160816; b=BwJT4ljeTs9KG07X5a0jJ1MFRZNNZQn3zAJy2i+OfejVlcrK42eHO+ughBemhSrgG6 upgrNlqmRnLr/Q8UVHAE9t7UswzWYV4Qk2z8ytItrAVeWeT/hRIPAIc6hBGW4KCHpmHs e4poC6l9VTod2YBbitHLY5NJEWVyUzVop15DrdFkDxEdHdO07AM2Letc8uGDxRXzXiMB YRnLyuGyi2dloPyeZc6V6sbN6wfR7GXNnYeJZhkN/K2v19+efneWn3ooeuiwyL91boXB 4f6seNVM4JiKiIWA7DlmL2B37mnm4rlm4w/UjixyDl2HXoWMMaQKZK8/VgLHu2N/ts+m rNIw== 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=7Ulbx8um7lvDbi8Ta7RT4vSg4brgP/pVSDqTwFOQ7/A=; b=aychC9Q6xA6cPCzfTP8FvWlCs9p9SJoLEpZHWVYiV8zYTqkRAM0BaE7lJwXMnzZ4Jv cCU++L970DRfxFDk070zMVGkOC2jRKejFMocq2cLgehmpMSWwFSc7WyM4v1nQQHd8t0f NJgNGJZXKxutXqXQ+2YMiW5AwROjkKDB3w84x3VXLK0wicI4OT39SU5mF1NasaHwZwiG GekQYRDkVMA2e9vdPAnq9D85Nb6RBGFTR9UO2Z0sXNH/gBaFyvmg6ttQb8/qwa/MyLYb VTtsnWsKbtx6GUMPNWMMRWnnta0rKmFFOrd2neUlbUOo1vqZYVI0BilCz8RlEXWav6to ZD3Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=HoqePaSx; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 dk27-20020a0564021d9b00b0046146c73211si3875533edb.314.2022.10.22.01.50.04; Sat, 22 Oct 2022 01:50: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=HoqePaSx; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S234680AbiJVIsk (ORCPT + 99 others); Sat, 22 Oct 2022 04:48:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41152 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234626AbiJVIpc (ORCPT ); Sat, 22 Oct 2022 04:45:32 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B16763B457; Sat, 22 Oct 2022 01:09: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 357D460B85; Sat, 22 Oct 2022 08:08:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3BD52C433D7; Sat, 22 Oct 2022 08:08:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666426102; bh=kFJ+68vFEX0M25SGmCiYdFlHCyOt1Ygv0k446d8yBno=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HoqePaSxcfa8AMSSvjWDTG103ft27CRjTrMv6y+PxbxdDPa006dF9gNlSam3mNe5N TDXkIAlL3F3Pk7Dvq7tU32HUMLmlQYIM7+ueSGs8ga+aOA6qDKam2X5oF99dM6gHPb ILdhTS36mHWJ2QxWprcORLH7XgcVXbXlXxtTicSc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Keith Busch , Ming Lei , Christoph Hellwig , Jens Axboe , Sasha Levin Subject: [PATCH 5.19 689/717] blk-mq: use quiesced elevator switch when reinitializing queues Date: Sat, 22 Oct 2022 09:29:28 +0200 Message-Id: <20221022072528.980696498@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747377065437494408?= X-GMAIL-MSGID: =?utf-8?q?1747377065437494408?= From: Keith Busch [ Upstream commit 8237c01f1696bc53c470493bf1fe092a107648a6 ] The hctx's run_work may be racing with the elevator switch when reinitializing hardware queues. The queue is merely frozen in this context, but that only prevents requests from allocating and doesn't stop the hctx work from running. The work may get an elevator pointer that's being torn down, and can result in use-after-free errors and kernel panics (example below). Use the quiesced elevator switch instead, and make the previous one static since it is now only used locally. nvme nvme0: resetting controller nvme nvme0: 32/0/0 default/read/poll queues BUG: kernel NULL pointer dereference, address: 0000000000000008 #PF: supervisor read access in kernel mode #PF: error_code(0x0000) - not-present page PGD 80000020c8861067 P4D 80000020c8861067 PUD 250f8c8067 PMD 0 Oops: 0000 [#1] SMP PTI Workqueue: kblockd blk_mq_run_work_fn RIP: 0010:kyber_has_work+0x29/0x70 ... Call Trace: __blk_mq_do_dispatch_sched+0x83/0x2b0 __blk_mq_sched_dispatch_requests+0x12e/0x170 blk_mq_sched_dispatch_requests+0x30/0x60 __blk_mq_run_hw_queue+0x2b/0x50 process_one_work+0x1ef/0x380 worker_thread+0x2d/0x3e0 Signed-off-by: Keith Busch Reviewed-by: Ming Lei Reviewed-by: Christoph Hellwig Link: https://lore.kernel.org/r/20220927155652.3260724-1-kbusch@fb.com Signed-off-by: Jens Axboe Signed-off-by: Sasha Levin --- block/blk-mq.c | 6 +++--- block/blk.h | 3 +-- block/elevator.c | 4 ++-- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/block/blk-mq.c b/block/blk-mq.c index 69d0a58f9e2f..302b8d92deef 100644 --- a/block/blk-mq.c +++ b/block/blk-mq.c @@ -4481,14 +4481,14 @@ static bool blk_mq_elv_switch_none(struct list_head *head, list_add(&qe->node, head); /* - * After elevator_switch_mq, the previous elevator_queue will be + * After elevator_switch, the previous elevator_queue will be * released by elevator_release. The reference of the io scheduler * module get by elevator_get will also be put. So we need to get * a reference of the io scheduler module here to prevent it to be * removed. */ __module_get(qe->type->elevator_owner); - elevator_switch_mq(q, NULL); + elevator_switch(q, NULL); mutex_unlock(&q->sysfs_lock); return true; @@ -4520,7 +4520,7 @@ static void blk_mq_elv_switch_back(struct list_head *head, kfree(qe); mutex_lock(&q->sysfs_lock); - elevator_switch_mq(q, t); + elevator_switch(q, t); mutex_unlock(&q->sysfs_lock); } diff --git a/block/blk.h b/block/blk.h index 0d6668663ab5..af2aaea23966 100644 --- a/block/blk.h +++ b/block/blk.h @@ -260,8 +260,7 @@ bool blk_bio_list_merge(struct request_queue *q, struct list_head *list, void blk_insert_flush(struct request *rq); -int elevator_switch_mq(struct request_queue *q, - struct elevator_type *new_e); +int elevator_switch(struct request_queue *q, struct elevator_type *new_e); void elevator_exit(struct request_queue *q); int elv_register_queue(struct request_queue *q, bool uevent); void elv_unregister_queue(struct request_queue *q); diff --git a/block/elevator.c b/block/elevator.c index c319765892bb..bd71f0fc4e4b 100644 --- a/block/elevator.c +++ b/block/elevator.c @@ -588,7 +588,7 @@ void elv_unregister(struct elevator_type *e) } EXPORT_SYMBOL_GPL(elv_unregister); -int elevator_switch_mq(struct request_queue *q, +static int elevator_switch_mq(struct request_queue *q, struct elevator_type *new_e) { int ret; @@ -723,7 +723,7 @@ void elevator_init_mq(struct request_queue *q) * need for the new one. this way we have a chance of going back to the old * one, if the new one fails init for some reason. */ -static int elevator_switch(struct request_queue *q, struct elevator_type *new_e) +int elevator_switch(struct request_queue *q, struct elevator_type *new_e) { int err; From patchwork Sat Oct 22 07: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: 7723 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1109921wrr; Sat, 22 Oct 2022 01:50:36 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7C0J3kzGcOxOwUFF0q+qOvAQLN75eJFcfcgLU95BhyjVvzDsd4MWVpVI9cxhkeH5Z9tjxR X-Received: by 2002:a05:6402:528a:b0:454:8613:6560 with SMTP id en10-20020a056402528a00b0045486136560mr22177773edb.252.1666428636272; Sat, 22 Oct 2022 01:50:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666428636; cv=none; d=google.com; s=arc-20160816; b=lIthKM/j4n/d59LFkPx/2YMf31jckdm+t2ISBbVyPI7Z/a7rLDuHXnHKdgoi4TURIl TsfyUSBHaqHHYjwYevyjnY/Rd8CvSPVFllga6fBos1PCsBmt070g/HcXgj26XxzTRbow fciKLZD/gvfwcQstIdPx4cpN7kd9jZlea9Ha6HM75LEgHi7hpGau/RJv678Ve5DFXspu FtFdRWdAXq1Kmw6FZ+hrrutvbvLZDMQLytmuWG9LvOfHYL4gkWNVycJnlitVNOItF3Fv 923GnB1IZGXL0JkJuwD7FQ7iar53cP2vCZLXw8nRx5LVWVpSWdaKxBnI9L4C4qTBE8nx EjhA== 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=bdGvK854tInQzKtgucNCQHvT3Q/SDwUJ44B/aMoVN2s=; b=ScwjpNPgRxs330VLtf8zyJnkl8V76sp7z3ChfqLrXF3v2hiQYQgqZZWaoiKvu5sRMk XL7OfeDb20b3k06J9hsw6wriCZs+/Aj+tffNnv5nhOCDKBUyMuie5pL4ZMW49Dku0W8S BUpxYITdXLU26U6iTcCbO0tJeFbAbHKNfXYxUobIrdF8xPImwAvkL4qPzyIj2om19CTB K02hEOWEYj/YW76emDAzZtjjPRT7C88eS7GeXU00v5G8k0YYq7da3SeQhyuS0+XH1xoo XQ/B1PcvphkUEn3XPUrWdmSMSDfPPN7aCCoiNkKZIX03S3y1orUGzmY8uizZk6ddjc50 zggA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=AhQrvyxo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 h1-20020a056402280100b0045cb68ca4ecsi28295856ede.37.2022.10.22.01.50.12; Sat, 22 Oct 2022 01:50: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=AhQrvyxo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S234780AbiJVIs5 (ORCPT + 99 others); Sat, 22 Oct 2022 04:48:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45628 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231969AbiJVIq3 (ORCPT ); Sat, 22 Oct 2022 04:46:29 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 18C8727170; Sat, 22 Oct 2022 01:09: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 2768F60B93; Sat, 22 Oct 2022 08:08:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 26150C433B5; Sat, 22 Oct 2022 08:08:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666426105; bh=Nu/8SgC7SIH9saHjokos5h2G6lpvcu/bw7NjIhvY4m0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AhQrvyxojQDS7FN/qnjz54KrR8jKltFgtU7rbxO4wz8MV54OYy/tSqufuZ01VFDwS S8qNnin7VCGd0LCZ7tiY4y52Gqar7nt46r1DOkE2nLopYi0e8siNgcM5RXJZRtXZIB OvYS+heLhRW9vEAxkUjx6NhWE0Wwnzm0n3CSUE3w= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Eddie James , Guenter Roeck , Joel Stanley , Sasha Levin Subject: [PATCH 5.19 690/717] hwmon (occ): Retry for checksum failure Date: Sat, 22 Oct 2022 09:29:29 +0200 Message-Id: <20221022072529.012389948@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747377073897564573?= X-GMAIL-MSGID: =?utf-8?q?1747377073897564573?= From: Eddie James [ Upstream commit dbed963ed62c4c2b8870a02c8b7dcb0c2af3ee0b ] Due to the OCC communication design with a shared SRAM area, checkum errors are expected due to corrupted buffer from OCC communications with other system components. Therefore, retry the command twice in the event of a checksum failure. Signed-off-by: Eddie James Acked-by: Guenter Roeck Link: https://lore.kernel.org/r/20220426154956.27205-3-eajames@linux.ibm.com Signed-off-by: Joel Stanley Signed-off-by: Sasha Levin --- drivers/hwmon/occ/p9_sbe.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/drivers/hwmon/occ/p9_sbe.c b/drivers/hwmon/occ/p9_sbe.c index a91937e28e12..775147f31cb1 100644 --- a/drivers/hwmon/occ/p9_sbe.c +++ b/drivers/hwmon/occ/p9_sbe.c @@ -14,6 +14,8 @@ #include "common.h" +#define OCC_CHECKSUM_RETRIES 3 + struct p9_sbe_occ { struct occ occ; bool sbe_error; @@ -81,18 +83,23 @@ static bool p9_sbe_occ_save_ffdc(struct p9_sbe_occ *ctx, const void *resp, static int p9_sbe_occ_send_cmd(struct occ *occ, u8 *cmd, size_t len, void *resp, size_t resp_len) { + size_t original_resp_len = resp_len; struct p9_sbe_occ *ctx = to_p9_sbe_occ(occ); - int rc; + int rc, i; - rc = fsi_occ_submit(ctx->sbe, cmd, len, resp, &resp_len); - if (rc < 0) { + for (i = 0; i < OCC_CHECKSUM_RETRIES; ++i) { + rc = fsi_occ_submit(ctx->sbe, cmd, len, resp, &resp_len); + if (rc >= 0) + break; if (resp_len) { if (p9_sbe_occ_save_ffdc(ctx, resp, resp_len)) sysfs_notify(&occ->bus_dev->kobj, NULL, bin_attr_ffdc.attr.name); + return rc; } - - return rc; + if (rc != -EBADE) + return rc; + resp_len = original_resp_len; } switch (((struct occ_response *)resp)->return_status) { From patchwork Sat Oct 22 07: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: 7740 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1110626wrr; Sat, 22 Oct 2022 01:53:31 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7+NN3a4RoZbjUn/X8dug7KA0sEaa5WY+AsacJgYnURV44Zw9To+WGh7LegWmD6HRqqDIcN X-Received: by 2002:a17:907:78a:b0:782:2223:a7cd with SMTP id xd10-20020a170907078a00b007822223a7cdmr18727371ejb.532.1666428811374; Sat, 22 Oct 2022 01:53:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666428811; cv=none; d=google.com; s=arc-20160816; b=PFrJPzJj0QwZTK+TMRSEdcm4JfRDZQL41SoVxUgE4by28wu6u0bMPCVb7xxmM6ySRC uF+2u8qiNRPjSOD3wwLgGfy2GP2N3dPuqRo3VhwMWLTa0bsvqUqYpHtMMTwUc2po9hyy I3/M5fbwea58fF2C69Y/KawNF0bDfkOFlnG5maBSAed2TozbzWCRNav60GFGB4f+aQ42 jCKBsY0lIYArkRgnfW6S8T+PeM1RAULDJF4p1BpFk5FxLILJfJNNtTUT54NiPniXbnQz ldLrvBmptiW5DfKyJOhZ1A3RzccXVpcKpGvgPghhjNRTTPknKGkz+Zi2MxNMRrix6tgq 2dpw== 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=gnoTKFganq8WlELK/iSYCLvh52KKTxuFVMqPOk/R5Tk=; b=c4mEhXpToQjoJStks3qDIwjEePgwEZoXBmDMn3Z58mHTU2dBTLLXMfp8FMi2v/Oi52 TYYII0zh5RSo1sjejpYcWUWNgj9vUckmKlUOw3u0KYWYZo37Rkeh9rFL+BiyFEptlG/J 1M9ZaEIuzg21wZTYaJavf8CD+IZBwtJgOMbNWbepLGRjkLUIN9s6daWVTw6QE0Fll11S nN2bxCpBKbadShIwD3YFCrC/OKCvhbsycNfBEzX1MVMIamu7zeGOsmze7cs8/cU1wH+Q CyZ2gOpqHLHj26vZz3dju8sYy0dBke0C8DNWvm6I68ONZ1chZ23PyT2aXds6fLrOVxLG uIIQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=OEbL3ChD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 du17-20020a17090772d100b00783ca4d1c74si23404031ejc.520.2022.10.22.01.53.07; Sat, 22 Oct 2022 01:53: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=OEbL3ChD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S234822AbiJVIv5 (ORCPT + 99 others); Sat, 22 Oct 2022 04:51:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40844 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234799AbiJVIuO (ORCPT ); Sat, 22 Oct 2022 04:50:14 -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 A1F492F0462; Sat, 22 Oct 2022 01:11: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 C56DBB82DF3; Sat, 22 Oct 2022 08:08:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2E097C433C1; Sat, 22 Oct 2022 08:08:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666426108; bh=GmRUeDbFgkpqIs8eExCjyoabv5cVnd0mR8YC0z3X1xw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OEbL3ChDVIk2ORUYSXCONJ1f3m0jspVsSZR4doKOulDUd5Uc6MMRF/fSrFm2gEAFV bet7N0FgEjHlEYX96luEcySj0sx4/1U9yI3y16XwgYimGF/TP44bDfrBqj0hSCwBxB rWOKeDJwoT/ICmHm5ZVTVMO+OgxCWNo16j72hLBI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Eddie James , Guenter Roeck , Joel Stanley , Sasha Levin Subject: [PATCH 5.19 691/717] fsi: occ: Prevent use after free Date: Sat, 22 Oct 2022 09:29:30 +0200 Message-Id: <20221022072529.046151502@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747377257239067162?= X-GMAIL-MSGID: =?utf-8?q?1747377257239067162?= From: Eddie James [ Upstream commit d3e1e24604031b0d83b6c2d38f54eeea265cfcc0 ] Use get_device and put_device in the open and close functions to make sure the device doesn't get freed while a file descriptor is open. Also, lock around the freeing of the device buffer and check the buffer before using it in the submit function. Signed-off-by: Eddie James Reviewed-by: Guenter Roeck Link: https://lore.kernel.org/r/20220513194424.53468-1-eajames@linux.ibm.com Signed-off-by: Joel Stanley Signed-off-by: Sasha Levin --- drivers/fsi/fsi-occ.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/drivers/fsi/fsi-occ.c b/drivers/fsi/fsi-occ.c index c9cc75fbdfb9..28c176d038a2 100644 --- a/drivers/fsi/fsi-occ.c +++ b/drivers/fsi/fsi-occ.c @@ -94,6 +94,7 @@ static int occ_open(struct inode *inode, struct file *file) client->occ = occ; mutex_init(&client->lock); file->private_data = client; + get_device(occ->dev); /* We allocate a 1-page buffer, make sure it all fits */ BUILD_BUG_ON((OCC_CMD_DATA_BYTES + 3) > PAGE_SIZE); @@ -197,6 +198,7 @@ static int occ_release(struct inode *inode, struct file *file) { struct occ_client *client = file->private_data; + put_device(client->occ->dev); free_page((unsigned long)client->buffer); kfree(client); @@ -493,12 +495,19 @@ int fsi_occ_submit(struct device *dev, const void *request, size_t req_len, for (i = 1; i < req_len - 2; ++i) checksum += byte_request[i]; - mutex_lock(&occ->occ_lock); + rc = mutex_lock_interruptible(&occ->occ_lock); + if (rc) + return rc; occ->client_buffer = response; occ->client_buffer_size = user_resp_len; occ->client_response_size = 0; + if (!occ->buffer) { + rc = -ENOENT; + goto done; + } + /* * Get a sequence number and update the counter. Avoid a sequence * number of 0 which would pass the response check below even if the @@ -671,10 +680,13 @@ static int occ_remove(struct platform_device *pdev) { struct occ *occ = platform_get_drvdata(pdev); - kvfree(occ->buffer); - misc_deregister(&occ->mdev); + mutex_lock(&occ->occ_lock); + kvfree(occ->buffer); + occ->buffer = NULL; + mutex_unlock(&occ->occ_lock); + device_for_each_child(&pdev->dev, NULL, occ_unregister_child); ida_simple_remove(&occ_ida, occ->idx); From patchwork Sat Oct 22 07: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: 7863 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1162207wrr; Sat, 22 Oct 2022 04:31:59 -0700 (PDT) X-Google-Smtp-Source: AMsMyM60VYUU/fLOEFfewoSFgTOj4OfcCqX8EOSxdQ9mo1SZGCV8a+Y1xk3eNBrhnplaEcnLXeTg X-Received: by 2002:a63:1718:0:b0:447:9ff3:66c0 with SMTP id x24-20020a631718000000b004479ff366c0mr19815695pgl.521.1666438319656; Sat, 22 Oct 2022 04:31:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666438319; cv=none; d=google.com; s=arc-20160816; b=UB5hlMPSGTyzfHgEFZsj2JFmukOaeDQgRtg5E+683t2ahny8/Kl8o96fxvahBKyPQn 29siu0Z5dWLkQmWF1yqWR/T+IqILY620VHlYAXga1lozzTPMmehA1QZVRbE5QopbB36j D499Xg+HO54F1GR2RDuV35uoZc+cbLVoHQ++nMYLnhbgBTJvNSiql1GkAOywZiyFqlH+ m2tqeDb/ORIhmk2NKQuTkk8+VlbS6uUtxOUEA5u1E4b1CcvrpbkG33QAFkpsj6HM+m7+ VBf2eyvCJU2vr0105o42qwWM5MjRuJnNmESiG7yrIjFqkdyiq1nAyAy/bOWNRDIeHa3r FgiQ== 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=ZqkUbhqpgmEBwlazX4EETBQZQDAJn/bCIlmvwCWqRG0=; b=EAjwU/CktcQj3pQq+2cTnMxtXsThHnf6RjXqNLBFkSqjeltm6PAW3dMUw+Wi4zwEsx YR/hhl+YhryC7r+izDDJshE9en8/fyS+8Bpuowgk4VchEQlOyn+bU9qJEftDXQlbdpSK j4ASFmHc6Vpe94fjHjNlEr9S0gBWMnuiuJxTdXerYqdaS4jcZPQHObkf5DV9+kGhZ2Wh j2mNWHzimwY8o+nL53d/Q7Ft409TmQ8GnaF9C241LjgUhDcWa7f7SlkvFiXmcXge5I65 pXYDtP1bQramFobqxaMkLLOkJsxR1cwpAGniSErwtkIFDnBze7aJ2A02APzRZS9EUT/X cKkg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=uZG1HHC2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 t63-20020a638142000000b0041183daa0ffsi265132pgd.761.2022.10.22.04.31.46; Sat, 22 Oct 2022 04:31: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=uZG1HHC2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231169AbiJVLTk (ORCPT + 99 others); Sat, 22 Oct 2022 07:19:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50586 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230376AbiJVLTH (ORCPT ); Sat, 22 Oct 2022 07:19:07 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E671A3AF; Sat, 22 Oct 2022 03:46: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 3A953B82E4B; Sat, 22 Oct 2022 08:08:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7989DC433C1; Sat, 22 Oct 2022 08:08:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666426111; bh=Wn3oSxO3heTPfc3NTmNAvwL+9w/ee0D9B9DE8PlDHrk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uZG1HHC21HZU5iycpKlW2ew2fs69cjmNRnhfqjl4ak3PM5gryrAsCvagC5mAjk0R8 JMNjVN9LhKMPfeyGfz3/qINojdkQ2uoEEYhq+U20FWHQMGXJ5H9+2GklovRaMFCzFP 5GWwuz6enNrXrokc/r+ARco6OmNZi+1SPCGp0WKg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zeal Robot , Lv Ruyi , Joel Stanley , Sasha Levin Subject: [PATCH 5.19 692/717] fsi: master-ast-cf: Fix missing of_node_put in fsi_master_acf_probe Date: Sat, 22 Oct 2022 09:29:31 +0200 Message-Id: <20221022072529.086457688@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 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?1747387227479248896?= X-GMAIL-MSGID: =?utf-8?q?1747387227479248896?= From: Lv Ruyi [ Upstream commit 182d98e00e4745fe253cb0c24c63bbac253464a2 ] of_parse_phandle returns node pointer with refcount incremented, use of_node_put() on it when done. Reported-by: Zeal Robot Signed-off-by: Lv Ruyi Link: https://lore.kernel.org/r/20220407085911.2491719-1-lv.ruyi@zte.com.cn Signed-off-by: Joel Stanley Signed-off-by: Sasha Levin --- drivers/fsi/fsi-master-ast-cf.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/fsi/fsi-master-ast-cf.c b/drivers/fsi/fsi-master-ast-cf.c index 24292acdbaf8..5f608ef8b53c 100644 --- a/drivers/fsi/fsi-master-ast-cf.c +++ b/drivers/fsi/fsi-master-ast-cf.c @@ -1324,12 +1324,14 @@ static int fsi_master_acf_probe(struct platform_device *pdev) } master->cvic = devm_of_iomap(&pdev->dev, np, 0, NULL); if (IS_ERR(master->cvic)) { + of_node_put(np); rc = PTR_ERR(master->cvic); dev_err(&pdev->dev, "Error %d mapping CVIC\n", rc); goto err_free; } rc = of_property_read_u32(np, "copro-sw-interrupts", &master->cvic_sw_irq); + of_node_put(np); if (rc) { dev_err(&pdev->dev, "Can't find coprocessor SW interrupt\n"); goto err_free; From patchwork Sat Oct 22 07: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: 7786 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1122189wrr; Sat, 22 Oct 2022 02:30:29 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7QL85IDYNljCzOlNMf2rbBoy4VX7QBKW5dHi8XToD2mAOEZlc9IXJLYIWhmqbcaIApFimF X-Received: by 2002:a63:e74d:0:b0:46e:acf4:7590 with SMTP id j13-20020a63e74d000000b0046eacf47590mr8809295pgk.465.1666431028891; Sat, 22 Oct 2022 02:30:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666431028; cv=none; d=google.com; s=arc-20160816; b=ay4AbVsOhxFRr9TqyuwHCI+iivpTH4f9H87RJpHmxwfohA1R34m2zvSH+DBTMATRKW warbXIOidmVbQFzUVj4IirwmtF3ufBo+ZUrlqMf7U46DjWgzgvAbHAGNl5FFN+otkmD/ RD3Z5veqOLJUrMQ7VGj7pvH6rOn/w2xG4wkGAzHyFiAlzajudgiN1gjqSo4XUzNfvy36 Ck4MmPHnbCVI9E2zX1vVVF4x7jwoSl/TtbtzXprqONzz7BzcB7Qm3o32PijCc42S9kAg HQ2okWDLIip/qpWlYKjDf0PajtmPCDmw9+dgdNI9Bx33/WTx3NkwKVFf9nIleUkcATDt L/Qw== 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=kPlUaQ+iKtENq0IJ54RWWYW1ELX4S1Vhd46BLkycqF8=; b=hNrnZ07HK5iD9zoxOT+0jyRytP084mxOPCX+wVuQ6qwxhup65hgLqbpLfhsA8Jv+p4 J30jGyy7tCGhW+hPxd8bFNR73SkHd3LmKI1smKhjXQW08ofDN0CQ7/fFEVapP/17nR6r SAiBE2MSPD01udMHQgKp+utVVZZFQ90fxbsrfP04jemTEGdXfFiVb8Mw5tNB5J1+VnL6 M2YhEUFfULOkL3An1vb5rXcWq2UTpXRQkFw3OC7/N7Cc21wuPCd2BljJjYMjckFTmzvw nnCagqPC9mWe+y/ZzxA6O94c8Y+xaTxCYn+D/1Vy+S3Ftj7Di/+o2/+vc69Rax+GfDu5 mpsw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="K2/TNFwK"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 c13-20020a63d14d000000b00439e032756fsi25022639pgj.65.2022.10.22.02.30.15; Sat, 22 Oct 2022 02:30: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="K2/TNFwK"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S230414AbiJVJKM (ORCPT + 99 others); Sat, 22 Oct 2022 05:10:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44570 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235261AbiJVJJh (ORCPT ); Sat, 22 Oct 2022 05:09:37 -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 13C252DF452; Sat, 22 Oct 2022 01:23: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 ams.source.kernel.org (Postfix) with ESMTPS id 79318B82E1F; Sat, 22 Oct 2022 08:08:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8C1BDC433C1; Sat, 22 Oct 2022 08:08:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666426115; bh=pZTA8+b6t89yvqWaduEatUoC/Fpvy1u8fwa7q8EqwVU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=K2/TNFwK2ZLPmMAKOnxBaBwnsvxw0rwLWbEKuEI90QuA2zE7bQ+gARZasAVyefA4F i3SYCF0x7Y5UfwRspEqsUVcRIcpcqn6h71RMnBbR6o5CsyfVq3R31bKhbK+6iQANFQ I1BxsAuw76NVWPbFBtTujiQpZgSEdt3OMmIpURlI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Wayne Chang , Heikki Krogerus , Sasha Levin Subject: [PATCH 5.19 693/717] usb: typec: ucsi: Dont warn on probe deferral Date: Sat, 22 Oct 2022 09:29:32 +0200 Message-Id: <20221022072529.126182612@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747379582444000483?= X-GMAIL-MSGID: =?utf-8?q?1747379582444000483?= From: Wayne Chang [ Upstream commit fce703a991b7e8c7e1371de95b9abaa832ecf9c3 ] Deferred probe is an expected return value for fwnode_usb_role_switch_get(). Given that the driver deals with it properly, there's no need to output a warning that may potentially confuse users. --- V2 -> V3: remove the Fixes and Cc V1 -> V2: adjust the coding style for better reading format. drivers/usb/typec/ucsi/ucsi.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) Signed-off-by: Wayne Chang Acked-by: Heikki Krogerus Link: https://lore.kernel.org/r/20220927134512.2651067-1-waynec@nvidia.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/usb/typec/ucsi/ucsi.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/usb/typec/ucsi/ucsi.c b/drivers/usb/typec/ucsi/ucsi.c index 6364f0d467ea..74fb5a4c6f21 100644 --- a/drivers/usb/typec/ucsi/ucsi.c +++ b/drivers/usb/typec/ucsi/ucsi.c @@ -1067,11 +1067,9 @@ static int ucsi_register_port(struct ucsi *ucsi, int index) cap->fwnode = ucsi_find_fwnode(con); con->usb_role_sw = fwnode_usb_role_switch_get(cap->fwnode); - if (IS_ERR(con->usb_role_sw)) { - dev_err(ucsi->dev, "con%d: failed to get usb role switch\n", - con->num); - return PTR_ERR(con->usb_role_sw); - } + if (IS_ERR(con->usb_role_sw)) + return dev_err_probe(ucsi->dev, PTR_ERR(con->usb_role_sw), + "con%d: failed to get usb role switch\n", con->num); /* Delay other interactions with the con until registration is complete */ mutex_lock(&con->lock); From patchwork Sat Oct 22 07:29:33 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 7686 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1108980wrr; Sat, 22 Oct 2022 01:46:47 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5gukw0u/5wAlJujoZvIch595nj4UuJxVBsqaL+hXEifeBbtMWMsAtMe1KLTJ6NnELNJnpi X-Received: by 2002:a05:6402:4511:b0:45c:b2b4:3e69 with SMTP id ez17-20020a056402451100b0045cb2b43e69mr20964575edb.339.1666428407830; Sat, 22 Oct 2022 01:46:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666428407; cv=none; d=google.com; s=arc-20160816; b=QklEzkvVgoDE0YNITuGVxdJpn0UWFrU8cBu8iw0wla/PX7JgwgSx0ktC0FIdIktfWi sVZssPdvPkOMGG2oU5dHMuuz0ObNoEwSKEL1+Ah0QbWJMPpo3U8tP8+0LwOmeXzGIEyt wZPg+pSv5OEy0dD7oGKfeFfO4Z2Vf1uERcdv7uuF5Byd5uDRcD/YAHp0WlPkSQReYebN u3azxBBsdrzarmdUM02iaLOuwmWyQnTSf5zxmGhe2DSQJ+m/Y4BGq6IwX85IG60UPRI3 gMWXOoW8UoZIYiMh8320TVO9L3qxbvjkyDFEcHRBcVNV64vCXdkVvXExeSCv481HciK7 /Bzg== 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=0wcJm6XXZSevavksoVHxdJAx5jep7QxZceFxdce7NXU=; b=patZGySTZU/q4A1WFPmTonk/W0wAVn0UcJyTYOMQNbxxEJ+vfOHo3eTFzxAK+KiG/S nTlE4RvS/ez22YLVhjRBTwWADRLb/oVedFPGGNhuhb5JSgU+eUUCaNAnS3B3mHyt4lW3 Kvx4boSkD/FejHi3WPy4aqImgFXI6dc0n9Ob5fteedyV0AbodK6oP6Y98gsPmgY8OQop mHI40JA/lZquGaWTpmM+hByszpyNc+k1DR8HHFvelNjPIcpGKkT3NoPnH52FQwz+jOWB B0yS+132XaaWtLbi6bRCybSHQpc3nnrMtTA/DgIxk06ysHkiMiLryZ8R1uVi/Ae5fjHC 2LQA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=U51R6I+7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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-20020a1709064b5300b0078d42f9d0cfsi17818786ejv.420.2022.10.22.01.46.22; Sat, 22 Oct 2022 01:46: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=U51R6I+7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231953AbiJVIp7 (ORCPT + 99 others); Sat, 22 Oct 2022 04:45:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52314 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234407AbiJVInw (ORCPT ); Sat, 22 Oct 2022 04:43:52 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4D1E72EA2B5; Sat, 22 Oct 2022 01:07: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 D7BDD60B40; Sat, 22 Oct 2022 08:07:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DC585C433D6; Sat, 22 Oct 2022 08:07:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666426024; bh=p6KS32qoHgkKgq4ULfN98+75gteCRbGAoMN6fl5aXBA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=U51R6I+772jBfQorpJtmK8pTzEqiWJFvfg9He6hciqwxdyLBVPjvnlM+BUPf4YBJs VBjpvI/Fkm9lP7GRT81fpdf3V8b90NeIHEsieNL7IoFC2CPQawK73Uq8H1VjKD+6QU MbBoolXFnMFeWWa4xckTXecs7tw7h5OqYYSw88nI= 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 5.19 694/717] clk: bcm2835: Make peripheral PLLC critical Date: Sat, 22 Oct 2022 09:29:33 +0200 Message-Id: <20221022072529.169043434@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376834355504470?= X-GMAIL-MSGID: =?utf-8?q?1747376834355504470?= 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 9e9f8b242958..f1102b4c7e88 100644 --- a/drivers/clk/bcm/clk-bcm2835.c +++ b/drivers/clk/bcm/clk-bcm2835.c @@ -1784,7 +1784,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 Sat Oct 22 07: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: 7729 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1110125wrr; Sat, 22 Oct 2022 01:51:27 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5qyjYLCIhm7B2PXjuXltIaCwjjjBrEDoEHOis4VeL2oOTetx1FZGRGssYT67sf6amb7xHn X-Received: by 2002:a17:907:3da2:b0:78d:51c4:5b80 with SMTP id he34-20020a1709073da200b0078d51c45b80mr18890825ejc.716.1666428687077; Sat, 22 Oct 2022 01:51:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666428687; cv=none; d=google.com; s=arc-20160816; b=GEluvoEYwtKC1nHC8rNOGUyOHzkIdfA588M1L0xDQiQkwBucA7GvE9Qa6bxW1o1cly 8lWE69yOv1GpCDTn47sjhp13lm3qDgsXZf5Jzl6eK5Tq/Y05DnQyvTlpXe7jWFz/BZLI mP0rzaCySNXA3ioy/lDT5SnBFruUnqau7882E3KHmM29wsoNF6UHdapvJiuF3WZkLtYC hChQdxqeJJjy6i9IzAECFPps5Ez+6heZOAQzZX7EmDIaOOgGkrf/eA8uN1AGa8p2gc7G LT7/tBlxOVtMDOiOuTCDRWjmAo+Rf76Jt19sPe22mgk6fJyGNk1dMJQ5Mrx/w1IZKRcH JKmA== 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=n9+3I6df9kyNB+5t+tXn/pRdnRxOnJ5haWzAoO44kfk=; b=NN8NOQTHtljaNdmTjc0E5YshtDkYmYgmeNBvps6o0NbvsH7cnVcn92s+prpeZqMZf8 IUlrly94kF5KI4hVN3lhGx9M5/8tOXPQfWPi5AMUcvf9e0W6X6kLKhS0F0Ucdzntn88P TORR3pM+6FDM2/IhSQ5kdwRfPaeJthAuRfzayk5la8/s0QO4Pc47OwL4pFd61AoXD+9b qY/Vg92J0++vT1f+xRCYaMX/wykU9zpHjDc/kiOC0Bv4RbU9yNbyM4e2TZKyQL2AdCZJ 8eDl3sfaZk04/hCsxbBOpVuVKKywku1FLRju4vAJRbi/2PkGWkfUmOsO+QvF+RPQSNsO F3RA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=KLNden24; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 x23-20020a170906135700b007470b52f94esi18669699ejb.199.2022.10.22.01.51.02; Sat, 22 Oct 2022 01:51: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=KLNden24; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S234802AbiJVIuP (ORCPT + 99 others); Sat, 22 Oct 2022 04:50:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41156 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234857AbiJVIsK (ORCPT ); Sat, 22 Oct 2022 04:48: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 A309E9F36B; Sat, 22 Oct 2022 01:10: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 92E69B82E09; Sat, 22 Oct 2022 08:07:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E054BC433D6; Sat, 22 Oct 2022 08:07:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666426027; bh=5aitl3GEqiPMweqkIwJxZlH7zJawy7W/BWV5r8LclIQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KLNden249oiRfzhEgmAeeTfPfoig12h+TZIatSIXTtJGPGO4gzHTRoSE5JUytETj9 GJFcgEYh7XHNgC7f8IAy24dmH5L8AlFMEMi335G/FFYN10RcIYEG8hjdlN3zXo3kTB MBbyDzI+x9dXgR/Ft+E5HxP+dEVa+7QHup9vR4Tk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Phil Elwell , "Ivan T. Ivanov" , Stefan Wahren , Stephen Boyd , Sasha Levin Subject: [PATCH 5.19 695/717] clk: bcm2835: Round UART input clock up Date: Sat, 22 Oct 2022 09:29:34 +0200 Message-Id: <20221022072529.205233985@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747377126784890905?= X-GMAIL-MSGID: =?utf-8?q?1747377126784890905?= From: Ivan T. Ivanov [ Upstream commit f690a4d7a8f66430662975511c86819dc9965bcc ] It was reported that RPi3[1] and RPi Zero 2W boards have issues with the Bluetooth. It turns out that when switching from initial to operation speed host and device no longer can talk each other because host uses incorrect UART baud rate. The UART driver used in this case is amba-pl011. Original fix, see below Github link[2], was inside pl011 module, but somehow it didn't look as the right place to fix. Beside that this original rounding function is not exactly perfect for all possible clock values. So I deiced to move the hack to the platform which actually need it. The UART clock is initialised to be as close to the requested frequency as possible without exceeding it. Now that there is a clock manager that returns the actual frequencies, an expected 48MHz clock is reported as 47999625. If the requested baud rate == requested clock/16, there is no headroom and the slight reduction in actual clock rate results in failure. If increasing a clock by less than 0.1% changes it from ..999.. to ..000.., round it up. [1] https://bugzilla.suse.com/show_bug.cgi?id=1188238 [2] https://github.com/raspberrypi/linux/commit/ab3f1b39537f6d3825b8873006fbe2fc5ff057b7 Cc: Phil Elwell Signed-off-by: Ivan T. Ivanov Reviewed-by: Stefan Wahren Link: https://lore.kernel.org/r/20220912081306.24662-1-iivanov@suse.de Signed-off-by: Stephen Boyd Signed-off-by: Sasha Levin --- drivers/clk/bcm/clk-bcm2835.c | 35 +++++++++++++++++++++++++++++++++-- 1 file changed, 33 insertions(+), 2 deletions(-) diff --git a/drivers/clk/bcm/clk-bcm2835.c b/drivers/clk/bcm/clk-bcm2835.c index f1102b4c7e88..e74fe6219d14 100644 --- a/drivers/clk/bcm/clk-bcm2835.c +++ b/drivers/clk/bcm/clk-bcm2835.c @@ -30,6 +30,7 @@ #include #include #include +#include #include #include #include @@ -502,6 +503,8 @@ struct bcm2835_clock_data { bool low_jitter; u32 tcnt_mux; + + bool round_up; }; struct bcm2835_gate_data { @@ -993,12 +996,34 @@ static unsigned long bcm2835_clock_rate_from_divisor(struct bcm2835_clock *clock return temp; } +static unsigned long bcm2835_round_rate(unsigned long rate) +{ + unsigned long scaler; + unsigned long limit; + + limit = rate / 100000; + + scaler = 1; + while (scaler < limit) + scaler *= 10; + + /* + * If increasing a clock by less than 0.1% changes it + * from ..999.. to ..000.., round up. + */ + if ((rate + scaler - 1) / scaler % 1000 == 0) + rate = roundup(rate, scaler); + + return rate; +} + static unsigned long bcm2835_clock_get_rate(struct clk_hw *hw, unsigned long parent_rate) { struct bcm2835_clock *clock = bcm2835_clock_from_hw(hw); struct bcm2835_cprman *cprman = clock->cprman; const struct bcm2835_clock_data *data = clock->data; + unsigned long rate; u32 div; if (data->int_bits == 0 && data->frac_bits == 0) @@ -1006,7 +1031,12 @@ static unsigned long bcm2835_clock_get_rate(struct clk_hw *hw, div = cprman_read(cprman, data->div_reg); - return bcm2835_clock_rate_from_divisor(clock, parent_rate, div); + rate = bcm2835_clock_rate_from_divisor(clock, parent_rate, div); + + if (data->round_up) + rate = bcm2835_round_rate(rate); + + return rate; } static void bcm2835_clock_wait_busy(struct bcm2835_clock *clock) @@ -2143,7 +2173,8 @@ static const struct bcm2835_clk_desc clk_desc_array[] = { .div_reg = CM_UARTDIV, .int_bits = 10, .frac_bits = 12, - .tcnt_mux = 28), + .tcnt_mux = 28, + .round_up = true), /* TV encoder clock. Only operating frequency is 108Mhz. */ [BCM2835_CLOCK_VEC] = REGISTER_PER_CLK( From patchwork Sat Oct 22 07: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: 7732 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1110160wrr; Sat, 22 Oct 2022 01:51:33 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5wOjXjTVyTN/p3m4V35BuGWd8hLBeuagEnsZEHuYWGLYnGP2ks5eZkxa2cE4BQaraSXQO1 X-Received: by 2002:a17:907:6095:b0:78d:bb0b:c34d with SMTP id ht21-20020a170907609500b0078dbb0bc34dmr19088227ejc.662.1666428693460; Sat, 22 Oct 2022 01:51:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666428693; cv=none; d=google.com; s=arc-20160816; b=qjCV0tvWAQQYhiQeLHvvfsLdL+VJXUpJkrAeENVT/AXhDaV3MeLR6uk9AbA3oYYtrI oEC7XOdaKZ7B4wkrg+P08vHf25jtO1XM9Qu19YFBO0oYewL96UaCXwhh+TGKKgM/liSW cl+ysFNzKaoMw/XlyrLZ/tJtpfC0kRzpnCLTZP3YMlfvxS+24BKC0tdu4leevq4opa4y igJpZ41SpQGP0hS4k7Db6rOPH9YuL5kODjakUBAmZvpf9smSy8OmpHbTGc0ACxy1LqOV oWzHX+wZ7EP3CAW05Awxqm+CroychusBlVLzX+QkFdnKJxEtuRFsoQFd9u8ucp0J3gSG oHWg== 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=4K7yEd4mDDlE5qcONrnHPLsafzKvpLvLwO1EqEriGek=; b=Y7+KSvGif/A4LIre3hRo889lqKFfMJFWXquIjfJBENUyP9dh/RwjchfrMBfDHPznfL v1Yi51E58ErSwCu34U9GX7v5J6BMlPcB3KU5l1W6ItiLNreQJ2yVxpZjdLE7H6iEN8oh 6StcgXkzOajzs3IKlTmG++RmOt6DmTS2rqiTwHE03edMw/H1Bw2cA76qYXeqyBd5N2O2 HOg89TpKOQYsWA5RCsPw07oIy74xnrt16CamBm8aA/J9a3zbX/TrWjGNSosGM9bei2OJ GPIJp0BdRerrVrcNku2z7Xev19JLnbudi9TQVa665pW3BpemPYEtevi/2eyVvQnzVIf0 zUWA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=igNhwmcI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 mf26-20020a170906cb9a00b0077c2e5ea05dsi18468772ejb.267.2022.10.22.01.51.09; Sat, 22 Oct 2022 01:51: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=igNhwmcI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S234908AbiJVIui (ORCPT + 99 others); Sat, 22 Oct 2022 04:50:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45840 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234953AbiJVItN (ORCPT ); Sat, 22 Oct 2022 04:49:13 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C4C905D708; Sat, 22 Oct 2022 01:10: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 7CC9260B8C; Sat, 22 Oct 2022 08:07:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 63D80C433D6; Sat, 22 Oct 2022 08:07:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666426029; bh=3AxiOxEr6p2R2Ik2xWi62KwOo1GadDSKNU8GpwFBzbA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=igNhwmcIQpiZcWnaXj9x5pCwjfcgq3uc0cDP9BuVjwEaNNnnRbZ05TVQodH/rGt36 Q+FfZx3ozGL3WE+Z6v6wTPKNwTeBTg50zD83ICG7Z+7ewM6qd6sR31Yh+u5I/3Fqcf 00SrRQw8b7icJ7S26QvhTQ/cB2IIzO7nIKsxydvo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Namhyung Kim , Rob Herring , Leo Yan , Alexander Shishkin , Ingo Molnar , James Clark , Jiri Olsa , Mark Rutland , Peter Zijlstra , Arnaldo Carvalho de Melo Subject: [PATCH 5.19 696/717] perf: Skip and warn on unknown format configN attrs Date: Sat, 22 Oct 2022 09:29:35 +0200 Message-Id: <20221022072529.243436599@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747377133633552565?= X-GMAIL-MSGID: =?utf-8?q?1747377133633552565?= From: Rob Herring commit e552b7be12ed62357df84392efa525ecb01910fb upstream. If the kernel exposes a new perf_event_attr field in a format attr, perf will return an error stating the specified PMU can't be found. For example, a format attr with 'config3:0-63' causes an error as config3 is unknown to perf. This causes a compatibility issue between a newer kernel with older perf tool. Before this change with a kernel adding 'config3' I get: $ perf record -e arm_spe// -- true event syntax error: 'arm_spe//' \___ Cannot find PMU `arm_spe'. Missing kernel support? Run 'perf list' for a list of valid events Usage: perf record [] [] or: perf record [] -- [] -e, --event event selector. use 'perf list' to list available events After this change, I get: $ perf record -e arm_spe// -- true WARNING: 'arm_spe_0' format 'inv_event_filter' requires 'perf_event_attr::config3' which is not supported by this version of perf! [ perf record: Woken up 2 times to write data ] [ perf record: Captured and wrote 0.091 MB perf.data ] To support unknown configN formats, rework the YACC implementation to pass any config[0-9]+ format to perf_pmu__new_format() to handle with a warning. Reviewed-by: Namhyung Kim Signed-off-by: Rob Herring Tested-by: Leo Yan Cc: Alexander Shishkin Cc: Ingo Molnar Cc: James Clark Cc: Jiri Olsa Cc: Mark Rutland Cc: Peter Zijlstra Cc: stable@vger.kernel.org Link: https://lore.kernel.org/r/20220914-arm-perf-tool-spe1-2-v2-v4-1-83c098e6212e@kernel.org Signed-off-by: Arnaldo Carvalho de Melo Signed-off-by: Greg Kroah-Hartman --- tools/perf/util/parse-events.c | 3 +++ tools/perf/util/pmu.c | 17 +++++++++++++++++ tools/perf/util/pmu.h | 2 ++ tools/perf/util/pmu.l | 2 -- tools/perf/util/pmu.y | 15 ++++----------- 5 files changed, 26 insertions(+), 13 deletions(-) --- a/tools/perf/util/parse-events.c +++ b/tools/perf/util/parse-events.c @@ -255,6 +255,9 @@ __add_event(struct list_head *list, int struct perf_cpu_map *cpus = pmu ? perf_cpu_map__get(pmu->cpus) : cpu_list ? perf_cpu_map__new(cpu_list) : NULL; + if (pmu) + perf_pmu__warn_invalid_formats(pmu); + if (pmu && attr->type == PERF_TYPE_RAW) perf_pmu__warn_invalid_config(pmu, attr->config, name); --- a/tools/perf/util/pmu.c +++ b/tools/perf/util/pmu.c @@ -1048,6 +1048,23 @@ err: return NULL; } +void perf_pmu__warn_invalid_formats(struct perf_pmu *pmu) +{ + struct perf_pmu_format *format; + + /* fake pmu doesn't have format list */ + if (pmu == &perf_pmu__fake) + return; + + list_for_each_entry(format, &pmu->format, list) + if (format->value >= PERF_PMU_FORMAT_VALUE_CONFIG_END) { + pr_warning("WARNING: '%s' format '%s' requires 'perf_event_attr::config%d'" + "which is not supported by this version of perf!\n", + pmu->name, format->name, format->value); + return; + } +} + static struct perf_pmu *pmu_find(const char *name) { struct perf_pmu *pmu; --- a/tools/perf/util/pmu.h +++ b/tools/perf/util/pmu.h @@ -17,6 +17,7 @@ enum { PERF_PMU_FORMAT_VALUE_CONFIG, PERF_PMU_FORMAT_VALUE_CONFIG1, PERF_PMU_FORMAT_VALUE_CONFIG2, + PERF_PMU_FORMAT_VALUE_CONFIG_END, }; #define PERF_PMU_FORMAT_BITS 64 @@ -139,6 +140,7 @@ int perf_pmu__caps_parse(struct perf_pmu void perf_pmu__warn_invalid_config(struct perf_pmu *pmu, __u64 config, const char *name); +void perf_pmu__warn_invalid_formats(struct perf_pmu *pmu); bool perf_pmu__has_hybrid(void); int perf_pmu__match(char *pattern, char *name, char *tok); --- a/tools/perf/util/pmu.l +++ b/tools/perf/util/pmu.l @@ -27,8 +27,6 @@ num_dec [0-9]+ {num_dec} { return value(10); } config { return PP_CONFIG; } -config1 { return PP_CONFIG1; } -config2 { return PP_CONFIG2; } - { return '-'; } : { return ':'; } , { return ','; } --- a/tools/perf/util/pmu.y +++ b/tools/perf/util/pmu.y @@ -20,7 +20,7 @@ do { \ %} -%token PP_CONFIG PP_CONFIG1 PP_CONFIG2 +%token PP_CONFIG %token PP_VALUE PP_ERROR %type PP_VALUE %type bit_term @@ -47,18 +47,11 @@ PP_CONFIG ':' bits $3)); } | -PP_CONFIG1 ':' bits +PP_CONFIG PP_VALUE ':' bits { ABORT_ON(perf_pmu__new_format(format, name, - PERF_PMU_FORMAT_VALUE_CONFIG1, - $3)); -} -| -PP_CONFIG2 ':' bits -{ - ABORT_ON(perf_pmu__new_format(format, name, - PERF_PMU_FORMAT_VALUE_CONFIG2, - $3)); + $2, + $4)); } bits: From patchwork Sat Oct 22 07: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: 7806 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1138191wrr; Sat, 22 Oct 2022 03:17:44 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6wFH3sFFG5PYx/YHNfIZXl7aRzjeEZdLLYNVyH2e7qNsYdAu3rIs1x9OCrXPsRHQCJAhoD X-Received: by 2002:a05:6402:354d:b0:45c:b772:5ef4 with SMTP id f13-20020a056402354d00b0045cb7725ef4mr22078982edd.225.1666433863811; Sat, 22 Oct 2022 03:17:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666433863; cv=none; d=google.com; s=arc-20160816; b=0lF20UfHeS0RT6zBRpgc5SOksWw2lGNpwnpAiG+H2vt9IBlSm+J4keB23GnEaiy28Q Uds8t8NseCxdkar4VJXOJwu6s04CIDdHaPhcgexh401QXgwEk1gB93KqowJ3CN1mGuXb JZ4buHDCKZSafLJ+OYdwNwWxsft9jsSQgMvo/Y9LDOj2sJ2bWZxM3vMHop4IA/jkxMWE iA6DhL4Ef2Emjl0CxODhlETQoEPIPQdcGP5H8D29gzTH4XSvDM7BHnnTdNEeO/17FM+y qOILuc4m8oVKWesVkCPR7gUqE7T1mU5e/IxlbykEsKVOH2KQn6eOiKGDrtT7rbkFg41A u62w== 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=qUaXSaj3cDD3aJhweshAGDCudJsxDN3HBdxDYshTqkA=; b=OXFdQYizUytKpL/sCdpSCP7VJqxD5fcTfBdPdpdAIdb/Zh72PmgeB6M3z5RIuVHV9j YNkVzgzVsjAmRfSO9g77k1xbMhC9EjBdGz8WqFJdQWicDSrSoFO39RGFHehwTg35oFSy 1yo4AmVq1pP0W77HD9vRWwiYD3cKIvwTjJxhUuGFV+urL5Uh+n4EkRgYnZUrcaNy38wE ERH8I+lNQwQpJNuHnEWSqm+9G6aj+hH6sANYmcnBDTSCNQhyLIXkH5ivu/YOS2G6EPXU IGmfW6Exf9qXBcqCtwVOcPa7wU07yHSKmVFs4sXI0SkGm2fwOuckjBNLQ9q6F1mBvspO Q4zA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=GgiL+dA8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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-20020a05640251cb00b0045d9ceae6d8si15297903edd.492.2022.10.22.03.17.18; Sat, 22 Oct 2022 03:17: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=GgiL+dA8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S230238AbiJVKMO (ORCPT + 99 others); Sat, 22 Oct 2022 06:12:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41878 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230160AbiJVKLs (ORCPT ); Sat, 22 Oct 2022 06:11: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 3FD952D452A; Sat, 22 Oct 2022 02:29: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 39447B82E13; Sat, 22 Oct 2022 08:07:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8C9E0C433D6; Sat, 22 Oct 2022 08:07:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666426032; bh=2Ab8NC/nMg7sY+5HGefX95dp+GqVgVdbTfyI40GmjLQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GgiL+dA8EAsV0Nse4sWkxrsBYwYN6W3NaUP5PIt0uOYmfpyu5clJ2VxaZVagbVZkd RWwzVkOyK0QfepJaSvweYUGPdgkFDWhnRZft+PlY411NXEROnV0bRXbTmchJHvzMfS qp3P2VtK/m1nIQCpKQg8ETt06l8t9S9USlChGJlY= 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 5.19 697/717] perf intel-pt: Fix segfault in intel_pt_print_info() with uClibc Date: Sat, 22 Oct 2022 09:29:36 +0200 Message-Id: <20221022072529.291679010@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 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?1747382555143198344?= X-GMAIL-MSGID: =?utf-8?q?1747382555143198344?= 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 @@ -3878,6 +3878,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", @@ -3892,8 +3893,12 @@ static void intel_pt_print_info(__u64 *a 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 Sat Oct 22 07: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: 7697 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1109276wrr; Sat, 22 Oct 2022 01:47:52 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7dx4HdaKRY5u7AClAxEKhIjCV9gXGARduwZ6g1hBdxpdk5Kw+m8L2TKGnl2X6lXkICebuF X-Received: by 2002:a17:907:25cd:b0:77b:9672:38e7 with SMTP id ae13-20020a17090725cd00b0077b967238e7mr20022882ejc.10.1666428472260; Sat, 22 Oct 2022 01:47:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666428472; cv=none; d=google.com; s=arc-20160816; b=c/tBg3L+b/Bc1QAl3FAxsVQ6SlFBFs6Sw8MqYYRd5nt+WSnotbmJIk9vRPPPgVccDA 4SfadcY0VDpnfsQWY2vgsc2HDdcGEBUg/B2zz86TBvHozggPPkHdeb6ix87nEkCt2tnn al+vxLZQLkaLTPrmXodeZGmKQEMQdb+7OQaLTtj2xs7+LGsVoAx77J1i1ttaHn77R2qG O0c1M2TXhVyv4+cI+mHbVv+GUduOQAkfjVipp41DTgy1fb066Wcsfb8BGY3eJIynm6jT vQ/9syflnU2G18L9GJnpe7PQ8TbuGuFFvdiTuNs4JHw0HEpmOS3r5nC3u6B1r/43pmQc lDcA== 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=g4PC4xOrQIxZ0ydw36JaxPy1FgjMMgTstwR54iH0OOQ=; b=TO41hM9xB4PYZ3iV0QLXGFmxrCnI9Q1QlzBwnLg0+Gitc8byaRMgLz98qWUjx+KZ+J HUms0wtLfHeyshN+8dF8BgAMBEv0/SeK5DPRC0fZMsXZUGhmyF1O2t2EAwvkzdUcIAPA NDoAZ3OVLHA9tXRr8+uO0prvo/NnXeSOPv+aeYaHY7t4NvL6KUa+LslMhQrwMrgNUoe/ yoQAyaT3yngD4GreB99BuMhIaR8sIIZaOxQvsYU5xH+FRtWIzKOvuvaRj9t3HR08NtbI dUcAhTndBgmp1VHJnmgKHVrr6dBEsqBW1tVXDEPvFuIoK4n8yNEzWGIgQ86k6xc3AnoK FGYQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=uDLegif6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 om40-20020a170907a1a800b0078d550c0272si17435574ejc.269.2022.10.22.01.47.27; Sat, 22 Oct 2022 01:47: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=uDLegif6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S234856AbiJVIq3 (ORCPT + 99 others); Sat, 22 Oct 2022 04:46:29 -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 S234978AbiJVIoL (ORCPT ); Sat, 22 Oct 2022 04:44:11 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 475612C6E9E; Sat, 22 Oct 2022 01:07: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 58F8460BAA; Sat, 22 Oct 2022 08:07:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 65443C433C1; Sat, 22 Oct 2022 08:07:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666426035; bh=6HicgzDugBOerZVbAxSgXH2xBFYBrHxtY5zu4BuDnVg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uDLegif66pSGgV2jHhObzgJK3qKtEitiHmKkb93hYOStGi9AYG8MrNdACG8MOREYw 1aZby/F13hgLAYcg9bFsxesHwaxayrwEMyPykrOhLUR8Fc+vZ842ef4seIim772nLH qRVZViJgx7LAkA7zGM4+PAL0I92H1hmDrPvEen8g= 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 5.19 698/717] perf intel-pt: Fix system_wide dummy event for hybrid Date: Sat, 22 Oct 2022 09:29:37 +0200 Message-Id: <20221022072529.333384768@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376901260584407?= X-GMAIL-MSGID: =?utf-8?q?1747376901260584407?= From: Adrian Hunter commit 6cef7dab3e2e5cb23a13569c3880c0532326748c upstream. User space tasks can migrate between CPUs, so when tracing selected CPUs, system-wide sideband is still needed, however evlist->core.has_user_cpus is not set in the hybrid case, so check the target cpu_list instead. Fixes: 7d189cadbeebc778 ("perf intel-pt: Track sideband system-wide when needed") 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-3-adrian.hunter@intel.com Signed-off-by: Arnaldo Carvalho de Melo Signed-off-by: Greg Kroah-Hartman --- tools/perf/arch/x86/util/intel-pt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/tools/perf/arch/x86/util/intel-pt.c +++ b/tools/perf/arch/x86/util/intel-pt.c @@ -871,7 +871,7 @@ static int intel_pt_recording_options(st * User space tasks can migrate between CPUs, so when tracing * selected CPUs, sideband for all CPUs is still needed. */ - need_system_wide_tracking = evlist->core.has_user_cpus && + need_system_wide_tracking = opts->target.cpu_list && !intel_pt_evsel->core.attr.exclude_user; tracking_evsel = evlist__add_aux_dummy(evlist, need_system_wide_tracking); From patchwork Sat Oct 22 07: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: 7687 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1109058wrr; Sat, 22 Oct 2022 01:47:06 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5HVf7huNM6VURrYbv0deeHquZMfF7jUjR9VwAV2IotyOyjJP5hGFSTXd8n6MLHHUsmJZGy X-Received: by 2002:a17:906:9b87:b0:733:1795:2855 with SMTP id dd7-20020a1709069b8700b0073317952855mr19219664ejc.156.1666428425967; Sat, 22 Oct 2022 01:47:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666428425; cv=none; d=google.com; s=arc-20160816; b=ttcMDOK8ackzLyq1x1lXI+yKOJz/D0wMda9tXDrC85AAXD148obJuPHHnk2EAJwqVa cC4XAGCfu/V5xnhMT6/RMVip6CXt9iwqqHGOdDSH4TtOGY0z00JQ/PYaNuQGO8XlcpPb hSNssOtP9iUoIegx10mrWBDMw6Fcn2aRJvMNuOcz5Vl+JnDjdzxCO2n52+vT0DWnsS6h SV4w2y7gPCfjaXzf7c10ilq1HEEVZz/+0tkhA6U5jXWfFVcgdBdIC0sHgviLRh3VFbI5 HBXVN6USbGzYRjW9u3Y8dsmvGgoaK7HFNokj0Imy5/z3zDKAa3CErrVTrjRZXL8zUTaq Tnbw== 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=twDjl41JmSYDehn3mM8tglfC07b9iurJOl8R2EzjmGo=; b=q7zD2ZR4oFX2wZeMmhN88yzThYoXMIeHOGmNybKW6Uat6rz3HoJMEw4gqNcTcZ9A9S Fa29lunHuA4IneDkU5n9E6xw3tl4FNzV4tffToD/Wuj6Wav4pLITuIhXU/XjlA4LXmpJ r/Q8AP+tDs72o1rpbuR4kHx6tWSpjZHfCgYLfFA76myFzd+9jUTyDKGDKHohHR9bJS5w f5szw8g9mhRM1DqrLqZ092NTM16++ksyvaUII8D0xotVi/ASd2M5uFniaDSy0NppWr54 PzFh3lfO+u7NgR9kzr5QOXaE/c0Eq821fqRCtDvPw3i8IfizdhCFskRmWgSIiOTqeHDI bbtA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=kQJtik8s; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 dr9-20020a170907720900b0078cffd3ce3esi18229932ejc.654.2022.10.22.01.46.40; Sat, 22 Oct 2022 01:47: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=kQJtik8s; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S234826AbiJVIqL (ORCPT + 99 others); Sat, 22 Oct 2022 04:46:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52866 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234902AbiJVIn7 (ORCPT ); Sat, 22 Oct 2022 04:43:59 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8EADC2D5E90; Sat, 22 Oct 2022 01:07: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 363F760B93; Sat, 22 Oct 2022 08:07:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 21FEFC43470; Sat, 22 Oct 2022 08:07:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666426038; bh=NnJ0YjbfDryTNsgBnYfvkTFfLDik9g6cRLQCeZMJaHk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kQJtik8s0x6RfwbSMuk9ym1Lu8mSD+/Alehwc4ZTkRUlxilnuU9dHnOxJdMqQUgi+ IvWtFv0vwgspaZN45W1e19a9aDqM1p0IBCkLx6ofDeNK86COeuORsroh5AdssIyMNf shmyCRlWBaKWqIQrrw8UgCV8X2tnGyN8hdjfGek8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Liu Shixin , Kefeng Wang , syzbot+193f9cee8638750b23cf@syzkaller.appspotmail.com, Liu Zixian , Mike Kravetz , David Hildenbrand , John Hubbard , Muchun Song , Sidhartha Kumar , Andrew Morton Subject: [PATCH 5.19 699/717] mm: hugetlb: fix UAF in hugetlb_handle_userfault Date: Sat, 22 Oct 2022 09:29:38 +0200 Message-Id: <20221022072529.365729689@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376853068471494?= X-GMAIL-MSGID: =?utf-8?q?1747376853068471494?= From: Liu Shixin commit 958f32ce832ba781ac20e11bb2d12a9352ea28fc upstream. The vma_lock and hugetlb_fault_mutex are dropped before handling userfault and reacquire them again after handle_userfault(), but reacquire the vma_lock could lead to UAF[1,2] due to the following race, hugetlb_fault hugetlb_no_page /*unlock vma_lock */ hugetlb_handle_userfault handle_userfault /* unlock mm->mmap_lock*/ vm_mmap_pgoff do_mmap mmap_region munmap_vma_range /* clean old vma */ /* lock vma_lock again <--- UAF */ /* unlock vma_lock */ Since the vma_lock will unlock immediately after hugetlb_handle_userfault(), let's drop the unneeded lock and unlock in hugetlb_handle_userfault() to fix the issue. [1] https://lore.kernel.org/linux-mm/000000000000d5e00a05e834962e@google.com/ [2] https://lore.kernel.org/linux-mm/20220921014457.1668-1-liuzixian4@huawei.com/ Link: https://lkml.kernel.org/r/20220923042113.137273-1-liushixin2@huawei.com Fixes: 1a1aad8a9b7b ("userfaultfd: hugetlbfs: add userfaultfd hugetlb hook") Signed-off-by: Liu Shixin Signed-off-by: Kefeng Wang Reported-by: syzbot+193f9cee8638750b23cf@syzkaller.appspotmail.com Reported-by: Liu Zixian Reviewed-by: Mike Kravetz Cc: David Hildenbrand Cc: John Hubbard Cc: Muchun Song Cc: Sidhartha Kumar Cc: [4.14+] Signed-off-by: Andrew Morton Signed-off-by: Greg Kroah-Hartman --- mm/hugetlb.c | 37 +++++++++++++++++-------------------- 1 file changed, 17 insertions(+), 20 deletions(-) --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -5467,7 +5467,6 @@ static inline vm_fault_t hugetlb_handle_ unsigned long addr, unsigned long reason) { - vm_fault_t ret; u32 hash; struct vm_fault vmf = { .vma = vma, @@ -5485,18 +5484,14 @@ static inline vm_fault_t hugetlb_handle_ }; /* - * hugetlb_fault_mutex and i_mmap_rwsem must be - * dropped before handling userfault. Reacquire - * after handling fault to make calling code simpler. + * vma_lock and hugetlb_fault_mutex must be dropped before handling + * userfault. Also mmap_lock will be dropped during handling + * userfault, any vma operation should be careful from here. */ hash = hugetlb_fault_mutex_hash(mapping, idx); mutex_unlock(&hugetlb_fault_mutex_table[hash]); i_mmap_unlock_read(mapping); - ret = handle_userfault(&vmf, reason); - i_mmap_lock_read(mapping); - mutex_lock(&hugetlb_fault_mutex_table[hash]); - - return ret; + return handle_userfault(&vmf, reason); } static vm_fault_t hugetlb_no_page(struct mm_struct *mm, @@ -5514,6 +5509,7 @@ static vm_fault_t hugetlb_no_page(struct spinlock_t *ptl; unsigned long haddr = address & huge_page_mask(h); bool new_page, new_pagecache_page = false; + u32 hash = hugetlb_fault_mutex_hash(mapping, idx); /* * Currently, we are forced to kill the process in the event the @@ -5524,7 +5520,7 @@ static vm_fault_t hugetlb_no_page(struct if (is_vma_resv_set(vma, HPAGE_RESV_UNMAPPED)) { pr_warn_ratelimited("PID %d killed due to inadequate hugepage pool\n", current->pid); - return ret; + goto out; } /* @@ -5541,12 +5537,10 @@ retry: page = find_lock_page(mapping, idx); if (!page) { /* Check for page in userfault range */ - if (userfaultfd_missing(vma)) { - ret = hugetlb_handle_userfault(vma, mapping, idx, + if (userfaultfd_missing(vma)) + return hugetlb_handle_userfault(vma, mapping, idx, flags, haddr, address, VM_UFFD_MISSING); - goto out; - } page = alloc_huge_page(vma, haddr, 0); if (IS_ERR(page)) { @@ -5606,10 +5600,9 @@ retry: if (userfaultfd_minor(vma)) { unlock_page(page); put_page(page); - ret = hugetlb_handle_userfault(vma, mapping, idx, + return hugetlb_handle_userfault(vma, mapping, idx, flags, haddr, address, VM_UFFD_MINOR); - goto out; } } @@ -5667,6 +5660,8 @@ retry: unlock_page(page); out: + mutex_unlock(&hugetlb_fault_mutex_table[hash]); + i_mmap_unlock_read(mapping); return ret; backout: @@ -5765,11 +5760,13 @@ vm_fault_t hugetlb_fault(struct mm_struc entry = huge_ptep_get(ptep); /* PTE markers should be handled the same way as none pte */ - if (huge_pte_none_mostly(entry)) { - ret = hugetlb_no_page(mm, vma, mapping, idx, address, ptep, + if (huge_pte_none_mostly(entry)) + /* + * hugetlb_no_page will drop vma lock and hugetlb fault + * mutex internally, which make us return immediately. + */ + return hugetlb_no_page(mm, vma, mapping, idx, address, ptep, entry, flags); - goto out_mutex; - } ret = 0; From patchwork Sat Oct 22 07: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: 7728 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1110079wrr; Sat, 22 Oct 2022 01:51:14 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5HNWGiQ/Ef1VNt3rCHuV61kwHwnAicEADyUjHEMZFQ373mLKgmU+dXTnnhfqCy2GYWFoxg X-Received: by 2002:a17:906:ee89:b0:73d:70c5:1a4e with SMTP id wt9-20020a170906ee8900b0073d70c51a4emr18381918ejb.683.1666428674057; Sat, 22 Oct 2022 01:51:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666428674; cv=none; d=google.com; s=arc-20160816; b=yrQ9SFwPcW+WZ1SJpfSgqCcflO27ZxHYeAuM5iL/O4Yz9qHw21OPberFLzXggVKEVu aftJLcxH3X1JpqtjTkDA6kz1m0TLds74YEqBk9oHnTaJfJab2V8BcRVJJo82Mwsgpgvi jby/6fsFaQL2EtBcmJ46WepeHDDoHqORKG7jgyi1E5ZLY7uc4lCqTAOcZLIcNb6jG5HZ ZxrlxxUqZ4MXCDJQcodG382fxz/spmACWQxpoPiik/XU8Dl4HxzoHwqZo7Ap4ZOH2fqh /3GtDWcYcFWKN/Q2hYJHuiswk014PwUFLBrmZSYQ3UiHFZKbXpH4tDCCnQGqpU+cwWUU KbQg== 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=gbCdJqhC/p7TIdq+qgmHmqp0p5N1FFC0pL42yEckEyA=; b=MZ+dM7VAHsL3jsHU07go608N8LWJkogxxTvwv0Kb59mr6Qz5I5cpfeuiEywkSnDzhj Lsk1OXnFUW7wEIgRpC+KRl4hG2TyuERDFwZ3L7uiTnTxjDMlrhX/7Pk6lfhFfRdqe4fh k1ahJKCnriFkW/09gmPQhNvWdpoQ2iWtFrXA0D3nWM0dpyaWk6mMW2lA9fi+zwQeA4ub bIRa1yzprQfwxNqoNMl11vhFyB09YqLL1ZOrZSf0tTOAAjL+vdAy0n5BhruBnN9Ayy5H 8WMKap/Y3XeJ+GRvb5+RHhzDIz+dtyxhAeRPwoM0nL1NA6UWL/sOEnrlq/QHzCUidnjc JcrQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Bzk2p3yU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 c26-20020a056402159a00b0046189831142si302235edv.7.2022.10.22.01.50.49; Sat, 22 Oct 2022 01:51: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=Bzk2p3yU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S234550AbiJVIuK (ORCPT + 99 others); Sat, 22 Oct 2022 04:50:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41210 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234820AbiJVIsK (ORCPT ); Sat, 22 Oct 2022 04:48:10 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 69121BC8A; Sat, 22 Oct 2022 01:10: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 D698BB82E11; Sat, 22 Oct 2022 08:07:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3CD10C433D6; Sat, 22 Oct 2022 08:07:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666426041; bh=OjZ0L2KyAgkZPt75DZB7YHk9PytepHMPjogVsy2mw0A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Bzk2p3yU5CoeSukwuetD4Fw4iK9VYqkYwP4Y4dT4hKfh/PC9+gJmXFf9mHUuNQ1bH rDnpTqWAI4U3ITJlCOt7XLefUcV3VEKOlJXrTAsWdBPBQIl1uKHLiQXmIQP2rhKKmp 1RvhT2IWeRwHNTE5AKwGuenok/qjGLa881dArqbw= 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 5.19 700/717] net: ieee802154: return -EINVAL for unknown addr type Date: Sat, 22 Oct 2022 09:29:39 +0200 Message-Id: <20221022072529.411578843@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747377113508475515?= X-GMAIL-MSGID: =?utf-8?q?1747377113508475515?= 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 @@ -185,21 +185,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 Sat Oct 22 07: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: 7730 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1110135wrr; Sat, 22 Oct 2022 01:51:30 -0700 (PDT) X-Google-Smtp-Source: AMsMyM68RVc7r9drOHk5JPCc9PCOHGceytd/KuQLU1bquc9oN7VgKoRaPJ3+d30SfJ76ojMDvJBQ X-Received: by 2002:a50:baec:0:b0:461:4c59:12bf with SMTP id x99-20020a50baec000000b004614c5912bfmr6689152ede.54.1666428690281; Sat, 22 Oct 2022 01:51:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666428690; cv=none; d=google.com; s=arc-20160816; b=oeeQ8Amxz7GUYklOanxhATi7RwURl2cTF2pXksORVIzG9bEQdoUGIpxPpgh9lS0+Od eGVODwqVYh4OxXGpV1GUNIe/cuh70TF8R2wpaUqFYk8mANrSZA5iZn73R4o7682aAp+X t/7GFWlHsa+FWq8AhHUjYzvhffoZGeAXjNv386rNiCPXeINWKlwsaEbFR+7cFw5Os4oE Mh59cuSkqdqGBy9e59SAwfMZoIjCmtRmU1MDaSHBWWOlJbBh0GlGQd9gpFBQ1xMZTe9C jBxLcO+neAqLU9dkb4bzCPUaUnYEtq7SgtDvEeu6G6ZEuzR85lcw2Zv6Ge0B5tnqJsaf tUXg== 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=/K/+pAbH0MDotvjlvaXwKwi5KdEBz8R3j8Q+jKXadIQ=; b=BYWkvXNziL797ZB6gEPwn5RVoxTgcYHBMAFwx02f7Ef/XxCdgplchXvgOuzQ6NrVAl Xyp3Go0sqd8MsqjozYQobBlCF2rsEUkgmPz0ZmfXmSPSPwQq1LaZ6UvKaV4KO64U5tko /oQ/aHnq179xyDmkNG+/uwL88wBfy45ToGPykLLNs6nlzrU6mca42h1E4qDDZ4EzEz/4 wpwl12jyZ18zFZymuksuEbUq8MB9sRFRF2/Vqlf2ZqpbO4xcOShQ51I47dS2sUxpXbQF Bme3qUYp8at/QdeoG5McL4iR2irLG/t/EG4Z6eMABq7ok+GBGBRVk3QUBHBG8YHpRmqr kI/w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=GPQfkp03; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 h1-20020a056402280100b0045cb68ca4ecsi28298638ede.37.2022.10.22.01.51.05; Sat, 22 Oct 2022 01:51: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=GPQfkp03; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S234870AbiJVIua (ORCPT + 99 others); Sat, 22 Oct 2022 04:50:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45624 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234926AbiJVItL (ORCPT ); Sat, 22 Oct 2022 04:49:11 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4B5B04E62F; Sat, 22 Oct 2022 01:10: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 C734DB82E39; Sat, 22 Oct 2022 08:07:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1D8C8C433C1; Sat, 22 Oct 2022 08:07:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666426044; bh=HqzInSWqetlXOUQs1l/ij7Z47hWlE+PPV581CXDV+lw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GPQfkp03Qk1Jci6f6GSC5cIeiaap1Vmhq8dpuOdgmslfO2a9aPafr+rpJ39VsrlHX PZBRdEd0VubvugmIVqd49TWECCeDgzlS2Lnf4Hps9n6jd078VLKKCu67XPiHR4Tj4a O7a3X9nhWKKts2RV1WnOLcr7JIITaf79UBMwoAV0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Takashi Iwai Subject: [PATCH 5.19 701/717] ALSA: usb-audio: Fix last interface check for registration Date: Sat, 22 Oct 2022 09:29:40 +0200 Message-Id: <20221022072529.462131443@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747377130168102701?= X-GMAIL-MSGID: =?utf-8?q?1747377130168102701?= From: Takashi Iwai commit 39efc9c8a973ddff5918191525d1679d0fb368ea upstream. The recent fix in commit 6392dcd1d0c7 ("ALSA: usb-audio: Register card at the last interface") tried to delay the card registration until the last found interface is probed. It assumed that the probe callback gets called for those later interfaces, but it's not always true; as the driver loops over the descriptor and probes the matching ones, it's not separately called via multiple probe calls. This results in the missing card registration, i.e. no sound device. For addressing this problem, replace the check whether the last interface is processed with usb_interface_claimed() instead of the comparison with the probe interface number. Fixes: 6392dcd1d0c7 ("ALSA: usb-audio: Register card at the last interface") Link: https://lore.kernel.org/r/20220915085947.7922-1-tiwai@suse.de Signed-off-by: Takashi Iwai Signed-off-by: Greg Kroah-Hartman --- sound/usb/card.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/sound/usb/card.c +++ b/sound/usb/card.c @@ -884,7 +884,7 @@ static int usb_audio_probe(struct usb_in * one given via option */ if (check_delayed_register_option(chip) == ifnum || - chip->last_iface == ifnum) { + usb_interface_claimed(usb_ifnum_to_if(dev, chip->last_iface))) { err = snd_card_register(chip->card); if (err < 0) goto __error; From patchwork Sat Oct 22 07: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: 7694 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1109227wrr; Sat, 22 Oct 2022 01:47:38 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4hJ+QK+BIlQwC3/UnKMWXO7RZEpzzQ5cV3bXl3BsS1WK5SJFwu950l5uaG6blyLws5Dyiz X-Received: by 2002:a17:906:8a66:b0:78b:da52:b752 with SMTP id hy6-20020a1709068a6600b0078bda52b752mr18849789ejc.365.1666428458157; Sat, 22 Oct 2022 01:47:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666428458; cv=none; d=google.com; s=arc-20160816; b=ncP3Db1hWg9ZuGqSJ5mTwLSqBCTgrpNRa0el2J7Guk5PNPM3aqYPTNtZJOnRK1WvOS VGE1X/fc4Zl1wl+MaLk3hzOOioaIv7Sej46RPYVLtlU7qupVxz2mMYu8OOrBJHogOUEQ lDM9LbTjyISybGhHOR4zZgfSlN3STcxojqSh+TcZHFw7f3+YgvT6JVLG9gN//f+opDwG SE/6sha1MrdToMwCS8Yk7JcHFSrjrcCVsSWGTubHSMZdJhwKal17f5eMXEABR5tvDeyl GdCuC+CRUH3Axg292Wn4kPtT7H7GL2giw7xYLXPcH16+daeuN6spA77te2GhQevMwnEu nUPQ== 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=EYXui/K/o4mxhygMajTrivZ57jJQl0HpU/2o/P07m+g=; b=uR+4cN0yThLbjFxIv5a7Ppl2JC2rlDTiJgqkUyEYlR9aieEtG0cmCzgz2/qVQClmox 69ibfPMNH5hdmhCgCuw/PbRp75JVQSraJsNGQB4EAREna6CNurtkncgiIA5mwkqsxhml fEHtonZdIGcTtVlzaaklJ2ZSDVZtUbW1QfQVU14XUcsOwuXn0Wr4QZBZeYa00Hnjj6o2 wYCUjsnb4cwe6rkAMA7b57WKZnEIp/o6ra85zJ4cBH00Zpj+djXDNcbSCYhaQ1XN0COM I0ZRsLpiuUfBan5P8yYD2IAotUoCxxAVNt440b3qX4m1yqPkEno3mZAhlccI1rnC0uRu +YwQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=1FEz9PqZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 sb32-20020a1709076da000b00787bacce740si24024986ejc.537.2022.10.22.01.47.13; Sat, 22 Oct 2022 01:47: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=1FEz9PqZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S234690AbiJVIqi (ORCPT + 99 others); Sat, 22 Oct 2022 04:46:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52858 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235014AbiJVIoP (ORCPT ); Sat, 22 Oct 2022 04:44:15 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 096E72D5EA4; Sat, 22 Oct 2022 01:07: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 6D82760AFA; Sat, 22 Oct 2022 08:07:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 609DAC433D7; Sat, 22 Oct 2022 08:07:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666426047; bh=407NwDvLPJKqzLB7rgTrwzWR7eY9drwpc2gxmRqi+5c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1FEz9PqZO8iy5j1LG+gfIXEkx4+ZtisPG16CpXvzqKFRIhGsKrYIWfYQyCFmu5oBf vRuJL6QLHOS+RwtonkVnIvDZr+3tbyK+18SJKcY3VC5lj9WKFYDg/NQkLhQMEAhExn vq3sLb/VAgbdaTR2PjphTIC6S8WrUH9Fb2GKsnjw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, kernel test robot , Yu Kuai , Ming Lei , Jens Axboe Subject: [PATCH 5.19 702/717] blk-wbt: fix that rwb->wc is always set to 1 in wbt_init() Date: Sat, 22 Oct 2022 09:29:41 +0200 Message-Id: <20221022072529.503058251@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376887236842229?= X-GMAIL-MSGID: =?utf-8?q?1747376887236842229?= From: Yu Kuai commit 285febabac4a16655372d23ff43e89ff6f216691 upstream. commit 8c5035dfbb94 ("blk-wbt: call rq_qos_add() after wb_normal is initialized") moves wbt_set_write_cache() before rq_qos_add(), which is wrong because wbt_rq_qos() is still NULL. Fix the problem by removing wbt_set_write_cache() and setting 'rwb->wc' directly. Noted that this patch also remove the redundant setting of 'rab->wc'. Fixes: 8c5035dfbb94 ("blk-wbt: call rq_qos_add() after wb_normal is initialized") Reported-by: kernel test robot Link: https://lore.kernel.org/r/202210081045.77ddf59b-yujie.liu@intel.com Signed-off-by: Yu Kuai Reviewed-by: Ming Lei Link: https://lore.kernel.org/r/20221009101038.1692875-1-yukuai1@huaweicloud.com Signed-off-by: Jens Axboe Signed-off-by: Greg Kroah-Hartman --- block/blk-wbt.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) --- a/block/blk-wbt.c +++ b/block/blk-wbt.c @@ -841,12 +841,11 @@ int wbt_init(struct request_queue *q) rwb->last_comp = rwb->last_issue = jiffies; rwb->win_nsec = RWB_WINDOW_NSEC; rwb->enable_state = WBT_STATE_ON_DEFAULT; - rwb->wc = 1; + rwb->wc = test_bit(QUEUE_FLAG_WC, &q->queue_flags); rwb->rq_depth.default_depth = RWB_DEF_DEPTH; rwb->min_lat_nsec = wbt_default_latency_nsec(q); wbt_queue_depth_changed(&rwb->rqos); - wbt_set_write_cache(q, test_bit(QUEUE_FLAG_WC, &q->queue_flags)); /* * Assign rwb and add the stats callback. From patchwork Sat Oct 22 07: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: 7736 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1110360wrr; Sat, 22 Oct 2022 01:52:23 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7U7QsoLng4CI0WC7mH/4FsmZQF1HPCeuQTOMSECvQW2MWcuGz4LhxDvaFMgOI2k84huk1o X-Received: by 2002:a17:907:8a27:b0:78e:274e:9235 with SMTP id sc39-20020a1709078a2700b0078e274e9235mr19441508ejc.754.1666428743465; Sat, 22 Oct 2022 01:52:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666428743; cv=none; d=google.com; s=arc-20160816; b=TTyMDBYSbqd+9H7YBf5QQkZ95Bkq+Vv8klTsZjcfrDHk4pe9ytQGLKUnIuBK5cMYvg UgCztQsH41a8ZqqZeoYuv46p2BUJX5cZUCPE1gX0VSq59f2y78an5GujXqG7ulDL9Mmu /UNyUr4SI0212Z3TQrfsuA+dgwsu8fi6xKD75SJKheNCjn0uZQqQnycaQUkB4qYyONUb 9PPSgM9TF1B5Jvpa90Hb9asg4AwX8T2wHLh2HmuPmhbf5ixyBP1GhjjSGUqgEXzwoAbo VzatP+4hemTz0XkC8oRTw8B/dheXBvQXCQSytgRR+8aV1lMjzvqHFS85/Tu9nacfUhMr fPJw== 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=rk8oQncFKtlJDdo8BEdMJDvFz+WvwaV7IqPdh9sRpKA=; b=EL0lvUlV1pmPROxiMNhcxv2sn7UGUNjkO8niMaxngW2H1ar/Neg/Xf2XQO8tLuXTMM E1Co3FK4QnbWth+orWQog6kMaxY4YhDQyqsTHXTEp2+1Bd/WEvKq5mNr6txbwV08UQLx /fu6FPZD5hYy/qY/Qz/c4iMogPxP1GbZ3BItjQGLM21GIEuSyK7oUuyTnoF8wanLTlMX JGB2bOZiTFdgfNVA+j1uKZ94uAZhLxb/p8bC3sdhHVbDVCdi75ntsk3zbzbGW0SdEwEu bVm0/4/qrge6l++Fji4J4tVYx3WjP40XoAtXPVX/CihdGWgv2sU7Fwnb5GjBszmTxJdT V3kA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=X4qC1DPz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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-20020aa7d606000000b0045d0c00ead2si18837590edr.157.2022.10.22.01.51.58; Sat, 22 Oct 2022 01:52: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=X4qC1DPz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S234874AbiJVIvF (ORCPT + 99 others); Sat, 22 Oct 2022 04:51:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44258 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234964AbiJVItP (ORCPT ); Sat, 22 Oct 2022 04:49:15 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C4F5480F58; Sat, 22 Oct 2022 01:10: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 625C360B94; Sat, 22 Oct 2022 08:07:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 59536C433D7; Sat, 22 Oct 2022 08:07:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666426050; bh=SfovaiwKGLjcp/SsOJAxEXvxF9kuiamt4gaWeahnRxA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=X4qC1DPzOiZL+1dWi7NbGw9EwKuwy2enhjTYT6RvQqi0+vJw/6VEAE7AG8PvHlFGz P8HjSxmBdO9iCTsMgBB1lMQEC/VHWXGfIwpf7Z6TbmQAgmqq4xREh5x+zmFWVx/CIX VsS9CrDdfix09IRqaZzttqgK3m8q7Dhckh1hAacQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Randy Dunlap , Grygorii Strashko , Ravi Gunasekaran , Eric Dumazet , Paolo Abeni , Naresh Kamboju , "Sudip Mukherjee (Codethink)" , Jakub Kicinski Subject: [PATCH 5.19 703/717] net: ethernet: ti: davinci_mdio: fix build for mdio bitbang uses Date: Sat, 22 Oct 2022 09:29:42 +0200 Message-Id: <20221022072529.547751759@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747377185841083868?= X-GMAIL-MSGID: =?utf-8?q?1747377185841083868?= From: Randy Dunlap commit 35bbe652c421037822aba29423f5f1f7d0d69f3f upstream. davinci_mdio.c uses mdio bitbang APIs, so it should select MDIO_BITBANG to prevent build errors. arm-linux-gnueabi-ld: drivers/net/ethernet/ti/davinci_mdio.o: in function `davinci_mdio_remove': drivers/net/ethernet/ti/davinci_mdio.c:649: undefined reference to `free_mdio_bitbang' arm-linux-gnueabi-ld: drivers/net/ethernet/ti/davinci_mdio.o: in function `davinci_mdio_probe': drivers/net/ethernet/ti/davinci_mdio.c:545: undefined reference to `alloc_mdio_bitbang' arm-linux-gnueabi-ld: drivers/net/ethernet/ti/davinci_mdio.o: in function `davinci_mdiobb_read': drivers/net/ethernet/ti/davinci_mdio.c:236: undefined reference to `mdiobb_read' arm-linux-gnueabi-ld: drivers/net/ethernet/ti/davinci_mdio.o: in function `davinci_mdiobb_write': drivers/net/ethernet/ti/davinci_mdio.c:253: undefined reference to `mdiobb_write' Fixes: d04807b80691 ("net: ethernet: ti: davinci_mdio: Add workaround for errata i2329") Signed-off-by: Randy Dunlap Cc: Grygorii Strashko Cc: Ravi Gunasekaran Cc: Eric Dumazet Cc: Paolo Abeni Cc: Naresh Kamboju Cc: Sudip Mukherjee (Codethink) Link: https://lore.kernel.org/r/20220824024216.4939-1-rdunlap@infradead.org Signed-off-by: Jakub Kicinski Signed-off-by: Greg Kroah-Hartman --- drivers/net/ethernet/ti/Kconfig | 1 + 1 file changed, 1 insertion(+) --- a/drivers/net/ethernet/ti/Kconfig +++ b/drivers/net/ethernet/ti/Kconfig @@ -33,6 +33,7 @@ config TI_DAVINCI_MDIO tristate "TI DaVinci MDIO Support" depends on ARCH_DAVINCI || ARCH_OMAP2PLUS || ARCH_KEYSTONE || ARCH_K3 || COMPILE_TEST select PHYLIB + select MDIO_BITBANG help This driver supports TI's DaVinci MDIO module. From patchwork Sat Oct 22 07: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: 7805 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1136489wrr; Sat, 22 Oct 2022 03:12:35 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4c//f9OKx6YH9YohvK2PNKSgJ80y3h9FUjDWIY/vZJomloW1LPyHgAEYFeof/IMwpf01Wl X-Received: by 2002:a17:902:ba8f:b0:17f:9b1b:6634 with SMTP id k15-20020a170902ba8f00b0017f9b1b6634mr23737621pls.171.1666433555119; Sat, 22 Oct 2022 03:12:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666433555; cv=none; d=google.com; s=arc-20160816; b=Zc4U/GjPcr7dglXKmvvh4NrXTc1d1Fv+qyfkHQ98kef3BjyCT4Qsf3iGifjs1OcV9X FlSCOOMsxWT2ytjkVoTRTKCCHtg+oG0x+PFI9EI8C7JiRZJCJitwl1edPKBLs7YjejmJ v2kT1JPVok+McJpg09TTSW8J1fD3dHPFVm/52Ac0Xmxs8VYAwLmOpGPaq2PayvKIZui+ AEl3NBAZHZdKf87RZ9xs7W/Vv27VwGuUpAMLc7lM6wUK967ELkl59YR9U95yGt5ExzXZ RS4rtKMCiUkApikMa83SC2Nk6WznQqD74iwQAiNTtP0KsRX3UUJCLLb4FeeKN1ZvXxLj uGFw== 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=UUzR53P+U+B2TZv34c86cEctXAOM6cbvhEfI8pz1o4M=; b=MqsoQkyRaMsFQlNewpxynN7hBQi8Ba+l26IVM2l8lLal+lGdNne+AAicxVe2512KL0 hR6kxpLZ1G6CfJgeRiwxunCa+zZBwin9zWYY499xuoRGZBR9Cgt1Jf3RzuE/nUcHNCgB vEuv5J4hVNMkafxwvv8jtXOHL70x3LIBjbBWlgejPs/qMBMETm+1n7ppgNAgVRKlF66k FQ2GTKagMkamlFyVxyOqoa66vfbdMyhVmrAHOcWAGxgVmUMOxvJ6mc6KS3PJCxiSMFft cznkRTqVDF47k8IGSvhuU5XKSc2MflFisAt0eSVdBb3DUAR4Pxso69Fm1WzVJgE4alc+ iP0w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=TPltwl0r; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 e67-20020a636946000000b0046eb0e3b1a0si6783882pgc.146.2022.10.22.03.12.22; Sat, 22 Oct 2022 03:12: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=TPltwl0r; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S229783AbiJVKLw (ORCPT + 99 others); Sat, 22 Oct 2022 06:11:52 -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 S230181AbiJVKLd (ORCPT ); Sat, 22 Oct 2022 06:11: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 2AE464F38B; Sat, 22 Oct 2022 02:28: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 3ED8EB82E3E; Sat, 22 Oct 2022 08:07:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7CCA2C433C1; Sat, 22 Oct 2022 08:07:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666426056; bh=9mM2KpCgp5FXSp4BZ4kUo6ES9NP7bd+VPnmOcTLJj00=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TPltwl0rFoBeJl7KTDysQAmbtDBpOWSCtIzUDG7/5GnZBLg6LcsYw1qqzQpZCtvMP cUEsrWkKgd7SKLJJkRznJIawSVdDhksXJb+B5EM11TVDCne/bW9vZKkKKfzyfwZrAq OFWA7MOvuBL5qVsIc45Kl07oKB0nGmqjrp8ms8CA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sherry Wang , Hamza Mahfooz , Aric Cyr , Alex Deucher Subject: [PATCH 5.19 704/717] Revert "drm/amd/display: correct hostvm flag" Date: Sat, 22 Oct 2022 09:29:43 +0200 Message-Id: <20221022072529.586530106@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 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?1747382231438958327?= X-GMAIL-MSGID: =?utf-8?q?1747382231438958327?= From: Aric Cyr commit 96ab3cb3b0f862308a03046d01d66c7b4154846b upstream. This reverts commit 796d6a37ff5ffaf9f2dc0f3f4bf9f4a1034c00de. 4K144 resolution isn't available on DCN31. Reviewed-by: Sherry Wang Acked-by: Hamza Mahfooz Signed-off-by: Aric Cyr Signed-off-by: Alex Deucher Signed-off-by: Greg Kroah-Hartman --- drivers/gpu/drm/amd/display/dc/dcn31/dcn31_resource.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/gpu/drm/amd/display/dc/dcn31/dcn31_resource.c +++ b/drivers/gpu/drm/amd/display/dc/dcn31/dcn31_resource.c @@ -892,7 +892,7 @@ static const struct dc_debug_options deb .enable_sw_cntl_psr = true, .apply_vendor_specific_lttpr_wa = true, .enable_z9_disable_interface = true, /* Allow support for the PMFW interface for disable Z9*/ - .dml_hostvm_override = DML_HOSTVM_NO_OVERRIDE, + .dml_hostvm_override = DML_HOSTVM_OVERRIDE_FALSE, }; static const struct dc_debug_options debug_defaults_diags = { From patchwork Sat Oct 22 07: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: 7781 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1121497wrr; Sat, 22 Oct 2022 02:28:46 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6dOsbr1xMPz1TWh6fiYnBeZ1ZEmEBmsT6MB47Kma2bMcD+s26YFPb/qvw1oXqnxFwZznse X-Received: by 2002:a17:903:2490:b0:17f:bf7e:c521 with SMTP id p16-20020a170903249000b0017fbf7ec521mr23312408plw.161.1666430925987; Sat, 22 Oct 2022 02:28:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666430925; cv=none; d=google.com; s=arc-20160816; b=FHSUddBx/BtGxfI0XfoHGcr+rvowqmsBLkAlGCP19rFipgENwBOiJC+JTZqj5K4kOc 88DJgzBa7G4X/prisYophT9nnrEsFcoUDXB1TgfJT4GrntJ6RsCEYYKTcy5GIrXiG8pJ hJ9fTBHUfvcEXRS0PXPCQ36DpqUUYd5UrLxIZGZM4vs3YJ77SbiDv1k1uFE4rVc3+FWO W/1ue0Mw0a3TIcjrB11TE9ZESiS26ITqJTnr5pEKzvSUQrc9sYqFmuoG3uMjF8vGpPxT bvGlbo/cFuR+zpHBPeSXdpzP6F4jZHGUxjlDhdDAdnfPPvjyJXpi0vtRby6Hf1lqG4zG uBzw== 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=nMJgdHT//sk6P9l3GtimaUZXH38U6bYfUMEFfCXiD6I=; b=bZ1rDYZg+tt9oCiaaDSB+b4xJ5uHWdmthluZ+LGp1w/H1LAKCi5fCwEr5xX2vx/oVh 9zLrRpXbY0CSDRx4/W4PbOYu4TIASWo4yW4YDD/CD6C+YwdUSm5AwyoFxQmlbqngMqJP oX4e5m7Zlui22KHevnMx9mxRjgJ1nuZjzfRVXXxCmy+fbs/10S25Wk+i6eP6s5ghAPIe X1w5VtNWB8+fwRRbq8M+TUAEDnGgITVaTkTqRFQuPvvZ6RTv9LhcUMcx0JTxWpBwG+zT 48W4ZSQw6fI0OQb0XiORsB3lezY1m4VV8URjbQXZlCLxCqUpCvl5Oy9Fpjvwcr+23b3W oIaA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=tPpJ7uzJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 x10-20020a170902ec8a00b0016f5e7d0febsi33261222plg.244.2022.10.22.02.28.33; Sat, 22 Oct 2022 02:28: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=tPpJ7uzJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S232097AbiJVJGH (ORCPT + 99 others); Sat, 22 Oct 2022 05:06:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50086 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234135AbiJVJEj (ORCPT ); Sat, 22 Oct 2022 05:04: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 C2A891B7B0; Sat, 22 Oct 2022 01:19: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 BEAF760B9A; Sat, 22 Oct 2022 08:07:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 85AA5C433D7; Sat, 22 Oct 2022 08:07:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666426060; bh=cevrSgJp5/K+gljJsjmLJh8wwK0TipvFRgrsfKwaDf0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tPpJ7uzJ2RkAWj6iMiy3s/mFIilAvBVFXLjS1hUzrw/9mg89n6S+O8PNZquHnzHFk pAWhbKBeNSNPKpvfE1yHgaytNPwnCYXE+/WPOOOkLsglWJN6RWAl/9tx9urUNH/LHt PpApmNtx/vWnS2SvJuCWrBTO3++gPDyOJeIkMZGE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alexander Aring , Stefan Schmidt , Sasha Levin Subject: [PATCH 5.19 705/717] Revert "net/ieee802154: reject zero-sized raw_sendmsg()" Date: Sat, 22 Oct 2022 09:29:44 +0200 Message-Id: <20221022072529.625640698@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747379474719091548?= X-GMAIL-MSGID: =?utf-8?q?1747379474719091548?= From: Alexander Aring [ Upstream commit 2eb2756f6c9e9621e022d78321ce40a62c4520b5 ] This reverts commit 3a4d061c699bd3eedc80dc97a4b2a2e1af83c6f5. There is a v2 which does return zero if zero length is given. Signed-off-by: Alexander Aring Link: https://lore.kernel.org/r/20221005014750.3685555-1-aahringo@redhat.com Signed-off-by: Stefan Schmidt Signed-off-by: Sasha Levin --- net/ieee802154/socket.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/net/ieee802154/socket.c b/net/ieee802154/socket.c index cbd0e2ac4ffe..7889e1ef7fad 100644 --- a/net/ieee802154/socket.c +++ b/net/ieee802154/socket.c @@ -251,9 +251,6 @@ static int raw_sendmsg(struct sock *sk, struct msghdr *msg, size_t size) return -EOPNOTSUPP; } - if (!size) - return -EINVAL; - lock_sock(sk); if (!sk->sk_bound_dev_if) dev = dev_getfirstbyhwtype(sock_net(sk), ARPHRD_IEEE802154); From patchwork Sat Oct 22 07: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: 7709 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1109484wrr; Sat, 22 Oct 2022 01:48:45 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4boGErbF0uOF4lkJ9a0mjFt2AT0HoLUMjHir6sgZVTtRFR6ZjJi35svi6nrzQMYJkArxmc X-Received: by 2002:aa7:c58e:0:b0:461:77b:7bd with SMTP id g14-20020aa7c58e000000b00461077b07bdmr10464853edq.387.1666428525343; Sat, 22 Oct 2022 01:48:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666428525; cv=none; d=google.com; s=arc-20160816; b=e7GX4YDP/TgrlxPwzw61Bn2DlwSulZEhUkCVZGO33XbjsSFz1di2h+inZbz9vCwZL8 ZF510+UYOR3AlYF6bR/6imZ6yQ2eGO32SL+VKsElc/LP3RImdviFYafp23mX7DHEs8Dp BajiQu8peMIIsba2qsnGo7Zf8wUAy+5kBsoeI+Z3JspvCSpZTGA1CZUPKhS+gYutOUBp HH8h1CBCF1hEOM8O/56jDal2HK8XJlGp+TUDcYkoTtOen/55gIcqVHYx+itULJFjXKxi igjvNeHfBtuDEa8CKTs9SeJkAFMWo5mzr0EOuIyBKHlN8TKdvC9W+SYF85kSOpzmriDR geVg== 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=T7VFqri3vWZMyD1Z23N5CPaysfrStChxZB418zLMELk=; b=oVMhkqJo+eXaP2QtRMUWuGOvcOqtpdC7qBYhiX11GOVyOFT89gFQ9qLWb3RTbXNw3D m6TqhuFgdWVFuKhKh92Xn1Yusba69Mm+D9r0JiHtiWdVB+qZkfx8mOIxBZMSRbBYD9UZ DDXfy1ofF5vhM+lexjrzmY5JPOlEZ8sscQmca09Q3jfRGeXpAjSk1wgjYXhZaWU0/I/A uthHl6piiRFwDwmaUgpGeeh/e3z3PC5x6AdXyeeq7PLGACOMXE0/dUQNUeSB0SOVaHCV xpvF+AUVAkl33WoSbc2riVq2A/YiooMt12GyTmXHh6WZmbkSrX2lhu5ZFHXnLT2355PE P3EA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=yOa0tD1U; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 g12-20020a1709065d0c00b007707ab4be23si23920783ejt.560.2022.10.22.01.48.21; Sat, 22 Oct 2022 01:48: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=yOa0tD1U; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S234186AbiJVIry (ORCPT + 99 others); Sat, 22 Oct 2022 04:47:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52894 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235238AbiJVIpA (ORCPT ); Sat, 22 Oct 2022 04:45:00 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5E5C32CB8D1; Sat, 22 Oct 2022 01:09: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 C698060B76; Sat, 22 Oct 2022 08:07:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B81EDC433D6; Sat, 22 Oct 2022 08:07:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666426063; bh=yYS4ckK6yz5zGnPL/ph/3qIwybyY33znX9KX1T7WhTI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=yOa0tD1U43dhQVu+VkD/OXCUM2P2bNWlq4+nv8lQb/R2rpmXo1u4mE4v4LVc5HK6s LEFJ8DsIezziScAZMmCNIHvo7O1xozo116h/LuuiNMYbYOOzyqnPIEr+lyyQcU6J54 FMCuf6nkQRtz+zPpByCmG4tbj/elzvpZU3mnWMr4= 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 5.19 706/717] net/ieee802154: dont warn zero-sized raw_sendmsg() Date: Sat, 22 Oct 2022 09:29:45 +0200 Message-Id: <20221022072529.669043843@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376957344599777?= X-GMAIL-MSGID: =?utf-8?q?1747376957344599777?= 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(+) diff --git a/net/ieee802154/socket.c b/net/ieee802154/socket.c index 7889e1ef7fad..6e55fae4c686 100644 --- a/net/ieee802154/socket.c +++ b/net/ieee802154/socket.c @@ -272,6 +272,10 @@ static int raw_sendmsg(struct sock *sk, struct msghdr *msg, size_t size) err = -EMSGSIZE; goto out_dev; } + if (!size) { + err = 0; + goto out_dev; + } hlen = LL_RESERVED_SPACE(dev); tlen = dev->needed_tailroom; From patchwork Sat Oct 22 07: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: 7800 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1133456wrr; Sat, 22 Oct 2022 03:04:36 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6QaIJmP/6294SJdUcFnmy4tIAkC9IvG9vwwxKzqPLcuH6q5OtG+B6x3ToD5A/BKCPief/H X-Received: by 2002:a05:6a00:843:b0:563:fd4:d73 with SMTP id q3-20020a056a00084300b005630fd40d73mr23568805pfk.47.1666433076445; Sat, 22 Oct 2022 03:04:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666433076; cv=none; d=google.com; s=arc-20160816; b=odpPCB7TtRtz6QhCB30AgTTVJw1TohmjvHsoioRDSQTSMawHacbOHoKQ0TOGS2S4GR d2EOs20R0/d7gr934ZD084S7yCqaNuw0aXuWQroLIa7xaBkciUb83F1roTu0S7nnW2FA au/3LTG7nVOAEqY/mB8MUTR21uK9e0f0C0hLKr/8UcX3pwGoHOgsBmRVnGBnCM8H60Tr smiuvikpULKvhRkOHpy7lRBZWUMBqGwP0Kftmewe+2wJbETo2lEm3LBdjCyNRiuVLgHj ua6ZJjW9ymJhnEQeOIPwDVbA72r0BSis/yftNafzkDtlo7d7x0cd7ZEQXKWCvAj8qMxW R5hA== 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=7qLPlh+qY61Vg0AVqBdPPqLOxPS0TKWJgcCBAzrOCvM=; b=EwhVTt10YLItkpURE4ffZww4gtua65WWRr4V3bcvFqpWQJTSQsDKcijYp6+7gA5PyP gfhehdSr3evAb/IZXfYQTnt0Aa3pj7JEAvVCYsbnNJvoOPxwhVNljuG7I3PDYislEhJr CCdU0XLqGwKYVJ2m7yapAhv4rzxBB3KRiTMOuP+PgzHxlH+sPRBBbfgnwVQlAn45aaq1 6aOZ9ROGBT0Q3MeQQFV3QDFIjcdIeN0Tub5uU4/tf7orojhRqS+YvCuuT43FgEYVflrp rIKVXsal9652pXUnXuTqu4tlcRjAmoo08o2ZrRBOj/S4/IcTzP16U/GWVJenWn1Gs6Sf UhMg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=fefuh4Dg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 z5-20020a63c045000000b0043af57e5d16si25611970pgi.724.2022.10.22.03.04.22; Sat, 22 Oct 2022 03:04: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=fefuh4Dg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S229574AbiJVKAM (ORCPT + 99 others); Sat, 22 Oct 2022 06:00:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54328 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230157AbiJVJ7o (ORCPT ); Sat, 22 Oct 2022 05: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 2BDB241523; Sat, 22 Oct 2022 02:14: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 C026860BA2; Sat, 22 Oct 2022 08:07:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B09DBC433D7; Sat, 22 Oct 2022 08:07:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666426066; bh=0fvtEFI43QThxu2xB2MBCAmBh4JcfuNcBuF2dhDcgv4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fefuh4DgUy9JFXTL2te6slUHKb/QL3QRl5hyrZx5KQQDHHDz3C+JlQGMSIQoiFRji OuKAPRgnrFzDLRaaG4IbdZ7mhA8QPYXQSblA+203GY7eKxrsMZWkBkVQgq3XJnDwux RcoSp/r39F5EHGBp33mZrnEAcReRNZsT3SyIGe08= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sachin Sant , Guenter Roeck , Nicholas Piggin , Michael Ellerman Subject: [PATCH 5.19 707/717] powerpc/64s/interrupt: Fix lost interrupts when returning to soft-masked context Date: Sat, 22 Oct 2022 09:29:46 +0200 Message-Id: <20221022072529.720783758@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 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?1747381729674135673?= X-GMAIL-MSGID: =?utf-8?q?1747381729674135673?= From: Nicholas Piggin commit a4cb3651a174366cc85a677da9e3681fbe97fdae upstream. It's possible for an interrupt returning to an irqs-disabled context to lose a pending soft-masked irq because it branches to part of the exit code for irqs-enabled contexts, which is meant to clear only the PACA_IRQS_HARD_DIS flag from PACAIRQHAPPENED by zeroing the byte. This just looks like a simple thinko from a recent commit (if there was no hard mask pending, there would be no reason to clear it anyway). This also adds comment to the code that actually does need to clear the flag. Fixes: e485f6c751e0a ("powerpc/64/interrupt: Fix return to masked context after hard-mask irq becomes pending") Reported-by: Sachin Sant Reported-by: Guenter Roeck Signed-off-by: Nicholas Piggin Signed-off-by: Michael Ellerman Link: https://lore.kernel.org/r/20221013064418.1311104-1-npiggin@gmail.com Signed-off-by: Greg Kroah-Hartman --- arch/powerpc/kernel/interrupt_64.S | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) --- a/arch/powerpc/kernel/interrupt_64.S +++ b/arch/powerpc/kernel/interrupt_64.S @@ -571,7 +571,7 @@ _ASM_NOKPROBE_SYMBOL(interrupt_return_\s beq .Lfast_kernel_interrupt_return_\srr\() // EE already disabled lbz r11,PACAIRQHAPPENED(r13) andi. r10,r11,PACA_IRQ_MUST_HARD_MASK - beq 1f // No HARD_MASK pending + beq .Lfast_kernel_interrupt_return_\srr\() // No HARD_MASK pending /* Must clear MSR_EE from _MSR */ #ifdef CONFIG_PPC_BOOK3S @@ -588,12 +588,23 @@ _ASM_NOKPROBE_SYMBOL(interrupt_return_\s b .Lfast_kernel_interrupt_return_\srr\() .Linterrupt_return_\srr\()_soft_enabled: + /* + * In the soft-enabled case, need to double-check that we have no + * pending interrupts that might have come in before we reached the + * restart section of code, and restart the exit so those can be + * handled. + * + * If there are none, it is be possible that the interrupt still + * has PACA_IRQ_HARD_DIS set, which needs to be cleared for the + * interrupted context. This clear will not clobber a new pending + * interrupt coming in, because we're in the restart section, so + * such would return to the restart location. + */ #ifdef CONFIG_PPC_BOOK3S lbz r11,PACAIRQHAPPENED(r13) andi. r11,r11,(~PACA_IRQ_HARD_DIS)@l bne- interrupt_return_\srr\()_kernel_restart #endif -1: li r11,0 stb r11,PACAIRQHAPPENED(r13) // clear the possible HARD_DIS From patchwork Sat Oct 22 07:29:47 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 7715 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1109602wrr; Sat, 22 Oct 2022 01:49:11 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5UVEsWiJZ+HNjjn/nCS2xcMnx/1AO/wP+2qFdTrcL8NrXV4hxgQlBfvBJccACnua3JCvR7 X-Received: by 2002:a05:6402:50cd:b0:45d:109d:676c with SMTP id h13-20020a05640250cd00b0045d109d676cmr22147253edb.344.1666428551408; Sat, 22 Oct 2022 01:49:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666428551; cv=none; d=google.com; s=arc-20160816; b=mde4aBKJtHdR4HFS0RCKn3REgjxnq57tCIrPTm4Gs/40LP5JV3KyiG7tzVr3fNPcUz rVKMXOBwNw2IkcQ2A3+YZKJkfxvBv4ty+wrbSb4amcEqQWksDKGqW/k+b3e/xmAtvbyg oAHZJx6FAVo9eSxICV5TS1ZPYrBkfSHqVqwLlxLZR9RwaDyS4aVbuTSdoulsbqIHQsi3 5pWfzuxZBAma9/ldceDz3ZpKp+XmhX3F+6p/PI7o6M0+/NAtg1JmzZcB7e9gJfKZOiUe ZsgHU/ouMDhVLP7KaRtKRpAQWFCKXNJIkBNMZr46rCRU0dfNMVwST+w5/xUhRLh6fnVZ ae/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=leukjDcx3SAGRrbnOmf1kbImZS6XRsLirHkJtGdtbck=; b=Z5/lmfcR/mDgwcSmAm08lansMboiS4TkMnNPSjL2Vo0yHS3Lcc0F/A6FvEvwq8PlRI qFTixNPAKI6165POPoVTZ4oBs4y2qgs9l+8URs1ReW1l3EMnqxLE72M36MKM0K8LOMt8 zyaODwQyG8+rHy72/2zdTL9ZqqK97eQduIk9OW4/q2MYknzMOYHvQtN0/gIGM4f5swmS Ea8lBtyyG2YdEGMml4WfdWiANOK+ypA6AoQALTXn1zZ4bfHmV6ed7qcRIuzzgSD4CRHa daORzyMXmb82qH7RGlWxKtUZBChZXUxoVOUnv9tvH+YGqTM8okRywhcYd6rB4Ir9lkUp 6Zyg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=IkUjp8EI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 b13-20020a0564021f0d00b0046054d6b3a8si6385627edb.302.2022.10.22.01.48.47; Sat, 22 Oct 2022 01:49: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=IkUjp8EI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S234618AbiJVIsN (ORCPT + 99 others); Sat, 22 Oct 2022 04:48:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33236 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235292AbiJVIpK (ORCPT ); Sat, 22 Oct 2022 04:45:10 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C3F042ECF6D; Sat, 22 Oct 2022 01:09: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 B69CC60ADE; Sat, 22 Oct 2022 08:07:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BFB19C433C1; Sat, 22 Oct 2022 08:07:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666426069; bh=b+tvcI6wpnxrBbfyWcd2dsGMGew2N6mThlyt7CAAejc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IkUjp8EIBE5L3MjT0MqwfPFPJpgH9FcwhZ0+jfDF+ZY7otIDtVw0frsnNAHbJSoNX yDIkx6Fieg3RDHx3TWvXNjADiEbI1/sLmAZLm0XoeCuWoSG2gdz3ARDExR7uc+9iO4 FVBtpI39paFcNm6rdOpGVPCqgSJfdoIqloFn2y4U= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Nathan Chancellor , Linus Torvalds Subject: [PATCH 5.19 708/717] drm/amd/display: Fix build breakage with CONFIG_DEBUG_FS=n Date: Sat, 22 Oct 2022 09:29:47 +0200 Message-Id: <20221022072529.772954386@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747376984794352285?= X-GMAIL-MSGID: =?utf-8?q?1747376984794352285?= From: Nathan Chancellor commit 2130b87b2273389cafe6765bf09ef564cda01407 upstream. After commit 8799c0be89eb ("drm/amd/display: Fix vblank refcount in vrr transition"), a build with CONFIG_DEBUG_FS=n is broken due to a misplaced brace, along the lines of: In file included from drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm_trace.h:39, from drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:41: drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c: At top level: ./include/drm/drm_atomic.h:864:9: error: expected identifier or ‘(’ before ‘for’ 864 | for ((__i) = 0; \ | ^~~ drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:8317:9: note: in expansion of macro ‘for_each_new_crtc_in_state’ 8317 | for_each_new_crtc_in_state(state, crtc, new_crtc_state, j) | ^~~~~~~~~~~~~~~~~~~~~~~~~~ Move the brace within the #ifdef so that the file can be built with or without CONFIG_DEBUG_FS. Fixes: 8799c0be89eb ("drm/amd/display: Fix vblank refcount in vrr transition") Signed-off-by: Nathan Chancellor Signed-off-by: Linus Torvalds Signed-off-by: Greg Kroah-Hartman --- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c @@ -9991,8 +9991,8 @@ static void amdgpu_dm_atomic_commit_tail crtc, dm_new_crtc_state, cur_crc_src)) DRM_DEBUG_DRIVER("Failed to configure crc source"); } -#endif } +#endif } for_each_new_crtc_in_state(state, crtc, new_crtc_state, j) From patchwork Sat Oct 22 07: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: 7738 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1110531wrr; Sat, 22 Oct 2022 01:53:09 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7UMYew27AZZX9x1hligS6prssYE1lmkytxSVx5HDhsWkbUrla0EpP5mP0FZ/+FSQroSf7o X-Received: by 2002:a17:906:4fca:b0:78d:b042:eeca with SMTP id i10-20020a1709064fca00b0078db042eecamr18551942ejw.685.1666428789132; Sat, 22 Oct 2022 01:53:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666428789; cv=none; d=google.com; s=arc-20160816; b=Z6e52OHU6GSOE9SD8eCQw2SvfOhwhedhjMswaFw7++3n9R+KyyIbDtAcxKLO+xXnHD iRfCF0Of3E4GKBtU/5C8TyHLwJI52hci5omm6ztirpkFjtRw3Hc4L+aYZxJTx40vEzn+ PHXEbQIV0P9MecpxpWPVmGuC56aEIQoGGdcn+aL6yoxoGrr7C3Woa47/pgI0AN2sMhFF bpXTPNGYYapPySlfZh7x8vYntS+2jMlPlxETffCN4Fsg2D1bv8OY29uxvbnkLOAtHgJb RmSUDggt0HecBTZtJDpE42s6zZFq2L+bRg/loqo4QYcyS2waUpyhGqZEzusPCL1JbEtG drzQ== 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=+I1ggahSoBU9qBmgs9Qavr65lWLPtNk99cIWqYHxDAs=; b=EJHI0ZbAl6Auv/5GHXyS9ttdvqUrKBet3StwUPUx4l/THLNyzNRdODskm2I3wmqT6M I5osxL+kSBtf29ni4R4jBWSEyRKq0Y6IG/sHdKOOH1tWkOlbJNP1JIW/JJ50+NfeTywq Qx6izurcoQ62xZDYYKPfUb6rPXmDE7JB9QTEi4o0hYIovZQvKCNkT0ipkgik+kBoMGfd 4uTKDcdKxGMQHE46lCYSTQ4Rcw7RccBrlNBacIv2gm2+a3qLRpjgbn/rWDvc16GRgoHN Fjb5DyVcIK1T4PPSGKSUGk6PW0h212FM4Yq/J43zkAvLX00ZtXSjv5G5NJvTKm4+1yC3 /Deg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=PdE1wxpJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 e5-20020a17090658c500b0073d8f141e76si16283681ejs.130.2022.10.22.01.52.44; Sat, 22 Oct 2022 01:53: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=PdE1wxpJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S234981AbiJVIvJ (ORCPT + 99 others); Sat, 22 Oct 2022 04:51:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41150 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234963AbiJVItO (ORCPT ); Sat, 22 Oct 2022 04:49:14 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A09461E3920; Sat, 22 Oct 2022 01:10: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 C84E1B82E3F; Sat, 22 Oct 2022 08:07:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C4BF3C433C1; Sat, 22 Oct 2022 08:07:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666426072; bh=I4Y0X1nv5hy0ZnRex9psEdEmaD4dw31+0KM/lFOjzig=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PdE1wxpJrDDeubUdwk3s6Yf/5YgTCk33cgisaHpaO6YlYN5hZJ7MJ6L4xQHanSKcU +ftKHLA0RnejbXVncGjDBxYm9d5E51d0m59AZNtj3T6KON/ayTg8kpH2IDWV/Df/YL Jrt1NnGK5cg+B9ThkgMKiM+IXVB6g8aX4sM0OzH0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Greg Kroah-Hartman , Martin Rodriguez Reboredo , Jiri Olsa Subject: [PATCH 5.19 709/717] kbuild: Add skip_encoding_btf_enum64 option to pahole Date: Sat, 22 Oct 2022 09:29:48 +0200 Message-Id: <20221022072529.817908352@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747377233645348349?= X-GMAIL-MSGID: =?utf-8?q?1747377233645348349?= From: Martin Rodriguez Reboredo New pahole (version 1.24) generates by default new BTF_KIND_ENUM64 BTF tag, which is not supported by stable kernel. As a result the kernel with CONFIG_DEBUG_INFO_BTF option will fail to compile with following error: BTFIDS vmlinux FAILED: load BTF from vmlinux: Invalid argument New pahole provides --skip_encoding_btf_enum64 option to skip BTF_KIND_ENUM64 generation and produce BTF supported by stable kernel. Adding this option to scripts/pahole-flags.sh. This change does not have equivalent commit in linus tree, because linus tree has support for BTF_KIND_ENUM64 tag, so it does not need to be disabled. Signed-off-by: Martin Rodriguez Reboredo Signed-off-by: Jiri Olsa Signed-off-by: Greg Kroah-Hartman --- scripts/pahole-flags.sh | 4 ++++ 1 file changed, 4 insertions(+) --- a/scripts/pahole-flags.sh +++ b/scripts/pahole-flags.sh @@ -20,4 +20,8 @@ if [ "${pahole_ver}" -ge "122" ]; then extra_paholeopt="${extra_paholeopt} -j" fi +if [ "${pahole_ver}" -ge "124" ]; then + extra_paholeopt="${extra_paholeopt} --skip_encoding_btf_enum64" +fi + echo ${extra_paholeopt} From patchwork Sat Oct 22 07: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: 7759 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1118782wrr; Sat, 22 Oct 2022 02:20:25 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5bAMRPcx6QZCuAhQBkOnijJqQ4fATTZRwRa780ndbu7AGGU1g5r1akzKflKZ6mB1SunAZY X-Received: by 2002:a63:4461:0:b0:43c:dbdb:90c4 with SMTP id t33-20020a634461000000b0043cdbdb90c4mr19064960pgk.340.1666430425474; Sat, 22 Oct 2022 02:20:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666430425; cv=none; d=google.com; s=arc-20160816; b=N7CgcUADHkDOjYDjkKZ1uHWwDEpbO/ExgxnroM0MBHVcR/Rbi39jjMWPK+9DyKN+3D t8J0Iq1A/MeZwn3sMT4ZnAMWFVhHpNYQngTpeJquCMRowiM2AzAwIVZK5YjMz4xaZgpc /L0j6c4eUMwwqwmDjaB9Y5IxsMF4CliTrJiNV+dU++tYyN0mgP+7+yYtkD7ubu//Dt1B SlqY+LYy9OGepZa5ooksGQ6b2UtW4Q1jn0RqvH0jUa7qghoTIf4CGAEkTzDclt1YOkLO VvBQL86eKznc8frb3Nbe1oP506hPKrhf6OBosAv3OfSOycY9SKYz2aKRwm/WH344kBlT o8UQ== 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=vcGT7GhWP1SxoEl4/QEapGsTSLdDu7laD1vx7Yqcj/s=; b=eoxPltjmNKfjk/idk/eaHa/ffhNBOYl9M3/bCxlhqBFhJvHFhtbJ0qi5WshCRuyvKS 5WFuka/w6DXHkGlRHLPldSAcwuMgwjcsTKoXtU770MgqYJ7RECleknaL/aS6aIqTlDxB TWoJjJTjZqIeJ3FcTqs9mVFq9ofPeS0MW+8YfDnBk00E6ceMlRJ44BvEcmuc8kjXVRcb uIdZ0wJytW7cS81FJK9mC5bEoIaDhkKARXY0a/iIwNC994fl8E1bhDKZbhV6vPrRymAz sAJON9qE0oLaPMmwL8x9CXm6b2yjvThBlGJW/i2/vScNQ+GLPuyn3+5jqVz4fNUXZ/CH iJdQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Xk+pYHp8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 om17-20020a17090b3a9100b001fdb95c743bsi2411514pjb.83.2022.10.22.02.20.12; Sat, 22 Oct 2022 02:20: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=Xk+pYHp8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S233350AbiJVI74 (ORCPT + 99 others); Sat, 22 Oct 2022 04:59:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37042 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235054AbiJVI64 (ORCPT ); Sat, 22 Oct 2022 04:58:56 -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 8479729B8B8; Sat, 22 Oct 2022 01:16: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 14F2460B83; Sat, 22 Oct 2022 08:07:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0B0ADC433D6; Sat, 22 Oct 2022 08:07:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666426075; bh=FYipOXVEh/W6XkjRwrcbJtXg1hEM0/kwaTD3dCXorOM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Xk+pYHp8qgTxP3p5QGmdaIAU/3CE3pV+4Sk67iDpYlByUFumEHpUKNVMIZudwll42 GGaGuL41XKLf+JwePuZGcUCDS2BAgL/ValJIu5oDfq+Mv6yzxniSMFWfUBsGEW3IgG Jo+Z/44vpgGs3sO5PRAs72Qq3D6MxLVTOOBf7XSw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Masahiro Yamada , Nathan Chancellor Subject: [PATCH 5.19 710/717] Kconfig.debug: simplify the dependency of DEBUG_INFO_DWARF4/5 Date: Sat, 22 Oct 2022 09:29:49 +0200 Message-Id: <20221022072529.869510319@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747378949651563134?= X-GMAIL-MSGID: =?utf-8?q?1747378949651563134?= From: Masahiro Yamada commit 4f001a21080ff2e2f0e1c3692f5e119aedbb3bc1 upstream. Commit c0a5c81ca9be ("Kconfig.debug: drop GCC 5+ version check for DWARF5") could have cleaned up the code a bit more. "CC_IS_CLANG &&" is unneeded. No functional change is intended. Signed-off-by: Masahiro Yamada Reviewed-by: Nathan Chancellor Signed-off-by: Greg Kroah-Hartman --- lib/Kconfig.debug | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/lib/Kconfig.debug +++ b/lib/Kconfig.debug @@ -264,7 +264,7 @@ config DEBUG_INFO_DWARF_TOOLCHAIN_DEFAUL config DEBUG_INFO_DWARF4 bool "Generate DWARF Version 4 debuginfo" select DEBUG_INFO - depends on !CC_IS_CLANG || (CC_IS_CLANG && (AS_IS_LLVM || (AS_IS_GNU && AS_VERSION >= 23502))) + depends on !CC_IS_CLANG || AS_IS_LLVM || (AS_IS_GNU && AS_VERSION >= 23502) help Generate DWARF v4 debug info. This requires gcc 4.5+, binutils 2.35.2 if using clang without clang's integrated assembler, and gdb 7.0+. @@ -276,7 +276,7 @@ config DEBUG_INFO_DWARF4 config DEBUG_INFO_DWARF5 bool "Generate DWARF Version 5 debuginfo" select DEBUG_INFO - depends on !CC_IS_CLANG || (CC_IS_CLANG && (AS_IS_LLVM || (AS_IS_GNU && AS_VERSION >= 23502))) + depends on !CC_IS_CLANG || AS_IS_LLVM || (AS_IS_GNU && AS_VERSION >= 23502) help Generate DWARF v5 debug info. Requires binutils 2.35.2, gcc 5.0+ (gcc 5.0+ accepts the -gdwarf-5 flag but only had partial support for some From patchwork Sat Oct 22 07: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: 7855 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1158114wrr; Sat, 22 Oct 2022 04:19:35 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5S/dd3an16EBYNPLH++wc0cPd1LmncdkX4L0O2sfrTsU3GCCBxjLZHUHbGxwgGzJzElwgS X-Received: by 2002:a65:4084:0:b0:463:aa4:49cf with SMTP id t4-20020a654084000000b004630aa449cfmr19885476pgp.164.1666437575348; Sat, 22 Oct 2022 04:19:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666437575; cv=none; d=google.com; s=arc-20160816; b=wVaOp45zDC/WJGpxep75ye8s8mJrnSNl5IFPVI5zQ4wtPfdNns81uVOPalEjLpTsfJ 1B2ucgE/FFMlLjfxzUYSwHGhxvZE0X3f3Ep265IO0dZC85tEES/V5f6mXlXIM8+akoLQ 042zzqZxEDEIVbZRUlWYBI15FOjags2NW5OCURoo+JPVjPk28lQdAdzh3X+ZnCxmn5NT dMI1/HI14OEOnjqMl9+v20F41og9Qme7SNtCdIrtN3MvK5lODseZpXds3IukRuQN5YYj PwAfvU5I/cli/KEt8cnPVRjVVODE3dCA3QB1nYKRH+bwkuZc5B5od27pVcMoIerOBfc2 D+GA== 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=dSP/WekZqdVNZMemNmsPhTMxr56aGuBQzy47HhWw5XA=; b=kdOWqdgLxJqwVI0gg5Bo8XUXD89F4t6IVHGN7rEiV9S82xRhbof7gjc0shCeYloHym Y7UrvSR0L/rq1STH1h9e9EtAikUGcGEbqRdk/pj6rzzbVW/6RsXxK0HqlPhdwWK84Z0s /uwOxqNKTxQXlGkEA1eEolEoNH3P+h8VEiZ7+wG7bby3Ryb42DJfK/pbkhCc+KYdb7qA DWMFofCJO/lsbzFzbF9t6NSwVaPtRAFubdc2FYQddXYXck9iDwZ8HMXGPV1Z2j9I/eF+ 22He0kvAep81ISDlRaaQKJdC+r9JkiJMJBpOTbpTY0ZMwlqRXOBHUX+AIZWTF0aos50h /2Jw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="1DU/QBD8"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 p16-20020a056a000b5000b00565db76831esi28873545pfo.62.2022.10.22.04.19.22; Sat, 22 Oct 2022 04:19: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="1DU/QBD8"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S230503AbiJVLRD (ORCPT + 99 others); Sat, 22 Oct 2022 07:17:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53968 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231194AbiJVLQi (ORCPT ); Sat, 22 Oct 2022 07:16: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 5397C27FEAF; Sat, 22 Oct 2022 03:41: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 9496CB82E1D; Sat, 22 Oct 2022 08:07:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id ECACBC433C1; Sat, 22 Oct 2022 08:07:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666426078; bh=nWENc6DvF0ptLyQFnc1HPQI6T98w4ylTIBF7MVi5LmY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1DU/QBD8c949Kk86HHVnPK4p3egAKHGnNxytTW+0XTskISS96Twq/CPEvgbQURtxK l+qPRfLto/R+3seIgtscz7RxyJsOXdQh2BmBmYg3+6k0xnTl5exX3halDRyi+iMQ// jokNGW+HipGnf/k1aKT8HmZBEaGOAD2zBrgRupKE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Masahiro Yamada , Nathan Chancellor Subject: [PATCH 5.19 711/717] Kconfig.debug: add toolchain checks for DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT Date: Sat, 22 Oct 2022 09:29:50 +0200 Message-Id: <20221022072529.902430182@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 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?1747386447256683366?= X-GMAIL-MSGID: =?utf-8?q?1747386447256683366?= From: Masahiro Yamada commit bb1435f3f575b5213eaf27434efa3971f51c01de upstream. CONFIG_DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT does not give explicit -gdwarf-* flag. The actual DWARF version is up to the toolchain. The combination of GCC and GAS works fine, and Clang with the integrated assembler is good too. The combination of Clang and GAS is tricky, but at least, the -g flag works for Clang <=13, which defaults to DWARF v4. Clang 14 switched its default to DWARF v5. Now, CONFIG_DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT has the same issue as addressed by commit 98cd6f521f10 ("Kconfig: allow explicit opt in to DWARF v5"). CONFIG_DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT=y for Clang >= 14 and GAS < 2.35 produces a ton of errors like follows: /tmp/main-c2741c.s: Assembler messages: /tmp/main-c2741c.s:109: Error: junk at end of line, first unrecognized character is `"' /tmp/main-c2741c.s:109: Error: file number less than one Add 'depends on' to check toolchains. Signed-off-by: Masahiro Yamada Reviewed-by: Nathan Chancellor Signed-off-by: Greg Kroah-Hartman --- lib/Kconfig.debug | 1 + 1 file changed, 1 insertion(+) --- a/lib/Kconfig.debug +++ b/lib/Kconfig.debug @@ -253,6 +253,7 @@ config DEBUG_INFO_NONE config DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT bool "Rely on the toolchain's implicit default DWARF version" select DEBUG_INFO + depends on !CC_IS_CLANG || AS_IS_LLVM || CLANG_VERSION < 140000 || (AS_IS_GNU && AS_VERSION >= 23502) help The implicit default version of DWARF debug info produced by a toolchain changes over time. From patchwork Sat Oct 22 07: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: 7733 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1110195wrr; Sat, 22 Oct 2022 01:51:39 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4+kmFo1+mjtBFWBfSozpq9cIr97iwM45PG0Jis7BwUzBC7yc/PhelygrbjEuBmbGuixy0n X-Received: by 2002:a05:6402:1d86:b0:457:e84:f0e with SMTP id dk6-20020a0564021d8600b004570e840f0emr21131421edb.241.1666428699724; Sat, 22 Oct 2022 01:51:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666428699; cv=none; d=google.com; s=arc-20160816; b=xEuKSf2LiA1v3G/vt3fXoqhAGFjb7Yg5e0Qd5Z8lxCKefpsAMOpqM55sFGgDO6Ysx0 fL3bkAW73d8J7d5um5a1y7O3APmfrvWeyLQSag5sFRgqie1UCbrdsL0xqZRjDGQJl9Z7 f2Fsb5LzrrVqr2m0UBlwf06lWm2GXucZAgJR2PAppA0qaNft9LEsKuZqvd8+bRk3TXBg fcxmOgYwDW34l3uqKkUV3wr9q4tSKzd0H9Qf5Sms/1myQW9Wz29QGr727KpC5sVnEC1y mooTfeoIEVRnacA1QPGbkNEZ4x3U9djrRTczkMHHACCNsB1mK8ItIue5qaCsBxxflshh P0pg== 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=gEXdejJfQmrxPYr9JOX8OPpO9WnXqVJ8F6fxO6eXNGU=; b=BM0Qidkf/L3yEYagilZ9XMH0b22FlZLVAT6lzYfu3qO1cVIJ0Y1KgaWFqfdlAS90Ad po0OzFj0EhD36cJPaW22RpZ708kjKlB9Ayik6J0pUyIRkhnfAhx1hU7ndOUTdXgLsqTh QkDE700xfhylF54dYbsczrW7KqEm37lJYqcjNrvB3TJCqNbfTjOY3BZMPPRGo9VR9O1z FytSFnmjS82FL8Fx6knUQVXCF4cNRAmE7X3NvrxV42tFmLfDeUvb9k0wg+hG3fX5SVyj rCqSfNXzSX8yrH2QWax0Ct8WjSJUZkA+NRxNO0Qv/f5U39CQUOJDaT9IGnUCY3IL4es6 5dAA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=M74X4bZy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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-20020a056402349600b0045cea9cf231si25778443edc.566.2022.10.22.01.51.14; Sat, 22 Oct 2022 01:51: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=M74X4bZy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S234929AbiJVIun (ORCPT + 99 others); Sat, 22 Oct 2022 04:50:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36526 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235094AbiJVItf (ORCPT ); Sat, 22 Oct 2022 04:49:35 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D70CD28C318; Sat, 22 Oct 2022 01:10: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 813E9B82E0C; Sat, 22 Oct 2022 08:08:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CF247C433D7; Sat, 22 Oct 2022 08:08:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666426081; bh=QexgGbePdpSUxSJVDrDa2mgDst0/2mVL7ZvWwc9hdg0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=M74X4bZyZuggXw6RsyOJBxG+/4oh3fDNYP81PyjBDHT/Sxsu9MmVoyNqSpx1IrMqM IG5v/3q/6hPAYw4m5OCWgZ3/NzJ4N0sdMFXs2mZP5XSxfTL4ciSwSI0PcLvEPDyyG6 czfF34bD1WVQ28vMRYTH8ZH5eStvdrNioU6H+Jvc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Nathan Chancellor , Nick Desaulniers , Masahiro Yamada Subject: [PATCH 5.19 712/717] lib/Kconfig.debug: Add check for non-constant .{s,u}leb128 support to DWARF5 Date: Sat, 22 Oct 2022 09:29:51 +0200 Message-Id: <20221022072529.954572792@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747377140666985597?= X-GMAIL-MSGID: =?utf-8?q?1747377140666985597?= From: Nathan Chancellor commit 0a6de78cff600cb991f2a1b7ed376935871796a0 upstream. When building with a RISC-V kernel with DWARF5 debug info using clang and the GNU assembler, several instances of the following error appear: /tmp/vgettimeofday-48aa35.s:2963: Error: non-constant .uleb128 is not supported Dumping the .s file reveals these .uleb128 directives come from .debug_loc and .debug_ranges: .Ldebug_loc0: .byte 4 # DW_LLE_offset_pair .uleb128 .Lfunc_begin0-.Lfunc_begin0 # starting offset .uleb128 .Ltmp1-.Lfunc_begin0 # ending offset .byte 1 # Loc expr size .byte 90 # DW_OP_reg10 .byte 0 # DW_LLE_end_of_list .Ldebug_ranges0: .byte 4 # DW_RLE_offset_pair .uleb128 .Ltmp6-.Lfunc_begin0 # starting offset .uleb128 .Ltmp27-.Lfunc_begin0 # ending offset .byte 4 # DW_RLE_offset_pair .uleb128 .Ltmp28-.Lfunc_begin0 # starting offset .uleb128 .Ltmp30-.Lfunc_begin0 # ending offset .byte 0 # DW_RLE_end_of_list There is an outstanding binutils issue to support a non-constant operand to .sleb128 and .uleb128 in GAS for RISC-V but there does not appear to be any movement on it, due to concerns over how it would work with linker relaxation. To avoid these build errors, prevent DWARF5 from being selected when using clang and an assembler that does not have support for these symbol deltas, which can be easily checked in Kconfig with as-instr plus the small test program from the dwz test suite from the binutils issue. Link: https://sourceware.org/bugzilla/show_bug.cgi?id=27215 Link: https://github.com/ClangBuiltLinux/linux/issues/1719 Signed-off-by: Nathan Chancellor Reviewed-by: Nick Desaulniers Signed-off-by: Masahiro Yamada Signed-off-by: Greg Kroah-Hartman --- lib/Kconfig.debug | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) --- a/lib/Kconfig.debug +++ b/lib/Kconfig.debug @@ -231,6 +231,11 @@ config DEBUG_INFO in the "Debug information" choice below, indicating that debug information will be generated for build targets. +# Clang is known to generate .{s,u}leb128 with symbol deltas with DWARF5, which +# some targets may not support: https://sourceware.org/bugzilla/show_bug.cgi?id=27215 +config AS_HAS_NON_CONST_LEB128 + def_bool $(as-instr,.uleb128 .Lexpr_end4 - .Lexpr_start3\n.Lexpr_start3:\n.Lexpr_end4:) + choice prompt "Debug information" depends on DEBUG_KERNEL @@ -253,7 +258,7 @@ config DEBUG_INFO_NONE config DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT bool "Rely on the toolchain's implicit default DWARF version" select DEBUG_INFO - depends on !CC_IS_CLANG || AS_IS_LLVM || CLANG_VERSION < 140000 || (AS_IS_GNU && AS_VERSION >= 23502) + depends on !CC_IS_CLANG || AS_IS_LLVM || CLANG_VERSION < 140000 || (AS_IS_GNU && AS_VERSION >= 23502 && AS_HAS_NON_CONST_LEB128) help The implicit default version of DWARF debug info produced by a toolchain changes over time. @@ -277,7 +282,7 @@ config DEBUG_INFO_DWARF4 config DEBUG_INFO_DWARF5 bool "Generate DWARF Version 5 debuginfo" select DEBUG_INFO - depends on !CC_IS_CLANG || AS_IS_LLVM || (AS_IS_GNU && AS_VERSION >= 23502) + depends on !CC_IS_CLANG || AS_IS_LLVM || (AS_IS_GNU && AS_VERSION >= 23502 && AS_HAS_NON_CONST_LEB128) help Generate DWARF v5 debug info. Requires binutils 2.35.2, gcc 5.0+ (gcc 5.0+ accepts the -gdwarf-5 flag but only had partial support for some From patchwork Sat Oct 22 07:29:52 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 7735 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1110319wrr; Sat, 22 Oct 2022 01:52:13 -0700 (PDT) X-Google-Smtp-Source: AMsMyM60QGf/iH/vzZam1Lh/qnqPZvT+TJ3sQrxgJzBvjYmHe9NQwB5FL0KqHQaMV03skXMsS7D6 X-Received: by 2002:a05:6402:358e:b0:45c:aa8b:f7e9 with SMTP id y14-20020a056402358e00b0045caa8bf7e9mr21461078edc.33.1666428733539; Sat, 22 Oct 2022 01:52:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666428733; cv=none; d=google.com; s=arc-20160816; b=F9cMNdB38reveZaMplkerfZH9ZtOs8gYuXX5v28aXSdlTMUmuCzUGHafhQ0p8E4ws7 1biUD9d+PXN8WEAuAjrs5GY4XqV7956/cmJ0ZSEwNp2NgWQs7UNBpfcmoWZnO8NyhiiY AOOWl3Qfv3fiYxMUINVIaUdKEpQNpQcR/+pAZsN2w2hE4LE8cpxENUYfXPjAKlugFEt2 rzkABBk8yUVIyg2RzHR5xb+5dQGzoR4S8AnAtD7luxCSKb65EjNc6oI8M5VuYMhtIqrS 7dASvYyh0uOHBAFJDHtG52EP7fnh9I83zsew6navAIdlUx7OC5I9cEwCKcViZzXKw6S4 KEPQ== 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=LUZpSS3F/J9GvaNLVmavrxSqSTqBGYnpz0YIacWVlj0=; b=IEZGaBDGsoRlPdUywEceafX0Bi61833ohEOpqH8mDgxl4OtUxOppPVZqktb5pyEnZN 7EFG+wwu44lRbr3BKuk2cmFWCHXoZD5zgchZ0+61BsWuLQQit9s+0poVOuuYxlu7tHrF iPXGBnR1bQ1sK9gEsYA54Xlo4LQsK2atW+Wuai8WCJosUKI/U+2WPBJ4o5iSyIkg1BdQ htth0w3CJ/hJ3A8jUof4Swe29JRMDlz6XT/6blbisH4/D9Sg9g1QNusnVF5c0cCc+98Y piPPe5iDXyPmvnb+1Z+64TX51yrZ3fv0bpCgI8Jl72hd/9v6VbYIgKIGsifoRkIZohSf cYKg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=U880E7Bf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 dm12-20020a170907948c00b0078a802cce5dsi10493269ejc.592.2022.10.22.01.51.49; Sat, 22 Oct 2022 01:52: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=U880E7Bf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S234938AbiJVIur (ORCPT + 99 others); Sat, 22 Oct 2022 04:50:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36494 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235183AbiJVItz (ORCPT ); Sat, 22 Oct 2022 04:49:55 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 852F1277A1D; Sat, 22 Oct 2022 01:11: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 82C9CB82E40; Sat, 22 Oct 2022 08:08:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CF05EC433C1; Sat, 22 Oct 2022 08:08:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666426084; bh=30oaRr/+0z675hWSv80pGu8HA4e+AOyozO+DFfi9qj8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=U880E7BfUUzLXmJsSAaaopKJqy3ZJfwYqIQdmf6VuXQ89FyPHteK/vFWURkP+aj03 ji/DZpFSbl1IPPke7jgEFZ9PdK/O6YKeog75CS5UE6HaHe0BkoK00s7cXzFyxy2rbT 4CHMg4jItEtvUd5j1DE6O+vX5jRncO5mZNpiOMmg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?utf-8?b?Sm9zw6kgRXhww7NzaXRv?= , Jiri Kosina Subject: [PATCH 5.19 713/717] HID: uclogic: Add missing suffix for digitalizers Date: Sat, 22 Oct 2022 09:29:52 +0200 Message-Id: <20221022072530.001085316@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747377175921670584?= X-GMAIL-MSGID: =?utf-8?q?1747377175921670584?= From: José Expósito commit 0977fda0587cbc5403651ba169e264aa01e8a026 upstream. The Pen (0x02) application usage was changed to Digitalizer (0x01) in commit f7d8e387d9ae ("HID: uclogic: Switch to Digitizer usage for styluses"). However, a suffix was not selected for the new usage. Handle the digitalizer application usage in uclogic_input_configured() and add the required suffix. Signed-off-by: José Expósito Signed-off-by: Jiri Kosina Signed-off-by: Greg Kroah-Hartman --- drivers/hid/hid-uclogic-core.c | 1 + 1 file changed, 1 insertion(+) --- a/drivers/hid/hid-uclogic-core.c +++ b/drivers/hid/hid-uclogic-core.c @@ -153,6 +153,7 @@ static int uclogic_input_configured(stru suffix = "Pad"; break; case HID_DG_PEN: + case HID_DG_DIGITIZER: suffix = "Pen"; break; case HID_CP_CONSUMER_CONTROL: From patchwork Sat Oct 22 07:29:53 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 7858 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1161046wrr; Sat, 22 Oct 2022 04:29:27 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6J9NZKNMZTv6PgTa4myIdHv1hvVE4tNTV5JsvqoSmO0r6TDvIZPT1Xku+VEr2JG2T2Vl9b X-Received: by 2002:a63:1a07:0:b0:46b:2825:f9cf with SMTP id a7-20020a631a07000000b0046b2825f9cfmr20911865pga.370.1666438166958; Sat, 22 Oct 2022 04:29:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666438166; cv=none; d=google.com; s=arc-20160816; b=F48Do68LUpYxVhGQn57iq2m4fx2vSnT5TYc7IU+yC9pNYGa+EZ5IXEBjAT5woAUGHU hkqLOTn5o3XQT2pwqRY6JJggpk+sFlwmMcD2sXfDaG+OX79spQcy9dL4PjwuWOrQjhMv lfFqNXFGaDqdxvJmFIooDDvahokK9Pc7IP+9UHJfHNBIt6p4Gt8Djzu66hWJ7+2SjFk+ 9IvBRpghLxoFwO9rSlKqf2mtDOugdw8AceJ3oXH2tl8CYLcbV5mQSZuA9TA3kQihTSSv 3BQncYtxRVytFBLHK6TCsE+JZRlxxghqO6ffW335Zf4W4HMRHrMDdXjIybPRaUlv/pGx /gYQ== 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=wX2bvX8XiJWQKJSflfkfFr19pfF+6o6PYMv0ztv4PYE=; b=nUiLdzGcy2rs12Gei5ZnjzuA1BUsgOQCqsgSKg795gJSd1cBZ4WR8B2j3cy1MAgoBH O4mO9sLg+JGH1+fRZ9//JjWcp/E3V4013WNLfgfWk3KY9vpC4hsip3LDaef/DqY8qeGy rbjGyllixBkGz7r/jhTJGH1UeSIucbu4KmcskgHTx6lVjBjwnJMrWuEXkOUCzBhYnHrV PBmYdObYGHQ1OK0Txge3gef68PafIJ1uN+vR5P3a6PgOOx6pbijjjGOzw8gRf9Pox34Z 0jVnmpHAp/W3RqHUbyeWUDzdSjAecuqtpXj0qdkKt791DCvWMpoAz3fW1tAMEd5tj2x7 Wywg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=dcNr+nr8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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-20020a056a0002c600b0056615a18b20si25699730pft.250.2022.10.22.04.29.14; Sat, 22 Oct 2022 04:29: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=dcNr+nr8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S230445AbiJVLTb (ORCPT + 99 others); Sat, 22 Oct 2022 07:19:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53350 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230255AbiJVLTD (ORCPT ); Sat, 22 Oct 2022 07:19: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 3CEFECA; Sat, 22 Oct 2022 03:46: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 D7979B82DFE; Sat, 22 Oct 2022 08:08:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 308BEC433C1; Sat, 22 Oct 2022 08:08:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666426090; bh=N8mowMvAqrmgwRPvaI4cyXf2wucadEu5438JlOL0RYk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dcNr+nr8JTmyT1Bs3f5WUcJCcZwR4qCMYYD22YD4oNydxaNXlDRbV3QDojpQ9Ag6i rww7djtT2/MfQFd3Uz7ndoa2NrGVWnqLpxqrV5DDgXQKmKQv9R/MAsZB/MwkLuC9iQ EFjR2psKk0EAMEv7F8NCQSZH5AHoH35wXl6xF9BI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jerry Lee , Theodore Tso Subject: [PATCH 5.19 714/717] ext4: continue to expand file system when the target size doesnt reach Date: Sat, 22 Oct 2022 09:29:53 +0200 Message-Id: <20221022072530.047462081@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 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?1747387067227785886?= X-GMAIL-MSGID: =?utf-8?q?1747387067227785886?= 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 @@ -2100,7 +2100,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 Sat Oct 22 07:29: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: 7751 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1113798wrr; Sat, 22 Oct 2022 02:04:44 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5x+4lIUz932KHu+cOBUVJSDNFlCAK50/6dL1tdo4A80SsA0ruTrFxrWelcy4R9SCtSnEgp X-Received: by 2002:a63:a5f:0:b0:46e:c9cf:e702 with SMTP id z31-20020a630a5f000000b0046ec9cfe702mr4474306pgk.198.1666429484137; Sat, 22 Oct 2022 02:04:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666429484; cv=none; d=google.com; s=arc-20160816; b=F6i6Cug9lT/h7dEypf428CAax6Wb6yE5Z9Ru8un/tlvy1flI6LPFrPuBhkB6J2G0xu Kw/GXKeOVdARbR7zjT4ag+CiVPdmSAVyQLQJW1hPQEBo6KMAKPUeUX8ng5fQf8jTs/jQ Eod6yTohWSHL0HeCDD9x8BUlpKmtDOGkzc5zqqTqKMLfl6FFYg+4J/M6CoI/s1gWz+tU /OBDZkv1D4KufQKp6lYSZ3bkBMaZKMRPAIaf8ILt4rxwpfpVWMab7pls6MMgWrzYmytO DoK1Ezf0t4zUciflWvheR5m9YmX4y9ufT5LbAcUolRNCj7ueZg/fHAtHW48AtK592EkM sr/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=2to1ioURcdvHsxBAdafFL1M/LwatrfPD9G9nU3C4g7E=; b=FGI2UQn4cjg2M37xyl6LeQzboPKqaMwgXY0pJdG5NT4LYq0tL9lUNKwNd77ghwhtkB kemKBvaOtoe0peZyElHGpHHBPoJ35ccVXqw5CpsIYZzPAx0IRqJSHrVHVKrKGHq62jdn lvBW7POPIijzkzcCOBF+ASMHsCf3/prvsuTR3oJv4PWEaGOuUbnnLD5vTF5Ul+T1XSAe UeD032K5qaDdlsLsFzBouNgfbEbOZGTIH9ZUqu3s+sou2jeHkgdeKlSHZuUR59yZu1Ig q2L6mORwnKz5GkpXjwxq8Xlr0W8SqASiwMGv/LxigEySNwgmqZ0yw20vDo9hi7vhErgt qvHg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=We9RWXtK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 n3-20020a632703000000b0043ac3ec9d9csi29227370pgn.758.2022.10.22.02.04.31; Sat, 22 Oct 2022 02:04: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=We9RWXtK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S234969AbiJVIzl (ORCPT + 99 others); Sat, 22 Oct 2022 04:55:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32988 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235184AbiJVIyl (ORCPT ); Sat, 22 Oct 2022 04:54:41 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DC3292F5844; Sat, 22 Oct 2022 01:13:37 -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 45B85B82E49; Sat, 22 Oct 2022 08:08:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 746A5C433D6; Sat, 22 Oct 2022 08:08:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666426093; bh=crSfYZdlpZpIdRFdSPKQ20saC6ktN5bPHpKGg0bi5tU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=We9RWXtKsE3dYEfDC8eVI7zTjixvCPN9zdbCvWIjqeuIqC2mUEfkTLdQAq5AQaSPv plFxdkV0hi9iY4+GMMn+AxegOLSfI7cLHWTraTsdok+yDUVkXlU2PauFxw28A6NQR2 6blr8OUAFuAFPnJJ3QgAwXqqgeV7/Ux90BcQOSu8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?utf-8?b?VmlsbGUgU3lyasOkbMOk?= , Jani Nikula Subject: [PATCH 5.19 715/717] drm/i915: Rename block_size()/block_offset() Date: Sat, 22 Oct 2022 09:29:54 +0200 Message-Id: <20221022072530.098549125@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747377963107093372?= X-GMAIL-MSGID: =?utf-8?q?1747377963107093372?= From: Ville Syrjälä commit 39b1bc4b5bcccac781267bb826b035fbb99c8b9d upstream. Give block_size()/block_offset() a "raw_" prefix since they both operate on the "raw" (as in not duplicated) BDB block contents. What actually spurred this was a conflict between intel_bios.c block_size() vs. block_size() from blkdev.h. That only happened to me on a custom tree where we somehow manage to include blkdev.h into intel_bios.c. But I think the rename makes sense anyway to clarify the purpose of these functions. Signed-off-by: Ville Syrjälä Link: https://patchwork.freedesktop.org/patch/msgid/20220519140010.10600-1-ville.syrjala@linux.intel.com Reviewed-by: Jani Nikula Signed-off-by: Greg Kroah-Hartman --- drivers/gpu/drm/i915/display/intel_bios.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) --- a/drivers/gpu/drm/i915/display/intel_bios.c +++ b/drivers/gpu/drm/i915/display/intel_bios.c @@ -123,7 +123,7 @@ find_raw_section(const void *_bdb, enum * Offset from the start of BDB to the start of the * block data (just past the block header). */ -static u32 block_offset(const void *bdb, enum bdb_block_id section_id) +static u32 raw_block_offset(const void *bdb, enum bdb_block_id section_id) { const void *block; @@ -135,7 +135,7 @@ static u32 block_offset(const void *bdb, } /* size of the block excluding the header */ -static u32 block_size(const void *bdb, enum bdb_block_id section_id) +static u32 raw_block_size(const void *bdb, enum bdb_block_id section_id) { const void *block; @@ -232,7 +232,7 @@ static bool validate_lfp_data_ptrs(const int data_block_size, lfp_data_size; int i; - data_block_size = block_size(bdb, BDB_LVDS_LFP_DATA); + data_block_size = raw_block_size(bdb, BDB_LVDS_LFP_DATA); if (data_block_size == 0) return false; @@ -309,7 +309,7 @@ static bool fixup_lfp_data_ptrs(const vo u32 offset; int i; - offset = block_offset(bdb, BDB_LVDS_LFP_DATA); + offset = raw_block_offset(bdb, BDB_LVDS_LFP_DATA); for (i = 0; i < 16; i++) { if (ptrs->ptr[i].fp_timing.offset < offset || From patchwork Sat Oct 22 07: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: 7739 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1110623wrr; Sat, 22 Oct 2022 01:53:30 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6Kdj7xALeSAJitY7R+rEs0KmYZ2D6rjI7Ut6FGH+9Qpg3mCDUFpsZD0F44wkKl5J0S2pqh X-Received: by 2002:a17:906:99c2:b0:78d:b5cf:419e with SMTP id s2-20020a17090699c200b0078db5cf419emr19398998ejn.673.1666428800061; Sat, 22 Oct 2022 01:53:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666428800; cv=none; d=google.com; s=arc-20160816; b=VdG1QymdpuBs/R/LAZwOp49Ih8klLVuzeE7zp2wyTw8h27ybnBt0t5eapb7+IbwP2S boS+N03e369tQ6cbtqN4vI6RV3dkCr1PU94Yv49TpDsvOV04UnxcBKbu5ddOeR6EiVlm hZHa3rn/DUjWPUdeP3A92f+Z2mqzklU6MmSum15glZODFXW6Bz3Ps76oGJwow5ZuH98F BNw/92qgMgpR+KDvPIqNaZJqM0fSqXWDr9KYlFc/v1E1rNxIZRDxgcLEgn6XMn+d9Lh3 kNOYXYYyQhXv/6byS/0RzMQRDEzYuHhc/I6B1+jvdvtMKN7Fyzz0s6VzuDglzRUCavnz JpHg== 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=kgd68feF0KaJ1rmNVkX9AXS8EHAm3W23WIdfHyav0kk=; b=v0ATFO4o/HORDmXl9EM3466HkvPje1T8FqM3xgOnTeqRAylzPYXKDJUkQS/VbdavJg 6T3+zrIPnrNV2UPO0KxCCmXuqtqo2LJCQqExDaaE8CwvvxcQSBTWrYQK8FCZLbByWqgv yrUe1wzYJg+Sze6Bh8rhAJzy/xQM1bx/RGsWVKLTXAyn387GroJrfIURex1MSBPHGbWs cr0QF+wSwE58CW/ANvAB7bfvttOTK/M13R0z2TV8a65GehZ+bjqvt2/r3VOKxRv64UVI 4ZTU160Le0abc1r3HNIt43fCrP0GlvTcypwo7CG3QAiN3sagZ9aKOgV9jbJ9+reV1PMQ tapw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=dq1o8u0X; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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-20020a056402518600b0045981993486si23503704edd.227.2022.10.22.01.52.56; Sat, 22 Oct 2022 01:53: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=dq1o8u0X; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S234650AbiJVIvs (ORCPT + 99 others); Sat, 22 Oct 2022 04:51:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37950 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234489AbiJVIuD (ORCPT ); Sat, 22 Oct 2022 04:50:03 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 201ED2E32FB; Sat, 22 Oct 2022 01:11: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 073E8B82E41; Sat, 22 Oct 2022 08:08:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 87003C433C1; Sat, 22 Oct 2022 08:08:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666426096; bh=W4/yh7xZQybObDims9YbWGLF6sS6IkZ+HBTqyatr0Ks=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dq1o8u0Xxln/upeRiNMYUy6wex7QfDE9zmMc2j0Hzft5laH+7dUnEYxz6T5tcr5UI d2GDFExlKCU0Q/cZIcglPC8zjPiC3RPxq0v/pfdkjTBTjVAHuOMO/iC9/7Hu9wR4kS WgJEZFSTnR4HRpy8JSJM9jagH+kX34Roj6gLZSnM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?utf-8?b?VmlsbGUgU3lyasOkbMOk?= , Jani Nikula Subject: [PATCH 5.19 716/717] drm/i915/bios: Validate fp_timing terminator presence Date: Sat, 22 Oct 2022 09:29:55 +0200 Message-Id: <20221022072530.138458717@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747377245508273953?= X-GMAIL-MSGID: =?utf-8?q?1747377245508273953?= From: Ville Syrjälä commit 4e78d6023c15c6acce8fbe42e13027c460395522 upstream. Validate the LFP data block a bit hardwer by making sure the fp_timing terminators (0xffff) are where we expect them to be. Signed-off-by: Ville Syrjälä Link: https://patchwork.freedesktop.org/patch/msgid/20220818192223.29881-2-ville.syrjala@linux.intel.com Reviewed-by: Jani Nikula Signed-off-by: Greg Kroah-Hartman --- drivers/gpu/drm/i915/display/intel_bios.c | 60 ++++++++++++++++-------------- 1 file changed, 32 insertions(+), 28 deletions(-) --- a/drivers/gpu/drm/i915/display/intel_bios.c +++ b/drivers/gpu/drm/i915/display/intel_bios.c @@ -134,18 +134,6 @@ static u32 raw_block_offset(const void * return block - bdb; } -/* size of the block excluding the header */ -static u32 raw_block_size(const void *bdb, enum bdb_block_id section_id) -{ - const void *block; - - block = find_raw_section(bdb, section_id); - if (!block) - return 0; - - return get_blocksize(block); -} - struct bdb_block_entry { struct list_head node; enum bdb_block_id section_id; @@ -230,9 +218,14 @@ static bool validate_lfp_data_ptrs(const { int fp_timing_size, dvo_timing_size, panel_pnp_id_size, panel_name_size; int data_block_size, lfp_data_size; + const void *data_block; int i; - data_block_size = raw_block_size(bdb, BDB_LVDS_LFP_DATA); + data_block = find_raw_section(bdb, BDB_LVDS_LFP_DATA); + if (!data_block) + return false; + + data_block_size = get_blocksize(data_block); if (data_block_size == 0) return false; @@ -260,21 +253,6 @@ static bool validate_lfp_data_ptrs(const if (16 * lfp_data_size > data_block_size) return false; - /* - * Except for vlv/chv machines all real VBTs seem to have 6 - * unaccounted bytes in the fp_timing table. And it doesn't - * appear to be a really intentional hole as the fp_timing - * 0xffff terminator is always within those 6 missing bytes. - */ - if (fp_timing_size + dvo_timing_size + panel_pnp_id_size != lfp_data_size && - fp_timing_size + 6 + dvo_timing_size + panel_pnp_id_size != lfp_data_size) - return false; - - if (ptrs->ptr[0].fp_timing.offset + fp_timing_size > ptrs->ptr[0].dvo_timing.offset || - ptrs->ptr[0].dvo_timing.offset + dvo_timing_size != ptrs->ptr[0].panel_pnp_id.offset || - ptrs->ptr[0].panel_pnp_id.offset + panel_pnp_id_size != lfp_data_size) - return false; - /* make sure the table entries have uniform size */ for (i = 1; i < 16; i++) { if (ptrs->ptr[i].fp_timing.table_size != fp_timing_size || @@ -288,6 +266,23 @@ static bool validate_lfp_data_ptrs(const return false; } + /* + * Except for vlv/chv machines all real VBTs seem to have 6 + * unaccounted bytes in the fp_timing table. And it doesn't + * appear to be a really intentional hole as the fp_timing + * 0xffff terminator is always within those 6 missing bytes. + */ + if (fp_timing_size + 6 + dvo_timing_size + panel_pnp_id_size == lfp_data_size) + fp_timing_size += 6; + + if (fp_timing_size + dvo_timing_size + panel_pnp_id_size != lfp_data_size) + return false; + + if (ptrs->ptr[0].fp_timing.offset + fp_timing_size != ptrs->ptr[0].dvo_timing.offset || + ptrs->ptr[0].dvo_timing.offset + dvo_timing_size != ptrs->ptr[0].panel_pnp_id.offset || + ptrs->ptr[0].panel_pnp_id.offset + panel_pnp_id_size != lfp_data_size) + return false; + /* make sure the tables fit inside the data block */ for (i = 0; i < 16; i++) { if (ptrs->ptr[i].fp_timing.offset + fp_timing_size > data_block_size || @@ -299,6 +294,15 @@ static bool validate_lfp_data_ptrs(const if (ptrs->panel_name.offset + 16 * panel_name_size > data_block_size) return false; + /* make sure fp_timing terminators are present at expected locations */ + for (i = 0; i < 16; i++) { + const u16 *t = data_block + ptrs->ptr[i].fp_timing.offset + + fp_timing_size - 2; + + if (*t != 0xffff) + return false; + } + return true; } From patchwork Sat Oct 22 07: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: 7726 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1109991wrr; Sat, 22 Oct 2022 01:50:55 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7ZQnQal95yoBx8BDCDvxwjhY2MJO6XJ/zIz1RTocvpffL99N/Qvbo3RWUdxIjarJjEqW7I X-Received: by 2002:a17:907:2672:b0:780:8bb5:25a3 with SMTP id ci18-20020a170907267200b007808bb525a3mr19038989ejc.281.1666428654935; Sat, 22 Oct 2022 01:50:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666428654; cv=none; d=google.com; s=arc-20160816; b=AoZF8gUYST8e+9/fMZ4GmmDRpxekBRvFFVtW28s8scQACLlHnBN+ShQiAQfNIfZJEs eWKHjdXQCR/leApCKEOZ5H421ahU4SvrEk9kLmt99MoJXihdv/X0D55QJxBIYIw1BcVu j+40Sfw8Ro+PROwY2IMc11CIkFjJA3Tx92yJJYPAbXwZ7tXqs1oBdTV8KY7U1jdHg2vk 8gJzPE0iZDda0MSK4VUTV2OUH8tnO+U59jiuZMM/4+NK1Nnl7Qa4gca90hO+YojfhE5A k99ZFubrxkKdDTRU3XxHHVyY4lPh4fku1a6kkNQjW3AFocDVT4R8XKsp2W2El711PXT2 sVgQ== 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=IjRRUEB+Bnbq35RV7IE4rzQu3SWESDd+oB+oVykpXV0=; b=aeQZ00IlvoD4i5br1bRDq/mEBzGpxbtjE2Yp70ly+az3iEDGQkbCbdlEO8JSS+qwQQ 1VUFklS89TlrxgLYh59xjH35riWcxmYnkuRqqhSILXJyK+sXfWEPFgF2xgSEcWOdD8sb vvBET4IUj35cxZdm7QWiJLhdpAyvzIIrufgWXN9lKD0LNR8LXj2WNZeo2LgPck5cUVbI AH9DzdAsqbibexxI8ITr+Q7VJSTCFTy531fHA4PRuoP+PWPYK0F5sOcAz5lqBKHgrTjL A8owhSS4tDK8YHPECNSr4yyy6yziDdNt4UHC0Nm23YWtdHgNTTby1HJNY+GhiWo4MT7Z uKVA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=SnbUCUvn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 ce12-20020a170906b24c00b0073d9c29892csi18201791ejb.939.2022.10.22.01.50.30; Sat, 22 Oct 2022 01:50: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=SnbUCUvn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S234940AbiJVItM (ORCPT + 99 others); Sat, 22 Oct 2022 04:49:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41742 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234649AbiJVIrW (ORCPT ); Sat, 22 Oct 2022 04:47: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 25FC85D72D; Sat, 22 Oct 2022 01:10: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 1422C60ACE; Sat, 22 Oct 2022 08:08:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 04ECAC433D7; Sat, 22 Oct 2022 08:08:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666426121; bh=5NlSRbXHvRb/aa25XM64BKUcWStHvdySzp+8NaPB+vM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SnbUCUvnocpG6weh1QFoJNa9EwTTOpgn4HfF90TyH3Z49tUJnYY/26z69NjYO2Lxg cXykfx23bTX2qWgKcskLKtJ46Dxzq4QhsHlfcv0BTtOIBF9PlJSsqRavPHZXb7js3D 0+m6v59KxboE07AmBrfrcp7+VuT1Q2OwkjowjMXQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?utf-8?b?VmlsbGUgU3lyasOkbMOk?= , Jani Nikula Subject: [PATCH 5.19 717/717] drm/i915/bios: Use hardcoded fp_timing size for generating LFP data pointers Date: Sat, 22 Oct 2022 09:29:56 +0200 Message-Id: <20221022072530.179352316@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747377093374136202?= X-GMAIL-MSGID: =?utf-8?q?1747377093374136202?= From: Ville Syrjälä commit d3a7051841f0a4bcb1ee26a1b721c6150cc4c2b1 upstream. The current scheme for generating the LFP data table pointers (when the block including them is missing from the VBT) expects the 0xffff sequence to only appear in the fp_timing terminator entries. However some VBTs also have extra 0xffff sequences elsewhere in the LFP data. When looking for the terminators we may end up finding those extra sequeneces insted, which means we deduce the wrong size for the fp_timing table. The code then notices the inconsistent looking values and gives up on the generated data table pointers, preventing us from parsing the LFP data table entirely. Let's give up on the "search for the terminators" approach and instead just hardcode the expected size for the fp_timing table. We have enough sanity checks in place to make sure we shouldn't end up parsing total garbage even if that size should change in the future (although that seems unlikely as the fp_timing and dvo_timing tables have been declared obsolete as of VBT version 229). Closes: https://gitlab.freedesktop.org/drm/intel/-/issues/6592 Signed-off-by: Ville Syrjälä Link: https://patchwork.freedesktop.org/patch/msgid/20220818192223.29881-3-ville.syrjala@linux.intel.com Reviewed-by: Jani Nikula Signed-off-by: Greg Kroah-Hartman --- drivers/gpu/drm/i915/display/intel_bios.c | 46 +++++++++++------------------- 1 file changed, 18 insertions(+), 28 deletions(-) --- a/drivers/gpu/drm/i915/display/intel_bios.c +++ b/drivers/gpu/drm/i915/display/intel_bios.c @@ -336,18 +336,6 @@ static bool fixup_lfp_data_ptrs(const vo return validate_lfp_data_ptrs(bdb, ptrs); } -static const void *find_fp_timing_terminator(const u8 *data, int size) -{ - int i; - - for (i = 0; i < size - 1; i++) { - if (data[i] == 0xff && data[i+1] == 0xff) - return &data[i]; - } - - return NULL; -} - static int make_lfp_data_ptr(struct lvds_lfp_data_ptr_table *table, int table_size, int total_size) { @@ -371,11 +359,22 @@ static void next_lfp_data_ptr(struct lvd static void *generate_lfp_data_ptrs(struct drm_i915_private *i915, const void *bdb) { - int i, size, table_size, block_size, offset; - const void *t0, *t1, *block; + int i, size, table_size, block_size, offset, fp_timing_size; struct bdb_lvds_lfp_data_ptrs *ptrs; + const void *block; void *ptrs_block; + /* + * The hardcoded fp_timing_size is only valid for + * modernish VBTs. All older VBTs definitely should + * include block 41 and thus we don't need to + * generate one. + */ + if (i915->vbt.version < 155) + return NULL; + + fp_timing_size = 38; + block = find_raw_section(bdb, BDB_LVDS_LFP_DATA); if (!block) return NULL; @@ -384,17 +383,8 @@ static void *generate_lfp_data_ptrs(stru block_size = get_blocksize(block); - size = block_size; - t0 = find_fp_timing_terminator(block, size); - if (!t0) - return NULL; - - size -= t0 - block - 2; - t1 = find_fp_timing_terminator(t0 + 2, size); - if (!t1) - return NULL; - - size = t1 - t0; + size = fp_timing_size + sizeof(struct lvds_dvo_timing) + + sizeof(struct lvds_pnp_id); if (size * 16 > block_size) return NULL; @@ -412,7 +402,7 @@ static void *generate_lfp_data_ptrs(stru table_size = sizeof(struct lvds_dvo_timing); size = make_lfp_data_ptr(&ptrs->ptr[0].dvo_timing, table_size, size); - table_size = t0 - block + 2; + table_size = fp_timing_size; size = make_lfp_data_ptr(&ptrs->ptr[0].fp_timing, table_size, size); if (ptrs->ptr[0].fp_timing.table_size) @@ -427,14 +417,14 @@ static void *generate_lfp_data_ptrs(stru return NULL; } - size = t1 - t0; + size = fp_timing_size + sizeof(struct lvds_dvo_timing) + + sizeof(struct lvds_pnp_id); for (i = 1; i < 16; i++) { next_lfp_data_ptr(&ptrs->ptr[i].fp_timing, &ptrs->ptr[i-1].fp_timing, size); next_lfp_data_ptr(&ptrs->ptr[i].dvo_timing, &ptrs->ptr[i-1].dvo_timing, size); next_lfp_data_ptr(&ptrs->ptr[i].panel_pnp_id, &ptrs->ptr[i-1].panel_pnp_id, size); } - size = t1 - t0; table_size = sizeof(struct lvds_lfp_panel_name); if (16 * (size + table_size) <= block_size) {